summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/x11/xm_api.c8
-rw-r--r--src/mesa/main/state.c38
-rw-r--r--src/mesa/shader/prog_instruction.h3
-rw-r--r--src/mesa/state_tracker/st_atom_constbuf.c2
-rw-r--r--src/mesa/state_tracker/st_atom_pixeltransfer.c3
-rw-r--r--src/mesa/state_tracker/st_atom_texture.c1
-rw-r--r--src/mesa/state_tracker/st_cb_accum.c18
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.c16
-rw-r--r--src/mesa/state_tracker/st_cb_bufferobjects.c5
-rw-r--r--src/mesa/state_tracker/st_cb_clear.c8
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c12
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c6
-rw-r--r--src/mesa/state_tracker/st_cb_readpixels.c8
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c16
-rw-r--r--src/mesa/state_tracker/st_context.c3
-rw-r--r--src/mesa/state_tracker/st_draw.c10
-rw-r--r--src/mesa/state_tracker/st_draw_feedback.c4
-rw-r--r--src/mesa/state_tracker/st_framebuffer.c1
-rw-r--r--src/mesa/state_tracker/st_gen_mipmap.c4
-rw-r--r--src/mesa/state_tracker/st_texture.c11
-rw-r--r--src/mesa/tnl/t_vb_points.c2
-rw-r--r--src/mesa/tnl/t_vp_build.c1
-rw-r--r--src/mesa/vbo/vbo_exec_api.c10
23 files changed, 104 insertions, 86 deletions
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index 908fecc85a1..6ae5b6fd580 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -1584,6 +1584,14 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
return NULL;
}
+ /* Enable this to exercise fixed function -> shader translation
+ * with software rendering.
+ */
+ if (0) {
+ mesaCtx->VertexProgram._MaintainTnlProgram = GL_TRUE;
+ mesaCtx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
+ }
+
_mesa_enable_sw_extensions(mesaCtx);
_mesa_enable_1_3_extensions(mesaCtx);
_mesa_enable_1_4_extensions(mesaCtx);
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 9ea932ea962..9d03ee744df 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -202,13 +202,17 @@ update_program_enables(GLcontext *ctx)
*
* This function needs to be called after texture state validation in case
* we're generating a fragment program from fixed-function texture state.
+ *
+ * \return bitfield which will indicate _NEW_PROGRAM state if a new vertex
+ * or fragment program is being used.
*/
-static void
+static GLbitfield
update_program(GLcontext *ctx)
{
const struct gl_shader_program *shProg = ctx->Shader.CurrentProgram;
const struct gl_vertex_program *prevVP = ctx->VertexProgram._Current;
const struct gl_fragment_program *prevFP = ctx->FragmentProgram._Current;
+ GLbitfield new_state = 0x0;
/*
* Set the ctx->VertexProgram._Current and ctx->FragmentProgram._Current
@@ -278,15 +282,23 @@ update_program(GLcontext *ctx)
/* Let the driver know what's happening:
*/
- if (ctx->FragmentProgram._Current != prevFP && ctx->Driver.BindProgram) {
- ctx->Driver.BindProgram(ctx, GL_FRAGMENT_PROGRAM_ARB,
- (struct gl_program *) ctx->FragmentProgram._Current);
+ if (ctx->FragmentProgram._Current != prevFP) {
+ new_state |= _NEW_PROGRAM;
+ if (ctx->Driver.BindProgram) {
+ ctx->Driver.BindProgram(ctx, GL_FRAGMENT_PROGRAM_ARB,
+ (struct gl_program *) ctx->FragmentProgram._Current);
+ }
}
- if (ctx->VertexProgram._Current != prevVP && ctx->Driver.BindProgram) {
- ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB,
- (struct gl_program *) ctx->VertexProgram._Current);
+ if (ctx->VertexProgram._Current != prevVP) {
+ new_state |= _NEW_PROGRAM;
+ if (ctx->Driver.BindProgram) {
+ ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB,
+ (struct gl_program *) ctx->VertexProgram._Current);
+ }
}
+
+ return new_state;
}
@@ -447,6 +459,7 @@ _mesa_update_state_locked( GLcontext *ctx )
{
GLbitfield new_state = ctx->NewState;
GLbitfield prog_flags = _NEW_PROGRAM;
+ GLbitfield new_prog_state = 0x0;
if (new_state == _NEW_CURRENT_ATTRIB)
goto out;
@@ -531,8 +544,13 @@ _mesa_update_state_locked( GLcontext *ctx )
if (new_state & _MESA_NEW_NEED_EYE_COORDS)
_mesa_update_tnl_spaces( ctx, new_state );
- if (new_state & prog_flags)
- update_program( ctx );
+ if (new_state & prog_flags) {
+ /* When we generate programs from fixed-function vertex/fragment state
+ * this call may generate/bind a new program. If so, we need to
+ * propogate the _NEW_PROGRAM flag to the driver.
+ */
+ new_prog_state |= update_program( ctx );
+ }
/*
* Give the driver a chance to act upon the new_state flags.
@@ -544,7 +562,7 @@ _mesa_update_state_locked( GLcontext *ctx )
* Driver.UpdateState() has to call FLUSH_VERTICES(). (fixed?)
*/
out:
- new_state = ctx->NewState;
+ new_state = ctx->NewState | new_prog_state;
ctx->NewState = 0;
ctx->Driver.UpdateState(ctx, new_state);
ctx->Array.NewState = 0;
diff --git a/src/mesa/shader/prog_instruction.h b/src/mesa/shader/prog_instruction.h
index 38086445502..95dd7fda7f4 100644
--- a/src/mesa/shader/prog_instruction.h
+++ b/src/mesa/shader/prog_instruction.h
@@ -38,6 +38,9 @@
#define PROG_INSTRUCTION_H
+#include "main/mfeatures.h"
+
+
/**
* Swizzle indexes.
* Do not change!
diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c
index 2df6fef210e..fd81ac36d2c 100644
--- a/src/mesa/state_tracker/st_atom_constbuf.c
+++ b/src/mesa/state_tracker/st_atom_constbuf.c
@@ -73,7 +73,7 @@ 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(pipe->screen, &cbuf->buffer, NULL );
+ pipe_buffer_reference(&cbuf->buffer, NULL );
cbuf->buffer = pipe_buffer_create(pipe->screen, 16, PIPE_BUFFER_USAGE_CONSTANT,
paramBytes );
diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c
index 05b69c9d00a..8d0029dde5f 100644
--- a/src/mesa/state_tracker/st_atom_pixeltransfer.c
+++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c
@@ -48,7 +48,6 @@
#include "pipe/p_screen.h"
#include "pipe/p_context.h"
-#include "pipe/p_inlines.h"
#include "util/u_pack_color.h"
@@ -171,7 +170,7 @@ load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt)
}
screen->transfer_unmap(screen, transfer);
- screen->tex_transfer_release(screen, &transfer);
+ screen->tex_transfer_destroy(transfer);
}
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index 21f7321f97a..4d4f97da7ed 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -37,7 +37,6 @@
#include "st_texture.h"
#include "st_cb_texture.h"
#include "pipe/p_context.h"
-#include "pipe/p_inlines.h"
#include "cso_cache/cso_context.h"
diff --git a/src/mesa/state_tracker/st_cb_accum.c b/src/mesa/state_tracker/st_cb_accum.c
index 15cc4cd95dc..3f9a825a153 100644
--- a/src/mesa/state_tracker/st_cb_accum.c
+++ b/src/mesa/state_tracker/st_cb_accum.c
@@ -149,7 +149,7 @@ st_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
}
screen->transfer_unmap(screen, acc_pt);
- screen->tex_transfer_release(screen, &acc_pt);
+ screen->tex_transfer_destroy(acc_pt);
}
@@ -187,7 +187,7 @@ accum_mad(GLcontext *ctx, GLfloat scale, GLfloat bias,
}
screen->transfer_unmap(screen, acc_pt);
- screen->tex_transfer_release(screen, &acc_pt);
+ screen->tex_transfer_destroy(acc_pt);
}
@@ -220,7 +220,7 @@ accum_accum(struct pipe_context *pipe, GLfloat value,
accBuf[i] = accBuf[i] + colorBuf[i] * value;
}
- screen->tex_transfer_release(screen, &acc_trans);
+ screen->tex_transfer_destroy(acc_trans);
acc_trans = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0,
PIPE_TRANSFER_WRITE, xpos, ypos,
width, height);
@@ -229,8 +229,8 @@ accum_accum(struct pipe_context *pipe, GLfloat value,
_mesa_free(colorBuf);
_mesa_free(accBuf);
- screen->tex_transfer_release(screen, &acc_trans);
- screen->tex_transfer_release(screen, &color_trans);
+ screen->tex_transfer_destroy(acc_trans);
+ screen->tex_transfer_destroy(color_trans);
}
@@ -264,8 +264,8 @@ accum_load(struct pipe_context *pipe, GLfloat value,
acc_put_tile_rgba(pipe, acc_trans, 0, 0, width, height, buf);
_mesa_free(buf);
- screen->tex_transfer_release(screen, &acc_trans);
- screen->tex_transfer_release(screen, &color_trans);
+ screen->tex_transfer_destroy(acc_trans);
+ screen->tex_transfer_destroy(color_trans);
}
@@ -316,8 +316,8 @@ accum_return(GLcontext *ctx, GLfloat value,
_mesa_free(abuf);
if (cbuf)
_mesa_free(cbuf);
- screen->tex_transfer_release(screen, &acc_trans);
- screen->tex_transfer_release(screen, &color_trans);
+ screen->tex_transfer_destroy(acc_trans);
+ screen->tex_transfer_destroy(color_trans);
}
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index f55a5e713ff..f77ac14762f 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -351,7 +351,7 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
/* Release transfer */
screen->transfer_unmap(screen, transfer);
- screen->tex_transfer_release(screen, &transfer);
+ screen->tex_transfer_destroy(transfer);
return pt;
}
@@ -379,7 +379,7 @@ setup_bitmap_vertex_data(struct st_context *st,
GLuint i;
if (st->bitmap.vbuf_slot >= max_slots) {
- pipe_buffer_reference(pipe->screen, &st->bitmap.vbuf, NULL);
+ pipe_buffer_reference(&st->bitmap.vbuf, NULL);
st->bitmap.vbuf_slot = 0;
}
@@ -571,7 +571,7 @@ reset_cache(struct st_context *st)
cache->ymax = -1000000;
if (cache->trans)
- screen->tex_transfer_release(screen, &cache->trans);
+ screen->tex_transfer_destroy(cache->trans);
assert(!cache->texture);
@@ -623,7 +623,7 @@ st_flush_bitmap_cache(struct st_context *st)
screen->transfer_unmap(screen, cache->trans);
cache->buffer = NULL;
- screen->tex_transfer_release(screen, &cache->trans);
+ screen->tex_transfer_destroy(cache->trans);
draw_bitmap_quad(st->ctx,
cache->xpos,
@@ -651,7 +651,7 @@ st_flush_bitmap( struct st_context *st )
/* Release vertex buffer to avoid synchronous rendering if we were
* to map it in the next frame.
*/
- pipe_buffer_reference(st->pipe->screen, &st->bitmap.vbuf, NULL);
+ pipe_buffer_reference(&st->bitmap.vbuf, NULL);
st->bitmap.vbuf_slot = 0;
}
@@ -819,7 +819,7 @@ st_destroy_bitmap(struct st_context *st)
struct bitmap_cache *cache = st->bitmap.cache;
screen->transfer_unmap(screen, cache->trans);
- screen->tex_transfer_release(screen, &cache->trans);
+ screen->tex_transfer_destroy(cache->trans);
if (st->bitmap.vs) {
cso_delete_vertex_shader(st->cso_context, st->bitmap.vs);
@@ -828,12 +828,12 @@ st_destroy_bitmap(struct st_context *st)
util_free_shader(&st->bitmap.vert_shader);
if (st->bitmap.vbuf) {
- pipe_buffer_reference(pipe->screen, &st->bitmap.vbuf, NULL);
+ pipe_buffer_reference(&st->bitmap.vbuf, NULL);
st->bitmap.vbuf = NULL;
}
if (st->bitmap.cache) {
- pipe_texture_release(&st->bitmap.cache->texture);
+ pipe_texture_reference(&st->bitmap.cache->texture, NULL);
_mesa_free(st->bitmap.cache);
st->bitmap.cache = NULL;
}
diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c
index 2765ec24b7a..45fbe8c76e0 100644
--- a/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -74,11 +74,10 @@ st_bufferobj_alloc(GLcontext *ctx, GLuint name, GLenum target)
static void
st_bufferobj_free(GLcontext *ctx, struct gl_buffer_object *obj)
{
- struct pipe_context *pipe = st_context(ctx)->pipe;
struct st_buffer_object *st_obj = st_buffer_object(obj);
if (st_obj->buffer)
- pipe_buffer_reference(pipe->screen, &st_obj->buffer, NULL);
+ pipe_buffer_reference(&st_obj->buffer, NULL);
_mesa_free(st_obj);
}
@@ -165,7 +164,7 @@ st_bufferobj_data(GLcontext *ctx,
buffer_usage = 0;
}
- pipe_buffer_reference( pipe->screen, &st_obj->buffer, NULL );
+ pipe_buffer_reference( &st_obj->buffer, NULL );
st_obj->buffer = pipe_buffer_create( pipe->screen, 32, buffer_usage, size );
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index c6fc7cec27c..7d4948a64ea 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -95,8 +95,6 @@ st_init_clear(struct st_context *st)
void
st_destroy_clear(struct st_context *st)
{
- struct pipe_context *pipe = st->pipe;
-
if (st->clear.vert_shader.tokens) {
util_free_shader(&st->clear.vert_shader);
st->clear.vert_shader.tokens = NULL;
@@ -116,7 +114,7 @@ st_destroy_clear(struct st_context *st)
st->clear.vs = NULL;
}
if (st->clear.vbuf) {
- pipe_buffer_reference(pipe->screen, &st->clear.vbuf, NULL);
+ pipe_buffer_reference(&st->clear.vbuf, NULL);
st->clear.vbuf = NULL;
}
}
@@ -152,7 +150,7 @@ draw_quad(GLcontext *ctx,
GLuint i;
if (st->clear.vbuf_slot >= max_slots) {
- pipe_buffer_reference(pipe->screen, &st->clear.vbuf, NULL);
+ pipe_buffer_reference(&st->clear.vbuf, NULL);
st->clear.vbuf_slot = 0;
}
@@ -524,7 +522,7 @@ void st_flush_clear( struct st_context *st )
/* Release vertex buffer to avoid synchronous rendering if we were
* to map it in the next frame.
*/
- pipe_buffer_reference(st->pipe->screen, &st->clear.vbuf, NULL);
+ pipe_buffer_reference(&st->clear.vbuf, NULL);
st->clear.vbuf_slot = 0;
}
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index cc7a9e78907..0a09e7e6f19 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -392,7 +392,7 @@ make_texture(struct st_context *st,
/* unmap */
screen->transfer_unmap(screen, transfer);
- screen->tex_transfer_release(screen, &transfer);
+ screen->tex_transfer_destroy(transfer);
assert(success);
@@ -495,7 +495,7 @@ draw_quad(GLcontext *ctx, GLfloat x0, GLfloat y0, GLfloat z,
PIPE_PRIM_QUADS,
4, /* verts */
3); /* attribs/vert */
- pipe_buffer_reference(pipe->screen, &buf, NULL);
+ pipe_buffer_reference(&buf, NULL);
}
}
@@ -808,7 +808,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
/* unmap the stencil buffer */
screen->transfer_unmap(screen, pt);
- screen->tex_transfer_release(screen, &pt);
+ screen->tex_transfer_destroy(pt);
}
@@ -951,7 +951,7 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
/* unmap the stencil buffer */
screen->transfer_unmap(screen, ptDraw);
- screen->tex_transfer_release(screen, &ptDraw);
+ screen->tex_transfer_destroy(ptDraw);
}
@@ -1070,8 +1070,8 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
_mesa_free(buf);
}
- screen->tex_transfer_release(screen, &ptRead);
- screen->tex_transfer_release(screen, &ptTex);
+ screen->tex_transfer_destroy(ptRead);
+ screen->tex_transfer_destroy(ptTex);
}
/* draw textured quad */
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 15bd6fee052..f74d0d46d01 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -41,7 +41,6 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
-#include "pipe/p_inlines.h"
#include "pipe/p_screen.h"
#include "st_context.h"
#include "st_cb_fbo.h"
@@ -357,8 +356,6 @@ st_render_texture(GLcontext *ctx,
if (!pt)
return;
- assert(!att->Renderbuffer);
-
/* create new renderbuffer which wraps the texture image */
rb = st_new_renderbuffer(ctx, 0);
if (!rb) {
@@ -415,7 +412,6 @@ static void
st_finish_render_texture(GLcontext *ctx,
struct gl_renderbuffer_attachment *att)
{
- struct pipe_screen *screen = ctx->st->pipe->screen;
struct st_renderbuffer *strb = st_renderbuffer(att->Renderbuffer);
if (!strb)
@@ -424,7 +420,7 @@ st_finish_render_texture(GLcontext *ctx,
st_flush( ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL );
if (strb->surface)
- screen->tex_surface_release( screen, &strb->surface );
+ pipe_surface_reference( &strb->surface, NULL );
strb->rtt = NULL;
diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c
index 5a4a7f0a616..2a4beccd90e 100644
--- a/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/src/mesa/state_tracker/st_cb_readpixels.c
@@ -134,7 +134,7 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
/* unmap the stencil buffer */
screen->transfer_unmap(screen, pt);
- screen->tex_transfer_release(screen, &pt);
+ screen->tex_transfer_destroy(pt);
}
@@ -224,7 +224,7 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb,
map = screen->transfer_map(screen, trans);
if (!map) {
- screen->tex_transfer_release(screen, &trans);
+ screen->tex_transfer_destroy(trans);
return GL_FALSE;
}
@@ -282,7 +282,7 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb,
}
screen->transfer_unmap(screen, trans);
- screen->tex_transfer_release(screen, &trans);
+ screen->tex_transfer_destroy(trans);
}
return GL_TRUE;
@@ -466,7 +466,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
}
}
- screen->tex_transfer_release(screen, &trans);
+ screen->tex_transfer_destroy(trans);
_mesa_unmap_readpix_pbo(ctx, &clippedPacking);
}
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 3039eb2a877..a5044541459 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -938,12 +938,12 @@ fallback_copy_texsubimage(GLcontext *ctx,
srcY = strb->Base.Height - srcY - height;
}
- src_trans = pipe->screen->get_tex_transfer( pipe->screen,
- strb->texture,
- 0, 0, 0,
- PIPE_TRANSFER_READ,
- srcX, srcY,
- width, height);
+ src_trans = screen->get_tex_transfer( screen,
+ strb->texture,
+ 0, 0, 0,
+ PIPE_TRANSFER_READ,
+ srcX, srcY,
+ width, height);
texDest = st_texture_image_map(ctx->st, stImage, 0, PIPE_TRANSFER_WRITE,
destX, destY, width, height);
@@ -1020,7 +1020,7 @@ fallback_copy_texsubimage(GLcontext *ctx,
}
st_texture_image_unmap(ctx->st, stImage);
- screen->tex_transfer_release(screen, &src_trans);
+ screen->tex_transfer_destroy(src_trans);
}
@@ -1413,7 +1413,7 @@ st_finalize_texture(GLcontext *ctx,
stObj->pt->depth[0] != firstImage->base.Depth2 ||
stObj->pt->block.size/stObj->pt->block.width != cpp || /* Nominal bytes per pixel */
stObj->pt->compressed != firstImage->base.IsCompressed) {
- pipe_texture_release(&stObj->pt);
+ pipe_texture_reference(&stObj->pt, NULL);
ctx->st->dirty.st |= ST_NEW_FRAMEBUFFER;
}
}
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 78a7956c90d..9a17038eaf1 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -66,7 +66,6 @@
#include "st_gen_mipmap.h"
#include "st_program.h"
#include "pipe/p_context.h"
-#include "pipe/p_inlines.h"
#include "draw/draw_context.h"
#include "cso_cache/cso_cache.h"
#include "cso_cache/cso_context.h"
@@ -209,7 +208,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(st->pipe->screen, &st->state.constants[i].buffer, NULL);
+ pipe_buffer_reference(&st->state.constants[i].buffer, NULL);
}
}
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index b52e4886128..be1d9a86281 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -378,7 +378,7 @@ setup_interleaved_attribs(GLcontext *ctx,
}
else {
vbuffer->buffer = NULL;
- pipe_buffer_reference(pipe->screen, &vbuffer->buffer, stobj->buffer);
+ pipe_buffer_reference(&vbuffer->buffer, stobj->buffer);
vbuffer->buffer_offset = (unsigned) low;
}
vbuffer->stride = stride; /* in bytes */
@@ -433,7 +433,7 @@ setup_non_interleaved_attribs(GLcontext *ctx,
/*printf("stobj %u = %p\n", attr, (void*) stobj);*/
vbuffer[attr].buffer = NULL;
- pipe_buffer_reference(pipe->screen, &vbuffer[attr].buffer, stobj->buffer);
+ pipe_buffer_reference(&vbuffer[attr].buffer, stobj->buffer);
vbuffer[attr].buffer_offset = (unsigned) arrays[mesaAttr]->Ptr;
velements[attr].src_offset = 0;
}
@@ -617,7 +617,7 @@ 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(pipe->screen, &indexBuf, stobj->buffer);
+ pipe_buffer_reference(&indexBuf, stobj->buffer);
indexOffset = (unsigned) ib->ptr / indexSize;
}
else {
@@ -657,7 +657,7 @@ st_draw_vbo(GLcontext *ctx,
}
}
- pipe_buffer_reference(pipe->screen, &indexBuf, NULL);
+ pipe_buffer_reference(&indexBuf, NULL);
}
else {
/* non-indexed */
@@ -673,7 +673,7 @@ st_draw_vbo(GLcontext *ctx,
/* unreference buffers (frees wrapped user-space buffer objects) */
for (attr = 0; attr < num_vbuffers; attr++) {
- pipe_buffer_reference(pipe->screen, &vbuffer[attr].buffer, NULL);
+ pipe_buffer_reference(&vbuffer[attr].buffer, NULL);
assert(!vbuffer[attr].buffer);
}
diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c
index 5c9c4506c22..d63d8cae28e 100644
--- a/src/mesa/state_tracker/st_draw_feedback.c
+++ b/src/mesa/state_tracker/st_draw_feedback.c
@@ -152,7 +152,7 @@ st_feedback_draw_vbo(GLcontext *ctx,
assert(stobj->buffer);
vbuffers[attr].buffer = NULL;
- pipe_buffer_reference(pipe->screen, &vbuffers[attr].buffer, stobj->buffer);
+ pipe_buffer_reference(&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;
}
@@ -248,7 +248,7 @@ st_feedback_draw_vbo(GLcontext *ctx,
for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
if (draw->pt.vertex_buffer[i].buffer) {
pipe_buffer_unmap(pipe->screen, draw->pt.vertex_buffer[i].buffer);
- pipe_buffer_reference(pipe->screen, &draw->pt.vertex_buffer[i].buffer, NULL);
+ pipe_buffer_reference(&draw->pt.vertex_buffer[i].buffer, NULL);
draw_set_mapped_vertex_buffer(draw, i, NULL);
}
}
diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c
index 0d4474a8b3a..d76a1eae093 100644
--- a/src/mesa/state_tracker/st_framebuffer.c
+++ b/src/mesa/state_tracker/st_framebuffer.c
@@ -38,7 +38,6 @@
#include "st_public.h"
#include "pipe/p_defines.h"
#include "pipe/p_context.h"
-#include "pipe/p_inlines.h"
struct st_framebuffer *
diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c
index 08e48030681..9cc2176d5e4 100644
--- a/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/src/mesa/state_tracker/st_gen_mipmap.c
@@ -147,8 +147,8 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
screen->transfer_unmap(screen, srcTrans);
screen->transfer_unmap(screen, dstTrans);
- screen->tex_transfer_release(screen, &srcTrans);
- screen->tex_transfer_release(screen, &dstTrans);
+ screen->tex_transfer_destroy(srcTrans);
+ screen->tex_transfer_destroy(dstTrans);
}
}
diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c
index fcf76ef82e8..20c34cd80af 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -40,7 +40,6 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
-#include "pipe/p_inlines.h"
#include "util/u_rect.h"
@@ -108,7 +107,7 @@ st_texture_create(struct st_context *st,
newtex = screen->texture_create(screen, &pt);
- assert(!newtex || newtex->refcount == 1);
+ assert(!newtex || newtex->reference.count == 1);
return newtex;
}
@@ -219,7 +218,7 @@ st_texture_image_unmap(struct st_context *st,
screen->transfer_unmap(screen, stImage->transfer);
- screen->tex_transfer_release(screen, &stImage->transfer);
+ screen->tex_transfer_destroy(stImage->transfer);
}
@@ -284,7 +283,7 @@ st_texture_image_data(struct pipe_context *pipe,
0, 0, /* source x, y */
dst->width[level], dst->height[level]); /* width, height */
- screen->tex_transfer_release(screen, &dst_transfer);
+ screen->tex_transfer_destroy(dst_transfer);
srcUB += src_image_stride;
}
@@ -350,8 +349,8 @@ st_texture_image_copy(struct pipe_context *pipe,
0, 0, /* srcX, Y */
width, height);
- screen->tex_surface_release(screen, &src_surface);
- screen->tex_surface_release(screen, &dst_surface);
+ pipe_surface_reference(&src_surface, NULL);
+ pipe_surface_reference(&dst_surface, NULL);
}
}
diff --git a/src/mesa/tnl/t_vb_points.c b/src/mesa/tnl/t_vb_points.c
index 01d055c1dd8..a52505b4b86 100644
--- a/src/mesa/tnl/t_vb_points.c
+++ b/src/mesa/tnl/t_vb_points.c
@@ -25,7 +25,9 @@
* Brian Paul
*/
+#include "main/glheader.h"
#include "main/mtypes.h"
+#include "main/dd.h"
#include "main/imports.h"
#include "t_context.h"
#include "t_pipeline.h"
diff --git a/src/mesa/tnl/t_vp_build.c b/src/mesa/tnl/t_vp_build.c
index 7be4d95af6b..735937bbe29 100644
--- a/src/mesa/tnl/t_vp_build.c
+++ b/src/mesa/tnl/t_vp_build.c
@@ -32,6 +32,7 @@
#include "main/glheader.h"
#include "main/ffvertex_prog.h"
+#include "main/dd.h"
#include "t_vp_build.h"
diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c
index c0ffdb55e47..9c2d0659139 100644
--- a/src/mesa/vbo/vbo_exec_api.c
+++ b/src/mesa/vbo/vbo_exec_api.c
@@ -183,8 +183,6 @@ static void vbo_exec_copy_to_current( struct vbo_exec_context *exec )
_mesa_update_color_material(ctx,
ctx->Current.Attrib[VBO_ATTRIB_COLOR0]);
}
-
- ctx->Driver.NeedFlush &= ~FLUSH_UPDATE_CURRENT;
}
@@ -204,8 +202,6 @@ static void vbo_exec_copy_from_current( struct vbo_exec_context *exec )
break;
}
}
-
- ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT;
}
@@ -346,8 +342,6 @@ static void vbo_exec_fixup_vertex( GLcontext *ctx,
*/
if (attr == 0)
exec->ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES;
- else
- exec->ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT;
}
@@ -750,6 +744,9 @@ void vbo_exec_BeginVertices( GLcontext *ctx )
struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
if (0) _mesa_printf("%s\n", __FUNCTION__);
vbo_exec_vtx_map( exec );
+
+ assert(exec->ctx->Driver.NeedFlush == 0);
+ exec->ctx->Driver.NeedFlush = FLUSH_UPDATE_CURRENT;
}
void vbo_exec_FlushVertices_internal( GLcontext *ctx, GLboolean unmap )
@@ -785,6 +782,7 @@ void vbo_exec_FlushVertices( GLcontext *ctx, GLuint flags )
*/
_mesa_restore_exec_vtxfmt( ctx );
+ assert(exec->ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT);
exec->ctx->Driver.NeedFlush = 0;
}