aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/common/meta.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/common/meta.c')
-rw-r--r--src/mesa/drivers/common/meta.c142
1 files changed, 30 insertions, 112 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 87d116ad9f1..9946bf19900 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -40,7 +40,6 @@
#include "main/bufferobj.h"
#include "main/buffers.h"
#include "main/colortab.h"
-#include "main/convolve.h"
#include "main/depth.h"
#include "main/enable.h"
#include "main/fbobject.h"
@@ -128,9 +127,6 @@ struct save_state
GLfloat AlphaBias, AlphaScale;
GLfloat DepthBias, DepthScale;
GLboolean MapColorFlag;
- GLboolean Convolution1DEnabled;
- GLboolean Convolution2DEnabled;
- GLboolean Separable2DEnabled;
/** META_RASTERIZATION */
GLenum FrontPolygonMode, BackPolygonMode;
@@ -288,7 +284,7 @@ struct gl_meta_state
* To be called once during context creation.
*/
void
-_mesa_meta_init(GLcontext *ctx)
+_mesa_meta_init(struct gl_context *ctx)
{
ASSERT(!ctx->Meta);
@@ -301,7 +297,7 @@ _mesa_meta_init(GLcontext *ctx)
* To be called once during context destruction.
*/
void
-_mesa_meta_free(GLcontext *ctx)
+_mesa_meta_free(struct gl_context *ctx)
{
/* Note: Any textures, VBOs, etc, that we allocate should get
* freed by the normal context destruction code. But this would be
@@ -320,7 +316,7 @@ _mesa_meta_free(GLcontext *ctx)
* to save and reset to their defaults
*/
static void
-_mesa_meta_begin(GLcontext *ctx, GLbitfield state)
+_mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
{
struct save_state *save = &ctx->Meta->Save;
@@ -389,9 +385,6 @@ _mesa_meta_begin(GLcontext *ctx, GLbitfield state)
save->AlphaScale = ctx->Pixel.AlphaScale;
save->AlphaBias = ctx->Pixel.AlphaBias;
save->MapColorFlag = ctx->Pixel.MapColorFlag;
- save->Convolution1DEnabled = ctx->Pixel.Convolution1DEnabled;
- save->Convolution2DEnabled = ctx->Pixel.Convolution2DEnabled;
- save->Separable2DEnabled = ctx->Pixel.Separable2DEnabled;
ctx->Pixel.RedScale = 1.0F;
ctx->Pixel.RedBias = 0.0F;
ctx->Pixel.GreenScale = 1.0F;
@@ -401,9 +394,6 @@ _mesa_meta_begin(GLcontext *ctx, GLbitfield state)
ctx->Pixel.AlphaScale = 1.0F;
ctx->Pixel.AlphaBias = 0.0F;
ctx->Pixel.MapColorFlag = GL_FALSE;
- ctx->Pixel.Convolution1DEnabled = GL_FALSE;
- ctx->Pixel.Convolution2DEnabled = GL_FALSE;
- ctx->Pixel.Separable2DEnabled = GL_FALSE;
/* XXX more state */
ctx->NewState |=_NEW_PIXEL;
}
@@ -567,7 +557,7 @@ _mesa_meta_begin(GLcontext *ctx, GLbitfield state)
* Leave meta state. This is like a light-weight version of glPopAttrib().
*/
static void
-_mesa_meta_end(GLcontext *ctx)
+_mesa_meta_end(struct gl_context *ctx)
{
struct save_state *save = &ctx->Meta->Save;
const GLbitfield state = save->SavedState;
@@ -638,9 +628,6 @@ _mesa_meta_end(GLcontext *ctx)
ctx->Pixel.AlphaScale = save->AlphaScale;
ctx->Pixel.AlphaBias = save->AlphaBias;
ctx->Pixel.MapColorFlag = save->MapColorFlag;
- ctx->Pixel.Convolution1DEnabled = save->Convolution1DEnabled;
- ctx->Pixel.Convolution2DEnabled = save->Convolution2DEnabled;
- ctx->Pixel.Separable2DEnabled = save->Separable2DEnabled;
/* XXX more state */
ctx->NewState |=_NEW_PIXEL;
}
@@ -837,7 +824,7 @@ invert_z(GLfloat normZ)
* Choose tex target, compute max tex size, etc.
*/
static void
-init_temp_texture(GLcontext *ctx, struct temp_texture *tex)
+init_temp_texture(struct gl_context *ctx, struct temp_texture *tex)
{
/* prefer texture rectangle */
if (ctx->Extensions.NV_texture_rectangle) {
@@ -863,7 +850,7 @@ init_temp_texture(GLcontext *ctx, struct temp_texture *tex)
* This does some one-time init if needed.
*/
static struct temp_texture *
-get_temp_texture(GLcontext *ctx)
+get_temp_texture(struct gl_context *ctx)
{
struct temp_texture *tex = &ctx->Meta->TempTex;
@@ -881,7 +868,7 @@ get_temp_texture(GLcontext *ctx)
* allocation/deallocation.
*/
static struct temp_texture *
-get_bitmap_temp_texture(GLcontext *ctx)
+get_bitmap_temp_texture(struct gl_context *ctx)
{
struct temp_texture *tex = &ctx->Meta->Bitmap.Tex;
@@ -997,7 +984,7 @@ setup_copypix_texture(struct temp_texture *tex,
* Setup/load texture for glDrawPixels.
*/
static void
-setup_drawpix_texture(GLcontext *ctx,
+setup_drawpix_texture(struct gl_context *ctx,
struct temp_texture *tex,
GLboolean newTex,
GLenum texIntFormat,
@@ -1048,7 +1035,7 @@ setup_drawpix_texture(GLcontext *ctx,
* One-time init for drawing depth pixels.
*/
static void
-init_blit_depth_pixels(GLcontext *ctx)
+init_blit_depth_pixels(struct gl_context *ctx)
{
static const char *program =
"!!ARBfp1.0\n"
@@ -1085,7 +1072,7 @@ init_blit_depth_pixels(GLcontext *ctx)
* normal path.
*/
static GLbitfield
-blitframebuffer_texture(GLcontext *ctx,
+blitframebuffer_texture(struct gl_context *ctx,
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield mask, GLenum filter)
@@ -1214,7 +1201,7 @@ blitframebuffer_texture(GLcontext *ctx,
* of texture mapping and polygon rendering.
*/
void
-_mesa_meta_BlitFramebuffer(GLcontext *ctx,
+_mesa_meta_BlitFramebuffer(struct gl_context *ctx,
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield mask, GLenum filter)
@@ -1375,7 +1362,7 @@ _mesa_meta_BlitFramebuffer(GLcontext *ctx,
* Meta implementation of ctx->Driver.Clear() in terms of polygon rendering.
*/
void
-_mesa_meta_Clear(GLcontext *ctx, GLbitfield buffers)
+_mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers)
{
struct clear_state *clear = &ctx->Meta->Clear;
struct vertex {
@@ -1493,7 +1480,7 @@ _mesa_meta_Clear(GLcontext *ctx, GLbitfield buffers)
* of texture mapping and polygon rendering.
*/
void
-_mesa_meta_CopyPixels(GLcontext *ctx, GLint srcX, GLint srcY,
+_mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY,
GLsizei width, GLsizei height,
GLint dstX, GLint dstY, GLenum type)
{
@@ -1607,7 +1594,7 @@ _mesa_meta_CopyPixels(GLcontext *ctx, GLint srcX, GLint srcY,
* into tiles which fit into the max texture size.
*/
static void
-tiled_draw_pixels(GLcontext *ctx,
+tiled_draw_pixels(struct gl_context *ctx,
GLint tileSize,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
@@ -1643,7 +1630,7 @@ tiled_draw_pixels(GLcontext *ctx,
* One-time init for drawing stencil pixels.
*/
static void
-init_draw_stencil_pixels(GLcontext *ctx)
+init_draw_stencil_pixels(struct gl_context *ctx)
{
/* This program is run eight times, once for each stencil bit.
* The stencil values to draw are found in an 8-bit alpha texture.
@@ -1707,7 +1694,7 @@ init_draw_stencil_pixels(GLcontext *ctx)
* One-time init for drawing depth pixels.
*/
static void
-init_draw_depth_pixels(GLcontext *ctx)
+init_draw_depth_pixels(struct gl_context *ctx)
{
static const char *program =
"!!ARBfp1.0\n"
@@ -1742,7 +1729,7 @@ init_draw_depth_pixels(GLcontext *ctx)
* of texture mapping and polygon rendering.
*/
void
-_mesa_meta_DrawPixels(GLcontext *ctx,
+_mesa_meta_DrawPixels(struct gl_context *ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *unpack,
@@ -1975,7 +1962,7 @@ _mesa_meta_DrawPixels(GLcontext *ctx,
* improve performance a lot.
*/
void
-_mesa_meta_Bitmap(GLcontext *ctx,
+_mesa_meta_Bitmap(struct gl_context *ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
const GLubyte *bitmap1)
@@ -2124,7 +2111,7 @@ _mesa_meta_Bitmap(GLcontext *ctx,
* \return GL_TRUE if a fallback is needed, GL_FALSE otherwise
*/
GLboolean
-_mesa_meta_check_generate_mipmap_fallback(GLcontext *ctx, GLenum target,
+_mesa_meta_check_generate_mipmap_fallback(struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj)
{
const GLuint fboSave = ctx->DrawBuffer->Name;
@@ -2190,7 +2177,7 @@ _mesa_meta_check_generate_mipmap_fallback(GLcontext *ctx, GLenum target,
* Note: texture borders and 3D texture support not yet complete.
*/
void
-_mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target,
+_mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj)
{
struct gen_mipmap_state *mipmap = &ctx->Meta->Mipmap;
@@ -2507,7 +2494,7 @@ _mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target,
* ReadPixels() and passed to Tex[Sub]Image().
*/
static GLenum
-get_temp_image_type(GLcontext *ctx, GLenum baseFormat)
+get_temp_image_type(struct gl_context *ctx, GLenum baseFormat)
{
switch (baseFormat) {
case GL_RGBA:
@@ -2538,7 +2525,7 @@ get_temp_image_type(GLcontext *ctx, GLenum baseFormat)
* Have to be careful with locking and meta state for pixel transfer.
*/
static void
-copy_tex_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level,
+copy_tex_image(struct gl_context *ctx, GLuint dims, GLenum target, GLint level,
GLenum internalFormat, GLint x, GLint y,
GLsizei width, GLsizei height, GLint border)
{
@@ -2579,14 +2566,6 @@ copy_tex_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level,
format, type, &ctx->Pack, buf);
_mesa_meta_end(ctx);
- /*
- * Prepare for new texture image size/data
- */
- if (_mesa_is_color_format(internalFormat)) {
- _mesa_adjust_image_for_convolution(ctx, 2,
- &postConvWidth, &postConvHeight);
- }
-
if (texImage->Data) {
ctx->Driver.FreeTexImageData(ctx, texImage);
}
@@ -2624,7 +2603,7 @@ copy_tex_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level,
void
-_mesa_meta_CopyTexImage1D(GLcontext *ctx, GLenum target, GLint level,
+_mesa_meta_CopyTexImage1D(struct gl_context *ctx, GLenum target, GLint level,
GLenum internalFormat, GLint x, GLint y,
GLsizei width, GLint border)
{
@@ -2634,7 +2613,7 @@ _mesa_meta_CopyTexImage1D(GLcontext *ctx, GLenum target, GLint level,
void
-_mesa_meta_CopyTexImage2D(GLcontext *ctx, GLenum target, GLint level,
+_mesa_meta_CopyTexImage2D(struct gl_context *ctx, GLenum target, GLint level,
GLenum internalFormat, GLint x, GLint y,
GLsizei width, GLsizei height, GLint border)
{
@@ -2649,7 +2628,7 @@ _mesa_meta_CopyTexImage2D(GLcontext *ctx, GLenum target, GLint level,
* Have to be careful with locking and meta state for pixel transfer.
*/
static void
-copy_tex_sub_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level,
+copy_tex_sub_image(struct gl_context *ctx, GLuint dims, GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLint x, GLint y,
GLsizei width, GLsizei height)
@@ -2720,7 +2699,7 @@ copy_tex_sub_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level,
void
-_mesa_meta_CopyTexSubImage1D(GLcontext *ctx, GLenum target, GLint level,
+_mesa_meta_CopyTexSubImage1D(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset,
GLint x, GLint y, GLsizei width)
{
@@ -2730,7 +2709,7 @@ _mesa_meta_CopyTexSubImage1D(GLcontext *ctx, GLenum target, GLint level,
void
-_mesa_meta_CopyTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
+_mesa_meta_CopyTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLint x, GLint y,
GLsizei width, GLsizei height)
@@ -2741,7 +2720,7 @@ _mesa_meta_CopyTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
void
-_mesa_meta_CopyTexSubImage3D(GLcontext *ctx, GLenum target, GLint level,
+_mesa_meta_CopyTexSubImage3D(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLint x, GLint y,
GLsizei width, GLsizei height)
@@ -2752,7 +2731,7 @@ _mesa_meta_CopyTexSubImage3D(GLcontext *ctx, GLenum target, GLint level,
void
-_mesa_meta_CopyColorTable(GLcontext *ctx,
+_mesa_meta_CopyColorTable(struct gl_context *ctx,
GLenum target, GLenum internalformat,
GLint x, GLint y, GLsizei width)
{
@@ -2780,7 +2759,7 @@ _mesa_meta_CopyColorTable(GLcontext *ctx,
void
-_mesa_meta_CopyColorSubTable(GLcontext *ctx,GLenum target, GLsizei start,
+_mesa_meta_CopyColorSubTable(struct gl_context *ctx,GLenum target, GLsizei start,
GLint x, GLint y, GLsizei width)
{
GLfloat *buf;
@@ -2804,64 +2783,3 @@ _mesa_meta_CopyColorSubTable(GLcontext *ctx,GLenum target, GLsizei start,
free(buf);
}
-
-
-void
-_mesa_meta_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target,
- GLenum internalFormat,
- GLint x, GLint y, GLsizei width)
-{
- GLfloat *buf;
-
- buf = (GLfloat *) malloc(width * 4 * sizeof(GLfloat));
- if (!buf) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyConvolutionFilter2D");
- return;
- }
-
- /*
- * Read image from framebuffer (disable pixel transfer ops)
- */
- _mesa_meta_begin(ctx, META_PIXEL_STORE | META_PIXEL_TRANSFER);
- _mesa_update_state(ctx);
- ctx->Driver.ReadPixels(ctx, x, y, width, 1,
- GL_RGBA, GL_FLOAT, &ctx->Pack, buf);
-
- _mesa_ConvolutionFilter1D(target, internalFormat, width,
- GL_RGBA, GL_FLOAT, buf);
-
- _mesa_meta_end(ctx);
-
- free(buf);
-}
-
-
-void
-_mesa_meta_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target,
- GLenum internalFormat, GLint x, GLint y,
- GLsizei width, GLsizei height)
-{
- GLfloat *buf;
-
- buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
- if (!buf) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyConvolutionFilter2D");
- return;
- }
-
- /*
- * Read image from framebuffer (disable pixel transfer ops)
- */
- _mesa_meta_begin(ctx, META_PIXEL_STORE | META_PIXEL_TRANSFER);
- _mesa_update_state(ctx);
-
- ctx->Driver.ReadPixels(ctx, x, y, width, height,
- GL_RGBA, GL_FLOAT, &ctx->Pack, buf);
-
- _mesa_ConvolutionFilter2D(target, internalFormat, width, height,
- GL_RGBA, GL_FLOAT, buf);
-
- _mesa_meta_end(ctx);
-
- free(buf);
-}