summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAnuj Phogat <[email protected]>2012-11-02 11:18:16 -0700
committerAndreas Boll <[email protected]>2013-01-20 15:08:27 +0100
commitc4263ac0baa37ee7cff9e36f973afab5fda433d4 (patch)
treee82829e438fcb87a49e7f73a837ed6783b2a74a7 /src
parentcb3bcb73e5646d25e9a313b478671c71a3440bf7 (diff)
meta: Remove redundant code in _mesa_meta_GenerateMipmap
Integer textures generate invalid operation in glGenerateMipmap. So, the code related to integer textures is now redundant. Note: This is a candidate for stable branches. Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Brian Paul <[email protected]> (cherry picked from commit a196f43596f6cb85a8f3e446596a2fb8e0ee7872)
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/common/meta.c65
1 files changed, 4 insertions, 61 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 5f0b4784e07..9960a30c0f0 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -293,7 +293,6 @@ struct gen_mipmap_state
GLuint FBO;
GLuint Sampler;
GLuint ShaderProg;
- GLuint IntegerShaderProg;
struct glsl_sampler sampler_1d;
struct glsl_sampler sampler_2d;
struct glsl_sampler sampler_3d;
@@ -3078,27 +3077,6 @@ setup_glsl_generate_mipmap(struct gl_context *ctx,
};
struct glsl_sampler *sampler;
const char *vs_source;
-
- static const char *vs_int_source =
- "#version 130\n"
- "in vec2 position;\n"
- "in vec3 textureCoords;\n"
- "out vec3 texCoords;\n"
- "void main()\n"
- "{\n"
- " texCoords = textureCoords;\n"
- " gl_Position = gl_Vertex;\n"
- "}\n";
- static const char *fs_int_source =
- "#version 130\n"
- "uniform isampler2D tex2d;\n"
- "in vec3 texCoords;\n"
- "out ivec4 out_color;\n"
- "\n"
- "void main()\n"
- "{\n"
- " out_color = texture(tex2d, texCoords.xy);\n"
- "}\n";
char *fs_source;
GLuint vs, fs;
void *mem_ctx;
@@ -3205,26 +3183,6 @@ setup_glsl_generate_mipmap(struct gl_context *ctx,
link_program_with_debug(ctx, mipmap->ShaderProg);
sampler->shader_prog = mipmap->ShaderProg;
ralloc_free(mem_ctx);
-
- if ((_mesa_is_desktop_gl(ctx) && ctx->Const.GLSLVersion >= 130) ||
- _mesa_is_gles3(ctx)){
- vs = compile_shader_with_debug(ctx, GL_VERTEX_SHADER, vs_int_source);
- fs = compile_shader_with_debug(ctx, GL_FRAGMENT_SHADER, fs_int_source);
-
- mipmap->IntegerShaderProg = _mesa_CreateProgramObjectARB();
- _mesa_AttachShader(mipmap->IntegerShaderProg, fs);
- _mesa_DeleteObjectARB(fs);
- _mesa_AttachShader(mipmap->IntegerShaderProg, vs);
- _mesa_DeleteObjectARB(vs);
- _mesa_BindAttribLocationARB(mipmap->IntegerShaderProg, 0, "position");
- _mesa_BindAttribLocationARB(mipmap->IntegerShaderProg, 1, "texcoords");
-
- /* Note that user-defined out attributes get automatically assigned
- * locations starting from 0, so we don't need to explicitly
- * BindFragDataLocation to 0.
- */
- link_program_with_debug(ctx, mipmap->IntegerShaderProg);
- }
}
@@ -3252,11 +3210,6 @@ meta_glsl_generate_mipmap_cleanup(struct gl_context *ctx,
mipmap->sampler_cubemap.shader_prog = 0;
mipmap->sampler_1d_array.shader_prog = 0;
mipmap->sampler_2d_array.shader_prog = 0;
-
- if (mipmap->IntegerShaderProg) {
- _mesa_DeleteObjectARB(mipmap->IntegerShaderProg);
- mipmap->IntegerShaderProg = 0;
- }
}
@@ -3310,11 +3263,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
*/
if (use_glsl_version) {
setup_glsl_generate_mipmap(ctx, mipmap, target);
-
- if (texObj->_IsIntegerFormat)
- _mesa_UseProgramObjectARB(mipmap->IntegerShaderProg);
- else
- _mesa_UseProgramObjectARB(mipmap->ShaderProg);
+ _mesa_UseProgramObjectARB(mipmap->ShaderProg);
}
else {
setup_ff_generate_mipmap(ctx, mipmap);
@@ -3338,15 +3287,9 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
_mesa_GenSamplers(1, &mipmap->Sampler);
_mesa_BindSampler(ctx->Texture.CurrentUnit, mipmap->Sampler);
- if (use_glsl_version && texObj->_IsIntegerFormat)
- _mesa_SamplerParameteri(mipmap->Sampler,
- GL_TEXTURE_MIN_FILTER,
- GL_NEAREST_MIPMAP_NEAREST);
- else
- _mesa_SamplerParameteri(mipmap->Sampler,
- GL_TEXTURE_MIN_FILTER,
- GL_LINEAR_MIPMAP_LINEAR);
-
+ _mesa_SamplerParameteri(mipmap->Sampler,
+ GL_TEXTURE_MIN_FILTER,
+ GL_LINEAR_MIPMAP_LINEAR);
_mesa_SamplerParameteri(mipmap->Sampler, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
_mesa_SamplerParameteri(mipmap->Sampler, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
_mesa_SamplerParameteri(mipmap->Sampler, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);