lavapipe: drop device pointer from pipeline object
Just get it from the base object. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38198>
This commit is contained in:
@@ -452,15 +452,16 @@ VkResult
|
||||
lvp_spirv_to_nir(struct lvp_pipeline *pipeline, const void *pipeline_pNext,
|
||||
const VkPipelineShaderStageCreateInfo *sinfo, nir_shader **out_nir)
|
||||
{
|
||||
VkResult result = compile_spirv(pipeline->device, pipeline->flags, sinfo, out_nir);
|
||||
struct lvp_device *device = lvp_pipeline_device(pipeline);
|
||||
VkResult result = compile_spirv(device, pipeline->flags, sinfo, out_nir);
|
||||
if (result == VK_SUCCESS) {
|
||||
if (pipeline->type == LVP_PIPELINE_EXEC_GRAPH)
|
||||
lvp_lower_exec_graph(pipeline, *out_nir);
|
||||
|
||||
struct vk_pipeline_robustness_state robustness;
|
||||
vk_pipeline_robustness_state_fill(&pipeline->device->vk, &robustness, pipeline_pNext, sinfo->pNext);
|
||||
vk_pipeline_robustness_state_fill(&device->vk, &robustness, pipeline_pNext, sinfo->pNext);
|
||||
|
||||
lvp_shader_lower(pipeline->device, *out_nir, pipeline->layout, &robustness);
|
||||
lvp_shader_lower(device, *out_nir, pipeline->layout, &robustness);
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -830,8 +831,6 @@ lvp_graphics_pipeline_init(struct lvp_pipeline *pipeline,
|
||||
VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_SHADER_BIT_EXT |
|
||||
VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_OUTPUT_INTERFACE_BIT_EXT));
|
||||
|
||||
pipeline->device = device;
|
||||
|
||||
for (uint32_t i = 0; i < pCreateInfo->stageCount; i++) {
|
||||
const VkPipelineShaderStageCreateInfo *sinfo = &pCreateInfo->pStages[i];
|
||||
mesa_shader_stage stage = vk_to_mesa_shader_stage(sinfo->stage);
|
||||
@@ -913,6 +912,7 @@ fail:
|
||||
void
|
||||
lvp_pipeline_shaders_compile(struct lvp_pipeline *pipeline, bool locked)
|
||||
{
|
||||
struct lvp_device *device = lvp_pipeline_device(pipeline);
|
||||
if (pipeline->compiled)
|
||||
return;
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(pipeline->shaders); i++) {
|
||||
@@ -922,10 +922,10 @@ lvp_pipeline_shaders_compile(struct lvp_pipeline *pipeline, bool locked)
|
||||
mesa_shader_stage stage = i;
|
||||
assert(stage == pipeline->shaders[i].pipeline_nir->nir->info.stage);
|
||||
|
||||
pipeline->shaders[stage].shader_cso = lvp_shader_compile(pipeline->device, &pipeline->shaders[stage],
|
||||
pipeline->shaders[stage].shader_cso = lvp_shader_compile(device, &pipeline->shaders[stage],
|
||||
nir_shader_clone(NULL, pipeline->shaders[stage].pipeline_nir->nir), locked);
|
||||
if (pipeline->shaders[MESA_SHADER_TESS_EVAL].tess_ccw)
|
||||
pipeline->shaders[MESA_SHADER_TESS_EVAL].tess_ccw_cso = lvp_shader_compile(pipeline->device, &pipeline->shaders[stage],
|
||||
pipeline->shaders[MESA_SHADER_TESS_EVAL].tess_ccw_cso = lvp_shader_compile(device, &pipeline->shaders[stage],
|
||||
nir_shader_clone(NULL, pipeline->shaders[MESA_SHADER_TESS_EVAL].tess_ccw->nir), locked);
|
||||
}
|
||||
pipeline->compiled = true;
|
||||
@@ -1018,7 +1018,6 @@ lvp_compute_pipeline_init(struct lvp_pipeline *pipeline,
|
||||
VkPipelineCreateFlagBits2KHR flags)
|
||||
{
|
||||
pipeline->flags = flags;
|
||||
pipeline->device = device;
|
||||
pipeline->layout = lvp_pipeline_layout_from_handle(pCreateInfo->layout);
|
||||
vk_pipeline_layout_ref(&pipeline->layout->vk);
|
||||
pipeline->force_min_sample = false;
|
||||
@@ -1030,7 +1029,7 @@ lvp_compute_pipeline_init(struct lvp_pipeline *pipeline,
|
||||
return result;
|
||||
|
||||
struct lvp_shader *shader = &pipeline->shaders[MESA_SHADER_COMPUTE];
|
||||
shader->shader_cso = lvp_shader_compile(pipeline->device, shader, nir_shader_clone(NULL, shader->pipeline_nir->nir), false);
|
||||
shader->shader_cso = lvp_shader_compile(device, shader, nir_shader_clone(NULL, shader->pipeline_nir->nir), false);
|
||||
pipeline->compiled = true;
|
||||
if (pipeline->layout)
|
||||
shader->push_constant_size = pipeline->layout->push_constant_size;
|
||||
|
||||
@@ -497,7 +497,6 @@ struct lvp_ray_tracing_group {
|
||||
|
||||
struct lvp_pipeline {
|
||||
struct vk_object_base base;
|
||||
struct lvp_device *device;
|
||||
struct lvp_pipeline_layout *layout;
|
||||
|
||||
enum lvp_pipeline_type type;
|
||||
@@ -535,6 +534,12 @@ struct lvp_pipeline {
|
||||
VkPipeline groups[0];
|
||||
};
|
||||
|
||||
static inline struct lvp_device *
|
||||
lvp_pipeline_device(const struct lvp_pipeline *pipeline)
|
||||
{
|
||||
return (struct lvp_device *)pipeline->base.device;
|
||||
}
|
||||
|
||||
/* Minimum requirement by the spec. */
|
||||
#define LVP_MAX_EXEC_GRAPH_PAYLOADS 256
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ static void
|
||||
lvp_init_ray_tracing_groups(struct lvp_pipeline *pipeline,
|
||||
const VkRayTracingPipelineCreateInfoKHR *create_info)
|
||||
{
|
||||
struct lvp_device *device = lvp_pipeline_device(pipeline);
|
||||
uint32_t i = 0;
|
||||
for (; i < create_info->groupCount; i++) {
|
||||
const VkRayTracingShaderGroupCreateInfoKHR *group_info = create_info->pGroups + i;
|
||||
@@ -57,7 +58,7 @@ lvp_init_ray_tracing_groups(struct lvp_pipeline *pipeline,
|
||||
UNREACHABLE("Unimplemented VkRayTracingShaderGroupTypeKHR");
|
||||
}
|
||||
|
||||
dst->handle.index = p_atomic_inc_return(&pipeline->device->group_handle_alloc);
|
||||
dst->handle.index = p_atomic_inc_return(&device->group_handle_alloc);
|
||||
}
|
||||
|
||||
if (!create_info->pLibraryInfo)
|
||||
@@ -342,7 +343,8 @@ lvp_ray_tracing_state_init(nir_shader *nir, struct lvp_ray_tracing_pipeline_comp
|
||||
state->terminate = nir_variable_create(nir, nir_var_shader_temp, glsl_bool_type(), "terminate");
|
||||
state->opaque = nir_variable_create(nir, nir_var_shader_temp, glsl_bool_type(), "opaque");
|
||||
|
||||
if (compiler->pipeline->device->vk.enabled_features.rayTracingPositionFetch)
|
||||
struct lvp_device *device = lvp_pipeline_device(compiler->pipeline);
|
||||
if (device->vk.enabled_features.rayTracingPositionFetch)
|
||||
state->primitive_addr = nir_variable_create(nir, nir_var_shader_temp, glsl_uint64_t_type(), "primitive_addr");
|
||||
}
|
||||
|
||||
@@ -1029,9 +1031,10 @@ static void
|
||||
lvp_compile_ray_tracing_pipeline(struct lvp_pipeline *pipeline,
|
||||
const VkRayTracingPipelineCreateInfoKHR *create_info)
|
||||
{
|
||||
struct lvp_device *device = lvp_pipeline_device(pipeline);
|
||||
nir_builder _b = nir_builder_init_simple_shader(
|
||||
MESA_SHADER_COMPUTE,
|
||||
pipeline->device->pscreen->nir_options[MESA_SHADER_COMPUTE],
|
||||
device->pscreen->nir_options[MESA_SHADER_COMPUTE],
|
||||
"ray tracing pipeline");
|
||||
nir_builder *b = &_b;
|
||||
|
||||
@@ -1111,7 +1114,7 @@ lvp_compile_ray_tracing_pipeline(struct lvp_pipeline *pipeline,
|
||||
struct lvp_shader *shader = &pipeline->shaders[MESA_SHADER_RAYGEN];
|
||||
lvp_shader_init(shader, b->shader);
|
||||
shader->push_constant_size = pipeline->layout->push_constant_size;
|
||||
shader->shader_cso = lvp_shader_compile(pipeline->device, shader, nir_shader_clone(NULL, shader->pipeline_nir->nir), false);
|
||||
shader->shader_cso = lvp_shader_compile(device, shader, nir_shader_clone(NULL, shader->pipeline_nir->nir), false);
|
||||
|
||||
_mesa_hash_table_destroy(compiler.functions, NULL);
|
||||
}
|
||||
@@ -1136,7 +1139,6 @@ lvp_create_ray_tracing_pipeline(VkDevice _device, const VkAllocationCallbacks *a
|
||||
|
||||
vk_pipeline_layout_ref(&layout->vk);
|
||||
|
||||
pipeline->device = device;
|
||||
pipeline->layout = layout;
|
||||
pipeline->type = LVP_PIPELINE_RAY_TRACING;
|
||||
pipeline->flags = vk_rt_pipeline_create_flags(create_info);
|
||||
|
||||
Reference in New Issue
Block a user