iris: null for non-existent cbufs
prevents BTs from being shifted down incorrectly
This commit is contained in:
@@ -516,6 +516,9 @@ void gen11_init_state(struct iris_context *ice);
|
|||||||
/* iris_program.c */
|
/* iris_program.c */
|
||||||
const struct shader_info *iris_get_shader_info(const struct iris_context *ice,
|
const struct shader_info *iris_get_shader_info(const struct iris_context *ice,
|
||||||
gl_shader_stage stage);
|
gl_shader_stage stage);
|
||||||
|
unsigned iris_get_shader_num_ubos(const struct iris_context *ice,
|
||||||
|
gl_shader_stage stage);
|
||||||
|
|
||||||
|
|
||||||
/* iris_program_cache.c */
|
/* iris_program_cache.c */
|
||||||
|
|
||||||
|
@@ -532,6 +532,20 @@ iris_get_shader_info(const struct iris_context *ice, gl_shader_stage stage)
|
|||||||
return &nir->info;
|
return &nir->info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// XXX: this function is gross
|
||||||
|
unsigned
|
||||||
|
iris_get_shader_num_ubos(const struct iris_context *ice, gl_shader_stage stage)
|
||||||
|
{
|
||||||
|
const struct iris_uncompiled_shader *ish = ice->shaders.uncompiled[stage];
|
||||||
|
|
||||||
|
if (ish) {
|
||||||
|
const nir_shader *nir = ish->nir;
|
||||||
|
/* see assign_common_binding_table_offsets */
|
||||||
|
return nir->info.num_ubos + (nir->num_uniforms > 0 ? 1 : 0);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the union of TCS output and TES input slots.
|
* Get the union of TCS output and TES input slots.
|
||||||
*
|
*
|
||||||
|
@@ -3180,6 +3180,26 @@ static const uint32_t push_constant_opcodes[] = {
|
|||||||
[MESA_SHADER_COMPUTE] = 0,
|
[MESA_SHADER_COMPUTE] = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static uint32_t
|
||||||
|
use_null_surface(struct iris_batch *batch, struct iris_context *ice)
|
||||||
|
{
|
||||||
|
struct iris_bo *state_bo = iris_resource_bo(ice->state.unbound_tex.res);
|
||||||
|
|
||||||
|
iris_use_pinned_bo(batch, state_bo, false);
|
||||||
|
|
||||||
|
return ice->state.unbound_tex.offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint32_t
|
||||||
|
use_null_fb_surface(struct iris_batch *batch, struct iris_context *ice)
|
||||||
|
{
|
||||||
|
struct iris_bo *state_bo = iris_resource_bo(ice->state.null_fb.res);
|
||||||
|
|
||||||
|
iris_use_pinned_bo(batch, state_bo, false);
|
||||||
|
|
||||||
|
return ice->state.null_fb.offset;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a surface to the validation list, as well as the buffer containing
|
* Add a surface to the validation list, as well as the buffer containing
|
||||||
* the corresponding SURFACE_STATE.
|
* the corresponding SURFACE_STATE.
|
||||||
@@ -3209,34 +3229,19 @@ use_sampler_view(struct iris_batch *batch, struct iris_sampler_view *isv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t
|
static uint32_t
|
||||||
use_const_buffer(struct iris_batch *batch, struct iris_const_buffer *cbuf)
|
use_const_buffer(struct iris_batch *batch,
|
||||||
|
struct iris_context *ice,
|
||||||
|
struct iris_const_buffer *cbuf)
|
||||||
{
|
{
|
||||||
|
if (!cbuf->surface_state.res)
|
||||||
|
return use_null_surface(batch, ice);
|
||||||
|
|
||||||
iris_use_pinned_bo(batch, iris_resource_bo(cbuf->data.res), false);
|
iris_use_pinned_bo(batch, iris_resource_bo(cbuf->data.res), false);
|
||||||
iris_use_pinned_bo(batch, iris_resource_bo(cbuf->surface_state.res), false);
|
iris_use_pinned_bo(batch, iris_resource_bo(cbuf->surface_state.res), false);
|
||||||
|
|
||||||
return cbuf->surface_state.offset;
|
return cbuf->surface_state.offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t
|
|
||||||
use_null_surface(struct iris_batch *batch, struct iris_context *ice)
|
|
||||||
{
|
|
||||||
struct iris_bo *state_bo = iris_resource_bo(ice->state.unbound_tex.res);
|
|
||||||
|
|
||||||
iris_use_pinned_bo(batch, state_bo, false);
|
|
||||||
|
|
||||||
return ice->state.unbound_tex.offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
static uint32_t
|
|
||||||
use_null_fb_surface(struct iris_batch *batch, struct iris_context *ice)
|
|
||||||
{
|
|
||||||
struct iris_bo *state_bo = iris_resource_bo(ice->state.null_fb.res);
|
|
||||||
|
|
||||||
iris_use_pinned_bo(batch, state_bo, false);
|
|
||||||
|
|
||||||
return ice->state.null_fb.offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
static uint32_t
|
static uint32_t
|
||||||
use_ssbo(struct iris_batch *batch, struct iris_context *ice,
|
use_ssbo(struct iris_batch *batch, struct iris_context *ice,
|
||||||
struct iris_shader_state *shs, int i)
|
struct iris_shader_state *shs, int i)
|
||||||
@@ -3330,12 +3335,10 @@ iris_populate_binding_table(struct iris_context *ice,
|
|||||||
push_bt_entry(addr);
|
push_bt_entry(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 1 + info->num_ubos; i++) {
|
const int num_ubos = iris_get_shader_num_ubos(ice, stage);
|
||||||
struct iris_const_buffer *cbuf = &shs->constbuf[i];
|
|
||||||
if (!cbuf->surface_state.res)
|
|
||||||
break;
|
|
||||||
|
|
||||||
uint32_t addr = use_const_buffer(batch, cbuf);
|
for (int i = 0; i < num_ubos; i++) {
|
||||||
|
uint32_t addr = use_const_buffer(batch, ice, &shs->constbuf[i]);
|
||||||
push_bt_entry(addr);
|
push_bt_entry(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user