zink: handle bitsizes in get_bo_vars() analysis

this allows it to be run repeatedly

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17239>
This commit is contained in:
Mike Blumenkrantz 2022-06-26 09:06:26 -04:00
parent 58780b3aa6
commit ac2141a5b2

View file

@ -485,16 +485,17 @@ get_bo_vars(struct zink_shader *zs, nir_shader *shader)
bo.first_ssbo = ffs(zs->ssbos_used) - 1;
assert(bo.first_ssbo < PIPE_MAX_SHADER_BUFFERS);
nir_foreach_variable_with_modes(var, shader, nir_var_mem_ssbo | nir_var_mem_ubo) {
unsigned idx = glsl_get_explicit_stride(glsl_get_struct_field(glsl_without_array(var->type), 0)) >> 1;
if (var->data.mode == nir_var_mem_ssbo) {
assert(!bo.ssbo[32 >> 4]);
bo.ssbo[32 >> 4] = var;
assert(!bo.ssbo[idx]);
bo.ssbo[idx] = var;
} else {
if (var->data.driver_location) {
assert(!bo.ubo[32 >> 4]);
bo.ubo[32 >> 4] = var;
assert(!bo.ubo[idx]);
bo.ubo[idx] = var;
} else {
assert(!bo.uniforms[32 >> 4]);
bo.uniforms[32 >> 4] = var;
assert(!bo.uniforms[idx]);
bo.uniforms[idx] = var;
}
}
}