* State for GLSL texture sampler which is used to generate fragment
* shader in _mesa_meta_generate_mipmap().
*/
-struct glsl_sampler {
+struct blit_shader {
const char *type;
const char *func;
const char *texcoords;
/**
* Table of all sampler types and shaders for accessing them.
*/
-struct sampler_table {
- struct glsl_sampler sampler_1d;
- struct glsl_sampler sampler_2d;
- struct glsl_sampler sampler_3d;
- struct glsl_sampler sampler_rect;
- struct glsl_sampler sampler_cubemap;
- struct glsl_sampler sampler_1d_array;
- struct glsl_sampler sampler_2d_array;
- struct glsl_sampler sampler_cubemap_array;
+struct blit_shader_table {
+ struct blit_shader sampler_1d;
+ struct blit_shader sampler_2d;
+ struct blit_shader sampler_3d;
+ struct blit_shader sampler_rect;
+ struct blit_shader sampler_cubemap;
+ struct blit_shader sampler_1d_array;
+ struct blit_shader sampler_2d_array;
+ struct blit_shader sampler_cubemap_array;
};
/**
GLuint VAO;
GLuint VBO;
GLuint DepthFP;
- struct sampler_table samplers;
+ struct blit_shader_table shaders;
struct temp_texture depthTex;
};
GLuint FBO;
GLuint Sampler;
- struct sampler_table samplers;
+ struct blit_shader_table shaders;
};
/**
GLuint VBO, FBO, RBO, Sampler;
GLint Width, Height;
- struct sampler_table samplers;
+ struct blit_shader_table shaders;
};
/**
GLfloat r, g, b, a;
};
-static struct glsl_sampler *
-setup_texture_sampler(GLenum target, struct sampler_table *table);
+static struct blit_shader *
+choose_blit_shader(GLenum target, struct blit_shader_table *table);
static void meta_glsl_blit_cleanup(struct blit_state *blit);
static void cleanup_temp_texture(struct temp_texture *tex);
static void meta_glsl_generate_mipmap_cleanup(struct gen_mipmap_state *mipmap);
static void meta_decompress_cleanup(struct decompress_state *decompress);
static void meta_drawpix_cleanup(struct drawpix_state *drawpix);
-static void sampler_table_cleanup(struct sampler_table *table);
+static void blit_shader_table_cleanup(struct blit_shader_table *table);
static GLuint
compile_shader_with_debug(struct gl_context *ctx, GLenum target, const GLcharARB *source)
static void
setup_blit_shader(struct gl_context *ctx,
GLenum target,
- struct sampler_table *table)
+ struct blit_shader_table *table)
{
const char *vs_source;
char *fs_source;
GLuint vs, fs;
void *const mem_ctx = ralloc_context(NULL);
- struct glsl_sampler *sampler =
- setup_texture_sampler(target, table);
+ struct blit_shader *shader = choose_blit_shader(target, table);
- assert(sampler != NULL);
+ assert(shader != NULL);
- if (sampler->shader_prog != 0) {
- _mesa_UseProgram(sampler->shader_prog);
+ if (shader->shader_prog != 0) {
+ _mesa_UseProgram(shader->shader_prog);
return;
}
" gl_FragColor = %s(texSampler, %s);\n"
" gl_FragDepth = gl_FragColor.x;\n"
"}\n",
- sampler->type,
- sampler->func, sampler->texcoords);
+ shader->type,
+ shader->func, shader->texcoords);
}
else {
vs_source = ralloc_asprintf(mem_ctx,
" gl_FragDepth = out_color.x;\n"
"}\n",
_mesa_is_desktop_gl(ctx) ? "130" : "300 es",
- sampler->type,
- sampler->texcoords);
+ shader->type,
+ shader->texcoords);
}
vs = compile_shader_with_debug(ctx, GL_VERTEX_SHADER, vs_source);
fs = compile_shader_with_debug(ctx, GL_FRAGMENT_SHADER, fs_source);
- sampler->shader_prog = _mesa_CreateProgramObjectARB();
- _mesa_AttachShader(sampler->shader_prog, fs);
+ shader->shader_prog = _mesa_CreateProgramObjectARB();
+ _mesa_AttachShader(shader->shader_prog, fs);
_mesa_DeleteObjectARB(fs);
- _mesa_AttachShader(sampler->shader_prog, vs);
+ _mesa_AttachShader(shader->shader_prog, vs);
_mesa_DeleteObjectARB(vs);
- _mesa_BindAttribLocation(sampler->shader_prog, 0, "position");
- _mesa_BindAttribLocation(sampler->shader_prog, 1, "texcoords");
- link_program_with_debug(ctx, sampler->shader_prog);
+ _mesa_BindAttribLocation(shader->shader_prog, 0, "position");
+ _mesa_BindAttribLocation(shader->shader_prog, 1, "texcoords");
+ link_program_with_debug(ctx, shader->shader_prog);
ralloc_free(mem_ctx);
- _mesa_UseProgram(sampler->shader_prog);
+ _mesa_UseProgram(shader->shader_prog);
}
/**
setup_vertex_objects(&blit->VAO, &blit->VBO, true, 2, 2, 0);
- setup_blit_shader(ctx, target, &blit->samplers);
+ setup_blit_shader(ctx, target, &blit->shaders);
}
/**
blit->DepthFP = 0;
}
- sampler_table_cleanup(&blit->samplers);
+ blit_shader_table_cleanup(&blit->shaders);
_mesa_DeleteTextures(1, &blit->depthTex.TexObj);
blit->depthTex.TexObj = 0;
}
}
-static struct glsl_sampler *
-setup_texture_sampler(GLenum target, struct sampler_table *table)
+static struct blit_shader *
+choose_blit_shader(GLenum target, struct blit_shader_table *table)
{
switch(target) {
case GL_TEXTURE_1D:
}
static void
-sampler_table_cleanup(struct sampler_table *table)
+blit_shader_table_cleanup(struct blit_shader_table *table)
{
_mesa_DeleteObjectARB(table->sampler_1d.shader_prog);
_mesa_DeleteObjectARB(table->sampler_2d.shader_prog);
_mesa_DeleteBuffers(1, &mipmap->VBO);
mipmap->VBO = 0;
- sampler_table_cleanup(&mipmap->samplers);
+ blit_shader_table_cleanup(&mipmap->shaders);
}
if (use_glsl_version) {
setup_vertex_objects(&mipmap->VAO, &mipmap->VBO, true,
2, 3, 0);
- setup_blit_shader(ctx, target, &mipmap->samplers);
+ setup_blit_shader(ctx, target, &mipmap->shaders);
}
else {
setup_ff_tnl_for_blit(&mipmap->VAO, &mipmap->VBO, 3);
setup_vertex_objects(&decompress->VAO, &decompress->VBO, true,
2, 4, 0);
- setup_blit_shader(ctx, target, &decompress->samplers);
+ setup_blit_shader(ctx, target, &decompress->shaders);
} else {
setup_ff_tnl_for_blit(&decompress->VAO, &decompress->VBO, 3);
}