Lines Matching refs:mipmap
53 #include "main/mipmap.h"
342 struct gen_mipmap_state Mipmap; /**< For _mesa_meta_GenerateMipmap() */
351 struct gen_mipmap_state *mipmap);
444 meta_glsl_generate_mipmap_cleanup(ctx, &ctx->Meta->Mipmap);
2783 struct gen_mipmap_state *mipmap = &ctx->Meta->Mipmap;
2814 if (!mipmap->FBO)
2815 _mesa_GenFramebuffersEXT(1, &mipmap->FBO);
2816 _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, mipmap->FBO);
2824 /* other work is needed to enable 3D mipmap generation */
3007 struct gen_mipmap_state *mipmap)
3013 if (mipmap->ArrayObj == 0) {
3016 _mesa_GenVertexArraysAPPLE(1, &mipmap->ArrayObj);
3017 _mesa_BindVertexArrayAPPLE(mipmap->ArrayObj);
3020 _mesa_GenBuffersARB(1, &mipmap->VBO);
3021 _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, mipmap->VBO);
3037 setup_texture_sampler(GLenum target, struct gen_mipmap_state *mipmap)
3041 mipmap->sampler_1d.type = "sampler1D";
3042 mipmap->sampler_1d.func = "texture1D";
3043 mipmap->sampler_1d.texcoords = "texCoords.x";
3044 return &mipmap->sampler_1d;
3046 mipmap->sampler_2d.type = "sampler2D";
3047 mipmap->sampler_2d.func = "texture2D";
3048 mipmap->sampler_2d.texcoords = "texCoords.xy";
3049 return &mipmap->sampler_2d;
3051 /* Code for mipmap generation with 3D textures is not used yet.
3054 mipmap->sampler_3d.type = "sampler3D";
3055 mipmap->sampler_3d.func = "texture3D";
3056 mipmap->sampler_3d.texcoords = "texCoords";
3057 return &mipmap->sampler_3d;
3059 mipmap->sampler_cubemap.type = "samplerCube";
3060 mipmap->sampler_cubemap.func = "textureCube";
3061 mipmap->sampler_cubemap.texcoords = "texCoords";
3062 return &mipmap->sampler_cubemap;
3064 mipmap->sampler_1d_array.type = "sampler1DArray";
3065 mipmap->sampler_1d_array.func = "texture1DArray";
3066 mipmap->sampler_1d_array.texcoords = "texCoords.xy";
3067 return &mipmap->sampler_1d_array;
3069 mipmap->sampler_2d_array.type = "sampler2DArray";
3070 mipmap->sampler_2d_array.func = "texture2DArray";
3071 mipmap->sampler_2d_array.texcoords = "texCoords";
3072 return &mipmap->sampler_2d_array;
3083 struct gen_mipmap_state *mipmap,
3096 if (mipmap->ArrayObj == 0) {
3099 _mesa_GenVertexArrays(1, &mipmap->ArrayObj);
3100 _mesa_BindVertexArray(mipmap->ArrayObj);
3103 _mesa_GenBuffersARB(1, &mipmap->VBO);
3104 _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, mipmap->VBO);
3114 mipmap);
3117 mipmap->ShaderProg = sampler->shader_prog;
3185 mipmap->ShaderProg = _mesa_CreateProgramObjectARB();
3186 _mesa_AttachShader(mipmap->ShaderProg, fs);
3188 _mesa_AttachShader(mipmap->ShaderProg, vs);
3190 _mesa_BindAttribLocationARB(mipmap->ShaderProg, 0, "position");
3191 _mesa_BindAttribLocationARB(mipmap->ShaderProg, 1, "texcoords");
3194 link_program_with_debug(ctx, mipmap->ShaderProg);
3195 sampler->shader_prog = mipmap->ShaderProg;
3202 struct gen_mipmap_state *mipmap)
3204 if (mipmap->ArrayObj == 0)
3206 _mesa_DeleteVertexArraysAPPLE(1, &mipmap->ArrayObj);
3207 mipmap->ArrayObj = 0;
3208 _mesa_DeleteBuffersARB(1, &mipmap->VBO);
3209 mipmap->VBO = 0;
3211 _mesa_DeleteObjectARB(mipmap->sampler_1d.shader_prog);
3212 _mesa_DeleteObjectARB(mipmap->sampler_2d.shader_prog);
3213 _mesa_DeleteObjectARB(mipmap->sampler_3d.shader_prog);
3214 _mesa_DeleteObjectARB(mipmap->sampler_cubemap.shader_prog);
3215 _mesa_DeleteObjectARB(mipmap->sampler_1d_array.shader_prog);
3216 _mesa_DeleteObjectARB(mipmap->sampler_2d_array.shader_prog);
3218 mipmap->sampler_1d.shader_prog = 0;
3219 mipmap->sampler_2d.shader_prog = 0;
3220 mipmap->sampler_3d.shader_prog = 0;
3221 mipmap->sampler_cubemap.shader_prog = 0;
3222 mipmap->sampler_1d_array.shader_prog = 0;
3223 mipmap->sampler_2d_array.shader_prog = 0;
3236 struct gen_mipmap_state *mipmap = &ctx->Meta->Mipmap;
3276 setup_glsl_generate_mipmap(ctx, mipmap, target);
3277 _mesa_UseProgramObjectARB(mipmap->ShaderProg);
3280 setup_ff_generate_mipmap(ctx, mipmap);
3284 _mesa_BindVertexArray(mipmap->ArrayObj);
3285 _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, mipmap->VBO);
3293 if (!mipmap->FBO) {
3294 _mesa_GenFramebuffersEXT(1, &mipmap->FBO);
3297 if (!mipmap->Sampler) {
3298 _mesa_GenSamplers(1, &mipmap->Sampler);
3299 _mesa_BindSampler(ctx->Texture.CurrentUnit, mipmap->Sampler);
3301 _mesa_SamplerParameteri(mipmap->Sampler,
3304 _mesa_SamplerParameteri(mipmap->Sampler, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
3305 _mesa_SamplerParameteri(mipmap->Sampler, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
3306 _mesa_SamplerParameteri(mipmap->Sampler, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
3307 _mesa_SamplerParameteri(mipmap->Sampler, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
3314 _mesa_SamplerParameteri(mipmap->Sampler, GL_TEXTURE_SRGB_DECODE_EXT,
3319 _mesa_BindSampler(ctx->Texture.CurrentUnit, mipmap->Sampler);
3322 _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, mipmap->FBO);
3388 /* Allocate storage for the destination mipmap image(s) */