diff options
Diffstat (limited to 'mesalib/src/mesa/state_tracker')
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_atom.c | 4 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_atom_constbuf.c | 27 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_cb_clear.c | 8 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_cb_drawpixels.c | 1 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_cb_fbo.c | 6 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_context.c | 7 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_context.h | 14 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_draw_feedback.c | 15 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_extensions.c | 1 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_manager.c | 6 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_program.c | 2 |
11 files changed, 38 insertions, 53 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_atom.c b/mesalib/src/mesa/state_tracker/st_atom.c index ff1f61afe..34dff79e7 100644 --- a/mesalib/src/mesa/state_tracker/st_atom.c +++ b/mesalib/src/mesa/state_tracker/st_atom.c @@ -147,7 +147,11 @@ void st_validate_state( struct st_context *st ) /*printf("%s %x/%x\n", __FUNCTION__, state->mesa, state->st);*/
+#ifdef NDEBUG
+ if (0) {
+#else
if (1) {
+#endif
/* Debug version which enforces various sanity checks on the
* state flags which are generated and checked to help ensure
* state atoms are ordered correctly in the list.
diff --git a/mesalib/src/mesa/state_tracker/st_atom_constbuf.c b/mesalib/src/mesa/state_tracker/st_atom_constbuf.c index 5672215f7..87a479a22 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_constbuf.c +++ b/mesalib/src/mesa/state_tracker/st_atom_constbuf.c @@ -56,7 +56,6 @@ void st_upload_constants( struct st_context *st, unsigned shader_type)
{
struct pipe_context *pipe = st->pipe;
- struct pipe_resource **cbuf = &st->state.constants[shader_type];
assert(shader_type == PIPE_SHADER_VERTEX ||
shader_type == PIPE_SHADER_FRAGMENT ||
@@ -64,6 +63,7 @@ void st_upload_constants( struct st_context *st, /* update constants */
if (params && params->NumParameters) {
+ struct pipe_resource *cbuf;
const uint paramBytes = params->NumParameters * sizeof(GLfloat) * 4;
/* Update the constants which come from fixed-function state, such as
@@ -75,11 +75,12 @@ 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.
+ * Let's use a user buffer to avoid an unnecessary copy.
*/
- pipe_resource_reference(cbuf, NULL );
- *cbuf = pipe_buffer_create(pipe->screen,
- PIPE_BIND_CONSTANT_BUFFER,
- paramBytes );
+ cbuf = pipe_user_buffer_create(pipe->screen,
+ params->ParameterValues,
+ paramBytes,
+ PIPE_BIND_CONSTANT_BUFFER);
if (ST_DEBUG & DEBUG_CONSTANTS) {
debug_printf("%s(shader=%d, numParams=%d, stateFlags=0x%x)\n",
@@ -88,17 +89,15 @@ void st_upload_constants( struct st_context *st, _mesa_print_parameter_list(params);
}
- /* load Mesa constants into the constant buffer */
- pipe_buffer_write(st->pipe, *cbuf,
- 0, paramBytes,
- params->ParameterValues);
+ st->pipe->set_constant_buffer(st->pipe, shader_type, 0, cbuf);
+ pipe_resource_reference(&cbuf, NULL);
- st->pipe->set_constant_buffer(st->pipe, shader_type, 0, *cbuf);
+ st->state.constants[shader_type].ptr = params->ParameterValues;
+ st->state.constants[shader_type].size = paramBytes;
}
- else if (*cbuf) {
- st->constants.tracked_state[shader_type].dirty.mesa = 0x0;
-
- pipe_resource_reference(cbuf, NULL);
+ else if (st->state.constants[shader_type].ptr) {
+ st->state.constants[shader_type].ptr = NULL;
+ st->state.constants[shader_type].size = 0;
st->pipe->set_constant_buffer(st->pipe, shader_type, 0, NULL);
}
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_clear.c b/mesalib/src/mesa/state_tracker/st_cb_clear.c index 7dd63798d..3e27be271 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_clear.c +++ b/mesalib/src/mesa/state_tracker/st_cb_clear.c @@ -470,13 +470,9 @@ st_Clear(struct gl_context *ctx, GLbitfield mask) if (mask & (1 << b)) {
struct gl_renderbuffer *rb
= ctx->DrawBuffer->Attachment[b].Renderbuffer;
- struct st_renderbuffer *strb;
+ struct st_renderbuffer *strb = st_renderbuffer(rb);
- assert(rb);
-
- strb = st_renderbuffer(rb);
-
- if (!strb->surface)
+ if (!strb || !strb->surface)
continue;
if (check_clear_color_with_quad( ctx, rb ))
diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c index 8a63192d7..c348dd343 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c @@ -34,6 +34,7 @@ #include "main/image.h"
#include "main/bufferobj.h"
#include "main/macros.h"
+#include "main/mtypes.h"
#include "main/pack.h"
#include "main/texformat.h"
#include "main/texstore.h"
diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c index 4bc01100a..d6df2a204 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c +++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c @@ -61,7 +61,8 @@ * during window resize.
*/
static GLboolean
-st_renderbuffer_alloc_storage(struct gl_context * ctx, struct gl_renderbuffer *rb,
+st_renderbuffer_alloc_storage(struct gl_context * ctx,
+ struct gl_renderbuffer *rb,
GLenum internalFormat,
GLuint width, GLuint height)
{
@@ -75,7 +76,8 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx, struct gl_renderbuffer *r if (strb->format != PIPE_FORMAT_NONE)
format = strb->format;
else
- format = st_choose_renderbuffer_format(screen, internalFormat, rb->NumSamples);
+ format = st_choose_renderbuffer_format(screen, internalFormat,
+ rb->NumSamples);
/* init renderbuffer fields */
strb->Base.Width = width;
diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c index 4656930ac..593da8fa6 100644 --- a/mesalib/src/mesa/state_tracker/st_context.c +++ b/mesalib/src/mesa/state_tracker/st_context.c @@ -207,12 +207,6 @@ static void st_destroy_context_priv( struct st_context *st ) pipe_sampler_view_reference(&st->state.sampler_views[i], NULL);
}
- for (i = 0; i < Elements(st->state.constants); i++) {
- if (st->state.constants[i]) {
- pipe_resource_reference(&st->state.constants[i], NULL);
- }
- }
-
if (st->default_texture) {
st->ctx->Driver.DeleteTexture(st->ctx, st->default_texture);
st->default_texture = NULL;
@@ -245,7 +239,6 @@ void st_destroy_context( struct st_context *st ) for (i = 0; i < PIPE_SHADER_TYPES; i++) {
pipe->set_constant_buffer(pipe, i, 0, NULL);
- pipe_resource_reference(&st->state.constants[i], NULL);
}
_mesa_delete_program_cache(st->ctx, st->pixel_xfer.cache);
diff --git a/mesalib/src/mesa/state_tracker/st_context.h b/mesalib/src/mesa/state_tracker/st_context.h index 348a5827d..492ee600e 100644 --- a/mesalib/src/mesa/state_tracker/st_context.h +++ b/mesalib/src/mesa/state_tracker/st_context.h @@ -92,7 +92,10 @@ struct st_context struct pipe_sampler_state samplers[PIPE_MAX_SAMPLERS];
struct pipe_sampler_state *sampler_list[PIPE_MAX_SAMPLERS];
struct pipe_clip_state clip;
- struct pipe_resource *constants[PIPE_SHADER_TYPES];
+ struct {
+ void *ptr;
+ unsigned size;
+ } constants[PIPE_SHADER_TYPES];
struct pipe_framebuffer_state framebuffer;
struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
struct pipe_scissor_state scissor;
@@ -105,15 +108,6 @@ struct st_context GLuint poly_stipple[32]; /**< In OpenGL's bottom-to-top order */
} state;
- struct {
- struct st_tracked_state tracked_state[PIPE_SHADER_TYPES];
- } constants;
-
- /* XXX unused: */
- struct {
- struct gl_fragment_program *fragment_program;
- } cb;
-
char vendor[100];
char renderer[100];
diff --git a/mesalib/src/mesa/state_tracker/st_draw_feedback.c b/mesalib/src/mesa/state_tracker/st_draw_feedback.c index b05e660ae..957912221 100644 --- a/mesalib/src/mesa/state_tracker/st_draw_feedback.c +++ b/mesalib/src/mesa/state_tracker/st_draw_feedback.c @@ -109,9 +109,7 @@ st_feedback_draw_vbo(struct gl_context *ctx, struct pipe_index_buffer ibuffer;
struct pipe_transfer *vb_transfer[PIPE_MAX_ATTRIBS];
struct pipe_transfer *ib_transfer = NULL;
- struct pipe_transfer *cb_transfer;
GLuint attr, i;
- ubyte *mapped_constants;
const void *mapped_indices = NULL;
assert(draw);
@@ -242,14 +240,10 @@ st_feedback_draw_vbo(struct gl_context *ctx, draw_set_mapped_index_buffer(draw, mapped_indices);
}
- /* map constant buffers */
- mapped_constants = pipe_buffer_map(pipe,
- st->state.constants[PIPE_SHADER_VERTEX],
- PIPE_TRANSFER_READ,
- &cb_transfer);
+ /* set the constant buffer */
draw_set_mapped_constant_buffer(st->draw, PIPE_SHADER_VERTEX, 0,
- mapped_constants,
- st->state.constants[PIPE_SHADER_VERTEX]->width0);
+ st->state.constants[PIPE_SHADER_VERTEX].ptr,
+ st->state.constants[PIPE_SHADER_VERTEX].size);
/* draw here */
@@ -258,9 +252,6 @@ st_feedback_draw_vbo(struct gl_context *ctx, }
- /* unmap constant buffers */
- pipe_buffer_unmap(pipe, cb_transfer);
-
/*
* unmap vertex/index buffers
*/
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c index c80811a07..574730120 100644 --- a/mesalib/src/mesa/state_tracker/st_extensions.c +++ b/mesalib/src/mesa/state_tracker/st_extensions.c @@ -224,6 +224,7 @@ void st_init_extensions(struct st_context *st) ctx->Extensions.ARB_draw_elements_base_vertex = GL_TRUE;
ctx->Extensions.ARB_fragment_coord_conventions = GL_TRUE;
ctx->Extensions.ARB_fragment_program = GL_TRUE;
+ ctx->Extensions.ARB_half_float_pixel = GL_TRUE;
ctx->Extensions.ARB_map_buffer_range = GL_TRUE;
ctx->Extensions.ARB_multisample = GL_TRUE;
ctx->Extensions.ARB_texture_border_clamp = GL_TRUE; /* XXX temp */
diff --git a/mesalib/src/mesa/state_tracker/st_manager.c b/mesalib/src/mesa/state_tracker/st_manager.c index 74d402daa..7952bb6ff 100644 --- a/mesalib/src/mesa/state_tracker/st_manager.c +++ b/mesalib/src/mesa/state_tracker/st_manager.c @@ -513,7 +513,8 @@ st_context_flush(struct st_context_iface *stctxi, unsigned flags, }
static boolean
-st_context_teximage(struct st_context_iface *stctxi, enum st_texture_type target,
+st_context_teximage(struct st_context_iface *stctxi,
+ enum st_texture_type target,
int level, enum pipe_format internal_format,
struct pipe_resource *tex, boolean mipmap)
{
@@ -865,7 +866,8 @@ st_manager_validate_framebuffers(struct st_context *st) * Add a color renderbuffer on demand.
*/
boolean
-st_manager_add_color_renderbuffer(struct st_context *st, struct gl_framebuffer *fb,
+st_manager_add_color_renderbuffer(struct st_context *st,
+ struct gl_framebuffer *fb,
gl_buffer_index idx)
{
struct st_framebuffer *stfb = st_ws_framebuffer(fb);
diff --git a/mesalib/src/mesa/state_tracker/st_program.c b/mesalib/src/mesa/state_tracker/st_program.c index 59165be04..50beaa766 100644 --- a/mesalib/src/mesa/state_tracker/st_program.c +++ b/mesalib/src/mesa/state_tracker/st_program.c @@ -409,6 +409,7 @@ st_translate_fragment_program(struct st_context *st, assert(!(key->bitmap && key->drawpixels));
+#if FEATURE_drawpix
if (key->bitmap) {
/* glBitmap drawing */
struct gl_fragment_program *fp;
@@ -434,6 +435,7 @@ st_translate_fragment_program(struct st_context *st, }
stfp = st_fragment_program(fp);
}
+#endif
if (!stfp->tgsi.tokens) {
/* need to translate Mesa instructions to TGSI now */
|