st/mesa: rename some vertex/fragment state fields for better consistency
Reviewed-by: José Fonseca <jfonseca@vmware.com>
This commit is contained in:
@@ -235,13 +235,13 @@ update_fragment_samplers(struct st_context *st)
|
||||
struct gl_fragment_program *fprog = ctx->FragmentProgram._Current;
|
||||
GLuint su;
|
||||
GLuint samplers_used = fprog->Base.SamplersUsed;
|
||||
GLuint old_max = st->state.num_samplers;
|
||||
GLuint old_max = st->state.num_fragment_samplers;
|
||||
|
||||
st->state.num_samplers = 0;
|
||||
st->state.num_fragment_samplers = 0;
|
||||
|
||||
/* loop over sampler units (aka tex image units) */
|
||||
for (su = 0; su < ctx->Const.MaxTextureImageUnits; su++, samplers_used >>= 1) {
|
||||
struct pipe_sampler_state *sampler = st->state.samplers + su;
|
||||
struct pipe_sampler_state *sampler = st->state.fragment_samplers + su;
|
||||
|
||||
if (samplers_used & 1) {
|
||||
GLuint texUnit;
|
||||
@@ -250,7 +250,7 @@ update_fragment_samplers(struct st_context *st)
|
||||
|
||||
convert_sampler(st, sampler, texUnit);
|
||||
|
||||
st->state.num_samplers = su + 1;
|
||||
st->state.num_fragment_samplers = su + 1;
|
||||
|
||||
/*printf("%s su=%u non-null\n", __FUNCTION__, su);*/
|
||||
cso_single_sampler(st->cso_context, PIPE_SHADER_FRAGMENT, su, sampler);
|
||||
|
@@ -281,7 +281,7 @@ update_vertex_textures(struct st_context *st)
|
||||
|
||||
st->state.num_vertex_textures = su + 1;
|
||||
}
|
||||
pipe_sampler_view_reference(&st->state.sampler_vertex_views[su],
|
||||
pipe_sampler_view_reference(&st->state.vertex_sampler_views[su],
|
||||
sampler_view);
|
||||
}
|
||||
|
||||
@@ -291,7 +291,7 @@ update_vertex_textures(struct st_context *st)
|
||||
cso_set_sampler_views(st->cso_context,
|
||||
PIPE_SHADER_VERTEX,
|
||||
numUnits,
|
||||
st->state.sampler_vertex_views);
|
||||
st->state.vertex_sampler_views);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -302,10 +302,10 @@ update_fragment_textures(struct st_context *st)
|
||||
const struct gl_context *ctx = st->ctx;
|
||||
struct gl_fragment_program *fprog = ctx->FragmentProgram._Current;
|
||||
GLuint su;
|
||||
int old_max = st->state.num_textures;
|
||||
int old_max = st->state.num_fragment_textures;
|
||||
GLbitfield samplers_used = fprog->Base.SamplersUsed;
|
||||
|
||||
st->state.num_textures = 0;
|
||||
st->state.num_fragment_textures = 0;
|
||||
|
||||
/* loop over sampler units (aka tex image units) */
|
||||
for (su = 0; su < ctx->Const.MaxTextureImageUnits; su++, samplers_used >>= 1) {
|
||||
@@ -321,19 +321,20 @@ update_fragment_textures(struct st_context *st)
|
||||
if (retval == GL_FALSE)
|
||||
continue;
|
||||
|
||||
st->state.num_textures = su + 1;
|
||||
st->state.num_fragment_textures = su + 1;
|
||||
} else if (samplers_used == 0 && su >= old_max) {
|
||||
/* if we've reset all the old views and we have no more new ones */
|
||||
break;
|
||||
}
|
||||
|
||||
pipe_sampler_view_reference(&st->state.sampler_views[su], sampler_view);
|
||||
pipe_sampler_view_reference(&st->state.fragment_sampler_views[su],
|
||||
sampler_view);
|
||||
}
|
||||
|
||||
cso_set_sampler_views(st->cso_context,
|
||||
PIPE_SHADER_FRAGMENT,
|
||||
st->state.num_textures,
|
||||
st->state.sampler_views);
|
||||
st->state.num_fragment_textures,
|
||||
st->state.fragment_sampler_views);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -480,10 +480,10 @@ 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_samplers);
|
||||
uint num = MAX2(fpv->bitmap_sampler + 1, st->state.num_fragment_samplers);
|
||||
uint i;
|
||||
for (i = 0; i < st->state.num_samplers; i++) {
|
||||
samplers[i] = &st->state.samplers[i];
|
||||
for (i = 0; i < st->state.num_fragment_samplers; i++) {
|
||||
samplers[i] = &st->state.fragment_samplers[i];
|
||||
}
|
||||
samplers[fpv->bitmap_sampler] =
|
||||
&st->bitmap.samplers[sv->texture->target != PIPE_TEXTURE_RECT];
|
||||
@@ -494,8 +494,10 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
|
||||
/* user textures, plus the bitmap texture */
|
||||
{
|
||||
struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
|
||||
uint num = MAX2(fpv->bitmap_sampler + 1, st->state.num_textures);
|
||||
memcpy(sampler_views, st->state.sampler_views, sizeof(sampler_views));
|
||||
uint num = MAX2(fpv->bitmap_sampler + 1,
|
||||
st->state.num_fragment_textures);
|
||||
memcpy(sampler_views, st->state.fragment_sampler_views,
|
||||
sizeof(sampler_views));
|
||||
sampler_views[fpv->bitmap_sampler] = sv;
|
||||
cso_set_sampler_views(cso, PIPE_SHADER_FRAGMENT, num, sampler_views);
|
||||
}
|
||||
|
@@ -248,8 +248,14 @@ 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.sampler_views); i++) {
|
||||
pipe_sampler_view_release(st->pipe, &st->state.sampler_views[i]);
|
||||
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]);
|
||||
}
|
||||
|
||||
if (st->default_texture) {
|
||||
|
@@ -98,23 +98,23 @@ 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 samplers[PIPE_MAX_SAMPLERS];
|
||||
struct pipe_sampler_state vertex_samplers[PIPE_MAX_VERTEX_SAMPLERS];
|
||||
struct pipe_sampler_state fragment_samplers[PIPE_MAX_SAMPLERS];
|
||||
struct pipe_sampler_state vertex_samplers[PIPE_MAX_VERTEX_SAMPLERS];
|
||||
struct pipe_clip_state clip;
|
||||
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_sampler_view *sampler_vertex_views[PIPE_MAX_VERTEX_SAMPLERS];
|
||||
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_samplers;
|
||||
GLuint num_fragment_samplers;
|
||||
GLuint num_vertex_samplers;
|
||||
GLuint num_textures;
|
||||
GLuint num_fragment_textures;
|
||||
GLuint num_vertex_textures;
|
||||
|
||||
GLuint poly_stipple[32]; /**< In OpenGL's bottom-to-top order */
|
||||
|
Reference in New Issue
Block a user