diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2016-09-19 15:36:09 -0700 |
---|---|---|
committer | Kenneth Graunke <kenneth@whitecape.org> | 2016-09-20 16:23:04 -0700 |
commit | d4bf9baa43e2cf7b4b877141ee472779ced219bf (patch) | |
tree | e37f68c01f0cfcc5f866af2c81906d308b28842a | |
parent | 956f3e3bcd426b97a4d73d6903bbeb93ec4fd3f3 (diff) |
mesa: Implement ARB_shader_viewport_layer_array for i965
This extension is a combination of AMD_vertex_shader_viewport_index and
AMD_vertex_shader_layer, making it rather trivial to implement.
For gallium I *think* this needs a new cap because of the addition of
support in tessellation evaluation shaders, and since I don't have any
hardware to test it on, I've left that for someone else to wire up.
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
-rw-r--r-- | docs/features.txt | 2 | ||||
-rw-r--r-- | docs/relnotes/12.1.0.html | 1 | ||||
-rw-r--r-- | src/compiler/glsl/builtin_variables.cpp | 14 | ||||
-rw-r--r-- | src/compiler/glsl/glsl_parser_extras.cpp | 1 | ||||
-rw-r--r-- | src/compiler/glsl/glsl_parser_extras.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_extensions.c | 1 | ||||
-rw-r--r-- | src/mesa/main/extensions_table.h | 1 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 1 |
8 files changed, 20 insertions, 3 deletions
diff --git a/docs/features.txt b/docs/features.txt index df81f91fba..ab98d6047b 100644 --- a/docs/features.txt +++ b/docs/features.txt @@ -297,7 +297,7 @@ Khronos, ARB, and OES extensions that are not part of any OpenGL or OpenGL ES ve GL_ARB_shader_draw_parameters DONE (i965, nvc0, radeonsi) GL_ARB_shader_group_vote DONE (nvc0) GL_ARB_shader_stencil_export DONE (i965/gen9+, radeonsi, softpipe, llvmpipe, swr) - GL_ARB_shader_viewport_layer_array not started + GL_ARB_shader_viewport_layer_array DONE (i965/gen6+) GL_ARB_sparse_buffer not started GL_ARB_sparse_texture not started GL_ARB_sparse_texture2 not started diff --git a/docs/relnotes/12.1.0.html b/docs/relnotes/12.1.0.html index 8e0a84e463..f411614cfc 100644 --- a/docs/relnotes/12.1.0.html +++ b/docs/relnotes/12.1.0.html @@ -53,6 +53,7 @@ Note: some of the new features are only available with certain drivers. <li>GL_ARB_indirect_parameters on radeonsi</li> <li>GL_ARB_shader_draw_parameters on radeonsi</li> <li>GL_ARB_shader_group_vote on nvc0</li> +<li>GL_ARB_shader_viewport_layer_array on i965/gen6+</li> <li>GL_ARB_stencil_texturing on i965/hsw</li> <li>GL_ARB_texture_stencil8 on i965/hsw</li> <li>GL_EXT_window_rectangles on nv50, nvc0</li> diff --git a/src/compiler/glsl/builtin_variables.cpp b/src/compiler/glsl/builtin_variables.cpp index f47daab868..b66ad00d7a 100644 --- a/src/compiler/glsl/builtin_variables.cpp +++ b/src/compiler/glsl/builtin_variables.cpp @@ -1000,11 +1000,13 @@ builtin_variable_generator::generate_vs_special_vars() add_system_value(SYSTEM_VALUE_BASE_INSTANCE, int_t, "gl_BaseInstanceARB"); add_system_value(SYSTEM_VALUE_DRAW_ID, int_t, "gl_DrawIDARB"); } - if (state->AMD_vertex_shader_layer_enable) { + if (state->AMD_vertex_shader_layer_enable || + state->ARB_shader_viewport_layer_array_enable) { var = add_output(VARYING_SLOT_LAYER, int_t, "gl_Layer"); var->data.interpolation = INTERP_MODE_FLAT; } - if (state->AMD_vertex_shader_viewport_index_enable) { + if (state->AMD_vertex_shader_viewport_index_enable || + state->ARB_shader_viewport_layer_array_enable) { var = add_output(VARYING_SLOT_VIEWPORT, int_t, "gl_ViewportIndex"); var->data.interpolation = INTERP_MODE_FLAT; } @@ -1066,6 +1068,8 @@ builtin_variable_generator::generate_tcs_special_vars() void builtin_variable_generator::generate_tes_special_vars() { + ir_variable *var; + add_system_value(SYSTEM_VALUE_PRIMITIVE_ID, int_t, "gl_PrimitiveID"); add_system_value(SYSTEM_VALUE_VERTICES_IN, int_t, "gl_PatchVerticesIn"); add_system_value(SYSTEM_VALUE_TESS_COORD, vec3_t, "gl_TessCoord"); @@ -1073,6 +1077,12 @@ builtin_variable_generator::generate_tes_special_vars() "gl_TessLevelOuter"); add_system_value(SYSTEM_VALUE_TESS_LEVEL_INNER, array(float_t, 2), "gl_TessLevelInner"); + if (state->ARB_shader_viewport_layer_array_enable) { + var = add_output(VARYING_SLOT_LAYER, int_t, "gl_Layer"); + var->data.interpolation = INTERP_MODE_FLAT; + var = add_output(VARYING_SLOT_VIEWPORT, int_t, "gl_ViewportIndex"); + var->data.interpolation = INTERP_MODE_FLAT; + } } diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index 0e9bfa713f..84d923f108 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -618,6 +618,7 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = { EXT(ARB_shader_subroutine), EXT(ARB_shader_texture_image_samples), EXT(ARB_shader_texture_lod), + EXT(ARB_shader_viewport_layer_array), EXT(ARB_shading_language_420pack), EXT(ARB_shading_language_packing), EXT(ARB_tessellation_shader), diff --git a/src/compiler/glsl/glsl_parser_extras.h b/src/compiler/glsl/glsl_parser_extras.h index 027b97edcd..e19f6ade59 100644 --- a/src/compiler/glsl/glsl_parser_extras.h +++ b/src/compiler/glsl/glsl_parser_extras.h @@ -632,6 +632,8 @@ struct _mesa_glsl_parse_state { bool ARB_shader_texture_image_samples_warn; bool ARB_shader_texture_lod_enable; bool ARB_shader_texture_lod_warn; + bool ARB_shader_viewport_layer_array_enable; + bool ARB_shader_viewport_layer_array_warn; bool ARB_shading_language_420pack_enable; bool ARB_shading_language_420pack_warn; bool ARB_shading_language_packing_enable; diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c index b1aefc0f92..2eb155415d 100644 --- a/src/mesa/drivers/dri/i965/intel_extensions.c +++ b/src/mesa/drivers/dri/i965/intel_extensions.c @@ -330,6 +330,7 @@ intelInitExtensions(struct gl_context *ctx) */ if (ctx->API == API_OPENGL_CORE) { ctx->Extensions.ARB_shader_subroutine = true; + ctx->Extensions.ARB_shader_viewport_layer_array = true; ctx->Extensions.ARB_viewport_array = true; ctx->Extensions.AMD_vertex_shader_viewport_index = true; } diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h index 1f8da7e824..c40dd7940c 100644 --- a/src/mesa/main/extensions_table.h +++ b/src/mesa/main/extensions_table.h @@ -117,6 +117,7 @@ EXT(ARB_shader_storage_buffer_object , ARB_shader_storage_buffer_object EXT(ARB_shader_subroutine , ARB_shader_subroutine , x , GLC, x , x , 2010) EXT(ARB_shader_texture_image_samples , ARB_shader_texture_image_samples , GLL, GLC, x , x , 2014) EXT(ARB_shader_texture_lod , ARB_shader_texture_lod , GLL, GLC, x , x , 2009) +EXT(ARB_shader_viewport_layer_array , ARB_shader_viewport_layer_array , x , GLC, x , x , 2015) EXT(ARB_shading_language_100 , dummy_true , GLL, x , x , x , 2003) EXT(ARB_shading_language_420pack , ARB_shading_language_420pack , GLL, GLC, x , x , 2011) EXT(ARB_shading_language_packing , ARB_shading_language_packing , GLL, GLC, x , x , 2011) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index d00829c1f3..d82b8ce9a1 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3871,6 +3871,7 @@ struct gl_extensions GLboolean ARB_shader_subroutine; GLboolean ARB_shader_texture_image_samples; GLboolean ARB_shader_texture_lod; + GLboolean ARB_shader_viewport_layer_array; GLboolean ARB_shading_language_packing; GLboolean ARB_shading_language_420pack; GLboolean ARB_shadow; |