aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/drivers/common/meta.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-12-03 09:16:19 +0100
committermarha <marha@users.sourceforge.net>2012-12-03 09:16:19 +0100
commit17464545a9abdd19312065a578d1f69a6b0b015f (patch)
treed39fde94a445ddde95399d4850ffbbbd357a3a19 /mesalib/src/mesa/drivers/common/meta.c
parenteba14241fe23d0561687a1e530a57fa0bfc6ab69 (diff)
parentb8da71ffb17d3d16706db04115e9ba1dd8bc49b9 (diff)
downloadvcxsrv-17464545a9abdd19312065a578d1f69a6b0b015f.tar.gz
vcxsrv-17464545a9abdd19312065a578d1f69a6b0b015f.tar.bz2
vcxsrv-17464545a9abdd19312065a578d1f69a6b0b015f.zip
Merge remote-tracking branch 'origin/released'
* origin/released: fontconfig mesa xserver pixman xkeyboard-config git update 3 dec 2012
Diffstat (limited to 'mesalib/src/mesa/drivers/common/meta.c')
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c51
1 files changed, 30 insertions, 21 deletions
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index 7d58281c1..d5e8af3c0 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -567,7 +567,7 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
save->PolygonCull = ctx->Polygon.CullFlag;
_mesa_PolygonMode(GL_FRONT_AND_BACK, GL_FILL);
_mesa_set_enable(ctx, GL_POLYGON_OFFSET_FILL, GL_FALSE);
- if (ctx->API == API_OPENGL) {
+ if (ctx->API == API_OPENGL_COMPAT) {
_mesa_set_enable(ctx, GL_POLYGON_SMOOTH, GL_FALSE);
_mesa_set_enable(ctx, GL_POLYGON_STIPPLE, GL_FALSE);
}
@@ -580,14 +580,14 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
}
if (state & MESA_META_SHADER) {
- if (ctx->API == API_OPENGL && ctx->Extensions.ARB_vertex_program) {
+ if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_vertex_program) {
save->VertexProgramEnabled = ctx->VertexProgram.Enabled;
_mesa_reference_vertprog(ctx, &save->VertexProgram,
ctx->VertexProgram.Current);
_mesa_set_enable(ctx, GL_VERTEX_PROGRAM_ARB, GL_FALSE);
}
- if (ctx->API == API_OPENGL && ctx->Extensions.ARB_fragment_program) {
+ if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_fragment_program) {
save->FragmentProgramEnabled = ctx->FragmentProgram.Enabled;
_mesa_reference_fragprog(ctx, &save->FragmentProgram,
ctx->FragmentProgram.Current);
@@ -623,7 +623,7 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
save->EnvMode = ctx->Texture.Unit[0].EnvMode;
/* Disable all texture units */
- if (ctx->API == API_OPENGL || ctx->API == API_OPENGLES) {
+ if (ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGLES) {
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
save->TexEnabled[u] = ctx->Texture.Unit[u].Enabled;
save->TexGenEnabled[u] = ctx->Texture.Unit[u].TexGenEnabled;
@@ -636,7 +636,7 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
if (ctx->Extensions.OES_EGL_image_external)
_mesa_set_enable(ctx, GL_TEXTURE_EXTERNAL_OES, GL_FALSE);
- if (ctx->API == API_OPENGL) {
+ if (ctx->API == API_OPENGL_COMPAT) {
_mesa_set_enable(ctx, GL_TEXTURE_1D, GL_FALSE);
_mesa_set_enable(ctx, GL_TEXTURE_3D, GL_FALSE);
if (ctx->Extensions.NV_texture_rectangle)
@@ -661,7 +661,7 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
/* set defaults for unit[0] */
_mesa_ActiveTexture(GL_TEXTURE0);
_mesa_ClientActiveTexture(GL_TEXTURE0);
- if (ctx->API == API_OPENGL || ctx->API == API_OPENGLES) {
+ if (ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGLES) {
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
}
}
@@ -684,11 +684,9 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
_mesa_LoadIdentity();
_mesa_MatrixMode(GL_PROJECTION);
_mesa_LoadIdentity();
- if (ctx->DrawBuffer->Initialized) {
- _mesa_Ortho(0.0, ctx->DrawBuffer->Width,
- 0.0, ctx->DrawBuffer->Height,
- -1.0, 1.0);
- }
+ _mesa_Ortho(0.0, ctx->DrawBuffer->Width,
+ 0.0, ctx->DrawBuffer->Height,
+ -1.0, 1.0);
}
if (state & MESA_META_CLIP) {
@@ -885,7 +883,7 @@ _mesa_meta_end(struct gl_context *ctx)
_mesa_PolygonMode(GL_FRONT, save->FrontPolygonMode);
_mesa_PolygonMode(GL_BACK, save->BackPolygonMode);
}
- if (ctx->API == API_OPENGL) {
+ if (ctx->API == API_OPENGL_COMPAT) {
_mesa_set_enable(ctx, GL_POLYGON_STIPPLE, save->PolygonStipple);
_mesa_set_enable(ctx, GL_POLYGON_SMOOTH, save->PolygonSmooth);
}
@@ -900,7 +898,7 @@ _mesa_meta_end(struct gl_context *ctx)
}
if (state & MESA_META_SHADER) {
- if (ctx->API == API_OPENGL && ctx->Extensions.ARB_vertex_program) {
+ if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_vertex_program) {
_mesa_set_enable(ctx, GL_VERTEX_PROGRAM_ARB,
save->VertexProgramEnabled);
_mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
@@ -908,7 +906,7 @@ _mesa_meta_end(struct gl_context *ctx)
_mesa_reference_vertprog(ctx, &save->VertexProgram, NULL);
}
- if (ctx->API == API_OPENGL && ctx->Extensions.ARB_fragment_program) {
+ if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_fragment_program) {
_mesa_set_enable(ctx, GL_FRAGMENT_PROGRAM_ARB,
save->FragmentProgramEnabled);
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
@@ -941,7 +939,7 @@ _mesa_meta_end(struct gl_context *ctx)
_mesa_set_enable(ctx, GL_STENCIL_TEST, stencil->Enabled);
_mesa_ClearStencil(stencil->Clear);
- if (ctx->API == API_OPENGL && ctx->Extensions.EXT_stencil_two_side) {
+ if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.EXT_stencil_two_side) {
_mesa_set_enable(ctx, GL_STENCIL_TEST_TWO_SIDE_EXT,
stencil->TestTwoSide);
_mesa_ActiveStencilFaceEXT(stencil->ActiveFace
@@ -973,7 +971,7 @@ _mesa_meta_end(struct gl_context *ctx)
ASSERT(ctx->Texture.CurrentUnit == 0);
/* restore texenv for unit[0] */
- if (ctx->API == API_OPENGL || ctx->API == API_OPENGLES) {
+ if (ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGLES) {
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, save->EnvMode);
}
@@ -988,7 +986,7 @@ _mesa_meta_end(struct gl_context *ctx)
}
/* Restore fixed function texture enables, texgen */
- if (ctx->API == API_OPENGL || ctx->API == API_OPENGLES) {
+ if (ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGLES) {
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
if (ctx->Texture.Unit[u].Enabled != save->TexEnabled[u]) {
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
@@ -3268,7 +3266,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
_mesa_BindFramebuffer(GL_FRAMEBUFFER_EXT, mipmap->FBO);
- if (ctx->API == API_OPENGL || ctx->API == API_OPENGLES)
+ if (ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGLES)
_mesa_TexParameteri(target, GL_GENERATE_MIPMAP, GL_FALSE);
else
assert(!genMipmapSave);
@@ -3687,6 +3685,7 @@ decompress_texture_image(struct gl_context *ctx,
/* read pixels from renderbuffer */
{
GLenum baseTexFormat = texImage->_BaseFormat;
+ GLenum destBaseFormat = _mesa_base_tex_format(ctx, destFormat);
/* The pixel transfer state will be set to default values at this point
* (see MESA_META_PIXEL_TRANSFER) so pixel transfer ops are effectively
@@ -3695,9 +3694,19 @@ decompress_texture_image(struct gl_context *ctx,
* returned as red and two-channel texture values are returned as
* red/alpha.
*/
- if (baseTexFormat == GL_LUMINANCE ||
- baseTexFormat == GL_LUMINANCE_ALPHA ||
- baseTexFormat == GL_INTENSITY) {
+ if ((baseTexFormat == GL_LUMINANCE ||
+ baseTexFormat == GL_LUMINANCE_ALPHA ||
+ baseTexFormat == GL_INTENSITY) ||
+ /* If we're reading back an RGB(A) texture (using glGetTexImage) as
+ * luminance then we need to return L=tex(R).
+ */
+ ((baseTexFormat == GL_RGBA ||
+ baseTexFormat == GL_RGB ||
+ baseTexFormat == GL_RG) &&
+ (destBaseFormat == GL_LUMINANCE ||
+ destBaseFormat == GL_LUMINANCE_ALPHA ||
+ destBaseFormat == GL_LUMINANCE_INTEGER_EXT ||
+ destBaseFormat == GL_LUMINANCE_ALPHA_INTEGER_EXT))) {
/* Green and blue must be zero */
_mesa_PixelTransferf(GL_GREEN_SCALE, 0.0f);
_mesa_PixelTransferf(GL_BLUE_SCALE, 0.0f);