anv: Move INTERFACE_DESCRIPTOR_DATA setup to the pipeline
There are a few dynamic bits, namely binding table and sampler addresses, but most of it is static and really belongs in the pipeline. It certainly doesn't belong in flush_compute_descriptor_set. We'll use the same state merging trick we use for gen7 DEPTH_STENCIL. Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
This commit is contained in:
@@ -1414,6 +1414,8 @@ struct anv_pipeline {
|
|||||||
struct {
|
struct {
|
||||||
uint32_t wm_depth_stencil[4];
|
uint32_t wm_depth_stencil[4];
|
||||||
} gen9;
|
} gen9;
|
||||||
|
|
||||||
|
uint32_t interface_descriptor_data[8];
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
|
@@ -1338,7 +1338,6 @@ void genX(CmdDrawIndexedIndirect)(
|
|||||||
static VkResult
|
static VkResult
|
||||||
flush_compute_descriptor_set(struct anv_cmd_buffer *cmd_buffer)
|
flush_compute_descriptor_set(struct anv_cmd_buffer *cmd_buffer)
|
||||||
{
|
{
|
||||||
struct anv_device *device = cmd_buffer->device;
|
|
||||||
struct anv_pipeline *pipeline = cmd_buffer->state.compute_pipeline;
|
struct anv_pipeline *pipeline = cmd_buffer->state.compute_pipeline;
|
||||||
struct anv_state surfaces = { 0, }, samplers = { 0, };
|
struct anv_state surfaces = { 0, }, samplers = { 0, };
|
||||||
VkResult result;
|
VkResult result;
|
||||||
@@ -1352,9 +1351,6 @@ flush_compute_descriptor_set(struct anv_cmd_buffer *cmd_buffer)
|
|||||||
|
|
||||||
struct anv_state push_state = anv_cmd_buffer_cs_push_constants(cmd_buffer);
|
struct anv_state push_state = anv_cmd_buffer_cs_push_constants(cmd_buffer);
|
||||||
|
|
||||||
const struct brw_cs_prog_data *cs_prog_data = get_cs_prog_data(pipeline);
|
|
||||||
const struct brw_stage_prog_data *prog_data = &cs_prog_data->base;
|
|
||||||
|
|
||||||
if (push_state.alloc_size) {
|
if (push_state.alloc_size) {
|
||||||
anv_batch_emit(&cmd_buffer->batch, GENX(MEDIA_CURBE_LOAD), curbe) {
|
anv_batch_emit(&cmd_buffer->batch, GENX(MEDIA_CURBE_LOAD), curbe) {
|
||||||
curbe.CURBETotalDataLength = push_state.alloc_size;
|
curbe.CURBETotalDataLength = push_state.alloc_size;
|
||||||
@@ -1362,31 +1358,18 @@ flush_compute_descriptor_set(struct anv_cmd_buffer *cmd_buffer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint32_t slm_size = encode_slm_size(GEN_GEN, prog_data->total_shared);
|
uint32_t iface_desc_data_dw[GENX(INTERFACE_DESCRIPTOR_DATA_length)];
|
||||||
|
struct GENX(INTERFACE_DESCRIPTOR_DATA) desc = {
|
||||||
|
.BindingTablePointer = surfaces.offset,
|
||||||
|
.SamplerStatePointer = samplers.offset,
|
||||||
|
};
|
||||||
|
GENX(INTERFACE_DESCRIPTOR_DATA_pack)(NULL, iface_desc_data_dw, &desc);
|
||||||
|
|
||||||
const struct anv_shader_bin *cs_bin =
|
|
||||||
pipeline->shaders[MESA_SHADER_COMPUTE];
|
|
||||||
struct anv_state state =
|
struct anv_state state =
|
||||||
anv_state_pool_emit(&device->dynamic_state_pool,
|
anv_cmd_buffer_merge_dynamic(cmd_buffer, iface_desc_data_dw,
|
||||||
GENX(INTERFACE_DESCRIPTOR_DATA), 64,
|
pipeline->interface_descriptor_data,
|
||||||
.KernelStartPointer = cs_bin->kernel.offset,
|
GENX(INTERFACE_DESCRIPTOR_DATA_length),
|
||||||
.BindingTablePointer = surfaces.offset,
|
64);
|
||||||
.BindingTableEntryCount = 0,
|
|
||||||
.SamplerStatePointer = samplers.offset,
|
|
||||||
.SamplerCount = 0,
|
|
||||||
#if !GEN_IS_HASWELL
|
|
||||||
.ConstantURBEntryReadOffset = 0,
|
|
||||||
#endif
|
|
||||||
.ConstantURBEntryReadLength =
|
|
||||||
cs_prog_data->push.per_thread.regs,
|
|
||||||
#if GEN_GEN >= 8 || GEN_IS_HASWELL
|
|
||||||
.CrossThreadConstantDataReadLength =
|
|
||||||
cs_prog_data->push.cross_thread.regs,
|
|
||||||
#endif
|
|
||||||
.BarrierEnable = cs_prog_data->uses_barrier,
|
|
||||||
.SharedLocalMemorySize = slm_size,
|
|
||||||
.NumberofThreadsinGPGPUThreadGroup =
|
|
||||||
cs_prog_data->threads);
|
|
||||||
|
|
||||||
uint32_t size = GENX(INTERFACE_DESCRIPTOR_DATA_length) * sizeof(uint32_t);
|
uint32_t size = GENX(INTERFACE_DESCRIPTOR_DATA_length) * sizeof(uint32_t);
|
||||||
anv_batch_emit(&cmd_buffer->batch,
|
anv_batch_emit(&cmd_buffer->batch,
|
||||||
|
@@ -1470,6 +1470,32 @@ compute_pipeline_create(
|
|||||||
vfe.CURBEAllocationSize = vfe_curbe_allocation;
|
vfe.CURBEAllocationSize = vfe_curbe_allocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const struct anv_shader_bin *cs_bin =
|
||||||
|
pipeline->shaders[MESA_SHADER_COMPUTE];
|
||||||
|
struct GENX(INTERFACE_DESCRIPTOR_DATA) desc = {
|
||||||
|
.KernelStartPointer = cs_bin->kernel.offset,
|
||||||
|
|
||||||
|
.SamplerCount = get_sampler_count(cs_bin),
|
||||||
|
.BindingTableEntryCount = get_binding_table_entry_count(cs_bin),
|
||||||
|
.BarrierEnable = cs_prog_data->uses_barrier,
|
||||||
|
.SharedLocalMemorySize =
|
||||||
|
encode_slm_size(GEN_GEN, cs_prog_data->base.total_shared),
|
||||||
|
|
||||||
|
#if !GEN_IS_HASWELL
|
||||||
|
.ConstantURBEntryReadOffset = 0,
|
||||||
|
#endif
|
||||||
|
.ConstantURBEntryReadLength = cs_prog_data->push.per_thread.regs,
|
||||||
|
#if GEN_GEN >= 8 || GEN_IS_HASWELL
|
||||||
|
.CrossThreadConstantDataReadLength =
|
||||||
|
cs_prog_data->push.cross_thread.regs,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
.NumberofThreadsinGPGPUThreadGroup = cs_prog_data->threads,
|
||||||
|
};
|
||||||
|
GENX(INTERFACE_DESCRIPTOR_DATA_pack)(NULL,
|
||||||
|
pipeline->interface_descriptor_data,
|
||||||
|
&desc);
|
||||||
|
|
||||||
*pPipeline = anv_pipeline_to_handle(pipeline);
|
*pPipeline = anv_pipeline_to_handle(pipeline);
|
||||||
|
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
|
Reference in New Issue
Block a user