aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-04-08 08:17:23 +0200
committermarha <marha@users.sourceforge.net>2013-04-11 11:13:40 +0200
commit59038e048c4be1e69744b087ba31386e98141a8f (patch)
treeb91f0b662663be6f26e985b0c09a906cfad9ccc5 /mesalib/src/mesa/main
parentdde22e946ccfb0bd937224daf42403b80528c2a6 (diff)
downloadvcxsrv-59038e048c4be1e69744b087ba31386e98141a8f.tar.gz
vcxsrv-59038e048c4be1e69744b087ba31386e98141a8f.tar.bz2
vcxsrv-59038e048c4be1e69744b087ba31386e98141a8f.zip
fontconfig libXau mesa xserver xkeyboard-config git update 8 Apr 2013
xserver commit 8928f8fa0bb154ce437af703ff702016f0dcf127 xkeyboard-config commit e5c6729f3679fe87a703eb1d7ec1cf0a61814ca8 libXau commit f5a57d8a21a34d7084cce294e24c0422e02ef8ef fontconfig commit 18bf57c70aafcad031c0b43756b754dcaf6a756a mesa commit eff66bc9f855fff5c4f5f57f247254a97431e8ad
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r--mesalib/src/mesa/main/attrib.c9
-rw-r--r--mesalib/src/mesa/main/blend.c82
-rw-r--r--mesalib/src/mesa/main/blend.h14
-rw-r--r--mesalib/src/mesa/main/compiler.h2
-rw-r--r--mesalib/src/mesa/main/extensions.c2
-rw-r--r--mesalib/src/mesa/main/fbobject.c34
-rw-r--r--mesalib/src/mesa/main/formatquery.c15
-rw-r--r--mesalib/src/mesa/main/formatquery.h4
-rw-r--r--mesalib/src/mesa/main/framebuffer.c6
-rw-r--r--mesalib/src/mesa/main/get.c18
-rw-r--r--mesalib/src/mesa/main/get_hash_params.py2
-rw-r--r--mesalib/src/mesa/main/imports.h6
-rw-r--r--mesalib/src/mesa/main/light.c3
-rw-r--r--mesalib/src/mesa/main/mtypes.h18
-rw-r--r--mesalib/src/mesa/main/readpix.c5
-rw-r--r--mesalib/src/mesa/main/shaderapi.c6
-rw-r--r--mesalib/src/mesa/main/state.c51
-rw-r--r--mesalib/src/mesa/main/stencil.c5
-rw-r--r--mesalib/src/mesa/main/texenv.c3
-rw-r--r--mesalib/src/mesa/main/teximage.c67
-rw-r--r--mesalib/src/mesa/main/teximage.h11
-rw-r--r--mesalib/src/mesa/main/texparam.c91
-rw-r--r--mesalib/src/mesa/main/texstorage.c37
-rw-r--r--mesalib/src/mesa/main/texstorage.h3
-rw-r--r--mesalib/src/mesa/main/version.c3
25 files changed, 369 insertions, 128 deletions
diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c
index 3b991bcac..a672845bf 100644
--- a/mesalib/src/mesa/main/attrib.c
+++ b/mesalib/src/mesa/main/attrib.c
@@ -986,7 +986,9 @@ _mesa_PopAttrib(void)
_mesa_set_enable(ctx, GL_INDEX_LOGIC_OP,
color->IndexLogicOpEnabled);
_mesa_set_enable(ctx, GL_DITHER, color->DitherFlag);
- _mesa_ClampColor(GL_CLAMP_FRAGMENT_COLOR_ARB, color->ClampFragmentColor);
+ if (ctx->Extensions.ARB_color_buffer_float)
+ _mesa_ClampColor(GL_CLAMP_FRAGMENT_COLOR_ARB,
+ color->ClampFragmentColor);
_mesa_ClampColor(GL_CLAMP_READ_COLOR_ARB, color->ClampReadColor);
/* GL_ARB_framebuffer_sRGB / GL_EXT_framebuffer_sRGB */
@@ -1114,7 +1116,10 @@ _mesa_PopAttrib(void)
/* materials */
memcpy(&ctx->Light.Material, &light->Material,
sizeof(struct gl_material));
- _mesa_ClampColor(GL_CLAMP_VERTEX_COLOR_ARB, light->ClampVertexColor);
+ if (ctx->Extensions.ARB_color_buffer_float) {
+ _mesa_ClampColor(GL_CLAMP_VERTEX_COLOR_ARB,
+ light->ClampVertexColor);
+ }
}
break;
case GL_LINE_BIT:
diff --git a/mesalib/src/mesa/main/blend.c b/mesalib/src/mesa/main/blend.c
index 309f1d538..09a1c9ae8 100644
--- a/mesalib/src/mesa/main/blend.c
+++ b/mesalib/src/mesa/main/blend.c
@@ -765,24 +765,96 @@ _mesa_ClampColor(GLenum target, GLenum clamp)
switch (target) {
case GL_CLAMP_VERTEX_COLOR_ARB:
+ if (ctx->API == API_OPENGL_CORE &&
+ !ctx->Extensions.ARB_color_buffer_float) {
+ goto invalid_enum;
+ }
FLUSH_VERTICES(ctx, _NEW_LIGHT);
ctx->Light.ClampVertexColor = clamp;
+ _mesa_update_clamp_vertex_color(ctx);
break;
case GL_CLAMP_FRAGMENT_COLOR_ARB:
+ if (ctx->API == API_OPENGL_CORE &&
+ !ctx->Extensions.ARB_color_buffer_float) {
+ goto invalid_enum;
+ }
FLUSH_VERTICES(ctx, _NEW_FRAG_CLAMP);
ctx->Color.ClampFragmentColor = clamp;
+ _mesa_update_clamp_fragment_color(ctx);
break;
case GL_CLAMP_READ_COLOR_ARB:
FLUSH_VERTICES(ctx, _NEW_COLOR);
ctx->Color.ClampReadColor = clamp;
break;
default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glClampColorARB(target)");
- return;
+ goto invalid_enum;
}
+ return;
+
+invalid_enum:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glClampColor(%s)",
+ _mesa_lookup_enum_by_nr(target));
+}
+
+static GLboolean
+get_clamp_color(const struct gl_framebuffer *fb, GLenum clamp)
+{
+ if (clamp == GL_TRUE || clamp == GL_FALSE)
+ return clamp;
+
+ ASSERT(clamp == GL_FIXED_ONLY);
+ if (!fb)
+ return GL_TRUE;
+
+ return fb->_AllColorBuffersFixedPoint;
+}
+
+GLboolean
+_mesa_get_clamp_fragment_color(const struct gl_context *ctx)
+{
+ return get_clamp_color(ctx->DrawBuffer,
+ ctx->Color.ClampFragmentColor);
+}
+
+GLboolean
+_mesa_get_clamp_vertex_color(const struct gl_context *ctx)
+{
+ return get_clamp_color(ctx->DrawBuffer, ctx->Light.ClampVertexColor);
+}
+
+GLboolean
+_mesa_get_clamp_read_color(const struct gl_context *ctx)
+{
+ return get_clamp_color(ctx->ReadBuffer, ctx->Color.ClampReadColor);
}
+/**
+ * Update the ctx->Color._ClampFragmentColor field
+ */
+void
+_mesa_update_clamp_fragment_color(struct gl_context *ctx)
+{
+ struct gl_framebuffer *fb = ctx->DrawBuffer;
+ /* Don't clamp if:
+ * - there is no colorbuffer
+ * - all colorbuffers are unsigned normalized, so clamping has no effect
+ * - there is an integer colorbuffer
+ */
+ if (!fb || !fb->_HasSNormOrFloatColorBuffer || fb->_IntegerColor)
+ ctx->Color._ClampFragmentColor = GL_FALSE;
+ else
+ ctx->Color._ClampFragmentColor = _mesa_get_clamp_fragment_color(ctx);
+}
+
+/**
+ * Update the ctx->Color._ClampVertexColor field
+ */
+void
+_mesa_update_clamp_vertex_color(struct gl_context *ctx)
+{
+ ctx->Light._ClampVertexColor = _mesa_get_clamp_vertex_color(ctx);
+}
/**********************************************************************/
@@ -832,10 +904,10 @@ void _mesa_init_color( struct gl_context * ctx )
ctx->Color.DrawBuffer[0] = GL_FRONT;
}
- ctx->Color.ClampFragmentColor = GL_FIXED_ONLY_ARB;
- ctx->Color._ClampFragmentColor = GL_TRUE;
+ ctx->Color.ClampFragmentColor = ctx->API == API_OPENGL_COMPAT ?
+ GL_FIXED_ONLY_ARB : GL_FALSE;
+ ctx->Color._ClampFragmentColor = GL_FALSE;
ctx->Color.ClampReadColor = GL_FIXED_ONLY_ARB;
- ctx->Color._ClampReadColor = GL_TRUE;
if (ctx->API == API_OPENGLES2) {
/* GLES 3 behaves as though GL_FRAMEBUFFER_SRGB is always enabled. */
diff --git a/mesalib/src/mesa/main/blend.h b/mesalib/src/mesa/main/blend.h
index a539aa809..621311d55 100644
--- a/mesalib/src/mesa/main/blend.h
+++ b/mesalib/src/mesa/main/blend.h
@@ -99,6 +99,20 @@ _mesa_ColorMaski( GLuint buf, GLboolean red, GLboolean green,
extern void GLAPIENTRY
_mesa_ClampColor(GLenum target, GLenum clamp);
+extern GLboolean
+_mesa_get_clamp_fragment_color(const struct gl_context *ctx);
+
+extern GLboolean
+_mesa_get_clamp_vertex_color(const struct gl_context *ctx);
+
+extern GLboolean
+_mesa_get_clamp_read_color(const struct gl_context *ctx);
+
+extern void
+_mesa_update_clamp_fragment_color(struct gl_context *ctx);
+
+extern void
+_mesa_update_clamp_vertex_color(struct gl_context *ctx);
extern void
_mesa_init_color( struct gl_context * ctx );
diff --git a/mesalib/src/mesa/main/compiler.h b/mesalib/src/mesa/main/compiler.h
index 8b23665e6..8431534c3 100644
--- a/mesalib/src/mesa/main/compiler.h
+++ b/mesalib/src/mesa/main/compiler.h
@@ -256,7 +256,7 @@ static INLINE GLuint CPU_TO_LE32(GLuint x)
*/
#define STATIC_ASSERT(COND) \
do { \
- typedef int static_assertion_failed[(!!(COND))*2-1]; \
+ (void) sizeof(char [1 - 2*!(COND)]); \
} while (0)
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index e90a29680..c7f038b88 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -144,10 +144,12 @@ static const struct extension extension_table[] = {
{ "GL_ARB_texture_mirrored_repeat", o(dummy_true), GLL, 2001 },
{ "GL_ARB_texture_multisample", o(ARB_texture_multisample), GL, 2009 },
{ "GL_ARB_texture_non_power_of_two", o(ARB_texture_non_power_of_two), GL, 2003 },
+ { "GL_ARB_texture_query_lod", o(ARB_texture_query_lod), GL, 2009 },
{ "GL_ARB_texture_rectangle", o(NV_texture_rectangle), GL, 2004 },
{ "GL_ARB_texture_rgb10_a2ui", o(ARB_texture_rgb10_a2ui), GL, 2009 },
{ "GL_ARB_texture_rg", o(ARB_texture_rg), GL, 2008 },
{ "GL_ARB_texture_storage", o(ARB_texture_storage), GL, 2011 },
+ { "GL_ARB_texture_storage_multisample", o(ARB_texture_storage_multisample), GL, 2012 },
{ "GL_ARB_texture_swizzle", o(EXT_texture_swizzle), GL, 2008 },
{ "GL_ARB_timer_query", o(ARB_timer_query), GL, 2010 },
{ "GL_ARB_transform_feedback2", o(ARB_transform_feedback2), GL, 2010 },
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c
index 3fdf62667..fc2b2620b 100644
--- a/mesalib/src/mesa/main/fbobject.c
+++ b/mesalib/src/mesa/main/fbobject.c
@@ -784,6 +784,8 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
numImages = 0;
fb->Width = 0;
fb->Height = 0;
+ fb->_AllColorBuffersFixedPoint = GL_TRUE;
+ fb->_HasSNormOrFloatColorBuffer = GL_FALSE;
/* Start at -2 to more easily loop over all attachment points.
* -2: depth buffer
@@ -900,6 +902,19 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
/* check if integer color */
fb->_IntegerColor = _mesa_is_format_integer_color(attFormat);
+ /* Update _AllColorBuffersFixedPoint and _HasSNormOrFloatColorBuffer. */
+ if (i >= 0) {
+ GLenum type = _mesa_get_format_datatype(attFormat);
+
+ fb->_AllColorBuffersFixedPoint =
+ fb->_AllColorBuffersFixedPoint &&
+ (type == GL_UNSIGNED_NORMALIZED || type == GL_SIGNED_NORMALIZED);
+
+ fb->_HasSNormOrFloatColorBuffer =
+ fb->_HasSNormOrFloatColorBuffer ||
+ type == GL_SIGNED_NORMALIZED || type == GL_FLOAT;
+ }
+
/* Error-check width, height, format */
if (numImages == 1) {
/* save format */
@@ -1537,15 +1552,16 @@ renderbuffer_storage(GLenum target, GLenum internalFormat,
/* NumSamples == 0 indicates non-multisampling */
samples = 0;
}
-
- /* check the sample count;
- * note: driver may choose to use more samples than what's requested
- */
- sample_count_error = _mesa_check_sample_count(ctx, target,
- internalFormat, samples);
- if (sample_count_error != GL_NO_ERROR) {
- _mesa_error(ctx, sample_count_error, "%s(samples)", func);
- return;
+ else {
+ /* check the sample count;
+ * note: driver may choose to use more samples than what's requested
+ */
+ sample_count_error = _mesa_check_sample_count(ctx, target,
+ internalFormat, samples);
+ if (sample_count_error != GL_NO_ERROR) {
+ _mesa_error(ctx, sample_count_error, "%s(samples)", func);
+ return;
+ }
}
rb = ctx->CurrentRenderbuffer;
diff --git a/mesalib/src/mesa/main/formatquery.c b/mesalib/src/mesa/main/formatquery.c
index 78c5fbe5e..e45dc8680 100644
--- a/mesalib/src/mesa/main/formatquery.c
+++ b/mesalib/src/mesa/main/formatquery.c
@@ -30,6 +30,21 @@
#include "fbobject.h"
#include "formatquery.h"
+/* default implementation of QuerySamplesForFormat driverfunc, for
+ * non-multisample-capable drivers. */
+size_t
+_mesa_query_samples_for_format(struct gl_context *ctx, GLenum target,
+ GLenum internalFormat, int samples[16])
+{
+ (void) target;
+ (void) internalFormat;
+ (void) ctx;
+
+ samples[0] = 1;
+ return 1;
+}
+
+
void GLAPIENTRY
_mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
GLsizei bufSize, GLint *params)
diff --git a/mesalib/src/mesa/main/formatquery.h b/mesalib/src/mesa/main/formatquery.h
index 585c3eb64..603400059 100644
--- a/mesalib/src/mesa/main/formatquery.h
+++ b/mesalib/src/mesa/main/formatquery.h
@@ -28,6 +28,10 @@
#include "compiler.h"
#include "glheader.h"
+size_t
+_mesa_query_samples_for_format(struct gl_context *ctx, GLenum target,
+ GLenum internalFormat, int samples[16]);
+
extern void GLAPIENTRY
_mesa_GetInternalformativ(GLenum target, GLenum internalformat,
GLenum pname, GLsizei bufSize, GLint *params);
diff --git a/mesalib/src/mesa/main/framebuffer.c b/mesalib/src/mesa/main/framebuffer.c
index 619aaa337..6c6977431 100644
--- a/mesalib/src/mesa/main/framebuffer.c
+++ b/mesalib/src/mesa/main/framebuffer.c
@@ -32,6 +32,7 @@
#include "glheader.h"
#include "imports.h"
+#include "blend.h"
#include "buffers.h"
#include "context.h"
#include "enums.h"
@@ -154,6 +155,8 @@ _mesa_initialize_window_framebuffer(struct gl_framebuffer *fb,
fb->Delete = _mesa_destroy_framebuffer;
fb->_Status = GL_FRAMEBUFFER_COMPLETE_EXT;
+ fb->_AllColorBuffersFixedPoint = !visual->floatMode;
+ fb->_HasSNormOrFloatColorBuffer = visual->floatMode;
compute_depth_max(fb);
}
@@ -740,6 +743,9 @@ _mesa_update_framebuffer(struct gl_context *ctx)
update_framebuffer(ctx, drawFb);
if (readFb != drawFb)
update_framebuffer(ctx, readFb);
+
+ _mesa_update_clamp_vertex_color(ctx);
+ _mesa_update_clamp_fragment_color(ctx);
}
diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c
index 582ef3198..2ba868c0d 100644
--- a/mesalib/src/mesa/main/get.c
+++ b/mesalib/src/mesa/main/get.c
@@ -24,6 +24,7 @@
#include "glheader.h"
#include "context.h"
+#include "blend.h"
#include "enable.h"
#include "enums.h"
#include "extensions.h"
@@ -358,6 +359,13 @@ EXTRA_EXT(ARB_texture_buffer_range);
EXTRA_EXT(ARB_texture_multisample);
static const int
+extra_ARB_color_buffer_float_or_glcore[] = {
+ EXT(ARB_color_buffer_float),
+ EXTRA_API_GL_CORE,
+ EXTRA_END
+};
+
+static const int
extra_NV_primitive_restart[] = {
EXT(NV_primitive_restart),
EXTRA_END
@@ -767,13 +775,13 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
break;
case GL_FOG_COLOR:
- if(ctx->Color._ClampFragmentColor)
+ if (_mesa_get_clamp_fragment_color(ctx))
COPY_4FV(v->value_float_4, ctx->Fog.Color);
else
COPY_4FV(v->value_float_4, ctx->Fog.ColorUnclamped);
break;
case GL_COLOR_CLEAR_VALUE:
- if(ctx->Color._ClampFragmentColor) {
+ if (_mesa_get_clamp_fragment_color(ctx)) {
v->value_float_4[0] = CLAMP(ctx->Color.ClearColor.f[0], 0.0F, 1.0F);
v->value_float_4[1] = CLAMP(ctx->Color.ClearColor.f[1], 0.0F, 1.0F);
v->value_float_4[2] = CLAMP(ctx->Color.ClearColor.f[2], 0.0F, 1.0F);
@@ -782,13 +790,13 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
COPY_4FV(v->value_float_4, ctx->Color.ClearColor.f);
break;
case GL_BLEND_COLOR_EXT:
- if(ctx->Color._ClampFragmentColor)
+ if (_mesa_get_clamp_fragment_color(ctx))
COPY_4FV(v->value_float_4, ctx->Color.BlendColor);
else
COPY_4FV(v->value_float_4, ctx->Color.BlendColorUnclamped);
break;
case GL_ALPHA_TEST_REF:
- if(ctx->Color._ClampFragmentColor)
+ if (_mesa_get_clamp_fragment_color(ctx))
v->value_float = ctx->Color.AlphaRef;
else
v->value_float = ctx->Color.AlphaRefUnclamped;
@@ -868,7 +876,7 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
* \param func name of calling glGet*v() function for error reporting
* \param d the struct value_desc that has the extra constraints
*
- * \return GL_FALSE if one of the constraints was not satisfied,
+ * \return GL_FALSE if all of the constraints were not satisfied,
* otherwise GL_TRUE.
*/
static GLboolean
diff --git a/mesalib/src/mesa/main/get_hash_params.py b/mesalib/src/mesa/main/get_hash_params.py
index 7d4f7e2a4..4ef23247b 100644
--- a/mesalib/src/mesa/main/get_hash_params.py
+++ b/mesalib/src/mesa/main/get_hash_params.py
@@ -96,7 +96,7 @@ descriptor=[
# GL_ARB_color_buffer_float
[ "CLAMP_VERTEX_COLOR", "CONTEXT_ENUM(Light.ClampVertexColor), extra_ARB_color_buffer_float" ],
[ "CLAMP_FRAGMENT_COLOR", "CONTEXT_ENUM(Color.ClampFragmentColor), extra_ARB_color_buffer_float" ],
- [ "CLAMP_READ_COLOR", "CONTEXT_ENUM(Color.ClampReadColor), extra_ARB_color_buffer_float" ],
+ [ "CLAMP_READ_COLOR", "CONTEXT_ENUM(Color.ClampReadColor), extra_ARB_color_buffer_float_or_glcore" ],
# GL_ARB_copy_buffer
[ "COPY_READ_BUFFER", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ],
diff --git a/mesalib/src/mesa/main/imports.h b/mesalib/src/mesa/main/imports.h
index 4b783818b..c4110ef10 100644
--- a/mesalib/src/mesa/main/imports.h
+++ b/mesalib/src/mesa/main/imports.h
@@ -500,17 +500,11 @@ _mesa_realloc( void *oldBuffer, size_t oldSize, size_t newSize );
#ifndef FFS_DEFINED
#define FFS_DEFINED 1
#ifdef __GNUC__
-
-#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(ANDROID) || defined(__APPLE__)
#define ffs __builtin_ffs
#define ffsll __builtin_ffsll
-#endif
-
#else
-
extern int ffs(int i);
extern int ffsll(long long int i);
-
#endif /*__ GNUC__ */
#endif /* FFS_DEFINED */
diff --git a/mesalib/src/mesa/main/light.c b/mesalib/src/mesa/main/light.c
index 3c43ec766..c694bebe6 100644
--- a/mesalib/src/mesa/main/light.c
+++ b/mesalib/src/mesa/main/light.c
@@ -1202,7 +1202,8 @@ _mesa_init_lighting( struct gl_context *ctx )
NULL );
ctx->Light.ColorMaterialEnabled = GL_FALSE;
- ctx->Light.ClampVertexColor = GL_TRUE;
+ ctx->Light.ClampVertexColor = ctx->API == API_OPENGL_COMPAT;
+ ctx->Light._ClampVertexColor = ctx->API == API_OPENGL_COMPAT;
/* Miscellaneous */
ctx->Light._NeedEyeCoords = GL_FALSE;
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index a0e7e281d..008f68bda 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -146,9 +146,6 @@ typedef enum
* VERT_ATTRIB_TEX
* include the classic texture coordinate attributes.
* Is a subset of VERT_ATTRIB_FF.
- * VERT_ATTRIB_GENERIC_NV
- * include the NV shader attributes.
- * Is a subset of VERT_ATTRIB_FF.
* VERT_ATTRIB_GENERIC
* include the OpenGL 2.0+ GLSL generic shader attributes.
* These alias the generic GL_ARB_vertex_shader attributes.
@@ -159,9 +156,6 @@ typedef enum
#define VERT_ATTRIB_TEX(i) (VERT_ATTRIB_TEX0 + (i))
#define VERT_ATTRIB_TEX_MAX MAX_TEXTURE_COORD_UNITS
-#define VERT_ATTRIB_GENERIC_NV(i) (VERT_ATTRIB_POS + (i))
-#define VERT_ATTRIB_GENERIC_NV_MAX MAX_VERTEX_GENERIC_ATTRIBS
-
#define VERT_ATTRIB_GENERIC(i) (VERT_ATTRIB_GENERIC0 + (i))
#define VERT_ATTRIB_GENERIC_MAX MAX_VERTEX_GENERIC_ATTRIBS
@@ -198,10 +192,6 @@ typedef enum
#define VERT_BIT_TEX_ALL \
BITFIELD64_RANGE(VERT_ATTRIB_TEX(0), VERT_ATTRIB_TEX_MAX)
-#define VERT_BIT_GENERIC_NV(i) VERT_BIT(VERT_ATTRIB_GENERIC_NV(i))
-#define VERT_BIT_GENERIC_NV_ALL \
- BITFIELD64_RANGE(VERT_ATTRIB_GENERIC_NV(0), VERT_ATTRIB_GENERIC_NV_MAX)
-
#define VERT_BIT_GENERIC(i) VERT_BIT(VERT_ATTRIB_GENERIC(i))
#define VERT_BIT_GENERIC_ALL \
BITFIELD64_RANGE(VERT_ATTRIB_GENERIC(0), VERT_ATTRIB_GENERIC_MAX)
@@ -683,7 +673,6 @@ struct gl_colorbuffer_attrib
GLenum ClampFragmentColor; /**< GL_TRUE, GL_FALSE or GL_FIXED_ONLY_ARB */
GLboolean _ClampFragmentColor; /** < with GL_FIXED_ONLY_ARB resolved */
GLenum ClampReadColor; /**< GL_TRUE, GL_FALSE or GL_FIXED_ONLY_ARB */
- GLboolean _ClampReadColor; /** < with GL_FIXED_ONLY_ARB resolved */
GLboolean sRGBEnabled; /**< Framebuffer sRGB blending/updating requested */
};
@@ -1025,6 +1014,7 @@ struct gl_stencil_attrib
GLboolean TestTwoSide; /**< GL_EXT_stencil_two_side */
GLubyte ActiveFace; /**< GL_EXT_stencil_two_side (0 or 2) */
GLboolean _Enabled; /**< Enabled and stencil buffer present */
+ GLboolean _WriteEnabled; /**< _Enabled and non-zero writemasks */
GLboolean _TestTwoSide;
GLubyte _BackFace; /**< Current back stencil state (1 or 2) */
GLenum Function[3]; /**< Stencil function */
@@ -2670,6 +2660,10 @@ struct gl_framebuffer
/** Integer color values */
GLboolean _IntegerColor;
+ /* ARB_color_buffer_float */
+ GLboolean _AllColorBuffersFixedPoint; /* no integer, no float */
+ GLboolean _HasSNormOrFloatColorBuffer;
+
/** Array of all renderbuffer attachments, indexed by BUFFER_* tokens. */
struct gl_renderbuffer_attachment Attachment[BUFFER_COUNT];
@@ -3002,9 +2996,11 @@ struct gl_extensions
GLboolean ARB_texture_float;
GLboolean ARB_texture_multisample;
GLboolean ARB_texture_non_power_of_two;
+ GLboolean ARB_texture_query_lod;
GLboolean ARB_texture_rg;
GLboolean ARB_texture_rgb10_a2ui;
GLboolean ARB_texture_storage;
+ GLboolean ARB_texture_storage_multisample;
GLboolean ARB_timer_query;
GLboolean ARB_transform_feedback2;
GLboolean ARB_transform_feedback3;
diff --git a/mesalib/src/mesa/main/readpix.c b/mesalib/src/mesa/main/readpix.c
index d3d09dea3..0dee38063 100644
--- a/mesalib/src/mesa/main/readpix.c
+++ b/mesalib/src/mesa/main/readpix.c
@@ -24,6 +24,7 @@
#include "glheader.h"
#include "imports.h"
+#include "blend.h"
#include "bufferobj.h"
#include "context.h"
#include "enums.h"
@@ -80,7 +81,7 @@ get_readpixels_transfer_ops(const struct gl_context *ctx, gl_format texFormat,
if (uses_blit) {
/* For blit-based ReadPixels packing, the clamping is done automatically
* unless the type is float. */
- if (ctx->Color._ClampReadColor == GL_TRUE &&
+ if (_mesa_get_clamp_read_color(ctx) &&
(type == GL_FLOAT || type == GL_HALF_FLOAT)) {
transferOps |= IMAGE_CLAMP_BIT;
}
@@ -88,7 +89,7 @@ get_readpixels_transfer_ops(const struct gl_context *ctx, gl_format texFormat,
else {
/* For CPU-based ReadPixels packing, the clamping must always be done
* for non-float types, */
- if (ctx->Color._ClampReadColor == GL_TRUE ||
+ if (_mesa_get_clamp_read_color(ctx) ||
(type != GL_FLOAT && type != GL_HALF_FLOAT)) {
transferOps |= IMAGE_CLAMP_BIT;
}
diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c
index be6946798..2c307e79c 100644
--- a/mesalib/src/mesa/main/shaderapi.c
+++ b/mesalib/src/mesa/main/shaderapi.c
@@ -518,9 +518,11 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param
GLint max_len = 0;
for (i = 0; i < shProg->NumUserUniformStorage; i++) {
- /* Add one for the terminating NUL character.
+ /* Add one for the terminating NUL character for a non-array, and
+ * 4 for the "[0]" and the NUL for an array.
*/
- const GLint len = strlen(shProg->UniformStorage[i].name) + 1;
+ const GLint len = strlen(shProg->UniformStorage[i].name) + 1 +
+ ((shProg->UniformStorage[i].array_elements != 0) ? 3 : 0);
if (len > max_len)
max_len = len;
diff --git a/mesalib/src/mesa/main/state.c b/mesalib/src/mesa/main/state.c
index fb8b71cfe..251c1aea9 100644
--- a/mesalib/src/mesa/main/state.c
+++ b/mesalib/src/mesa/main/state.c
@@ -51,6 +51,7 @@
#include "texobj.h"
#include "texstate.h"
#include "varray.h"
+#include "blend.h"
static void
@@ -308,47 +309,6 @@ update_multisample(struct gl_context *ctx)
/**
- * Update the ctx->Color._ClampFragmentColor field
- */
-static void
-update_clamp_fragment_color(struct gl_context *ctx)
-{
- if (ctx->Color.ClampFragmentColor == GL_FIXED_ONLY_ARB)
- ctx->Color._ClampFragmentColor =
- !ctx->DrawBuffer || !ctx->DrawBuffer->Visual.floatMode;
- else
- ctx->Color._ClampFragmentColor = ctx->Color.ClampFragmentColor;
-}
-
-
-/**
- * Update the ctx->Color._ClampVertexColor field
- */
-static void
-update_clamp_vertex_color(struct gl_context *ctx)
-{
- if (ctx->Light.ClampVertexColor == GL_FIXED_ONLY_ARB)
- ctx->Light._ClampVertexColor =
- !ctx->DrawBuffer || !ctx->DrawBuffer->Visual.floatMode;
- else
- ctx->Light._ClampVertexColor = ctx->Light.ClampVertexColor;
-}
-
-
-/**
- * Update the ctx->Color._ClampReadColor field
- */
-static void
-update_clamp_read_color(struct gl_context *ctx)
-{
- if (ctx->Color.ClampReadColor == GL_FIXED_ONLY_ARB)
- ctx->Color._ClampReadColor =
- !ctx->ReadBuffer || !ctx->ReadBuffer->Visual.floatMode;
- else
- ctx->Color._ClampReadColor = ctx->Color.ClampReadColor;
-}
-
-/**
* Update the ctx->VertexProgram._TwoSideEnabled flag.
*/
static void
@@ -507,9 +467,6 @@ _mesa_update_state_locked( struct gl_context *ctx )
if (new_state & (_NEW_LIGHT | _NEW_PROGRAM))
update_twoside( ctx );
- if (new_state & (_NEW_LIGHT | _NEW_BUFFERS))
- update_clamp_vertex_color(ctx);
-
if (new_state & (_NEW_STENCIL | _NEW_BUFFERS))
_mesa_update_stencil( ctx );
@@ -525,12 +482,6 @@ _mesa_update_state_locked( struct gl_context *ctx )
if (new_state & (_NEW_MULTISAMPLE | _NEW_BUFFERS))
update_multisample( ctx );
- if (new_state & (_NEW_COLOR | _NEW_BUFFERS))
- update_clamp_read_color(ctx);
-
- if(new_state & (_NEW_FRAG_CLAMP | _NEW_BUFFERS))
- update_clamp_fragment_color(ctx);
-
#if 0
if (new_state & (_NEW_POINT | _NEW_LINE | _NEW_POLYGON | _NEW_LIGHT
| _NEW_STENCIL | _MESA_NEW_SEPARATE_SPECULAR))
diff --git a/mesalib/src/mesa/main/stencil.c b/mesalib/src/mesa/main/stencil.c
index c161808e5..330841731 100644
--- a/mesalib/src/mesa/main/stencil.c
+++ b/mesalib/src/mesa/main/stencil.c
@@ -551,6 +551,11 @@ _mesa_update_stencil(struct gl_context *ctx)
ctx->Stencil.Ref[0] != ctx->Stencil.Ref[face] ||
ctx->Stencil.ValueMask[0] != ctx->Stencil.ValueMask[face] ||
ctx->Stencil.WriteMask[0] != ctx->Stencil.WriteMask[face]);
+
+ ctx->Stencil._WriteEnabled =
+ ctx->Stencil._Enabled &&
+ (ctx->Stencil.WriteMask[0] != 0 ||
+ (ctx->Stencil._TestTwoSide && ctx->Stencil.WriteMask[face] != 0));
}
diff --git a/mesalib/src/mesa/main/texenv.c b/mesalib/src/mesa/main/texenv.c
index 0fe5fbd7a..2979e6706 100644
--- a/mesalib/src/mesa/main/texenv.c
+++ b/mesalib/src/mesa/main/texenv.c
@@ -32,6 +32,7 @@
#include "main/glheader.h"
#include "main/context.h"
+#include "main/blend.h"
#include "main/enums.h"
#include "main/macros.h"
#include "main/mtypes.h"
@@ -680,7 +681,7 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
if (pname == GL_TEXTURE_ENV_COLOR) {
if(ctx->NewState & (_NEW_BUFFERS | _NEW_FRAG_CLAMP))
_mesa_update_state(ctx);
- if(ctx->Color._ClampFragmentColor)
+ if (_mesa_get_clamp_fragment_color(ctx))
COPY_4FV( params, texUnit->EnvColor );
else
COPY_4FV( params, texUnit->EnvColorUnclamped );
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index bc755ae79..784b389a7 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -47,6 +47,7 @@
#include "teximage.h"
#include "texobj.h"
#include "texstate.h"
+#include "texstorage.h"
#include "mtypes.h"
#include "glformats.h"
@@ -4194,7 +4195,8 @@ check_multisample_target(GLuint dims, GLenum target)
static void
teximagemultisample(GLuint dims, GLenum target, GLsizei samples,
GLint internalformat, GLsizei width, GLsizei height,
- GLsizei depth, GLboolean fixedsamplelocations)
+ GLsizei depth, GLboolean fixedsamplelocations,
+ GLboolean immutable, const char *func)
{
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
@@ -4206,12 +4208,12 @@ teximagemultisample(GLuint dims, GLenum target, GLsizei samples,
if (!(ctx->Extensions.ARB_texture_multisample
&& _mesa_is_desktop_gl(ctx))) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glTexImage%uDMultisample", dims);
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s(unsupported)", func);
return;
}
if (!check_multisample_target(dims, target)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage%uDMultisample(target)", dims);
+ _mesa_error(ctx, GL_INVALID_ENUM, "%s(target)", func);
return;
}
@@ -4219,26 +4221,40 @@ teximagemultisample(GLuint dims, GLenum target, GLsizei samples,
* refer GL3.1 spec 4.4.4
*/
+ if (immutable && !_mesa_is_legal_tex_storage_format(ctx, internalformat)) {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "%s(internalformat=%s not legal for immutable-format)",
+ func, _mesa_lookup_enum_by_nr(internalformat));
+ return;
+ }
+
if (!is_renderable_texture_format(ctx, internalformat)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
- "glTexImage%uDMultisample(internalformat=%s)",
- dims,
- _mesa_lookup_enum_by_nr(internalformat));
+ "%s(internalformat=%s)",
+ func, _mesa_lookup_enum_by_nr(internalformat));
return;
}
sample_count_error = _mesa_check_sample_count(ctx, target,
internalformat, samples);
if (sample_count_error != GL_NO_ERROR) {
- _mesa_error(ctx, sample_count_error, "glTexImage%uDMultisample(samples)", dims);
+ _mesa_error(ctx, sample_count_error, "%s(samples)", func);
return;
}
texObj = _mesa_get_current_tex_object(ctx, target);
+
+ if (immutable && (!texObj || (texObj->Name == 0))) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "%s(texture object 0)",
+ func);
+ return;
+ }
+
texImage = _mesa_get_tex_image(ctx, texObj, 0, 0);
if (texImage == NULL) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage%uDMultisample()", dims);
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s()", func);
return;
}
@@ -4268,13 +4284,19 @@ teximagemultisample(GLuint dims, GLenum target, GLsizei samples,
else {
if (!dimensionsOK) {
_mesa_error(ctx, GL_INVALID_VALUE,
- "glTexImage%uDMultisample(invalid width or height)", dims);
+ "%s(invalid width or height)", func);
return;
}
if (!sizeOK) {
_mesa_error(ctx, GL_OUT_OF_MEMORY,
- "glTexImage%uDMultisample(texture too large)", dims);
+ "%s(texture too large)", func);
+ return;
+ }
+
+ /* Check if texObj->Immutable is set */
+ if (texObj->Immutable) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s(immutable)", func);
return;
}
@@ -4299,6 +4321,7 @@ teximagemultisample(GLuint dims, GLenum target, GLsizei samples,
}
}
+ texObj->Immutable = immutable;
_mesa_update_fbo_texture(ctx, texObj, 0, 0);
}
}
@@ -4309,7 +4332,7 @@ _mesa_TexImage2DMultisample(GLenum target, GLsizei samples,
GLsizei height, GLboolean fixedsamplelocations)
{
teximagemultisample(2, target, samples, internalformat,
- width, height, 1, fixedsamplelocations);
+ width, height, 1, fixedsamplelocations, GL_FALSE, "glTexImage2DMultisample");
}
void GLAPIENTRY
@@ -4319,5 +4342,25 @@ _mesa_TexImage3DMultisample(GLenum target, GLsizei samples,
GLboolean fixedsamplelocations)
{
teximagemultisample(3, target, samples, internalformat,
- width, height, depth, fixedsamplelocations);
+ width, height, depth, fixedsamplelocations, GL_FALSE, "glTexImage3DMultisample");
+}
+
+
+void GLAPIENTRY
+_mesa_TexStorage2DMultisample(GLenum target, GLsizei samples,
+ GLenum internalformat, GLsizei width,
+ GLsizei height, GLboolean fixedsamplelocations)
+{
+ teximagemultisample(2, target, samples, internalformat,
+ width, height, 1, fixedsamplelocations, GL_TRUE, "glTexStorage2DMultisample");
+}
+
+void GLAPIENTRY
+_mesa_TexStorage3DMultisample(GLenum target, GLsizei samples,
+ GLenum internalformat, GLsizei width,
+ GLsizei height, GLsizei depth,
+ GLboolean fixedsamplelocations)
+{
+ teximagemultisample(3, target, samples, internalformat,
+ width, height, depth, fixedsamplelocations, GL_TRUE, "glTexStorage3DMultisample");
}
diff --git a/mesalib/src/mesa/main/teximage.h b/mesalib/src/mesa/main/teximage.h
index 744c47a8a..bb295c7a7 100644
--- a/mesalib/src/mesa/main/teximage.h
+++ b/mesalib/src/mesa/main/teximage.h
@@ -305,6 +305,17 @@ _mesa_TexImage3DMultisample(GLenum target, GLsizei samples,
GLsizei height, GLsizei depth,
GLboolean fixedsamplelocations);
+extern void GLAPIENTRY
+_mesa_TexStorage2DMultisample(GLenum target, GLsizei samples,
+ GLenum internalformat, GLsizei width,
+ GLsizei height, GLboolean fixedsamplelocations);
+
+extern void GLAPIENTRY
+_mesa_TexStorage3DMultisample(GLenum target, GLsizei samples,
+ GLenum internalformat, GLsizei width,
+ GLsizei height, GLsizei depth,
+ GLboolean fixedsamplelocations);
+
/*@}*/
#ifdef __cplusplus
diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c
index bd2f75170..f60eb204e 100644
--- a/mesalib/src/mesa/main/texparam.c
+++ b/mesalib/src/mesa/main/texparam.c
@@ -31,6 +31,7 @@
#include <stdbool.h>
#include "main/glheader.h"
+#include "main/blend.h"
#include "main/colormac.h"
#include "main/context.h"
#include "main/enums.h"
@@ -175,6 +176,16 @@ get_texobj(struct gl_context *ctx, GLenum target, GLboolean get)
return texUnit->CurrentTex[TEXTURE_CUBE_ARRAY_INDEX];
}
break;
+ case GL_TEXTURE_2D_MULTISAMPLE:
+ if (ctx->Extensions.ARB_texture_storage_multisample) {
+ return texUnit->CurrentTex[TEXTURE_2D_MULTISAMPLE_INDEX];
+ }
+ break;
+ case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
+ if (ctx->Extensions.ARB_texture_storage_multisample) {
+ return texUnit->CurrentTex[TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX];
+ }
+ break;
default:
;
}
@@ -250,6 +261,20 @@ incomplete(struct gl_context *ctx, struct gl_texture_object *texObj)
}
+static GLboolean
+target_allows_setting_sampler_parameters(GLenum target)
+{
+ switch (target) {
+ case GL_TEXTURE_2D_MULTISAMPLE:
+ case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
+ return GL_FALSE;
+
+ default:
+ return GL_TRUE;
+ }
+}
+
+
/**
* Set an integer-valued texture parameter
* \return GL_TRUE if legal AND the value changed, GL_FALSE otherwise
@@ -261,6 +286,9 @@ set_tex_parameteri(struct gl_context *ctx,
{
switch (pname) {
case GL_TEXTURE_MIN_FILTER:
+ if (!target_allows_setting_sampler_parameters(texObj->Target))
+ goto invalid_operation;
+
if (texObj->Sampler.MinFilter == params[0])
return GL_FALSE;
switch (params[0]) {
@@ -286,6 +314,9 @@ set_tex_parameteri(struct gl_context *ctx,
return GL_FALSE;
case GL_TEXTURE_MAG_FILTER:
+ if (!target_allows_setting_sampler_parameters(texObj->Target))
+ goto invalid_operation;
+
if (texObj->Sampler.MagFilter == params[0])
return GL_FALSE;
switch (params[0]) {
@@ -300,6 +331,9 @@ set_tex_parameteri(struct gl_context *ctx,
return GL_FALSE;
case GL_TEXTURE_WRAP_S:
+ if (!target_allows_setting_sampler_parameters(texObj->Target))
+ goto invalid_operation;
+
if (texObj->Sampler.WrapS == params[0])
return GL_FALSE;
if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) {
@@ -310,6 +344,9 @@ set_tex_parameteri(struct gl_context *ctx,
return GL_FALSE;
case GL_TEXTURE_WRAP_T:
+ if (!target_allows_setting_sampler_parameters(texObj->Target))
+ goto invalid_operation;
+
if (texObj->Sampler.WrapT == params[0])
return GL_FALSE;
if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) {
@@ -320,6 +357,9 @@ set_tex_parameteri(struct gl_context *ctx,
return GL_FALSE;
case GL_TEXTURE_WRAP_R:
+ if (!target_allows_setting_sampler_parameters(texObj->Target))
+ goto invalid_operation;
+
if (texObj->Sampler.WrapR == params[0])
return GL_FALSE;
if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) {
@@ -335,6 +375,11 @@ set_tex_parameteri(struct gl_context *ctx,
if (texObj->BaseLevel == params[0])
return GL_FALSE;
+
+ if ((texObj->Target == GL_TEXTURE_2D_MULTISAMPLE ||
+ texObj->Target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) && params[0] != 0)
+ goto invalid_operation;
+
if (params[0] < 0 ||
(texObj->Target == GL_TEXTURE_RECTANGLE_ARB && params[0] != 0)) {
_mesa_error(ctx, GL_INVALID_VALUE,
@@ -348,6 +393,7 @@ set_tex_parameteri(struct gl_context *ctx,
case GL_TEXTURE_MAX_LEVEL:
if (texObj->MaxLevel == params[0])
return GL_FALSE;
+
if (params[0] < 0 || texObj->Target == GL_TEXTURE_RECTANGLE_ARB) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glTexParameter(param=%d)", params[0]);
@@ -373,6 +419,10 @@ set_tex_parameteri(struct gl_context *ctx,
case GL_TEXTURE_COMPARE_MODE_ARB:
if ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_shadow)
|| _mesa_is_gles3(ctx)) {
+
+ if (!target_allows_setting_sampler_parameters(texObj->Target))
+ goto invalid_operation;
+
if (texObj->Sampler.CompareMode == params[0])
return GL_FALSE;
if (params[0] == GL_NONE ||
@@ -388,6 +438,10 @@ set_tex_parameteri(struct gl_context *ctx,
case GL_TEXTURE_COMPARE_FUNC_ARB:
if ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_shadow)
|| _mesa_is_gles3(ctx)) {
+
+ if (!target_allows_setting_sampler_parameters(texObj->Target))
+ goto invalid_operation;
+
if (texObj->Sampler.CompareFunc == params[0])
return GL_FALSE;
switch (params[0]) {
@@ -489,7 +543,11 @@ set_tex_parameteri(struct gl_context *ctx,
case GL_TEXTURE_SRGB_DECODE_EXT:
if (_mesa_is_desktop_gl(ctx)
&& ctx->Extensions.EXT_texture_sRGB_decode) {
- GLenum decode = params[0];
+ GLenum decode = params[0];
+
+ if (!target_allows_setting_sampler_parameters(texObj->Target))
+ goto invalid_operation;
+
if (decode == GL_DECODE_EXT || decode == GL_SKIP_DECODE_EXT) {
if (texObj->Sampler.sRGBDecode != decode) {
flush(ctx);
@@ -504,6 +562,10 @@ set_tex_parameteri(struct gl_context *ctx,
if (_mesa_is_desktop_gl(ctx)
&& ctx->Extensions.AMD_seamless_cubemap_per_texture) {
GLenum param = params[0];
+
+ if (!target_allows_setting_sampler_parameters(texObj->Target))
+ goto invalid_operation;
+
if (param != GL_TRUE && param != GL_FALSE) {
goto invalid_param;
}
@@ -528,6 +590,11 @@ invalid_param:
_mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(param=%s)",
_mesa_lookup_enum_by_nr(params[0]));
return GL_FALSE;
+
+invalid_operation:
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glTexParameter(pname=%s)",
+ _mesa_lookup_enum_by_nr(pname));
+ return GL_FALSE;
}
@@ -545,6 +612,9 @@ set_tex_parameterf(struct gl_context *ctx,
if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
goto invalid_pname;
+ if (!target_allows_setting_sampler_parameters(texObj->Target))
+ goto invalid_operation;
+
if (texObj->Sampler.MinLod == params[0])
return GL_FALSE;
flush(ctx);
@@ -555,6 +625,9 @@ set_tex_parameterf(struct gl_context *ctx,
if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
goto invalid_pname;
+ if (!target_allows_setting_sampler_parameters(texObj->Target))
+ goto invalid_operation;
+
if (texObj->Sampler.MaxLod == params[0])
return GL_FALSE;
flush(ctx);
@@ -571,6 +644,9 @@ set_tex_parameterf(struct gl_context *ctx,
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
if (ctx->Extensions.EXT_texture_filter_anisotropic) {
+ if (!target_allows_setting_sampler_parameters(texObj->Target))
+ goto invalid_operation;
+
if (texObj->Sampler.MaxAnisotropy == params[0])
return GL_FALSE;
if (params[0] < 1.0) {
@@ -598,6 +674,9 @@ set_tex_parameterf(struct gl_context *ctx,
if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
+ if (!target_allows_setting_sampler_parameters(texObj->Target))
+ goto invalid_operation;
+
if (texObj->Sampler.LodBias != params[0]) {
flush(ctx);
texObj->Sampler.LodBias = params[0];
@@ -609,6 +688,9 @@ set_tex_parameterf(struct gl_context *ctx,
if (!_mesa_is_desktop_gl(ctx))
goto invalid_pname;
+ if (!target_allows_setting_sampler_parameters(texObj->Target))
+ goto invalid_operation;
+
flush(ctx);
/* ARB_texture_float disables clamping */
if (ctx->Extensions.ARB_texture_float) {
@@ -633,6 +715,11 @@ invalid_pname:
_mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=%s)",
_mesa_lookup_enum_by_nr(pname));
return GL_FALSE;
+
+invalid_operation:
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glTexParameter(pname=%s)",
+ _mesa_lookup_enum_by_nr(pname));
+ return GL_FALSE;
}
@@ -1329,7 +1416,7 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
if (ctx->NewState & (_NEW_BUFFERS | _NEW_FRAG_CLAMP))
_mesa_update_state_locked(ctx);
- if (ctx->Color._ClampFragmentColor) {
+ if (_mesa_get_clamp_fragment_color(ctx)) {
params[0] = CLAMP(obj->Sampler.BorderColor.f[0], 0.0F, 1.0F);
params[1] = CLAMP(obj->Sampler.BorderColor.f[1], 0.0F, 1.0F);
params[2] = CLAMP(obj->Sampler.BorderColor.f[2], 0.0F, 1.0F);
diff --git a/mesalib/src/mesa/main/texstorage.c b/mesalib/src/mesa/main/texstorage.c
index 675fd745b..6309b5716 100644
--- a/mesalib/src/mesa/main/texstorage.c
+++ b/mesalib/src/mesa/main/texstorage.c
@@ -202,20 +202,9 @@ clear_texture_fields(struct gl_context *ctx,
}
-/**
- * Do error checking for calls to glTexStorage1/2/3D().
- * If an error is found, record it with _mesa_error(), unless the target
- * is a proxy texture.
- * \return GL_TRUE if any error, GL_FALSE otherwise.
- */
-static GLboolean
-tex_storage_error_check(struct gl_context *ctx, GLuint dims, GLenum target,
- GLsizei levels, GLenum internalformat,
- GLsizei width, GLsizei height, GLsizei depth)
+GLboolean
+_mesa_is_legal_tex_storage_format(struct gl_context *ctx, GLenum internalformat)
{
- struct gl_texture_object *texObj;
- GLboolean legalFormat;
-
/* check internal format - note that only sized formats are allowed */
switch (internalformat) {
case GL_ALPHA:
@@ -250,13 +239,27 @@ tex_storage_error_check(struct gl_context *ctx, GLuint dims, GLenum target,
case GL_LUMINANCE_INTEGER_EXT:
case GL_LUMINANCE_ALPHA_INTEGER_EXT:
/* these unsized formats are illegal */
- legalFormat = GL_FALSE;
- break;
+ return GL_FALSE;
default:
- legalFormat = _mesa_base_tex_format(ctx, internalformat) > 0;
+ return _mesa_base_tex_format(ctx, internalformat) > 0;
}
+}
+
+
+/**
+ * Do error checking for calls to glTexStorage1/2/3D().
+ * If an error is found, record it with _mesa_error(), unless the target
+ * is a proxy texture.
+ * \return GL_TRUE if any error, GL_FALSE otherwise.
+ */
+static GLboolean
+tex_storage_error_check(struct gl_context *ctx, GLuint dims, GLenum target,
+ GLsizei levels, GLenum internalformat,
+ GLsizei width, GLsizei height, GLsizei depth)
+{
+ struct gl_texture_object *texObj;
- if (!legalFormat) {
+ if (!_mesa_is_legal_tex_storage_format(ctx, internalformat)) {
_mesa_error(ctx, GL_INVALID_ENUM,
"glTexStorage%uD(internalformat = %s)", dims,
_mesa_lookup_enum_by_nr(internalformat));
diff --git a/mesalib/src/mesa/main/texstorage.h b/mesalib/src/mesa/main/texstorage.h
index 99382df51..9f172e1ca 100644
--- a/mesalib/src/mesa/main/texstorage.h
+++ b/mesalib/src/mesa/main/texstorage.h
@@ -57,5 +57,8 @@ _mesa_TextureStorage3DEXT(GLuint texture, GLenum target, GLsizei levels,
GLenum internalformat,
GLsizei width, GLsizei height, GLsizei depth);
+extern GLboolean
+_mesa_is_legal_tex_storage_format(struct gl_context *ctx, GLenum internalformat);
+
#endif /* TEXSTORAGE_H */
diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c
index 3d4af5923..ecca446c1 100644
--- a/mesalib/src/mesa/main/version.c
+++ b/mesalib/src/mesa/main/version.c
@@ -233,7 +233,8 @@ compute_version(struct gl_context *ctx)
const GLboolean ver_3_0 = (ver_2_1 &&
ctx->Const.GLSLVersion >= 130 &&
ctx->Const.MaxSamples >= 4 &&
- ctx->Extensions.ARB_color_buffer_float &&
+ (ctx->API == API_OPENGL_CORE ||
+ ctx->Extensions.ARB_color_buffer_float) &&
ctx->Extensions.ARB_depth_buffer_float &&
ctx->Extensions.ARB_half_float_pixel &&
ctx->Extensions.ARB_half_float_vertex &&