aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-03-09 21:32:55 +0100
committermarha <marha@users.sourceforge.net>2014-03-09 21:32:55 +0100
commit3dd4b6420f686b0147d5b8136268cc63196e253b (patch)
tree2c81c3f7503dbcfb5b64fd95b40bb1c2204598ef /mesalib/src/mesa/main
parent321c01267ae1c446f1bd22b642567fcafa016c02 (diff)
downloadvcxsrv-3dd4b6420f686b0147d5b8136268cc63196e253b.tar.gz
vcxsrv-3dd4b6420f686b0147d5b8136268cc63196e253b.tar.bz2
vcxsrv-3dd4b6420f686b0147d5b8136268cc63196e253b.zip
fontconfig mesa xserver git update 9 Mar 2014
xserver commit 1c61d38528a573caadee2468ee59ea558c822e09 fontconfig commit f8ccf379eb1092592ae0b65deb563c5491f69de9 mesa commit 897f40f25d21af678b1b67c1a68c4a6722d19983
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r--mesalib/src/mesa/main/errors.c303
-rw-r--r--mesalib/src/mesa/main/errors.h15
-rw-r--r--mesalib/src/mesa/main/extensions.c1
-rw-r--r--mesalib/src/mesa/main/format_pack.c55
-rw-r--r--mesalib/src/mesa/main/format_unpack.c45
-rw-r--r--mesalib/src/mesa/main/formats.c36
-rw-r--r--mesalib/src/mesa/main/formats.h4
-rw-r--r--mesalib/src/mesa/main/hash_table.c1
-rw-r--r--mesalib/src/mesa/main/hash_table.h1
-rw-r--r--mesalib/src/mesa/main/mtypes.h3
-rw-r--r--mesalib/src/mesa/main/set.c1
-rw-r--r--mesalib/src/mesa/main/streaming-load-memcpy.c3
-rw-r--r--mesalib/src/mesa/main/teximage.c60
-rw-r--r--mesalib/src/mesa/main/texobj.c2
-rw-r--r--mesalib/src/mesa/main/texobj.h14
-rw-r--r--mesalib/src/mesa/main/texparam.c41
-rw-r--r--mesalib/src/mesa/main/texstore.c20
-rw-r--r--mesalib/src/mesa/main/varray.c4
18 files changed, 330 insertions, 279 deletions
diff --git a/mesalib/src/mesa/main/errors.c b/mesalib/src/mesa/main/errors.c
index ca73a6686..8ec6a8c33 100644
--- a/mesalib/src/mesa/main/errors.c
+++ b/mesalib/src/mesa/main/errors.c
@@ -38,9 +38,6 @@
#include "version.h"
#include "hash_table.h"
-#define MESSAGE_LOG 1
-#define MESSAGE_LOG_ARB 2
-
static mtx_t DynamicIDMutex = _MTX_INITIALIZER_NP;
static GLuint NextDynamicID = 1;
@@ -373,40 +370,6 @@ store_message_details(struct gl_debug_msg *emptySlot,
/**
- * Remap any type exclusive to KHR_debug to something suitable
- * for ARB_debug_output
- */
-inline static int
-remap_type(GLenum type) {
-
- switch(type) {
- case GL_DEBUG_TYPE_MARKER:
- case GL_DEBUG_TYPE_PUSH_GROUP:
- case GL_DEBUG_TYPE_POP_GROUP:
- type = GL_DEBUG_TYPE_OTHER;
- default:
- ;
- }
-
- return type;
-}
-
-
-/**
- * Remap severity exclusive to KHR_debug to something suitable
- * for ARB_debug_output
- */
-inline static int
-remap_severity(GLenum severity) {
-
- if (GL_DEBUG_SEVERITY_NOTIFICATION == severity)
- severity = GL_DEBUG_SEVERITY_LOW;
-
- return severity;
-}
-
-
-/**
* 'buf' is not necessarily a null-terminated string. When logging, copy
* 'len' characters from it, store them in a new, null-terminated string,
* and remember the number of bytes used by that string, *including*
@@ -433,10 +396,6 @@ log_msg(struct gl_context *ctx, enum mesa_debug_source source,
GLenum gl_type = debug_type_enums[type];
GLenum gl_severity = debug_severity_enums[severity];
- if (debug->ARBCallback) {
- gl_severity = remap_severity(gl_severity);
- gl_type = remap_type(gl_type);
- }
debug->Callback(debug_source_enums[source], gl_type, id, gl_severity,
len, buf, debug->CallbackData);
return;
@@ -470,8 +429,7 @@ log_msg(struct gl_context *ctx, enum mesa_debug_source source,
*/
static GLsizei
get_msg(struct gl_context *ctx, GLenum *source, GLenum *type,
- GLuint *id, GLenum *severity, GLsizei bufSize, char *buf,
- unsigned caller)
+ GLuint *id, GLenum *severity, GLsizei bufSize, char *buf)
{
struct gl_debug_state *debug = _mesa_get_debug_state(ctx);
struct gl_debug_msg *msg;
@@ -490,8 +448,6 @@ get_msg(struct gl_context *ctx, GLenum *source, GLenum *type,
if (severity) {
*severity = debug_severity_enums[msg->severity];
- if (caller == MESSAGE_LOG_ARB)
- *severity = remap_severity(*severity);
}
if (source) {
@@ -500,8 +456,6 @@ get_msg(struct gl_context *ctx, GLenum *source, GLenum *type,
if (type) {
*type = debug_type_enums[msg->type];
- if (caller == MESSAGE_LOG_ARB)
- *type = remap_type(*type);
}
if (id) {
@@ -529,12 +483,9 @@ get_msg(struct gl_context *ctx, GLenum *source, GLenum *type,
/**
* Verify that source, type, and severity are valid enums.
- * glDebugMessageInsertARB only accepts two values for 'source',
- * and glDebugMessageControlARB will additionally accept GL_DONT_CARE
- * in any parameter, so handle those cases specially.
*
- * There is also special cases for handling values available in
- * GL_KHR_debug that are not avaliable in GL_ARB_debug_output
+ * The 'caller' param is used for handling values available
+ * only in glDebugMessageInsert or glDebugMessageControl
*/
static GLboolean
validate_params(struct gl_context *ctx, unsigned caller,
@@ -543,8 +494,6 @@ validate_params(struct gl_context *ctx, unsigned caller,
{
#define INSERT 1
#define CONTROL 2
-#define INSERT_ARB 3
-#define CONTROL_ARB 4
switch(source) {
case GL_DEBUG_SOURCE_APPLICATION_ARB:
case GL_DEBUG_SOURCE_THIRD_PARTY_ARB:
@@ -553,11 +502,15 @@ validate_params(struct gl_context *ctx, unsigned caller,
case GL_DEBUG_SOURCE_SHADER_COMPILER_ARB:
case GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB:
case GL_DEBUG_SOURCE_OTHER_ARB:
- if (caller != INSERT || caller == INSERT_ARB)
+ if (caller != INSERT)
break;
+ else
+ goto error;
case GL_DONT_CARE:
- if (caller == CONTROL || caller == CONTROL_ARB)
+ if (caller == CONTROL)
break;
+ else
+ goto error;
default:
goto error;
}
@@ -569,14 +522,15 @@ validate_params(struct gl_context *ctx, unsigned caller,
case GL_DEBUG_TYPE_PERFORMANCE_ARB:
case GL_DEBUG_TYPE_PORTABILITY_ARB:
case GL_DEBUG_TYPE_OTHER_ARB:
- break;
case GL_DEBUG_TYPE_MARKER:
- /* this value is only valid for GL_KHR_debug functions */
- if (caller == CONTROL || caller == INSERT)
- break;
+ break;
+ case GL_DEBUG_TYPE_PUSH_GROUP:
+ case GL_DEBUG_TYPE_POP_GROUP:
case GL_DONT_CARE:
- if (caller == CONTROL || caller == CONTROL_ARB)
+ if (caller == CONTROL)
break;
+ else
+ goto error;
default:
goto error;
}
@@ -585,14 +539,13 @@ validate_params(struct gl_context *ctx, unsigned caller,
case GL_DEBUG_SEVERITY_HIGH_ARB:
case GL_DEBUG_SEVERITY_MEDIUM_ARB:
case GL_DEBUG_SEVERITY_LOW_ARB:
- break;
case GL_DEBUG_SEVERITY_NOTIFICATION:
- /* this value is only valid for GL_KHR_debug functions */
- if (caller == CONTROL || caller == INSERT)
- break;
+ break;
case GL_DONT_CARE:
- if (caller == CONTROL || caller == CONTROL_ARB)
+ if (caller == CONTROL)
break;
+ else
+ goto error;
default:
goto error;
}
@@ -706,44 +659,6 @@ control_app_messages(struct gl_context *ctx, GLenum esource, GLenum etype,
/**
- * This is a generic message control function for use by both
- * glDebugMessageControlARB and glDebugMessageControl.
- */
-static void
-message_control(GLenum gl_source, GLenum gl_type,
- GLenum gl_severity,
- GLsizei count, const GLuint *ids,
- GLboolean enabled,
- unsigned caller, const char *callerstr)
-{
- GET_CURRENT_CONTEXT(ctx);
-
- if (count < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "%s(count=%d : count must not be negative)", callerstr,
- count);
- return;
- }
-
- if (!validate_params(ctx, caller, callerstr, gl_source, gl_type,
- gl_severity))
- return; /* GL_INVALID_ENUM */
-
- if (count && (gl_severity != GL_DONT_CARE || gl_type == GL_DONT_CARE
- || gl_source == GL_DONT_CARE)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "%s(When passing an array of ids, severity must be"
- " GL_DONT_CARE, and source and type must not be GL_DONT_CARE.",
- callerstr);
- return;
- }
-
- control_app_messages(ctx, gl_source, gl_type, gl_severity,
- count, ids, enabled);
-}
-
-
-/**
* This is a generic message insert function.
* Validation of source, type and severity parameters should be done
* before calling this funtion.
@@ -773,58 +688,6 @@ message_insert(GLenum source, GLenum type, GLuint id,
}
-/**
- * This is a generic message insert function for use by both
- * glGetDebugMessageLogARB and glGetDebugMessageLog.
- */
-static GLuint
-get_message_log(GLuint count, GLsizei logSize, GLenum *sources,
- GLenum *types, GLenum *ids, GLenum *severities,
- GLsizei *lengths, GLchar *messageLog,
- unsigned caller, const char *callerstr)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLuint ret;
-
- if (!messageLog)
- logSize = 0;
-
- if (logSize < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "%s(logSize=%d : logSize must not be negative)", callerstr,
- logSize);
- return 0;
- }
-
- for (ret = 0; ret < count; ret++) {
- GLsizei written = get_msg(ctx, sources, types, ids, severities,
- logSize, messageLog, caller);
- if (!written)
- break;
-
- if (messageLog) {
- messageLog += written;
- logSize -= written;
- }
- if (lengths) {
- *lengths = written;
- lengths++;
- }
-
- if (severities)
- severities++;
- if (sources)
- sources++;
- if (types)
- types++;
- if (ids)
- ids++;
- }
-
- return ret;
-}
-
-
static void
do_nothing(GLuint key, void *data, void *userData)
{
@@ -887,22 +750,79 @@ _mesa_GetDebugMessageLog(GLuint count, GLsizei logSize, GLenum *sources,
GLenum *types, GLenum *ids, GLenum *severities,
GLsizei *lengths, GLchar *messageLog)
{
- const char *callerstr = "glGetDebugMessageLog";
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint ret;
+
+ if (!messageLog)
+ logSize = 0;
+
+ if (logSize < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glGetDebugMessageLog(logSize=%d : logSize must not be"
+ " negative)", logSize);
+ return 0;
+ }
+
+ for (ret = 0; ret < count; ret++) {
+ GLsizei written = get_msg(ctx, sources, types, ids, severities,
+ logSize, messageLog);
+ if (!written)
+ break;
+
+ if (messageLog) {
+ messageLog += written;
+ logSize -= written;
+ }
+ if (lengths) {
+ *lengths = written;
+ lengths++;
+ }
- return get_message_log(count, logSize, sources, types, ids, severities,
- lengths, messageLog, MESSAGE_LOG, callerstr);
+ if (severities)
+ severities++;
+ if (sources)
+ sources++;
+ if (types)
+ types++;
+ if (ids)
+ ids++;
+ }
+
+ return ret;
}
void GLAPIENTRY
-_mesa_DebugMessageControl(GLenum source, GLenum type, GLenum severity,
- GLsizei count, const GLuint *ids,
- GLboolean enabled)
+_mesa_DebugMessageControl(GLenum gl_source, GLenum gl_type,
+ GLenum gl_severity, GLsizei count,
+ const GLuint *ids, GLboolean enabled)
{
const char *callerstr = "glDebugMessageControl";
- message_control(source, type, severity, count, ids,
- enabled, CONTROL, callerstr);
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (count < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "%s(count=%d : count must not be negative)", callerstr,
+ count);
+ return;
+ }
+
+ if (!validate_params(ctx, CONTROL, callerstr, gl_source, gl_type,
+ gl_severity))
+ return; /* GL_INVALID_ENUM */
+
+ if (count && (gl_severity != GL_DONT_CARE || gl_type == GL_DONT_CARE
+ || gl_source == GL_DONT_CARE)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "%s(When passing an array of ids, severity must be"
+ " GL_DONT_CARE, and source and type must not be GL_DONT_CARE.",
+ callerstr);
+ return;
+ }
+
+ control_app_messages(ctx, gl_source, gl_type, gl_severity,
+ count, ids, enabled);
}
@@ -914,7 +834,6 @@ _mesa_DebugMessageCallback(GLDEBUGPROC callback, const void *userParam)
if (debug) {
debug->Callback = callback;
debug->CallbackData = userParam;
- debug->ARBCallback = GL_FALSE;
}
}
@@ -1041,60 +960,6 @@ _mesa_PopDebugGroup(void)
}
-void GLAPIENTRY
-_mesa_DebugMessageInsertARB(GLenum source, GLenum type, GLuint id,
- GLenum severity, GLint length,
- const GLcharARB *buf)
-{
- const char *callerstr = "glDebugMessageInsertARB";
-
- GET_CURRENT_CONTEXT(ctx);
-
- if (!validate_params(ctx, INSERT_ARB, callerstr, source, type, severity))
- return; /* GL_INVALID_ENUM */
-
- message_insert(source, type, id, severity, length, buf, callerstr);
-}
-
-
-GLuint GLAPIENTRY
-_mesa_GetDebugMessageLogARB(GLuint count, GLsizei logSize, GLenum *sources,
- GLenum *types, GLenum *ids, GLenum *severities,
- GLsizei *lengths, GLcharARB *messageLog)
-{
- const char *callerstr = "glGetDebugMessageLogARB";
-
- return get_message_log(count, logSize, sources, types, ids, severities,
- lengths, messageLog, MESSAGE_LOG_ARB, callerstr);
-}
-
-
-void GLAPIENTRY
-_mesa_DebugMessageControlARB(GLenum gl_source, GLenum gl_type,
- GLenum gl_severity,
- GLsizei count, const GLuint *ids,
- GLboolean enabled)
-{
- const char *callerstr = "glDebugMessageControlARB";
-
- message_control(gl_source, gl_type, gl_severity, count, ids,
- enabled, CONTROL_ARB, callerstr);
-}
-
-
-void GLAPIENTRY
-_mesa_DebugMessageCallbackARB(GLDEBUGPROCARB callback, const void *userParam)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct gl_debug_state *debug = _mesa_get_debug_state(ctx);
- if (debug) {
- debug->Callback = callback;
- debug->CallbackData = userParam;
- debug->ARBCallback = GL_TRUE;
- }
-}
-
-
void
_mesa_init_errors(struct gl_context *ctx)
{
diff --git a/mesalib/src/mesa/main/errors.h b/mesalib/src/mesa/main/errors.h
index cd414e6b6..e0706e5b9 100644
--- a/mesalib/src/mesa/main/errors.h
+++ b/mesalib/src/mesa/main/errors.h
@@ -91,21 +91,6 @@ _mesa_shader_debug(struct gl_context *ctx, GLenum type, GLuint *id,
const char *msg, int len);
void GLAPIENTRY
-_mesa_DebugMessageInsertARB(GLenum source, GLenum type, GLuint id,
- GLenum severity, GLint length,
- const GLcharARB* buf);
-GLuint GLAPIENTRY
-_mesa_GetDebugMessageLogARB(GLuint count, GLsizei logSize, GLenum* sources,
- GLenum* types, GLenum* ids, GLenum* severities,
- GLsizei* lengths, GLcharARB* messageLog);
-void GLAPIENTRY
-_mesa_DebugMessageControlARB(GLenum source, GLenum type, GLenum severity,
- GLsizei count, const GLuint *ids,
- GLboolean enabled);
-void GLAPIENTRY
-_mesa_DebugMessageCallbackARB(GLDEBUGPROCARB callback,
- const void *userParam);
-void GLAPIENTRY
_mesa_DebugMessageInsert(GLenum source, GLenum type, GLuint id,
GLenum severity, GLint length,
const GLchar* buf);
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index c46d70b20..a72284c9a 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -138,6 +138,7 @@ static const struct extension extension_table[] = {
{ "GL_ARB_shading_language_packing", o(ARB_shading_language_packing), GL, 2011 },
{ "GL_ARB_shading_language_420pack", o(ARB_shading_language_420pack), GL, 2011 },
{ "GL_ARB_shadow", o(ARB_shadow), GLL, 2001 },
+ { "GL_ARB_stencil_texturing", o(ARB_stencil_texturing), GL, 2012 },
{ "GL_ARB_sync", o(ARB_sync), GL, 2003 },
{ "GL_ARB_texture_border_clamp", o(ARB_texture_border_clamp), GLL, 2000 },
{ "GL_ARB_texture_buffer_object", o(ARB_texture_buffer_object), GLC, 2008 },
diff --git a/mesalib/src/mesa/main/format_pack.c b/mesalib/src/mesa/main/format_pack.c
index 2772ff2d3..acab6cb8d 100644
--- a/mesalib/src/mesa/main/format_pack.c
+++ b/mesalib/src/mesa/main/format_pack.c
@@ -567,7 +567,7 @@ static void
pack_ubyte_ARGB4444_REV(const GLubyte src[4], void *dst)
{
GLushort *d = ((GLushort *) dst);
- *d = PACK_COLOR_4444(src[GCOMP], src[BCOMP], src[ACOMP], src[RCOMP]);
+ *d = PACK_COLOR_4444(src[BCOMP], src[GCOMP], src[RCOMP], src[ACOMP]);
}
static void
@@ -1044,8 +1044,8 @@ pack_ubyte_SRGB8(const GLubyte src[4], void *dst)
{
GLubyte *d = ((GLubyte *) dst);
d[2] = linear_ubyte_to_srgb_ubyte(src[RCOMP]);
- d[1] = linear_ubyte_to_srgb_ubyte(src[RCOMP]);
- d[0] = linear_ubyte_to_srgb_ubyte(src[RCOMP]);
+ d[1] = linear_ubyte_to_srgb_ubyte(src[GCOMP]);
+ d[0] = linear_ubyte_to_srgb_ubyte(src[BCOMP]);
}
static void
@@ -1090,8 +1090,8 @@ pack_ubyte_SARGB8(const GLubyte src[4], void *dst)
{
GLuint *d = ((GLuint *) dst);
GLubyte r = linear_ubyte_to_srgb_ubyte(src[RCOMP]);
- GLubyte g = linear_ubyte_to_srgb_ubyte(src[RCOMP]);
- GLubyte b = linear_ubyte_to_srgb_ubyte(src[RCOMP]);
+ GLubyte g = linear_ubyte_to_srgb_ubyte(src[GCOMP]);
+ GLubyte b = linear_ubyte_to_srgb_ubyte(src[BCOMP]);
*d = PACK_COLOR_8888(src[ACOMP], r, g, b);
}
@@ -1108,6 +1108,31 @@ pack_float_SARGB8(const GLfloat src[4], void *dst)
}
+/* MESA_FORMAT_R8G8B8A8_SRGB */
+
+static void
+pack_ubyte_SABGR8(const GLubyte src[4], void *dst)
+{
+ GLuint *d = ((GLuint *) dst);
+ GLubyte r = linear_ubyte_to_srgb_ubyte(src[RCOMP]);
+ GLubyte g = linear_ubyte_to_srgb_ubyte(src[GCOMP]);
+ GLubyte b = linear_ubyte_to_srgb_ubyte(src[BCOMP]);
+ *d = PACK_COLOR_8888(src[ACOMP], b, g, r);
+}
+
+static void
+pack_float_SABGR8(const GLfloat src[4], void *dst)
+{
+ GLuint *d = ((GLuint *) dst);
+ GLubyte r, g, b, a;
+ r = linear_float_to_srgb_ubyte(src[RCOMP]);
+ g = linear_float_to_srgb_ubyte(src[GCOMP]);
+ b = linear_float_to_srgb_ubyte(src[BCOMP]);
+ UNCLAMPED_FLOAT_TO_UBYTE(a, src[ACOMP]);
+ *d = PACK_COLOR_8888(a, b, g, r);
+}
+
+
/* MESA_FORMAT_L_SRGB8 */
static void
@@ -1880,6 +1905,20 @@ pack_float_SIGNED_RG1616(const GLfloat src[4], void *dst)
*d = (r << 16) | (g & 0xffff);
}
+/*
+ * MESA_FORMAT_B8G8R8X8_SRGB
+ */
+
+static void
+pack_float_XRGB8888_SRGB(const GLfloat src[4], void *dst)
+{
+ GLuint *d = (GLuint *) dst;
+ GLubyte r = linear_float_to_srgb_ubyte(src[RCOMP]);
+ GLubyte g = linear_float_to_srgb_ubyte(src[GCOMP]);
+ GLubyte b = linear_float_to_srgb_ubyte(src[BCOMP]);
+ *d = PACK_COLOR_8888(127, r, g, b);
+}
+
/**
* Return a function that can pack a GLubyte rgba[4] color.
*/
@@ -1947,6 +1986,7 @@ _mesa_get_pack_ubyte_rgba_function(mesa_format format)
table[MESA_FORMAT_BGR_SRGB8] = pack_ubyte_SRGB8;
table[MESA_FORMAT_A8B8G8R8_SRGB] = pack_ubyte_SRGBA8;
table[MESA_FORMAT_B8G8R8A8_SRGB] = pack_ubyte_SARGB8;
+ table[MESA_FORMAT_R8G8B8A8_SRGB] = pack_ubyte_SABGR8;
table[MESA_FORMAT_L_SRGB8] = pack_ubyte_SL8;
table[MESA_FORMAT_L8A8_SRGB] = pack_ubyte_SLA8;
/* n/a */
@@ -2034,6 +2074,8 @@ _mesa_get_pack_ubyte_rgba_function(mesa_format format)
table[MESA_FORMAT_R10G10B10A2_UNORM] = pack_ubyte_ABGR2101010;
+ table[MESA_FORMAT_B8G8R8X8_SRGB] = NULL;
+
initialized = GL_TRUE;
}
@@ -2109,6 +2151,7 @@ _mesa_get_pack_float_rgba_function(mesa_format format)
table[MESA_FORMAT_BGR_SRGB8] = pack_float_SRGB8;
table[MESA_FORMAT_A8B8G8R8_SRGB] = pack_float_SRGBA8;
table[MESA_FORMAT_B8G8R8A8_SRGB] = pack_float_SARGB8;
+ table[MESA_FORMAT_R8G8B8A8_SRGB] = pack_float_SABGR8;
table[MESA_FORMAT_L_SRGB8] = pack_float_SL8;
table[MESA_FORMAT_L8A8_SRGB] = pack_float_SLA8;
@@ -2197,6 +2240,8 @@ _mesa_get_pack_float_rgba_function(mesa_format format)
table[MESA_FORMAT_G8R8_SNORM] = pack_float_SIGNED_RG88;
table[MESA_FORMAT_G16R16_SNORM] = pack_float_SIGNED_RG1616;
+ table[MESA_FORMAT_B8G8R8X8_SRGB] = pack_float_XRGB8888_SRGB;
+
initialized = GL_TRUE;
}
diff --git a/mesalib/src/mesa/main/format_unpack.c b/mesalib/src/mesa/main/format_unpack.c
index 276ba556a..2348ef605 100644
--- a/mesalib/src/mesa/main/format_unpack.c
+++ b/mesalib/src/mesa/main/format_unpack.c
@@ -267,10 +267,10 @@ unpack_ARGB4444_REV(const void *src, GLfloat dst[][4], GLuint n)
const GLushort *s = ((const GLushort *) src);
GLuint i;
for (i = 0; i < n; i++) {
- dst[i][RCOMP] = ((s[i] ) & 0xf) * (1.0F / 15.0F);
- dst[i][GCOMP] = ((s[i] >> 12) & 0xf) * (1.0F / 15.0F);
- dst[i][BCOMP] = ((s[i] >> 8) & 0xf) * (1.0F / 15.0F);
- dst[i][ACOMP] = ((s[i] >> 4) & 0xf) * (1.0F / 15.0F);
+ dst[i][RCOMP] = ((s[i] >> 4) & 0xf) * (1.0F / 15.0F);
+ dst[i][GCOMP] = ((s[i] >> 8) & 0xf) * (1.0F / 15.0F);
+ dst[i][BCOMP] = ((s[i] >> 12) & 0xf) * (1.0F / 15.0F);
+ dst[i][ACOMP] = ((s[i] ) & 0xf) * (1.0F / 15.0F);
}
}
@@ -797,6 +797,19 @@ unpack_SARGB8(const void *src, GLfloat dst[][4], GLuint n)
}
static void
+unpack_SABGR8(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = _mesa_nonlinear_to_linear( (s[i] ) & 0xff );
+ dst[i][GCOMP] = _mesa_nonlinear_to_linear( (s[i] >> 8) & 0xff );
+ dst[i][BCOMP] = _mesa_nonlinear_to_linear( (s[i] >> 16) & 0xff );
+ dst[i][ACOMP] = UBYTE_TO_FLOAT( s[i] >> 24 ); /* linear! */
+ }
+}
+
+static void
unpack_SL8(const void *src, GLfloat dst[][4], GLuint n)
{
const GLubyte *s = ((const GLubyte *) src);
@@ -2313,6 +2326,19 @@ unpack_SIGNED_RG1616(const void *src, GLfloat dst[][4], GLuint n)
}
}
+static void
+unpack_XRGB8888_SRGB(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = _mesa_nonlinear_to_linear( (s[i] >> 16) & 0xff );
+ dst[i][GCOMP] = _mesa_nonlinear_to_linear( (s[i] >> 8) & 0xff );
+ dst[i][BCOMP] = _mesa_nonlinear_to_linear( (s[i] ) & 0xff );
+ dst[i][ACOMP] = 1.0F;
+ }
+}
+
/**
* Return the unpacker function for the given format.
*/
@@ -2375,6 +2401,7 @@ get_unpack_rgba_function(mesa_format format)
table[MESA_FORMAT_BGR_SRGB8] = unpack_SRGB8;
table[MESA_FORMAT_A8B8G8R8_SRGB] = unpack_SRGBA8;
table[MESA_FORMAT_B8G8R8A8_SRGB] = unpack_SARGB8;
+ table[MESA_FORMAT_R8G8B8A8_SRGB] = unpack_SABGR8;
table[MESA_FORMAT_L_SRGB8] = unpack_SL8;
table[MESA_FORMAT_L8A8_SRGB] = unpack_SLA8;
table[MESA_FORMAT_SRGB_DXT1] = unpack_SRGB_DXT1;
@@ -2530,6 +2557,8 @@ get_unpack_rgba_function(mesa_format format)
table[MESA_FORMAT_G8R8_SNORM] = unpack_SIGNED_RG88;
table[MESA_FORMAT_G16R16_SNORM] = unpack_SIGNED_RG1616;
+ table[MESA_FORMAT_B8G8R8X8_SRGB] = unpack_XRGB8888_SRGB;
+
initialized = GL_TRUE;
}
@@ -2738,10 +2767,10 @@ unpack_ubyte_ARGB4444_REV(const void *src, GLubyte dst[][4], GLuint n)
const GLushort *s = ((const GLushort *) src);
GLuint i;
for (i = 0; i < n; i++) {
- dst[i][RCOMP] = EXPAND_4_8((s[i] ) & 0xf);
- dst[i][GCOMP] = EXPAND_4_8((s[i] >> 12) & 0xf);
- dst[i][BCOMP] = EXPAND_4_8((s[i] >> 8) & 0xf);
- dst[i][ACOMP] = EXPAND_4_8((s[i] >> 4) & 0xf);
+ dst[i][RCOMP] = EXPAND_4_8((s[i] >> 4) & 0xf);
+ dst[i][GCOMP] = EXPAND_4_8((s[i] >> 8) & 0xf);
+ dst[i][BCOMP] = EXPAND_4_8((s[i] >> 12) & 0xf);
+ dst[i][ACOMP] = EXPAND_4_8((s[i] ) & 0xf);
}
}
diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c
index f6c399ede..0cf97fa31 100644
--- a/mesalib/src/mesa/main/formats.c
+++ b/mesalib/src/mesa/main/formats.c
@@ -520,6 +520,15 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
1, 1, 4
},
{
+ MESA_FORMAT_R8G8B8A8_SRGB,
+ "MESA_FORMAT_R8G8B8A8_SRGB",
+ GL_RGBA,
+ GL_UNSIGNED_NORMALIZED,
+ 8, 8, 8, 8,
+ 0, 0, 0, 0, 0,
+ 1, 1, 4
+ },
+ {
MESA_FORMAT_L_SRGB8,
"MESA_FORMAT_L_SRGB8",
GL_LUMINANCE,
@@ -1790,6 +1799,15 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
0, 0, 0, 0, 0,
1, 1, 4
},
+ {
+ MESA_FORMAT_B8G8R8X8_SRGB,
+ "MESA_FORMAT_B8G8R8X8_SRGB",
+ GL_RGB,
+ GL_UNSIGNED_NORMALIZED,
+ 8, 8, 8, 0,
+ 0, 0, 0, 0, 0,
+ 1, 1, 4
+ },
};
@@ -2025,6 +2043,7 @@ _mesa_get_format_color_encoding(mesa_format format)
case MESA_FORMAT_BGR_SRGB8:
case MESA_FORMAT_A8B8G8R8_SRGB:
case MESA_FORMAT_B8G8R8A8_SRGB:
+ case MESA_FORMAT_R8G8B8A8_SRGB:
case MESA_FORMAT_L_SRGB8:
case MESA_FORMAT_L8A8_SRGB:
case MESA_FORMAT_SRGB_DXT1:
@@ -2035,6 +2054,7 @@ _mesa_get_format_color_encoding(mesa_format format)
case MESA_FORMAT_ETC2_SRGB8:
case MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC:
case MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1:
+ case MESA_FORMAT_B8G8R8X8_SRGB:
return GL_SRGB;
default:
return GL_LINEAR;
@@ -2059,6 +2079,9 @@ _mesa_get_srgb_format_linear(mesa_format format)
case MESA_FORMAT_B8G8R8A8_SRGB:
format = MESA_FORMAT_B8G8R8A8_UNORM;
break;
+ case MESA_FORMAT_R8G8B8A8_SRGB:
+ format = MESA_FORMAT_R8G8B8A8_UNORM;
+ break;
case MESA_FORMAT_L_SRGB8:
format = MESA_FORMAT_L_UNORM8;
break;
@@ -2089,6 +2112,9 @@ _mesa_get_srgb_format_linear(mesa_format format)
case MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1:
format = MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1;
break;
+ case MESA_FORMAT_B8G8R8X8_SRGB:
+ format = MESA_FORMAT_B8G8R8X8_UNORM;
+ break;
default:
break;
}
@@ -2563,6 +2589,7 @@ _mesa_format_to_type_and_comps(mesa_format format,
return;
case MESA_FORMAT_A8B8G8R8_SRGB:
case MESA_FORMAT_B8G8R8A8_SRGB:
+ case MESA_FORMAT_R8G8B8A8_SRGB:
*datatype = GL_UNSIGNED_BYTE;
*comps = 4;
return;
@@ -2895,6 +2922,11 @@ _mesa_format_to_type_and_comps(mesa_format format,
*comps = 2;
return;
+ case MESA_FORMAT_B8G8R8X8_SRGB:
+ *datatype = GL_UNSIGNED_BYTE;
+ *comps = 4;
+ return;
+
case MESA_FORMAT_COUNT:
assert(0);
return;
@@ -2967,6 +2999,7 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format,
return GL_FALSE;
case MESA_FORMAT_R8G8B8A8_UNORM:
+ case MESA_FORMAT_R8G8B8A8_SRGB:
if (format == GL_RGBA && type == GL_UNSIGNED_INT_8_8_8_8_REV &&
!swapBytes)
return GL_TRUE;
@@ -3448,6 +3481,9 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format,
case MESA_FORMAT_G16R16_SNORM:
return format == GL_RG && type == GL_SHORT && !littleEndian &&
!swapBytes;
+
+ case MESA_FORMAT_B8G8R8X8_SRGB:
+ return GL_FALSE;
}
return GL_FALSE;
diff --git a/mesalib/src/mesa/main/formats.h b/mesalib/src/mesa/main/formats.h
index 3102584b6..a12fe4f08 100644
--- a/mesalib/src/mesa/main/formats.h
+++ b/mesalib/src/mesa/main/formats.h
@@ -333,6 +333,7 @@ typedef enum
* R10G10B10A2_UNORM
* G8R8_SINT
* G16R16_SINT
+ * B8G8R8X8_SRGB
*
*/
/*@{*/
@@ -418,6 +419,7 @@ typedef enum
/* Type P formats */
MESA_FORMAT_A8B8G8R8_SRGB, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
MESA_FORMAT_B8G8R8A8_SRGB, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
+ MESA_FORMAT_R8G8B8A8_SRGB, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */
/* Type A format(s) */
MESA_FORMAT_L_SRGB8, /* uchar[i] = L */
@@ -647,6 +649,8 @@ typedef enum
MESA_FORMAT_G8R8_SNORM, /* RRRR RRRR GGGG GGGG */
MESA_FORMAT_G16R16_SNORM, /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */
+ MESA_FORMAT_B8G8R8X8_SRGB, /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */
+
MESA_FORMAT_COUNT
} mesa_format;
diff --git a/mesalib/src/mesa/main/hash_table.c b/mesalib/src/mesa/main/hash_table.c
index 008b4cdbc..ad8f89852 100644
--- a/mesalib/src/mesa/main/hash_table.c
+++ b/mesalib/src/mesa/main/hash_table.c
@@ -119,7 +119,6 @@ _mesa_hash_table_create(void *mem_ctx,
if (ht == NULL)
return NULL;
- ht->mem_ctx = mem_ctx;
ht->size_index = 0;
ht->size = hash_sizes[ht->size_index].size;
ht->rehash = hash_sizes[ht->size_index].rehash;
diff --git a/mesalib/src/mesa/main/hash_table.h b/mesalib/src/mesa/main/hash_table.h
index ad1dae478..f51131aee 100644
--- a/mesalib/src/mesa/main/hash_table.h
+++ b/mesalib/src/mesa/main/hash_table.h
@@ -44,7 +44,6 @@ struct hash_entry {
};
struct hash_table {
- void *mem_ctx;
struct hash_entry *table;
bool (*key_equals_function)(const void *a, const void *b);
const void *deleted_key;
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index bbc377280..e5f10baab 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -1199,6 +1199,7 @@ struct gl_texture_object
struct gl_sampler_object Sampler;
GLenum DepthMode; /**< GL_ARB_depth_texture */
+ bool StencilSampling; /**< Should we sample stencil instead of depth? */
GLfloat Priority; /**< in [0,1] */
GLint BaseLevel; /**< min mipmap level, OpenGL 1.2 */
@@ -3526,6 +3527,7 @@ struct gl_extensions
GLboolean ARB_shading_language_packing;
GLboolean ARB_shading_language_420pack;
GLboolean ARB_shadow;
+ GLboolean ARB_stencil_texturing;
GLboolean ARB_sync;
GLboolean ARB_texture_border_clamp;
GLboolean ARB_texture_buffer_object;
@@ -3843,7 +3845,6 @@ struct gl_debug_state
const void *CallbackData;
GLboolean SyncOutput;
GLboolean DebugOutput;
- GLboolean ARBCallback; /* Used to track if current callback is of type ARB_debug_output or KHR_debug */
GLboolean Defaults[MAX_DEBUG_GROUP_STACK_DEPTH][MESA_DEBUG_SEVERITY_COUNT][MESA_DEBUG_SOURCE_COUNT][MESA_DEBUG_TYPE_COUNT];
struct gl_debug_namespace Namespaces[MAX_DEBUG_GROUP_STACK_DEPTH][MESA_DEBUG_SOURCE_COUNT][MESA_DEBUG_TYPE_COUNT];
struct gl_debug_msg Log[MAX_DEBUG_LOGGED_MESSAGES];
diff --git a/mesalib/src/mesa/main/set.c b/mesalib/src/mesa/main/set.c
index dc3550c76..989e5dece 100644
--- a/mesalib/src/mesa/main/set.c
+++ b/mesalib/src/mesa/main/set.c
@@ -112,7 +112,6 @@ _mesa_set_create(void *mem_ctx,
if (ht == NULL)
return NULL;
- ht->mem_ctx = mem_ctx;
ht->size_index = 0;
ht->size = hash_sizes[ht->size_index].size;
ht->rehash = hash_sizes[ht->size_index].rehash;
diff --git a/mesalib/src/mesa/main/streaming-load-memcpy.c b/mesalib/src/mesa/main/streaming-load-memcpy.c
index d7147afdc..8427149c5 100644
--- a/mesalib/src/mesa/main/streaming-load-memcpy.c
+++ b/mesalib/src/mesa/main/streaming-load-memcpy.c
@@ -26,6 +26,7 @@
*
*/
+#ifdef __SSE4_1__
#include "main/macros.h"
#include "main/streaming-load-memcpy.h"
#include <smmintrin.h>
@@ -83,3 +84,5 @@ _mesa_streaming_load_memcpy(void *restrict dst, void *restrict src, size_t len)
memcpy(d, s, len);
}
}
+
+#endif
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index 0519d221f..a6c3581bf 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -1290,16 +1290,19 @@ clear_teximage_fields(struct gl_texture_image *img)
* \param border image border.
* \param internalFormat internal format.
* \param format the actual hardware format (one of MESA_FORMAT_*)
+ * \param numSamples number of samples per texel, or zero for non-MS.
+ * \param fixedSampleLocations are sample locations fixed?
*
* Fills in the fields of \p img with the given information.
* Note: width, height and depth include the border.
*/
-void
-_mesa_init_teximage_fields(struct gl_context *ctx,
- struct gl_texture_image *img,
- GLsizei width, GLsizei height, GLsizei depth,
- GLint border, GLenum internalFormat,
- mesa_format format)
+static void
+init_teximage_fields_ms(struct gl_context *ctx,
+ struct gl_texture_image *img,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLint border, GLenum internalFormat,
+ mesa_format format,
+ GLuint numSamples, GLboolean fixedSampleLocations)
{
GLenum target;
ASSERT(img);
@@ -1397,6 +1400,20 @@ _mesa_init_teximage_fields(struct gl_context *ctx,
_mesa_get_tex_max_num_levels(target,
img->Width2, img->Height2, img->Depth2);
img->TexFormat = format;
+ img->NumSamples = numSamples;
+ img->FixedSampleLocations = fixedSampleLocations;
+}
+
+
+void
+_mesa_init_teximage_fields(struct gl_context *ctx,
+ struct gl_texture_image *img,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLint border, GLenum internalFormat,
+ mesa_format format)
+{
+ init_teximage_fields_ms(ctx, img, width, height, depth, border,
+ internalFormat, format, 0, GL_TRUE);
}
@@ -2039,6 +2056,8 @@ texture_error_check( struct gl_context *ctx,
GLint depth, GLint border )
{
GLboolean colorFormat;
+ GLboolean is_format_depth_or_depthstencil;
+ GLboolean is_internalFormat_depth_or_depthstencil;
GLenum err;
/* Even though there are no color-index textures, we still have to support
@@ -2129,11 +2148,18 @@ texture_error_check( struct gl_context *ctx,
}
/* make sure internal format and format basically agree */
+ is_internalFormat_depth_or_depthstencil =
+ _mesa_is_depth_format(internalFormat) ||
+ _mesa_is_depthstencil_format(internalFormat);
+
+ is_format_depth_or_depthstencil =
+ _mesa_is_depth_format(format) ||
+ _mesa_is_depthstencil_format(format);
+
colorFormat = _mesa_is_color_format(format);
if ((_mesa_is_color_format(internalFormat) && !colorFormat && !indexFormat) ||
- (_mesa_is_depth_format(internalFormat) != _mesa_is_depth_format(format)) ||
+ (is_internalFormat_depth_or_depthstencil != is_format_depth_or_depthstencil) ||
(_mesa_is_ycbcr_format(internalFormat) != _mesa_is_ycbcr_format(format)) ||
- (_mesa_is_depthstencil_format(internalFormat) != _mesa_is_depthstencil_format(format)) ||
(_mesa_is_dudv_format(internalFormat) != _mesa_is_dudv_format(format))) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glTexImage%dD(incompatible internalFormat = %s, format = %s)",
@@ -4420,15 +4446,13 @@ teximagemultisample(GLuint dims, GLenum target, GLsizei samples,
if (_mesa_is_proxy_texture(target)) {
if (dimensionsOK && sizeOK) {
- _mesa_init_teximage_fields(ctx, texImage,
- width, height, depth, 0, internalformat, texFormat);
- texImage->NumSamples = samples;
- texImage->FixedSampleLocations = fixedsamplelocations;
+ init_teximage_fields_ms(ctx, texImage, width, height, depth, 0,
+ internalformat, texFormat,
+ samples, fixedsamplelocations);
}
else {
/* clear all image fields */
- _mesa_init_teximage_fields(ctx, texImage,
- 0, 0, 0, 0, GL_NONE, MESA_FORMAT_NONE);
+ clear_teximage_fields(texImage);
}
}
else {
@@ -4452,11 +4476,9 @@ teximagemultisample(GLuint dims, GLenum target, GLsizei samples,
ctx->Driver.FreeTextureImageBuffer(ctx, texImage);
- _mesa_init_teximage_fields(ctx, texImage,
- width, height, depth, 0, internalformat, texFormat);
-
- texImage->NumSamples = samples;
- texImage->FixedSampleLocations = fixedsamplelocations;
+ init_teximage_fields_ms(ctx, texImage, width, height, depth, 0,
+ internalformat, texFormat,
+ samples, fixedsamplelocations);
if (width > 0 && height > 0 && depth > 0) {
if (!ctx->Driver.AllocTextureStorage(ctx, texObj, 1,
diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c
index 3375fe36b..8bdbb08c8 100644
--- a/mesalib/src/mesa/main/texobj.c
+++ b/mesalib/src/mesa/main/texobj.c
@@ -148,6 +148,7 @@ _mesa_initialize_texture_object( struct gl_context *ctx,
obj->Sampler.CompareMode = GL_NONE; /* ARB_shadow */
obj->Sampler.CompareFunc = GL_LEQUAL; /* ARB_shadow */
obj->DepthMode = ctx->API == API_OPENGL_CORE ? GL_RED : GL_LUMINANCE;
+ obj->StencilSampling = false;
obj->Sampler.CubeMapSeamless = GL_FALSE;
obj->Swizzle[0] = GL_RED;
obj->Swizzle[1] = GL_GREEN;
@@ -280,6 +281,7 @@ _mesa_copy_texture_object( struct gl_texture_object *dest,
dest->Sampler.CompareFunc = src->Sampler.CompareFunc;
dest->Sampler.CubeMapSeamless = src->Sampler.CubeMapSeamless;
dest->DepthMode = src->DepthMode;
+ dest->StencilSampling = src->StencilSampling;
dest->Sampler.sRGBDecode = src->Sampler.sRGBDecode;
dest->_MaxLevel = src->_MaxLevel;
dest->_MaxLambda = src->_MaxLambda;
diff --git a/mesalib/src/mesa/main/texobj.h b/mesalib/src/mesa/main/texobj.h
index a4573b399..a9de73fff 100644
--- a/mesalib/src/mesa/main/texobj.h
+++ b/mesalib/src/mesa/main/texobj.h
@@ -114,6 +114,20 @@ _mesa_is_texture_complete(const struct gl_texture_object *texObj,
return GL_FALSE;
}
+ /* From the ARB_stencil_texturing specification:
+ * "Add a new bullet point for the conditions that cause the texture
+ * to not be complete:
+ *
+ * * The internal format of the texture is DEPTH_STENCIL, the
+ * DEPTH_STENCIL_TEXTURE_MODE for the texture is STENCIL_INDEX and either
+ * the magnification filter or the minification filter is not NEAREST."
+ */
+ if (texObj->StencilSampling &&
+ texObj->Image[0][texObj->BaseLevel]->_BaseFormat == GL_DEPTH_STENCIL &&
+ (sampler->MagFilter != GL_NEAREST || sampler->MinFilter != GL_NEAREST)) {
+ return GL_FALSE;
+ }
+
if (_mesa_is_mipmap_filter(sampler))
return texObj->_MipmapComplete;
else
diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c
index bbdbc2763..bfb2e1b9f 100644
--- a/mesalib/src/mesa/main/texparam.c
+++ b/mesalib/src/mesa/main/texparam.c
@@ -451,6 +451,20 @@ set_tex_parameteri(struct gl_context *ctx,
}
goto invalid_pname;
+ case GL_DEPTH_STENCIL_TEXTURE_MODE:
+ if (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_stencil_texturing) {
+ bool stencil = params[0] == GL_STENCIL_INDEX;
+ if (!stencil && params[0] != GL_DEPTH_COMPONENT)
+ goto invalid_param;
+
+ if (texObj->StencilSampling == stencil)
+ return GL_FALSE;
+
+ texObj->StencilSampling = stencil;
+ return GL_TRUE;
+ }
+ goto invalid_pname;
+
case GL_TEXTURE_CROP_RECT_OES:
if (ctx->API != API_OPENGLES || !ctx->Extensions.OES_draw_texture)
goto invalid_pname;
@@ -707,6 +721,7 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param)
case GL_TEXTURE_COMPARE_MODE_ARB:
case GL_TEXTURE_COMPARE_FUNC_ARB:
case GL_DEPTH_TEXTURE_MODE_ARB:
+ case GL_DEPTH_STENCIL_TEXTURE_MODE:
case GL_TEXTURE_SRGB_DECODE_EXT:
case GL_TEXTURE_CUBE_MAP_SEAMLESS:
case GL_TEXTURE_SWIZZLE_R_EXT:
@@ -762,6 +777,7 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
case GL_TEXTURE_COMPARE_MODE_ARB:
case GL_TEXTURE_COMPARE_FUNC_ARB:
case GL_DEPTH_TEXTURE_MODE_ARB:
+ case GL_DEPTH_STENCIL_TEXTURE_MODE:
case GL_TEXTURE_SRGB_DECODE_EXT:
case GL_TEXTURE_CUBE_MAP_SEAMLESS:
{
@@ -1038,9 +1054,16 @@ get_tex_level_parameter_image(struct gl_context *ctx,
img = _mesa_select_tex_image(ctx, texObj, target, level);
if (!img || img->TexFormat == MESA_FORMAT_NONE) {
- /* undefined texture image */
- if (pname == GL_TEXTURE_COMPONENTS)
- *params = 1;
+ /* In case of undefined texture image return the default values.
+ *
+ * From OpenGL 4.0 spec, page 398:
+ * "The initial internal format of a texel array is RGBA
+ * instead of 1. TEXTURE_COMPONENTS is deprecated; always
+ * use TEXTURE_INTERNAL_FORMAT."
+ */
+
+ if (pname == GL_TEXTURE_INTERNAL_FORMAT)
+ *params = GL_RGBA;
else
*params = 0;
return;
@@ -1452,6 +1475,12 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
goto invalid_pname;
*params = (GLfloat) obj->DepthMode;
break;
+ case GL_DEPTH_STENCIL_TEXTURE_MODE:
+ if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_stencil_texturing)
+ goto invalid_pname;
+ *params = (GLfloat)
+ (obj->StencilSampling ? GL_STENCIL_INDEX : GL_DEPTH_COMPONENT);
+ break;
case GL_TEXTURE_LOD_BIAS:
if (_mesa_is_gles(ctx))
goto invalid_pname;
@@ -1666,6 +1695,12 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
goto invalid_pname;
*params = (GLint) obj->DepthMode;
break;
+ case GL_DEPTH_STENCIL_TEXTURE_MODE:
+ if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_stencil_texturing)
+ goto invalid_pname;
+ *params = (GLint)
+ (obj->StencilSampling ? GL_STENCIL_INDEX : GL_DEPTH_COMPONENT);
+ break;
case GL_TEXTURE_LOD_BIAS:
if (_mesa_is_gles(ctx))
goto invalid_pname;
diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c
index 3e22a0b46..557703d01 100644
--- a/mesalib/src/mesa/main/texstore.c
+++ b/mesalib/src/mesa/main/texstore.c
@@ -3290,10 +3290,20 @@ _mesa_texstore_sargb8(TEXSTORE_PARAMS)
mesa_format newDstFormat;
GLboolean k;
- ASSERT(dstFormat == MESA_FORMAT_B8G8R8A8_SRGB);
-
- /* reuse normal rgba texstore code */
- newDstFormat = MESA_FORMAT_B8G8R8A8_UNORM;
+ switch (dstFormat) {
+ case MESA_FORMAT_B8G8R8A8_SRGB:
+ newDstFormat = MESA_FORMAT_B8G8R8A8_UNORM;
+ break;
+ case MESA_FORMAT_R8G8B8A8_SRGB:
+ newDstFormat = MESA_FORMAT_R8G8B8A8_UNORM;
+ break;
+ case MESA_FORMAT_B8G8R8X8_SRGB:
+ newDstFormat = MESA_FORMAT_B8G8R8X8_UNORM;
+ break;
+ default:
+ ASSERT(0);
+ return GL_FALSE;
+ }
k = _mesa_texstore_argb8888(ctx, dims, baseInternalFormat,
newDstFormat,
@@ -3859,6 +3869,8 @@ _mesa_get_texstore_func(mesa_format format)
table[MESA_FORMAT_G8R8_SNORM] = _mesa_texstore_snorm88;
table[MESA_FORMAT_G16R16_SNORM] = _mesa_texstore_snorm1616;
+ table[MESA_FORMAT_B8G8R8X8_SRGB] = _mesa_texstore_sargb8;
+
initialized = GL_TRUE;
}
diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c
index 44db2cbcd..b4b6fa9be 100644
--- a/mesalib/src/mesa/main/varray.c
+++ b/mesalib/src/mesa/main/varray.c
@@ -569,8 +569,8 @@ void GLAPIENTRY
_mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *ptr)
{
const GLbitfield legalTypes = UNSIGNED_BYTE_BIT;
- /* see table 2.4 edits in GL_EXT_gpu_shader4 spec: */
- const GLboolean integer = GL_TRUE;
+ /* this is the same type that glEdgeFlag uses */
+ const GLboolean integer = GL_FALSE;
GET_CURRENT_CONTEXT(ctx);
FLUSH_VERTICES(ctx, 0);