From 2a1abdc8fe640583dac90dc316caf2d40b9ee4e2 Mon Sep 17 00:00:00 2001 From: marha Date: Mon, 14 Jan 2013 15:13:52 +0100 Subject: libxtrans xwininfo libX11 libXau libXmu libXdmcp mesa mkfontscale xkeyboard-config git update 14 jan 2013 libxtrans: ec3136232f7ce930f9ca812b6ab42a71b60af4af xwininfo: 3e60a26559221e561770710a8c4ed0b8ebc31afb libX11: 3cd974b1d4d1fa6389d3695fa9fcc0c22a51d50c libXau: 8570d287396934f26224c76d48d7f17d87380e72 libXmu: 9b253d99d5b4f3fbb681c2cb1b84f8f9acfee528 libXdmcp: ca65a92405500393f09d34388edbbf6350e6c146 mesa: e3e1ffb2520498584ef402213d0c8aa4303a46a3 mkfontscale: 1157b3039551b552b483f05f6a411e57941a87c0 --- mesalib/src/mesa/main/api_arrayelt.c | 2 +- mesalib/src/mesa/main/attrib.c | 3 + mesalib/src/mesa/main/enable.c | 33 ++++++++ mesalib/src/mesa/main/extensions.c | 2 + mesalib/src/mesa/main/format_unpack.c | 18 ++++ mesalib/src/mesa/main/get_hash_params.py | 14 ++-- mesalib/src/mesa/main/glformats.c | 83 +++++++++++++++---- mesalib/src/mesa/main/glformats.h | 9 ++ mesalib/src/mesa/main/mtypes.h | 24 +++++- mesalib/src/mesa/main/queryobj.c | 12 ++- mesalib/src/mesa/main/shaderapi.c | 137 +++++++++++++++++++++++++++++-- mesalib/src/mesa/main/shaderapi.h | 12 ++- mesalib/src/mesa/main/texformat.c | 8 +- mesalib/src/mesa/main/teximage.c | 15 ++-- mesalib/src/mesa/main/texstore.c | 18 +--- mesalib/src/mesa/main/uniform_query.cpp | 3 +- mesalib/src/mesa/main/varray.c | 5 +- 17 files changed, 338 insertions(+), 60 deletions(-) (limited to 'mesalib/src/mesa/main') diff --git a/mesalib/src/mesa/main/api_arrayelt.c b/mesalib/src/mesa/main/api_arrayelt.c index 0fa242997..ea3361488 100644 --- a/mesalib/src/mesa/main/api_arrayelt.c +++ b/mesalib/src/mesa/main/api_arrayelt.c @@ -1636,7 +1636,7 @@ void GLAPIENTRY _ae_ArrayElement( GLint elt ) /* If PrimitiveRestart is enabled and the index is the RestartIndex * then we call PrimitiveRestartNV and return. */ - if (ctx->Array.PrimitiveRestart && (elt == ctx->Array.RestartIndex)) { + if (ctx->Array._PrimitiveRestart && (elt == ctx->Array._RestartIndex)) { CALL_PrimitiveRestartNV((struct _glapi_table *)disp, ()); return; } diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c index a19d61054..d6f298d93 100644 --- a/mesalib/src/mesa/main/attrib.c +++ b/mesalib/src/mesa/main/attrib.c @@ -1377,7 +1377,10 @@ copy_array_attrib(struct gl_context *ctx, dest->LockFirst = src->LockFirst; dest->LockCount = src->LockCount; dest->PrimitiveRestart = src->PrimitiveRestart; + dest->PrimitiveRestartFixedIndex = src->PrimitiveRestartFixedIndex; + dest->_PrimitiveRestart = src->_PrimitiveRestart; dest->RestartIndex = src->RestartIndex; + dest->_RestartIndex = src->_RestartIndex; /* skip NewState */ /* skip RebindArrays */ diff --git a/mesalib/src/mesa/main/enable.c b/mesalib/src/mesa/main/enable.c index b48794f95..73257290e 100644 --- a/mesalib/src/mesa/main/enable.c +++ b/mesalib/src/mesa/main/enable.c @@ -48,6 +48,20 @@ } +static void +update_derived_primitive_restart_state(struct gl_context *ctx) +{ + /* Update derived primitive restart state. + */ + if (ctx->Array.PrimitiveRestart) + ctx->Array._RestartIndex = ctx->Array.RestartIndex; + else + ctx->Array._RestartIndex = ~0; + + ctx->Array._PrimitiveRestart = ctx->Array.PrimitiveRestart + || ctx->Array.PrimitiveRestartFixedIndex; +} + /** * Helper to enable/disable client-side state. */ @@ -119,6 +133,8 @@ client_state(struct gl_context *ctx, GLenum cap, GLboolean state) *var = state; + update_derived_primitive_restart_state(ctx); + if (state) arrayObj->_Enabled |= flag; else @@ -967,6 +983,17 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) if (ctx->Array.PrimitiveRestart != state) { FLUSH_VERTICES(ctx, _NEW_TRANSFORM); ctx->Array.PrimitiveRestart = state; + update_derived_primitive_restart_state(ctx); + } + break; + + case GL_PRIMITIVE_RESTART_FIXED_INDEX: + if (!_mesa_is_gles3(ctx) && !ctx->Extensions.ARB_ES3_compatibility) + goto invalid_enum_error; + if (ctx->Array.PrimitiveRestartFixedIndex != state) { + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + ctx->Array.PrimitiveRestartFixedIndex = state; + update_derived_primitive_restart_state(ctx); } break; @@ -1542,6 +1569,12 @@ _mesa_IsEnabled( GLenum cap ) } return ctx->Array.PrimitiveRestart; + case GL_PRIMITIVE_RESTART_FIXED_INDEX: + if (!_mesa_is_gles3(ctx) && !ctx->Extensions.ARB_ES3_compatibility) { + goto invalid_enum_error; + } + return ctx->Array.PrimitiveRestartFixedIndex; + /* GL3.0 - GL_framebuffer_sRGB */ case GL_FRAMEBUFFER_SRGB_EXT: if (!_mesa_is_desktop_gl(ctx)) diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c index 3486b65a4..c3c73fc26 100644 --- a/mesalib/src/mesa/main/extensions.c +++ b/mesalib/src/mesa/main/extensions.c @@ -100,6 +100,7 @@ static const struct extension extension_table[] = { { "GL_ARB_fragment_shader", o(ARB_fragment_shader), GL, 2002 }, { "GL_ARB_framebuffer_object", o(ARB_framebuffer_object), GL, 2005 }, { "GL_ARB_framebuffer_sRGB", o(EXT_framebuffer_sRGB), GL, 1998 }, + { "GL_ARB_get_program_binary", o(ARB_shader_objects), GL, 2010 }, { "GL_ARB_half_float_pixel", o(ARB_half_float_pixel), GL, 2003 }, { "GL_ARB_half_float_vertex", o(ARB_half_float_vertex), GL, 2008 }, { "GL_ARB_instanced_arrays", o(ARB_instanced_arrays), GL, 2008 }, @@ -249,6 +250,7 @@ static const struct extension extension_table[] = { { "GL_OES_fbo_render_mipmap", o(EXT_framebuffer_object), ES1 | ES2, 2005 }, { "GL_OES_fixed_point", o(dummy_true), ES1, 2002 }, { "GL_OES_framebuffer_object", o(EXT_framebuffer_object), ES1, 2005 }, + { "GL_OES_get_program_binary", o(ARB_shader_objects), ES2, 2008 }, { "GL_OES_mapbuffer", o(dummy_true), ES1 | ES2, 2005 }, { "GL_OES_matrix_get", o(dummy_true), ES1, 2004 }, { "GL_OES_packed_depth_stencil", o(EXT_packed_depth_stencil), ES1 | ES2, 2007 }, diff --git a/mesalib/src/mesa/main/format_unpack.c b/mesalib/src/mesa/main/format_unpack.c index d34a27b82..92ce86908 100644 --- a/mesalib/src/mesa/main/format_unpack.c +++ b/mesalib/src/mesa/main/format_unpack.c @@ -2696,6 +2696,20 @@ unpack_int_rgba_ABGR2101010_UINT(const GLuint *src, GLuint dst[][4], GLuint n) } } +static void +unpack_int_rgba_ARGB2101010(const GLuint *src, GLuint dst[][4], GLuint n) +{ + unsigned int i; + + for (i = 0; i < n; i++) { + GLuint tmp = src[i]; + dst[i][0] = (tmp >> 20) & 0x3ff; + dst[i][1] = (tmp >> 10) & 0x3ff; + dst[i][2] = (tmp >> 0) & 0x3ff; + dst[i][3] = (tmp >> 30) & 0x3; + } +} + void _mesa_unpack_uint_rgba_row(gl_format format, GLuint n, const void *src, GLuint dst[][4]) @@ -2871,6 +2885,10 @@ _mesa_unpack_uint_rgba_row(gl_format format, GLuint n, unpack_int_rgba_ABGR2101010_UINT(src, dst, n); break; + case MESA_FORMAT_ARGB2101010: + unpack_int_rgba_ARGB2101010(src, dst, n); + break; + default: _mesa_problem(NULL, "%s: bad format %s", __FUNCTION__, _mesa_get_format_name(format)); diff --git a/mesalib/src/mesa/main/get_hash_params.py b/mesalib/src/mesa/main/get_hash_params.py index 3db820a77..26a722a87 100644 --- a/mesalib/src/mesa/main/get_hash_params.py +++ b/mesalib/src/mesa/main/get_hash_params.py @@ -310,6 +310,12 @@ descriptor=[ [ "MAX_VARYING_VECTORS", "CONTEXT_INT(Const.MaxVarying), extra_ARB_ES2_compatibility_api_es2" ], [ "MAX_VERTEX_UNIFORM_VECTORS", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_ES2_compatibility_api_es2" ], [ "MAX_FRAGMENT_UNIFORM_VECTORS", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_ES2_compatibility_api_es2" ], + [ "NUM_SHADER_BINARY_FORMATS", "CONST(0), extra_ARB_ES2_compatibility_api_es2" ], + [ "SHADER_BINARY_FORMATS", "CONST(0), extra_ARB_ES2_compatibility_api_es2" ], + +# GL_ARB_get_program_binary / GL_OES_get_program_binary + [ "NUM_PROGRAM_BINARY_FORMATS", "CONST(0), extra_ARB_shader_objects" ], + [ "PROGRAM_BINARY_FORMATS", "LOC_CUSTOM, TYPE_INVALID, 0, extra_ARB_shader_objects" ], ]}, # GLES3 is not a typo. @@ -379,14 +385,6 @@ descriptor=[ [ "TEXTURE_EXTERNAL_OES", "LOC_CUSTOM, TYPE_BOOLEAN, 0, extra_OES_EGL_image_external" ], ]}, -# Enums unique to OpenGL ES 2.0 -{ "apis": ["GLES2"], "params": [ -# OES_get_program_binary - [ "NUM_SHADER_BINARY_FORMATS", "CONST(0), NO_EXTRA" ], - [ "SHADER_BINARY_FORMATS", "CONST(0), NO_EXTRA" ], -]}, - - # Remaining enums are only in OpenGL { "apis": ["GL", "GL_CORE"], "params": [ [ "ACCUM_RED_BITS", "BUFFER_INT(Visual.accumRedBits), NO_EXTRA" ], diff --git a/mesalib/src/mesa/main/glformats.c b/mesalib/src/mesa/main/glformats.c index f33a0503d..ff56ffad0 100644 --- a/mesalib/src/mesa/main/glformats.c +++ b/mesalib/src/mesa/main/glformats.c @@ -271,7 +271,8 @@ _mesa_bytes_per_pixel(GLenum format, GLenum type) case GL_UNSIGNED_INT_10_10_10_2: case GL_UNSIGNED_INT_2_10_10_10_REV: if (format == GL_RGBA || format == GL_BGRA || format == GL_ABGR_EXT || - format == GL_RGBA_INTEGER_EXT || format == GL_BGRA_INTEGER_EXT) + format == GL_RGBA_INTEGER_EXT || format == GL_BGRA_INTEGER_EXT || + format == GL_RGB) return sizeof(GLuint); else return -1; @@ -353,21 +354,9 @@ _mesa_bytes_per_vertex_attrib(GLint comps, GLenum type) * Test if the given format is an integer (non-normalized) format. */ GLboolean -_mesa_is_enum_format_integer(GLenum format) +_mesa_is_enum_format_unsigned_int(GLenum format) { switch (format) { - /* generic integer formats */ - case GL_RED_INTEGER_EXT: - case GL_GREEN_INTEGER_EXT: - case GL_BLUE_INTEGER_EXT: - case GL_ALPHA_INTEGER_EXT: - case GL_RGB_INTEGER_EXT: - case GL_RGBA_INTEGER_EXT: - case GL_BGR_INTEGER_EXT: - case GL_BGRA_INTEGER_EXT: - case GL_LUMINANCE_INTEGER_EXT: - case GL_LUMINANCE_ALPHA_INTEGER_EXT: - case GL_RG_INTEGER: /* specific integer formats */ case GL_RGBA32UI_EXT: case GL_RGB32UI_EXT: @@ -393,6 +382,34 @@ _mesa_is_enum_format_integer(GLenum format) case GL_INTENSITY8UI_EXT: case GL_LUMINANCE8UI_EXT: case GL_LUMINANCE_ALPHA8UI_EXT: + case GL_RGB10_A2UI: + return GL_TRUE; + default: + return GL_FALSE; + } +} + + +/** + * Test if the given format is an integer (non-normalized) format. + */ +GLboolean +_mesa_is_enum_format_signed_int(GLenum format) +{ + switch (format) { + /* generic integer formats */ + case GL_RED_INTEGER_EXT: + case GL_GREEN_INTEGER_EXT: + case GL_BLUE_INTEGER_EXT: + case GL_ALPHA_INTEGER_EXT: + case GL_RGB_INTEGER_EXT: + case GL_RGBA_INTEGER_EXT: + case GL_BGR_INTEGER_EXT: + case GL_BGRA_INTEGER_EXT: + case GL_LUMINANCE_INTEGER_EXT: + case GL_LUMINANCE_ALPHA_INTEGER_EXT: + case GL_RG_INTEGER: + /* specific integer formats */ case GL_RGBA32I_EXT: case GL_RGB32I_EXT: case GL_RG32I: @@ -417,7 +434,6 @@ _mesa_is_enum_format_integer(GLenum format) case GL_INTENSITY8I_EXT: case GL_LUMINANCE8I_EXT: case GL_LUMINANCE_ALPHA8I_EXT: - case GL_RGB10_A2UI: return GL_TRUE; default: return GL_FALSE; @@ -425,6 +441,17 @@ _mesa_is_enum_format_integer(GLenum format) } +/** + * Test if the given format is an integer (non-normalized) format. + */ +GLboolean +_mesa_is_enum_format_integer(GLenum format) +{ + return _mesa_is_enum_format_unsigned_int(format) || + _mesa_is_enum_format_signed_int(format); +} + + /** * Test if the given type is an integer (non-normalized) format. */ @@ -1031,6 +1058,32 @@ _mesa_base_format_has_channel(GLenum base_format, GLenum pname) } +/** + * Returns the number of channels/components for a base format. + */ +GLint +_mesa_base_format_component_count(GLenum base_format) +{ + switch (base_format) { + case GL_RED: + case GL_ALPHA: + case GL_INTENSITY: + case GL_DEPTH_COMPONENT: + return 1; + case GL_RG: + case GL_LUMINANCE_ALPHA: + case GL_DEPTH_STENCIL: + return 2; + case GL_RGB: + return 3; + case GL_RGBA: + return 4; + default: + return -1; + } +} + + /** * If format is a generic compressed format, return the corresponding * non-compressed format. For other formats, return the format as-is. diff --git a/mesalib/src/mesa/main/glformats.h b/mesalib/src/mesa/main/glformats.h index ccfb5e13c..fe604ddc9 100644 --- a/mesalib/src/mesa/main/glformats.h +++ b/mesalib/src/mesa/main/glformats.h @@ -61,6 +61,12 @@ _mesa_is_type_unsigned(GLenum type); extern GLboolean _mesa_is_enum_format_integer(GLenum format); +extern GLboolean +_mesa_is_enum_format_unsigned_int(GLenum format); + +extern GLboolean +_mesa_is_enum_format_signed_int(GLenum format); + extern GLboolean _mesa_is_enum_format_or_type_integer(GLenum format, GLenum type); @@ -94,6 +100,9 @@ _mesa_base_format_to_integer_format(GLenum format); extern GLboolean _mesa_base_format_has_channel(GLenum base_format, GLenum pname); +extern GLint +_mesa_base_format_component_count(GLenum base_format); + extern GLenum _mesa_generic_compressed_format_to_uncompressed_format(GLenum format); diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index 318dcb548..8904b13d9 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -1634,9 +1634,20 @@ struct gl_array_attrib GLuint LockFirst; /**< GL_EXT_compiled_vertex_array */ GLuint LockCount; /**< GL_EXT_compiled_vertex_array */ - /** GL 3.1 (slightly different from GL_NV_primitive_restart) */ + /** + * \name Primitive restart controls + * + * Primitive restart is enabled if either \c PrimitiveRestart or + * \c PrimitiveRestart is set. If \c PrimitiveRestart is set, then + * \c RestartIndex is used as the cut vertex. Otherwise ~0 is used. + */ + /*@{*/ GLboolean PrimitiveRestart; + GLboolean PrimitiveRestartFixedIndex; + GLboolean _PrimitiveRestart; GLuint RestartIndex; + GLuint _RestartIndex; + /*@}*/ /* GL_ARB_vertex_buffer_object */ struct gl_buffer_object *ArrayBufferObj; @@ -2302,6 +2313,11 @@ struct gl_shader_program GLint RefCount; /**< Reference count */ GLboolean DeletePending; + /** + * Is the application intending to glGetProgramBinary this program? + */ + GLboolean BinaryRetreivableHint; + /** * Flags that the linker should not reject the program if it lacks * a vertex or fragment shader. GLES2 doesn't allow separate @@ -2973,6 +2989,12 @@ struct gl_constants * \sa _mesa_init_constants */ GLuint64 MaxElementIndex; + + /** + * Disable interpretation of line continuations (lines ending with a + * backslash character ('\') in GLSL source. + */ + GLboolean DisableGLSLLineContinuations; }; diff --git a/mesalib/src/mesa/main/queryobj.c b/mesalib/src/mesa/main/queryobj.c index b5023e260..aa7c800d4 100644 --- a/mesalib/src/mesa/main/queryobj.c +++ b/mesalib/src/mesa/main/queryobj.c @@ -147,6 +147,12 @@ get_query_binding_point(struct gl_context *ctx, GLenum target) return &ctx->Query.CurrentOcclusionObject; else return NULL; + case GL_ANY_SAMPLES_PASSED_CONSERVATIVE: + if (ctx->Extensions.ARB_ES3_compatibility + || (ctx->API == API_OPENGLES2 && ctx->Version >= 30)) + return &ctx->Query.CurrentOcclusionObject; + else + return NULL; case GL_TIME_ELAPSED_EXT: if (ctx->Extensions.EXT_timer_query) return &ctx->Query.CurrentTimerObject; @@ -577,7 +583,8 @@ _mesa_GetQueryObjectiv(GLuint id, GLenum pname, GLint *params) if (!q->Ready) ctx->Driver.WaitQuery(ctx, q); /* if result is too large for returned type, clamp to max value */ - if (q->Target == GL_ANY_SAMPLES_PASSED) { + if (q->Target == GL_ANY_SAMPLES_PASSED + || q->Target == GL_ANY_SAMPLES_PASSED_CONSERVATIVE) { if (q->Result) *params = GL_TRUE; else @@ -628,7 +635,8 @@ _mesa_GetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params) if (!q->Ready) ctx->Driver.WaitQuery(ctx, q); /* if result is too large for returned type, clamp to max value */ - if (q->Target == GL_ANY_SAMPLES_PASSED) { + if (q->Target == GL_ANY_SAMPLES_PASSED + || q->Target == GL_ANY_SAMPLES_PASSED_CONSERVATIVE) { if (q->Result) *params = GL_TRUE; else diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c index 1f0002f6f..7f5fce796 100644 --- a/mesalib/src/mesa/main/shaderapi.c +++ b/mesalib/src/mesa/main/shaderapi.c @@ -583,6 +583,21 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param *params = shProg->NumUniformBlocks; return; + case GL_PROGRAM_BINARY_RETRIEVABLE_HINT: + /* This enum isn't part of the OES extension for OpenGL ES 2.0. It is + * only available with desktop OpenGL 3.0+ with the + * GL_ARB_get_program_binary extension or OpenGL ES 3.0. + * + * On desktop, we ignore the 3.0+ requirement because it is silly. + */ + if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx)) + break; + + *params = shProg->BinaryRetreivableHint; + return; + case GL_PROGRAM_BINARY_LENGTH: + *params = 0; + return; default: break; } @@ -1500,9 +1515,64 @@ _mesa_ShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat, #endif /* FEATURE_ES2 */ +void GLAPIENTRY +_mesa_GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, + GLenum *binaryFormat, GLvoid *binary) +{ + struct gl_shader_program *shProg; + GET_CURRENT_CONTEXT(ctx); + + ASSERT_OUTSIDE_BEGIN_END(ctx); + + shProg = _mesa_lookup_shader_program_err(ctx, program, "glGetProgramBinary"); + if (!shProg) + return; + + if (!shProg->LinkStatus) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetProgramBinary(program %u not linked)", + shProg->Name); + return; + } + + if (bufSize < 0){ + _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramBinary(bufSize < 0)"); + return; + } + + /* The ARB_get_program_binary spec says: + * + * "If is NULL, then no length is returned." + */ + if (length != NULL) + *length = 0; + + (void) binaryFormat; + (void) binary; +} void GLAPIENTRY -_mesa_ProgramParameteriARB(GLuint program, GLenum pname, GLint value) +_mesa_ProgramBinary(GLuint program, GLenum binaryFormat, + const GLvoid *binary, GLsizei length) +{ + struct gl_shader_program *shProg; + GET_CURRENT_CONTEXT(ctx); + + ASSERT_OUTSIDE_BEGIN_END(ctx); + + shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramBinary"); + if (!shProg) + return; + + (void) binaryFormat; + (void) binary; + (void) length; + _mesa_error(ctx, GL_INVALID_OPERATION, __FUNCTION__); +} + + +void GLAPIENTRY +_mesa_ProgramParameteri(GLuint program, GLenum pname, GLint value) { struct gl_shader_program *shProg; GET_CURRENT_CONTEXT(ctx); @@ -1516,6 +1586,9 @@ _mesa_ProgramParameteriARB(GLuint program, GLenum pname, GLint value) switch (pname) { case GL_GEOMETRY_VERTICES_OUT_ARB: + if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_geometry_shader4) + break; + if (value < 1 || (unsigned) value > ctx->Const.MaxGeometryOutputVertices) { _mesa_error(ctx, GL_INVALID_VALUE, @@ -1524,8 +1597,11 @@ _mesa_ProgramParameteriARB(GLuint program, GLenum pname, GLint value) return; } shProg->Geom.VerticesOut = value; - break; + return; case GL_GEOMETRY_INPUT_TYPE_ARB: + if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_geometry_shader4) + break; + switch (value) { case GL_POINTS: case GL_LINES: @@ -1540,8 +1616,11 @@ _mesa_ProgramParameteriARB(GLuint program, GLenum pname, GLint value) _mesa_lookup_enum_by_nr(value)); return; } - break; + return; case GL_GEOMETRY_OUTPUT_TYPE_ARB: + if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_geometry_shader4) + break; + switch (value) { case GL_POINTS: case GL_LINE_STRIP: @@ -1554,12 +1633,58 @@ _mesa_ProgramParameteriARB(GLuint program, GLenum pname, GLint value) _mesa_lookup_enum_by_nr(value)); return; } - break; + return; + case GL_PROGRAM_BINARY_RETRIEVABLE_HINT: + /* This enum isn't part of the OES extension for OpenGL ES 2.0, but it + * is part of OpenGL ES 3.0. For the ES2 case, this function shouldn't + * even be in the dispatch table, so we shouldn't need to expclicitly + * check here. + * + * On desktop, we ignore the 3.0+ requirement because it is silly. + */ + + /* The ARB_get_program_binary extension spec says: + * + * "An INVALID_VALUE error is generated if the argument to + * ProgramParameteri is not TRUE or FALSE." + */ + if (value != GL_TRUE && value != GL_FALSE) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glProgramParameteri(pname=%s, value=%d): " + "value must be 0 or 1.", + _mesa_lookup_enum_by_nr(pname), + value); + return; + } + + /* No need to notify the driver. Any changes will actually take effect + * the next time the shader is linked. + * + * The ARB_get_program_binary extension spec says: + * + * "To indicate that a program binary is likely to be retrieved, + * ProgramParameteri should be called with + * PROGRAM_BINARY_RETRIEVABLE_HINT and TRUE. This setting + * will not be in effect until the next time LinkProgram or + * ProgramBinary has been called successfully." + * + * The resloution of issue 9 in the extension spec also says: + * + * "The application may use the PROGRAM_BINARY_RETRIEVABLE_HINT hint + * to indicate to the GL implementation that this program will + * likely be saved with GetProgramBinary at some point. This will + * give the GL implementation the opportunity to track any state + * changes made to the program before being saved such that when it + * is loaded again a recompile can be avoided." + */ + shProg->BinaryRetreivableHint = value; + return; default: - _mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameteriARB(pname=%s)", - _mesa_lookup_enum_by_nr(pname)); break; } + + _mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameteri(pname=%s)", + _mesa_lookup_enum_by_nr(pname)); } void diff --git a/mesalib/src/mesa/main/shaderapi.h b/mesalib/src/mesa/main/shaderapi.h index 8ee68d82d..d3199db96 100644 --- a/mesalib/src/mesa/main/shaderapi.h +++ b/mesalib/src/mesa/main/shaderapi.h @@ -190,8 +190,16 @@ _mesa_ShaderBinary(GLint n, const GLuint *shaders, GLenum binaryformat, const void* binary, GLint length); extern void GLAPIENTRY -_mesa_ProgramParameteriARB(GLuint program, GLenum pname, - GLint value); +_mesa_GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, + GLenum *binaryFormat, GLvoid *binary); + +extern void GLAPIENTRY +_mesa_ProgramBinary(GLuint program, GLenum binaryFormat, + const GLvoid *binary, GLsizei length); + +extern void GLAPIENTRY +_mesa_ProgramParameteri(GLuint program, GLenum pname, GLint value); + void _mesa_use_shader_program(struct gl_context *ctx, GLenum type, struct gl_shader_program *shProg); diff --git a/mesalib/src/mesa/main/texformat.c b/mesalib/src/mesa/main/texformat.c index b3ffc6c51..4fb4b70f9 100644 --- a/mesalib/src/mesa/main/texformat.c +++ b/mesalib/src/mesa/main/texformat.c @@ -75,7 +75,9 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB4444); } else if (type == GL_UNSIGNED_SHORT_1_5_5_5_REV) { RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB1555); - } + } else if (type == GL_UNSIGNED_INT_2_10_10_10_REV) { + RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB2101010); + } RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888); RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); break; @@ -111,6 +113,10 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, /* shallow RGB formats */ case 3: case GL_RGB: + if (type == GL_UNSIGNED_INT_2_10_10_10_REV) { + RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB2101010); + } + /* fallthrough */ case GL_RGB8: RETURN_IF_SUPPORTED(MESA_FORMAT_RGB888); RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888); diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index 33f81a25c..7d3abb7e0 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -1947,8 +1947,9 @@ texture_error_check( struct gl_context *ctx, err = _mesa_error_check_format_and_type(ctx, format, type); if (err != GL_NO_ERROR) { _mesa_error(ctx, err, - "glTexImage%dD(incompatible format 0x%x, type 0x%x)", - dimensions, format, type); + "glTexImage%dD(incompatible format = %s, type = %s)", + dimensions, _mesa_lookup_enum_by_nr(format), + _mesa_lookup_enum_by_nr(type)); return GL_TRUE; } @@ -1960,8 +1961,9 @@ texture_error_check( struct gl_context *ctx, (_mesa_is_depthstencil_format(internalFormat) != _mesa_is_depthstencil_format(format)) || (_mesa_is_dudv_format(internalFormat) != _mesa_is_dudv_format(format))) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glTexImage%dD(incompatible internalFormat 0x%x, format 0x%x)", - dimensions, internalFormat, format); + "glTexImage%dD(incompatible internalFormat = %s, format = %s)", + dimensions, _mesa_lookup_enum_by_nr(internalFormat), + _mesa_lookup_enum_by_nr(format)); return GL_TRUE; } @@ -2263,8 +2265,9 @@ texsubimage_error_check(struct gl_context *ctx, GLuint dimensions, err = _mesa_error_check_format_and_type(ctx, format, type); if (err != GL_NO_ERROR) { _mesa_error(ctx, err, - "glTexSubImage%dD(incompatible format 0x%x, type 0x%x)", - dimensions, format, type); + "glTexSubImage%dD(incompatible format = %s, type = %s)", + dimensions, _mesa_lookup_enum_by_nr(format), + _mesa_lookup_enum_by_nr(type)); return GL_TRUE; } diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c index 751150937..a5c7712e0 100644 --- a/mesalib/src/mesa/main/texstore.c +++ b/mesalib/src/mesa/main/texstore.c @@ -1714,18 +1714,20 @@ _mesa_texstore_argb2101010(TEXSTORE_PARAMS) srcPacking, ctx->_ImageTransferState); const GLfloat *src = tempImage; + const GLushort aMask = (srcFormat == GL_RGB) ? 0xffff : 0; GLint img, row, col; if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = dstSlices[img]; - if (baseInternalFormat == GL_RGBA) { + if (baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB) { for (row = 0; row < srcHeight; row++) { GLuint *dstUI = (GLuint *) dstRow; for (col = 0; col < srcWidth; col++) { GLushort a,r,g,b; UNCLAMPED_FLOAT_TO_USHORT(a, src[ACOMP]); + a = a | aMask; UNCLAMPED_FLOAT_TO_USHORT(r, src[RCOMP]); UNCLAMPED_FLOAT_TO_USHORT(g, src[GCOMP]); UNCLAMPED_FLOAT_TO_USHORT(b, src[BCOMP]); @@ -1734,20 +1736,6 @@ _mesa_texstore_argb2101010(TEXSTORE_PARAMS) } dstRow += dstRowStride; } - } else if (baseInternalFormat == GL_RGB) { - for (row = 0; row < srcHeight; row++) { - GLuint *dstUI = (GLuint *) dstRow; - for (col = 0; col < srcWidth; col++) { - GLushort r,g,b; - - UNCLAMPED_FLOAT_TO_USHORT(r, src[RCOMP]); - UNCLAMPED_FLOAT_TO_USHORT(g, src[GCOMP]); - UNCLAMPED_FLOAT_TO_USHORT(b, src[BCOMP]); - dstUI[col] = PACK_COLOR_2101010_US(0xffff, r, g, b); - src += 4; - } - dstRow += dstRowStride; - } } else { ASSERT(0); } diff --git a/mesalib/src/mesa/main/uniform_query.cpp b/mesalib/src/mesa/main/uniform_query.cpp index afe9a08c1..efff8f381 100644 --- a/mesalib/src/mesa/main/uniform_query.cpp +++ b/mesalib/src/mesa/main/uniform_query.cpp @@ -864,7 +864,8 @@ _mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg, /* GL_INVALID_VALUE is generated if `transpose' is not GL_FALSE. * http://www.khronos.org/opengles/sdk/docs/man/xhtml/glUniform.xml */ - if (ctx->API == API_OPENGLES || ctx->API == API_OPENGLES2) { + if (ctx->API == API_OPENGLES + || (ctx->API == API_OPENGLES2 && ctx->Version < 30)) { if (transpose) { _mesa_error(ctx, GL_INVALID_VALUE, "glUniformMatrix(matrix transpose is not GL_FALSE)"); diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c index 5e4d6c3e6..e453b3b0e 100644 --- a/mesalib/src/mesa/main/varray.c +++ b/mesalib/src/mesa/main/varray.c @@ -1113,9 +1113,10 @@ _mesa_PrimitiveRestartIndex(GLuint index) ASSERT_OUTSIDE_BEGIN_END(ctx); - if (ctx->Array.RestartIndex != index) { + ctx->Array.RestartIndex = index; + if (ctx->Array.PrimitiveRestart && ctx->Array._RestartIndex != index) { FLUSH_VERTICES(ctx, _NEW_TRANSFORM); - ctx->Array.RestartIndex = index; + ctx->Array._RestartIndex = index; } } -- cgit v1.2.3