diff --git a/.pick_status.json b/.pick_status.json index 371d31244b6..919f616845f 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -15964,7 +15964,7 @@ "description": "kk: Move gfx pipeline data to the info struct within kk_shader", "nominated": false, "nomination_type": 0, - "resolution": 4, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/kosmickrisp/vulkan/kk_shader.c b/src/kosmickrisp/vulkan/kk_shader.c index 70228629a1f..af8182f643e 100644 --- a/src/kosmickrisp/vulkan/kk_shader.c +++ b/src/kosmickrisp/vulkan/kk_shader.c @@ -971,7 +971,7 @@ kk_compile_graphics_pipeline(struct kk_device *device, pipeline_descriptor, max_amplification); } - vertex_shader->pipeline.gfx.sample_count = 1u; + vertex_shader->info.vs.sample_count = 1u; if (state->ms) { mtl_render_pipeline_descriptor_set_raster_sample_count( pipeline_descriptor, state->ms->rasterization_samples); @@ -979,15 +979,14 @@ kk_compile_graphics_pipeline(struct kk_device *device, pipeline_descriptor, state->ms->alpha_to_coverage_enable); mtl_render_pipeline_descriptor_set_alpha_to_one( pipeline_descriptor, state->ms->alpha_to_one_enable); - vertex_shader->pipeline.gfx.sample_count = - state->ms->rasterization_samples; + vertex_shader->info.vs.sample_count = state->ms->rasterization_samples; } vertex_shader->pipeline.gfx.handle = mtl_new_render_pipeline(device->mtl_handle, pipeline_descriptor); if (vertex_shader->pipeline.gfx.handle == NULL) result = VK_ERROR_INVALID_SHADER_NV; - vertex_shader->pipeline.gfx.primitive_type = + vertex_shader->info.vs.primitive_type = vk_primitive_topology_to_mtl_primitive_type( state->ia->primitive_topology); @@ -1214,7 +1213,7 @@ kk_cmd_bind_graphics_shader(struct kk_cmd_buffer *cmd, if (stage != MESA_SHADER_VERTEX) return; - cmd->state.gfx.primitive_type = shader->pipeline.gfx.primitive_type; + cmd->state.gfx.primitive_type = shader->info.vs.primitive_type; cmd->state.gfx.pipeline_state = shader->pipeline.gfx.handle; cmd->state.gfx.vb.attribs_read = shader->info.vs.attribs_read; @@ -1237,7 +1236,7 @@ kk_cmd_bind_graphics_shader(struct kk_cmd_buffer *cmd, cmd->state.gfx.dirty |= KK_DIRTY_PIPELINE; cmd->state.gfx.dirty |= KK_DIRTY_VB; - cmd->state.gfx.sample_count = shader->pipeline.gfx.sample_count; + cmd->state.gfx.sample_count = shader->info.vs.sample_count; } static void diff --git a/src/kosmickrisp/vulkan/kk_shader.h b/src/kosmickrisp/vulkan/kk_shader.h index 207bab524a7..d23eef1eb85 100644 --- a/src/kosmickrisp/vulkan/kk_shader.h +++ b/src/kosmickrisp/vulkan/kk_shader.h @@ -18,8 +18,14 @@ struct kk_shader_info { mesa_shader_stage stage; union { + /* Vertex shader is the pipeline, store all relevant data here. */ struct { + /* Data needed to start render pass and bind pipeline. */ uint32_t attribs_read; + uint32_t sample_count; + enum mtl_primitive_type primitive_type; + + /* Data needed for serialization. */ } vs; struct { @@ -30,23 +36,21 @@ struct kk_shader_info { struct kk_shader { struct vk_shader vk; - const char *entrypoint_name; - const char *msl_code; - struct kk_shader_info info; - - /* Pipeline resources. Only stored in compute or vertex shaders */ + /* Metal handles for binding. */ struct { union { struct { mtl_render_pipeline_state *handle; mtl_depth_stencil_state *mtl_depth_stencil_state_handle; - enum mtl_primitive_type primitive_type; - uint32_t sample_count; } gfx; mtl_compute_pipeline_state *cs; }; } pipeline; + + struct kk_shader_info info; + const char *entrypoint_name; + const char *msl_code; }; VK_DEFINE_NONDISP_HANDLE_CASTS(kk_shader, vk.base, VkShaderEXT,