aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa')
-rw-r--r--mesalib/src/mesa/main/context.c6
-rw-r--r--mesalib/src/mesa/main/get.c13
-rw-r--r--mesalib/src/mesa/main/get_hash_params.py19
-rw-r--r--mesalib/src/mesa/main/mtypes.h25
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c5
5 files changed, 55 insertions, 13 deletions
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index d726d117b..58f42cc5b 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -478,18 +478,24 @@ init_program_limits(struct gl_context *ctx, GLenum type,
prog->MaxAttribs = MAX_VERTEX_GENERIC_ATTRIBS;
prog->MaxAddressRegs = MAX_VERTEX_PROGRAM_ADDRESS_REGS;
prog->MaxUniformComponents = 4 * MAX_UNIFORMS;
+ prog->MaxInputComponents = 0; /* value not used */
+ prog->MaxOutputComponents = 16 * 4; /* old limit not to break tnl and swrast */
break;
case GL_FRAGMENT_PROGRAM_ARB:
prog->MaxParameters = MAX_NV_FRAGMENT_PROGRAM_PARAMS;
prog->MaxAttribs = MAX_NV_FRAGMENT_PROGRAM_INPUTS;
prog->MaxAddressRegs = MAX_FRAGMENT_PROGRAM_ADDRESS_REGS;
prog->MaxUniformComponents = 4 * MAX_UNIFORMS;
+ prog->MaxInputComponents = 16 * 4; /* old limit not to break tnl and swrast */
+ prog->MaxOutputComponents = 0; /* value not used */
break;
case MESA_GEOMETRY_PROGRAM:
prog->MaxParameters = MAX_VERTEX_PROGRAM_PARAMS;
prog->MaxAttribs = MAX_VERTEX_GENERIC_ATTRIBS;
prog->MaxAddressRegs = MAX_VERTEX_PROGRAM_ADDRESS_REGS;
prog->MaxUniformComponents = MAX_GEOMETRY_UNIFORM_COMPONENTS;
+ prog->MaxInputComponents = 16 * 4; /* old limit not to break tnl and swrast */
+ prog->MaxOutputComponents = 16 * 4; /* old limit not to break tnl and swrast */
break;
default:
assert(0 && "Bad program type in init_program_limits()");
diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c
index 4f6f59ae6..7af5f5591 100644
--- a/mesalib/src/mesa/main/get.c
+++ b/mesalib/src/mesa/main/get.c
@@ -396,6 +396,12 @@ static const int extra_gl32_es3[] = {
EXTRA_END,
};
+static const int extra_gl32_ARB_geometry_shader4[] = {
+ EXTRA_VERSION_32,
+ EXT(ARB_geometry_shader4),
+ EXTRA_END
+};
+
static const int
extra_ARB_vertex_program_api_es2[] = {
EXT(ARB_vertex_program),
@@ -502,7 +508,9 @@ print_table_stats(int api)
void _mesa_init_get_hash(struct gl_context *ctx)
{
#ifdef GET_DEBUG
- print_table_stats();
+ print_table_stats(ctx->API);
+#else
+ (void) ctx;
#endif
}
@@ -709,11 +717,10 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
case GL_COMPRESSED_TEXTURE_FORMATS_ARB:
v->value_int_n.n =
_mesa_get_compressed_formats(ctx, v->value_int_n.ints);
- ASSERT(v->value_int_n.n <= ARRAY_SIZE(v->value_int_n.ints));
+ ASSERT(v->value_int_n.n <= (int) ARRAY_SIZE(v->value_int_n.ints));
break;
case GL_MAX_VARYING_FLOATS_ARB:
- case GL_MAX_FRAGMENT_INPUT_COMPONENTS:
v->value_int = ctx->Const.MaxVarying * 4;
break;
diff --git a/mesalib/src/mesa/main/get_hash_params.py b/mesalib/src/mesa/main/get_hash_params.py
index 30855c37b..fb321a3df 100644
--- a/mesalib/src/mesa/main/get_hash_params.py
+++ b/mesalib/src/mesa/main/get_hash_params.py
@@ -329,8 +329,9 @@ descriptor=[
[ "MAJOR_VERSION", "LOC_CUSTOM, TYPE_INT, 0, extra_gl30_es3" ],
[ "MINOR_VERSION", "LOC_CUSTOM, TYPE_INT, 0, extra_gl30_es3" ],
- # GL 3.0 / GLES3
- [ "MAX_FRAGMENT_INPUT_COMPONENTS", "LOC_CUSTOM, TYPE_INT, 0, extra_gl32_es3" ],
+ # GL 3.2 / GLES3
+ [ "MAX_VERTEX_OUTPUT_COMPONENTS", "CONTEXT_INT(Const.VertexProgram.MaxOutputComponents), extra_gl32_es3" ],
+ [ "MAX_FRAGMENT_INPUT_COMPONENTS", "CONTEXT_INT(Const.FragmentProgram.MaxInputComponents), extra_gl32_es3" ],
# GL_ARB_ES3_compatibility
[ "MAX_ELEMENT_INDEX", "CONTEXT_INT64(Const.MaxElementIndex), extra_ARB_ES3_compatibility_api_es3"],
@@ -646,12 +647,12 @@ descriptor=[
[ "MAX_VERTEX_STREAMS", "CONTEXT_INT(Const.MaxVertexStreams), extra_ARB_transform_feedback3" ],
# GL_ARB_geometry_shader4
- [ "MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB", "CONTEXT_INT(Const.GeometryProgram.MaxTextureImageUnits), extra_ARB_geometry_shader4" ],
- [ "MAX_GEOMETRY_OUTPUT_VERTICES_ARB", "CONTEXT_INT(Const.MaxGeometryOutputVertices), extra_ARB_geometry_shader4" ],
- [ "MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB", "CONTEXT_INT(Const.MaxGeometryTotalOutputComponents), extra_ARB_geometry_shader4" ],
- [ "MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB", "CONTEXT_INT(Const.GeometryProgram.MaxUniformComponents), extra_ARB_geometry_shader4" ],
- [ "MAX_GEOMETRY_VARYING_COMPONENTS_ARB", "CONTEXT_INT(Const.MaxVaryingComponents), extra_ARB_geometry_shader4" ],
- [ "MAX_VERTEX_VARYING_COMPONENTS_ARB", "CONTEXT_INT(Const.MaxVaryingComponents), extra_ARB_geometry_shader4" ],
+ [ "MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB", "CONTEXT_INT(Const.GeometryProgram.MaxTextureImageUnits), extra_gl32_ARB_geometry_shader4" ],
+ [ "MAX_GEOMETRY_OUTPUT_VERTICES_ARB", "CONTEXT_INT(Const.MaxGeometryOutputVertices), extra_gl32_ARB_geometry_shader4" ],
+ [ "MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB", "CONTEXT_INT(Const.MaxGeometryTotalOutputComponents), extra_gl32_ARB_geometry_shader4" ],
+ [ "MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB", "CONTEXT_INT(Const.GeometryProgram.MaxUniformComponents), extra_gl32_ARB_geometry_shader4" ],
+ [ "MAX_GEOMETRY_VARYING_COMPONENTS_ARB", "CONTEXT_INT(Const.GeometryProgram.MaxOutputComponents), extra_ARB_geometry_shader4" ],
+ [ "MAX_VERTEX_VARYING_COMPONENTS_ARB", "CONTEXT_INT(Const.VertexProgram.MaxOutputComponents), extra_ARB_geometry_shader4" ],
# GL_ARB_color_buffer_float
[ "RGBA_FLOAT_MODE_ARB", "BUFFER_FIELD(Visual.floatMode, TYPE_BOOLEAN), extra_core_ARB_color_buffer_float_and_new_buffers" ],
@@ -691,6 +692,8 @@ descriptor=[
# GL 3.2
[ "CONTEXT_PROFILE_MASK", "CONTEXT_INT(Const.ProfileMask), extra_version_32" ],
+ [ "MAX_GEOMETRY_INPUT_COMPONENTS", "CONTEXT_INT(Const.GeometryProgram.MaxInputComponents), extra_version_32" ],
+ [ "MAX_GEOMETRY_OUTPUT_COMPONENTS", "CONTEXT_INT(Const.GeometryProgram.MaxOutputComponents), extra_version_32" ],
# GL_ARB_robustness
[ "RESET_NOTIFICATION_STRATEGY_ARB", "CONTEXT_ENUM(Const.ResetStrategy), NO_EXTRA" ],
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 6d700ece8..c88c1c67b 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -2832,6 +2832,30 @@ struct gl_program_constants
GLuint MaxNativeParameters;
/* For shaders */
GLuint MaxUniformComponents; /**< Usually == MaxParameters * 4 */
+
+ /**
+ * \name Per-stage input / output limits
+ *
+ * Previous to OpenGL 3.2, the intrastage data limits were advertised with
+ * a single value: GL_MAX_VARYING_COMPONENTS (GL_MAX_VARYING_VECTORS in
+ * ES). This is stored as \c gl_constants::MaxVarying.
+ *
+ * Starting with OpenGL 3.2, the limits are advertised with per-stage
+ * variables. Each stage as a certain number of outputs that it can feed
+ * to the next stage and a certain number inputs that it can consume from
+ * the previous stage.
+ *
+ * Vertex shader inputs do not participate this in this accounting.
+ * These are tracked exclusively by \c gl_program_constants::MaxAttribs.
+ *
+ * Fragment shader outputs do not participate this in this accounting.
+ * These are tracked exclusively by \c gl_constants::MaxDrawBuffers.
+ */
+ /*@{*/
+ GLuint MaxInputComponents;
+ GLuint MaxOutputComponents;
+ /*@}*/
+
/* ES 2.0 and GL_ARB_ES2_compatibility */
struct gl_precision LowFloat, MediumFloat, HighFloat;
struct gl_precision LowInt, MediumInt, HighInt;
@@ -2906,7 +2930,6 @@ struct gl_constants
/** Number of varying vectors between any two shader stages. */
GLuint MaxVarying;
- GLuint MaxVaryingComponents;
/** @{
* GL_ARB_uniform_buffer_object
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index 0b7001bae..97dd73210 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -256,7 +256,10 @@ void st_init_limits(struct st_context *st)
c->MaxVarying = screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT,
PIPE_SHADER_CAP_MAX_INPUTS);
c->MaxVarying = MIN2(c->MaxVarying, MAX_VARYING);
- c->MaxVaryingComponents = c->MaxVarying * 4;
+ c->FragmentProgram.MaxInputComponents = c->MaxVarying * 4;
+ c->VertexProgram.MaxOutputComponents = c->MaxVarying * 4;
+ c->GeometryProgram.MaxInputComponents = c->MaxVarying * 4;
+ c->GeometryProgram.MaxOutputComponents = c->MaxVarying * 4;
c->MinProgramTexelOffset = screen->get_param(screen, PIPE_CAP_MIN_TEXEL_OFFSET);
c->MaxProgramTexelOffset = screen->get_param(screen, PIPE_CAP_MAX_TEXEL_OFFSET);