summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/mtypes.h
diff options
context:
space:
mode:
authorTimothy Arceri <timothy.arceri@collabora.com>2016-06-30 14:44:59 +1000
committerTimothy Arceri <timothy.arceri@collabora.com>2016-06-30 16:51:25 +1000
commit1591e668e162daf4057a0d44df4e70f19b94fc76 (patch)
tree2d6482014ef8ca198bd15d578d6ffbd2ff32d2da /src/mesa/main/mtypes.h
parentfd2b3da5c8cdbc5b00436185a3c03dfb7b7bd853 (diff)
downloadexternal_mesa3d-1591e668e162daf4057a0d44df4e70f19b94fc76.zip
external_mesa3d-1591e668e162daf4057a0d44df4e70f19b94fc76.tar.gz
external_mesa3d-1591e668e162daf4057a0d44df4e70f19b94fc76.tar.bz2
glsl/mesa: move duplicate shader fields into new struct gl_shader_info
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Diffstat (limited to 'src/mesa/main/mtypes.h')
-rw-r--r--src/mesa/main/mtypes.h241
1 files changed, 80 insertions, 161 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index fdd445f..cab315d 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2235,62 +2235,10 @@ struct gl_subroutine_function
};
/**
- * A linked GLSL shader object.
+ * Shader information needed by both gl_shader and gl_linked shader.
*/
-struct gl_linked_shader
+struct gl_shader_info
{
- gl_shader_stage Stage;
-
- struct gl_program *Program; /**< Post-compile assembly code */
-
- /**
- * \name Sampler tracking
- *
- * \note Each of these fields is only set post-linking.
- */
- /*@{*/
- unsigned num_samplers; /**< Number of samplers used by this shader. */
- GLbitfield active_samplers; /**< Bitfield of which samplers are used */
- GLbitfield shadow_samplers; /**< Samplers used for shadow sampling. */
- /*@}*/
-
- /**
- * Map from sampler unit to texture unit (set by glUniform1i())
- *
- * A sampler unit is associated with each sampler uniform by the linker.
- * The sampler unit associated with each uniform is stored in the
- * \c gl_uniform_storage::sampler field.
- */
- GLubyte SamplerUnits[MAX_SAMPLERS];
- /** Which texture target is being sampled (TEXTURE_1D/2D/3D/etc_INDEX) */
- gl_texture_index SamplerTargets[MAX_SAMPLERS];
-
- /**
- * Number of default uniform block components used by this shader.
- *
- * This field is only set post-linking.
- */
- unsigned num_uniform_components;
-
- /**
- * Number of combined uniform components used by this shader.
- *
- * This field is only set post-linking. It is the sum of the uniform block
- * sizes divided by sizeof(float), and num_uniform_compoennts.
- */
- unsigned num_combined_uniform_components;
-
- unsigned NumUniformBlocks;
- struct gl_uniform_block **UniformBlocks;
-
- unsigned NumShaderStorageBlocks;
- struct gl_uniform_block **ShaderStorageBlocks;
-
- struct exec_list *ir;
- struct exec_list *packed_varyings;
- struct exec_list *fragdata_arrays;
- struct glsl_symbol_table *symbols;
-
bool uses_builtin_functions;
bool uses_gl_fragcoord;
bool redeclares_gl_fragcoord;
@@ -2366,6 +2314,81 @@ struct gl_linked_shader
} Geom;
/**
+ * Whether early fragment tests are enabled as defined by
+ * ARB_shader_image_load_store.
+ */
+ bool EarlyFragmentTests;
+
+ /**
+ * Compute shader state from ARB_compute_shader layout qualifiers.
+ */
+ struct {
+ /**
+ * Size specified using local_size_{x,y,z}, or all 0's to indicate that
+ * it's not set in this shader.
+ */
+ unsigned LocalSize[3];
+ } Comp;
+};
+
+/**
+ * A linked GLSL shader object.
+ */
+struct gl_linked_shader
+{
+ gl_shader_stage Stage;
+
+ struct gl_program *Program; /**< Post-compile assembly code */
+
+ /**
+ * \name Sampler tracking
+ *
+ * \note Each of these fields is only set post-linking.
+ */
+ /*@{*/
+ unsigned num_samplers; /**< Number of samplers used by this shader. */
+ GLbitfield active_samplers; /**< Bitfield of which samplers are used */
+ GLbitfield shadow_samplers; /**< Samplers used for shadow sampling. */
+ /*@}*/
+
+ /**
+ * Map from sampler unit to texture unit (set by glUniform1i())
+ *
+ * A sampler unit is associated with each sampler uniform by the linker.
+ * The sampler unit associated with each uniform is stored in the
+ * \c gl_uniform_storage::sampler field.
+ */
+ GLubyte SamplerUnits[MAX_SAMPLERS];
+ /** Which texture target is being sampled (TEXTURE_1D/2D/3D/etc_INDEX) */
+ gl_texture_index SamplerTargets[MAX_SAMPLERS];
+
+ /**
+ * Number of default uniform block components used by this shader.
+ *
+ * This field is only set post-linking.
+ */
+ unsigned num_uniform_components;
+
+ /**
+ * Number of combined uniform components used by this shader.
+ *
+ * This field is only set post-linking. It is the sum of the uniform block
+ * sizes divided by sizeof(float), and num_uniform_compoennts.
+ */
+ unsigned num_combined_uniform_components;
+
+ unsigned NumUniformBlocks;
+ struct gl_uniform_block **UniformBlocks;
+
+ unsigned NumShaderStorageBlocks;
+ struct gl_uniform_block **ShaderStorageBlocks;
+
+ struct exec_list *ir;
+ struct exec_list *packed_varyings;
+ struct exec_list *fragdata_arrays;
+ struct glsl_symbol_table *symbols;
+
+ /**
* Map from image uniform index to image unit (set by glUniform1i())
*
* An image uniform index is associated with each image uniform by
@@ -2395,23 +2418,6 @@ struct gl_linked_shader
unsigned NumAtomicBuffers;
/**
- * Whether early fragment tests are enabled as defined by
- * ARB_shader_image_load_store.
- */
- bool EarlyFragmentTests;
-
- /**
- * Compute shader state from ARB_compute_shader layout qualifiers.
- */
- struct {
- /**
- * Size specified using local_size_{x,y,z}, or all 0's to indicate that
- * it's not set in this shader.
- */
- unsigned LocalSize[3];
- } Comp;
-
- /**
* Number of types for subroutine uniforms.
*/
GLuint NumSubroutineUniformTypes;
@@ -2431,6 +2437,8 @@ struct gl_linked_shader
GLuint NumSubroutineFunctions;
GLuint MaxSubroutineFunctionIndex;
struct gl_subroutine_function *SubroutineFunctions;
+
+ struct gl_shader_info info;
};
/**
@@ -2461,96 +2469,7 @@ struct gl_shader
struct exec_list *ir;
struct glsl_symbol_table *symbols;
- bool uses_builtin_functions;
- bool uses_gl_fragcoord;
- bool redeclares_gl_fragcoord;
- bool ARB_fragment_coord_conventions_enable;
-
- /**
- * Fragment shader state from GLSL 1.50 layout qualifiers.
- */
- bool origin_upper_left;
- bool pixel_center_integer;
-
- struct {
- /** Global xfb_stride out qualifier if any */
- GLuint BufferStride[MAX_FEEDBACK_BUFFERS];
- } TransformFeedback;
-
- /**
- * 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 {
- /**
- * GL_TRIANGLES, GL_QUADS, GL_ISOLINES or PRIM_UNKNOWN if it's not set
- * in this shader.
- */
- GLenum PrimitiveMode;
- /**
- * GL_EQUAL, GL_FRACTIONAL_ODD, GL_FRACTIONAL_EVEN, or 0 if it's not set
- * in this shader.
- */
- GLenum Spacing;
- /**
- * GL_CW, GL_CCW, or 0 if it's not set in this shader.
- */
- GLenum VertexOrder;
- /**
- * 1, 0, or -1 if it's not set in this shader.
- */
- int PointMode;
- } TessEval;
-
- /**
- * Geometry shader state from GLSL 1.50 layout qualifiers.
- */
- struct {
- GLint VerticesOut;
- /**
- * 0 - Invocations count not declared in shader, or
- * 1 .. MAX_GEOMETRY_SHADER_INVOCATIONS
- */
- GLint Invocations;
- /**
- * GL_POINTS, GL_LINES, GL_LINES_ADJACENCY, GL_TRIANGLES, or
- * GL_TRIANGLES_ADJACENCY, or PRIM_UNKNOWN if it's not set in this
- * shader.
- */
- GLenum InputType;
- /**
- * GL_POINTS, GL_LINE_STRIP or GL_TRIANGLE_STRIP, or PRIM_UNKNOWN if
- * it's not set in this shader.
- */
- GLenum OutputType;
- } Geom;
-
- /**
- * Whether early fragment tests are enabled as defined by
- * ARB_shader_image_load_store.
- */
- bool EarlyFragmentTests;
-
- /**
- * Compute shader state from ARB_compute_shader layout qualifiers.
- */
- struct {
- /**
- * Size specified using local_size_{x,y,z}, or all 0's to indicate that
- * it's not set in this shader.
- */
- unsigned LocalSize[3];
- } Comp;
+ struct gl_shader_info info;
};