aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2016-06-22 12:41:28 +1000
committerTimothy Arceri <[email protected]>2016-06-23 11:01:46 +1000
commitab99196b6bc5b0170db20db6cc3837ce7642d22a (patch)
tree0e37f19fba45438d45cad609ab4b940b0ab6b997 /src/mesa/main
parent24b3be093870a9a77325ac33c8fce97fae143e8e (diff)
glsl/mesa: stop duplicating geom and tcs layout values
We already store these in gl_shader and gl_program here we remove it from gl_shader_program and just use the values from gl_shader. This will allow us to keep the shader cache restore code as simple as it can be while making it somewhat clearer where these values originate from. Reviewed-by: Iago Toral Quiroga <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/api_validate.c6
-rw-r--r--src/mesa/main/mtypes.h20
-rw-r--r--src/mesa/main/shaderapi.c43
-rw-r--r--src/mesa/main/shaderobj.c6
4 files changed, 36 insertions, 39 deletions
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index ab34d99834c..8efbf50c092 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -200,7 +200,8 @@ _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name)
*/
if (ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY]) {
const GLenum geom_mode =
- ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY]->Geom.InputType;
+ ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY]->
+ _LinkedShaders[MESA_SHADER_GEOMETRY]->Geom.InputType;
struct gl_shader_program *tes =
ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL];
GLenum mode_before_gs = mode;
@@ -305,7 +306,8 @@ _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name)
GLboolean pass = GL_TRUE;
if(ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY]) {
- switch (ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY]->Geom.OutputType) {
+ switch (ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY]->
+ _LinkedShaders[MESA_SHADER_GEOMETRY]->Geom.OutputType) {
case GL_POINTS:
pass = ctx->TransformFeedback.Mode == GL_POINTS;
break;
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 99fa779a807..73ae55d83eb 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2712,17 +2712,6 @@ struct gl_shader_program
enum gl_frag_depth_layout FragDepthLayout;
/**
- * Tessellation Control shader state from layout qualifiers.
- */
- struct {
- /**
- * 0 - vertices not declared in shader, or
- * 1 .. GL_MAX_PATCH_VERTICES
- */
- GLint VerticesOut;
- } TessCtrl;
-
- /**
* Tessellation Evaluation shader state from layout qualifiers.
*/
struct {
@@ -2742,14 +2731,7 @@ struct gl_shader_program
*/
struct {
GLint VerticesIn;
- GLint VerticesOut;
- /**
- * 1 .. MAX_GEOMETRY_SHADER_INVOCATIONS
- */
- GLint Invocations;
- GLenum InputType; /**< GL_POINTS, GL_LINES, GL_LINES_ADJACENCY_ARB,
- GL_TRIANGLES, or GL_TRIANGLES_ADJACENCY_ARB */
- GLenum OutputType; /**< GL_POINTS, GL_LINE_STRIP or GL_TRIANGLE_STRIP */
+
/**
* True if gl_ClipDistance is written to. Copied into
* gl_geometry_program by _mesa_copy_linked_program_data().
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index b65c0dc6c37..07250cd768c 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -731,26 +731,34 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname,
case GL_GEOMETRY_VERTICES_OUT:
if (!has_core_gs)
break;
- if (check_gs_query(ctx, shProg))
- *params = shProg->Geom.VerticesOut;
+ if (check_gs_query(ctx, shProg)) {
+ *params = shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->
+ Geom.VerticesOut;
+ }
return;
case GL_GEOMETRY_SHADER_INVOCATIONS:
if (!has_core_gs || !ctx->Extensions.ARB_gpu_shader5)
break;
- if (check_gs_query(ctx, shProg))
- *params = shProg->Geom.Invocations;
+ if (check_gs_query(ctx, shProg)) {
+ *params = shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->
+ Geom.Invocations;
+ }
return;
case GL_GEOMETRY_INPUT_TYPE:
if (!has_core_gs)
break;
- if (check_gs_query(ctx, shProg))
- *params = shProg->Geom.InputType;
+ if (check_gs_query(ctx, shProg)) {
+ *params = shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->
+ Geom.InputType;
+ }
return;
case GL_GEOMETRY_OUTPUT_TYPE:
if (!has_core_gs)
break;
- if (check_gs_query(ctx, shProg))
- *params = shProg->Geom.OutputType;
+ if (check_gs_query(ctx, shProg)) {
+ *params = shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->
+ Geom.OutputType;
+ }
return;
case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH: {
unsigned i;
@@ -825,8 +833,10 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname,
case GL_TESS_CONTROL_OUTPUT_VERTICES:
if (!has_tess)
break;
- if (check_tcs_query(ctx, shProg))
- *params = shProg->TessCtrl.VerticesOut;
+ if (check_tcs_query(ctx, shProg)) {
+ *params = shProg->_LinkedShaders[MESA_SHADER_TESS_CTRL]->
+ TessCtrl.VerticesOut;
+ }
return;
case GL_TESS_GEN_MODE:
if (!has_tess)
@@ -2159,7 +2169,8 @@ _mesa_copy_linked_program_data(gl_shader_stage type,
case MESA_SHADER_TESS_CTRL: {
struct gl_tess_ctrl_program *dst_tcp =
(struct gl_tess_ctrl_program *) dst;
- dst_tcp->VerticesOut = src->TessCtrl.VerticesOut;
+ dst_tcp->VerticesOut =
+ src->_LinkedShaders[MESA_SHADER_TESS_CTRL]->TessCtrl.VerticesOut;
break;
}
case MESA_SHADER_TESS_EVAL: {
@@ -2177,11 +2188,13 @@ _mesa_copy_linked_program_data(gl_shader_stage type,
}
case MESA_SHADER_GEOMETRY: {
struct gl_geometry_program *dst_gp = (struct gl_geometry_program *) dst;
+ struct gl_shader *geom_sh = src->_LinkedShaders[MESA_SHADER_GEOMETRY];
+
dst_gp->VerticesIn = src->Geom.VerticesIn;
- dst_gp->VerticesOut = src->Geom.VerticesOut;
- dst_gp->Invocations = src->Geom.Invocations;
- dst_gp->InputType = src->Geom.InputType;
- dst_gp->OutputType = src->Geom.OutputType;
+ dst_gp->VerticesOut = geom_sh->Geom.VerticesOut;
+ dst_gp->Invocations = geom_sh->Geom.Invocations;
+ dst_gp->InputType = geom_sh->Geom.InputType;
+ dst_gp->OutputType = geom_sh->Geom.OutputType;
dst->ClipDistanceArraySize = src->Geom.ClipDistanceArraySize;
dst->CullDistanceArraySize = src->Geom.CullDistanceArraySize;
dst_gp->UsesEndPrimitive = src->Geom.UsesEndPrimitive;
diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c
index 8283555740b..f3d5c2ee5ba 100644
--- a/src/mesa/main/shaderobj.c
+++ b/src/mesa/main/shaderobj.c
@@ -92,6 +92,9 @@ void
_mesa_init_shader(struct gl_context *ctx, struct gl_shader *shader)
{
shader->RefCount = 1;
+ shader->Geom.VerticesOut = -1;
+ shader->Geom.InputType = GL_TRIANGLES;
+ shader->Geom.OutputType = GL_TRIANGLE_STRIP;
}
/**
@@ -230,9 +233,6 @@ init_shader_program(struct gl_shader_program *prog)
prog->FragDataBindings = string_to_uint_map_ctor();
prog->FragDataIndexBindings = string_to_uint_map_ctor();
- prog->Geom.VerticesOut = -1;
- prog->Geom.InputType = GL_TRIANGLES;
- prog->Geom.OutputType = GL_TRIANGLE_STRIP;
prog->Geom.UsesEndPrimitive = false;
prog->Geom.UsesStreams = false;