diff options
-rw-r--r-- | src/gallium/drivers/etnaviv/etnaviv_clear_blit.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/etnaviv/etnaviv_context.h | 9 | ||||
-rw-r--r-- | src/gallium/drivers/etnaviv/etnaviv_emit.c | 16 | ||||
-rw-r--r-- | src/gallium/drivers/etnaviv/etnaviv_shader.c | 16 | ||||
-rw-r--r-- | src/gallium/drivers/etnaviv/etnaviv_uniforms.c | 2 |
5 files changed, 24 insertions, 23 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c index 6c61ad5fae2..35d635ff3dd 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c +++ b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c @@ -49,11 +49,11 @@ etna_blit_save_state(struct etna_context *ctx) { util_blitter_save_vertex_buffer_slot(ctx->blitter, ctx->vertex_buffer.vb); util_blitter_save_vertex_elements(ctx->blitter, ctx->vertex_elements); - util_blitter_save_vertex_shader(ctx->blitter, ctx->vs); + util_blitter_save_vertex_shader(ctx->blitter, ctx->shader.vs); util_blitter_save_rasterizer(ctx->blitter, ctx->rasterizer); util_blitter_save_viewport(ctx->blitter, &ctx->viewport_s); util_blitter_save_scissor(ctx->blitter, &ctx->scissor_s); - util_blitter_save_fragment_shader(ctx->blitter, ctx->fs); + util_blitter_save_fragment_shader(ctx->blitter, ctx->shader.fs); util_blitter_save_blend(ctx->blitter, ctx->blend); util_blitter_save_depth_stencil_alpha(ctx->blitter, ctx->zsa); util_blitter_save_stencil_ref(ctx->blitter, &ctx->stencil_ref_s); diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.h b/src/gallium/drivers/etnaviv/etnaviv_context.h index 81acc92eb01..b847b652d1d 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_context.h +++ b/src/gallium/drivers/etnaviv/etnaviv_context.h @@ -79,6 +79,10 @@ struct etna_vertexbuf_state { uint32_t enabled_mask; }; +struct etna_shader_state { + struct etna_shader_variant *vs, *fs; +}; + enum etna_immediate_contents { ETNA_IMMEDIATE_UNUSED = 0, ETNA_IMMEDIATE_CONSTANT, @@ -155,10 +159,7 @@ struct etna_context { struct pipe_constant_buffer constant_buffer[PIPE_SHADER_TYPES]; struct etna_vertexbuf_state vertex_buffer; struct etna_index_buffer index_buffer; - - /* pointers to the bound state. these are mainly kept around for the blitter */ - struct etna_shader_variant *vs; - struct etna_shader_variant *fs; + struct etna_shader_state shader; /* saved parameter-like state. these are mainly kept around for the blitter */ struct pipe_framebuffer_state framebuffer_s; diff --git a/src/gallium/drivers/etnaviv/etnaviv_emit.c b/src/gallium/drivers/etnaviv/etnaviv_emit.c index 8394474b4b5..af74cbb4c52 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_emit.c +++ b/src/gallium/drivers/etnaviv/etnaviv_emit.c @@ -253,8 +253,8 @@ required_stream_size(struct etna_context *ctx) size += ctx->vertex_elements->num_elements + 1; /* uniforms - worst case (2 words per uniform load) */ - size += ctx->vs->uniforms.const_count * 2; - size += ctx->fs->uniforms.const_count * 2; + size += ctx->shader.vs->uniforms.const_count * 2; + size += ctx->shader.fs->uniforms.const_count * 2; /* shader */ size += ctx->shader_state.vs_inst_mem_size + 1; @@ -722,14 +722,14 @@ etna_emit_state(struct etna_context *ctx) static const uint32_t uniform_dirty_bits = ETNA_DIRTY_SHADER | ETNA_DIRTY_CONSTBUF; - if (dirty & (uniform_dirty_bits | ctx->fs->uniforms_dirty_bits)) + if (dirty & (uniform_dirty_bits | ctx->shader.fs->uniforms_dirty_bits)) etna_uniforms_write( - ctx, ctx->vs, &ctx->constant_buffer[PIPE_SHADER_VERTEX], + ctx, ctx->shader.vs, &ctx->constant_buffer[PIPE_SHADER_VERTEX], ctx->shader_state.VS_UNIFORMS, &ctx->shader_state.vs_uniforms_size); - if (dirty & (uniform_dirty_bits | ctx->vs->uniforms_dirty_bits)) + if (dirty & (uniform_dirty_bits | ctx->shader.vs->uniforms_dirty_bits)) etna_uniforms_write( - ctx, ctx->fs, &ctx->constant_buffer[PIPE_SHADER_FRAGMENT], + ctx, ctx->shader.fs, &ctx->constant_buffer[PIPE_SHADER_FRAGMENT], ctx->shader_state.PS_UNIFORMS, &ctx->shader_state.ps_uniforms_size); /**** Large dynamically-sized state ****/ @@ -762,7 +762,7 @@ etna_emit_state(struct etna_context *ctx) ctx->shader_state.ps_uniforms_size * 4); } else { etna_coalesce_start(stream, &coalesce); - for (int x = 0; x < ctx->vs->uniforms.const_count; ++x) { + for (int x = 0; x < ctx->shader.vs->uniforms.const_count; ++x) { if (ctx->gpu3d.VS_UNIFORMS[x] != ctx->shader_state.VS_UNIFORMS[x]) { /*05000*/ EMIT_STATE(VS_UNIFORMS(x), ctx->shader_state.VS_UNIFORMS[x]); ctx->gpu3d.VS_UNIFORMS[x] = ctx->shader_state.VS_UNIFORMS[x]; @@ -771,7 +771,7 @@ etna_emit_state(struct etna_context *ctx) etna_coalesce_end(stream, &coalesce); etna_coalesce_start(stream, &coalesce); - for (int x = 0; x < ctx->fs->uniforms.const_count; ++x) { + for (int x = 0; x < ctx->shader.fs->uniforms.const_count; ++x) { if (ctx->gpu3d.PS_UNIFORMS[x] != ctx->shader_state.PS_UNIFORMS[x]) { /*07000*/ EMIT_STATE(PS_UNIFORMS(x), ctx->shader_state.PS_UNIFORMS[x]); ctx->gpu3d.PS_UNIFORMS[x] = ctx->shader_state.PS_UNIFORMS[x]; diff --git a/src/gallium/drivers/etnaviv/etnaviv_shader.c b/src/gallium/drivers/etnaviv/etnaviv_shader.c index 0ef611fdff9..6996187871f 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_shader.c +++ b/src/gallium/drivers/etnaviv/etnaviv_shader.c @@ -173,11 +173,11 @@ etna_link_shaders(struct etna_context *ctx, struct compiled_shader_state *cs, bool etna_shader_link(struct etna_context *ctx) { - if (!ctx->vs || !ctx->fs) + if (!ctx->shader.vs || !ctx->shader.fs) return false; /* re-link vs and fs if needed */ - return etna_link_shaders(ctx, &ctx->shader_state, ctx->vs, ctx->fs); + return etna_link_shaders(ctx, &ctx->shader_state, ctx->shader.vs, ctx->shader.fs); } static bool @@ -197,7 +197,7 @@ etna_shader_update_vs_inputs(struct etna_context *ctx, num_vs_inputs = MAX2(ves->num_elements, vs->infile.num_reg); if (num_vs_inputs != ves->num_elements) { BUG("Number of elements %u does not match the number of VS inputs %zu", - ctx->vertex_elements->num_elements, ctx->vs->infile.num_reg); + ctx->vertex_elements->num_elements, ctx->shader.vs->infile.num_reg); return false; } @@ -263,7 +263,7 @@ dump_shader_info(struct etna_shader_variant *shader, struct pipe_debug_callback bool etna_shader_update_vertex(struct etna_context *ctx) { - return etna_shader_update_vs_inputs(ctx, &ctx->shader_state, ctx->vs, + return etna_shader_update_vs_inputs(ctx, &ctx->shader_state, ctx->shader.vs, ctx->vertex_elements); } @@ -334,11 +334,11 @@ etna_bind_fs_state(struct pipe_context *pctx, void *fss_) struct etna_context *ctx = etna_context(pctx); struct etna_shader_variant *fss = fss_; - if (ctx->fs == fss) /* skip if already bound */ + if (ctx->shader.fs == fss) /* skip if already bound */ return; assert(fss == NULL || fss->processor == PIPE_SHADER_FRAGMENT); - ctx->fs = fss; + ctx->shader.fs = fss; ctx->dirty |= ETNA_DIRTY_SHADER; } @@ -348,11 +348,11 @@ etna_bind_vs_state(struct pipe_context *pctx, void *vss_) struct etna_context *ctx = etna_context(pctx); struct etna_shader_variant *vss = vss_; - if (ctx->vs == vss) /* skip if already bound */ + if (ctx->shader.vs == vss) /* skip if already bound */ return; assert(vss == NULL || vss->processor == PIPE_SHADER_VERTEX); - ctx->vs = vss; + ctx->shader.vs = vss; ctx->dirty |= ETNA_DIRTY_SHADER; } diff --git a/src/gallium/drivers/etnaviv/etnaviv_uniforms.c b/src/gallium/drivers/etnaviv/etnaviv_uniforms.c index 74874261b0e..a8d970d185a 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_uniforms.c +++ b/src/gallium/drivers/etnaviv/etnaviv_uniforms.c @@ -72,7 +72,7 @@ etna_uniforms_write(const struct etna_context *ctx, memcpy(uniforms, cb->user_buffer, size); } - if (sobj == ctx->fs) + if (sobj == ctx->shader.fs) frag = true; for (uint32_t i = 0; i < uinfo->imm_count; i++) { |