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_constbuf.c12
-rw-r--r--src/mesa/state_tracker/st_atom_shader.c23
-rw-r--r--src/mesa/state_tracker/st_context.c4
-rw-r--r--src/mesa/state_tracker/st_context.h2
-rw-r--r--src/mesa/state_tracker/st_draw.c4
-rw-r--r--src/mesa/state_tracker/st_draw_feedback.c7
-rw-r--r--src/mesa/state_tracker/st_extensions.c1
-rw-r--r--src/mesa/state_tracker/st_mesa_to_tgsi.c17
-rw-r--r--src/mesa/state_tracker/st_program.c1
-rw-r--r--src/mesa/state_tracker/st_texture.c1
10 files changed, 43 insertions, 29 deletions
diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c
index 77153889b6..d70cf877e8 100644
--- a/src/mesa/state_tracker/st_atom_constbuf.c
+++ b/src/mesa/state_tracker/st_atom_constbuf.c
@@ -57,7 +57,7 @@ void st_upload_constants( struct st_context *st,
unsigned shader_type)
{
struct pipe_context *pipe = st->pipe;
- struct pipe_constant_buffer *cbuf = &st->state.constants[shader_type];
+ struct pipe_buffer **cbuf = &st->state.constants[shader_type];
assert(shader_type == PIPE_SHADER_VERTEX ||
shader_type == PIPE_SHADER_FRAGMENT);
@@ -71,8 +71,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(&cbuf->buffer, NULL );
- cbuf->buffer = pipe_buffer_create(pipe->screen, 16,
+ pipe_buffer_reference(cbuf, NULL );
+ *cbuf = pipe_buffer_create(pipe->screen, 16,
PIPE_BUFFER_USAGE_CONSTANT,
paramBytes );
@@ -84,12 +84,12 @@ void st_upload_constants( struct st_context *st,
}
/* load Mesa constants into the constant buffer */
- if (cbuf->buffer)
- st_no_flush_pipe_buffer_write(st, cbuf->buffer,
+ if (cbuf)
+ st_no_flush_pipe_buffer_write(st, *cbuf,
0, paramBytes,
params->ParameterValues);
- st->pipe->set_constant_buffer(st->pipe, shader_type, 0, cbuf);
+ st->pipe->set_constant_buffer(st->pipe, shader_type, 0, *cbuf);
}
else {
st->constants.tracked_state[shader_type].dirty.mesa = 0x0;
diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
index 46c8cbb309..176f3ea68d 100644
--- a/src/mesa/state_tracker/st_atom_shader.c
+++ b/src/mesa/state_tracker/st_atom_shader.c
@@ -35,8 +35,6 @@
* Brian Paul
*/
-
-
#include "main/imports.h"
#include "main/mtypes.h"
#include "main/macros.h"
@@ -57,9 +55,7 @@
-
-
-/*
+/**
* Translate fragment program if needed.
*/
static void
@@ -155,8 +151,10 @@ find_translated_vp(struct st_context *st,
}
-
-
+/**
+ * Return pointer to a pass-through fragment shader.
+ * This shader is used when a texture is missing/incomplete.
+ */
static void *
get_passthrough_fs(struct st_context *st)
{
@@ -168,6 +166,11 @@ get_passthrough_fs(struct st_context *st)
return st->passthrough_fs;
}
+
+/**
+ * Update fragment program state/atom. This involves translating the
+ * Mesa fragment program into a gallium fragment program and binding it.
+ */
static void
update_fp( struct st_context *st )
{
@@ -191,6 +194,7 @@ update_fp( struct st_context *st )
}
}
+
const struct st_tracked_state st_update_fp = {
"st_update_fp", /* name */
{ /* dirty */
@@ -202,7 +206,10 @@ const struct st_tracked_state st_update_fp = {
-
+/**
+ * Update vertex program state/atom. This involves translating the
+ * Mesa vertex program into a gallium fragment program and binding it.
+ */
static void
update_vp( struct st_context *st )
{
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 145bd62b83..9e6ce30db0 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -218,8 +218,8 @@ 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->state.constants[i].buffer, NULL);
+ if (st->state.constants[i]) {
+ pipe_buffer_reference(&st->state.constants[i], NULL);
}
}
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index 831909a3f8..2c4943cfb0 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -92,7 +92,7 @@ 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_constant_buffer constants[2];
+ struct pipe_buffer *constants[2];
struct pipe_framebuffer_state framebuffer;
struct pipe_texture *sampler_texture[PIPE_MAX_SAMPLERS];
struct pipe_scissor_state scissor;
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index e54f21be60..b0d5b993a7 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -365,6 +365,7 @@ setup_interleaved_attribs(GLcontext *ctx,
velements[attr].src_offset =
(unsigned) (arrays[mesaAttr]->Ptr - offset0);
+ velements[attr].instance_divisor = 0;
velements[attr].vertex_buffer_index = 0;
velements[attr].nr_components = arrays[mesaAttr]->Size;
velements[attr].src_format =
@@ -454,6 +455,7 @@ setup_non_interleaved_attribs(GLcontext *ctx,
/* common-case setup */
vbuffer[attr].stride = stride; /* in bytes */
vbuffer[attr].max_index = max_index;
+ velements[attr].instance_divisor = 0;
velements[attr].vertex_buffer_index = attr;
velements[attr].nr_components = arrays[mesaAttr]->Size;
velements[attr].src_format
@@ -522,7 +524,6 @@ st_draw_vbo(GLcontext *ctx,
struct pipe_context *pipe = ctx->st->pipe;
const struct st_vertex_program *vp;
const struct st_vp_varient *vpv;
- const struct pipe_shader_state *vs;
struct pipe_vertex_buffer vbuffer[PIPE_MAX_SHADER_INPUTS];
GLuint attr;
struct pipe_vertex_element velements[PIPE_MAX_ATTRIBS];
@@ -550,7 +551,6 @@ st_draw_vbo(GLcontext *ctx,
/* must get these after state validation! */
vp = ctx->st->vp;
vpv = ctx->st->vp_varient;
- vs = &vpv->state;
#if 0
if (MESA_VERBOSE & VERBOSE_GLSL) {
diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c
index cfc0caac98..a05d6dd06b 100644
--- a/src/mesa/state_tracker/st_draw_feedback.c
+++ b/src/mesa/state_tracker/st_draw_feedback.c
@@ -177,6 +177,7 @@ st_feedback_draw_vbo(GLcontext *ctx,
/* common-case setup */
vbuffers[attr].stride = arrays[mesaAttr]->StrideB; /* in bytes */
vbuffers[attr].max_index = max_index;
+ velements[attr].instance_divisor = 0;
velements[attr].vertex_buffer_index = attr;
velements[attr].nr_components = arrays[mesaAttr]->Size;
velements[attr].src_format =
@@ -239,11 +240,11 @@ st_feedback_draw_vbo(GLcontext *ctx,
/* map constant buffers */
mapped_constants = pipe_buffer_map(pipe->screen,
- st->state.constants[PIPE_SHADER_VERTEX].buffer,
+ st->state.constants[PIPE_SHADER_VERTEX],
PIPE_BUFFER_USAGE_CPU_READ);
draw_set_mapped_constant_buffer(st->draw, PIPE_SHADER_VERTEX,
mapped_constants,
- st->state.constants[PIPE_SHADER_VERTEX].buffer->size);
+ st->state.constants[PIPE_SHADER_VERTEX]->size);
/* draw here */
@@ -253,7 +254,7 @@ st_feedback_draw_vbo(GLcontext *ctx,
/* unmap constant buffers */
- pipe_buffer_unmap(pipe->screen, st->state.constants[PIPE_SHADER_VERTEX].buffer);
+ pipe_buffer_unmap(pipe->screen, st->state.constants[PIPE_SHADER_VERTEX]);
/*
* unmap vertex/index buffers
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index e25a613d8a..2a5fb27d8f 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -168,6 +168,7 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.EXT_blend_subtract = GL_TRUE;
ctx->Extensions.EXT_framebuffer_blit = GL_TRUE;
ctx->Extensions.EXT_framebuffer_object = GL_TRUE;
+ ctx->Extensions.EXT_framebuffer_multisample = GL_TRUE;
ctx->Extensions.EXT_fog_coord = GL_TRUE;
ctx->Extensions.EXT_multi_draw_arrays = GL_TRUE;
ctx->Extensions.EXT_pixel_buffer_object = GL_TRUE;
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index e788008dfe..05b56c9b58 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -48,6 +48,10 @@ struct label {
unsigned token;
};
+
+/**
+ * Intermediate state used during shader translation.
+ */
struct st_translate {
struct ureg_program *ureg;
@@ -730,6 +734,7 @@ emit_face_var( struct st_translate *t,
t->inputs[t->inputMapping[FRAG_ATTRIB_FACE]] = ureg_src(face_temp);
}
+
static void
emit_edgeflags( struct st_translate *t,
const struct gl_program *program )
@@ -741,6 +746,7 @@ emit_edgeflags( struct st_translate *t,
ureg_MOV( ureg, edge_dst, edge_src );
}
+
/**
* Translate Mesa program to TGSI format.
* \param program the program to translate
@@ -758,7 +764,7 @@ emit_edgeflags( struct st_translate *t,
* \param outputSemanticIndex the semantic index (ex: which texcoord) for
* each output
*
- * \return array of translated tokens, caller's responsibility to free
+ * \return PIPE_OK or PIPE_ERROR_OUT_OF_MEMORY
*/
enum pipe_error
st_translate_mesa_program(
@@ -779,6 +785,7 @@ st_translate_mesa_program(
{
struct st_translate translate, *t;
unsigned i;
+ enum pipe_error ret = PIPE_OK;
t = &translate;
memset(t, 0, sizeof *t);
@@ -865,8 +872,10 @@ st_translate_mesa_program(
t->constants = CALLOC( program->Parameters->NumParameters,
sizeof t->constants[0] );
- if (t->constants == NULL)
+ if (t->constants == NULL) {
+ ret = PIPE_ERROR_OUT_OF_MEMORY;
goto out;
+ }
for (i = 0; i < program->Parameters->NumParameters; i++) {
switch (program->Parameters->Parameters[i].Type) {
@@ -920,8 +929,6 @@ st_translate_mesa_program(
t->insn[t->labels[i].branch_target] );
}
- return PIPE_OK;
-
out:
FREE(t->insn);
FREE(t->labels);
@@ -931,7 +938,7 @@ out:
debug_printf("%s: translate error flag set\n", __FUNCTION__);
}
- return PIPE_ERROR_OUT_OF_MEMORY;
+ return ret;
}
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 6a869fae90..5c87e47ca3 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -44,7 +44,6 @@
#include "st_debug.h"
#include "st_context.h"
-#include "st_atom.h"
#include "st_program.h"
#include "st_mesa_to_tgsi.h"
#include "cso_cache/cso_context.h"
diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c
index 8a3e4cd3ac..b210ac9187 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -35,7 +35,6 @@
#include "main/texfetch.h"
#include "main/teximage.h"
#include "main/texobj.h"
-#include "main/texstore.h"
#undef Elements /* fix re-defined macro warning */