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_clear_cleanup(struct clear_state *clear);
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 blit_shader_table_cleanup(struct blit_shader_table *table);
-static GLuint
-compile_shader_with_debug(struct gl_context *ctx, GLenum target, const GLcharARB *source)
+GLuint
+_mesa_meta_compile_shader_with_debug(struct gl_context *ctx, GLenum target,
+ const GLcharARB *source)
{
GLuint shader;
GLint ok, size;
return 0;
}
-static GLuint
-link_program_with_debug(struct gl_context *ctx, GLuint program)
+GLuint
+_mesa_meta_link_program_with_debug(struct gl_context *ctx, GLuint program)
{
GLint ok, size;
GLchar *info;
*
* \returns a handle to a shader program on success or zero on failure.
*/
-static void
-setup_blit_shader(struct gl_context *ctx,
- GLenum target,
- struct blit_shader_table *table)
+void
+_mesa_meta_setup_blit_shader(struct gl_context *ctx,
+ GLenum target,
+ struct blit_shader_table *table)
{
const char *vs_source;
char *fs_source;
shader->texcoords);
}
- vs = compile_shader_with_debug(ctx, GL_VERTEX_SHADER, vs_source);
- fs = compile_shader_with_debug(ctx, GL_FRAGMENT_SHADER, fs_source);
+ vs = _mesa_meta_compile_shader_with_debug(ctx, GL_VERTEX_SHADER, vs_source);
+ fs = _mesa_meta_compile_shader_with_debug(ctx, GL_FRAGMENT_SHADER, fs_source);
shader->shader_prog = _mesa_CreateProgramObjectARB();
_mesa_AttachShader(shader->shader_prog, fs);
_mesa_DeleteObjectARB(vs);
_mesa_BindAttribLocation(shader->shader_prog, 0, "position");
_mesa_BindAttribLocation(shader->shader_prog, 1, "texcoords");
- link_program_with_debug(ctx, shader->shader_prog);
+ _mesa_meta_link_program_with_debug(ctx, shader->shader_prog);
ralloc_free(mem_ctx);
_mesa_UseProgram(shader->shader_prog);
* \note If \c use_generic_attributes is \c true, \c color_size must be zero.
* Use \c texcoord_size instead.
*/
-static void
-setup_vertex_objects(GLuint *VAO, GLuint *VBO, bool use_generic_attributes,
- unsigned vertex_size, unsigned texcoord_size,
- unsigned color_size)
+void
+_mesa_meta_setup_vertex_objects(GLuint *VAO, GLuint *VBO,
+ bool use_generic_attributes,
+ unsigned vertex_size, unsigned texcoord_size,
+ unsigned color_size)
{
if (*VAO == 0) {
assert(*VBO == 0);
{
GET_CURRENT_CONTEXT(old_context);
_mesa_make_current(ctx, NULL, NULL);
- meta_glsl_blit_cleanup(&ctx->Meta->Blit);
+ _mesa_meta_glsl_blit_cleanup(&ctx->Meta->Blit);
meta_glsl_clear_cleanup(&ctx->Meta->Clear);
meta_glsl_generate_mipmap_cleanup(&ctx->Meta->Mipmap);
cleanup_temp_texture(&ctx->Meta->TempTex);
* Return pointer to temp_texture info for non-bitmap ops.
* This does some one-time init if needed.
*/
-static struct temp_texture *
-get_temp_texture(struct gl_context *ctx)
+struct temp_texture *
+_mesa_meta_get_temp_texture(struct gl_context *ctx)
{
struct temp_texture *tex = &ctx->Meta->TempTex;
* Return pointer to depth temp_texture.
* This does some one-time init if needed.
*/
-static struct temp_texture *
-get_temp_depth_texture(struct gl_context *ctx)
+struct temp_texture *
+_mesa_meta_get_temp_depth_texture(struct gl_context *ctx)
{
struct temp_texture *tex = &ctx->Meta->Blit.depthTex;
*
* \return GL_TRUE if new texture is needed, GL_FALSE otherwise
*/
-static GLboolean
-alloc_texture(struct temp_texture *tex,
- GLsizei width, GLsizei height, GLenum intFormat)
+GLboolean
+_mesa_meta_alloc_texture(struct temp_texture *tex,
+ GLsizei width, GLsizei height, GLenum intFormat)
{
GLboolean newTex = GL_FALSE;
/**
* Setup/load texture for glCopyPixels or glBlitFramebuffer.
*/
-static void
-setup_copypix_texture(struct gl_context *ctx,
- struct temp_texture *tex,
- GLint srcX, GLint srcY,
- GLsizei width, GLsizei height, GLenum intFormat,
- GLenum filter)
+void
+_mesa_meta_setup_copypix_texture(struct gl_context *ctx,
+ struct temp_texture *tex,
+ GLint srcX, GLint srcY,
+ GLsizei width, GLsizei height,
+ GLenum intFormat,
+ GLenum filter)
{
bool newTex;
if (ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGLES)
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
- newTex = alloc_texture(tex, width, height, intFormat);
+ newTex = _mesa_meta_alloc_texture(tex, width, height, intFormat);
/* copy framebuffer image to texture */
if (newTex) {
/**
* Setup/load texture for glDrawPixels.
*/
-static void
-setup_drawpix_texture(struct gl_context *ctx,
- struct temp_texture *tex,
- GLboolean newTex,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels)
+void
+_mesa_meta_setup_drawpix_texture(struct gl_context *ctx,
+ struct temp_texture *tex,
+ GLboolean newTex,
+ GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const GLvoid *pixels)
{
_mesa_BindTexture(tex->Target, tex->TexObj);
_mesa_TexParameteri(tex->Target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
"END \n";
char program2[200];
struct blit_state *blit = &ctx->Meta->Blit;
- struct temp_texture *tex = get_temp_texture(ctx);
+ struct temp_texture *tex = _mesa_meta_get_temp_texture(ctx);
const char *texTarget;
assert(blit->DepthFP == 0);
strlen(program2), (const GLubyte *) program2);
}
-static void
-setup_ff_tnl_for_blit(GLuint *VAO, GLuint *VBO, unsigned texcoord_size)
+void
+_mesa_meta_setup_ff_tnl_for_blit(GLuint *VAO, GLuint *VBO,
+ unsigned texcoord_size)
{
- setup_vertex_objects(VAO, VBO, false, 2, texcoord_size, 0);
+ _mesa_meta_setup_vertex_objects(VAO, VBO, false, 2, texcoord_size, 0);
/* setup projection matrix */
_mesa_MatrixMode(GL_PROJECTION);
/* target = GL_TEXTURE_RECTANGLE is not supported in GLES 3.0 */
assert(_mesa_is_desktop_gl(ctx) || target == GL_TEXTURE_2D);
- setup_vertex_objects(&blit->VAO, &blit->VBO, true, 2, 2, 0);
+ _mesa_meta_setup_vertex_objects(&blit->VAO, &blit->VBO, true, 2, 2, 0);
- setup_blit_shader(ctx, target, &blit->shaders);
+ _mesa_meta_setup_blit_shader(ctx, target, &blit->shaders);
}
/**
setup_glsl_blit_framebuffer(ctx, blit, target);
}
else {
- setup_ff_tnl_for_blit(&ctx->Meta->Blit.VAO,
- &ctx->Meta->Blit.VBO,
- 2);
+ _mesa_meta_setup_ff_tnl_for_blit(&ctx->Meta->Blit.VAO,
+ &ctx->Meta->Blit.VBO,
+ 2);
}
_mesa_GenSamplers(1, &sampler);
GLbitfield mask, GLenum filter)
{
struct blit_state *blit = &ctx->Meta->Blit;
- struct temp_texture *tex = get_temp_texture(ctx);
- struct temp_texture *depthTex = get_temp_depth_texture(ctx);
+ struct temp_texture *tex = _mesa_meta_get_temp_texture(ctx);
+ struct temp_texture *depthTex = _mesa_meta_get_temp_depth_texture(ctx);
const GLsizei maxTexSize = tex->MaxSize;
const GLint srcX = MIN2(srcX0, srcX1);
const GLint srcY = MIN2(srcY0, srcY1);
setup_glsl_blit_framebuffer(ctx, blit, tex->Target);
}
else {
- setup_ff_tnl_for_blit(&blit->VAO, &blit->VBO, 2);
+ _mesa_meta_setup_ff_tnl_for_blit(&blit->VAO, &blit->VBO, 2);
}
/* Silence valgrind warnings about reading uninitialized stack. */
* linear filtering along the edges. So, allocate the texture extended along
* edges by one pixel in x, y directions.
*/
- setup_copypix_texture(ctx, tex,
- srcX - 1, srcY - 1, srcW + 2, srcH + 2,
- rb_base_format, filter);
+ _mesa_meta_setup_copypix_texture(ctx, tex,
+ srcX - 1, srcY - 1, srcW + 2, srcH + 2,
+ rb_base_format, filter);
/* texcoords (after texture allocation!) */
{
verts[0].tex[0] = 1.0F;
if (tmp) {
- newTex = alloc_texture(depthTex, srcW, srcH, GL_DEPTH_COMPONENT);
+ newTex = _mesa_meta_alloc_texture(depthTex, srcW, srcH,
+ GL_DEPTH_COMPONENT);
_mesa_ReadPixels(srcX, srcY, srcW, srcH, GL_DEPTH_COMPONENT,
GL_UNSIGNED_INT, tmp);
- setup_drawpix_texture(ctx, depthTex, newTex,
- srcW, srcH, GL_DEPTH_COMPONENT,
- GL_UNSIGNED_INT, tmp);
+ _mesa_meta_setup_drawpix_texture(ctx, depthTex, newTex,
+ srcW, srcH, GL_DEPTH_COMPONENT,
+ GL_UNSIGNED_INT, tmp);
/* texcoords (after texture allocation!) */
{
}
}
-static void
-meta_glsl_blit_cleanup(struct blit_state *blit)
+void
+_mesa_meta_glsl_blit_cleanup(struct blit_state *blit)
{
if (blit->VAO) {
_mesa_DeleteVertexArrays(1, &blit->VAO);
blit->DepthFP = 0;
}
- blit_shader_table_cleanup(&blit->shaders);
+ _mesa_meta_blit_shader_table_cleanup(&blit->shaders);
_mesa_DeleteTextures(1, &blit->depthTex.TexObj);
blit->depthTex.TexObj = 0;
_mesa_meta_begin(ctx, metaSave);
- setup_vertex_objects(&clear->VAO, &clear->VBO, false, 3, 0, 4);
+ _mesa_meta_setup_vertex_objects(&clear->VAO, &clear->VBO, false, 3, 0, 4);
/* GL_COLOR_BUFFER_BIT */
if (buffers & BUFFER_BITS_COLOR) {
GLuint vs, gs = 0, fs;
bool has_integer_textures;
- setup_vertex_objects(&clear->VAO, &clear->VBO, true, 3, 0, 0);
+ _mesa_meta_setup_vertex_objects(&clear->VAO, &clear->VBO, true, 3, 0, 0);
if (clear->ShaderProg != 0)
return;
"}\n",
_mesa_is_desktop_gl(ctx) ? "130" : "300 es");
- vs = compile_shader_with_debug(ctx, GL_VERTEX_SHADER, vs_int_source);
- fs = compile_shader_with_debug(ctx, GL_FRAGMENT_SHADER, fs_int_source);
+ vs = _mesa_meta_compile_shader_with_debug(ctx, GL_VERTEX_SHADER,
+ vs_int_source);
+ fs = _mesa_meta_compile_shader_with_debug(ctx, GL_FRAGMENT_SHADER,
+ fs_int_source);
ralloc_free(shader_source_mem_ctx);
clear->IntegerShaderProg = _mesa_CreateProgramObjectARB();
* BindFragDataLocation to 0.
*/
- link_program_with_debug(ctx, clear->IntegerShaderProg);
+ _mesa_meta_link_program_with_debug(ctx, clear->IntegerShaderProg);
clear->IntegerColorLocation =
_mesa_GetUniformLocation(clear->IntegerShaderProg, "color");
GLint dstX, GLint dstY, GLenum type)
{
struct copypix_state *copypix = &ctx->Meta->CopyPix;
- struct temp_texture *tex = get_temp_texture(ctx);
+ struct temp_texture *tex = _mesa_meta_get_temp_texture(ctx);
struct vertex verts[4];
if (type != GL_COLOR ||
MESA_META_VERTEX |
MESA_META_VIEWPORT));
- setup_vertex_objects(©pix->VAO, ©pix->VBO, false, 3, 2, 0);
+ _mesa_meta_setup_vertex_objects(©pix->VAO, ©pix->VBO, false,
+ 3, 2, 0);
/* Silence valgrind warnings about reading uninitialized stack. */
memset(verts, 0, sizeof(verts));
/* Alloc/setup texture */
- setup_copypix_texture(ctx, tex, srcX, srcY, width, height,
- GL_RGBA, GL_NEAREST);
+ _mesa_meta_setup_copypix_texture(ctx, tex, srcX, srcY, width, height,
+ GL_RGBA, GL_NEAREST);
/* vertex positions, texcoords (after texture allocation!) */
{
"END \n";
char program2[1000];
struct drawpix_state *drawpix = &ctx->Meta->DrawPix;
- struct temp_texture *tex = get_temp_texture(ctx);
+ struct temp_texture *tex = _mesa_meta_get_temp_texture(ctx);
const char *texTarget;
assert(drawpix->StencilFP == 0);
"END \n";
char program2[200];
struct drawpix_state *drawpix = &ctx->Meta->DrawPix;
- struct temp_texture *tex = get_temp_texture(ctx);
+ struct temp_texture *tex = _mesa_meta_get_temp_texture(ctx);
const char *texTarget;
assert(drawpix->DepthFP == 0);
const GLvoid *pixels)
{
struct drawpix_state *drawpix = &ctx->Meta->DrawPix;
- struct temp_texture *tex = get_temp_texture(ctx);
+ struct temp_texture *tex = _mesa_meta_get_temp_texture(ctx);
const struct gl_pixelstore_attrib unpackSave = ctx->Unpack;
const GLuint origStencilMask = ctx->Stencil.WriteMask[0];
struct vertex verts[4];
MESA_META_VIEWPORT |
metaExtraSave));
- newTex = alloc_texture(tex, width, height, texIntFormat);
+ newTex = _mesa_meta_alloc_texture(tex, width, height, texIntFormat);
- setup_vertex_objects(&drawpix->VAO, &drawpix->VBO, false, 3, 2, 0);
+ _mesa_meta_setup_vertex_objects(&drawpix->VAO, &drawpix->VBO, false,
+ 3, 2, 0);
/* Silence valgrind warnings about reading uninitialized stack. */
memset(verts, 0, sizeof(verts));
if (!drawpix->StencilFP)
init_draw_stencil_pixels(ctx);
- setup_drawpix_texture(ctx, tex, newTex, width, height,
- GL_ALPHA, type, pixels);
+ _mesa_meta_setup_drawpix_texture(ctx, tex, newTex, width, height,
+ GL_ALPHA, type, pixels);
_mesa_ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
_mesa_ProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, 0,
ctx->Current.RasterColor);
- setup_drawpix_texture(ctx, tex, newTex, width, height,
- format, type, pixels);
+ _mesa_meta_setup_drawpix_texture(ctx, tex, newTex, width, height,
+ format, type, pixels);
_mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
else {
/* Drawing RGBA */
- setup_drawpix_texture(ctx, tex, newTex, width, height,
- format, type, pixels);
+ _mesa_meta_setup_drawpix_texture(ctx, tex, newTex, width, height,
+ format, type, pixels);
_mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
MESA_META_VERTEX |
MESA_META_VIEWPORT));
- setup_vertex_objects(&bitmap->VAO, &bitmap->VBO, false, 3, 2, 4);
+ _mesa_meta_setup_vertex_objects(&bitmap->VAO, &bitmap->VBO, false, 3, 2, 4);
- newTex = alloc_texture(tex, width, height, texIntFormat);
+ newTex = _mesa_meta_alloc_texture(tex, width, height, texIntFormat);
/* Silence valgrind warnings about reading uninitialized stack. */
memset(verts, 0, sizeof(verts));
_mesa_set_enable(ctx, GL_ALPHA_TEST, GL_TRUE);
_mesa_AlphaFunc(GL_NOTEQUAL, UBYTE_TO_FLOAT(bg));
- setup_drawpix_texture(ctx, tex, newTex, width, height,
- GL_ALPHA, GL_UNSIGNED_BYTE, bitmap8);
+ _mesa_meta_setup_drawpix_texture(ctx, tex, newTex, width, height,
+ GL_ALPHA, GL_UNSIGNED_BYTE, bitmap8);
_mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
}
-static void
-blit_shader_table_cleanup(struct blit_shader_table *table)
+void
+_mesa_meta_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;
- blit_shader_table_cleanup(&mipmap->shaders);
+ _mesa_meta_blit_shader_table_cleanup(&mipmap->shaders);
}
* GenerateMipmap function.
*/
if (use_glsl_version) {
- setup_vertex_objects(&mipmap->VAO, &mipmap->VBO, true,
- 2, 3, 0);
- setup_blit_shader(ctx, target, &mipmap->shaders);
+ _mesa_meta_setup_vertex_objects(&mipmap->VAO, &mipmap->VBO, true,
+ 2, 3, 0);
+ _mesa_meta_setup_blit_shader(ctx, target, &mipmap->shaders);
}
else {
- setup_ff_tnl_for_blit(&mipmap->VAO, &mipmap->VBO, 3);
+ _mesa_meta_setup_ff_tnl_for_blit(&mipmap->VAO, &mipmap->VBO, 3);
_mesa_set_enable(ctx, target, GL_TRUE);
}
}
if (use_glsl_version) {
- setup_vertex_objects(&decompress->VAO, &decompress->VBO, true,
- 2, 4, 0);
+ _mesa_meta_setup_vertex_objects(&decompress->VAO, &decompress->VBO, true,
+ 2, 4, 0);
- setup_blit_shader(ctx, target, &decompress->shaders);
+ _mesa_meta_setup_blit_shader(ctx, target, &decompress->shaders);
} else {
- setup_ff_tnl_for_blit(&decompress->VAO, &decompress->VBO, 3);
+ _mesa_meta_setup_ff_tnl_for_blit(&decompress->VAO, &decompress->VBO, 3);
}
if (!decompress->Sampler) {