summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/SConscript4
-rw-r--r--src/mesa/drivers/dri/i915/i915_program.c13
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_draw.c197
-rw-r--r--src/mesa/main/context.c1
-rw-r--r--src/mesa/main/ffvertex_prog.c70
-rw-r--r--src/mesa/main/mtypes.h2
-rw-r--r--src/mesa/main/state.c29
-rw-r--r--src/mesa/main/state.h17
-rw-r--r--src/mesa/main/texenvprogram.c14
-rw-r--r--src/mesa/ppc/common_ppc.c2
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c6
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c4
12 files changed, 314 insertions, 45 deletions
diff --git a/src/mesa/SConscript b/src/mesa/SConscript
index af8dfcb4930..89b98b37ab0 100644
--- a/src/mesa/SConscript
+++ b/src/mesa/SConscript
@@ -283,6 +283,10 @@ if env['platform'] != 'winddk':
'x86-64/glapi_x86-64.S'
]
elif gcc and env['machine'] == 'ppc':
+ env.Append(CPPDEFINES = [
+ 'USE_PPC_ASM',
+ 'USE_VMX_ASM',
+ ])
mesa_sources += [
'ppc/common_ppc.c',
]
diff --git a/src/mesa/drivers/dri/i915/i915_program.c b/src/mesa/drivers/dri/i915/i915_program.c
index 350da5e1697..e87700f8e0a 100644
--- a/src/mesa/drivers/dri/i915/i915_program.c
+++ b/src/mesa/drivers/dri/i915/i915_program.c
@@ -245,6 +245,19 @@ GLuint i915_emit_texld( struct i915_fragment_program *p,
*/
assert(GET_UREG_TYPE(coord) != REG_TYPE_U);
+ if ((GET_UREG_TYPE(coord) != REG_TYPE_R) &&
+ (GET_UREG_TYPE(coord) != REG_TYPE_OC) &&
+ (GET_UREG_TYPE(coord) != REG_TYPE_OD) &&
+ (GET_UREG_TYPE(coord) != REG_TYPE_T)) {
+ GLuint tmpCoord = get_free_rreg(p, live_regs);
+
+ if (tmpCoord == UREG_BAD)
+ return 0;
+
+ i915_emit_arith(p, A0_MOV, tmpCoord, A0_DEST_CHANNEL_ALL, 0, coord, 0, 0);
+ coord = tmpCoord;
+ }
+
/* Output register being oC or oD defines a phase boundary */
if (GET_UREG_TYPE(dest) == REG_TYPE_OC ||
GET_UREG_TYPE(dest) == REG_TYPE_OD)
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c
index b60dad74601..50518a68792 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c
@@ -40,6 +40,12 @@
#include "main/varray.h"
#include "main/attrib.h"
#include "main/enable.h"
+#include "main/buffers.h"
+#include "main/fbobject.h"
+#include "main/renderbuffer.h"
+#include "main/depth.h"
+#include "main/hash.h"
+#include "main/blend.h"
#include "glapi/dispatch.h"
#include "swrast/swrast.h"
@@ -51,7 +57,7 @@
#include "intel_regions.h"
#include "intel_pixel.h"
#include "intel_buffer_objects.h"
-
+#include "intel_fbo.h"
static GLboolean
intel_texture_drawpixels(GLcontext * ctx,
@@ -89,6 +95,15 @@ intel_texture_drawpixels(GLcontext * ctx,
if (format == GL_STENCIL_INDEX)
return GL_FALSE;
+ /* Check that we can load in a texture this big. */
+ if (width > (1 << (ctx->Const.MaxTextureLevels - 1)) ||
+ height > (1 << (ctx->Const.MaxTextureLevels - 1))) {
+ if (INTEL_DEBUG & DEBUG_FALLBACKS)
+ fprintf(stderr, "glDrawPixels() fallback: bitmap too large (%dx%d)\n",
+ width, height);
+ return GL_FALSE;
+ }
+
/* To do DEPTH_COMPONENT, we would need to change our setup to not draw to
* the color buffer, and sample the texture values into the fragment depth
* in a program.
@@ -170,6 +185,182 @@ intel_texture_drawpixels(GLcontext * ctx,
return GL_TRUE;
}
+static GLboolean
+intel_stencil_drawpixels(GLcontext * ctx,
+ GLint x, GLint y,
+ GLsizei width, GLsizei height,
+ GLenum format,
+ GLenum type,
+ const struct gl_pixelstore_attrib *unpack,
+ const GLvoid *pixels)
+{
+ GLuint texname, rb_name, fb_name, old_fb_name;
+ GLfloat vertices[4][2];
+ GLfloat texcoords[4][2];
+ struct intel_renderbuffer *irb;
+ struct intel_renderbuffer *depth_irb;
+ struct gl_renderbuffer *rb;
+ struct gl_pixelstore_attrib old_unpack;
+ GLstencil *stencil_pixels;
+ int row;
+
+ if (format != GL_STENCIL_INDEX)
+ return GL_FALSE;
+
+ /* If there's nothing to write, we're done. */
+ if (ctx->Stencil.WriteMask[0] == 0)
+ return GL_TRUE;
+
+ /* Can't do a per-bit writemask while treating stencil as rgba data. */
+ if ((ctx->Stencil.WriteMask[0] & 0xff) != 0xff)
+ return GL_FALSE;
+
+ /* We use FBOs for our wrapping of the depthbuffer into a color
+ * destination.
+ */
+ if (!ctx->Extensions.EXT_framebuffer_object)
+ return GL_FALSE;
+
+ /* We're going to mess with texturing with no regard to existing texture
+ * state, so if there is some set up we have to bail.
+ */
+ if (ctx->Texture._EnabledUnits != 0)
+ return GL_FALSE;
+
+ /* Can't do textured DrawPixels with a fragment program, unless we were
+ * to generate a new program that sampled our texture and put the results
+ * in the fragment color before the user's program started.
+ */
+ if (ctx->FragmentProgram.Enabled)
+ return GL_FALSE;
+
+ /* Check that we can load in a texture this big. */
+ if (width > (1 << (ctx->Const.MaxTextureLevels - 1)) ||
+ height > (1 << (ctx->Const.MaxTextureLevels - 1))) {
+ if (INTEL_DEBUG & DEBUG_FALLBACKS)
+ fprintf(stderr, "glDrawPixels(STENCIL_IDNEX) fallback: "
+ "bitmap too large (%dx%d)\n",
+ width, height);
+ return GL_FALSE;
+ }
+
+ _mesa_PushAttrib(GL_ENABLE_BIT | GL_TRANSFORM_BIT | GL_TEXTURE_BIT |
+ GL_CURRENT_BIT | GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ _mesa_PushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
+ old_fb_name = ctx->DrawBuffer->Name;
+
+ _mesa_Disable(GL_POLYGON_STIPPLE);
+ _mesa_Disable(GL_DEPTH_TEST);
+ _mesa_Disable(GL_STENCIL_TEST);
+
+ /* Unpack the supplied stencil values into a ubyte buffer. */
+ assert(sizeof(GLstencil) == sizeof(GLubyte));
+ stencil_pixels = _mesa_malloc(width * height * sizeof(GLstencil));
+ for (row = 0; row < height; row++) {
+ GLvoid *source = _mesa_image_address2d(unpack, pixels,
+ width, height,
+ GL_COLOR_INDEX, type,
+ row, 0);
+ _mesa_unpack_stencil_span(ctx, width, GL_UNSIGNED_BYTE,
+ stencil_pixels +
+ row * width * sizeof(GLstencil),
+ type, source, unpack, ctx->_ImageTransferState);
+ }
+
+ /* Take the current depth/stencil renderbuffer, and make a new one wrapping
+ * it which will be treated as GL_RGBA8 so we can render to it as a color
+ * buffer.
+ */
+ depth_irb = intel_get_renderbuffer(ctx->DrawBuffer, BUFFER_DEPTH);
+ irb = intel_create_renderbuffer(GL_RGBA8);
+ rb = &irb->Base;
+ irb->Base.Width = depth_irb->Base.Width;
+ irb->Base.Height = depth_irb->Base.Height;
+ intel_renderbuffer_set_region(irb, depth_irb->region);
+
+ /* Create a name for our renderbuffer, which lets us use other mesa
+ * rb functions for convenience.
+ */
+ _mesa_GenRenderbuffersEXT(1, &rb_name);
+ irb->Base.RefCount++;
+ _mesa_HashInsert(ctx->Shared->RenderBuffers, rb_name, &irb->Base);
+
+ /* Bind the new renderbuffer to the color attachment point. */
+ _mesa_GenFramebuffersEXT(1, &fb_name);
+ _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb_name);
+ _mesa_FramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
+ GL_COLOR_ATTACHMENT0_EXT,
+ GL_RENDERBUFFER_EXT,
+ rb_name);
+ /* Choose to render to the color attachment. */
+ _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
+
+ _mesa_DepthMask(GL_FALSE);
+ _mesa_ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
+
+ _mesa_ActiveTextureARB(GL_TEXTURE0_ARB);
+ _mesa_Enable(GL_TEXTURE_2D);
+ _mesa_GenTextures(1, &texname);
+ _mesa_BindTexture(GL_TEXTURE_2D, texname);
+ _mesa_TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ _mesa_TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ _mesa_TexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
+ old_unpack = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
+ _mesa_TexImage2D(GL_TEXTURE_2D, 0, GL_INTENSITY, width, height, 0,
+ GL_RED, GL_UNSIGNED_BYTE, stencil_pixels);
+ ctx->Unpack = old_unpack;
+ _mesa_free(stencil_pixels);
+
+ _mesa_MatrixMode(GL_PROJECTION);
+ _mesa_PushMatrix();
+ _mesa_LoadIdentity();
+ _mesa_Ortho(0, ctx->DrawBuffer->Width, 0, ctx->DrawBuffer->Height, 1, -1);
+
+ _mesa_MatrixMode(GL_MODELVIEW);
+ _mesa_PushMatrix();
+ _mesa_LoadIdentity();
+
+ vertices[0][0] = x;
+ vertices[0][1] = y;
+ vertices[1][0] = x + width * ctx->Pixel.ZoomX;
+ vertices[1][1] = y;
+ vertices[2][0] = x + width * ctx->Pixel.ZoomX;
+ vertices[2][1] = y + height * ctx->Pixel.ZoomY;
+ vertices[3][0] = x;
+ vertices[3][1] = y + height * ctx->Pixel.ZoomY;
+
+ texcoords[0][0] = 0.0;
+ texcoords[0][1] = 0.0;
+ texcoords[1][0] = 1.0;
+ texcoords[1][1] = 0.0;
+ texcoords[2][0] = 1.0;
+ texcoords[2][1] = 1.0;
+ texcoords[3][0] = 0.0;
+ texcoords[3][1] = 1.0;
+
+ _mesa_VertexPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), &vertices);
+ _mesa_TexCoordPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), &texcoords);
+ _mesa_Enable(GL_VERTEX_ARRAY);
+ _mesa_Enable(GL_TEXTURE_COORD_ARRAY);
+ CALL_DrawArrays(ctx->Exec, (GL_TRIANGLE_FAN, 0, 4));
+
+ _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, old_fb_name);
+
+ _mesa_MatrixMode(GL_PROJECTION);
+ _mesa_PopMatrix();
+ _mesa_MatrixMode(GL_MODELVIEW);
+ _mesa_PopMatrix();
+ _mesa_PopClientAttrib();
+ _mesa_PopAttrib();
+
+ _mesa_DeleteTextures(1, &texname);
+ _mesa_DeleteFramebuffersEXT(1, &fb_name);
+ _mesa_DeleteRenderbuffersEXT(1, &rb_name);
+
+ return GL_TRUE;
+}
+
void
intelDrawPixels(GLcontext * ctx,
GLint x, GLint y,
@@ -183,6 +374,10 @@ intelDrawPixels(GLcontext * ctx,
unpack, pixels))
return;
+ if (intel_stencil_drawpixels(ctx, x, y, width, height, format, type,
+ unpack, pixels))
+ return;
+
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s: fallback to swrast\n", __FUNCTION__);
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index c6ff8c13c68..61c0861cbd4 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1063,6 +1063,7 @@ init_attrib_groups(GLcontext *ctx)
/* Miscellaneous */
ctx->NewState = _NEW_ALL;
ctx->ErrorValue = (GLenum) GL_NO_ERROR;
+ ctx->varying_vp_inputs = ~0;
return GL_TRUE;
}
diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c
index 308b4ef7115..da2640dd8fc 100644
--- a/src/mesa/main/ffvertex_prog.c
+++ b/src/mesa/main/ffvertex_prog.c
@@ -47,17 +47,17 @@
struct state_key {
+ unsigned light_color_material_mask:12;
+ unsigned light_material_mask:12;
unsigned light_global_enabled:1;
unsigned light_local_viewer:1;
unsigned light_twoside:1;
unsigned light_color_material:1;
- unsigned light_color_material_mask:12;
- unsigned light_material_mask:12;
unsigned material_shininess_is_zero:1;
-
unsigned need_eye_coords:1;
unsigned normalize:1;
unsigned rescale_normals:1;
+
unsigned fog_source_is_depth:1;
unsigned tnl_do_vertex_fog:1;
unsigned separate_specular:1;
@@ -67,6 +67,8 @@ struct state_key {
unsigned texture_enabled_global:1;
unsigned fragprog_inputs_read:12;
+ unsigned varying_vp_inputs;
+
struct {
unsigned light_enabled:1;
unsigned light_eyepos3_is_zero:1;
@@ -193,6 +195,7 @@ static void make_state_key( GLcontext *ctx, struct state_key *key )
key->need_eye_coords = ctx->_NeedEyeCoords;
key->fragprog_inputs_read = fp->Base.InputsRead;
+ key->varying_vp_inputs = ctx->varying_vp_inputs;
if (ctx->RenderMode == GL_FEEDBACK) {
/* make sure the vertprog emits color and tex0 */
@@ -448,14 +451,46 @@ static void release_temps( struct tnl_program *p )
}
+static struct ureg register_param5(struct tnl_program *p,
+ GLint s0,
+ GLint s1,
+ GLint s2,
+ GLint s3,
+ GLint s4)
+{
+ gl_state_index tokens[STATE_LENGTH];
+ GLint idx;
+ tokens[0] = s0;
+ tokens[1] = s1;
+ tokens[2] = s2;
+ tokens[3] = s3;
+ tokens[4] = s4;
+ idx = _mesa_add_state_reference( p->program->Base.Parameters, tokens );
+ return make_ureg(PROGRAM_STATE_VAR, idx);
+}
+
+
+#define register_param1(p,s0) register_param5(p,s0,0,0,0,0)
+#define register_param2(p,s0,s1) register_param5(p,s0,s1,0,0,0)
+#define register_param3(p,s0,s1,s2) register_param5(p,s0,s1,s2,0,0)
+#define register_param4(p,s0,s1,s2,s3) register_param5(p,s0,s1,s2,s3,0)
+
+
/**
* \param input one of VERT_ATTRIB_x tokens.
*/
static struct ureg register_input( struct tnl_program *p, GLuint input )
{
- p->program->Base.InputsRead |= (1<<input);
- return make_ureg(PROGRAM_INPUT, input);
+ /* Material attribs are passed here as inputs >= 32
+ */
+ if (input >= 32 || (p->state->varying_vp_inputs & (1<<input))) {
+ p->program->Base.InputsRead |= (1<<input);
+ return make_ureg(PROGRAM_INPUT, input);
+ }
+ else {
+ return register_param3( p, STATE_INTERNAL, STATE_CURRENT_ATTRIB, input );
+ }
}
/**
@@ -504,31 +539,6 @@ static struct ureg get_identity_param( struct tnl_program *p )
return p->identity;
}
-static struct ureg register_param5(struct tnl_program *p,
- GLint s0,
- GLint s1,
- GLint s2,
- GLint s3,
- GLint s4)
-{
- gl_state_index tokens[STATE_LENGTH];
- GLint idx;
- tokens[0] = s0;
- tokens[1] = s1;
- tokens[2] = s2;
- tokens[3] = s3;
- tokens[4] = s4;
- idx = _mesa_add_state_reference( p->program->Base.Parameters, tokens );
- return make_ureg(PROGRAM_STATE_VAR, idx);
-}
-
-
-#define register_param1(p,s0) register_param5(p,s0,0,0,0,0)
-#define register_param2(p,s0,s1) register_param5(p,s0,s1,0,0,0)
-#define register_param3(p,s0,s1,s2) register_param5(p,s0,s1,s2,0,0)
-#define register_param4(p,s0,s1,s2,s3) register_param5(p,s0,s1,s2,s3,0)
-
-
static void register_matrix_param5( struct tnl_program *p,
GLint s0, /* modelview, projection, etc */
GLint s1, /* texture matrix number */
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 052da2c18e1..7ad8cb244d5 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1987,6 +1987,8 @@ struct gl_vertex_program_state
GLboolean CallbackEnabled;
GLuint CurrentPosition;
#endif
+
+ GLboolean _Overriden;
};
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 2f0e7cc368e..5e073a18637 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 7.1
+ * Version: 7.3
*
* Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
*
@@ -508,10 +508,12 @@ _mesa_update_state_locked( GLcontext *ctx )
if (ctx->FragmentProgram._MaintainTexEnvProgram) {
prog_flags |= (_NEW_ARRAY | _NEW_TEXTURE_MATRIX | _NEW_LIGHT |
+ _NEW_RENDERMODE |
_NEW_TEXTURE | _NEW_FOG | _DD_NEW_SEPARATE_SPECULAR);
}
if (ctx->VertexProgram._MaintainTnlProgram) {
prog_flags |= (_NEW_ARRAY | _NEW_TEXTURE | _NEW_TEXTURE_MATRIX |
+ _NEW_RENDERMODE |
_NEW_TRANSFORM | _NEW_POINT |
_NEW_FOG | _NEW_LIGHT |
_MESA_NEW_NEED_EYE_COORDS);
@@ -551,7 +553,8 @@ _mesa_update_state( GLcontext *ctx )
-/* Want to figure out which fragment program inputs are actually
+/**
+ * Want to figure out which fragment program inputs are actually
* constant/current values from ctx->Current. These should be
* referenced as a tracked state variable rather than a fragment
* program input, to save the overhead of putting a constant value in
@@ -579,6 +582,26 @@ _mesa_set_varying_vp_inputs( GLcontext *ctx,
if (ctx->varying_vp_inputs != varying_inputs) {
ctx->varying_vp_inputs = varying_inputs;
ctx->NewState |= _NEW_ARRAY;
- //_mesa_printf("%s %x\n", __FUNCTION__, varying_inputs);
+ /*_mesa_printf("%s %x\n", __FUNCTION__, varying_inputs);*/
+ }
+}
+
+
+/**
+ * Used by drivers to tell core Mesa that the driver is going to
+ * install/ use its own vertex program. In particular, this will
+ * prevent generated fragment programs from using state vars instead
+ * of ordinary varyings/inputs.
+ */
+void
+_mesa_set_vp_override(GLcontext *ctx, GLboolean flag)
+{
+ if (ctx->VertexProgram._Overriden != flag) {
+ ctx->VertexProgram._Overriden = flag;
+
+ /* Set one of the bits which will trigger fragment program
+ * regeneration:
+ */
+ ctx->NewState |= _NEW_ARRAY;
}
}
diff --git a/src/mesa/main/state.h b/src/mesa/main/state.h
index 79f2f6beb0c..29db08a0b95 100644
--- a/src/mesa/main/state.h
+++ b/src/mesa/main/state.h
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 7.1
+ * Version: 7.3
*
* Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
*
@@ -29,16 +29,21 @@
#include "mtypes.h"
extern void
-_mesa_update_state( GLcontext *ctx );
+_mesa_update_state(GLcontext *ctx);
/* As above but can only be called between _mesa_lock_context_textures() and
* _mesa_unlock_context_textures().
*/
extern void
-_mesa_update_state_locked( GLcontext *ctx );
+_mesa_update_state_locked(GLcontext *ctx);
+
+
+extern void
+_mesa_set_varying_vp_inputs(GLcontext *ctx, GLbitfield varying_inputs);
+
+
+extern void
+_mesa_set_vp_override(GLcontext *ctx, GLboolean flag);
-void
-_mesa_set_varying_vp_inputs( GLcontext *ctx,
- GLbitfield varying_inputs );
#endif
diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c
index c23173014de..2c7df7b8d9a 100644
--- a/src/mesa/main/texenvprogram.c
+++ b/src/mesa/main/texenvprogram.c
@@ -217,8 +217,18 @@ static GLbitfield get_fp_input_mask( GLcontext *ctx )
{
GLbitfield fp_inputs = 0x0;
- if (!ctx->VertexProgram._Enabled ||
- !ctx->VertexProgram._Current) {
+ if (ctx->VertexProgram._Overriden) {
+ /* Somebody's messing with the vertex program and we don't have
+ * a clue what's happening. Assume that it could be producing
+ * all possible outputs.
+ */
+ fp_inputs = ~0;
+ }
+ else if (ctx->RenderMode == GL_FEEDBACK) {
+ fp_inputs = (FRAG_BIT_COL0 | FRAG_BIT_TEX0);
+ }
+ else if (!ctx->VertexProgram._Enabled ||
+ !ctx->VertexProgram._Current) {
/* Fixed function logic */
GLbitfield varying_inputs = ctx->varying_vp_inputs;
diff --git a/src/mesa/ppc/common_ppc.c b/src/mesa/ppc/common_ppc.c
index 786e1817acf..c7cec96e5d5 100644
--- a/src/mesa/ppc/common_ppc.c
+++ b/src/mesa/ppc/common_ppc.c
@@ -85,7 +85,7 @@ void _mesa_init_all_ppc_transform_asm( void )
}
# ifndef USE_VMX_ASM
- _mesa_ppc_cpu_features &= ~PPC_FEATURES_HAS_ALTIVEC;
+ _mesa_ppc_cpu_features &= ~PPC_FEATURE_HAS_ALTIVEC;
# endif
#endif
}
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 00bbcae32ae..5b24b9f0687 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -35,6 +35,7 @@
#include "main/bufferobj.h"
#include "main/macros.h"
#include "main/texformat.h"
+#include "main/state.h"
#include "shader/program.h"
#include "shader/prog_parameter.h"
#include "shader/prog_print.h"
@@ -835,6 +836,9 @@ st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
return;
}
+ _mesa_set_vp_override( ctx, TRUE );
+ _mesa_update_state( ctx );
+
st_validate_state(st);
if (format == GL_DEPTH_COMPONENT) {
@@ -874,6 +878,8 @@ st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
/* blit */
draw_blit(st, width, height, format, type, pixels);
}
+
+ _mesa_set_vp_override( ctx, FALSE );
}
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index acaf1de8823..d08229b57a3 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -156,7 +156,7 @@ st_FreeTextureImageData(GLcontext * ctx, struct gl_texture_image *texImage)
}
if (texImage->Data) {
- free(texImage->Data);
+ _mesa_align_free(texImage->Data);
texImage->Data = NULL;
}
}
@@ -541,7 +541,7 @@ st_TexImage(GLcontext * ctx,
sizeInBytes = depth * dstRowStride * postConvHeight;
}
- texImage->Data = malloc(sizeInBytes);
+ texImage->Data = _mesa_align_malloc(sizeInBytes, 16);
}
if (!texImage->Data) {