From cd092bf937020984d6008f93eb0d15d647c112c5 Mon Sep 17 00:00:00 2001 From: Ilia Mirkin Date: Fri, 10 Apr 2020 23:46:08 -0400 Subject: [PATCH] st/mesa: add support for GL_NV_viewport_array2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Ilia Mirkin Reviewed-by: Marek Olšák Part-of: --- src/gallium/auxiliary/tgsi/tgsi_from_mesa.c | 4 ++++ src/mesa/state_tracker/st_atom.c | 3 ++- src/mesa/state_tracker/st_extensions.c | 1 + src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 3 +++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_from_mesa.c b/src/gallium/auxiliary/tgsi/tgsi_from_mesa.c index 72fd5c91c52..29fa68da9f0 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_from_mesa.c +++ b/src/gallium/auxiliary/tgsi/tgsi_from_mesa.c @@ -139,6 +139,10 @@ tgsi_get_gl_varying_semantic(gl_varying_slot attr, *semantic_name = TGSI_SEMANTIC_TESSINNER; *semantic_index = 0; break; + case VARYING_SLOT_VIEWPORT_MASK: + *semantic_name = TGSI_SEMANTIC_VIEWPORT_MASK; + *semantic_index = 0; + break; case VARYING_SLOT_TEX0: case VARYING_SLOT_TEX1: diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c index f6fc615d224..11b0ce6ec55 100644 --- a/src/mesa/state_tracker/st_atom.c +++ b/src/mesa/state_tracker/st_atom.c @@ -125,7 +125,8 @@ static void check_program_state( struct st_context *st ) struct gl_program *last_prim_shader = new_gp ? new_gp : new_tep ? new_tep : new_vp; if (last_prim_shader && - last_prim_shader->info.outputs_written & VARYING_BIT_VIEWPORT) + last_prim_shader->info.outputs_written & ( + VARYING_BIT_VIEWPORT | VARYING_BIT_VIEWPORT_MASK)) num_viewports = ctx->Const.MaxViewports; if (st->state.num_viewports != num_viewports) { diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 9db85a077f6..97ab11f41d4 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -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_array2), PIPE_CAP_VIEWPORT_MASK }, { 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 diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 254f966b4e3..a9a824f7bda 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -6832,6 +6832,9 @@ st_translate_program( emit_compute_block_size(proginfo, ureg); } + if (program->shader->Program->info.layer_viewport_relative) + ureg_property(ureg, TGSI_PROPERTY_LAYER_VIEWPORT_RELATIVE, 1); + /* Declare address register. */ if (program->num_address_regs > 0) { -- 2.30.2