[Mesa-dev] [PATCH] meta: Generate and compile shaders everytime in setup_glsl_generate_mipmap()
Anuj Phogat
anuj.phogat at gmail.com
Tue Sep 18 15:38:42 PDT 2012
Fixes float-texture(mipmap.manual):
See Comment 6: https://bugs.freedesktop.org/show_bug.cgi?id=54296
NOTE: This is a candidate for stable branches.
Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
src/mesa/drivers/common/meta.c | 40 ++++++++++++++++++++--------------------
1 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 3d8e138..bb3b105 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -3135,21 +3135,21 @@ setup_glsl_generate_mipmap(struct gl_context *ctx,
}
/* Check if already initialized */
- if (mipmap->ArrayObj != 0)
- return;
- /* create vertex array object */
- _mesa_GenVertexArrays(1, &mipmap->ArrayObj);
- _mesa_BindVertexArray(mipmap->ArrayObj);
+ if (mipmap->ArrayObj == 0) {
+ /* create vertex array object */
+ _mesa_GenVertexArrays(1, &mipmap->ArrayObj);
+ _mesa_BindVertexArray(mipmap->ArrayObj);
- /* create vertex array buffer */
- _mesa_GenBuffersARB(1, &mipmap->VBO);
- _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, mipmap->VBO);
+ /* create vertex array buffer */
+ _mesa_GenBuffersARB(1, &mipmap->VBO);
+ _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, mipmap->VBO);
- /* setup vertex arrays */
- _mesa_VertexAttribPointerARB(0, 2, GL_FLOAT, GL_FALSE,
- sizeof(struct vertex), OFFSET(x));
- _mesa_VertexAttribPointerARB(1, 3, GL_FLOAT, GL_FALSE,
- sizeof(struct vertex), OFFSET(tex));
+ /* setup vertex arrays */
+ _mesa_VertexAttribPointerARB(0, 2, GL_FLOAT, GL_FALSE,
+ sizeof(struct vertex), OFFSET(x));
+ _mesa_VertexAttribPointerARB(1, 3, GL_FLOAT, GL_FALSE,
+ sizeof(struct vertex), OFFSET(tex));
+ }
/* Generate a fragment shader program appropriate for the texture target */
setup_texture_sampler(target, &sampler);
@@ -3217,13 +3217,6 @@ meta_glsl_generate_mipmap_cleanup(struct gl_context *ctx,
mipmap->ArrayObj = 0;
_mesa_DeleteBuffersARB(1, &mipmap->VBO);
mipmap->VBO = 0;
- _mesa_DeleteObjectARB(mipmap->ShaderProg);
- mipmap->ShaderProg = 0;
-
- if (mipmap->IntegerShaderProg) {
- _mesa_DeleteObjectARB(mipmap->IntegerShaderProg);
- mipmap->IntegerShaderProg = 0;
- }
}
@@ -3460,6 +3453,13 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
_mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
+ _mesa_DeleteObjectARB(mipmap->ShaderProg);
+ mipmap->ShaderProg = 0;
+
+ if (mipmap->IntegerShaderProg) {
+ _mesa_DeleteObjectARB(mipmap->IntegerShaderProg);
+ mipmap->IntegerShaderProg = 0;
+ }
if (ctx->Extensions.EXT_framebuffer_sRGB && srgbBufferSave) {
_mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB_EXT, GL_TRUE);
--
1.7.7.6
More information about the mesa-dev
mailing list