aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-02-01 08:36:02 +0100
committermarha <marha@users.sourceforge.net>2012-02-01 08:36:02 +0100
commit68320ff05946f092b6836754c6267b1dff2f4633 (patch)
tree424d73f509dff521d4cc22a95369594b7ee56dad /mesalib/src/mesa
parent71b5bea4d5ef75f50bd7bd7b93f47f8552c178e0 (diff)
parent58ff764d4111bfaa7360c57bc62dd620fbdce06f (diff)
downloadvcxsrv-68320ff05946f092b6836754c6267b1dff2f4633.tar.gz
vcxsrv-68320ff05946f092b6836754c6267b1dff2f4633.tar.bz2
vcxsrv-68320ff05946f092b6836754c6267b1dff2f4633.zip
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'mesalib/src/mesa')
-rw-r--r--mesalib/src/mesa/drivers/dri/common/Makefile.am2
-rw-r--r--mesalib/src/mesa/drivers/dri/common/drirc7
-rw-r--r--mesalib/src/mesa/drivers/dri/common/xmlpool/options.h10
-rw-r--r--mesalib/src/mesa/main/format_pack.c42
-rw-r--r--mesalib/src/mesa/main/format_pack.h4
-rw-r--r--mesalib/src/mesa/main/format_unpack.c58
-rw-r--r--mesalib/src/mesa/main/mtypes.h6
-rw-r--r--mesalib/src/mesa/main/texstore.c399
-rw-r--r--mesalib/src/mesa/program/prog_statevars.c27
-rw-r--r--mesalib/src/mesa/program/prog_statevars.h1
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_rasterizer.c24
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp49
-rw-r--r--mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c49
13 files changed, 204 insertions, 474 deletions
diff --git a/mesalib/src/mesa/drivers/dri/common/Makefile.am b/mesalib/src/mesa/drivers/dri/common/Makefile.am
index 4b43f4409..27c3e3d42 100644
--- a/mesalib/src/mesa/drivers/dri/common/Makefile.am
+++ b/mesalib/src/mesa/drivers/dri/common/Makefile.am
@@ -35,3 +35,5 @@ libdricommon_la_SOURCES = \
utils.c \
dri_util.c \
xmlconfig.c
+
+sysconf_DATA = drirc
diff --git a/mesalib/src/mesa/drivers/dri/common/drirc b/mesalib/src/mesa/drivers/dri/common/drirc
new file mode 100644
index 000000000..7abc64648
--- /dev/null
+++ b/mesalib/src/mesa/drivers/dri/common/drirc
@@ -0,0 +1,7 @@
+<driconf>
+ <device screen="0" driver="i965">
+ <application name="Sanctuary">
+ <option name="force_glsl_extensions_warn" value="true" />
+ </application>
+ </device>
+</driconf>
diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/options.h b/mesalib/src/mesa/drivers/dri/common/xmlpool/options.h
index 1e584ba08..75c887e5d 100644
--- a/mesalib/src/mesa/drivers/dri/common/xmlpool/options.h
+++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/options.h
@@ -626,3 +626,13 @@ DRI_CONF_OPT_BEGIN(always_flush_cache,bool,def) \
DRI_CONF_DESC(fr,"Enable flushing GPU caches with each draw call") \
DRI_CONF_DESC(sv,"Enable flushing GPU caches with each draw call") \
DRI_CONF_OPT_END
+
+#define DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN(def) \
+DRI_CONF_OPT_BEGIN(force_glsl_extensions_warn,bool,def) \
+ DRI_CONF_DESC(en,"Force GLSL extension default behavior to 'warn'") \
+ DRI_CONF_DESC(de,"Force GLSL extension default behavior to 'warn'") \
+ DRI_CONF_DESC(es,"Force GLSL extension default behavior to 'warn'") \
+ DRI_CONF_DESC(nl,"Force GLSL extension default behavior to 'warn'") \
+ DRI_CONF_DESC(fr,"Force GLSL extension default behavior to 'warn'") \
+ DRI_CONF_DESC(sv,"Force GLSL extension default behavior to 'warn'") \
+DRI_CONF_OPT_END
diff --git a/mesalib/src/mesa/main/format_pack.c b/mesalib/src/mesa/main/format_pack.c
index 85b2c691c..ea1d95ee9 100644
--- a/mesalib/src/mesa/main/format_pack.c
+++ b/mesalib/src/mesa/main/format_pack.c
@@ -2050,6 +2050,48 @@ _mesa_pack_ubyte_rgba_row(gl_format format, GLuint n,
/**
+ * Pack a 2D image of ubyte RGBA pixels in the given format.
+ * \param srcRowStride source image row stride in bytes
+ * \param dstRowStride destination image row stride in bytes
+ */
+void
+_mesa_pack_ubyte_rgba_rect(gl_format format, GLuint width, GLuint height,
+ const GLubyte *src, GLint srcRowStride,
+ void *dst, GLint dstRowStride)
+{
+ pack_ubyte_rgba_row_func packrow = get_pack_ubyte_rgba_row_function(format);
+ GLubyte *dstUB = (GLubyte *) dst;
+ GLuint i;
+
+ if (packrow) {
+ if (srcRowStride == width * 4 * sizeof(GLubyte) &&
+ dstRowStride == _mesa_format_row_stride(format, width)) {
+ /* do whole image at once */
+ packrow(width * height, (const GLubyte (*)[4]) src, dst);
+ }
+ else {
+ /* row by row */
+ for (i = 0; i < height; i++) {
+ packrow(width, (const GLubyte (*)[4]) src, dstUB);
+ src += srcRowStride;
+ dstUB += dstRowStride;
+ }
+ }
+ }
+ else {
+ /* slower fallback */
+ for (i = 0; i < height; i++) {
+ _mesa_pack_ubyte_rgba_row(format, width,
+ (const GLubyte (*)[4]) src, dstUB);
+ src += srcRowStride;
+ dstUB += dstRowStride;
+ }
+ }
+}
+
+
+
+/**
** Pack float Z pixels
**/
diff --git a/mesalib/src/mesa/main/format_pack.h b/mesalib/src/mesa/main/format_pack.h
index f1b480510..20b2ad8a5 100644
--- a/mesalib/src/mesa/main/format_pack.h
+++ b/mesalib/src/mesa/main/format_pack.h
@@ -77,6 +77,10 @@ _mesa_pack_ubyte_rgba_row(gl_format format, GLuint n,
const GLubyte src[][4], void *dst);
+extern void
+_mesa_pack_ubyte_rgba_rect(gl_format format, GLuint width, GLuint height,
+ const GLubyte *src, GLint srcRowStride,
+ void *dst, GLint dstRowStride);
extern void
_mesa_pack_float_z_row(gl_format format, GLuint n,
diff --git a/mesalib/src/mesa/main/format_unpack.c b/mesalib/src/mesa/main/format_unpack.c
index a2d889116..cd16a9ea6 100644
--- a/mesalib/src/mesa/main/format_unpack.c
+++ b/mesalib/src/mesa/main/format_unpack.c
@@ -2393,6 +2393,51 @@ unpack_int_rgba_LUMINANCE_UINT32(const GLuint *src, GLuint dst[][4], GLuint n)
}
static void
+unpack_int_rgba_LUMINANCE_UINT16(const GLushort *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = dst[i][1] = dst[i][2] = src[i];
+ dst[i][3] = 1;
+ }
+}
+
+static void
+unpack_int_rgba_LUMINANCE_INT16(const GLshort *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = dst[i][1] = dst[i][2] = src[i];
+ dst[i][3] = 1;
+ }
+}
+
+static void
+unpack_int_rgba_LUMINANCE_UINT8(const GLubyte *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = dst[i][1] = dst[i][2] = src[i];
+ dst[i][3] = 1;
+ }
+}
+
+static void
+unpack_int_rgba_LUMINANCE_INT8(const GLbyte *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = dst[i][1] = dst[i][2] = src[i];
+ dst[i][3] = 1;
+ }
+}
+
+
+static void
unpack_int_rgba_LUMINANCE_ALPHA_UINT32(const GLuint *src, GLuint dst[][4], GLuint n)
{
unsigned int i;
@@ -2618,6 +2663,19 @@ _mesa_unpack_uint_rgba_row(gl_format format, GLuint n,
case MESA_FORMAT_LUMINANCE_INT32:
unpack_int_rgba_LUMINANCE_UINT32(src, dst, n);
break;
+ case MESA_FORMAT_LUMINANCE_UINT16:
+ unpack_int_rgba_LUMINANCE_UINT16(src, dst, n);
+ break;
+ case MESA_FORMAT_LUMINANCE_INT16:
+ unpack_int_rgba_LUMINANCE_INT16(src, dst, n);
+ break;
+
+ case MESA_FORMAT_LUMINANCE_UINT8:
+ unpack_int_rgba_LUMINANCE_UINT8(src, dst, n);
+ break;
+ case MESA_FORMAT_LUMINANCE_INT8:
+ unpack_int_rgba_LUMINANCE_INT8(src, dst, n);
+ break;
case MESA_FORMAT_LUMINANCE_ALPHA_UINT32:
case MESA_FORMAT_LUMINANCE_ALPHA_INT32:
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index a2b01d05d..99dcb389b 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -2772,6 +2772,12 @@ struct gl_constants
GLuint GLSLVersion; /**< GLSL version supported (ex: 120 = 1.20) */
/**
+ * Changes default GLSL extension behavior from "error" to "warn". It's out
+ * of spec, but it can make some apps work that otherwise wouldn't.
+ */
+ GLboolean ForceGLSLExtensionsWarn;
+
+ /**
* Does the driver support real 32-bit integers? (Otherwise, integers are
* simulated via floats.)
*/
diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c
index 827fcb788..8c51a948e 100644
--- a/mesalib/src/mesa/main/texstore.c
+++ b/mesalib/src/mesa/main/texstore.c
@@ -55,6 +55,7 @@
#include "glheader.h"
#include "bufferobj.h"
#include "colormac.h"
+#include "format_pack.h"
#include "image.h"
#include "macros.h"
#include "mipmap.h"
@@ -967,6 +968,41 @@ memcpy_texture(struct gl_context *ctx,
}
+/**
+ * General-case function for storing a color texture images with
+ * components that can be represented with ubytes. Example destination
+ * texture formats are MESA_FORMAT_ARGB888, ARGB4444, RGB565.
+ */
+static GLboolean
+store_ubyte_texture(TEXSTORE_PARAMS)
+{
+ const GLint srcRowStride = srcWidth * 4 * sizeof(GLubyte);
+ GLubyte *tempImage, *src;
+ GLint img;
+
+ tempImage = _mesa_make_temp_ubyte_image(ctx, dims,
+ baseInternalFormat,
+ GL_RGBA,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr,
+ srcPacking);
+ if (!tempImage)
+ return GL_FALSE;
+
+ src = tempImage;
+ for (img = 0; img < srcDepth; img++) {
+ _mesa_pack_ubyte_rgba_rect(dstFormat, srcWidth, srcHeight,
+ src, srcRowStride,
+ dstSlices[img], dstRowStride);
+ src += srcHeight * srcRowStride;
+ }
+ free(tempImage);
+
+ return GL_TRUE;
+}
+
+
+
/**
* Store a 32-bit integer or float depth component texture image.
@@ -1132,8 +1168,6 @@ _mesa_texstore_z16(TEXSTORE_PARAMS)
static GLboolean
_mesa_texstore_rgb565(TEXSTORE_PARAMS)
{
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
-
ASSERT(dstFormat == MESA_FORMAT_RGB565 ||
dstFormat == MESA_FORMAT_RGB565_REV);
ASSERT(_mesa_get_format_bytes(dstFormat) == 2);
@@ -1184,42 +1218,10 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS)
}
}
else {
- /* general path */
- const GLubyte *tempImage = _mesa_make_temp_ubyte_image(ctx, dims,
- baseInternalFormat,
- baseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- const GLubyte *src = tempImage;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstSlices[img];
- for (row = 0; row < srcHeight; row++) {
- GLushort *dstUS = (GLushort *) dstRow;
- /* check for byteswapped format */
- if (dstFormat == MESA_FORMAT_RGB565) {
- for (col = 0; col < srcWidth; col++) {
- dstUS[col] = PACK_COLOR_565( src[RCOMP],
- src[GCOMP],
- src[BCOMP] );
- src += 3;
- }
- }
- else {
- for (col = 0; col < srcWidth; col++) {
- dstUS[col] = PACK_COLOR_565_REV( src[RCOMP],
- src[GCOMP],
- src[BCOMP] );
- src += 3;
- }
- }
- dstRow += dstRowStride;
- }
- }
- free((void *) tempImage);
+ return store_ubyte_texture(ctx, dims, baseInternalFormat,
+ dstFormat, dstRowStride, dstSlices,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr, srcPacking);
}
return GL_TRUE;
}
@@ -1232,7 +1234,6 @@ static GLboolean
_mesa_texstore_rgba8888(TEXSTORE_PARAMS)
{
const GLboolean littleEndian = _mesa_little_endian();
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
ASSERT(dstFormat == MESA_FORMAT_RGBA8888 ||
dstFormat == MESA_FORMAT_RGBA8888_REV ||
@@ -1288,44 +1289,10 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS)
srcPacking);
}
else {
- /* general path */
- const GLubyte *tempImage = _mesa_make_temp_ubyte_image(ctx, dims,
- baseInternalFormat,
- baseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- const GLubyte *src = tempImage;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstSlices[img];
- for (row = 0; row < srcHeight; row++) {
- GLuint *dstUI = (GLuint *) dstRow;
- if (dstFormat == MESA_FORMAT_RGBA8888 ||
- dstFormat == MESA_FORMAT_RGBX8888) {
- for (col = 0; col < srcWidth; col++) {
- dstUI[col] = PACK_COLOR_8888( src[RCOMP],
- src[GCOMP],
- src[BCOMP],
- src[ACOMP] );
- src += 4;
- }
- }
- else {
- for (col = 0; col < srcWidth; col++) {
- dstUI[col] = PACK_COLOR_8888_REV( src[RCOMP],
- src[GCOMP],
- src[BCOMP],
- src[ACOMP] );
- src += 4;
- }
- }
- dstRow += dstRowStride;
- }
- }
- free((void *) tempImage);
+ return store_ubyte_texture(ctx, dims, baseInternalFormat,
+ dstFormat, dstRowStride, dstSlices,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr, srcPacking);
}
return GL_TRUE;
}
@@ -1335,7 +1302,6 @@ static GLboolean
_mesa_texstore_argb8888(TEXSTORE_PARAMS)
{
const GLboolean littleEndian = _mesa_little_endian();
- const GLenum baseFormat = GL_RGBA;
ASSERT(dstFormat == MESA_FORMAT_ARGB8888 ||
dstFormat == MESA_FORMAT_ARGB8888_REV ||
@@ -1457,52 +1423,10 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS)
srcPacking);
}
else {
- /* general path */
- const GLubyte *tempImage = _mesa_make_temp_ubyte_image(ctx, dims,
- baseInternalFormat,
- baseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- const GLubyte *src = tempImage;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstSlices[img];
- for (row = 0; row < srcHeight; row++) {
- GLuint *dstUI = (GLuint *) dstRow;
- if (dstFormat == MESA_FORMAT_ARGB8888) {
- for (col = 0; col < srcWidth; col++) {
- dstUI[col] = PACK_COLOR_8888( src[ACOMP],
- src[RCOMP],
- src[GCOMP],
- src[BCOMP] );
- src += 4;
- }
- }
- else if (dstFormat == MESA_FORMAT_XRGB8888) {
- for (col = 0; col < srcWidth; col++) {
- dstUI[col] = PACK_COLOR_8888( 0xff,
- src[RCOMP],
- src[GCOMP],
- src[BCOMP] );
- src += 4;
- }
- }
- else {
- for (col = 0; col < srcWidth; col++) {
- dstUI[col] = PACK_COLOR_8888_REV( src[ACOMP],
- src[RCOMP],
- src[GCOMP],
- src[BCOMP] );
- src += 4;
- }
- }
- dstRow += dstRowStride;
- }
- }
- free((void *) tempImage);
+ return store_ubyte_texture(ctx, dims, baseInternalFormat,
+ dstFormat, dstRowStride, dstSlices,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr, srcPacking);
}
return GL_TRUE;
}
@@ -1511,8 +1435,6 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS)
static GLboolean
_mesa_texstore_rgb888(TEXSTORE_PARAMS)
{
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
-
ASSERT(dstFormat == MESA_FORMAT_RGB888);
ASSERT(_mesa_get_format_bytes(dstFormat) == 3);
@@ -1574,49 +1496,10 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS)
srcPacking);
}
else {
- /* general path */
- const GLubyte *tempImage = _mesa_make_temp_ubyte_image(ctx, dims,
- baseInternalFormat,
- baseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- const GLubyte *src = (const GLubyte *) tempImage;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstSlices[img];
- for (row = 0; row < srcHeight; row++) {
-#if 0
- if (littleEndian) {
- for (col = 0; col < srcWidth; col++) {
- dstRow[col * 3 + 0] = src[RCOMP];
- dstRow[col * 3 + 1] = src[GCOMP];
- dstRow[col * 3 + 2] = src[BCOMP];
- srcUB += 3;
- }
- }
- else {
- for (col = 0; col < srcWidth; col++) {
- dstRow[col * 3 + 0] = srcUB[BCOMP];
- dstRow[col * 3 + 1] = srcUB[GCOMP];
- dstRow[col * 3 + 2] = srcUB[RCOMP];
- srcUB += 3;
- }
- }
-#else
- for (col = 0; col < srcWidth; col++) {
- dstRow[col * 3 + 0] = src[BCOMP];
- dstRow[col * 3 + 1] = src[GCOMP];
- dstRow[col * 3 + 2] = src[RCOMP];
- src += 3;
- }
-#endif
- dstRow += dstRowStride;
- }
- }
- free((void *) tempImage);
+ return store_ubyte_texture(ctx, dims, baseInternalFormat,
+ dstFormat, dstRowStride, dstSlices,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr, srcPacking);
}
return GL_TRUE;
}
@@ -1625,8 +1508,6 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS)
static GLboolean
_mesa_texstore_bgr888(TEXSTORE_PARAMS)
{
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
-
ASSERT(dstFormat == MESA_FORMAT_BGR888);
ASSERT(_mesa_get_format_bytes(dstFormat) == 3);
@@ -1688,30 +1569,10 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS)
srcPacking);
}
else {
- /* general path */
- const GLubyte *tempImage = _mesa_make_temp_ubyte_image(ctx, dims,
- baseInternalFormat,
- baseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- const GLubyte *src = (const GLubyte *) tempImage;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstSlices[img];
- for (row = 0; row < srcHeight; row++) {
- for (col = 0; col < srcWidth; col++) {
- dstRow[col * 3 + 0] = src[RCOMP];
- dstRow[col * 3 + 1] = src[GCOMP];
- dstRow[col * 3 + 2] = src[BCOMP];
- src += 3;
- }
- dstRow += dstRowStride;
- }
- }
- free((void *) tempImage);
+ return store_ubyte_texture(ctx, dims, baseInternalFormat,
+ dstFormat, dstRowStride, dstSlices,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr, srcPacking);
}
return GL_TRUE;
}
@@ -1720,8 +1581,6 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS)
static GLboolean
_mesa_texstore_argb4444(TEXSTORE_PARAMS)
{
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
-
ASSERT(dstFormat == MESA_FORMAT_ARGB4444 ||
dstFormat == MESA_FORMAT_ARGB4444_REV);
ASSERT(_mesa_get_format_bytes(dstFormat) == 2);
@@ -1738,43 +1597,10 @@ _mesa_texstore_argb4444(TEXSTORE_PARAMS)
srcAddr, srcPacking);
}
else {
- /* general path */
- const GLubyte *tempImage = _mesa_make_temp_ubyte_image(ctx, dims,
- baseInternalFormat,
- baseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- const GLubyte *src = tempImage;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstSlices[img];
- for (row = 0; row < srcHeight; row++) {
- GLushort *dstUS = (GLushort *) dstRow;
- if (dstFormat == MESA_FORMAT_ARGB4444) {
- for (col = 0; col < srcWidth; col++) {
- dstUS[col] = PACK_COLOR_4444( src[ACOMP],
- src[RCOMP],
- src[GCOMP],
- src[BCOMP] );
- src += 4;
- }
- }
- else {
- for (col = 0; col < srcWidth; col++) {
- dstUS[col] = PACK_COLOR_4444_REV( src[ACOMP],
- src[RCOMP],
- src[GCOMP],
- src[BCOMP] );
- src += 4;
- }
- }
- dstRow += dstRowStride;
- }
- }
- free((void *) tempImage);
+ return store_ubyte_texture(ctx, dims, baseInternalFormat,
+ dstFormat, dstRowStride, dstSlices,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr, srcPacking);
}
return GL_TRUE;
}
@@ -1782,8 +1608,6 @@ _mesa_texstore_argb4444(TEXSTORE_PARAMS)
static GLboolean
_mesa_texstore_rgba5551(TEXSTORE_PARAMS)
{
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
-
ASSERT(dstFormat == MESA_FORMAT_RGBA5551);
ASSERT(_mesa_get_format_bytes(dstFormat) == 2);
@@ -1799,32 +1623,10 @@ _mesa_texstore_rgba5551(TEXSTORE_PARAMS)
srcAddr, srcPacking);
}
else {
- /* general path */
- const GLubyte *tempImage = _mesa_make_temp_ubyte_image(ctx, dims,
- baseInternalFormat,
- baseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- const GLubyte *src =tempImage;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstSlices[img];
- for (row = 0; row < srcHeight; row++) {
- GLushort *dstUS = (GLushort *) dstRow;
- for (col = 0; col < srcWidth; col++) {
- dstUS[col] = PACK_COLOR_5551( src[RCOMP],
- src[GCOMP],
- src[BCOMP],
- src[ACOMP] );
- src += 4;
- }
- dstRow += dstRowStride;
- }
- }
- free((void *) tempImage);
+ return store_ubyte_texture(ctx, dims, baseInternalFormat,
+ dstFormat, dstRowStride, dstSlices,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr, srcPacking);
}
return GL_TRUE;
}
@@ -1832,8 +1634,6 @@ _mesa_texstore_rgba5551(TEXSTORE_PARAMS)
static GLboolean
_mesa_texstore_argb1555(TEXSTORE_PARAMS)
{
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
-
ASSERT(dstFormat == MESA_FORMAT_ARGB1555 ||
dstFormat == MESA_FORMAT_ARGB1555_REV);
ASSERT(_mesa_get_format_bytes(dstFormat) == 2);
@@ -1850,43 +1650,10 @@ _mesa_texstore_argb1555(TEXSTORE_PARAMS)
srcAddr, srcPacking);
}
else {
- /* general path */
- const GLubyte *tempImage = _mesa_make_temp_ubyte_image(ctx, dims,
- baseInternalFormat,
- baseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- const GLubyte *src =tempImage;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstSlices[img];
- for (row = 0; row < srcHeight; row++) {
- GLushort *dstUS = (GLushort *) dstRow;
- if (dstFormat == MESA_FORMAT_ARGB1555) {
- for (col = 0; col < srcWidth; col++) {
- dstUS[col] = PACK_COLOR_1555( src[ACOMP],
- src[RCOMP],
- src[GCOMP],
- src[BCOMP] );
- src += 4;
- }
- }
- else {
- for (col = 0; col < srcWidth; col++) {
- dstUS[col] = PACK_COLOR_1555_REV( src[ACOMP],
- src[RCOMP],
- src[GCOMP],
- src[BCOMP] );
- src += 4;
- }
- }
- dstRow += dstRowStride;
- }
- }
- free((void *) tempImage);
+ return store_ubyte_texture(ctx, dims, baseInternalFormat,
+ dstFormat, dstRowStride, dstSlices,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr, srcPacking);
}
return GL_TRUE;
}
@@ -2396,8 +2163,6 @@ _mesa_texstore_signed_rgba_16(TEXSTORE_PARAMS)
static GLboolean
_mesa_texstore_rgb332(TEXSTORE_PARAMS)
{
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
-
ASSERT(dstFormat == MESA_FORMAT_RGB332);
ASSERT(_mesa_get_format_bytes(dstFormat) == 1);
@@ -2413,30 +2178,10 @@ _mesa_texstore_rgb332(TEXSTORE_PARAMS)
srcAddr, srcPacking);
}
else {
- /* general path */
- const GLubyte *tempImage = _mesa_make_temp_ubyte_image(ctx, dims,
- baseInternalFormat,
- baseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- const GLubyte *src = tempImage;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstSlices[img];
- for (row = 0; row < srcHeight; row++) {
- for (col = 0; col < srcWidth; col++) {
- dstRow[col] = PACK_COLOR_332( src[RCOMP],
- src[GCOMP],
- src[BCOMP] );
- src += 3;
- }
- dstRow += dstRowStride;
- }
- }
- free((void *) tempImage);
+ return store_ubyte_texture(ctx, dims, baseInternalFormat,
+ dstFormat, dstRowStride, dstSlices,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr, srcPacking);
}
return GL_TRUE;
}
diff --git a/mesalib/src/mesa/program/prog_statevars.c b/mesalib/src/mesa/program/prog_statevars.c
index f34a6d360..98ab9d003 100644
--- a/mesalib/src/mesa/program/prog_statevars.c
+++ b/mesalib/src/mesa/program/prog_statevars.c
@@ -495,29 +495,6 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
value[3] = ctx->Point.Threshold;
}
return;
- case STATE_POINT_SIZE_IMPL_CLAMP:
- {
- /* for implementation clamp only in vs */
- GLfloat minImplSize;
- GLfloat maxImplSize;
- if (ctx->Point.PointSprite) {
- minImplSize = ctx->Const.MinPointSizeAA;
- maxImplSize = ctx->Const.MaxPointSize;
- }
- else if (ctx->Point.SmoothFlag || ctx->Multisample._Enabled) {
- minImplSize = ctx->Const.MinPointSizeAA;
- maxImplSize = ctx->Const.MaxPointSizeAA;
- }
- else {
- minImplSize = ctx->Const.MinPointSize;
- maxImplSize = ctx->Const.MaxPointSize;
- }
- value[0] = ctx->Point.Size;
- value[1] = minImplSize;
- value[2] = maxImplSize;
- value[3] = ctx->Point.Threshold;
- }
- return;
case STATE_LIGHT_SPOT_DIR_NORMALIZED:
{
/* here, state[2] is the light number */
@@ -729,7 +706,6 @@ _mesa_program_state_flags(const gl_state_index state[STATE_LENGTH])
case STATE_FOG_PARAMS_OPTIMIZED:
return _NEW_FOG;
case STATE_POINT_SIZE_CLAMPED:
- case STATE_POINT_SIZE_IMPL_CLAMP:
return _NEW_POINT | _NEW_MULTISAMPLE;
case STATE_LIGHT_SPOT_DIR_NORMALIZED:
case STATE_LIGHT_POSITION:
@@ -921,9 +897,6 @@ append_token(char *dst, gl_state_index k)
case STATE_POINT_SIZE_CLAMPED:
append(dst, "pointSizeClamped");
break;
- case STATE_POINT_SIZE_IMPL_CLAMP:
- append(dst, "pointSizeImplClamp");
- break;
case STATE_LIGHT_SPOT_DIR_NORMALIZED:
append(dst, "lightSpotDirNormalized");
break;
diff --git a/mesalib/src/mesa/program/prog_statevars.h b/mesalib/src/mesa/program/prog_statevars.h
index 8b731e12b..65baa7833 100644
--- a/mesalib/src/mesa/program/prog_statevars.h
+++ b/mesalib/src/mesa/program/prog_statevars.h
@@ -118,7 +118,6 @@ typedef enum gl_state_index_ {
STATE_TEXRECT_SCALE,
STATE_FOG_PARAMS_OPTIMIZED, /* for faster fog calc */
STATE_POINT_SIZE_CLAMPED, /* includes implementation dependent size clamp */
- STATE_POINT_SIZE_IMPL_CLAMP, /* for implementation clamp only in vs */
STATE_LIGHT_SPOT_DIR_NORMALIZED, /* pre-normalized spot dir */
STATE_LIGHT_POSITION, /* object vs eye space */
STATE_LIGHT_POSITION_NORMALIZED, /* object vs eye space */
diff --git a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
index 25799bf2b..204f505a6 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
@@ -90,28 +90,10 @@ static void update_raster_state( struct st_context *st )
if (ctx->Light.ProvokingVertex == GL_FIRST_VERTEX_CONVENTION_EXT)
raster->flatshade_first = 1;
- /* _NEW_LIGHT | _NEW_PROGRAM
- *
- * Back-face colors can come from traditional lighting (when
- * GL_LIGHT_MODEL_TWO_SIDE is set) or from vertex programs/shaders (when
- * GL_VERTEX_PROGRAM_TWO_SIDE is set). Note the logic here.
- */
- if (ctx->VertexProgram._Current) {
- if (ctx->VertexProgram._Enabled ||
- (ctx->Shader.CurrentVertexProgram &&
- ctx->Shader.CurrentVertexProgram->LinkStatus)) {
- /* user-defined vertex program or shader */
- raster->light_twoside = ctx->VertexProgram.TwoSideEnabled;
- }
- else {
- /* TNL-generated program */
- raster->light_twoside = ctx->Light.Enabled && ctx->Light.Model.TwoSide;
- }
- }
- else if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) {
- raster->light_twoside = 1;
- }
+ /* _NEW_LIGHT | _NEW_PROGRAM */
+ raster->light_twoside = ctx->VertexProgram._TwoSideEnabled;
+ /*_NEW_LIGHT | _NEW_BUFFERS */
raster->clamp_vertex_color = !st->clamp_vert_color_in_shader &&
ctx->Light._ClampVertexColor;
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 ab05896ce..f139e95fe 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -3843,12 +3843,6 @@ struct st_translate {
struct ureg_src samplers[PIPE_MAX_SAMPLERS];
struct ureg_src systemValues[SYSTEM_VALUE_MAX];
- /* Extra info for handling point size clamping in vertex shader */
- struct ureg_dst pointSizeResult; /**< Actual point size output register */
- struct ureg_src pointSizeConst; /**< Point size range constant register */
- GLint pointSizeOutIndex; /**< Temp point size output register */
- GLboolean prevInstWrotePointSize;
-
const GLuint *inputMapping;
const GLuint *outputMapping;
@@ -3970,9 +3964,6 @@ dst_register(struct st_translate *t,
return t->temps[index];
case PROGRAM_OUTPUT:
- if (t->procType == TGSI_PROCESSOR_VERTEX && index == VERT_RESULT_PSIZ)
- t->prevInstWrotePointSize = GL_TRUE;
-
if (t->procType == TGSI_PROCESSOR_VERTEX)
assert(index < VERT_RESULT_MAX);
else if (t->procType == TGSI_PROCESSOR_FRAGMENT)
@@ -4502,8 +4493,6 @@ st_translate_program(
t->inputMapping = inputMapping;
t->outputMapping = outputMapping;
t->ureg = ureg;
- t->pointSizeOutIndex = -1;
- t->prevInstWrotePointSize = GL_FALSE;
if (program->shader_program) {
for (i = 0; i < program->shader_program->NumUserUniformStorage; i++) {
@@ -4597,25 +4586,6 @@ st_translate_program(
outputSemanticName[i],
outputSemanticIndex[i]);
}
- if ((outputSemanticName[i] == TGSI_SEMANTIC_PSIZE) && proginfo->Id) {
- /* Writing to the point size result register requires special
- * handling to implement clamping.
- */
- static const gl_state_index pointSizeClampState[STATE_LENGTH]
- = { STATE_INTERNAL, STATE_POINT_SIZE_IMPL_CLAMP, (gl_state_index)0, (gl_state_index)0, (gl_state_index)0 };
- /* XXX: note we are modifying the incoming shader here! Need to
- * do this before emitting the constant decls below, or this
- * will be missed.
- */
- unsigned pointSizeClampConst =
- _mesa_add_state_reference(proginfo->Parameters,
- pointSizeClampState);
- struct ureg_dst psizregtemp = ureg_DECL_temporary(ureg);
- t->pointSizeConst = ureg_DECL_constant(ureg, pointSizeClampConst);
- t->pointSizeResult = t->outputs[i];
- t->pointSizeOutIndex = i;
- t->outputs[i] = psizregtemp;
- }
}
if (passthrough_edgeflags)
emit_edgeflags(t);
@@ -4723,25 +4693,6 @@ st_translate_program(
set_insn_start(t, ureg_get_instruction_number(ureg));
compile_tgsi_instruction(t, (glsl_to_tgsi_instruction *)iter.get(),
clamp_color);
-
- if (t->prevInstWrotePointSize && proginfo->Id) {
- /* The previous instruction wrote to the (fake) vertex point size
- * result register. Now we need to clamp that value to the min/max
- * point size range, putting the result into the real point size
- * register.
- * Note that we can't do this easily at the end of program due to
- * possible early return.
- */
- set_insn_start(t, ureg_get_instruction_number(ureg));
- ureg_MAX(t->ureg,
- ureg_writemask(t->outputs[t->pointSizeOutIndex], WRITEMASK_X),
- ureg_src(t->outputs[t->pointSizeOutIndex]),
- ureg_swizzle(t->pointSizeConst, 1,1,1,1));
- ureg_MIN(t->ureg, ureg_writemask(t->pointSizeResult, WRITEMASK_X),
- ureg_src(t->outputs[t->pointSizeOutIndex]),
- ureg_swizzle(t->pointSizeConst, 2,2,2,2));
- }
- t->prevInstWrotePointSize = GL_FALSE;
}
/* Fix up all emitted labels:
diff --git a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c
index fc77089e7..e414ed88c 100644
--- a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -74,12 +74,6 @@ struct st_translate {
struct ureg_src samplers[PIPE_MAX_SAMPLERS];
struct ureg_src systemValues[SYSTEM_VALUE_MAX];
- /* Extra info for handling point size clamping in vertex shader */
- struct ureg_dst pointSizeResult; /**< Actual point size output register */
- struct ureg_src pointSizeConst; /**< Point size range constant register */
- GLint pointSizeOutIndex; /**< Temp point size output register */
- GLboolean prevInstWrotePointSize;
-
const GLuint *inputMapping;
const GLuint *outputMapping;
@@ -187,9 +181,6 @@ dst_register( struct st_translate *t,
return t->temps[index];
case PROGRAM_OUTPUT:
- if (t->procType == TGSI_PROCESSOR_VERTEX && index == VERT_RESULT_PSIZ)
- t->prevInstWrotePointSize = GL_TRUE;
-
if (t->procType == TGSI_PROCESSOR_VERTEX)
assert(index < VERT_RESULT_MAX);
else if (t->procType == TGSI_PROCESSOR_FRAGMENT)
@@ -1057,8 +1048,6 @@ st_translate_mesa_program(
t->inputMapping = inputMapping;
t->outputMapping = outputMapping;
t->ureg = ureg;
- t->pointSizeOutIndex = -1;
- t->prevInstWrotePointSize = GL_FALSE;
/*_mesa_print_program(program);*/
@@ -1149,25 +1138,6 @@ st_translate_mesa_program(
t->outputs[i] = ureg_DECL_output( ureg,
outputSemanticName[i],
outputSemanticIndex[i] );
- if ((outputSemanticName[i] == TGSI_SEMANTIC_PSIZE) && program->Id) {
- /* Writing to the point size result register requires special
- * handling to implement clamping.
- */
- static const gl_state_index pointSizeClampState[STATE_LENGTH]
- = { STATE_INTERNAL, STATE_POINT_SIZE_IMPL_CLAMP, 0, 0, 0 };
- /* XXX: note we are modifying the incoming shader here! Need to
- * do this before emitting the constant decls below, or this
- * will be missed:
- */
- unsigned pointSizeClampConst =
- _mesa_add_state_reference(program->Parameters,
- pointSizeClampState);
- struct ureg_dst psizregtemp = ureg_DECL_temporary( ureg );
- t->pointSizeConst = ureg_DECL_constant( ureg, pointSizeClampConst );
- t->pointSizeResult = t->outputs[i];
- t->pointSizeOutIndex = i;
- t->outputs[i] = psizregtemp;
- }
}
if (passthrough_edgeflags)
emit_edgeflags( t, program );
@@ -1259,25 +1229,6 @@ st_translate_mesa_program(
for (i = 0; i < program->NumInstructions; i++) {
set_insn_start( t, ureg_get_instruction_number( ureg ));
compile_instruction( t, &program->Instructions[i], clamp_color );
-
- if (t->prevInstWrotePointSize && program->Id) {
- /* The previous instruction wrote to the (fake) vertex point size
- * result register. Now we need to clamp that value to the min/max
- * point size range, putting the result into the real point size
- * register.
- * Note that we can't do this easily at the end of program due to
- * possible early return.
- */
- set_insn_start( t, ureg_get_instruction_number( ureg ));
- ureg_MAX( t->ureg,
- ureg_writemask(t->outputs[t->pointSizeOutIndex], WRITEMASK_X),
- ureg_src(t->outputs[t->pointSizeOutIndex]),
- ureg_swizzle(t->pointSizeConst, 1,1,1,1));
- ureg_MIN( t->ureg, ureg_writemask(t->pointSizeResult, WRITEMASK_X),
- ureg_src(t->outputs[t->pointSizeOutIndex]),
- ureg_swizzle(t->pointSizeConst, 2,2,2,2));
- }
- t->prevInstWrotePointSize = GL_FALSE;
}
/* Fix up all emitted labels: