Commit 60b9c00a authored by Juan A. Suárez's avatar Juan A. Suárez Committed by Marge Bot

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. Suárez's avatarJuan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Iago Toral's avatarIago Toral Quiroga <itoral@igalia.com>
Closes: #3078
Part-of: <!7196>
parent 9648bfba
Pipeline #224307 waiting for manual action with stages
in 1 minute and 55 seconds
......@@ -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)
......
......@@ -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) {
......
......@@ -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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment