summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_atom_blend.c15
-rw-r--r--src/mesa/state_tracker/st_atom_clip.c15
-rw-r--r--src/mesa/state_tracker/st_atom_constbuf.c34
-rw-r--r--src/mesa/state_tracker/st_atom_depth.c10
-rw-r--r--src/mesa/state_tracker/st_atom_fixedfunction.c10
-rw-r--r--src/mesa/state_tracker/st_atom_framebuffer.c10
-rw-r--r--src/mesa/state_tracker/st_atom_pixeltransfer.c10
-rw-r--r--src/mesa/state_tracker/st_atom_rasterizer.c12
-rw-r--r--src/mesa/state_tracker/st_atom_sampler.c32
-rw-r--r--src/mesa/state_tracker/st_atom_scissor.c15
-rw-r--r--src/mesa/state_tracker/st_atom_shader.c10
-rw-r--r--src/mesa/state_tracker/st_atom_stipple.c10
-rw-r--r--src/mesa/state_tracker/st_atom_texture.c17
-rw-r--r--src/mesa/state_tracker/st_atom_viewport.c10
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.c297
-rw-r--r--src/mesa/state_tracker/st_cb_bufferobjects.c22
-rw-r--r--src/mesa/state_tracker/st_cb_clear.c16
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c13
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c2
-rw-r--r--src/mesa/state_tracker/st_cb_strings.c12
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c62
-rw-r--r--src/mesa/state_tracker/st_context.c4
-rw-r--r--src/mesa/state_tracker/st_context.h1
-rw-r--r--src/mesa/state_tracker/st_draw.c59
-rw-r--r--src/mesa/state_tracker/st_extensions.c28
-rw-r--r--src/mesa/state_tracker/st_format.c32
-rw-r--r--src/mesa/state_tracker/st_gen_mipmap.c14
-rw-r--r--src/mesa/state_tracker/st_mesa_to_tgsi.c2
-rw-r--r--src/mesa/state_tracker/st_program.h4
-rw-r--r--src/mesa/state_tracker/st_texobj.c102
-rw-r--r--src/mesa/state_tracker/st_texobj.h41
-rw-r--r--src/mesa/state_tracker/st_texture.c1
-rw-r--r--src/mesa/state_tracker/st_texture.h4
33 files changed, 337 insertions, 589 deletions
diff --git a/src/mesa/state_tracker/st_atom_blend.c b/src/mesa/state_tracker/st_atom_blend.c
index 2a0e92245c8..35c09c3e08f 100644
--- a/src/mesa/state_tracker/st_atom_blend.c
+++ b/src/mesa/state_tracker/st_atom_blend.c
@@ -223,15 +223,10 @@ update_blend( struct st_context *st )
const struct st_tracked_state st_update_blend = {
- .name = "st_update_blend",
- .dirty = {
- .mesa = (_NEW_COLOR), /* XXX _NEW_BLEND someday? */
- .st = 0,
+ "st_update_blend", /* name */
+ { /* dirty */
+ (_NEW_COLOR), /* XXX _NEW_BLEND someday? */ /* mesa */
+ 0, /* st */
},
- .update = update_blend
+ update_blend, /* update */
};
-
-
-
-
-
diff --git a/src/mesa/state_tracker/st_atom_clip.c b/src/mesa/state_tracker/st_atom_clip.c
index a6f05686608..23d709b814c 100644
--- a/src/mesa/state_tracker/st_atom_clip.c
+++ b/src/mesa/state_tracker/st_atom_clip.c
@@ -62,15 +62,10 @@ static void update_clip( struct st_context *st )
const struct st_tracked_state st_update_clip = {
- .name = "st_update_clip",
- .dirty = {
- .mesa = (_NEW_TRANSFORM),
- .st = 0,
+ "st_update_clip", /* name */
+ { /* dirty */
+ (_NEW_TRANSFORM), /* mesa */
+ 0, /* st */
},
- .update = update_clip
+ update_clip /* update */
};
-
-
-
-
-
diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c
index 03093579e15..2856e0f0e0f 100644
--- a/src/mesa/state_tracker/st_atom_constbuf.c
+++ b/src/mesa/state_tracker/st_atom_constbuf.c
@@ -36,7 +36,6 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
-#include "pipe/p_winsys.h"
#include "pipe/p_inlines.h"
#include "st_context.h"
@@ -54,7 +53,7 @@ void st_upload_constants( struct st_context *st,
struct gl_program_parameter_list *params,
unsigned id)
{
- struct pipe_winsys *ws = st->pipe->winsys;
+ struct pipe_context *pipe = st->pipe;
struct pipe_constant_buffer *cbuf = &st->state.constants[id];
assert(id == PIPE_SHADER_VERTEX || id == PIPE_SHADER_FRAGMENT);
@@ -74,8 +73,8 @@ void st_upload_constants( struct st_context *st,
/* We always need to get a new buffer, to keep the drivers simple and
* avoid gratuitous rendering synchronization.
*/
- pipe_buffer_reference( ws, &cbuf->buffer, NULL );
- cbuf->buffer = ws->buffer_create( ws, 1, PIPE_BUFFER_USAGE_CONSTANT,
+ pipe_reference_buffer(pipe, &cbuf->buffer, NULL );
+ cbuf->buffer = pipe_buffer_create(pipe, 1, PIPE_BUFFER_USAGE_CONSTANT,
paramBytes );
if (0)
@@ -87,9 +86,10 @@ void st_upload_constants( struct st_context *st,
/* load Mesa constants into the constant buffer */
if (cbuf->buffer) {
- memcpy(ws->buffer_map(ws, cbuf->buffer, PIPE_BUFFER_USAGE_CPU_WRITE),
- params->ParameterValues, paramBytes);
- ws->buffer_unmap(ws, cbuf->buffer);
+ void *map = pipe_buffer_map(pipe, cbuf->buffer,
+ PIPE_BUFFER_USAGE_CPU_WRITE);
+ memcpy(map, params->ParameterValues, paramBytes);
+ pipe_buffer_unmap(pipe, cbuf->buffer);
}
cbuf->size = paramBytes;
@@ -113,12 +113,12 @@ static void update_vs_constants(struct st_context *st )
}
const struct st_tracked_state st_update_vs_constants = {
- .name = "st_update_vs_constants",
- .dirty = {
- .mesa = 0, /* set dynamically above */
- .st = ST_NEW_VERTEX_PROGRAM,
+ "st_update_vs_constants", /* name */
+ { /* dirty */
+ 0, /* set dynamically above */ /* mesa */
+ ST_NEW_VERTEX_PROGRAM, /* st */
},
- .update = update_vs_constants
+ update_vs_constants /* update */
};
/* Fragment shader:
@@ -132,11 +132,11 @@ static void update_fs_constants(struct st_context *st )
}
const struct st_tracked_state st_update_fs_constants = {
- .name = "st_update_fs_constants",
- .dirty = {
- .mesa = 0, /* set dynamically above */
- .st = ST_NEW_FRAGMENT_PROGRAM,
+ "st_update_fs_constants", /* name */
+ { /* dirty */
+ 0, /* set dynamically above */ /* mesa */
+ ST_NEW_FRAGMENT_PROGRAM, /* st */
},
- .update = update_fs_constants
+ update_fs_constants /* update */
};
diff --git a/src/mesa/state_tracker/st_atom_depth.c b/src/mesa/state_tracker/st_atom_depth.c
index ef467582c00..0e791ceb208 100644
--- a/src/mesa/state_tracker/st_atom_depth.c
+++ b/src/mesa/state_tracker/st_atom_depth.c
@@ -142,10 +142,10 @@ update_depth_stencil_alpha(struct st_context *st)
const struct st_tracked_state st_update_depth_stencil_alpha = {
- .name = "st_update_depth_stencil",
- .dirty = {
- .mesa = (_NEW_DEPTH|_NEW_STENCIL|_NEW_COLOR),
- .st = 0,
+ "st_update_depth_stencil", /* name */
+ { /* dirty */
+ (_NEW_DEPTH|_NEW_STENCIL|_NEW_COLOR), /* mesa */
+ 0, /* st */
},
- .update = update_depth_stencil_alpha
+ update_depth_stencil_alpha /* update */
};
diff --git a/src/mesa/state_tracker/st_atom_fixedfunction.c b/src/mesa/state_tracker/st_atom_fixedfunction.c
index 3f137e16339..165567af70c 100644
--- a/src/mesa/state_tracker/st_atom_fixedfunction.c
+++ b/src/mesa/state_tracker/st_atom_fixedfunction.c
@@ -55,12 +55,12 @@ static void update_tnl( struct st_context *st )
const struct st_tracked_state st_update_tnl = {
- .name = "st_update_tnl",
- .dirty = {
- .mesa = TNL_FIXED_FUNCTION_STATE_FLAGS,
- .st = 0
+ "st_update_tnl", /* name */
+ { /* dirty */
+ TNL_FIXED_FUNCTION_STATE_FLAGS, /* mesa */
+ 0 /* st */
},
- .update = update_tnl
+ update_tnl /* update */
};
diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c
index 14eeb58cc1b..0a6974d8a7f 100644
--- a/src/mesa/state_tracker/st_atom_framebuffer.c
+++ b/src/mesa/state_tracker/st_atom_framebuffer.c
@@ -96,11 +96,11 @@ update_framebuffer_state( struct st_context *st )
const struct st_tracked_state st_update_framebuffer = {
- .name = "st_update_framebuffer",
- .dirty = {
- .mesa = _NEW_BUFFERS,
- .st = 0,
+ "st_update_framebuffer", /* name */
+ { /* dirty */
+ _NEW_BUFFERS, /* mesa */
+ 0, /* st */
},
- .update = update_framebuffer_state
+ update_framebuffer_state /* update */
};
diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c
index 76356bbad76..999c1484490 100644
--- a/src/mesa/state_tracker/st_atom_pixeltransfer.c
+++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c
@@ -463,10 +463,10 @@ update_pixel_transfer(struct st_context *st)
const struct st_tracked_state st_update_pixel_transfer = {
- .name = "st_update_pixel_transfer",
- .dirty = {
- .mesa = _NEW_PIXEL | _NEW_COLOR_MATRIX,
- .st = 0,
+ "st_update_pixel_transfer", /* name */
+ { /* dirty */
+ _NEW_PIXEL | _NEW_COLOR_MATRIX, /* mesa */
+ 0, /* st */
},
- .update = update_pixel_transfer
+ update_pixel_transfer /* update */
};
diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c
index bb14cf9045a..87a91d56d06 100644
--- a/src/mesa/state_tracker/st_atom_rasterizer.c
+++ b/src/mesa/state_tracker/st_atom_rasterizer.c
@@ -267,11 +267,11 @@ static void update_raster_state( struct st_context *st )
}
const struct st_tracked_state st_update_rasterizer = {
- .name = "st_update_rasterizer",
- .dirty = {
- .mesa = (_NEW_LIGHT | _NEW_POLYGON | _NEW_LINE | _NEW_SCISSOR |
- _NEW_POINT | _NEW_BUFFERS | _NEW_MULTISAMPLE),
- .st = 0,
+ "st_update_rasterizer", /* name */
+ { /* dirty */
+ (_NEW_LIGHT | _NEW_POLYGON | _NEW_LINE | _NEW_SCISSOR | /* mesa */
+ _NEW_POINT | _NEW_BUFFERS | _NEW_MULTISAMPLE),
+ 0, /* st */
},
- .update = update_raster_state
+ update_raster_state /* update */
};
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index e1ddb53b80f..10283d31a19 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -32,11 +32,14 @@
*/
+#include "main/macros.h"
+
#include "st_context.h"
#include "st_atom.h"
#include "st_program.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
+
#include "cso_cache/cso_context.h"
@@ -147,17 +150,9 @@ update_samplers(struct st_context *st)
sampler->normalized_coords = 1;
sampler->lod_bias = st->ctx->Texture.Unit[su].LodBias;
-#if 1
- sampler->min_lod = (texobj->MinLod) < 0.0 ? 0.0 : texobj->MinLod;
- sampler->max_lod = texobj->MaxLod;
-#else
- /* min/max lod should really be as follows (untested).
- * Also, calculate_first_last_level() needs to be overhauled
- * since today's hardware had real support for LOD clamping.
- */
- sampler->min_lod = MAX2(texobj->BaseLevel, texobj->MinLod);
- sampler->max_lod = MIN2(texobj->MaxLevel, texobj->MaxLod);
-#endif
+ sampler->min_lod = MAX2(0.0f, texobj->MinLod);
+ sampler->max_lod = MIN2(texobj->MaxLevel - texobj->BaseLevel,
+ texobj->MaxLod);
sampler->border_color[0] = texobj->BorderColor[RCOMP];
sampler->border_color[1] = texobj->BorderColor[GCOMP];
@@ -193,15 +188,10 @@ update_samplers(struct st_context *st)
const struct st_tracked_state st_update_sampler = {
- .name = "st_update_sampler",
- .dirty = {
- .mesa = _NEW_TEXTURE,
- .st = 0,
+ "st_update_sampler", /* name */
+ { /* dirty */
+ _NEW_TEXTURE, /* mesa */
+ 0, /* st */
},
- .update = update_samplers
+ update_samplers /* update */
};
-
-
-
-
-
diff --git a/src/mesa/state_tracker/st_atom_scissor.c b/src/mesa/state_tracker/st_atom_scissor.c
index 59601e91a11..f5db4924037 100644
--- a/src/mesa/state_tracker/st_atom_scissor.c
+++ b/src/mesa/state_tracker/st_atom_scissor.c
@@ -83,15 +83,10 @@ update_scissor( struct st_context *st )
const struct st_tracked_state st_update_scissor = {
- .name = "st_update_scissor",
- .dirty = {
- .mesa = (_NEW_SCISSOR | _NEW_BUFFERS),
- .st = 0,
+ "st_update_scissor", /* name */
+ { /* dirty */
+ (_NEW_SCISSOR | _NEW_BUFFERS), /* mesa */
+ 0, /* st */
},
- .update = update_scissor
+ update_scissor /* update */
};
-
-
-
-
-
diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
index 3f5ec711128..652500f52a2 100644
--- a/src/mesa/state_tracker/st_atom_shader.c
+++ b/src/mesa/state_tracker/st_atom_shader.c
@@ -281,10 +281,10 @@ update_linkage( struct st_context *st )
const struct st_tracked_state st_update_shader = {
- .name = "st_update_shader",
- .dirty = {
- .mesa = 0,
- .st = ST_NEW_VERTEX_PROGRAM | ST_NEW_FRAGMENT_PROGRAM
+ "st_update_shader", /* name */
+ { /* dirty */
+ 0, /* mesa */
+ ST_NEW_VERTEX_PROGRAM | ST_NEW_FRAGMENT_PROGRAM /* st */
},
- .update = update_linkage
+ update_linkage /* update */
};
diff --git a/src/mesa/state_tracker/st_atom_stipple.c b/src/mesa/state_tracker/st_atom_stipple.c
index c91214059a7..f395930ab40 100644
--- a/src/mesa/state_tracker/st_atom_stipple.c
+++ b/src/mesa/state_tracker/st_atom_stipple.c
@@ -54,10 +54,10 @@ update_stipple( struct st_context *st )
const struct st_tracked_state st_update_polygon_stipple = {
- .name = "st_update_polygon_stipple",
- .dirty = {
- .mesa = (_NEW_POLYGONSTIPPLE),
- .st = 0,
+ "st_update_polygon_stipple", /* name */
+ { /* dirty */
+ (_NEW_POLYGONSTIPPLE), /* mesa */
+ 0, /* st */
},
- .update = update_stipple
+ update_stipple /* update */
};
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index d15da5895ab..767654f3d0f 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -90,6 +90,8 @@ update_textures(struct st_context *st)
}
st->state.num_textures = su + 1;
+
+ stObj->teximage_realloc = TRUE;
}
pt = st_get_stobj_texture(stObj);
@@ -111,15 +113,10 @@ update_textures(struct st_context *st)
const struct st_tracked_state st_update_texture = {
- .name = "st_update_texture",
- .dirty = {
- .mesa = _NEW_TEXTURE,
- .st = ST_NEW_FRAGMENT_PROGRAM,
+ "st_update_texture", /* name */
+ { /* dirty */
+ _NEW_TEXTURE, /* mesa */
+ ST_NEW_FRAGMENT_PROGRAM, /* st */
},
- .update = update_textures
+ update_textures /* update */
};
-
-
-
-
-
diff --git a/src/mesa/state_tracker/st_atom_viewport.c b/src/mesa/state_tracker/st_atom_viewport.c
index eb3f62cfbea..4b51521470b 100644
--- a/src/mesa/state_tracker/st_atom_viewport.c
+++ b/src/mesa/state_tracker/st_atom_viewport.c
@@ -82,10 +82,10 @@ update_viewport( struct st_context *st )
const struct st_tracked_state st_update_viewport = {
- .name = "st_update_viewport",
- .dirty = {
- .mesa = _NEW_BUFFERS | _NEW_VIEWPORT,
- .st = 0,
+ "st_update_viewport", /* name */
+ { /* dirty */
+ _NEW_BUFFERS | _NEW_VIEWPORT, /* mesa */
+ 0, /* st */
},
- .update = update_viewport
+ update_viewport /* update */
};
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index 836758a3365..ce8fefe703f 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -50,7 +50,6 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
-#include "pipe/p_winsys.h"
#include "util/p_tile.h"
#include "util/u_draw_quad.h"
#include "util/u_simple_shaders.h"
@@ -90,10 +89,14 @@ struct bitmap_cache
GLint xpos, ypos;
/** Bounds of region used in window coords */
GLint xmin, ymin, xmax, ymax;
+
struct pipe_texture *texture;
+ struct pipe_surface *surf;
+
GLboolean empty;
+
/** An I8 texture image: */
- GLubyte buffer[BITMAP_CACHE_HEIGHT][BITMAP_CACHE_WIDTH];
+ ubyte *buffer;
};
@@ -220,76 +223,37 @@ combined_bitmap_fragment_program(GLcontext *ctx)
/**
- * Create a texture which represents a bitmap image.
+ * Copy user-provide bitmap bits into texture buffer, expanding
+ * bits into texels.
+ * "On" bits will set texels to 0xff.
+ * "Off" bits will not modify texels.
+ * Note that the image is actually going to be upside down in
+ * the texture. We deal with that with texcoords.
*/
-static struct pipe_texture *
-make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
- const struct gl_pixelstore_attrib *unpack,
- const GLubyte *bitmap)
+static void
+unpack_bitmap(struct st_context *st,
+ GLint px, GLint py, GLsizei width, GLsizei height,
+ const struct gl_pixelstore_attrib *unpack,
+ const GLubyte *bitmap,
+ ubyte *destBuffer, uint destStride)
{
- struct pipe_context *pipe = ctx->st->pipe;
- struct pipe_screen *screen = pipe->screen;
- struct pipe_surface *surface;
- uint format = 0, cpp, comp;
- ubyte *dest;
- struct pipe_texture *pt;
- int row, col;
-
- /* find a texture format we know */
- if (screen->is_format_supported( screen, PIPE_FORMAT_U_I8, PIPE_TEXTURE )) {
- format = PIPE_FORMAT_U_I8;
- cpp = 1;
- comp = 0;
- }
- else if (screen->is_format_supported( screen, PIPE_FORMAT_A8R8G8B8_UNORM, PIPE_TEXTURE )) {
- format = PIPE_FORMAT_A8R8G8B8_UNORM;
- cpp = 4;
- comp = 3; /* alpha channel */ /*XXX little-endian dependency */
- }
- else {
- /* XXX support more formats */
- assert( 0 );
- }
-
- /* PBO source... */
- bitmap = _mesa_map_bitmap_pbo(ctx, unpack, bitmap);
- if (!bitmap) {
- return NULL;
- }
-
- /**
- * Create texture to hold bitmap pattern.
- */
- pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, format, 0, width, height,
- 1, 0);
- if (!pt) {
- _mesa_unmap_bitmap_pbo(ctx, unpack);
- return NULL;
- }
-
- surface = screen->get_tex_surface(screen, pt, 0, 0, 0);
-
- /* map texture surface */
- dest = pipe_surface_map(surface);
+ GLint row, col;
- /* Put image into texture surface.
- * Note that the image is actually going to be upside down in
- * the texture. We deal with that with texcoords.
- */
+#define SET_PIXEL(COL, ROW) \
+ destBuffer[(py + (ROW)) * destStride + px + (COL)] = 0x0;
for (row = 0; row < height; row++) {
const GLubyte *src = (const GLubyte *) _mesa_image_address2d(unpack,
bitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, row, 0);
- ubyte *destRow = dest + row * surface->pitch * cpp;
if (unpack->LsbFirst) {
/* Lsb first */
GLubyte mask = 1U << (unpack->SkipPixels & 0x7);
for (col = 0; col < width; col++) {
- /* set texel to 255 if bit is set */
- destRow[comp] = (*src & mask) ? 0x0 : 0xff;
- destRow += cpp;
+ if (*src & mask) {
+ SET_PIXEL(col, row);
+ }
if (mask == 128U) {
src++;
@@ -309,9 +273,9 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
GLubyte mask = 128U >> (unpack->SkipPixels & 0x7);
for (col = 0; col < width; col++) {
- /* set texel to 255 if bit is set */
- destRow[comp] =(*src & mask) ? 0x0 : 0xff;
- destRow += cpp;
+ if (*src & mask) {
+ SET_PIXEL(col, row);
+ }
if (mask == 1U) {
src++;
@@ -329,6 +293,50 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
} /* row */
+#undef SET_PIXEL
+}
+
+
+/**
+ * Create a texture which represents a bitmap image.
+ */
+static struct pipe_texture *
+make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
+ const struct gl_pixelstore_attrib *unpack,
+ const GLubyte *bitmap)
+{
+ struct pipe_context *pipe = ctx->st->pipe;
+ struct pipe_screen *screen = pipe->screen;
+ struct pipe_surface *surface;
+ ubyte *dest;
+ struct pipe_texture *pt;
+
+ /* PBO source... */
+ bitmap = _mesa_map_bitmap_pbo(ctx, unpack, bitmap);
+ if (!bitmap) {
+ return NULL;
+ }
+
+ /**
+ * Create texture to hold bitmap pattern.
+ */
+ pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, ctx->st->bitmap.tex_format,
+ 0, width, height, 1, 0);
+ if (!pt) {
+ _mesa_unmap_bitmap_pbo(ctx, unpack);
+ return NULL;
+ }
+
+ surface = screen->get_tex_surface(screen, pt, 0, 0, 0);
+
+ /* map texture surface */
+ dest = pipe_surface_map(surface);
+
+ /* Put image into texture surface */
+ memset(dest, 0xff, height * surface->pitch);
+ unpack_bitmap(ctx->st, 0, 0, width, height, unpack, bitmap,
+ dest, surface->pitch);
+
_mesa_unmap_bitmap_pbo(ctx, unpack);
/* Release surface */
@@ -336,8 +344,6 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
pipe_surface_reference(&surface, NULL);
pipe->texture_update(pipe, pt, 0, 0x1);
- pt->format = format;
-
return pt;
}
@@ -365,9 +371,8 @@ setup_bitmap_vertex_data(struct st_context *st,
void *buf;
if (!st->bitmap.vbuf) {
- st->bitmap.vbuf = pipe->winsys->buffer_create(pipe->winsys, 32,
- PIPE_BUFFER_USAGE_VERTEX,
- sizeof(st->bitmap.vertices));
+ st->bitmap.vbuf = pipe_buffer_create(pipe, 32, PIPE_BUFFER_USAGE_VERTEX,
+ sizeof(st->bitmap.vertices));
}
/* Positions are in clip coords since we need to do clipping in case
@@ -406,10 +411,9 @@ setup_bitmap_vertex_data(struct st_context *st,
}
/* put vertex data into vbuf */
- buf = pipe->winsys->buffer_map(pipe->winsys, st->bitmap.vbuf,
- PIPE_BUFFER_USAGE_CPU_WRITE);
+ buf = pipe_buffer_map(pipe, st->bitmap.vbuf, PIPE_BUFFER_USAGE_CPU_WRITE);
memcpy(buf, st->bitmap.vertices, sizeof(st->bitmap.vertices));
- pipe->winsys->buffer_unmap(pipe->winsys, st->bitmap.vbuf);
+ pipe_buffer_unmap(pipe, st->bitmap.vbuf);
}
@@ -517,46 +521,34 @@ draw_bitmap_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
static void
reset_cache(struct st_context *st)
{
- memset(st->bitmap.cache->buffer, 0xff, sizeof(st->bitmap.cache->buffer));
- st->bitmap.cache->empty = GL_TRUE;
-
- st->bitmap.cache->xmin = 1000000;
- st->bitmap.cache->xmax = -1000000;
- st->bitmap.cache->ymin = 1000000;
- st->bitmap.cache->ymax = -1000000;
-}
-
-
-static void
-init_bitmap_cache(struct st_context *st)
-{
struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
- enum pipe_format format;
+ struct bitmap_cache *cache = st->bitmap.cache;
- st->bitmap.cache = CALLOC_STRUCT(bitmap_cache);
- if (!st->bitmap.cache)
- return;
+ //memset(cache->buffer, 0xff, sizeof(cache->buffer));
+ cache->empty = GL_TRUE;
- /* find a usable texture format */
- if (screen->is_format_supported(screen, PIPE_FORMAT_U_I8, PIPE_TEXTURE)) {
- format = PIPE_FORMAT_U_I8;
- }
- else {
- /* XXX support more formats */
- assert(0);
- }
+ cache->xmin = 1000000;
+ cache->xmax = -1000000;
+ cache->ymin = 1000000;
+ cache->ymax = -1000000;
- st->bitmap.cache->texture
- = st_texture_create(st, PIPE_TEXTURE_2D, format, 0,
- BITMAP_CACHE_WIDTH, BITMAP_CACHE_HEIGHT, 1, 0);
- if (!st->bitmap.cache->texture) {
- FREE(st->bitmap.cache);
- st->bitmap.cache = NULL;
- return;
- }
+ assert(!cache->texture);
- reset_cache(st);
+ /* allocate a new texture */
+ cache->texture = st_texture_create(st, PIPE_TEXTURE_2D,
+ st->bitmap.tex_format, 0,
+ BITMAP_CACHE_WIDTH, BITMAP_CACHE_HEIGHT,
+ 1, 0);
+
+ /* Map the texture surface.
+ * Subsequent glBitmap calls will write into the texture image.
+ */
+ cache->surf = screen->get_tex_surface(screen, cache->texture, 0, 0, 0);
+ cache->buffer = pipe_surface_map(cache->surf);
+
+ /* init image to all 0xff */
+ memset(cache->buffer, 0xff, BITMAP_CACHE_WIDTH * BITMAP_CACHE_HEIGHT);
}
@@ -570,9 +562,6 @@ st_flush_bitmap_cache(struct st_context *st)
if (st->ctx->DrawBuffer) {
struct bitmap_cache *cache = st->bitmap.cache;
struct pipe_context *pipe = st->pipe;
- struct pipe_screen *screen = pipe->screen;
- struct pipe_surface *surf;
- void *dest;
assert(cache->xmin <= cache->xmax);
/*
@@ -582,18 +571,13 @@ st_flush_bitmap_cache(struct st_context *st)
cache->xpos, cache->ypos);
*/
- /* update the texture map image */
- surf = screen->get_tex_surface(screen, cache->texture, 0, 0, 0);
- dest = pipe_surface_map(surf);
- memcpy(dest, cache->buffer, sizeof(cache->buffer));
- pipe_surface_unmap(surf);
- pipe_surface_reference(&surf, NULL);
-
- /* flush in case the previous texture contents haven't been
- * used yet. XXX this is not ideal! Revisit.
+ /* The texture surface has been mapped until now.
+ * So unmap and release the texture surface before drawing.
*/
- st->pipe->flush( st->pipe, 0x0, NULL );
+ pipe_surface_unmap(cache->surf);
+ pipe_surface_reference(&cache->surf, NULL);
+ /* XXX is this needed? */
pipe->texture_update(pipe, cache->texture, 0, 0x1);
draw_bitmap_quad(st->ctx,
@@ -602,6 +586,9 @@ st_flush_bitmap_cache(struct st_context *st)
st->ctx->Current.RasterPos[2],
BITMAP_CACHE_WIDTH, BITMAP_CACHE_HEIGHT,
cache->texture);
+
+ /* release/free the texture */
+ pipe_texture_reference(&cache->texture, NULL);
}
reset_cache(st);
}
@@ -619,7 +606,6 @@ accum_bitmap(struct st_context *st,
const GLubyte *bitmap )
{
struct bitmap_cache *cache = st->bitmap.cache;
- int row, col;
int px = -999, py;
if (width > BITMAP_CACHE_WIDTH ||
@@ -658,60 +644,8 @@ accum_bitmap(struct st_context *st,
if (y + height > cache->ymax)
cache->ymax = y + height;
- /* XXX try to combine this code with code in make_bitmap_texture() */
-#define SET_PIXEL(COL, ROW) \
- cache->buffer[py + (ROW)][px + (COL)] = 0x0;
-
- for (row = 0; row < height; row++) {
- const GLubyte *src = (const GLubyte *) _mesa_image_address2d(unpack,
- bitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, row, 0);
-
- if (unpack->LsbFirst) {
- /* Lsb first */
- GLubyte mask = 1U << (unpack->SkipPixels & 0x7);
- for (col = 0; col < width; col++) {
-
- if (*src & mask) {
- SET_PIXEL(col, row);
- }
-
- if (mask == 128U) {
- src++;
- mask = 1U;
- }
- else {
- mask = mask << 1;
- }
- }
-
- /* get ready for next row */
- if (mask != 1)
- src++;
- }
- else {
- /* Msb first */
- GLubyte mask = 128U >> (unpack->SkipPixels & 0x7);
- for (col = 0; col < width; col++) {
-
- if (*src & mask) {
- SET_PIXEL(col, row);
- }
-
- if (mask == 1U) {
- src++;
- mask = 128U;
- }
- else {
- mask = mask >> 1;
- }
- }
-
- /* get ready for next row */
- if (mask != 128)
- src++;
- }
-
- } /* row */
+ unpack_bitmap(st, px, py, width, height, unpack, bitmap,
+ cache->buffer, BITMAP_CACHE_WIDTH);
return GL_TRUE; /* accumulated */
}
@@ -750,6 +684,7 @@ st_Bitmap(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
assert(pt->target == PIPE_TEXTURE_2D);
draw_bitmap_quad(ctx, x, y, ctx->Current.RasterPos[2],
width, height, pt);
+ /* release/free the texture */
pipe_texture_reference(&pt, NULL);
}
}
@@ -768,6 +703,8 @@ void
st_init_bitmap(struct st_context *st)
{
struct pipe_sampler_state *sampler = &st->bitmap.sampler;
+ struct pipe_context *pipe = st->pipe;
+ struct pipe_screen *screen = pipe->screen;
/* init sampler state once */
memset(sampler, 0, sizeof(*sampler));
@@ -784,7 +721,19 @@ st_init_bitmap(struct st_context *st)
st->bitmap.rasterizer.gl_rasterization_rules = 1;
st->bitmap.rasterizer.bypass_vs = 1;
- init_bitmap_cache(st);
+ /* find a usable texture format */
+ if (screen->is_format_supported(screen, PIPE_FORMAT_I8_UNORM, PIPE_TEXTURE)) {
+ st->bitmap.tex_format = PIPE_FORMAT_I8_UNORM;
+ }
+ else {
+ /* XXX support more formats */
+ assert(0);
+ }
+
+ /* alloc bitmap cache object */
+ st->bitmap.cache = CALLOC_STRUCT(bitmap_cache);
+
+ reset_cache(st);
}
@@ -809,7 +758,7 @@ st_destroy_bitmap(struct st_context *st)
}
if (st->bitmap.vbuf) {
- pipe->winsys->buffer_destroy(pipe->winsys, st->bitmap.vbuf);
+ pipe_buffer_destroy(pipe, st->bitmap.vbuf);
st->bitmap.vbuf = NULL;
}
diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c
index fa1254ff7ca..af79aefa968 100644
--- a/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -35,7 +35,6 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
-#include "pipe/p_winsys.h"
#include "pipe/p_inlines.h"
@@ -79,7 +78,7 @@ st_bufferobj_free(GLcontext *ctx, struct gl_buffer_object *obj)
struct st_buffer_object *st_obj = st_buffer_object(obj);
if (st_obj->buffer)
- pipe_buffer_reference(pipe->winsys, &st_obj->buffer, NULL);
+ pipe_reference_buffer(pipe, &st_obj->buffer, NULL);
free(st_obj);
}
@@ -106,10 +105,9 @@ st_bufferobj_subdata(GLcontext *ctx,
if (offset >= st_obj->size || size > (st_obj->size - offset))
return;
- map = pipe->winsys->buffer_map(pipe->winsys, st_obj->buffer,
- PIPE_BUFFER_USAGE_CPU_WRITE);
+ map = pipe_buffer_map(pipe, st_obj->buffer, PIPE_BUFFER_USAGE_CPU_WRITE);
memcpy(map + offset, data, size);
- pipe->winsys->buffer_unmap(pipe->winsys, st_obj->buffer);
+ pipe_buffer_unmap(pipe, st_obj->buffer);
}
@@ -130,10 +128,9 @@ st_bufferobj_get_subdata(GLcontext *ctx,
if (offset >= st_obj->size || size > (st_obj->size - offset))
return;
- map = pipe->winsys->buffer_map(pipe->winsys, st_obj->buffer,
- PIPE_BUFFER_USAGE_CPU_READ);
+ map = pipe_buffer_map(pipe, st_obj->buffer, PIPE_BUFFER_USAGE_CPU_READ);
memcpy(data, map + offset, size);
- pipe->winsys->buffer_unmap(pipe->winsys, st_obj->buffer);
+ pipe_buffer_unmap(pipe, st_obj->buffer);
}
@@ -174,10 +171,9 @@ st_bufferobj_data(GLcontext *ctx,
buffer_usage = 0;
}
- pipe_buffer_reference( pipe->winsys, &st_obj->buffer, NULL );
+ pipe_reference_buffer( pipe, &st_obj->buffer, NULL );
- st_obj->buffer = pipe->winsys->buffer_create( pipe->winsys, 32, buffer_usage,
- size );
+ st_obj->buffer = pipe_buffer_create( pipe, 32, buffer_usage, size );
st_obj->size = size;
@@ -211,7 +207,7 @@ st_bufferobj_map(GLcontext *ctx, GLenum target, GLenum access,
break;
}
- obj->Pointer = pipe->winsys->buffer_map(pipe->winsys, st_obj->buffer, flags);
+ obj->Pointer = pipe_buffer_map(pipe, st_obj->buffer, flags);
return obj->Pointer;
}
@@ -225,7 +221,7 @@ st_bufferobj_unmap(GLcontext *ctx, GLenum target, struct gl_buffer_object *obj)
struct pipe_context *pipe = st_context(ctx)->pipe;
struct st_buffer_object *st_obj = st_buffer_object(obj);
- pipe->winsys->buffer_unmap(pipe->winsys, st_obj->buffer);
+ pipe_buffer_unmap(pipe, st_obj->buffer);
obj->Pointer = NULL;
return GL_TRUE;
}
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index 95a5fb8db47..b7d72046339 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -34,8 +34,8 @@
#include "main/glheader.h"
#include "main/macros.h"
#include "shader/prog_instruction.h"
-#include "st_atom.h"
#include "st_context.h"
+#include "st_atom.h"
#include "st_cb_accum.h"
#include "st_cb_clear.h"
#include "st_cb_fbo.h"
@@ -45,9 +45,9 @@
#include "st_mesa_to_tgsi.h"
#include "pipe/p_context.h"
+#include "pipe/p_inlines.h"
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
-#include "pipe/p_winsys.h"
#include "util/u_pack_color.h"
#include "util/u_simple_shaders.h"
#include "util/u_draw_quad.h"
@@ -106,7 +106,7 @@ st_destroy_clear(struct st_context *st)
st->clear.vs = NULL;
}
if (st->clear.vbuf) {
- pipe->winsys->buffer_destroy(pipe->winsys, st->clear.vbuf);
+ pipe_buffer_destroy(pipe, st->clear.vbuf);
st->clear.vbuf = NULL;
}
}
@@ -142,9 +142,8 @@ draw_quad(GLcontext *ctx,
void *buf;
if (!st->clear.vbuf) {
- st->clear.vbuf = pipe->winsys->buffer_create(pipe->winsys, 32,
- PIPE_BUFFER_USAGE_VERTEX,
- sizeof(st->clear.vertices));
+ st->clear.vbuf = pipe_buffer_create(pipe, 32, PIPE_BUFFER_USAGE_VERTEX,
+ sizeof(st->clear.vertices));
}
/* positions */
@@ -171,10 +170,9 @@ draw_quad(GLcontext *ctx,
}
/* put vertex data into vbuf */
- buf = pipe->winsys->buffer_map(pipe->winsys, st->clear.vbuf,
- PIPE_BUFFER_USAGE_CPU_WRITE);
+ buf = pipe_buffer_map(pipe, st->clear.vbuf, PIPE_BUFFER_USAGE_CPU_WRITE);
memcpy(buf, st->clear.vertices, sizeof(st->clear.vertices));
- pipe->winsys->buffer_unmap(pipe->winsys, st->clear.vbuf);
+ pipe_buffer_unmap(pipe, st->clear.vbuf);
/* draw */
util_draw_vertex_buffer(pipe, st->clear.vbuf,
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 7597ea323c7..65bfd6cfcc0 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -55,7 +55,6 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
-#include "pipe/p_winsys.h"
#include "util/p_tile.h"
#include "util/u_draw_quad.h"
#include "shader/prog_instruction.h"
@@ -483,20 +482,18 @@ draw_quad(GLcontext *ctx, GLfloat x0, GLfloat y0, GLfloat z,
ubyte *map;
/* allocate/load buffer object with vertex data */
- buf = pipe->winsys->buffer_create(pipe->winsys, 32,
- PIPE_BUFFER_USAGE_VERTEX,
- sizeof(verts));
- map = pipe->winsys->buffer_map(pipe->winsys, buf,
- PIPE_BUFFER_USAGE_CPU_WRITE);
+ buf = pipe_buffer_create(pipe,32, PIPE_BUFFER_USAGE_VERTEX,
+ sizeof(verts));
+ map = pipe_buffer_map(pipe, buf, PIPE_BUFFER_USAGE_CPU_WRITE);
memcpy(map, verts, sizeof(verts));
- pipe->winsys->buffer_unmap(pipe->winsys, buf);
+ pipe_buffer_unmap(pipe, buf);
util_draw_vertex_buffer(pipe, buf,
PIPE_PRIM_QUADS,
4, /* verts */
3); /* attribs/vert */
- pipe->winsys->buffer_destroy(pipe->winsys, buf);
+ pipe_buffer_destroy(pipe, buf);
}
}
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 2d741d93908..fc8a5ea7f62 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -105,7 +105,7 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
}
else if (strb->surface->buffer) {
/* release/discard the old surface buffer */
- pipe_buffer_reference(pipe->winsys, &strb->surface->buffer, NULL);
+ pipe_reference_buffer(pipe, &strb->surface->buffer, NULL);
}
/* Determine surface format here */
diff --git a/src/mesa/state_tracker/st_cb_strings.c b/src/mesa/state_tracker/st_cb_strings.c
index 247519ab3de..066124f8f30 100644
--- a/src/mesa/state_tracker/st_cb_strings.c
+++ b/src/mesa/state_tracker/st_cb_strings.c
@@ -53,21 +53,21 @@ st_get_string(GLcontext * ctx, GLenum name)
const char *vendor = screen->get_vendor( screen );
const char *tungsten = "Tungsten Graphics, Inc.";
- /* Tungsten developed the state_tracker module (and much of
- * Mesa), but the driver itself may come from elsewhere. The
- * additional string allows "and XyzCorp" to reflect this.
+ /* Tungsten Graphics, Inc. developed the state_tracker module
+ * (and much of Mesa), but the driver itself may come from elsewhere.
+ * The additional string allows "and XyzCorp" to reflect this.
*/
if (vendor && strcmp(vendor, tungsten) != 0)
- snprintf(st->vendor, sizeof(st->vendor),
+ util_snprintf(st->vendor, sizeof(st->vendor),
"%s and %s", tungsten, vendor);
else
- snprintf(st->vendor, sizeof(st->vendor), "%s", tungsten);
+ util_snprintf(st->vendor, sizeof(st->vendor), "%s", tungsten);
return (GLubyte *) st->vendor;
}
case GL_RENDERER:
- snprintf(st->renderer, sizeof(st->renderer), "Gallium %s, %s on %s",
+ util_snprintf(st->renderer, sizeof(st->renderer), "Gallium %s, %s on %s",
ST_VERSION_STRING,
screen->get_name( screen ),
screen->winsys->get_name( screen->winsys ));
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 3d9c550d8c1..02ef961e4d3 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -494,6 +494,10 @@ st_TexImage(GLcontext * ctx,
strip_texture_border(border, &width, &height, &depth,
unpack, &unpackNB);
unpack = &unpackNB;
+ texImage->Width = width;
+ texImage->Height = height;
+ texImage->Depth = depth;
+ texImage->Border = 0;
border = 0;
}
@@ -552,15 +556,17 @@ st_TexImage(GLcontext * ctx,
* waiting on any outstanding fences.
*/
if (stObj->pt &&
- /*stObj->pt->first_level == level &&*/
- stObj->pt->last_level == level &&
- stObj->pt->target != PIPE_TEXTURE_CUBE &&
- !st_texture_match_image(stObj->pt, &stImage->base,
- stImage->face, stImage->level)) {
+ (stObj->teximage_realloc ||
+ (/*stObj->pt->first_level == level &&*/
+ stObj->pt->last_level == level &&
+ stObj->pt->target != PIPE_TEXTURE_CUBE &&
+ !st_texture_match_image(stObj->pt, &stImage->base,
+ stImage->face, stImage->level)))) {
DBG("release it\n");
pipe_texture_release(&stObj->pt);
assert(!stObj->pt);
+ stObj->teximage_realloc = FALSE;
}
if (!stObj->pt) {
@@ -1338,8 +1344,6 @@ static void
calculate_first_last_level(struct st_texture_object *stObj)
{
struct gl_texture_object *tObj = &stObj->base;
- const struct gl_texture_image *const baseImage =
- tObj->Image[0][tObj->BaseLevel];
/* These must be signed values. MinLod and MaxLod can be negative numbers,
* and having firstLevel and lastLevel as signed prevents the need for
@@ -1362,7 +1366,7 @@ calculate_first_last_level(struct st_texture_object *stObj)
}
else {
firstLevel = 0;
- lastLevel = MIN2(tObj->MaxLevel - tObj->BaseLevel, baseImage->MaxLog2);
+ lastLevel = MIN2(tObj->MaxLevel, tObj->Image[0][0]->WidthLog2);
}
break;
case GL_TEXTURE_RECTANGLE_NV:
@@ -1444,17 +1448,6 @@ st_finalize_texture(GLcontext *ctx,
calculate_first_last_level(stObj);
firstImage = st_texture_image(stObj->base.Image[0][stObj->base.BaseLevel]);
-#if 0
- /* Fallback case:
- */
- if (firstImage->base.Border) {
- if (stObj->pt) {
- pipe_texture_release(&stObj->pt);
- }
- return GL_FALSE;
- }
-#endif
-
/* If both firstImage and stObj point to a texture which can contain
* all active images, favour firstImage. Note that because of the
* completeness requirement, we know that the image dimensions
@@ -1478,24 +1471,25 @@ st_finalize_texture(GLcontext *ctx,
cpp = firstImage->base.TexFormat->TexelBytes;
}
- /* Check texture can hold all active levels. Check texture matches
- * target, imageFormat, etc.
+ /* If we already have a gallium texture, check that it matches the texture
+ * object's format, target, size, num_levels, etc.
*/
- if (stObj->pt &&
- (stObj->pt->target != gl_target_to_pipe(stObj->base.Target) ||
- stObj->pt->format !=
- st_mesa_format_to_pipe_format(firstImage->base.TexFormat->MesaFormat) ||
- stObj->pt->last_level != stObj->lastLevel ||
- stObj->pt->width[0] != firstImage->base.Width2 ||
- stObj->pt->height[0] != firstImage->base.Height2 ||
- stObj->pt->depth[0] != firstImage->base.Depth2 ||
- stObj->pt->cpp != cpp ||
- stObj->pt->compressed != firstImage->base.IsCompressed)) {
- pipe_texture_release(&stObj->pt);
+ if (stObj->pt) {
+ const enum pipe_format fmt =
+ st_mesa_format_to_pipe_format(firstImage->base.TexFormat->MesaFormat);
+ if (stObj->pt->target != gl_target_to_pipe(stObj->base.Target) ||
+ stObj->pt->format != fmt ||
+ stObj->pt->last_level < stObj->lastLevel ||
+ stObj->pt->width[0] != firstImage->base.Width2 ||
+ stObj->pt->height[0] != firstImage->base.Height2 ||
+ stObj->pt->depth[0] != firstImage->base.Depth2 ||
+ stObj->pt->cpp != cpp ||
+ stObj->pt->compressed != firstImage->base.IsCompressed) {
+ pipe_texture_release(&stObj->pt);
+ }
}
-
- /* May need to create a new texture:
+ /* May need to create a new gallium texture:
*/
if (!stObj->pt) {
stObj->pt = st_texture_create(ctx->st,
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 8a30871fa07..c900064f2b8 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -55,7 +55,6 @@
#include "st_gen_mipmap.h"
#include "st_program.h"
#include "pipe/p_context.h"
-#include "pipe/p_winsys.h"
#include "pipe/p_inlines.h"
#include "draw/draw_context.h"
#include "cso_cache/cso_cache.h"
@@ -157,7 +156,6 @@ struct st_context *st_create_context(struct pipe_context *pipe,
static void st_destroy_context_priv( struct st_context *st )
{
- struct pipe_winsys *ws = st->pipe->winsys;
uint i;
draw_destroy(st->draw);
@@ -172,7 +170,7 @@ static void st_destroy_context_priv( struct st_context *st )
for (i = 0; i < Elements(st->state.constants); i++) {
if (st->state.constants[i].buffer) {
- pipe_buffer_reference(ws, &st->state.constants[i].buffer, NULL);
+ pipe_reference_buffer(st->pipe, &st->state.constants[i].buffer, NULL);
}
}
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index 80a71d17667..1ca779d0a98 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -145,6 +145,7 @@ struct st_context
struct pipe_rasterizer_state rasterizer;
struct pipe_sampler_state sampler;
struct pipe_shader_state vert_shader;
+ enum pipe_format tex_format;
void *vs;
float vertices[4][3][4]; /**< vertex pos + color + texcoord */
struct pipe_buffer *vbuf;
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index 6c20120ac7a..a3bffbfc95b 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -35,15 +35,14 @@
#include "vbo/vbo.h"
-#include "st_atom.h"
#include "st_context.h"
+#include "st_atom.h"
#include "st_cb_bufferobjects.h"
#include "st_draw.h"
#include "st_program.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
-#include "pipe/p_winsys.h"
#include "pipe/p_inlines.h"
#include "draw/draw_private.h"
@@ -219,8 +218,7 @@ setup_edgeflags(GLcontext *ctx, GLenum primMode, GLint start, GLint count,
if (!vec)
return NULL;
- map = pipe->winsys->buffer_map(pipe->winsys, stobj->buffer,
- PIPE_BUFFER_USAGE_CPU_READ);
+ map = pipe_buffer_map(pipe, stobj->buffer, PIPE_BUFFER_USAGE_CPU_READ);
map = ADD_POINTERS(map, array->Ptr);
for (i = 0; i < count; i++) {
@@ -230,7 +228,7 @@ setup_edgeflags(GLcontext *ctx, GLenum primMode, GLint start, GLint count,
map += array->StrideB;
}
- pipe->winsys->buffer_unmap(pipe->winsys, stobj->buffer);
+ pipe_buffer_unmap(pipe, stobj->buffer);
pipe->set_edgeflags(pipe, vec);
@@ -260,7 +258,6 @@ st_draw_vbo(GLcontext *ctx,
GLuint max_index)
{
struct pipe_context *pipe = ctx->st->pipe;
- struct pipe_winsys *winsys = pipe->winsys;
const struct st_vertex_program *vp;
const struct pipe_shader_state *vs;
struct pipe_vertex_buffer vbuffer[PIPE_MAX_SHADER_INPUTS];
@@ -292,7 +289,7 @@ st_draw_vbo(GLcontext *ctx,
assert(stobj->buffer);
vbuffer[attr].buffer = NULL;
- pipe_buffer_reference(winsys, &vbuffer[attr].buffer, stobj->buffer);
+ pipe_reference_buffer(pipe, &vbuffer[attr].buffer, stobj->buffer);
vbuffer[attr].buffer_offset = (unsigned) arrays[0]->Ptr;/* in bytes */
velements[attr].src_offset = arrays[mesaAttr]->Ptr - arrays[0]->Ptr;
assert(velements[attr].src_offset <= 2048); /* 11-bit field */
@@ -310,9 +307,8 @@ st_draw_vbo(GLcontext *ctx,
/* wrap user data */
vbuffer[attr].buffer
- = winsys->user_buffer_create(winsys,
- (void *) arrays[mesaAttr]->Ptr,
- bytes);
+ = pipe_user_buffer_create(pipe, (void *) arrays[mesaAttr]->Ptr,
+ bytes);
vbuffer[attr].buffer_offset = 0;
velements[attr].src_offset = 0;
}
@@ -358,14 +354,13 @@ st_draw_vbo(GLcontext *ctx,
if (bufobj && bufobj->Name) {
/* elements/indexes are in a real VBO */
struct st_buffer_object *stobj = st_buffer_object(bufobj);
- pipe_buffer_reference(winsys, &indexBuf, stobj->buffer);
+ pipe_reference_buffer(pipe, &indexBuf, stobj->buffer);
indexOffset = (unsigned) ib->ptr / indexSize;
}
else {
/* element/indicies are in user space memory */
- indexBuf = winsys->user_buffer_create(winsys,
- (void *) ib->ptr,
- ib->count * indexSize);
+ indexBuf = pipe_user_buffer_create(pipe, (void *) ib->ptr,
+ ib->count * indexSize);
indexOffset = 0;
}
@@ -380,7 +375,7 @@ st_draw_vbo(GLcontext *ctx,
prims[i].start + indexOffset, prims[i].count);
}
- pipe_buffer_reference(winsys, &indexBuf, NULL);
+ pipe_reference_buffer(pipe, &indexBuf, NULL);
}
else {
/* non-indexed */
@@ -396,7 +391,7 @@ st_draw_vbo(GLcontext *ctx,
/* unreference buffers (frees wrapped user-space buffer objects) */
for (attr = 0; attr < vp->num_inputs; attr++) {
- pipe_buffer_reference(winsys, &vbuffer[attr].buffer, NULL);
+ pipe_reference_buffer(pipe, &vbuffer[attr].buffer, NULL);
assert(!vbuffer[attr].buffer);
}
pipe->set_vertex_buffers(pipe, vp->num_inputs, vbuffer);
@@ -458,7 +453,6 @@ st_feedback_draw_vbo(GLcontext *ctx,
struct st_context *st = ctx->st;
struct pipe_context *pipe = st->pipe;
struct draw_context *draw = st->draw;
- struct pipe_winsys *winsys = pipe->winsys;
const struct st_vertex_program *vp;
const struct pipe_shader_state *vs;
struct pipe_buffer *index_buffer_handle = 0;
@@ -509,7 +503,7 @@ st_feedback_draw_vbo(GLcontext *ctx,
assert(stobj->buffer);
vbuffers[attr].buffer = NULL;
- pipe_buffer_reference(winsys, &vbuffers[attr].buffer, stobj->buffer);
+ pipe_reference_buffer(pipe, &vbuffers[attr].buffer, stobj->buffer);
vbuffers[attr].buffer_offset = (unsigned) arrays[0]->Ptr;/* in bytes */
velements[attr].src_offset = arrays[mesaAttr]->Ptr - arrays[0]->Ptr;
}
@@ -521,9 +515,8 @@ st_feedback_draw_vbo(GLcontext *ctx,
/* wrap user data */
vbuffers[attr].buffer
- = winsys->user_buffer_create(winsys,
- (void *) arrays[mesaAttr]->Ptr,
- bytes);
+ = pipe_user_buffer_create(pipe, (void *) arrays[mesaAttr]->Ptr,
+ bytes);
vbuffers[attr].buffer_offset = 0;
velements[attr].src_offset = 0;
}
@@ -544,9 +537,8 @@ st_feedback_draw_vbo(GLcontext *ctx,
#endif
/* map the attrib buffer */
- map = pipe->winsys->buffer_map(pipe->winsys,
- vbuffers[attr].buffer,
- PIPE_BUFFER_USAGE_CPU_READ);
+ map = pipe_buffer_map(pipe, vbuffers[attr].buffer,
+ PIPE_BUFFER_USAGE_CPU_READ);
draw_set_mapped_vertex_buffer(draw, attr, map);
}
@@ -557,9 +549,10 @@ st_feedback_draw_vbo(GLcontext *ctx,
unsigned indexSize;
struct gl_buffer_object *bufobj = ib->obj;
struct st_buffer_object *stobj = st_buffer_object(bufobj);
- index_buffer_handle = stobj->buffer;
void *map;
+ index_buffer_handle = stobj->buffer;
+
switch (ib->type) {
case GL_UNSIGNED_INT:
indexSize = 4;
@@ -572,9 +565,8 @@ st_feedback_draw_vbo(GLcontext *ctx,
return;
}
- map = pipe->winsys->buffer_map(pipe->winsys,
- index_buffer_handle,
- PIPE_BUFFER_USAGE_CPU_READ);
+ map = pipe_buffer_map(pipe, index_buffer_handle,
+ PIPE_BUFFER_USAGE_CPU_READ);
draw_set_mapped_element_buffer(draw, indexSize, map);
}
else {
@@ -584,7 +576,7 @@ st_feedback_draw_vbo(GLcontext *ctx,
/* map constant buffers */
- mapped_constants = winsys->buffer_map(winsys,
+ mapped_constants = pipe_buffer_map(pipe,
st->state.constants[PIPE_SHADER_VERTEX].buffer,
PIPE_BUFFER_USAGE_CPU_READ);
draw_set_mapped_constant_buffer(st->draw, mapped_constants);
@@ -597,21 +589,20 @@ st_feedback_draw_vbo(GLcontext *ctx,
/* unmap constant buffers */
- winsys->buffer_unmap(winsys, st->state.constants[PIPE_SHADER_VERTEX].buffer);
+ pipe_buffer_unmap(pipe, st->state.constants[PIPE_SHADER_VERTEX].buffer);
/*
* unmap vertex/index buffers
*/
for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
if (draw->pt.vertex_buffer[i].buffer) {
- pipe->winsys->buffer_unmap(pipe->winsys,
- draw->pt.vertex_buffer[i].buffer);
- pipe_buffer_reference(winsys, &draw->pt.vertex_buffer[i].buffer, NULL);
+ pipe_buffer_unmap(pipe, draw->pt.vertex_buffer[i].buffer);
+ pipe_reference_buffer(pipe, &draw->pt.vertex_buffer[i].buffer, NULL);
draw_set_mapped_vertex_buffer(draw, i, NULL);
}
}
if (ib) {
- pipe->winsys->buffer_unmap(pipe->winsys, index_buffer_handle);
+ pipe_buffer_unmap(pipe, index_buffer_handle);
draw_set_mapped_element_buffer(draw, 0, NULL);
}
}
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 260a2efe886..6f94ba39aeb 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -38,17 +38,17 @@
#include "st_extensions.h"
-static int min(int a, int b)
+static int _min(int a, int b)
{
return (a < b) ? a : b;
}
-static int max(int a, int b)
+static int _max(int a, int b)
{
return (a > b) ? a : b;
}
-static int clamp(int a, int min, int max)
+static int _clamp(int a, int min, int max)
{
if (a < min)
return min;
@@ -69,42 +69,42 @@ void st_init_limits(struct st_context *st)
struct gl_constants *c = &st->ctx->Const;
c->MaxTextureLevels
- = min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS),
+ = _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS),
MAX_TEXTURE_LEVELS);
c->Max3DTextureLevels
- = min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_3D_LEVELS),
+ = _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_3D_LEVELS),
MAX_3D_TEXTURE_LEVELS);
c->MaxCubeTextureLevels
- = min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS),
+ = _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS),
MAX_CUBE_TEXTURE_LEVELS);
c->MaxTextureRectSize
- = min(1 << (c->MaxTextureLevels - 1), MAX_TEXTURE_RECT_SIZE);
+ = _min(1 << (c->MaxTextureLevels - 1), MAX_TEXTURE_RECT_SIZE);
c->MaxTextureUnits
= c->MaxTextureImageUnits
= c->MaxTextureCoordUnits
- = min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS),
+ = _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS),
MAX_TEXTURE_IMAGE_UNITS);
c->MaxDrawBuffers
- = clamp(screen->get_param(screen, PIPE_CAP_MAX_RENDER_TARGETS),
+ = _clamp(screen->get_param(screen, PIPE_CAP_MAX_RENDER_TARGETS),
1, MAX_DRAW_BUFFERS);
c->MaxLineWidth
- = max(1.0, screen->get_paramf(screen, PIPE_CAP_MAX_LINE_WIDTH));
+ = _max(1.0, screen->get_paramf(screen, PIPE_CAP_MAX_LINE_WIDTH));
c->MaxLineWidthAA
- = max(1.0, screen->get_paramf(screen, PIPE_CAP_MAX_LINE_WIDTH_AA));
+ = _max(1.0, screen->get_paramf(screen, PIPE_CAP_MAX_LINE_WIDTH_AA));
c->MaxPointSize
- = max(1.0, screen->get_paramf(screen, PIPE_CAP_MAX_POINT_WIDTH));
+ = _max(1.0, screen->get_paramf(screen, PIPE_CAP_MAX_POINT_WIDTH));
c->MaxPointSizeAA
- = max(1.0, screen->get_paramf(screen, PIPE_CAP_MAX_POINT_WIDTH_AA));
+ = _max(1.0, screen->get_paramf(screen, PIPE_CAP_MAX_POINT_WIDTH_AA));
c->MaxTextureMaxAnisotropy
- = max(2.0, screen->get_paramf(screen, PIPE_CAP_MAX_TEXTURE_ANISOTROPY));
+ = _max(2.0, screen->get_paramf(screen, PIPE_CAP_MAX_TEXTURE_ANISOTROPY));
c->MaxTextureLodBias
= screen->get_paramf(screen, PIPE_CAP_MAX_TEXTURE_LOD_BIAS);
diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index 8b5f84cd56d..9a385a04579 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -261,13 +261,13 @@ st_mesa_format_to_pipe_format(GLuint mesaFormat)
case MESA_FORMAT_RGB565:
return PIPE_FORMAT_R5G6B5_UNORM;
case MESA_FORMAT_AL88:
- return PIPE_FORMAT_U_A8_L8;
+ return PIPE_FORMAT_A8L8_UNORM;
case MESA_FORMAT_A8:
- return PIPE_FORMAT_U_A8;
+ return PIPE_FORMAT_A8_UNORM;
case MESA_FORMAT_L8:
- return PIPE_FORMAT_U_L8;
+ return PIPE_FORMAT_L8_UNORM;
case MESA_FORMAT_I8:
- return PIPE_FORMAT_U_I8;
+ return PIPE_FORMAT_I8_UNORM;
case MESA_FORMAT_Z16:
return PIPE_FORMAT_Z16_UNORM;
case MESA_FORMAT_Z32:
@@ -409,8 +409,8 @@ st_choose_format(struct pipe_context *pipe, GLint internalFormat,
case GL_ALPHA12:
case GL_ALPHA16:
case GL_COMPRESSED_ALPHA:
- if (screen->is_format_supported( screen, PIPE_FORMAT_U_A8, surfType ))
- return PIPE_FORMAT_U_A8;
+ if (screen->is_format_supported( screen, PIPE_FORMAT_A8_UNORM, surfType ))
+ return PIPE_FORMAT_A8_UNORM;
return default_rgba_format( screen, surfType );
case 1:
@@ -420,8 +420,8 @@ st_choose_format(struct pipe_context *pipe, GLint internalFormat,
case GL_LUMINANCE12:
case GL_LUMINANCE16:
case GL_COMPRESSED_LUMINANCE:
- if (screen->is_format_supported( screen, PIPE_FORMAT_U_L8, surfType ))
- return PIPE_FORMAT_U_L8;
+ if (screen->is_format_supported( screen, PIPE_FORMAT_L8_UNORM, surfType ))
+ return PIPE_FORMAT_L8_UNORM;
return default_rgba_format( screen, surfType );
case 2:
@@ -433,8 +433,8 @@ st_choose_format(struct pipe_context *pipe, GLint internalFormat,
case GL_LUMINANCE12_ALPHA12:
case GL_LUMINANCE16_ALPHA16:
case GL_COMPRESSED_LUMINANCE_ALPHA:
- if (screen->is_format_supported( screen, PIPE_FORMAT_U_A8_L8, surfType ))
- return PIPE_FORMAT_U_A8_L8;
+ if (screen->is_format_supported( screen, PIPE_FORMAT_A8L8_UNORM, surfType ))
+ return PIPE_FORMAT_A8L8_UNORM;
return default_rgba_format( screen, surfType );
case GL_INTENSITY:
@@ -443,8 +443,8 @@ st_choose_format(struct pipe_context *pipe, GLint internalFormat,
case GL_INTENSITY12:
case GL_INTENSITY16:
case GL_COMPRESSED_INTENSITY:
- if (screen->is_format_supported( screen, PIPE_FORMAT_U_I8, surfType ))
- return PIPE_FORMAT_U_I8;
+ if (screen->is_format_supported( screen, PIPE_FORMAT_I8_UNORM, surfType ))
+ return PIPE_FORMAT_I8_UNORM;
return default_rgba_format( screen, surfType );
case GL_YCBCR_MESA:
@@ -547,13 +547,13 @@ translate_gallium_format_to_mesa_format(enum pipe_format format)
return &_mesa_texformat_argb4444;
case PIPE_FORMAT_R5G6B5_UNORM:
return &_mesa_texformat_rgb565;
- case PIPE_FORMAT_U_A8_L8:
+ case PIPE_FORMAT_A8L8_UNORM:
return &_mesa_texformat_al88;
- case PIPE_FORMAT_U_A8:
+ case PIPE_FORMAT_A8_UNORM:
return &_mesa_texformat_a8;
- case PIPE_FORMAT_U_L8:
+ case PIPE_FORMAT_L8_UNORM:
return &_mesa_texformat_l8;
- case PIPE_FORMAT_U_I8:
+ case PIPE_FORMAT_I8_UNORM:
return &_mesa_texformat_i8;
case PIPE_FORMAT_Z16_UNORM:
return &_mesa_texformat_z16;
diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c
index da9ec12a4d2..1a0e19c2f92 100644
--- a/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/src/mesa/state_tracker/st_gen_mipmap.c
@@ -36,7 +36,6 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
-#include "pipe/p_winsys.h"
#include "util/u_gen_mipmap.h"
#include "cso_cache/cso_cache.h"
@@ -105,7 +104,6 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
{
struct pipe_context *pipe = ctx->st->pipe;
struct pipe_screen *screen = pipe->screen;
- struct pipe_winsys *ws = pipe->winsys;
struct pipe_texture *pt = st_get_texobj_texture(texObj);
const uint baseLevel = texObj->BaseLevel;
const uint lastLevel = pt->last_level;
@@ -128,11 +126,11 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
srcSurf = screen->get_tex_surface(screen, pt, face, srcLevel, zslice);
dstSurf = screen->get_tex_surface(screen, pt, face, dstLevel, zslice);
- srcData = (ubyte *) ws->buffer_map(ws, srcSurf->buffer,
- PIPE_BUFFER_USAGE_CPU_READ)
+ srcData = (ubyte *) pipe_buffer_map(pipe, srcSurf->buffer,
+ PIPE_BUFFER_USAGE_CPU_READ)
+ srcSurf->offset;
- dstData = (ubyte *) ws->buffer_map(ws, dstSurf->buffer,
- PIPE_BUFFER_USAGE_CPU_WRITE)
+ dstData = (ubyte *) pipe_buffer_map(pipe, dstSurf->buffer,
+ PIPE_BUFFER_USAGE_CPU_WRITE)
+ dstSurf->offset;
_mesa_generate_mipmap_level(target, datatype, comps,
@@ -144,8 +142,8 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
dstSurf->pitch * dstSurf->cpp, /* stride in bytes */
dstData);
- ws->buffer_unmap(ws, srcSurf->buffer);
- ws->buffer_unmap(ws, dstSurf->buffer);
+ pipe_buffer_unmap(pipe, srcSurf->buffer);
+ pipe_buffer_unmap(pipe, dstSurf->buffer);
pipe_surface_reference(&srcSurf, NULL);
pipe_surface_reference(&dstSurf, NULL);
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index 524b5af50b2..d2be450bdb9 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -805,7 +805,7 @@ tgsi_translate_mesa_program(
{
GLboolean tempsUsed[MAX_PROGRAM_TEMPS + 1];
GLboolean inside_range = GL_FALSE;
- GLuint start_range;
+ GLuint start_range = 0;
find_temporaries(program, tempsUsed);
tempsUsed[MAX_PROGRAM_TEMPS] = GL_FALSE;
diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h
index 1a2062131d0..d8f26da2eeb 100644
--- a/src/mesa/state_tracker/st_program.h
+++ b/src/mesa/state_tracker/st_program.h
@@ -101,14 +101,14 @@ struct st_vertex_program
};
-static inline struct st_fragment_program *
+static INLINE struct st_fragment_program *
st_fragment_program( struct gl_fragment_program *fp )
{
return (struct st_fragment_program *)fp;
}
-static inline struct st_vertex_program *
+static INLINE struct st_vertex_program *
st_vertex_program( struct gl_vertex_program *vp )
{
return (struct st_vertex_program *)vp;
diff --git a/src/mesa/state_tracker/st_texobj.c b/src/mesa/state_tracker/st_texobj.c
deleted file mode 100644
index eb5bdb2d08f..00000000000
--- a/src/mesa/state_tracker/st_texobj.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-/*
- * Authors:
- * Brian Paul
- */
-
-#include "imports.h"
-#include "texformat.h"
-
-#include "st_context.h"
-#include "st_texobj.h"
-#include "pipe/p_defines.h"
-
-
-/**
- * Create a pipe_texture_object from a Mesa texture object.
- * Eventually, gl_texture_object may be derived from this...
- */
-struct pipe_texture_object *
-create_texture_object(struct gl_texture_object *texObj)
-{
- struct pipe_texture_object *pto;
- const struct gl_texture_image *texImage;
-
- pto = calloc(1, sizeof(*pto));
- if (!pto)
- return NULL;
-
- /* XXX: Member not defined. Comment-out to get it compile. */
- /*assert(texObj->Complete);*/
-
- switch (texObj->Target) {
- case GL_TEXTURE_1D:
- pto->type = PIPE_TEXTURE_1D;
- break;
- case GL_TEXTURE_2D:
- pto->type = PIPE_TEXTURE_2D;
- break;
- case GL_TEXTURE_3D:
- pto->type = PIPE_TEXTURE_3D;
- break;
- case GL_TEXTURE_CUBE_MAP:
- pto->type = PIPE_TEXTURE_CUBE;
- break;
- default:
- assert(0);
- return NULL;
- }
-
- texImage = texObj->Image[0][texObj->BaseLevel];
- assert(texImage);
-
- switch (texImage->TexFormat->MesaFormat) {
- case MESA_FORMAT_RGBA8888:
- pto->format = PIPE_FORMAT_U_R8_G8_B8_A8;
- break;
- case MESA_FORMAT_RGB565:
- pto->format = PIPE_FORMAT_U_R5_G6_B5;
- break;
-
- /* XXX fill in more formats */
-
- default:
- assert(0);
- return NULL;
- }
-
- pto->width = texImage->Width;
- pto->height = texImage->Height;
- pto->depth = texImage->Depth;
-
- /* XXX verify this */
- pto->mipmapped = texObj->Image[0][texObj->BaseLevel + 1] != NULL;
-
- return pto;
-}
diff --git a/src/mesa/state_tracker/st_texobj.h b/src/mesa/state_tracker/st_texobj.h
deleted file mode 100644
index 3c660310187..00000000000
--- a/src/mesa/state_tracker/st_texobj.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-/*
- * Authors:
- * Brian Paul
- */
-
-#ifndef ST_TEXOBJ_H
-#define ST_TEXOBJ_H 1
-
-
-extern struct pipe_texture_object *
-create_texture_object(struct gl_texture_object *texObj);
-
-
-#endif /* ST_TEXOBJ_H */
diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c
index 66d81e2b959..f68bef1207c 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -38,7 +38,6 @@
#include "pipe/p_inlines.h"
#include "pipe/p_util.h"
#include "pipe/p_inlines.h"
-#include "pipe/p_winsys.h"
#define DBG if(0) printf
diff --git a/src/mesa/state_tracker/st_texture.h b/src/mesa/state_tracker/st_texture.h
index 7abccb3a69f..b05762113cc 100644
--- a/src/mesa/state_tracker/st_texture.h
+++ b/src/mesa/state_tracker/st_texture.h
@@ -68,9 +68,7 @@ struct st_texture_object
*/
struct pipe_texture *pt;
- GLboolean imageOverride;
- GLint depthOverride;
- GLuint pitchOverride;
+ GLboolean teximage_realloc;
};