aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-08-17 10:54:15 +0200
committermarha <marha@users.sourceforge.net>2012-08-17 10:54:15 +0200
commit5d9b8cf0e4054e774f906cde9dd6b61ceca72d44 (patch)
tree2a15e0622fdb009a0aac84019dce232a245f2e0b /mesalib/src/mesa/state_tracker
parent4aac32998c2b173b84aec0b020aa086fef4b1423 (diff)
downloadvcxsrv-5d9b8cf0e4054e774f906cde9dd6b61ceca72d44.tar.gz
vcxsrv-5d9b8cf0e4054e774f906cde9dd6b61ceca72d44.tar.bz2
vcxsrv-5d9b8cf0e4054e774f906cde9dd6b61ceca72d44.zip
fontconfig mesa git update 17 Aug 2012
Diffstat (limited to 'mesalib/src/mesa/state_tracker')
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom.c3
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom.h3
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_sampler.c26
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_texture.c36
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_bitmap.c11
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.c15
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.h13
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp6
8 files changed, 67 insertions, 46 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_atom.c b/mesalib/src/mesa/state_tracker/st_atom.c
index e6fc114f1..102fee93b 100644
--- a/mesalib/src/mesa/state_tracker/st_atom.c
+++ b/mesalib/src/mesa/state_tracker/st_atom.c
@@ -57,7 +57,8 @@ static const struct st_tracked_state *atoms[] =
&st_update_blend,
&st_update_sampler,
&st_update_vertex_texture,
- &st_update_texture,
+ &st_update_fragment_texture,
+ &st_update_geometry_texture,
&st_update_framebuffer,
&st_update_msaa,
&st_update_vs_constants,
diff --git a/mesalib/src/mesa/state_tracker/st_atom.h b/mesalib/src/mesa/state_tracker/st_atom.h
index 703bc2ab3..6c7d09fba 100644
--- a/mesalib/src/mesa/state_tracker/st_atom.h
+++ b/mesalib/src/mesa/state_tracker/st_atom.h
@@ -60,8 +60,9 @@ extern const struct st_tracked_state st_update_scissor;
extern const struct st_tracked_state st_update_blend;
extern const struct st_tracked_state st_update_msaa;
extern const struct st_tracked_state st_update_sampler;
-extern const struct st_tracked_state st_update_texture;
+extern const struct st_tracked_state st_update_fragment_texture;
extern const struct st_tracked_state st_update_vertex_texture;
+extern const struct st_tracked_state st_update_geometry_texture;
extern const struct st_tracked_state st_finalize_textures;
extern const struct st_tracked_state st_update_fs_constants;
extern const struct st_tracked_state st_update_gs_constants;
diff --git a/mesalib/src/mesa/state_tracker/st_atom_sampler.c b/mesalib/src/mesa/state_tracker/st_atom_sampler.c
index f39fd7551..adcc7b505 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_sampler.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_sampler.c
@@ -253,24 +253,24 @@ update_samplers(struct st_context *st)
PIPE_SHADER_FRAGMENT,
&ctx->FragmentProgram._Current->Base,
ctx->Const.MaxTextureImageUnits,
- st->state.fragment_samplers,
- &st->state.num_fragment_samplers);
+ st->state.samplers[PIPE_SHADER_FRAGMENT],
+ &st->state.num_samplers[PIPE_SHADER_FRAGMENT]);
update_shader_samplers(st,
PIPE_SHADER_VERTEX,
&ctx->VertexProgram._Current->Base,
ctx->Const.MaxVertexTextureImageUnits,
- st->state.vertex_samplers,
- &st->state.num_vertex_samplers);
-
-/*
- update_shader_samplers(st,
- PIPE_SHADER_GEOMETRY,
- &ctx->GeometryProgram._Current->Base,
- ctx->Const.MaxGeometryTextureImageUnits,
- st->state.geometry_samplers,
- &st->state.num_geometry_samplers);
-*/
+ st->state.samplers[PIPE_SHADER_VERTEX],
+ &st->state.num_samplers[PIPE_SHADER_VERTEX]);
+
+ if (ctx->GeometryProgram._Current) {
+ update_shader_samplers(st,
+ PIPE_SHADER_GEOMETRY,
+ &ctx->GeometryProgram._Current->Base,
+ ctx->Const.MaxGeometryTextureImageUnits,
+ st->state.samplers[PIPE_SHADER_GEOMETRY],
+ &st->state.num_samplers[PIPE_SHADER_GEOMETRY]);
+ }
}
diff --git a/mesalib/src/mesa/state_tracker/st_atom_texture.c b/mesalib/src/mesa/state_tracker/st_atom_texture.c
index e88675d4e..6e2efd960 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_texture.c
@@ -312,8 +312,8 @@ update_vertex_textures(struct st_context *st)
PIPE_SHADER_VERTEX,
&ctx->VertexProgram._Current->Base,
ctx->Const.MaxVertexTextureImageUnits,
- st->state.vertex_sampler_views,
- &st->state.num_vertex_textures);
+ st->state.sampler_views[PIPE_SHADER_VERTEX],
+ &st->state.num_sampler_views[PIPE_SHADER_VERTEX]);
}
}
@@ -327,12 +327,28 @@ update_fragment_textures(struct st_context *st)
PIPE_SHADER_FRAGMENT,
&ctx->FragmentProgram._Current->Base,
ctx->Const.MaxTextureImageUnits,
- st->state.fragment_sampler_views,
- &st->state.num_fragment_textures);
+ st->state.sampler_views[PIPE_SHADER_FRAGMENT],
+ &st->state.num_sampler_views[PIPE_SHADER_FRAGMENT]);
}
-const struct st_tracked_state st_update_texture = {
+static void
+update_geometry_textures(struct st_context *st)
+{
+ const struct gl_context *ctx = st->ctx;
+
+ if (ctx->GeometryProgram._Current) {
+ update_textures(st,
+ PIPE_SHADER_GEOMETRY,
+ &ctx->GeometryProgram._Current->Base,
+ ctx->Const.MaxTextureImageUnits,
+ st->state.sampler_views[PIPE_SHADER_GEOMETRY],
+ &st->state.num_sampler_views[PIPE_SHADER_GEOMETRY]);
+ }
+}
+
+
+const struct st_tracked_state st_update_fragment_texture = {
"st_update_texture", /* name */
{ /* dirty */
_NEW_TEXTURE, /* mesa */
@@ -352,6 +368,16 @@ const struct st_tracked_state st_update_vertex_texture = {
};
+const struct st_tracked_state st_update_geometry_texture = {
+ "st_update_geometry_texture", /* name */
+ { /* dirty */
+ _NEW_TEXTURE, /* mesa */
+ ST_NEW_GEOMETRY_PROGRAM, /* st */
+ },
+ update_geometry_textures /* update */
+};
+
+
static void
finalize_textures(struct st_context *st)
diff --git a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c
index 7d9ccc1e5..dbd778b4f 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c
@@ -481,10 +481,11 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
/* user samplers, plus our bitmap sampler */
{
struct pipe_sampler_state *samplers[PIPE_MAX_SAMPLERS];
- uint num = MAX2(fpv->bitmap_sampler + 1, st->state.num_fragment_samplers);
+ uint num = MAX2(fpv->bitmap_sampler + 1,
+ st->state.num_samplers[PIPE_SHADER_FRAGMENT]);
uint i;
- for (i = 0; i < st->state.num_fragment_samplers; i++) {
- samplers[i] = &st->state.fragment_samplers[i];
+ for (i = 0; i < st->state.num_samplers[PIPE_SHADER_FRAGMENT]; i++) {
+ samplers[i] = &st->state.samplers[PIPE_SHADER_FRAGMENT][i];
}
samplers[fpv->bitmap_sampler] =
&st->bitmap.samplers[sv->texture->target != PIPE_TEXTURE_RECT];
@@ -496,8 +497,8 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
{
struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
uint num = MAX2(fpv->bitmap_sampler + 1,
- st->state.num_fragment_textures);
- memcpy(sampler_views, st->state.fragment_sampler_views,
+ st->state.num_sampler_views[PIPE_SHADER_FRAGMENT]);
+ memcpy(sampler_views, st->state.sampler_views[PIPE_SHADER_FRAGMENT],
sizeof(sampler_views));
sampler_views[fpv->bitmap_sampler] = sv;
cso_set_sampler_views(cso, PIPE_SHADER_FRAGMENT, num, sampler_views);
diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c
index 2f9516178..7735eee4f 100644
--- a/mesalib/src/mesa/state_tracker/st_context.c
+++ b/mesalib/src/mesa/state_tracker/st_context.c
@@ -237,7 +237,7 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,
static void st_destroy_context_priv( struct st_context *st )
{
- uint i;
+ uint shader, i;
st_destroy_atoms( st );
st_destroy_draw( st );
@@ -248,14 +248,11 @@ static void st_destroy_context_priv( struct st_context *st )
st_destroy_drawpix(st);
st_destroy_drawtex(st);
- for (i = 0; i < Elements(st->state.fragment_sampler_views); i++) {
- pipe_sampler_view_release(st->pipe,
- &st->state.fragment_sampler_views[i]);
- }
-
- for (i = 0; i < Elements(st->state.vertex_sampler_views); i++) {
- pipe_sampler_view_release(st->pipe,
- &st->state.vertex_sampler_views[i]);
+ for (shader = 0; shader < Elements(st->state.sampler_views); shader++) {
+ for (i = 0; i < Elements(st->state.sampler_views[0]); i++) {
+ pipe_sampler_view_release(st->pipe,
+ &st->state.sampler_views[shader][i]);
+ }
}
if (st->default_texture) {
diff --git a/mesalib/src/mesa/state_tracker/st_context.h b/mesalib/src/mesa/state_tracker/st_context.h
index 0dfd81c1b..47d3af520 100644
--- a/mesalib/src/mesa/state_tracker/st_context.h
+++ b/mesalib/src/mesa/state_tracker/st_context.h
@@ -98,25 +98,20 @@ struct st_context
struct pipe_blend_state blend;
struct pipe_depth_stencil_alpha_state depth_stencil;
struct pipe_rasterizer_state rasterizer;
- struct pipe_sampler_state fragment_samplers[PIPE_MAX_SAMPLERS];
- struct pipe_sampler_state vertex_samplers[PIPE_MAX_VERTEX_SAMPLERS];
+ struct pipe_sampler_state samplers[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
+ GLuint num_samplers[PIPE_SHADER_TYPES];
+ struct pipe_sampler_view *sampler_views[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
+ GLuint num_sampler_views[PIPE_SHADER_TYPES];
struct pipe_clip_state clip;
struct {
void *ptr;
unsigned size;
} constants[PIPE_SHADER_TYPES];
struct pipe_framebuffer_state framebuffer;
- struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS];
- struct pipe_sampler_view *vertex_sampler_views[PIPE_MAX_VERTEX_SAMPLERS];
struct pipe_scissor_state scissor;
struct pipe_viewport_state viewport;
unsigned sample_mask;
- GLuint num_fragment_samplers;
- GLuint num_vertex_samplers;
- GLuint num_fragment_textures;
- GLuint num_vertex_textures;
-
GLuint poly_stipple[32]; /**< In OpenGL's bottom-to-top order */
GLuint fb_orientation;
diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 39717b6fd..9146f24f3 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4028,7 +4028,7 @@ dst_register(struct st_translate *t,
static struct ureg_src
src_register(struct st_translate *t,
gl_register_file file,
- GLuint index)
+ GLint index)
{
switch(file) {
case PROGRAM_UNDEFINED:
@@ -4036,7 +4036,7 @@ src_register(struct st_translate *t,
case PROGRAM_TEMPORARY:
assert(index >= 0);
- assert(index < Elements(t->temps));
+ assert(index < (int) Elements(t->temps));
if (ureg_dst_is_undef(t->temps[index]))
t->temps[index] = ureg_DECL_local_temporary(t->ureg);
return ureg_src(t->temps[index]);
@@ -4069,7 +4069,7 @@ src_register(struct st_translate *t,
return ureg_src(t->address[index]);
case PROGRAM_SYSTEM_VALUE:
- assert(index < Elements(t->systemValues));
+ assert(index < (int) Elements(t->systemValues));
return t->systemValues[index];
default: