GLuint VAO;
GLuint VBO, FBO, RBO, Sampler;
GLint Width, Height;
+
+ struct sampler_table samplers;
};
/**
GLuint fboDrawSave, fboReadSave;
GLuint rbSave;
GLuint samplerSave;
+ const bool use_glsl_version = ctx->Extensions.ARB_vertex_shader &&
+ ctx->Extensions.ARB_fragment_shader &&
+ (ctx->API != API_OPENGLES);
+ GLuint shaderProg = 0;
if (slice > 0) {
assert(target == GL_TEXTURE_3D ||
assert(!"No compressed 3D textures.");
return;
- case GL_TEXTURE_2D_ARRAY:
case GL_TEXTURE_CUBE_MAP_ARRAY:
- /* These targets are just broken currently. */
+ /* This target is just broken currently. */
return;
case GL_TEXTURE_CUBE_MAP:
decompress->Height = height;
}
- setup_ff_tnl_for_blit(&decompress->VAO, &decompress->VBO, 3);
+ if (use_glsl_version) {
+ struct glsl_sampler *sampler;
+
+ setup_vertex_objects(&decompress->VAO, &decompress->VBO, true,
+ 2, 3, 0);
+
+ /* Generate a relevant fragment shader program for the texture target */
+ sampler = setup_texture_sampler(target, &decompress->samplers);
+ assert(sampler != NULL);
+
+ shaderProg = setup_shader_for_sampler(ctx, sampler);
+ } else {
+ setup_ff_tnl_for_blit(&decompress->VAO, &decompress->VBO, 3);
+ }
if (!decompress->Sampler) {
_mesa_GenSamplers(1, &decompress->Sampler);
/* setup texture state */
_mesa_BindTexture(target, texObj->Name);
- _mesa_set_enable(ctx, target, GL_TRUE);
+
+ if (!use_glsl_version)
+ _mesa_set_enable(ctx, target, GL_TRUE);
+ else {
+ assert(shaderProg != 0);
+ _mesa_UseProgram(shaderProg);
+ }
{
/* save texture object state */
}
/* disable texture unit */
- _mesa_set_enable(ctx, target, GL_FALSE);
+ if (!use_glsl_version)
+ _mesa_set_enable(ctx, target, GL_FALSE);
_mesa_BindSampler(ctx->Texture.CurrentUnit, samplerSave);