nir: Add a range_base+range to nir_intrinsic_load_ubo().
For UBO accesses to be the same performance as classic GL default uniform block uniforms, we need to be able to push them through the same path. On freedreno, we haven't been uploading UBOs as push constants when they're used for indirect array access, because we don't know what range of the UBO is needed for an access. I believe we won't be able to calculate the range in general in spirv given casts that can happen, so we define a [0, ~0] range to be "We don't know anything". We use that at the moment for all UBO loads except for nir_lower_uniforms_to_ubo, where we now avoid losing the range information that default uniform block loads come with. In a departure from other NIR intrinsics with a "base", I didn't make the base an be something you have to add to the src[1] offset. This keeps us from needing to modify all drivers (particularly since the base+offset thing can mean needing to do addition in the backend), makes backend tracking of ranges easy, and makes the range calculations in load_store_vectorizer reasonable. However, this could definitely cause some confusion for people used to the normal NIR base. Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Reviewed-by: Rob Clark <robdclark@chromium.org> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6359>
This commit is contained in:
@@ -853,6 +853,9 @@ _vtn_load_store_tail(struct vtn_builder *b, nir_intrinsic_op op, bool load,
|
||||
if (op == nir_intrinsic_load_push_constant) {
|
||||
nir_intrinsic_set_base(instr, access_offset);
|
||||
nir_intrinsic_set_range(instr, access_size);
|
||||
} else if (op == nir_intrinsic_load_ubo) {
|
||||
nir_intrinsic_set_range_base(instr, 0);
|
||||
nir_intrinsic_set_range(instr, ~0);
|
||||
}
|
||||
|
||||
if (op == nir_intrinsic_load_ubo ||
|
||||
|
Reference in New Issue
Block a user