summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2013-12-14 00:57:06 -0800
committerEric Anholt <[email protected]>2014-02-11 14:11:21 -0800
commit83c90c9239404412dc61aa3b0229ebd56a1406cf (patch)
treec4b129977553527d329a4e37f4c4c7ea33076075 /src/mesa/drivers
parent897f97566898b6ddde710c8c4e83ecf163c2c62f (diff)
meta: Expand the vertex structure for the GenerateMipmap and decompress paths
Final intermediate step leading to some code sharing. Note that the new GemerateMipmap and decompress vertex structures are the same as the new vertex structure in BlitFramebuffer and the others. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/common/meta.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index e56440f410f..0c5c63dc011 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -3249,10 +3249,10 @@ setup_texture_coords(GLenum faceTarget,
GLint width,
GLint height,
GLint depth,
- GLfloat coords0[3],
- GLfloat coords1[3],
- GLfloat coords2[3],
- GLfloat coords3[3])
+ GLfloat coords0[4],
+ GLfloat coords1[4],
+ GLfloat coords2[4],
+ GLfloat coords3[4])
{
static const GLfloat st[4][2] = {
{0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 1.0f}
@@ -3260,6 +3260,13 @@ setup_texture_coords(GLenum faceTarget,
GLuint i;
GLfloat r;
+ /* Currently all texture targets want the W component to be 1.0.
+ */
+ coords0[3] = 1.0F;
+ coords1[3] = 1.0F;
+ coords2[3] = 1.0F;
+ coords3[3] = 1.0F;
+
switch (faceTarget) {
case GL_TEXTURE_1D:
case GL_TEXTURE_2D:
@@ -3396,7 +3403,7 @@ static void
setup_ff_generate_mipmap(struct gen_mipmap_state *mipmap)
{
struct vertex {
- GLfloat x, y, tex[3];
+ GLfloat x, y, z, tex[4];
};
if (mipmap->VAO == 0) {
@@ -3473,7 +3480,7 @@ setup_glsl_generate_mipmap(struct gl_context *ctx,
GLenum target)
{
struct vertex {
- GLfloat x, y, tex[3];
+ GLfloat x, y, z, tex[4];
};
struct glsl_sampler *sampler;
const char *vs_source;
@@ -3619,7 +3626,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
{
struct gen_mipmap_state *mipmap = &ctx->Meta->Mipmap;
struct vertex {
- GLfloat x, y, tex[3];
+ GLfloat x, y, z, tex[4];
};
struct vertex verts[4];
const GLuint baseLevel = texObj->BaseLevel;
@@ -3709,6 +3716,9 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
else
assert(!genMipmapSave);
+ /* Silence valgrind warnings about reading uninitialized stack. */
+ memset(verts, 0, sizeof(verts));
+
/* Setup texture coordinates */
setup_texture_coords(faceTarget,
slice,
@@ -4018,7 +4028,7 @@ decompress_texture_image(struct gl_context *ctx,
const GLenum target = texObj->Target;
GLenum faceTarget;
struct vertex {
- GLfloat x, y, tex[3];
+ GLfloat x, y, z, tex[4];
};
struct vertex verts[4];
GLuint fboDrawSave, fboReadSave;
@@ -4127,6 +4137,9 @@ decompress_texture_image(struct gl_context *ctx,
_mesa_BindSampler(ctx->Texture.CurrentUnit, decompress->Sampler);
}
+ /* Silence valgrind warnings about reading uninitialized stack. */
+ memset(verts, 0, sizeof(verts));
+
setup_texture_coords(faceTarget, slice, width, height, depth,
verts[0].tex,
verts[1].tex,