mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-12-28 09:23:34 +00:00
VK: add cull mode and front face (#1789)
This commit is contained in:
parent
c4733a6eab
commit
28366d35d2
@ -14,6 +14,7 @@ namespace vk
|
||||
VkFormat get_compatible_depth_surface_format(const gpu_formats_support &support, rsx::surface_depth_format format);
|
||||
VkStencilOp get_stencil_op(u32 op);
|
||||
VkLogicOp get_logic_op(u32 op);
|
||||
VkFrontFace get_front_face_ccw(u32 ffv);
|
||||
|
||||
std::tuple<VkFilter, VkSamplerMipmapMode> get_min_filter_and_mip(rsx::texture_minify_filter min_filter);
|
||||
VkFilter get_mag_filter(rsx::texture_magnify_filter mag_filter);
|
||||
|
@ -258,6 +258,17 @@ namespace vk
|
||||
throw EXCEPTION("Unknown stencil op: 0x%X", op);
|
||||
}
|
||||
}
|
||||
|
||||
VkFrontFace get_front_face_ccw(u32 ffv)
|
||||
{
|
||||
switch (ffv)
|
||||
{
|
||||
case CELL_GCM_CW: return VK_FRONT_FACE_CLOCKWISE;
|
||||
case CELL_GCM_CCW: return VK_FRONT_FACE_COUNTER_CLOCKWISE;
|
||||
default:
|
||||
throw EXCEPTION("Unknown front face value: 0x%X", ffv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -979,6 +990,29 @@ bool VKGSRender::load_program()
|
||||
else
|
||||
properties.ds.depthTestEnable = VK_FALSE;
|
||||
|
||||
if (!!rsx::method_registers[NV4097_SET_CULL_FACE_ENABLE])
|
||||
{
|
||||
switch (rsx::method_registers[NV4097_SET_CULL_FACE])
|
||||
{
|
||||
case CELL_GCM_FRONT:
|
||||
properties.rs.cullMode = VK_CULL_MODE_FRONT_BIT;
|
||||
break;
|
||||
case CELL_GCM_BACK:
|
||||
properties.rs.cullMode = VK_CULL_MODE_BACK_BIT;
|
||||
break;
|
||||
case CELL_GCM_FRONT_AND_BACK:
|
||||
properties.rs.cullMode = VK_CULL_MODE_FRONT_AND_BACK;
|
||||
break;
|
||||
default:
|
||||
properties.rs.cullMode = VK_CULL_MODE_NONE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
properties.rs.cullMode = VK_CULL_MODE_NONE;
|
||||
|
||||
properties.rs.frontFace = vk::get_front_face_ccw(rsx::method_registers[NV4097_SET_FRONT_FACE]);
|
||||
|
||||
size_t idx = vk::get_render_pass_location(
|
||||
vk::get_compatible_surface_format(m_surface.color_format).first,
|
||||
vk::get_compatible_depth_surface_format(m_optimal_tiling_supported_formats, m_surface.depth_format),
|
||||
|
@ -12,7 +12,8 @@ namespace vk
|
||||
VkPipelineDepthStencilStateCreateInfo ds;
|
||||
VkPipelineColorBlendAttachmentState att_state[4];
|
||||
VkPipelineColorBlendStateCreateInfo cs;
|
||||
|
||||
VkPipelineRasterizationStateCreateInfo rs;
|
||||
|
||||
VkRenderPass render_pass;
|
||||
int num_targets;
|
||||
|
||||
@ -24,6 +25,10 @@ namespace vk
|
||||
return false;
|
||||
if (memcmp(&att_state[0], &other.att_state[0], sizeof(VkPipelineColorBlendAttachmentState)))
|
||||
return false;
|
||||
if (memcmp(&cs, &other.cs, sizeof(VkPipelineColorBlendStateCreateInfo)))
|
||||
return false;
|
||||
if (memcmp(&rs, &other.rs, sizeof(VkPipelineRasterizationStateCreateInfo)))
|
||||
return false;
|
||||
return num_targets == other.num_targets;
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user