st/mesa: add NV_viewport_swizzle support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4519>
This commit is contained in:
Ilia Mirkin 2020-04-06 01:57:54 -04:00
parent ff168b297d
commit 90fcb3fef2
2 changed files with 12 additions and 0 deletions

View File

@ -34,6 +34,12 @@
#include "pipe/p_context.h"
#include "cso_cache/cso_context.h"
static enum pipe_viewport_swizzle
viewport_swizzle_from_glenum(GLenum16 swizzle)
{
return swizzle - GL_VIEWPORT_SWIZZLE_POSITIVE_X_NV;
}
/**
* Update the viewport transformation matrix. Depends on:
* - viewport pos/size
@ -60,6 +66,11 @@ st_update_viewport( struct st_context *st )
scale[1] *= -1;
translate[1] = st->state.fb_height - translate[1];
}
st->state.viewport[i].swizzle_x = viewport_swizzle_from_glenum(ctx->ViewportArray[i].SwizzleX);
st->state.viewport[i].swizzle_y = viewport_swizzle_from_glenum(ctx->ViewportArray[i].SwizzleY);
st->state.viewport[i].swizzle_z = viewport_swizzle_from_glenum(ctx->ViewportArray[i].SwizzleZ);
st->state.viewport[i].swizzle_w = viewport_swizzle_from_glenum(ctx->ViewportArray[i].SwizzleW);
}
cso_set_viewport(st->cso_context, &st->state.viewport[0]);

View File

@ -804,6 +804,7 @@ void st_init_extensions(struct pipe_screen *screen,
{ o(NV_primitive_restart), PIPE_CAP_PRIMITIVE_RESTART },
{ o(NV_shader_atomic_float), PIPE_CAP_TGSI_ATOMFADD },
{ o(NV_texture_barrier), PIPE_CAP_TEXTURE_BARRIER },
{ o(NV_viewport_swizzle), PIPE_CAP_VIEWPORT_SWIZZLE },
{ o(NVX_gpu_memory_info), PIPE_CAP_QUERY_MEMORY_INFO },
/* GL_NV_point_sprite is not supported by gallium because we don't
* support the GL_POINT_SPRITE_R_MODE_NV option. */