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 <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
Ian Romanick
2013-12-14 00:57:06 -08:00
committed by Eric Anholt
parent 897f975668
commit 83c90c9239
+21 -8
View File
@@ -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,