@@ -1488,7 +1488,7 @@ void R_CreateDescriptorSetLayouts ()
14881488 }
14891489
14901490 {
1491- ZEROED_STRUCT_ARRAY (VkDescriptorSetLayoutBinding , indirect_compute_layout_bindings , 4 );
1491+ ZEROED_STRUCT_ARRAY (VkDescriptorSetLayoutBinding , indirect_compute_layout_bindings , 6 );
14921492 indirect_compute_layout_bindings [0 ].binding = 0 ;
14931493 indirect_compute_layout_bindings [0 ].descriptorCount = 1 ;
14941494 indirect_compute_layout_bindings [0 ].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER ;
@@ -1505,19 +1505,50 @@ void R_CreateDescriptorSetLayouts ()
15051505 indirect_compute_layout_bindings [3 ].descriptorCount = 1 ;
15061506 indirect_compute_layout_bindings [3 ].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER ;
15071507 indirect_compute_layout_bindings [3 ].stageFlags = VK_SHADER_STAGE_COMPUTE_BIT ;
1508+ indirect_compute_layout_bindings [4 ].binding = 4 ;
1509+ indirect_compute_layout_bindings [4 ].descriptorCount = 1 ;
1510+ indirect_compute_layout_bindings [4 ].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER ;
1511+ indirect_compute_layout_bindings [4 ].stageFlags = VK_SHADER_STAGE_COMPUTE_BIT ;
1512+ indirect_compute_layout_bindings [5 ].binding = 5 ;
1513+ indirect_compute_layout_bindings [5 ].descriptorCount = 1 ;
1514+ indirect_compute_layout_bindings [5 ].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER ;
1515+ indirect_compute_layout_bindings [5 ].stageFlags = VK_SHADER_STAGE_COMPUTE_BIT ;
15081516
15091517 descriptor_set_layout_create_info .bindingCount = countof (indirect_compute_layout_bindings );
15101518 descriptor_set_layout_create_info .pBindings = indirect_compute_layout_bindings ;
15111519
15121520 memset (& vulkan_globals .indirect_compute_set_layout , 0 , sizeof (vulkan_globals .indirect_compute_set_layout ));
1513- vulkan_globals .indirect_compute_set_layout .num_storage_buffers = 4 ;
1521+ vulkan_globals .indirect_compute_set_layout .num_storage_buffers = 6 ;
15141522
15151523 err = vkCreateDescriptorSetLayout (vulkan_globals .device , & descriptor_set_layout_create_info , NULL , & vulkan_globals .indirect_compute_set_layout .handle );
15161524 if (err != VK_SUCCESS )
15171525 Sys_Error ("vkCreateDescriptorSetLayout failed with code %i" , (int )err );
15181526 GL_SetObjectName ((uint64_t )vulkan_globals .indirect_compute_set_layout .handle , VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT , "indirect compute" );
15191527 }
15201528
1529+ {
1530+ ZEROED_STRUCT_ARRAY (VkDescriptorSetLayoutBinding , bmodel_instances_layout_bindings , 2 );
1531+ bmodel_instances_layout_bindings [0 ].binding = 0 ;
1532+ bmodel_instances_layout_bindings [0 ].descriptorCount = 1 ;
1533+ bmodel_instances_layout_bindings [0 ].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER ;
1534+ bmodel_instances_layout_bindings [0 ].stageFlags = VK_SHADER_STAGE_VERTEX_BIT ;
1535+ bmodel_instances_layout_bindings [1 ].binding = 1 ;
1536+ bmodel_instances_layout_bindings [1 ].descriptorCount = 1 ;
1537+ bmodel_instances_layout_bindings [1 ].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER ;
1538+ bmodel_instances_layout_bindings [1 ].stageFlags = VK_SHADER_STAGE_VERTEX_BIT ;
1539+
1540+ descriptor_set_layout_create_info .bindingCount = countof (bmodel_instances_layout_bindings );
1541+ descriptor_set_layout_create_info .pBindings = bmodel_instances_layout_bindings ;
1542+
1543+ memset (& vulkan_globals .bmodel_instances_set_layout , 0 , sizeof (vulkan_globals .bmodel_instances_set_layout ));
1544+ vulkan_globals .bmodel_instances_set_layout .num_storage_buffers = 2 ;
1545+
1546+ err = vkCreateDescriptorSetLayout (vulkan_globals .device , & descriptor_set_layout_create_info , NULL , & vulkan_globals .bmodel_instances_set_layout .handle );
1547+ if (err != VK_SUCCESS )
1548+ Sys_Error ("vkCreateDescriptorSetLayout failed with code %i" , (int )err );
1549+ GL_SetObjectName ((uint64_t )vulkan_globals .bmodel_instances_set_layout .handle , VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT , "bmodel instances" );
1550+ }
1551+
15211552 if (vulkan_globals .ray_query )
15221553 {
15231554 ZEROED_STRUCT (VkDescriptorSetLayoutBinding , ray_query_push_layout_binding );
@@ -1616,7 +1647,7 @@ void R_CreatePipelineLayouts ()
16161647
16171648 ZEROED_STRUCT (VkPushConstantRange , push_constant_range );
16181649 push_constant_range .offset = 0 ;
1619- push_constant_range .size = 21 * sizeof (float );
1650+ push_constant_range .size = 22 * sizeof (float );
16201651 push_constant_range .stageFlags = VK_SHADER_STAGE_ALL_GRAPHICS ;
16211652
16221653 ZEROED_STRUCT (VkPipelineLayoutCreateInfo , pipeline_layout_create_info );
@@ -1636,13 +1667,13 @@ void R_CreatePipelineLayouts ()
16361667
16371668 {
16381669 // World
1639- VkDescriptorSetLayout world_descriptor_set_layouts [4 ] = {
1670+ VkDescriptorSetLayout world_descriptor_set_layouts [5 ] = {
16401671 vulkan_globals .single_texture_set_layout .handle , vulkan_globals .single_texture_set_layout .handle , vulkan_globals .single_texture_set_layout .handle ,
1641- vulkan_globals .mboit_input_attachment_set_layout .handle };
1672+ vulkan_globals .mboit_input_attachment_set_layout .handle , vulkan_globals . bmodel_instances_set_layout . handle };
16421673
16431674 ZEROED_STRUCT (VkPushConstantRange , push_constant_range );
16441675 push_constant_range .offset = 0 ;
1645- push_constant_range .size = 21 * sizeof (float );
1676+ push_constant_range .size = 22 * sizeof (float );
16461677 push_constant_range .stageFlags = VK_SHADER_STAGE_ALL_GRAPHICS ;
16471678
16481679 ZEROED_STRUCT (VkPipelineLayoutCreateInfo , pipeline_layout_create_info );
@@ -1668,7 +1699,7 @@ void R_CreatePipelineLayouts ()
16681699
16691700 ZEROED_STRUCT (VkPushConstantRange , push_constant_range );
16701701 push_constant_range .offset = 0 ;
1671- push_constant_range .size = 21 * sizeof (float );
1702+ push_constant_range .size = 22 * sizeof (float );
16721703 push_constant_range .stageFlags = VK_SHADER_STAGE_ALL_GRAPHICS ;
16731704
16741705 ZEROED_STRUCT (VkPipelineLayoutCreateInfo , pipeline_layout_create_info );
@@ -1696,7 +1727,7 @@ void R_CreatePipelineLayouts ()
16961727
16971728 ZEROED_STRUCT (VkPushConstantRange , push_constant_range );
16981729 push_constant_range .offset = 0 ;
1699- push_constant_range .size = 21 * sizeof (float );
1730+ push_constant_range .size = 22 * sizeof (float );
17001731 push_constant_range .stageFlags = VK_SHADER_STAGE_ALL_GRAPHICS ;
17011732
17021733 ZEROED_STRUCT (VkPipelineLayoutCreateInfo , pipeline_layout_create_info );
@@ -1953,7 +1984,7 @@ void R_CreatePipelineLayouts ()
19531984
19541985 ZEROED_STRUCT (VkPushConstantRange , push_constant_range );
19551986 push_constant_range .offset = 0 ;
1956- push_constant_range .size = 6 * sizeof (uint32_t );
1987+ push_constant_range .size = 7 * sizeof (uint32_t );
19571988 push_constant_range .stageFlags = VK_SHADER_STAGE_COMPUTE_BIT ;
19581989
19591990 ZEROED_STRUCT (VkPipelineLayoutCreateInfo , pipeline_layout_create_info );
@@ -3168,17 +3199,20 @@ static void R_CreateShowTrisPipelines ()
31683199 infos .input_assembly_state .topology = VK_PRIMITIVE_TOPOLOGY_LINE_LIST ;
31693200 R_CreateGraphicsPipeline (& vulkan_globals .showbboxes_pipeline [variant ], & infos , vulkan_globals .basic_pipeline_layout , va ("showbboxes%s" , pass_suffix ));
31703201
3202+ // indirect showtris uses the world vertex shader so moved submodels get their instance transform applied
31713203 R_CopyPipelineCreateInfos (& infos , & base );
31723204 infos .graphics_pipeline .renderPass = render_pass ;
3205+ infos .shader_stages [0 ].module = world_vert_module ;
31733206 infos .vertex_input_state .vertexAttributeDescriptionCount = 3 ;
31743207 infos .vertex_input_state .pVertexAttributeDescriptions = world_vertex_input_attribute_descriptions ;
31753208 infos .vertex_input_state .vertexBindingDescriptionCount = 1 ;
31763209 infos .vertex_input_state .pVertexBindingDescriptions = & world_vertex_binding_description ;
31773210 R_CreateGraphicsPipeline (
3178- & vulkan_globals .showtris_indirect_pipeline [variant ], & infos , vulkan_globals .basic_pipeline_layout , va ("showtris_indirect%s" , pass_suffix ));
3211+ & vulkan_globals .showtris_indirect_pipeline [variant ], & infos , vulkan_globals .world_pipeline_layout , va ("showtris_indirect%s" , pass_suffix ));
31793212
31803213 R_CopyPipelineCreateInfos (& infos , & base );
31813214 infos .graphics_pipeline .renderPass = render_pass ;
3215+ infos .shader_stages [0 ].module = world_vert_module ;
31823216 infos .vertex_input_state .vertexAttributeDescriptionCount = 3 ;
31833217 infos .vertex_input_state .pVertexAttributeDescriptions = world_vertex_input_attribute_descriptions ;
31843218 infos .vertex_input_state .vertexBindingDescriptionCount = 1 ;
@@ -3188,7 +3222,7 @@ static void R_CreateShowTrisPipelines ()
31883222 infos .rasterization_state .depthBiasConstantFactor = 500.0f ;
31893223 infos .rasterization_state .depthBiasSlopeFactor = 0.0f ;
31903224 R_CreateGraphicsPipeline (
3191- & vulkan_globals .showtris_indirect_depth_test_pipeline [variant ], & infos , vulkan_globals .basic_pipeline_layout ,
3225+ & vulkan_globals .showtris_indirect_depth_test_pipeline [variant ], & infos , vulkan_globals .world_pipeline_layout ,
31923226 va ("showtris_indirect_depth_test%s" , pass_suffix ));
31933227 }
31943228}
0 commit comments