st/mesa: add support for GL_NV_viewport_array2
authorIlia Mirkin <imirkin@alum.mit.edu>
Sat, 11 Apr 2020 03:46:08 +0000 (23:46 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Thu, 16 Apr 2020 00:12:48 +0000 (20:12 -0400)
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/4529>

src/gallium/auxiliary/tgsi/tgsi_from_mesa.c
src/mesa/state_tracker/st_atom.c
src/mesa/state_tracker/st_extensions.c
src/mesa/state_tracker/st_glsl_to_tgsi.cpp

index 72fd5c91c521dade15070c3150c5695fa3fc69e1..29fa68da9f00c5d56bdd490b65c4c19bb372bb86 100644 (file)
@@ -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:
index f6fc615d224fed0158ed21d25a2ec9a6f9fe52a2..11b0ce6ec55519b425ad6bc33abdcd2229cd28ef 100644 (file)
@@ -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) {
index 9db85a077f652a05fdbca3c5567e7dbe37e7c0b4..97ab11f41d4f2eb06c557034afe9d8f680812a05 100644 (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_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
index 254f966b4e33add3c5397ae2c7b6cb76cf1111c8..a9a824f7bdaffc30da0e982b0eb517f3bdc8b5a1 100644 (file)
@@ -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) {