gpu: handle primitive restart index register (#438)

This commit is contained in:
Vinicius Rangel 2024-08-15 09:43:27 -03:00 committed by GitHub
parent a0fb47b0ab
commit d45563f92c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 9 additions and 2 deletions

View file

@ -86,8 +86,10 @@ GraphicsPipeline::GraphicsPipeline(const Instance& instance_, Scheduler& schedul
const vk::PipelineInputAssemblyStateCreateInfo input_assembly = {
.topology = LiverpoolToVK::PrimitiveType(key.prim_type),
.primitiveRestartEnable = false,
.primitiveRestartEnable = key.prim_restart_index != 0,
};
ASSERT_MSG(key.prim_restart_index == 0 || key.prim_restart_index == 0xFFFF,
"Primitive restart index other than 0xFFFF is not supported");
const vk::PipelineRasterizationStateCreateInfo raster_state = {
.depthClampEnable = false,

View file

@ -39,6 +39,7 @@ struct GraphicsPipelineKey {
Liverpool::StencilRefMask stencil_ref_front;
Liverpool::StencilRefMask stencil_ref_back;
Liverpool::PrimitiveType prim_type;
u32 prim_restart_index;
Liverpool::PolygonMode polygon_mode;
Liverpool::CullMode cull_mode;
Liverpool::FrontFace front_face;

View file

@ -165,6 +165,7 @@ void PipelineCache::RefreshGraphicsKey() {
key.stencil_ref_front = regs.stencil_ref_front;
key.stencil_ref_back = regs.stencil_ref_back;
key.prim_type = regs.primitive_type;
key.prim_restart_index = regs.primitive_reset_index;
key.polygon_mode = regs.polygon_control.PolyMode();
key.cull_mode = regs.polygon_control.CullingMode();
key.clip_space = regs.clipper_control.clip_space;