summaryrefslogtreecommitdiff
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.c1
-rw-r--r--src/mesa/state_tracker/st_atom.h1
-rw-r--r--src/mesa/state_tracker/st_atom_clear_color.c63
-rw-r--r--src/mesa/state_tracker/st_atom_depth.c2
-rw-r--r--src/mesa/state_tracker/st_atom_sampler.c15
-rw-r--r--src/mesa/state_tracker/st_atom_texture.c32
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c19
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c35
-rw-r--r--src/mesa/state_tracker/st_cb_queryobj.c68
-rw-r--r--src/mesa/state_tracker/st_cb_rasterpos.c44
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c40
-rw-r--r--src/mesa/state_tracker/st_cb_texture.h3
-rw-r--r--src/mesa/state_tracker/st_context.h4
-rw-r--r--src/mesa/state_tracker/st_draw.c1
-rw-r--r--src/mesa/state_tracker/st_format.c4
-rw-r--r--src/mesa/state_tracker/st_texture.c6
-rw-r--r--src/mesa/state_tracker/st_texture.h1
17 files changed, 127 insertions, 212 deletions
diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
index 0797ea615e..bde81edd8c 100644
--- a/src/mesa/state_tracker/st_atom.c
+++ b/src/mesa/state_tracker/st_atom.c
@@ -45,7 +45,6 @@
static const struct st_tracked_state *atoms[] =
{
&st_update_framebuffer,
- &st_update_clear_color,
&st_update_depth_stencil,
&st_update_clip,
diff --git a/src/mesa/state_tracker/st_atom.h b/src/mesa/state_tracker/st_atom.h
index 3c0db0db09..0114f42ba5 100644
--- a/src/mesa/state_tracker/st_atom.h
+++ b/src/mesa/state_tracker/st_atom.h
@@ -46,7 +46,6 @@ void st_validate_state( struct st_context *st );
const struct st_tracked_state st_update_framebuffer;
const struct st_tracked_state st_update_clip;
-const struct st_tracked_state st_update_clear_color;
const struct st_tracked_state st_update_depth_stencil;
const struct st_tracked_state st_update_shader;
const struct st_tracked_state st_update_rasterizer;
diff --git a/src/mesa/state_tracker/st_atom_clear_color.c b/src/mesa/state_tracker/st_atom_clear_color.c
deleted file mode 100644
index ce3431c5d3..0000000000
--- a/src/mesa/state_tracker/st_atom_clear_color.c
+++ /dev/null
@@ -1,63 +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:
- * Keith Whitwell <keith@tungstengraphics.com>
- * Brian Paul
- */
-
-#include "st_context.h"
-#include "st_atom.h"
-#include "pipe/p_context.h"
-
-
-static void
-update_clear_color_state( struct st_context *st )
-{
- struct pipe_clear_color_state clear;
-
- clear.color[0] = st->ctx->Color.ClearColor[0];
- clear.color[1] = st->ctx->Color.ClearColor[1];
- clear.color[2] = st->ctx->Color.ClearColor[2];
- clear.color[3] = st->ctx->Color.ClearColor[3];
-
- if (memcmp(&clear, &st->state.clear_color, sizeof(clear)) != 0) {
- st->state.clear_color = clear;
- st->pipe->set_clear_color_state( st->pipe, &clear );
- }
-}
-
-
-const struct st_tracked_state st_update_clear_color = {
- .name = "st_update_clear_color",
- .dirty = {
- .mesa = _NEW_COLOR,
- .st = 0,
- },
- .update = update_clear_color_state
-};
diff --git a/src/mesa/state_tracker/st_atom_depth.c b/src/mesa/state_tracker/st_atom_depth.c
index f0f360e6dd..e785434cec 100644
--- a/src/mesa/state_tracker/st_atom_depth.c
+++ b/src/mesa/state_tracker/st_atom_depth.c
@@ -101,7 +101,6 @@ update_depth_stencil(struct st_context *st)
depth_stencil.depth.enabled = st->ctx->Depth.Test;
depth_stencil.depth.writemask = st->ctx->Depth.Mask;
depth_stencil.depth.func = st_compare_func_to_pipe(st->ctx->Depth.Func);
- depth_stencil.depth.clear = st->ctx->Depth.Clear;
if (st->ctx->Query.CurrentOcclusionObject &&
st->ctx->Query.CurrentOcclusionObject->Active)
@@ -126,7 +125,6 @@ update_depth_stencil(struct st_context *st)
depth_stencil.stencil.value_mask[1] = st->ctx->Stencil.ValueMask[1] & 0xff;
depth_stencil.stencil.write_mask[1] = st->ctx->Stencil.WriteMask[1] & 0xff;
}
- depth_stencil.stencil.clear_value = st->ctx->Stencil.Clear & 0xff;
}
cso = st_cached_depth_stencil_state(st, &depth_stencil);
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index 67a9159069..052b6dd144 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -172,26 +172,13 @@ update_samplers(struct st_context *st)
st->pipe->bind_sampler_state(st->pipe, u, cso->data);
}
}
-
-
- /* mapping from sampler vars to texture units */
- {
- struct gl_fragment_program *fprog = st->ctx->FragmentProgram._Current;
- uint sample_units[PIPE_MAX_SAMPLERS];
- uint s;
- for (s = 0; s < PIPE_MAX_SAMPLERS; s++) {
- sample_units[s] = fprog->Base.SamplerUnits[s];
- }
-
- st->pipe->set_sampler_units(st->pipe, PIPE_MAX_SAMPLERS, sample_units);
- }
}
const struct st_tracked_state st_update_sampler = {
.name = "st_update_sampler",
.dirty = {
- .mesa = _NEW_TEXTURE | _NEW_PROGRAM,
+ .mesa = _NEW_TEXTURE,
.st = 0,
},
.update = update_samplers
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index c4e5af02d5..fb21d29c40 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -46,20 +46,24 @@
static void
update_textures(struct st_context *st)
{
- GLuint u;
+ GLuint s;
- for (u = 0; u < st->ctx->Const.MaxTextureImageUnits; u++) {
+ /* ST_NEW_FRAGMENT_PROGRAM
+ */
+ struct gl_fragment_program *fprog = st->ctx->FragmentProgram._Current;
+
+ for (s = 0; s < st->ctx->Const.MaxTextureCoordUnits; s++) {
+ GLuint su = fprog->Base.SamplerUnits[s];
+
struct gl_texture_object *texObj
- = st->ctx->Texture.Unit[u]._Current;
+ = st->ctx->Texture.Unit[su]._Current;
+
struct pipe_texture *pt;
+
if (texObj) {
GLboolean flush, retval;
- retval = st_finalize_texture(st->ctx, st->pipe, u, &flush);
-#if 0
- printf("finalize_texture returned %d, flush = %d\n",
- retval, flush);
-#endif
+ retval = st_finalize_texture(st->ctx, st->pipe, texObj, &flush);
pt = st_get_texobj_texture(texObj);
}
@@ -67,8 +71,14 @@ update_textures(struct st_context *st)
pt = NULL;
}
- st->state.texture[u] = pt;
- st->pipe->set_texture_state(st->pipe, u, pt);
+ /* XXX: need to ensure that textures are unbound/removed from
+ * this table before being deleted, otherwise the pointer
+ * comparison below could fail.
+ */
+ if (st->state.sampler_texture[s] != pt) {
+ st->state.sampler_texture[s] = pt;
+ st->pipe->set_sampler_texture(st->pipe, s, pt);
+ }
}
}
@@ -77,7 +87,7 @@ const struct st_tracked_state st_update_texture = {
.name = "st_update_texture",
.dirty = {
.mesa = _NEW_TEXTURE,
- .st = 0,
+ .st = ST_NEW_FRAGMENT_PROGRAM,
},
.update = update_textures
};
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 0179000353..0bc48b7039 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -469,8 +469,8 @@ make_texture(struct st_context *st,
assert(pipeFormat);
cpp = st_sizeof_format(pipeFormat);
- pt = st_texture_create(st, PIPE_TEXTURE_2D, pipeFormat, baseFormat, 0, 0,
- width, height, 1, 0);
+ pt = st_texture_create(st, PIPE_TEXTURE_2D, pipeFormat, 0, 0, width, height,
+ 1, 0);
if (!pt)
return NULL;
@@ -697,7 +697,7 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
/* texture state: */
{
- pipe->set_texture_state(pipe, unit, pt);
+ pipe->set_sampler_texture(pipe, unit, pt);
}
/* Compute window coords (y=0=bottom) with pixel zoom.
@@ -719,7 +719,7 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
pipe->bind_rasterizer_state(pipe, ctx->st->state.rasterizer->data);
pipe->bind_fs_state(pipe, ctx->st->state.fs->data);
pipe->bind_vs_state(pipe, ctx->st->state.vs->data);
- pipe->set_texture_state(pipe, unit, ctx->st->state.texture[unit]);
+ pipe->set_sampler_texture(pipe, unit, ctx->st->state.sampler_texture[unit]);
pipe->bind_sampler_state(pipe, unit, ctx->st->state.sampler[unit]->data);
pipe->set_viewport_state(pipe, &ctx->st->state.viewport);
}
@@ -987,7 +987,6 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
struct pipe_context *pipe = ctx->st->pipe;
struct pipe_surface *surface;
uint format = 0, cpp, comp;
- GLenum internal_format;
ubyte *dest;
struct pipe_texture *pt;
int row, col;
@@ -995,13 +994,11 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
/* find a texture format we know */
if (pipe->is_format_supported( pipe, PIPE_FORMAT_U_I8, PIPE_TEXTURE )) {
format = PIPE_FORMAT_U_I8;
- internal_format = GL_INTENSITY8;
cpp = 1;
comp = 0;
}
else if (pipe->is_format_supported( pipe, PIPE_FORMAT_A8R8G8B8_UNORM, PIPE_TEXTURE )) {
format = PIPE_FORMAT_A8R8G8B8_UNORM;
- internal_format = GL_RGBA8;
cpp = 4;
comp = 3; /* alpha channel */ /*XXX little-endian dependency */
}
@@ -1013,8 +1010,8 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
/**
* Create a texture.
*/
- pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, format, internal_format,
- 0, 0, width, height, 1, 0);
+ pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, format, 0, 0, width, height,
+ 1, 0);
if (!pt)
return NULL;
@@ -1237,8 +1234,8 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
psRead = rbRead->surface;
format = psRead->format;
- pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, format,
- rbRead->Base.InternalFormat, 0, 0, width, height, 1, 0);
+ pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, format, 0, 0, width, height,
+ 1, 0);
if (!pt)
return;
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 6e9e7e3a24..047de412e3 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -90,29 +90,15 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
uint type = strb->screenSurface ? PIPE_SCREEN_SURFACE : PIPE_SURFACE;
const enum pipe_format pipeFormat
= st_choose_pipe_format(pipe, internalFormat, GL_NONE, GL_NONE, type);
- GLuint cpp;
GLbitfield flags = 0x0; /* XXX needed? */
- cpp = init_renderbuffer_bits(strb, pipeFormat);
- assert(cpp);
-
- if (strb->surface && strb->surface->format != pipeFormat) {
- /* need to change surface types, free this surface */
- pipe_surface_reference(&strb->surface, NULL);
- assert(strb->surface == NULL);
- }
-
if (!strb->surface) {
- strb->surface = pipe->winsys->surface_alloc(pipe->winsys, pipeFormat);
+ strb->surface = pipe->winsys->surface_alloc(pipe->winsys);
assert(strb->surface);
if (!strb->surface)
return GL_FALSE;
- strb->surface->cpp = cpp;
}
- strb->surface->pitch = pipe->winsys->surface_pitch(pipe->winsys, cpp,
- width, flags);
-
/* loop here since mapping is refcounted */
while (strb->surface->map)
pipe_surface_unmap(strb->surface);
@@ -120,19 +106,24 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
pipe->winsys->buffer_reference(pipe->winsys, &strb->surface->buffer,
NULL);
- strb->surface->buffer = pipe->winsys->buffer_create(pipe->winsys, 32, 0, 0);
+ pipe->winsys->surface_alloc_storage(pipe->winsys,
+ strb->surface,
+ width,
+ height,
+ pipeFormat,
+ flags);
if (!strb->surface->buffer)
return GL_FALSE; /* out of memory, try s/w buffer? */
- pipe->winsys->buffer_data(pipe->winsys, strb->surface->buffer,
- strb->surface->pitch * cpp * height, NULL,
- PIPE_BUFFER_USAGE_PIXEL);
-
ASSERT(strb->surface->buffer);
ASSERT(strb->surface->format);
+ ASSERT(strb->surface->cpp);
+ ASSERT(strb->surface->width == width);
+ ASSERT(strb->surface->height == height);
+ ASSERT(strb->surface->pitch);
- strb->Base.Width = strb->surface->width = width;
- strb->Base.Height = strb->surface->height = height;
+ strb->Base.Width = width;
+ strb->Base.Height = height;
return GL_TRUE;
}
diff --git a/src/mesa/state_tracker/st_cb_queryobj.c b/src/mesa/state_tracker/st_cb_queryobj.c
index 5b95dd7fd3..c1d0d086b4 100644
--- a/src/mesa/state_tracker/st_cb_queryobj.c
+++ b/src/mesa/state_tracker/st_cb_queryobj.c
@@ -47,7 +47,7 @@
struct st_query_object
{
struct gl_query_object base;
- struct pipe_query_object pq;
+ struct pipe_query *pq;
};
@@ -68,12 +68,28 @@ st_NewQueryObject(GLcontext *ctx, GLuint id)
if (stq) {
stq->base.Id = id;
stq->base.Ready = GL_TRUE;
+ stq->pq = NULL;
return &stq->base;
}
return NULL;
}
+
+static void
+st_DeleteQuery(GLcontext *ctx, struct gl_query_object *q)
+{
+ struct pipe_context *pipe = ctx->st->pipe;
+ struct st_query_object *stq = st_query_object(q);
+
+ if (stq->pq) {
+ pipe->destroy_query(pipe, stq->pq);
+ stq->pq = NULL;
+ }
+
+ FREE(stq);
+}
+
/**
* Do glReadPixels by getting rows from the framebuffer surface with
* get_tile(). Convert to requested format/type with Mesa image routines.
@@ -85,25 +101,17 @@ st_BeginQuery(GLcontext *ctx, struct gl_query_object *q)
struct pipe_context *pipe = ctx->st->pipe;
struct st_query_object *stq = st_query_object(q);
- stq->pq.count = 0;
-
switch (q->Target) {
case GL_SAMPLES_PASSED_ARB:
- stq->pq.type = PIPE_QUERY_OCCLUSION_COUNTER;
- break;
- case GL_PRIMITIVES_GENERATED_NV:
- /* someday */
- stq->pq.type = PIPE_QUERY_PRIMITIVES_GENERATED;
- break;
- case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV:
- /* someday */
- stq->pq.type = PIPE_QUERY_PRIMITIVES_EMITTED;
+ if (!stq->pq)
+ stq->pq = pipe->create_query( pipe, PIPE_QUERY_OCCLUSION_COUNTER );
break;
default:
assert(0);
+ return;
}
- pipe->begin_query(pipe, &stq->pq);
+ pipe->begin_query(pipe, stq->pq);
}
@@ -113,10 +121,7 @@ st_EndQuery(GLcontext *ctx, struct gl_query_object *q)
struct pipe_context *pipe = ctx->st->pipe;
struct st_query_object *stq = st_query_object(q);
- pipe->end_query(pipe, &stq->pq);
- stq->base.Ready = stq->pq.ready;
- if (stq->base.Ready)
- stq->base.Result = stq->pq.count;
+ pipe->end_query(pipe, stq->pq);
}
@@ -129,17 +134,42 @@ st_WaitQuery(GLcontext *ctx, struct gl_query_object *q)
/* this function should only be called if we don't have a ready result */
assert(!stq->base.Ready);
- pipe->wait_query(pipe, &stq->pq);
+ while (!stq->base.Ready &&
+ !pipe->get_query_result(pipe,
+ stq->pq,
+ TRUE,
+ &q->Result))
+ {
+ /* nothing */
+ }
+
q->Ready = GL_TRUE;
- q->Result = stq->pq.count;
}
+static void
+st_CheckQuery(GLcontext *ctx, struct gl_query_object *q)
+{
+ struct pipe_context *pipe = ctx->st->pipe;
+ struct st_query_object *stq = st_query_object(q);
+
+ if (!q->Ready) {
+ q->Ready = pipe->get_query_result(pipe,
+ stq->pq,
+ FALSE,
+ &q->Result);
+ }
+}
+
+
+
void st_init_query_functions(struct dd_function_table *functions)
{
functions->NewQueryObject = st_NewQueryObject;
+ functions->DeleteQuery = st_DeleteQuery;
functions->BeginQuery = st_BeginQuery;
functions->EndQuery = st_EndQuery;
functions->WaitQuery = st_WaitQuery;
+ functions->CheckQuery = st_CheckQuery;
}
diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c b/src/mesa/state_tracker/st_cb_rasterpos.c
index 5279cb1cd4..852cff6490 100644
--- a/src/mesa/state_tracker/st_cb_rasterpos.c
+++ b/src/mesa/state_tracker/st_cb_rasterpos.c
@@ -173,6 +173,7 @@ static struct rastpos_stage *
new_draw_rastpos_stage(GLcontext *ctx, struct draw_context *draw)
{
struct rastpos_stage *rs = CALLOC_STRUCT(rastpos_stage);
+ GLuint i;
rs->stage.draw = draw;
rs->stage.next = NULL;
@@ -184,6 +185,26 @@ new_draw_rastpos_stage(GLcontext *ctx, struct draw_context *draw)
rs->stage.reset_stipple_counter = rastpos_reset_stipple_counter;
rs->ctx = ctx;
+ for (i = 0; i < VERT_ATTRIB_MAX; i++) {
+ rs->array[i].Size = 4;
+ rs->array[i].Type = GL_FLOAT;
+ rs->array[i].Stride = 0;
+ rs->array[i].StrideB = 0;
+ rs->array[i].Ptr = (GLubyte *) ctx->Current.Attrib[i];
+ rs->array[i].Enabled = GL_TRUE;
+ rs->array[i].Normalized = GL_TRUE;
+ rs->array[i].BufferObj = NULL;
+ rs->arrays[i] = &rs->array[i];
+ }
+
+ rs->prim.mode = GL_POINTS;
+ rs->prim.indexed = 0;
+ rs->prim.begin = 1;
+ rs->prim.end = 1;
+ rs->prim.weak = 0;
+ rs->prim.start = 0;
+ rs->prim.count = 1;
+
return rs;
}
@@ -201,31 +222,8 @@ st_RasterPos(GLcontext *ctx, const GLfloat v[4])
}
else {
/* create rastpos draw stage */
- GLuint i;
-
rs = new_draw_rastpos_stage(ctx, draw);
st->rastpos_stage = &rs->stage;
-
- /* one-time init */
- for (i = 0; i < VERT_ATTRIB_MAX; i++) {
- rs->array[i].Size = 4;
- rs->array[i].Type = GL_FLOAT;
- rs->array[i].Stride = 0;
- rs->array[i].StrideB = 0;
- rs->array[i].Ptr = (GLubyte *) ctx->Current.Attrib[i];
- rs->array[i].Enabled = GL_TRUE;
- rs->array[i].Normalized = GL_TRUE;
- rs->array[i].BufferObj = NULL;
- rs->arrays[i] = &rs->array[i];
- }
-
- rs->prim.mode = GL_POINTS;
- rs->prim.indexed = 0;
- rs->prim.begin = 1;
- rs->prim.end = 1;
- rs->prim.weak = 0;
- rs->prim.start = 0;
- rs->prim.count = 1;
}
/* plug our rastpos stage into the draw module */
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 14f8d38def..e813bdb47a 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -366,7 +366,6 @@ guess_and_alloc_texture(struct st_context *st,
stObj->pt = st_texture_create(st,
gl_target_to_pipe(stObj->base.Target),
st_mesa_format_to_pipe_format(stImage->base.TexFormat->MesaFormat),
- stImage->base.InternalFormat,
firstLevel,
lastLevel,
width,
@@ -487,18 +486,6 @@ try_pbo_upload(GLcontext *ctx,
-static GLboolean
-try_pbo_zcopy(GLcontext *ctx,
- struct st_texture_image *stImage,
- const struct gl_pixelstore_attrib *unpack,
- GLint internalFormat,
- GLint width, GLint height,
- GLenum format, GLenum type, const void *pixels)
-{
- return GL_FALSE;
-}
-
-
@@ -618,24 +605,6 @@ st_TexImage(GLcontext * ctx,
DBG("trying pbo upload\n");
- /* Attempt to texture directly from PBO data (zero copy upload).
- *
- * Currently disable as it can lead to worse as well as better
- * performance (in particular when pipe_region_cow() is
- * required).
- */
- if (stObj->pt == stImage->pt &&
- stObj->pt->first_level == level &&
- stObj->pt->last_level == level) {
-
- if (try_pbo_zcopy(intel, stImage, unpack,
- internalFormat,
- width, height, format, type, pixels)) {
-
- DBG("pbo zcopy upload succeeded\n");
- return;
- }
- }
/* Otherwise, attempt to use the blitter for PBO image uploads.
@@ -652,7 +621,6 @@ st_TexImage(GLcontext * ctx,
#else
(void) try_pbo_upload;
(void) check_pbo_format;
- (void) try_pbo_zcopy;
#endif
@@ -1443,10 +1411,10 @@ copy_image_data_to_texture(struct st_context *st,
*/
GLboolean
st_finalize_texture(GLcontext *ctx,
- struct pipe_context *pipe, GLuint unit,
+ struct pipe_context *pipe,
+ struct gl_texture_object *tObj,
GLboolean *needFlush)
{
- struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
struct st_texture_object *stObj = st_texture_object(tObj);
int comp_byte = 0;
int cpp;
@@ -1512,7 +1480,8 @@ st_finalize_texture(GLcontext *ctx,
*/
if (stObj->pt &&
(stObj->pt->target != gl_target_to_pipe(stObj->base.Target) ||
- stObj->pt->internal_format != firstImage->base.InternalFormat ||
+ stObj->pt->format !=
+ st_mesa_format_to_pipe_format(firstImage->base.TexFormat->MesaFormat) ||
stObj->pt->first_level != stObj->firstLevel ||
stObj->pt->last_level != stObj->lastLevel ||
stObj->pt->width[0] != firstImage->base.Width ||
@@ -1530,7 +1499,6 @@ st_finalize_texture(GLcontext *ctx,
stObj->pt = st_texture_create(ctx->st,
gl_target_to_pipe(stObj->base.Target),
st_mesa_format_to_pipe_format(firstImage->base.TexFormat->MesaFormat),
- firstImage->base.InternalFormat,
stObj->firstLevel,
stObj->lastLevel,
firstImage->base.Width,
diff --git a/src/mesa/state_tracker/st_cb_texture.h b/src/mesa/state_tracker/st_cb_texture.h
index 7f8082b029..878256ec26 100644
--- a/src/mesa/state_tracker/st_cb_texture.h
+++ b/src/mesa/state_tracker/st_cb_texture.h
@@ -8,7 +8,8 @@ st_get_texobj_texture(struct gl_texture_object *texObj);
extern GLboolean
st_finalize_texture(GLcontext *ctx,
- struct pipe_context *pipe, GLuint unit,
+ struct pipe_context *pipe,
+ struct gl_texture_object *tObj,
GLboolean *needFlush);
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index c31b76c63f..87646b3c71 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -103,12 +103,10 @@ struct st_context
const struct cso_vertex_shader *vs;
struct pipe_blend_color blend_color;
- struct pipe_clear_color_state clear_color;
struct pipe_clip_state clip;
struct pipe_constant_buffer constants[2];
- struct pipe_feedback_state feedback;
struct pipe_framebuffer_state framebuffer;
- struct pipe_texture *texture[PIPE_MAX_SAMPLERS];
+ struct pipe_texture *sampler_texture[PIPE_MAX_SAMPLERS];
struct pipe_poly_stipple poly_stipple;
struct pipe_scissor_state scissor;
struct pipe_viewport_state viewport;
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index 24bb4823bc..274ae86a3e 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -199,6 +199,7 @@ static void
create_default_attribs_buffer(struct st_context *st)
{
struct pipe_context *pipe = st->pipe;
+ /* XXX don't hardcode magic 32 here */
st->default_attrib_buffer = pipe->winsys->buffer_create( pipe->winsys, 32, 0, 0 );
}
diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index c292a975f3..98cc2084f0 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -254,8 +254,12 @@ st_mesa_format_to_pipe_format(GLuint mesaFormat)
case MESA_FORMAT_ARGB8888_REV:
case MESA_FORMAT_ARGB8888:
return PIPE_FORMAT_A8R8G8B8_UNORM;
+ case MESA_FORMAT_ARGB1555:
+ return PIPE_FORMAT_A1R5G5B5_UNORM;
case MESA_FORMAT_ARGB4444:
return PIPE_FORMAT_A4R4G4B4_UNORM;
+ case MESA_FORMAT_RGB565:
+ return PIPE_FORMAT_R5G6B5_UNORM;
case MESA_FORMAT_AL88:
return PIPE_FORMAT_U_A8_L8;
case MESA_FORMAT_A8:
diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c
index 1ec4514873..c7d28eeca2 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -63,7 +63,6 @@ struct pipe_texture *
st_texture_create(struct st_context *st,
unsigned target,
unsigned format,
- GLenum internal_format,
GLuint first_level,
GLuint last_level,
GLuint width0,
@@ -77,7 +76,7 @@ st_texture_create(struct st_context *st,
DBG("%s target %s format %s level %d..%d\n", __FUNCTION__,
_mesa_lookup_enum_by_nr(target),
- _mesa_lookup_enum_by_nr(internal_format), first_level, last_level);
+ _mesa_lookup_enum_by_nr(format), first_level, last_level);
if (!pt)
return NULL;
@@ -86,7 +85,6 @@ st_texture_create(struct st_context *st,
pt->target = target;
pt->format = format;
- pt->internal_format = internal_format;
pt->first_level = first_level;
pt->last_level = last_level;
pt->width[0] = width0;
@@ -119,7 +117,7 @@ st_texture_match_image(struct pipe_texture *pt,
if (image->Border)
return GL_FALSE;
- if (image->InternalFormat != pt->internal_format ||
+ if (st_mesa_format_to_pipe_format(image->TexFormat->MesaFormat) != pt->format ||
image->IsCompressed != pt->compressed)
return GL_FALSE;
diff --git a/src/mesa/state_tracker/st_texture.h b/src/mesa/state_tracker/st_texture.h
index 2be53abf3a..7524c219e0 100644
--- a/src/mesa/state_tracker/st_texture.h
+++ b/src/mesa/state_tracker/st_texture.h
@@ -39,7 +39,6 @@ extern struct pipe_texture *
st_texture_create(struct st_context *st,
unsigned target,
unsigned format,
- GLenum internal_format,
GLuint first_level,
GLuint last_level,
GLuint width0,