st/mesa: combine vertex/fragment sampler state in arrays
As with other recent changes, put the vertex and fragment sampler state into arrays indexed by the shader type. This will let us easily add support for other types of shaders in the future.
This commit is contained in:
parent
cab2fed135
commit
6c8a132158
|
@ -253,23 +253,23 @@ 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);
|
||||
st->state.samplers[PIPE_SHADER_VERTEX],
|
||||
&st->state.num_samplers[PIPE_SHADER_VERTEX]);
|
||||
|
||||
/*
|
||||
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_GEOMETRY],
|
||||
&st->state.num_samplers[PIPE_SHADER_GEOMETRY]);
|
||||
*/
|
||||
}
|
||||
|
||||
|
|
|
@ -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,8 +327,8 @@ 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]);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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_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_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;
|
||||
|
|
Loading…
Reference in New Issue