aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r--mesalib/src/mesa/main/fbobject.c42
-rw-r--r--mesalib/src/mesa/main/shaderapi.c36
-rw-r--r--mesalib/src/mesa/main/shaderobj.c2
-rw-r--r--mesalib/src/mesa/main/texcompress_s3tc.c4
-rw-r--r--mesalib/src/mesa/main/transformfeedback.c4
5 files changed, 58 insertions, 30 deletions
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c
index 223aef18d..891ec5dce 100644
--- a/mesalib/src/mesa/main/fbobject.c
+++ b/mesalib/src/mesa/main/fbobject.c
@@ -2799,11 +2799,41 @@ get_nongeneric_internalformat(GLenum format)
}
+static GLenum
+get_linear_internalformat(GLenum format)
+{
+ switch (format) {
+ case GL_SRGB:
+ return GL_RGB;
+
+ case GL_SRGB_ALPHA:
+ return GL_RGBA;
+
+ case GL_SRGB8:
+ return GL_RGB8;
+
+ case GL_SRGB8_ALPHA8:
+ return GL_RGBA8;
+
+ case GL_SLUMINANCE:
+ return GL_LUMINANCE8;
+
+ case GL_SLUMINANCE_ALPHA:
+ return GL_LUMINANCE8_ALPHA8;
+
+ default:
+ return format;
+ }
+}
+
+
static GLboolean
compatible_resolve_formats(const struct gl_renderbuffer *colorReadRb,
const struct gl_renderbuffer *colorDrawRb)
{
- /* The simple case where we know the backing formats are the same.
+ GLenum readFormat, drawFormat;
+
+ /* The simple case where we know the backing Mesa formats are the same.
*/
if (_mesa_get_srgb_format_linear(colorReadRb->Format) ==
_mesa_get_srgb_format_linear(colorDrawRb->Format)) {
@@ -2817,9 +2847,15 @@ compatible_resolve_formats(const struct gl_renderbuffer *colorReadRb,
* textures and get two entirely different Mesa formats like RGBA8888 and
* ARGB8888. Drivers behaving like that should be able to cope with
* non-matching formats by themselves, because it's not the user's fault.
+ *
+ * Blits between linear and sRGB formats are also allowed.
*/
- if (get_nongeneric_internalformat(colorReadRb->InternalFormat) ==
- get_nongeneric_internalformat(colorDrawRb->InternalFormat)) {
+ readFormat = get_nongeneric_internalformat(colorReadRb->InternalFormat);
+ drawFormat = get_nongeneric_internalformat(colorDrawRb->InternalFormat);
+ readFormat = get_linear_internalformat(readFormat);
+ drawFormat = get_linear_internalformat(drawFormat);
+
+ if (readFormat == drawFormat) {
return GL_TRUE;
}
diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c
index 727115015..5c0a923e4 100644
--- a/mesalib/src/mesa/main/shaderapi.c
+++ b/mesalib/src/mesa/main/shaderapi.c
@@ -180,25 +180,6 @@ validate_shader_target(const struct gl_context *ctx, GLenum type)
}
-/**
- * Find the length of the longest transform feedback varying name
- * which was specified with glTransformFeedbackVaryings().
- */
-static GLint
-longest_feedback_varying_name(const struct gl_shader_program *shProg)
-{
- GLuint i;
- GLint max = 0;
- for (i = 0; i < shProg->TransformFeedback.NumVarying; i++) {
- GLint len = strlen(shProg->TransformFeedback.VaryingNames[i]);
- if (len > max)
- max = len;
- }
- return max;
-}
-
-
-
static GLboolean
is_program(struct gl_context *ctx, GLuint name)
{
@@ -538,11 +519,24 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param
break;
*params = shProg->TransformFeedback.NumVarying;
return;
- case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH:
+ case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH: {
+ unsigned i;
+ GLint max_len = 0;
if (!has_xfb)
break;
- *params = longest_feedback_varying_name(shProg) + 1;
+
+ for (i = 0; i < shProg->TransformFeedback.NumVarying; i++) {
+ /* Add one for the terminating NUL character.
+ */
+ const GLint len = strlen(shProg->TransformFeedback.VaryingNames[i]) + 1;
+
+ if (len > max_len)
+ max_len = len;
+ }
+
+ *params = max_len;
return;
+ }
case GL_TRANSFORM_FEEDBACK_BUFFER_MODE:
if (!has_xfb)
break;
diff --git a/mesalib/src/mesa/main/shaderobj.c b/mesalib/src/mesa/main/shaderobj.c
index 1706cac55..59daff5bf 100644
--- a/mesalib/src/mesa/main/shaderobj.c
+++ b/mesalib/src/mesa/main/shaderobj.c
@@ -247,6 +247,8 @@ _mesa_init_shader_program(struct gl_context *ctx, struct gl_shader_program *prog
prog->Geom.InputType = GL_TRIANGLES;
prog->Geom.OutputType = GL_TRIANGLE_STRIP;
+ prog->TransformFeedback.BufferMode = GL_INTERLEAVED_ATTRIBS;
+
prog->InfoLog = ralloc_strdup(prog, "");
}
diff --git a/mesalib/src/mesa/main/texcompress_s3tc.c b/mesalib/src/mesa/main/texcompress_s3tc.c
index 6476f118e..da7725964 100644
--- a/mesalib/src/mesa/main/texcompress_s3tc.c
+++ b/mesalib/src/mesa/main/texcompress_s3tc.c
@@ -362,7 +362,6 @@ static void
fetch_texel_2d_rgb_dxt1(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLubyte *texel)
{
- (void) k;
if (fetch_ext_rgb_dxt1) {
GLint sliceOffset = k ? texImage->ImageOffsets[k] / 2 : 0;
fetch_ext_rgb_dxt1(texImage->RowStride,
@@ -391,7 +390,6 @@ static void
fetch_texel_2d_rgba_dxt1(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLubyte *texel)
{
- (void) k;
if (fetch_ext_rgba_dxt1) {
GLint sliceOffset = k ? texImage->ImageOffsets[k] / 2 : 0;
fetch_ext_rgba_dxt1(texImage->RowStride,
@@ -420,7 +418,6 @@ static void
fetch_texel_2d_rgba_dxt3(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLubyte *texel)
{
- (void) k;
if (fetch_ext_rgba_dxt3) {
GLint sliceOffset = k ? texImage->ImageOffsets[k] : 0;
fetch_ext_rgba_dxt3(texImage->RowStride,
@@ -449,7 +446,6 @@ static void
fetch_texel_2d_rgba_dxt5(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLubyte *texel)
{
- (void) k;
if (fetch_ext_rgba_dxt5) {
GLint sliceOffset = k ? texImage->ImageOffsets[k] : 0;
fetch_ext_rgba_dxt5(texImage->RowStride,
diff --git a/mesalib/src/mesa/main/transformfeedback.c b/mesalib/src/mesa/main/transformfeedback.c
index e0dd4e886..22060c34c 100644
--- a/mesalib/src/mesa/main/transformfeedback.c
+++ b/mesalib/src/mesa/main/transformfeedback.c
@@ -622,14 +622,14 @@ _mesa_GetTransformFeedbackVarying(GLuint program, GLuint index,
shProg = _mesa_lookup_shader_program(ctx, program);
if (!shProg) {
_mesa_error(ctx, GL_INVALID_VALUE,
- "glGetTransformFeedbackVaryings(program=%u)", program);
+ "glGetTransformFeedbackVarying(program=%u)", program);
return;
}
linked_xfb_info = &shProg->LinkedTransformFeedback;
if (index >= (GLuint) linked_xfb_info->NumVarying) {
_mesa_error(ctx, GL_INVALID_VALUE,
- "glGetTransformFeedbackVaryings(index=%u)", index);
+ "glGetTransformFeedbackVarying(index=%u)", index);
return;
}