aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa')
-rw-r--r--mesalib/src/mesa/drivers/common/driverfuncs.c3
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c18
-rw-r--r--mesalib/src/mesa/drivers/dri/common/Android.mk3
-rw-r--r--mesalib/src/mesa/drivers/dri/common/drirc6
-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
-rw-r--r--mesalib/src/mesa/program/ir_to_mesa.cpp3
-rw-r--r--mesalib/src/mesa/program/prog_cache.c11
-rw-r--r--mesalib/src/mesa/program/prog_statevars.c8
-rw-r--r--mesalib/src/mesa/program/register_allocate.c31
-rw-r--r--mesalib/src/mesa/program/register_allocate.h1
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_constbuf.c8
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_rasterizer.c3
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_shader.c3
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_bitmap.c4
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_drawpixels.c11
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_drawtex.c4
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_readpixels.c3
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c11
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp9
-rw-r--r--mesalib/src/mesa/state_tracker/st_manager.c5
-rw-r--r--mesalib/src/mesa/swrast/s_blit.c8
46 files changed, 481 insertions, 171 deletions
diff --git a/mesalib/src/mesa/drivers/common/driverfuncs.c b/mesalib/src/mesa/drivers/common/driverfuncs.c
index 731d46658..a98dfc607 100644
--- a/mesalib/src/mesa/drivers/common/driverfuncs.c
+++ b/mesalib/src/mesa/drivers/common/driverfuncs.c
@@ -28,6 +28,7 @@
#include "main/accum.h"
#include "main/arrayobj.h"
#include "main/context.h"
+#include "main/formatquery.h"
#include "main/framebuffer.h"
#include "main/mipmap.h"
#include "main/queryobj.h"
@@ -90,7 +91,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
/* Texture functions */
driver->ChooseTextureFormat = _mesa_choose_tex_format;
- driver->QuerySamplesForFormat = NULL;
+ driver->QuerySamplesForFormat = _mesa_query_samples_for_format;
driver->TexImage = _mesa_store_teximage;
driver->TexSubImage = _mesa_store_texsubimage;
driver->GetTexImage = _mesa_meta_GetTexImage;
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index 8114550ba..e3ab82bfe 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -757,7 +757,8 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
* it's for the pixel path (ClampFragmentColor is GL_TRUE),
* regardless of the internal implementation of the metaops.
*/
- if (ctx->Color.ClampFragmentColor != GL_TRUE)
+ if (ctx->Color.ClampFragmentColor != GL_TRUE &&
+ ctx->Extensions.ARB_color_buffer_float)
_mesa_ClampColor(GL_CLAMP_FRAGMENT_COLOR, GL_FALSE);
}
@@ -767,7 +768,8 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
/* Generally in here we never want vertex color clamping --
* result clamping is only dependent on fragment clamping.
*/
- _mesa_ClampColor(GL_CLAMP_VERTEX_COLOR, GL_FALSE);
+ if (ctx->Extensions.ARB_color_buffer_float)
+ _mesa_ClampColor(GL_CLAMP_VERTEX_COLOR, GL_FALSE);
}
if (state & MESA_META_CONDITIONAL_RENDER) {
@@ -1091,11 +1093,13 @@ _mesa_meta_end(struct gl_context *ctx)
_mesa_DepthRange(save->DepthNear, save->DepthFar);
}
- if (state & MESA_META_CLAMP_FRAGMENT_COLOR) {
+ if (state & MESA_META_CLAMP_FRAGMENT_COLOR &&
+ ctx->Extensions.ARB_color_buffer_float) {
_mesa_ClampColor(GL_CLAMP_FRAGMENT_COLOR, save->ClampFragmentColor);
}
- if (state & MESA_META_CLAMP_VERTEX_COLOR) {
+ if (state & MESA_META_CLAMP_VERTEX_COLOR &&
+ ctx->Extensions.ARB_color_buffer_float) {
_mesa_ClampColor(GL_CLAMP_VERTEX_COLOR, save->ClampVertexColor);
}
@@ -2044,7 +2048,8 @@ _mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers)
/* leave colormask, glDrawBuffer state as-is */
/* Clears never have the color clamped. */
- _mesa_ClampColor(GL_CLAMP_FRAGMENT_COLOR, GL_FALSE);
+ if (ctx->Extensions.ARB_color_buffer_float)
+ _mesa_ClampColor(GL_CLAMP_FRAGMENT_COLOR, GL_FALSE);
}
else {
ASSERT(metaSave & MESA_META_COLOR_MASK);
@@ -2295,7 +2300,8 @@ _mesa_meta_glsl_Clear(struct gl_context *ctx, GLbitfield buffers)
/* leave colormask, glDrawBuffer state as-is */
/* Clears never have the color clamped. */
- _mesa_ClampColor(GL_CLAMP_FRAGMENT_COLOR, GL_FALSE);
+ if (ctx->Extensions.ARB_color_buffer_float)
+ _mesa_ClampColor(GL_CLAMP_FRAGMENT_COLOR, GL_FALSE);
}
else {
ASSERT(metaSave & MESA_META_COLOR_MASK);
diff --git a/mesalib/src/mesa/drivers/dri/common/Android.mk b/mesalib/src/mesa/drivers/dri/common/Android.mk
index f428c3855..b3dac29dd 100644
--- a/mesalib/src/mesa/drivers/dri/common/Android.mk
+++ b/mesalib/src/mesa/drivers/dri/common/Android.mk
@@ -77,7 +77,8 @@ $(intermediates)/xmlpool/options.h: PRIVATE_SCRIPT := $(LOCAL_PATH)/xmlpool/gen_
$(intermediates)/xmlpool/options.h: PRIVATE_LOCALEDIR := $(intermediates)/xmlpool
$(intermediates)/xmlpool/options.h: PRIVATE_TEMPLATE_HEADER := $(LOCAL_PATH)/xmlpool/t_options.h
$(intermediates)/xmlpool/options.h: PRIVATE_MO_FILES := $(MESA_DRI_OPTIONS_LANGS:%=$(intermediates)/xmlpool/%/LC_MESSAGES/options.mo)
-$(intermediates)/xmlpool/options.h: $(PRIVATE_SCRIPT) $(PRIVATE_TEMPLATE_HEADER) $(PRIVATE_MO_FILES)
+.SECONDEXPANSION:
+$(intermediates)/xmlpool/options.h: $$(PRIVATE_SCRIPT) $$(PRIVATE_TEMPLATE_HEADER) $$(PRIVATE_MO_FILES)
mkdir -p $(dir $@)
mkdir -p $(PRIVATE_LOCALEDIR)
$(MESA_PYTHON2) $(PRIVATE_SCRIPT) $(PRIVATE_TEMPLATE_HEADER) \
diff --git a/mesalib/src/mesa/drivers/dri/common/drirc b/mesalib/src/mesa/drivers/dri/common/drirc
index a13941f68..556d1b599 100644
--- a/mesalib/src/mesa/drivers/dri/common/drirc
+++ b/mesalib/src/mesa/drivers/dri/common/drirc
@@ -25,5 +25,11 @@
<application name="Savage 2" executable="savage2.bin">
<option name="disable_glsl_line_continuations" value="true" />
</application>
+ <application name="Topogun (32-bit)" executable="topogun32">
+ <option name="always_have_depth_buffer" value="true" />
+ </application>
+ <application name="Topogun (64-bit)" executable="topogun64">
+ <option name="always_have_depth_buffer" value="true" />
+ </application>
</device>
</driconf>
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 8c8192595..c4ae2a6ce 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 &&
diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp
index 2cb5f02f4..14cf5baa7 100644
--- a/mesalib/src/mesa/program/ir_to_mesa.cpp
+++ b/mesalib/src/mesa/program/ir_to_mesa.cpp
@@ -2048,6 +2048,9 @@ ir_to_mesa_visitor::visit(ir_texture *ir)
case ir_txf_ms:
assert(!"Unexpected ir_txf_ms opcode");
break;
+ case ir_lod:
+ assert(!"Unexpected ir_lod opcode");
+ break;
}
const glsl_type *sampler_type = ir->sampler->type;
diff --git a/mesalib/src/mesa/program/prog_cache.c b/mesalib/src/mesa/program/prog_cache.c
index 47f926b1b..1f1c6142d 100644
--- a/mesalib/src/mesa/program/prog_cache.c
+++ b/mesalib/src/mesa/program/prog_cache.c
@@ -37,6 +37,7 @@
struct cache_item
{
GLuint hash;
+ unsigned keysize;
void *key;
struct gl_program *program;
struct cache_item *next;
@@ -174,7 +175,8 @@ struct gl_program *
_mesa_search_program_cache(struct gl_program_cache *cache,
const void *key, GLuint keysize)
{
- if (cache->last &&
+ if (cache->last &&
+ cache->last->keysize == keysize &&
memcmp(cache->last->key, key, keysize) == 0) {
return cache->last->program;
}
@@ -183,7 +185,10 @@ _mesa_search_program_cache(struct gl_program_cache *cache,
struct cache_item *c;
for (c = cache->items[hash % cache->size]; c; c = c->next) {
- if (c->hash == hash && memcmp(c->key, key, keysize) == 0) {
+ if (c->hash == hash &&
+ c->keysize == keysize &&
+ memcmp(c->key, key, keysize) == 0) {
+
cache->last = c;
return c->program;
}
@@ -207,6 +212,7 @@ _mesa_program_cache_insert(struct gl_context *ctx,
c->key = malloc(keysize);
memcpy(c->key, key, keysize);
+ c->keysize = keysize;
c->program = program; /* no refcount change */
@@ -235,6 +241,7 @@ _mesa_shader_cache_insert(struct gl_context *ctx,
c->key = malloc(keysize);
memcpy(c->key, key, keysize);
+ c->keysize = keysize;
c->program = (struct gl_program *)program; /* no refcount change */
diff --git a/mesalib/src/mesa/program/prog_statevars.c b/mesalib/src/mesa/program/prog_statevars.c
index 5a350798c..09d2a568a 100644
--- a/mesalib/src/mesa/program/prog_statevars.c
+++ b/mesalib/src/mesa/program/prog_statevars.c
@@ -31,6 +31,7 @@
#include "main/glheader.h"
#include "main/context.h"
+#include "main/blend.h"
#include "main/imports.h"
#include "main/macros.h"
#include "main/mtypes.h"
@@ -239,14 +240,14 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
{
/* state[1] is the texture unit */
const GLuint unit = (GLuint) state[1];
- if(ctx->Color._ClampFragmentColor)
+ if (_mesa_get_clamp_fragment_color(ctx))
COPY_4V(value, ctx->Texture.Unit[unit].EnvColor);
else
COPY_4V(value, ctx->Texture.Unit[unit].EnvColorUnclamped);
}
return;
case STATE_FOG_COLOR:
- if(ctx->Color._ClampFragmentColor)
+ if (_mesa_get_clamp_fragment_color(ctx))
COPY_4V(value, ctx->Fog.Color);
else
COPY_4V(value, ctx->Fog.ColorUnclamped);
@@ -871,6 +872,9 @@ append_token(char *dst, gl_state_index k)
case STATE_CURRENT_ATTRIB:
append(dst, "current");
break;
+ case STATE_CURRENT_ATTRIB_MAYBE_VP_CLAMPED:
+ append(dst, "currentAttribMaybeVPClamped");
+ break;
case STATE_NORMAL_SCALE:
append(dst, "normalScale");
break;
diff --git a/mesalib/src/mesa/program/register_allocate.c b/mesalib/src/mesa/program/register_allocate.c
index a9064c38c..2c826fc66 100644
--- a/mesalib/src/mesa/program/register_allocate.c
+++ b/mesalib/src/mesa/program/register_allocate.c
@@ -70,6 +70,7 @@
* this during ra_set_finalize().
*/
+#include <stdbool.h>
#include <ralloc.h>
#include "main/imports.h"
@@ -93,6 +94,8 @@ struct ra_regs {
struct ra_class **classes;
unsigned int class_count;
+
+ bool round_robin;
};
struct ra_class {
@@ -185,6 +188,22 @@ ra_alloc_reg_set(void *mem_ctx, unsigned int count)
return regs;
}
+/**
+ * The register allocator by default prefers to allocate low register numbers,
+ * since it was written for hardware (gen4/5 Intel) that is limited in its
+ * multithreadedness by the number of registers used in a given shader.
+ *
+ * However, for hardware without that restriction, densely packed register
+ * allocation can put serious constraints on instruction scheduling. This
+ * function tells the allocator to rotate around the registers if possible as
+ * it allocates the nodes.
+ */
+void
+ra_set_allocate_round_robin(struct ra_regs *regs)
+{
+ regs->round_robin = true;
+}
+
static void
ra_add_conflict_list(struct ra_regs *regs, unsigned int r1, unsigned int r2)
{
@@ -436,16 +455,19 @@ GLboolean
ra_select(struct ra_graph *g)
{
int i;
+ int start_search_reg = 0;
while (g->stack_count != 0) {
- unsigned int r;
+ unsigned int ri;
+ unsigned int r = -1;
int n = g->stack[g->stack_count - 1];
struct ra_class *c = g->regs->classes[g->nodes[n].class];
/* Find the lowest-numbered reg which is not used by a member
* of the graph adjacent to us.
*/
- for (r = 0; r < g->regs->count; r++) {
+ for (ri = 0; ri < g->regs->count; ri++) {
+ r = (start_search_reg + ri) % g->regs->count;
if (!c->regs[r])
continue;
@@ -461,12 +483,15 @@ ra_select(struct ra_graph *g)
if (i == g->nodes[n].adjacency_count)
break;
}
- if (r == g->regs->count)
+ if (ri == g->regs->count)
return GL_FALSE;
g->nodes[n].reg = r;
g->nodes[n].in_stack = GL_FALSE;
g->stack_count--;
+
+ if (g->regs->round_robin)
+ start_search_reg = r + 1;
}
return GL_TRUE;
diff --git a/mesalib/src/mesa/program/register_allocate.h b/mesalib/src/mesa/program/register_allocate.h
index 2a9d61191..fa119e320 100644
--- a/mesalib/src/mesa/program/register_allocate.h
+++ b/mesalib/src/mesa/program/register_allocate.h
@@ -37,6 +37,7 @@ struct ra_regs;
* two real registers from which they are composed.
*/
struct ra_regs *ra_alloc_reg_set(void *mem_ctx, unsigned int count);
+void ra_set_allocate_round_robin(struct ra_regs *regs);
unsigned int ra_alloc_reg_class(struct ra_regs *regs);
void ra_add_reg_conflict(struct ra_regs *regs,
unsigned int r1, unsigned int r2);
diff --git a/mesalib/src/mesa/state_tracker/st_atom_constbuf.c b/mesalib/src/mesa/state_tracker/st_atom_constbuf.c
index 961fb28a9..56ba96fe3 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_constbuf.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_constbuf.c
@@ -39,6 +39,7 @@
#include "pipe/p_defines.h"
#include "util/u_inlines.h"
#include "util/u_upload_mgr.h"
+#include "cso_cache/cso_context.h"
#include "st_debug.h"
#include "st_context.h"
@@ -96,16 +97,17 @@ void st_upload_constants( struct st_context *st,
_mesa_print_parameter_list(params);
}
- st->pipe->set_constant_buffer(st->pipe, shader_type, 0, &cb);
+ cso_set_constant_buffer(st->cso_context, shader_type, 0, &cb);
pipe_resource_reference(&cb.buffer, NULL);
st->state.constants[shader_type].ptr = params->ParameterValues;
st->state.constants[shader_type].size = paramBytes;
}
else if (st->state.constants[shader_type].ptr) {
+ /* Unbind. */
st->state.constants[shader_type].ptr = NULL;
st->state.constants[shader_type].size = 0;
- st->pipe->set_constant_buffer(st->pipe, shader_type, 0, NULL);
+ cso_set_constant_buffer(st->cso_context, shader_type, 0, NULL);
}
}
@@ -196,7 +198,7 @@ static void st_bind_ubos(struct st_context *st,
cb.buffer_size = st_obj->buffer->width0 - binding->Offset;
- st->pipe->set_constant_buffer(st->pipe, shader_type, 1 + i, &cb);
+ cso_set_constant_buffer(st->cso_context, shader_type, 1 + i, &cb);
pipe_resource_reference(&cb.buffer, NULL);
}
}
diff --git a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
index 866e5627d..62464b475 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
@@ -227,8 +227,7 @@ static void update_raster_state( struct st_context *st )
/* _NEW_FRAG_CLAMP */
raster->clamp_fragment_color = !st->clamp_frag_color_in_shader &&
- ctx->Color._ClampFragmentColor &&
- !ctx->DrawBuffer->_IntegerColor;
+ ctx->Color._ClampFragmentColor;
raster->gl_rasterization_rules = 1;
/* _NEW_RASTERIZER_DISCARD */
diff --git a/mesalib/src/mesa/state_tracker/st_atom_shader.c b/mesalib/src/mesa/state_tracker/st_atom_shader.c
index c1d7c80bb..c0239e929 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_shader.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_shader.c
@@ -86,8 +86,7 @@ update_fp( struct st_context *st )
/* _NEW_FRAG_CLAMP */
key.clamp_color = st->clamp_frag_color_in_shader &&
- st->ctx->Color._ClampFragmentColor &&
- !st->ctx->DrawBuffer->_IntegerColor;
+ st->ctx->Color._ClampFragmentColor;
st->fp_variant = st_get_fp_variant(st, stfp, &key);
diff --git a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c
index bae9ff858..b3ca40501 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c
@@ -417,8 +417,7 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
key.st = st;
key.bitmap = GL_TRUE;
key.clamp_color = st->clamp_frag_color_in_shader &&
- st->ctx->Color._ClampFragmentColor &&
- !st->ctx->DrawBuffer->_IntegerColor;
+ st->ctx->Color._ClampFragmentColor;
fpv = st_get_fp_variant(st, st->fp, &key);
@@ -766,6 +765,7 @@ st_Bitmap(struct gl_context *ctx, GLint x, GLint y,
/* create pass-through vertex shader now */
const uint semantic_names[] = { TGSI_SEMANTIC_POSITION,
TGSI_SEMANTIC_COLOR,
+ st->needs_texcoord_semantic ? TGSI_SEMANTIC_TEXCOORD :
TGSI_SEMANTIC_GENERIC };
const uint semantic_indexes[] = { 0, 0, 0 };
st->bitmap.vs = util_make_vertex_passthrough_shader(st->pipe, 3,
diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
index f0baa3435..f5a1e27f7 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -294,6 +294,9 @@ static void *
make_passthrough_vertex_shader(struct st_context *st,
GLboolean passColor)
{
+ const unsigned texcoord_semantic = st->needs_texcoord_semantic ?
+ TGSI_SEMANTIC_TEXCOORD : TGSI_SEMANTIC_GENERIC;
+
if (!st->drawpix.vert_shaders[passColor]) {
struct ureg_program *ureg = ureg_create( TGSI_PROCESSOR_VERTEX );
@@ -307,7 +310,7 @@ make_passthrough_vertex_shader(struct st_context *st,
/* MOV result.texcoord0, vertex.attr[1]; */
ureg_MOV(ureg,
- ureg_DECL_output( ureg, TGSI_SEMANTIC_GENERIC, 0 ),
+ ureg_DECL_output( ureg, texcoord_semantic, 0 ),
ureg_DECL_vs_input( ureg, 1 ));
if (passColor) {
@@ -707,8 +710,7 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
struct pipe_rasterizer_state rasterizer;
memset(&rasterizer, 0, sizeof(rasterizer));
rasterizer.clamp_fragment_color = !st->clamp_frag_color_in_shader &&
- ctx->Color._ClampFragmentColor &&
- !ctx->DrawBuffer->_IntegerColor;
+ ctx->Color._ClampFragmentColor;
rasterizer.gl_rasterization_rules = 1;
rasterizer.depth_clip = !ctx->Transform.DepthClamp;
rasterizer.scissor = ctx->Scissor.Enabled;
@@ -1034,8 +1036,7 @@ get_color_fp_variant(struct st_context *st)
ctx->Pixel.AlphaScale != 1.0);
key.pixelMaps = ctx->Pixel.MapColorFlag;
key.clamp_color = st->clamp_frag_color_in_shader &&
- st->ctx->Color._ClampFragmentColor &&
- !st->ctx->DrawBuffer->_IntegerColor;
+ st->ctx->Color._ClampFragmentColor;
fpv = st_get_fp_variant(st, st->fp, &key);
diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawtex.c b/mesalib/src/mesa/state_tracker/st_cb_drawtex.c
index a8806c91e..c4efce02f 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_drawtex.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_drawtex.c
@@ -209,7 +209,9 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
SET_ATTRIB(2, attr, s1, t1, 0.0f, 1.0f); /* upper right */
SET_ATTRIB(3, attr, s0, t1, 0.0f, 1.0f); /* upper left */
- semantic_names[attr] = TGSI_SEMANTIC_GENERIC;
+ semantic_names[attr] = st->needs_texcoord_semantic ?
+ TGSI_SEMANTIC_TEXCOORD : TGSI_SEMANTIC_GENERIC;
+ /* XXX: should this use semantic index i instead of 0 ? */
semantic_indexes[attr] = 0;
attr++;
diff --git a/mesalib/src/mesa/state_tracker/st_cb_readpixels.c b/mesalib/src/mesa/state_tracker/st_cb_readpixels.c
index bfed98870..9fab113fa 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_readpixels.c
@@ -133,7 +133,6 @@ st_readpixels(struct gl_context *ctx, GLint x, GLint y,
!screen->is_format_supported(screen, src_format, src->target,
src->nr_samples,
PIPE_BIND_SAMPLER_VIEW)) {
- printf("fallback: src format unsupported %s\n", util_format_short_name(src_format));
goto fallback;
}
@@ -147,8 +146,6 @@ st_readpixels(struct gl_context *ctx, GLint x, GLint y,
dst_format = st_choose_matching_format(screen, bind, format, type,
pack->SwapBytes);
if (dst_format == PIPE_FORMAT_NONE) {
- printf("fallback: no matching format for %s, %s\n",
- _mesa_lookup_enum_by_nr(format), _mesa_lookup_enum_by_nr(type));
goto fallback;
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index 94fbbf7be..0cd0d77af 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -868,7 +868,7 @@ st_GetTexImage(struct gl_context * ctx,
goto fallback;
}
- if (!stImage->pt) {
+ if (!stImage->pt || !src) {
goto fallback;
}
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index 11db9d3f3..2d8b9efec 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -629,6 +629,7 @@ void st_init_extensions(struct st_context *st)
ctx->Const.PrimitiveRestartInSoftware = GL_TRUE;
}
+ /* ARB_color_buffer_float. */
if (screen->get_param(screen, PIPE_CAP_VERTEX_COLOR_UNCLAMPED)) {
ctx->Extensions.ARB_color_buffer_float = GL_TRUE;
@@ -639,6 +640,16 @@ void st_init_extensions(struct st_context *st)
if (!screen->get_param(screen, PIPE_CAP_FRAGMENT_COLOR_CLAMPED)) {
st->clamp_frag_color_in_shader = TRUE;
}
+
+ /* For drivers which cannot do color clamping, it's better to just
+ * disable ARB_color_buffer_float in the core profile, because
+ * the clamping is deprecated there anyway. */
+ if (ctx->API == API_OPENGL_CORE &&
+ (st->clamp_frag_color_in_shader || st->clamp_vert_color_in_shader)) {
+ st->clamp_vert_color_in_shader = GL_FALSE;
+ st->clamp_frag_color_in_shader = GL_FALSE;
+ ctx->Extensions.ARB_color_buffer_float = GL_FALSE;
+ }
}
if (screen->fence_finish) {
diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index e3718eeda..338c652cb 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -1009,7 +1009,9 @@ glsl_to_tgsi_visitor::get_temp(const glsl_type *type)
src.reladdr = NULL;
src.negate = 0;
- if (type->is_array() || type->is_matrix()) {
+ if (!options->EmitNoIndirectTemp &&
+ (type->is_array() || type->is_matrix())) {
+
src.file = PROGRAM_ARRAY;
src.index = next_array << 16 | 0x8000;
array_sizes[next_array] = type_size(type);
@@ -2772,6 +2774,9 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
case ir_txf_ms:
assert(!"Unexpected ir_txf_ms opcode");
break;
+ case ir_lod:
+ assert(!"Unexpected ir_lod opcode");
+ break;
}
if (ir->projector) {
@@ -3191,7 +3196,7 @@ glsl_to_tgsi_visitor::simplify_cmp(void)
prevWriteMask = tempWrites[inst->dst.index];
tempWrites[inst->dst.index] |= inst->dst.writemask;
} else
- break;
+ continue;
/* For a CMP to be considered a conditional write, the destination
* register and source register two must be the same. */
diff --git a/mesalib/src/mesa/state_tracker/st_manager.c b/mesalib/src/mesa/state_tracker/st_manager.c
index 0b025d9d5..03e086a72 100644
--- a/mesalib/src/mesa/state_tracker/st_manager.c
+++ b/mesalib/src/mesa/state_tracker/st_manager.c
@@ -170,9 +170,8 @@ st_context_validate(struct st_context *st,
/**
* Validate a framebuffer to make sure up-to-date pipe_textures are used.
- * The context we need to pass in is s dummy context needed only to be
- * able to get a pipe context to create pipe surfaces, and to have a
- * context to call _mesa_resize_framebuffer():
+ * The context is only used for creating pipe surfaces and for calling
+ * _mesa_resize_framebuffer().
* (That should probably be rethought, since those surfaces become
* drawable state, not context state, and can be freed by another pipe
* context).
diff --git a/mesalib/src/mesa/swrast/s_blit.c b/mesalib/src/mesa/swrast/s_blit.c
index 82fa43f1c..051354dc8 100644
--- a/mesalib/src/mesa/swrast/s_blit.c
+++ b/mesalib/src/mesa/swrast/s_blit.c
@@ -110,8 +110,8 @@ blit_nearest(struct gl_context *ctx,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield buffer)
{
- struct gl_renderbuffer *readRb, *drawRb;
- struct gl_renderbuffer_attachment *readAtt, *drawAtt;
+ struct gl_renderbuffer *readRb, *drawRb = NULL;
+ struct gl_renderbuffer_attachment *readAtt = NULL, *drawAtt = NULL;
struct gl_framebuffer *readFb = ctx->ReadBuffer;
struct gl_framebuffer *drawFb = ctx->DrawBuffer;
GLuint numDrawBuffers = 0;
@@ -135,12 +135,12 @@ blit_nearest(struct gl_context *ctx,
UNPACK_Z_FLOAT,
UNPACK_Z_INT,
UNPACK_S,
- } mode;
+ } mode = DIRECT;
GLubyte *srcMap, *dstMap;
GLint srcRowStride, dstRowStride;
GLint dstRow;
- GLint pixelSize;
+ GLint pixelSize = 0;
GLvoid *srcBuffer, *dstBuffer;
GLint prevY = -1;