aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa')
-rw-r--r--mesalib/src/mesa/main/extensions.c4
-rw-r--r--mesalib/src/mesa/main/format_unpack.c14
-rw-r--r--mesalib/src/mesa/main/formats.c12
-rw-r--r--mesalib/src/mesa/main/mtypes.h2
-rw-r--r--mesalib/src/mesa/main/readpix.c4
-rw-r--r--mesalib/src/mesa/main/texformat.c12
-rw-r--r--mesalib/src/mesa/main/teximage.c11
-rw-r--r--mesalib/src/mesa/main/texparam.c119
-rw-r--r--mesalib/src/mesa/main/texstore.c7
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_drawpixels.c7
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_fbo.c14
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c46
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp16
-rw-r--r--mesalib/src/mesa/swrast/s_texcombine.c23
-rw-r--r--mesalib/src/mesa/vbo/vbo_noop.h6
15 files changed, 185 insertions, 112 deletions
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index d5a891435..8ebc05139 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -81,7 +81,7 @@ static const struct extension extension_table[] = {
{ "GL_ARB_blend_func_extended", o(ARB_blend_func_extended), GL, 2009 },
{ "GL_ARB_color_buffer_float", o(ARB_color_buffer_float), GL, 2004 },
{ "GL_ARB_copy_buffer", o(ARB_copy_buffer), GL, 2008 },
- { "GL_ARB_conservative_depth", o(AMD_conservative_depth), GL, 2011 },
+ { "GL_ARB_conservative_depth", o(ARB_conservative_depth), GL, 2011 },
{ "GL_ARB_depth_buffer_float", o(ARB_depth_buffer_float), GL, 2008 },
{ "GL_ARB_depth_clamp", o(ARB_depth_clamp), GL, 2003 },
{ "GL_ARB_depth_texture", o(ARB_depth_texture), GL, 2001 },
@@ -257,7 +257,7 @@ static const struct extension extension_table[] = {
/* Vendor extensions */
{ "GL_3DFX_texture_compression_FXT1", o(TDFX_texture_compression_FXT1), GL, 1999 },
- { "GL_AMD_conservative_depth", o(AMD_conservative_depth), GL, 2009 },
+ { "GL_AMD_conservative_depth", o(ARB_conservative_depth), GL, 2009 },
{ "GL_AMD_draw_buffers_blend", o(ARB_draw_buffers_blend), GL, 2009 },
{ "GL_AMD_seamless_cubemap_per_texture", o(AMD_seamless_cubemap_per_texture), GL, 2009 },
{ "GL_AMD_shader_stencil_export", o(ARB_shader_stencil_export), GL, 2009 },
diff --git a/mesalib/src/mesa/main/format_unpack.c b/mesalib/src/mesa/main/format_unpack.c
index 6e2ce7a05..080392f2b 100644
--- a/mesalib/src/mesa/main/format_unpack.c
+++ b/mesalib/src/mesa/main/format_unpack.c
@@ -936,7 +936,7 @@ unpack_INTENSITY_FLOAT16(const void *src, GLfloat dst[][4], GLuint n)
dst[i][RCOMP] =
dst[i][GCOMP] =
dst[i][BCOMP] =
- dst[i][ACOMP] = s[i];
+ dst[i][ACOMP] = _mesa_half_to_float(s[i]);
}
}
@@ -1751,6 +1751,12 @@ unpack_float_z_Z32(GLuint n, const void *src, GLfloat *dst)
}
static void
+unpack_float_z_Z32F(GLuint n, const void *src, GLfloat *dst)
+{
+ memcpy(dst, src, n * sizeof(float));
+}
+
+static void
unpack_float_z_Z32X24S8(GLuint n, const void *src, GLfloat *dst)
{
const GLfloat *s = ((const GLfloat *) src);
@@ -1783,6 +1789,9 @@ _mesa_unpack_float_z_row(gl_format format, GLuint n,
case MESA_FORMAT_Z32:
unpack = unpack_float_z_Z32;
break;
+ case MESA_FORMAT_Z32_FLOAT:
+ unpack = unpack_float_z_Z32F;
+ break;
case MESA_FORMAT_Z32_FLOAT_X24S8:
unpack = unpack_float_z_Z32X24S8;
break;
@@ -1959,7 +1968,8 @@ _mesa_unpack_uint_24_8_depth_stencil_row(gl_format format, GLuint n,
unpack_uint_24_8_depth_stencil_S8_Z24(src, dst, n);
break;
default:
- _mesa_problem(NULL, "bad format %s in _mesa_unpack_ubyte_s_row",
+ _mesa_problem(NULL,
+ "bad format %s in _mesa_unpack_uint_24_8_depth_stencil_row",
_mesa_get_format_name(format));
return;
}
diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c
index c6febb0e5..b934bd4d8 100644
--- a/mesalib/src/mesa/main/formats.c
+++ b/mesalib/src/mesa/main/formats.c
@@ -414,7 +414,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
MESA_FORMAT_Z24_S8, /* Name */
"MESA_FORMAT_Z24_S8", /* StrName */
GL_DEPTH_STENCIL, /* BaseFormat */
- GL_UNSIGNED_INT, /* DataType */
+ GL_UNSIGNED_NORMALIZED, /* DataType */
0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
0, 0, 0, 24, 8, /* Lum/Int/Index/Depth/StencilBits */
1, 1, 4 /* BlockWidth/Height,Bytes */
@@ -423,7 +423,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
MESA_FORMAT_S8_Z24, /* Name */
"MESA_FORMAT_S8_Z24", /* StrName */
GL_DEPTH_STENCIL, /* BaseFormat */
- GL_UNSIGNED_INT, /* DataType */
+ GL_UNSIGNED_NORMALIZED, /* DataType */
0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
0, 0, 0, 24, 8, /* Lum/Int/Index/Depth/StencilBits */
1, 1, 4 /* BlockWidth/Height,Bytes */
@@ -432,7 +432,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
MESA_FORMAT_Z16, /* Name */
"MESA_FORMAT_Z16", /* StrName */
GL_DEPTH_COMPONENT, /* BaseFormat */
- GL_UNSIGNED_INT, /* DataType */
+ GL_UNSIGNED_NORMALIZED, /* DataType */
0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
0, 0, 0, 16, 0, /* Lum/Int/Index/Depth/StencilBits */
1, 1, 2 /* BlockWidth/Height,Bytes */
@@ -441,7 +441,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
MESA_FORMAT_X8_Z24, /* Name */
"MESA_FORMAT_X8_Z24", /* StrName */
GL_DEPTH_COMPONENT, /* BaseFormat */
- GL_UNSIGNED_INT, /* DataType */
+ GL_UNSIGNED_NORMALIZED, /* DataType */
0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
0, 0, 0, 24, 0, /* Lum/Int/Index/Depth/StencilBits */
1, 1, 4 /* BlockWidth/Height,Bytes */
@@ -450,7 +450,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
MESA_FORMAT_Z24_X8, /* Name */
"MESA_FORMAT_Z24_X8", /* StrName */
GL_DEPTH_COMPONENT, /* BaseFormat */
- GL_UNSIGNED_INT, /* DataType */
+ GL_UNSIGNED_NORMALIZED, /* DataType */
0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
0, 0, 0, 24, 0, /* Lum/Int/Index/Depth/StencilBits */
1, 1, 4 /* BlockWidth/Height,Bytes */
@@ -459,7 +459,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
MESA_FORMAT_Z32, /* Name */
"MESA_FORMAT_Z32", /* StrName */
GL_DEPTH_COMPONENT, /* BaseFormat */
- GL_UNSIGNED_INT, /* DataType */
+ GL_UNSIGNED_NORMALIZED, /* DataType */
0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
0, 0, 0, 32, 0, /* Lum/Int/Index/Depth/StencilBits */
1, 1, 4 /* BlockWidth/Height,Bytes */
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index b3427dac1..96a44266c 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -2844,6 +2844,7 @@ struct gl_extensions
GLboolean ARB_ES2_compatibility;
GLboolean ARB_blend_func_extended;
GLboolean ARB_color_buffer_float;
+ GLboolean ARB_conservative_depth;
GLboolean ARB_copy_buffer;
GLboolean ARB_depth_buffer_float;
GLboolean ARB_depth_clamp;
@@ -2942,7 +2943,6 @@ struct gl_extensions
GLboolean EXT_vertex_array_bgra;
GLboolean OES_standard_derivatives;
/* vendor extensions */
- GLboolean AMD_conservative_depth;
GLboolean AMD_seamless_cubemap_per_texture;
GLboolean APPLE_packed_pixels;
GLboolean APPLE_vertex_array_object;
diff --git a/mesalib/src/mesa/main/readpix.c b/mesalib/src/mesa/main/readpix.c
index 8048a7286..a7b7ed7f2 100644
--- a/mesalib/src/mesa/main/readpix.c
+++ b/mesalib/src/mesa/main/readpix.c
@@ -60,7 +60,7 @@ fast_read_depth_pixels( struct gl_context *ctx,
if (packing->SwapBytes)
return GL_FALSE;
- if (_mesa_get_format_datatype(rb->Format) != GL_UNSIGNED_INT)
+ if (_mesa_get_format_datatype(rb->Format) != GL_UNSIGNED_NORMALIZED)
return GL_FALSE;
if (!((type == GL_UNSIGNED_SHORT && rb->Format == MESA_FORMAT_Z16) ||
@@ -381,7 +381,7 @@ fast_read_depth_stencil_pixels_separate(struct gl_context *ctx,
GLubyte *depthMap, *stencilMap;
int depthStride, stencilStride, i, j;
- if (_mesa_get_format_datatype(depthRb->Format) != GL_UNSIGNED_INT)
+ if (_mesa_get_format_datatype(depthRb->Format) != GL_UNSIGNED_NORMALIZED)
return GL_FALSE;
ctx->Driver.MapRenderbuffer(ctx, depthRb, x, y, width, height,
diff --git a/mesalib/src/mesa/main/texformat.c b/mesalib/src/mesa/main/texformat.c
index aebe38ee0..ee9552bc0 100644
--- a/mesalib/src/mesa/main/texformat.c
+++ b/mesalib/src/mesa/main/texformat.c
@@ -326,6 +326,8 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
case GL_ALPHA32F_ARB:
RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT32);
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
break;
case GL_LUMINANCE16F_ARB:
RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT16);
@@ -335,6 +337,8 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
case GL_LUMINANCE32F_ARB:
RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT32);
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
break;
case GL_LUMINANCE_ALPHA16F_ARB:
RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16);
@@ -344,6 +348,8 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
case GL_LUMINANCE_ALPHA32F_ARB:
RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32);
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
break;
case GL_INTENSITY16F_ARB:
RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT16);
@@ -353,15 +359,20 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
case GL_INTENSITY32F_ARB:
RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT32);
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
break;
case GL_RGB16F_ARB:
RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT32);
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
break;
case GL_RGB32F_ARB:
RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT32);
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
break;
case GL_RGBA16F_ARB:
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
@@ -369,6 +380,7 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
break;
case GL_RGBA32F_ARB:
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
break;
default:
; /* fallthrough */
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index c8ea4329f..56335ad10 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -1021,15 +1021,8 @@ make_null_texture(GLint width, GLint height, GLint depth, GLenum format)
/**
- * Reset the fields of a gl_texture_image struct to zero.
- *
- * \param img texture image structure.
- *
- * This is called when a proxy texture test fails, we set all the
- * image members (except DriverData) to zero.
- * It's also used in glTexImage[123]D as a safeguard to be sure all
- * required fields get initialized properly by the Driver.TexImage[123]D
- * functions.
+ * Set the size and format-related fields of a gl_texture_image struct
+ * to zero. This is used when a proxy texture test fails.
*/
static void
clear_teximage_fields(struct gl_texture_image *img)
diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c
index 17eac5fc9..0081c3b52 100644
--- a/mesalib/src/mesa/main/texparam.c
+++ b/mesalib/src/mesa/main/texparam.c
@@ -884,6 +884,70 @@ _mesa_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
}
+static GLboolean
+base_format_has_channel(GLenum base_format, GLenum pname)
+{
+ switch (pname) {
+ case GL_TEXTURE_RED_SIZE:
+ case GL_TEXTURE_RED_TYPE:
+ if (base_format == GL_RED ||
+ base_format == GL_RG ||
+ base_format == GL_RGB ||
+ base_format == GL_RGBA) {
+ return GL_TRUE;
+ }
+ return GL_FALSE;
+ case GL_TEXTURE_GREEN_SIZE:
+ case GL_TEXTURE_GREEN_TYPE:
+ if (base_format == GL_RG ||
+ base_format == GL_RGB ||
+ base_format == GL_RGBA) {
+ return GL_TRUE;
+ }
+ return GL_FALSE;
+ case GL_TEXTURE_BLUE_SIZE:
+ case GL_TEXTURE_BLUE_TYPE:
+ if (base_format == GL_RGB ||
+ base_format == GL_RGBA) {
+ return GL_TRUE;
+ }
+ return GL_FALSE;
+ case GL_TEXTURE_ALPHA_SIZE:
+ case GL_TEXTURE_ALPHA_TYPE:
+ if (base_format == GL_RGBA ||
+ base_format == GL_ALPHA ||
+ base_format == GL_LUMINANCE_ALPHA) {
+ return GL_TRUE;
+ }
+ return GL_FALSE;
+ case GL_TEXTURE_LUMINANCE_SIZE:
+ case GL_TEXTURE_LUMINANCE_TYPE:
+ if (base_format == GL_LUMINANCE ||
+ base_format == GL_LUMINANCE_ALPHA) {
+ return GL_TRUE;
+ }
+ return GL_FALSE;
+ case GL_TEXTURE_INTENSITY_SIZE:
+ case GL_TEXTURE_INTENSITY_TYPE:
+ if (base_format == GL_INTENSITY) {
+ return GL_TRUE;
+ }
+ return GL_FALSE;
+ case GL_TEXTURE_DEPTH_SIZE:
+ case GL_TEXTURE_DEPTH_TYPE:
+ if (base_format == GL_DEPTH_STENCIL ||
+ base_format == GL_DEPTH_COMPONENT) {
+ return GL_TRUE;
+ }
+ return GL_FALSE;
+ default:
+ _mesa_warning(NULL, "%s: Unexpected channel token 0x%x\n",
+ __FUNCTION__, pname);
+ return GL_FALSE;
+ }
+
+ return GL_FALSE;
+}
void GLAPIENTRY
@@ -981,27 +1045,10 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
*params = img->Border;
break;
case GL_TEXTURE_RED_SIZE:
- if (img->_BaseFormat == GL_RED) {
- *params = _mesa_get_format_bits(texFormat, pname);
- break;
- }
- /* FALLTHROUGH */
case GL_TEXTURE_GREEN_SIZE:
- if (img->_BaseFormat == GL_RG) {
- *params = _mesa_get_format_bits(texFormat, pname);
- break;
- }
- /* FALLTHROUGH */
case GL_TEXTURE_BLUE_SIZE:
- if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA)
- *params = _mesa_get_format_bits(texFormat, pname);
- else
- *params = 0;
- break;
case GL_TEXTURE_ALPHA_SIZE:
- if (img->_BaseFormat == GL_ALPHA ||
- img->_BaseFormat == GL_LUMINANCE_ALPHA ||
- img->_BaseFormat == GL_RGBA)
+ if (base_format_has_channel(img->_BaseFormat, pname))
*params = _mesa_get_format_bits(texFormat, pname);
else
*params = 0;
@@ -1067,46 +1114,18 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
/* GL_ARB_texture_float */
case GL_TEXTURE_RED_TYPE_ARB:
- if (!ctx->Extensions.ARB_texture_float)
- goto invalid_pname;
- *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE) ?
- _mesa_get_format_datatype(texFormat) : GL_NONE;
- break;
case GL_TEXTURE_GREEN_TYPE_ARB:
- if (!ctx->Extensions.ARB_texture_float)
- goto invalid_pname;
- *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE) ?
- _mesa_get_format_datatype(texFormat) : GL_NONE;
- break;
case GL_TEXTURE_BLUE_TYPE_ARB:
- if (!ctx->Extensions.ARB_texture_float)
- goto invalid_pname;
- *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_BLUE_SIZE) ?
- _mesa_get_format_datatype(texFormat) : GL_NONE;
- break;
case GL_TEXTURE_ALPHA_TYPE_ARB:
- if (!ctx->Extensions.ARB_texture_float)
- goto invalid_pname;
- *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_ALPHA_SIZE) ?
- _mesa_get_format_datatype(texFormat) : GL_NONE;
- break;
case GL_TEXTURE_LUMINANCE_TYPE_ARB:
- if (!ctx->Extensions.ARB_texture_float)
- goto invalid_pname;
- *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_LUMINANCE_SIZE) ?
- _mesa_get_format_datatype(texFormat) : GL_NONE;
- break;
case GL_TEXTURE_INTENSITY_TYPE_ARB:
- if (!ctx->Extensions.ARB_texture_float)
- goto invalid_pname;
- *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_INTENSITY_SIZE) ?
- _mesa_get_format_datatype(texFormat) : GL_NONE;
- break;
case GL_TEXTURE_DEPTH_TYPE_ARB:
if (!ctx->Extensions.ARB_texture_float)
goto invalid_pname;
- *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_DEPTH_SIZE) ?
- _mesa_get_format_datatype(texFormat) : GL_NONE;
+ if (base_format_has_channel(img->_BaseFormat, pname))
+ *params = _mesa_get_format_datatype(texFormat);
+ else
+ *params = GL_NONE;
break;
default:
diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c
index 05c1964d6..aae6b4b3b 100644
--- a/mesalib/src/mesa/main/texstore.c
+++ b/mesalib/src/mesa/main/texstore.c
@@ -986,12 +986,17 @@ _mesa_texstore_z32(TEXSTORE_PARAMS)
{
const GLuint depthScale = 0xffffffff;
const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
- const GLenum dstType = _mesa_get_format_datatype(dstFormat);
+ GLenum dstType;
(void) dims;
ASSERT(dstFormat == MESA_FORMAT_Z32 ||
dstFormat == MESA_FORMAT_Z32_FLOAT);
ASSERT(texelBytes == sizeof(GLuint));
+ if (dstFormat == MESA_FORMAT_Z32)
+ dstType = GL_UNSIGNED_INT;
+ else
+ dstType = GL_FLOAT;
+
if (ctx->Pixel.DepthScale == 1.0f &&
ctx->Pixel.DepthBias == 0.0f &&
!srcPacking->SwapBytes &&
diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
index 95805fd3c..912241b35 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -1441,6 +1441,13 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
st_validate_state(st);
+ if (type == GL_DEPTH_STENCIL) {
+ /* XXX make this more efficient */
+ st_CopyPixels(ctx, srcx, srcy, width, height, dstx, dsty, GL_STENCIL);
+ st_CopyPixels(ctx, srcx, srcy, width, height, dstx, dsty, GL_DEPTH);
+ return;
+ }
+
if (type == GL_STENCIL) {
/* can't use texturing to do stencil */
copy_stencil_pixels(ctx, srcx, srcy, width, height, dstx, dsty);
diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
index a351d1197..1e8ec0556 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
@@ -75,8 +75,18 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx,
enum pipe_format format;
struct pipe_surface surf_tmpl;
- format = st_choose_renderbuffer_format(screen, internalFormat,
- rb->NumSamples);
+ if (internalFormat == GL_RGBA16_SNORM && strb->software) {
+ /* Special case for software accum buffers. Otherwise, if the
+ * call to st_choose_renderbuffer_format() fails (because the
+ * driver doesn't support signed 16-bit/channel colors) we'd
+ * just return without allocating the software accum buffer.
+ */
+ format = PIPE_FORMAT_R16G16B16A16_SNORM;
+ }
+ else {
+ format = st_choose_renderbuffer_format(screen, internalFormat,
+ rb->NumSamples);
+ }
if (format == PIPE_FORMAT_NONE) {
return FALSE;
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index 3563e1d9b..25a6cdc75 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -113,14 +113,18 @@ void st_init_limits(struct st_context *st)
1, MAX_DRAW_BUFFERS);
c->MaxLineWidth
- = _maxf(1.0f, screen->get_paramf(screen, PIPE_CAP_MAX_LINE_WIDTH));
+ = _maxf(1.0f, screen->get_paramf(screen,
+ PIPE_CAPF_MAX_LINE_WIDTH));
c->MaxLineWidthAA
- = _maxf(1.0f, screen->get_paramf(screen, PIPE_CAP_MAX_LINE_WIDTH_AA));
+ = _maxf(1.0f, screen->get_paramf(screen,
+ PIPE_CAPF_MAX_LINE_WIDTH_AA));
c->MaxPointSize
- = _maxf(1.0f, screen->get_paramf(screen, PIPE_CAP_MAX_POINT_WIDTH));
+ = _maxf(1.0f, screen->get_paramf(screen,
+ PIPE_CAPF_MAX_POINT_WIDTH));
c->MaxPointSizeAA
- = _maxf(1.0f, screen->get_paramf(screen, PIPE_CAP_MAX_POINT_WIDTH_AA));
+ = _maxf(1.0f, screen->get_paramf(screen,
+ PIPE_CAPF_MAX_POINT_WIDTH_AA));
/* called after _mesa_create_context/_mesa_init_point, fix default user
* settable max point size up
*/
@@ -132,10 +136,11 @@ void st_init_limits(struct st_context *st)
c->MinPointSizeAA = 0.0f;
c->MaxTextureMaxAnisotropy
- = _maxf(2.0f, screen->get_paramf(screen, PIPE_CAP_MAX_TEXTURE_ANISOTROPY));
+ = _maxf(2.0f, screen->get_paramf(screen,
+ PIPE_CAPF_MAX_TEXTURE_ANISOTROPY));
c->MaxTextureLodBias
- = screen->get_paramf(screen, PIPE_CAP_MAX_TEXTURE_LOD_BIAS);
+ = screen->get_paramf(screen, PIPE_CAPF_MAX_TEXTURE_LOD_BIAS);
c->MaxDrawBuffers
= CLAMP(screen->get_param(screen, PIPE_CAP_MAX_RENDER_TARGETS),
@@ -213,15 +218,10 @@ void st_init_limits(struct st_context *st)
c->MaxVarying = screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT, PIPE_SHADER_CAP_MAX_INPUTS) - 2;
c->MaxVarying = MIN2(c->MaxVarying, MAX_VARYING);
- /* XXX we'll need a better query here someday */
- if (screen->get_param(screen, PIPE_CAP_GLSL)) {
- c->MinProgramTexelOffset = screen->get_param(screen, PIPE_CAP_MIN_TEXEL_OFFSET);
- c->MaxProgramTexelOffset = screen->get_param(screen, PIPE_CAP_MAX_TEXEL_OFFSET);
+ c->MinProgramTexelOffset = screen->get_param(screen, PIPE_CAP_MIN_TEXEL_OFFSET);
+ c->MaxProgramTexelOffset = screen->get_param(screen, PIPE_CAP_MAX_TEXEL_OFFSET);
- c->GLSLVersion = 120;
- _mesa_override_glsl_version(st->ctx);
- c->UniformBooleanTrue = ~0;
- }
+ c->UniformBooleanTrue = ~0;
c->StripTextureBorder = GL_TRUE;
}
@@ -249,16 +249,23 @@ void st_init_extensions(struct st_context *st)
struct gl_context *ctx = st->ctx;
int i;
+ ctx->Const.GLSLVersion = 120;
+ _mesa_override_glsl_version(st->ctx);
+
/*
* Extensions that are supported by all Gallium drivers:
*/
ctx->Extensions.ARB_copy_buffer = GL_TRUE;
ctx->Extensions.ARB_draw_elements_base_vertex = GL_TRUE;
+ ctx->Extensions.ARB_explicit_attrib_location = GL_TRUE;
ctx->Extensions.ARB_fragment_coord_conventions = GL_TRUE;
ctx->Extensions.ARB_fragment_program = GL_TRUE;
+ ctx->Extensions.ARB_fragment_shader = GL_TRUE;
ctx->Extensions.ARB_half_float_pixel = GL_TRUE;
ctx->Extensions.ARB_map_buffer_range = GL_TRUE;
ctx->Extensions.ARB_sampler_objects = GL_TRUE;
+ ctx->Extensions.ARB_shader_objects = GL_TRUE;
+ ctx->Extensions.ARB_shading_language_100 = GL_TRUE;
ctx->Extensions.ARB_texture_border_clamp = GL_TRUE; /* XXX temp */
ctx->Extensions.ARB_texture_cube_map = GL_TRUE;
ctx->Extensions.ARB_texture_env_combine = GL_TRUE;
@@ -267,6 +274,7 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.ARB_texture_storage = GL_TRUE;
ctx->Extensions.ARB_vertex_array_object = GL_TRUE;
ctx->Extensions.ARB_vertex_program = GL_TRUE;
+ ctx->Extensions.ARB_vertex_shader = GL_TRUE;
ctx->Extensions.ARB_window_pos = GL_TRUE;
ctx->Extensions.EXT_blend_color = GL_TRUE;
@@ -281,6 +289,7 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.EXT_point_parameters = GL_TRUE;
ctx->Extensions.EXT_provoking_vertex = GL_TRUE;
ctx->Extensions.EXT_secondary_color = GL_TRUE;
+ ctx->Extensions.EXT_separate_shader_objects = GL_TRUE;
ctx->Extensions.EXT_texture_env_dot3 = GL_TRUE;
ctx->Extensions.EXT_vertex_array_bgra = GL_TRUE;
@@ -317,15 +326,6 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.EXT_texture_swizzle = GL_TRUE;
}
- if (screen->get_param(screen, PIPE_CAP_GLSL)) {
- ctx->Extensions.ARB_fragment_shader = GL_TRUE;
- ctx->Extensions.ARB_vertex_shader = GL_TRUE;
- ctx->Extensions.ARB_shader_objects = GL_TRUE;
- ctx->Extensions.ARB_shading_language_100 = GL_TRUE;
- ctx->Extensions.ARB_explicit_attrib_location = GL_TRUE;
- ctx->Extensions.EXT_separate_shader_objects = GL_TRUE;
- }
-
if (screen->get_param(screen, PIPE_CAP_BLEND_EQUATION_SEPARATE)) {
ctx->Extensions.EXT_blend_equation_separate = GL_TRUE;
}
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 929c7af01..74b8fa7c7 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4803,6 +4803,8 @@ get_mesa_program(struct gl_context *ctx,
{
glsl_to_tgsi_visitor* v = new glsl_to_tgsi_visitor();
struct gl_program *prog;
+ struct pipe_screen * screen = st_context(ctx)->pipe->screen;
+ unsigned pipe_shader_type;
GLenum target;
const char *target_string;
bool progress;
@@ -4813,14 +4815,17 @@ get_mesa_program(struct gl_context *ctx,
case GL_VERTEX_SHADER:
target = GL_VERTEX_PROGRAM_ARB;
target_string = "vertex";
+ pipe_shader_type = PIPE_SHADER_VERTEX;
break;
case GL_FRAGMENT_SHADER:
target = GL_FRAGMENT_PROGRAM_ARB;
target_string = "fragment";
+ pipe_shader_type = PIPE_SHADER_FRAGMENT;
break;
case GL_GEOMETRY_SHADER:
target = GL_GEOMETRY_PROGRAM_NV;
target_string = "geometry";
+ pipe_shader_type = PIPE_SHADER_GEOMETRY;
break;
default:
assert(!"should not be reached");
@@ -4889,10 +4894,13 @@ get_mesa_program(struct gl_context *ctx,
}
#endif
- /* Remove reads to output registers, and to varyings in vertex shaders. */
- v->remove_output_reads(PROGRAM_OUTPUT);
- if (target == GL_VERTEX_PROGRAM_ARB)
- v->remove_output_reads(PROGRAM_VARYING);
+ if (!screen->get_shader_param(screen, pipe_shader_type,
+ PIPE_SHADER_CAP_OUTPUT_READ)) {
+ /* Remove reads to output registers, and to varyings in vertex shaders. */
+ v->remove_output_reads(PROGRAM_OUTPUT);
+ if (target == GL_VERTEX_PROGRAM_ARB)
+ v->remove_output_reads(PROGRAM_VARYING);
+ }
/* Perform optimizations on the instructions in the glsl_to_tgsi_visitor. */
v->simplify_cmp();
diff --git a/mesalib/src/mesa/swrast/s_texcombine.c b/mesalib/src/mesa/swrast/s_texcombine.c
index a7cbb4424..1fce5c565 100644
--- a/mesalib/src/mesa/swrast/s_texcombine.c
+++ b/mesalib/src/mesa/swrast/s_texcombine.c
@@ -69,17 +69,18 @@ get_texel_array(SWcontext *swrast, GLuint unit)
*
* \param ctx rendering context
* \param unit the texture combiner unit
- * \param n number of fragments to process (span width)
* \param primary_rgba incoming fragment color array
* \param texelBuffer pointer to texel colors for all texture units
*
- * \param rgba incoming/result fragment colors
+ * \param span two fields are used in this function:
+ * span->end: number of fragments to process
+ * span->array->rgba: incoming/result fragment colors
*/
static void
-texture_combine( struct gl_context *ctx, GLuint unit, GLuint n,
+texture_combine( struct gl_context *ctx, GLuint unit,
const float4_array primary_rgba,
const GLfloat *texelBuffer,
- GLchan (*rgbaChan)[4] )
+ SWspan *span )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
const struct gl_texture_unit *textureUnit = &(ctx->Texture.Unit[unit]);
@@ -92,6 +93,8 @@ texture_combine( struct gl_context *ctx, GLuint unit, GLuint n,
const GLuint numArgsA = combine->_NumArgsA;
float4_array ccolor[4], rgba;
GLuint i, term;
+ GLuint n = span->end;
+ GLchan (*rgbaChan)[4] = span->array->rgba;
/* alloc temp pixel buffers */
rgba = (float4_array) malloc(4 * n * sizeof(GLfloat));
@@ -542,6 +545,10 @@ texture_combine( struct gl_context *ctx, GLuint unit, GLuint n,
UNCLAMPED_FLOAT_TO_CHAN(rgbaChan[i][BCOMP], rgba[i][BCOMP]);
UNCLAMPED_FLOAT_TO_CHAN(rgbaChan[i][ACOMP], rgba[i][ACOMP]);
}
+ /* The span->array->rgba values are of CHAN type so set
+ * span->array->ChanType field accordingly.
+ */
+ span->array->ChanType = CHAN_TYPE;
end:
for (i = 0; i < numArgsRGB || i < numArgsA; i++) {
@@ -764,12 +771,8 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span )
* We modify the span->color.rgba values.
*/
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
- if (ctx->Texture.Unit[unit]._ReallyEnabled) {
- texture_combine( ctx, unit, span->end,
- primary_rgba,
- swrast->TexelBuffer,
- span->array->rgba );
- }
+ if (ctx->Texture.Unit[unit]._ReallyEnabled)
+ texture_combine(ctx, unit, primary_rgba, swrast->TexelBuffer, span);
}
free(primary_rgba);
diff --git a/mesalib/src/mesa/vbo/vbo_noop.h b/mesalib/src/mesa/vbo/vbo_noop.h
index f9180374f..92f61d356 100644
--- a/mesalib/src/mesa/vbo/vbo_noop.h
+++ b/mesalib/src/mesa/vbo/vbo_noop.h
@@ -38,6 +38,12 @@ _mesa_noop_vtxfmt_init(GLvertexformat *vfmt);
extern GLboolean
_mesa_using_noop_vtxfmt(const struct _glapi_table *dispatch);
+#else
+
+static inline void
+_mesa_noop_vtxfmt_init(GLvertexformat *vfmt)
+{
+}
#endif /* FEATURE_beginend */