radeon_check_space(cmd_buffer->device->ws, cmd_buffer->cs, pipeline->base.cs.cdw);
radeon_emit_array(cmd_buffer->cs, pipeline->base.cs.buf, pipeline->base.cs.cdw);
- cmd_buffer->compute_scratch_size_per_wave_needed =
- MAX2(cmd_buffer->compute_scratch_size_per_wave_needed, pipeline->base.scratch_bytes_per_wave);
- cmd_buffer->compute_scratch_waves_wanted = MAX2(cmd_buffer->compute_scratch_waves_wanted, pipeline->base.max_waves);
-
if (pipeline->base.type == RADV_PIPELINE_COMPUTE) {
radv_cs_add_buffer(cmd_buffer->device->ws, cmd_buffer->cs, cmd_buffer->state.shaders[MESA_SHADER_COMPUTE]->bo);
} else {
cmd_buffer->task_rings_needed = true;
}
+#define RADV_GRAPHICS_STAGES \
+ (VK_SHADER_STAGE_ALL_GRAPHICS | VK_SHADER_STAGE_MESH_BIT_EXT | VK_SHADER_STAGE_TASK_BIT_EXT)
+
/* This function binds/unbinds a shader to the cmdbuffer state. */
static void
radv_bind_shader(struct radv_cmd_buffer *cmd_buffer, struct radv_shader *shader, gl_shader_stage stage)
{
+ const struct radv_device *device = cmd_buffer->device;
+
if (!shader) {
cmd_buffer->state.shaders[stage] = NULL;
cmd_buffer->state.active_stages &= ~mesa_to_vk_shader_stage(stage);
case MESA_SHADER_TASK:
radv_bind_task_shader(cmd_buffer, shader);
break;
- case MESA_SHADER_COMPUTE:
+ case MESA_SHADER_COMPUTE: {
+ cmd_buffer->compute_scratch_size_per_wave_needed =
+ MAX2(cmd_buffer->compute_scratch_size_per_wave_needed, shader->config.scratch_bytes_per_wave);
+
+ const unsigned max_stage_waves = radv_get_max_scratch_waves(device, shader);
+ cmd_buffer->compute_scratch_waves_wanted = MAX2(cmd_buffer->compute_scratch_waves_wanted, max_stage_waves);
+ break;
+ }
case MESA_SHADER_INTERSECTION:
/* no-op */
break;
cmd_buffer->state.shaders[stage] = shader;
cmd_buffer->state.active_stages |= mesa_to_vk_shader_stage(stage);
-}
-#define RADV_GRAPHICS_STAGES \
- (VK_SHADER_STAGE_ALL_GRAPHICS | VK_SHADER_STAGE_MESH_BIT_EXT | VK_SHADER_STAGE_TASK_BIT_EXT)
+ if (mesa_to_vk_shader_stage(stage) & RADV_GRAPHICS_STAGES) {
+ cmd_buffer->scratch_size_per_wave_needed =
+ MAX2(cmd_buffer->scratch_size_per_wave_needed, shader->config.scratch_bytes_per_wave);
+
+ const unsigned max_stage_waves = radv_get_max_scratch_waves(device, shader);
+ cmd_buffer->scratch_waves_wanted = MAX2(cmd_buffer->scratch_waves_wanted, max_stage_waves);
+ }
+}
VKAPI_ATTR void VKAPI_CALL
radv_CmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline _pipeline)
radv_bind_vs_input_state(cmd_buffer, graphics_pipeline);
- cmd_buffer->scratch_size_per_wave_needed =
- MAX2(cmd_buffer->scratch_size_per_wave_needed, pipeline->scratch_bytes_per_wave);
- cmd_buffer->scratch_waves_wanted = MAX2(cmd_buffer->scratch_waves_wanted, pipeline->max_waves);
-
radv_bind_multisample_state(cmd_buffer, &graphics_pipeline->ms);
cmd_buffer->state.custom_blend_mode = graphics_pipeline->custom_blend_mode;
radv_pipeline_destroy(device, pipeline, pAllocator);
}
-void
-radv_pipeline_init_scratch(const struct radv_device *device, struct radv_pipeline *pipeline, struct radv_shader *shader)
-{
- if (!shader->config.scratch_bytes_per_wave)
- return;
-
- pipeline->scratch_bytes_per_wave = MAX2(pipeline->scratch_bytes_per_wave, shader->config.scratch_bytes_per_wave);
-
- const unsigned max_stage_waves = radv_get_max_scratch_waves(device, shader);
- pipeline->max_waves = MAX2(pipeline->max_waves, max_stage_waves);
-}
-
static enum radv_buffer_robustness
radv_convert_buffer_robustness(const struct radv_device *device, VkPipelineRobustnessBufferBehaviorEXT behaviour)
{
uint32_t user_data_0[MESA_VULKAN_SHADER_STAGES];
- unsigned max_waves;
- unsigned scratch_bytes_per_wave;
-
/* Unique pipeline hash identifier. */
uint64_t pipeline_hash;
bool radv_shader_need_indirect_descriptor_sets(const struct radv_shader *shader);
-void radv_pipeline_init_scratch(const struct radv_device *device, struct radv_pipeline *pipeline,
- struct radv_shader *shader);
-
bool radv_pipeline_has_ngg(const struct radv_graphics_pipeline *pipeline);
void radv_pipeline_destroy(struct radv_device *device, struct radv_pipeline *pipeline,