Module: Mesa Branch: master Commit: 60b9c00afd25d0294b508f490ae46389f6fdc3bb URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=60b9c00afd25d0294b508f490ae46389f6fdc3bb
Author: Juan A. Suarez Romero <[email protected]> Date: Fri Oct 16 17:07:57 2020 +0200 v3d: Add GL_ARB_vertex_array_bgra support This is done by adding support to PIPE_FORMAT_B8G8R8A8_UNORM, and relying on the R/B swapping for vertex attributes implemented in the compiler. v2: - Simplify the loop (Iago) v3: - Assert before derreferencing variable (Iago). Signed-off-by: Juan A. Suarez Romero <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]> Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3078 Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7196> --- docs/features.txt | 2 +- src/gallium/drivers/v3d/v3d_program.c | 23 +++++++++++++++++++++++ src/gallium/drivers/v3d/v3d_screen.c | 1 + 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/docs/features.txt b/docs/features.txt index cde9bb7fe15..8a7cec4bc14 100644 --- a/docs/features.txt +++ b/docs/features.txt @@ -86,7 +86,7 @@ GL 3.2, GLSL 1.50 --- all DONE: i965, nv50, nvc0, r600, radeonsi, llvmpipe, soft Core/compatibility profiles DONE Geometry shaders DONE () - GL_ARB_vertex_array_bgra (BGRA vertex order) DONE (freedreno, panfrost) + GL_ARB_vertex_array_bgra (BGRA vertex order) DONE (freedreno, v3d, panfrost) GL_ARB_draw_elements_base_vertex (Base vertex offset) DONE (freedreno, v3d, panfrost) GL_ARB_fragment_coord_conventions (Frag shader coord) DONE (freedreno, v3d, panfrost) GL_ARB_provoking_vertex (Provoking vertex) DONE (freedreno, v3d, panfrost) diff --git a/src/gallium/drivers/v3d/v3d_program.c b/src/gallium/drivers/v3d/v3d_program.c index 3ea9d953abc..3132eb5e473 100644 --- a/src/gallium/drivers/v3d/v3d_program.c +++ b/src/gallium/drivers/v3d/v3d_program.c @@ -762,6 +762,29 @@ v3d_update_compiled_vs(struct v3d_context *v3d, uint8_t prim_mode) (prim_mode == PIPE_PRIM_POINTS && v3d->rasterizer->base.point_size_per_vertex); + nir_shader *s = v3d->prog.bind_vs->base.ir.nir; + uint64_t inputs_read = s->info.inputs_read; + assert(util_bitcount(inputs_read) <= v3d->vtx->num_elements); + + while (inputs_read) { + int location = u_bit_scan64(&inputs_read); + nir_variable *var = + nir_find_variable_with_location(s, nir_var_shader_in, location); + assert (var != NULL); + int driver_location = var->data.driver_location; + switch (v3d->vtx->pipe[driver_location].src_format) { + case PIPE_FORMAT_B8G8R8A8_UNORM: + case PIPE_FORMAT_B10G10R10A2_UNORM: + case PIPE_FORMAT_B10G10R10A2_SNORM: + case PIPE_FORMAT_B10G10R10A2_USCALED: + case PIPE_FORMAT_B10G10R10A2_SSCALED: + key->va_swap_rb_mask |= 1 << location; + break; + default: + break; + } + } + struct v3d_compiled_shader *vs = v3d_get_compiled_shader(v3d, &key->base, sizeof(*key)); if (vs != v3d->prog.vs) { diff --git a/src/gallium/drivers/v3d/v3d_screen.c b/src/gallium/drivers/v3d/v3d_screen.c index 0c5327c63bc..1b9d76b8956 100644 --- a/src/gallium/drivers/v3d/v3d_screen.c +++ b/src/gallium/drivers/v3d/v3d_screen.c @@ -560,6 +560,7 @@ v3d_screen_is_format_supported(struct pipe_screen *pscreen, case PIPE_FORMAT_R16G16B16_SSCALED: case PIPE_FORMAT_R16G16_SSCALED: case PIPE_FORMAT_R16_SSCALED: + case PIPE_FORMAT_B8G8R8A8_UNORM: case PIPE_FORMAT_R8G8B8A8_UNORM: case PIPE_FORMAT_R8G8B8_UNORM: case PIPE_FORMAT_R8G8_UNORM: _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
