util_blitter_save_vertex_buffer_slot(blitter, ctx->vertex_buffers);
util_blitter_save_vertex_elements(blitter, ctx->vertex);
- util_blitter_save_vertex_shader(blitter, ctx->vs);
+ util_blitter_save_vertex_shader(blitter, ctx->shader[PIPE_SHADER_VERTEX]);
util_blitter_save_rasterizer(blitter, ctx->rasterizer);
util_blitter_save_viewport(blitter, &ctx->pipe_viewport);
util_blitter_save_scissor(blitter, &ctx->scissor);
- util_blitter_save_fragment_shader(blitter, ctx->fs);
+ util_blitter_save_fragment_shader(blitter, ctx->shader[PIPE_SHADER_FRAGMENT]);
util_blitter_save_blend(blitter, ctx->blend);
util_blitter_save_depth_stencil_alpha(blitter, ctx->depth_stencil);
util_blitter_save_stencil_ref(blitter, &ctx->stencil_ref);
{
/* Load the shaders */
- struct panfrost_shader_state *vs = &ctx->vs->variants[ctx->vs->active_variant];
- struct panfrost_shader_state *fs = &ctx->fs->variants[ctx->fs->active_variant];
+ struct panfrost_shader_state *vs = &ctx->shader[PIPE_SHADER_VERTEX]->variants[ctx->shader[PIPE_SHADER_VERTEX]->active_variant];
+ struct panfrost_shader_state *fs = &ctx->shader[PIPE_SHADER_FRAGMENT]->variants[ctx->shader[PIPE_SHADER_FRAGMENT]->active_variant];
unsigned int num_gen_varyings = 0;
/* Allocate the varying descriptor */
static bool
panfrost_writes_point_size(struct panfrost_context *ctx)
{
- assert(ctx->vs);
- struct panfrost_shader_state *vs = &ctx->vs->variants[ctx->vs->active_variant];
+ assert(ctx->shader[PIPE_SHADER_VERTEX]);
+ struct panfrost_shader_state *vs = &ctx->shader[PIPE_SHADER_VERTEX]->variants[ctx->shader[PIPE_SHADER_VERTEX]->active_variant];
return vs->writes_point_size && ctx->payloads[PIPE_SHADER_FRAGMENT].prefix.draw_mode == MALI_POINTS;
}
* uploads */
ctx->dirty |= PAN_DIRTY_VS;
if (ctx->dirty & PAN_DIRTY_VS) {
- assert(ctx->vs);
+ assert(ctx->shader[PIPE_SHADER_VERTEX]);
- struct panfrost_shader_state *vs = &ctx->vs->variants[ctx->vs->active_variant];
+ struct panfrost_shader_state *vs = &ctx->shader[PIPE_SHADER_VERTEX]->variants[ctx->shader[PIPE_SHADER_VERTEX]->active_variant];
ctx->payloads[PIPE_SHADER_VERTEX].postfix._shader_upper =
panfrost_patch_shader_state(ctx, vs, PIPE_SHADER_VERTEX, true) >> 4;
}
/* TODO: Maybe dirty track FS, maybe not. For now, it's transient. */
- if (ctx->fs)
+ if (ctx->shader[PIPE_SHADER_FRAGMENT])
ctx->dirty |= PAN_DIRTY_FS;
if (ctx->dirty & PAN_DIRTY_FS) {
- assert(ctx->fs);
- struct panfrost_shader_state *variant = &ctx->fs->variants[ctx->fs->active_variant];
+ assert(ctx->shader[PIPE_SHADER_FRAGMENT]);
+ struct panfrost_shader_state *variant = &ctx->shader[PIPE_SHADER_FRAGMENT]->variants[ctx->shader[PIPE_SHADER_FRAGMENT]->active_variant];
panfrost_patch_shader_state(ctx, variant, PIPE_SHADER_FRAGMENT, false);
for (int i = 0; i <= PIPE_SHADER_FRAGMENT; ++i) {
struct panfrost_constant_buffer *buf = &ctx->constant_buffer[i];
- struct panfrost_shader_state *vs = &ctx->vs->variants[ctx->vs->active_variant];
- struct panfrost_shader_state *fs = &ctx->fs->variants[ctx->fs->active_variant];
+ struct panfrost_shader_state *vs = &ctx->shader[PIPE_SHADER_VERTEX]->variants[ctx->shader[PIPE_SHADER_VERTEX]->active_variant];
+ struct panfrost_shader_state *fs = &ctx->shader[PIPE_SHADER_FRAGMENT]->variants[ctx->shader[PIPE_SHADER_FRAGMENT]->active_variant];
struct panfrost_shader_state *ss = (i == PIPE_SHADER_FRAGMENT) ? fs : vs;
/* Uniforms are implicitly UBO #0 */
switch (i) {
case PIPE_SHADER_VERTEX:
- uniform_count = ctx->vs->variants[ctx->vs->active_variant].uniform_count;
+ uniform_count = ctx->shader[PIPE_SHADER_VERTEX]->variants[ctx->shader[PIPE_SHADER_VERTEX]->active_variant].uniform_count;
break;
case PIPE_SHADER_FRAGMENT:
- uniform_count = ctx->fs->variants[ctx->fs->active_variant].uniform_count;
+ uniform_count = ctx->shader[PIPE_SHADER_FRAGMENT]->variants[ctx->shader[PIPE_SHADER_FRAGMENT]->active_variant].uniform_count;
break;
default:
/* Point sprites are emulated */
struct panfrost_shader_state *variant =
- ctx->fs ? &ctx->fs->variants[ctx->fs->active_variant] : NULL;
+ ctx->shader[PIPE_SHADER_FRAGMENT] ? &ctx->shader[PIPE_SHADER_FRAGMENT]->variants[ctx->shader[PIPE_SHADER_FRAGMENT]->active_variant] : NULL;
if (ctx->rasterizer->base.sprite_coord_enable || (variant && variant->point_sprite_mask))
- ctx->base.bind_fs_state(&ctx->base, ctx->fs);
+ ctx->base.bind_fs_state(&ctx->base, ctx->shader[PIPE_SHADER_FRAGMENT]);
}
static void *
struct panfrost_context *ctx = pan_context(pctx);
if (type == PIPE_SHADER_FRAGMENT) {
- ctx->fs = hwcso;
+ ctx->shader[PIPE_SHADER_FRAGMENT] = hwcso;
ctx->dirty |= PAN_DIRTY_FS;
} else {
assert(type == PIPE_SHADER_VERTEX);
- ctx->vs = hwcso;
+ ctx->shader[PIPE_SHADER_VERTEX] = hwcso;
ctx->dirty |= PAN_DIRTY_VS;
}
if (depth_stencil->alpha.enabled) {
/* We need to trigger a new shader (maybe) */
- ctx->base.bind_fs_state(&ctx->base, ctx->fs);
+ ctx->base.bind_fs_state(&ctx->base, ctx->shader[PIPE_SHADER_FRAGMENT]);
}
/* Stencil state */