aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuan A. Suarez Romero <jasuarez@igalia.com>2020-10-16 11:27:42 +0200
committerMarge Bot <eric+marge@anholt.net>2020-11-05 12:15:28 +0000
commit1e723745dde45da4adafbb9a28d17850484fc5a7 (patch)
treef5d219e2ee8e6d246d388b5f0122f9a0bc7a02c6
parent44925a8a5547ba63a755668dfa947052f525ac8d (diff)
downloadexternal_mesa3d-1e723745dde45da4adafbb9a28d17850484fc5a7.tar.gz
external_mesa3d-1e723745dde45da4adafbb9a28d17850484fc5a7.tar.bz2
external_mesa3d-1e723745dde45da4adafbb9a28d17850484fc5a7.zip
v3d/compiler: extend swapping R/B support to all vertex attributes
So far the support for R/B swapping in vertex attributes were for the generic attributes. But there are cases like glSecondaryColorPointer() supporting BGRA formats that require the R/B swapping to be also allowed in the non-generic vertex attributes (in this case, in the COLOR1 attribute). v2: - Don't split line (Iago) Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7196>
-rw-r--r--src/broadcom/compiler/nir_to_vir.c10
-rw-r--r--src/broadcom/compiler/v3d_compiler.h2
-rw-r--r--src/broadcom/compiler/v3d_nir_lower_io.c5
3 files changed, 6 insertions, 11 deletions
diff --git a/src/broadcom/compiler/nir_to_vir.c b/src/broadcom/compiler/nir_to_vir.c
index 2bd88741919..0a961cb41d1 100644
--- a/src/broadcom/compiler/nir_to_vir.c
+++ b/src/broadcom/compiler/nir_to_vir.c
@@ -1611,14 +1611,10 @@ ntq_setup_vs_inputs(struct v3d_compile *c)
c->vattr_sizes[loc] = MAX2(c->vattr_sizes[loc],
start_component + num_components);
- /* Handle BGRA user inputs */
+ /* Handle BGRA inputs */
if (start_component == 0 &&
- var->data.location >= VERT_ATTRIB_GENERIC0) {
- int32_t idx = var->data.location - VERT_ATTRIB_GENERIC0;
- if (c->vs_key->va_swap_rb_mask & (1 << idx)) {
- c->vattr_sizes[loc] =
- MAX2(3, c->vattr_sizes[loc]);
- }
+ c->vs_key->va_swap_rb_mask & (1 << var->data.location)) {
+ c->vattr_sizes[loc] = MAX2(3, c->vattr_sizes[loc]);
}
}
diff --git a/src/broadcom/compiler/v3d_compiler.h b/src/broadcom/compiler/v3d_compiler.h
index 8d78bb4f183..6e176491428 100644
--- a/src/broadcom/compiler/v3d_compiler.h
+++ b/src/broadcom/compiler/v3d_compiler.h
@@ -418,7 +418,7 @@ struct v3d_vs_key {
* vertex attributes. Since the hardware doesn't provide any
* means to swizzle vertex attributes we need to do it in the shader.
*/
- uint16_t va_swap_rb_mask;
+ uint32_t va_swap_rb_mask;
bool is_coord;
bool per_vertex_point_size;
diff --git a/src/broadcom/compiler/v3d_nir_lower_io.c b/src/broadcom/compiler/v3d_nir_lower_io.c
index 520a8e608a8..7d8fa4667d6 100644
--- a/src/broadcom/compiler/v3d_nir_lower_io.c
+++ b/src/broadcom/compiler/v3d_nir_lower_io.c
@@ -332,9 +332,8 @@ v3d_nir_lower_vertex_input(struct v3d_compile *c, nir_builder *b,
if (!c->vs_key->va_swap_rb_mask)
return;
- const uint32_t location =
- nir_intrinsic_io_semantics(instr).location - VERT_ATTRIB_GENERIC0;
- assert(location < V3D_MAX_VS_INPUTS / 4);
+ const uint32_t location = nir_intrinsic_io_semantics(instr).location;
+
if (!(c->vs_key->va_swap_rb_mask & (1 << location)))
return;