v3d/compiler: handle GL/Vulkan differences in uniform handling
This also adds a v3d_execution_environment, so compiler could know if it is generating code for OpenGL or Vulkan needs. Reviewed-by: Iago Toral <itoral@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
This commit is contained in:

committed by
Marge Bot

parent
4e2817fd33
commit
c8212731e7
@@ -241,10 +241,13 @@ ntq_emit_tmu_general(struct v3d_compile *c, nir_intrinsic_instr *instr,
|
||||
v3d_unit_data_create(0, const_offset));
|
||||
const_offset = 0;
|
||||
} else if (instr->intrinsic == nir_intrinsic_load_ubo) {
|
||||
uint32_t index = nir_src_as_uint(instr->src[0]) + 1;
|
||||
/* Note that QUNIFORM_UBO_ADDR takes a UBO index shifted up by
|
||||
* 1 (0 is gallium's constant buffer 0).
|
||||
*/
|
||||
uint32_t index = nir_src_as_uint(instr->src[0]);
|
||||
/* On OpenGL QUNIFORM_UBO_ADDR takes a UBO index
|
||||
* shifted up by 1 (0 is gallium's constant buffer 0).
|
||||
*/
|
||||
if (c->key->environment == V3D_ENVIRONMENT_OPENGL)
|
||||
index++;
|
||||
|
||||
base_offset =
|
||||
vir_uniform(c, QUNIFORM_UBO_ADDR,
|
||||
v3d_unit_data_create(index, const_offset));
|
||||
|
Reference in New Issue
Block a user