util_blitter_save_sample_mask(v3d->blitter, v3d->sample_mask);
util_blitter_save_framebuffer(v3d->blitter, &v3d->framebuffer);
util_blitter_save_fragment_sampler_states(v3d->blitter,
- v3d->fragtex.num_samplers,
- (void **)v3d->fragtex.samplers);
+ v3d->tex[PIPE_SHADER_FRAGMENT].num_samplers,
+ (void **)v3d->tex[PIPE_SHADER_FRAGMENT].samplers);
util_blitter_save_fragment_sampler_views(v3d->blitter,
- v3d->fragtex.num_textures, v3d->fragtex.textures);
+ v3d->tex[PIPE_SHADER_FRAGMENT].num_textures,
+ v3d->tex[PIPE_SHADER_FRAGMENT].textures);
util_blitter_save_so_targets(v3d->blitter, v3d->streamout.num_targets,
v3d->streamout.targets);
}
struct v3d_rasterizer_state *rasterizer;
struct v3d_depth_stencil_alpha_state *zsa;
- struct v3d_texture_stateobj verttex, fragtex;
-
struct v3d_program_stateobj prog;
struct v3d_vertex_stateobj *vtx;
struct pipe_clip_state clip;
struct pipe_viewport_state viewport;
struct v3d_constbuf_stateobj constbuf[PIPE_SHADER_TYPES];
+ struct v3d_texture_stateobj tex[PIPE_SHADER_TYPES];
struct v3d_vertexbuf_stateobj vertexbuf;
struct v3d_streamout_stateobj streamout;
struct v3d_bo *current_oq;
void v3d_set_shader_uniform_dirty_flags(struct v3d_compiled_shader *shader);
struct v3d_cl_reloc v3d_write_uniforms(struct v3d_context *v3d,
struct v3d_compiled_shader *shader,
- struct v3d_constbuf_stateobj *cb,
- struct v3d_texture_stateobj *texstate);
+ enum pipe_shader_type stage);
void v3d_flush(struct pipe_context *pctx);
void v3d_job_init(struct v3d_context *v3d);
}
memset(key, 0, sizeof(*key));
- v3d_setup_shared_key(v3d, &key->base, &v3d->fragtex);
+ v3d_setup_shared_key(v3d, &key->base, &v3d->tex[PIPE_SHADER_FRAGMENT]);
key->base.shader_state = v3d->prog.bind_fs;
key->is_points = (prim_mode == PIPE_PRIM_POINTS);
key->is_lines = (prim_mode >= PIPE_PRIM_LINES &&
}
memset(key, 0, sizeof(*key));
- v3d_setup_shared_key(v3d, &key->base, &v3d->verttex);
+ v3d_setup_shared_key(v3d, &key->base, &v3d->tex[PIPE_SHADER_VERTEX]);
key->base.shader_state = v3d->prog.bind_vs;
key->num_fs_inputs = v3d->prog.fs->prog_data.fs->base.num_inputs;
STATIC_ASSERT(sizeof(key->fs_inputs) ==
struct v3d_cl_reloc
v3d_write_uniforms(struct v3d_context *v3d, struct v3d_compiled_shader *shader,
- struct v3d_constbuf_stateobj *cb,
- struct v3d_texture_stateobj *texstate)
+ enum pipe_shader_type stage)
{
+ struct v3d_constbuf_stateobj *cb = &v3d->constbuf[stage];
+ struct v3d_texture_stateobj *texstate = &v3d->tex[stage];
struct v3d_uniform_list *uinfo = &shader->prog_data.base->uniforms;
struct v3d_job *job = v3d->job;
const uint32_t *gallium_uniforms = cb->cb[0].user_buffer;
/* Upload the uniforms to the indirect CL first */
struct v3d_cl_reloc fs_uniforms =
v3d_write_uniforms(v3d, v3d->prog.fs,
- &v3d->constbuf[PIPE_SHADER_FRAGMENT],
- &v3d->fragtex);
+ PIPE_SHADER_FRAGMENT);
struct v3d_cl_reloc vs_uniforms =
v3d_write_uniforms(v3d, v3d->prog.vs,
- &v3d->constbuf[PIPE_SHADER_VERTEX],
- &v3d->verttex);
+ PIPE_SHADER_VERTEX);
struct v3d_cl_reloc cs_uniforms =
v3d_write_uniforms(v3d, v3d->prog.cs,
- &v3d->constbuf[PIPE_SHADER_VERTEX],
- &v3d->verttex);
+ PIPE_SHADER_VERTEX);
/* See GFXH-930 workaround below */
uint32_t num_elements_to_emit = MAX2(vtx->num_elements, 1);
/* Before setting up the draw, flush anything writing to the textures
* that we read from.
*/
- v3d_predraw_check_textures(pctx, &v3d->verttex);
- v3d_predraw_check_textures(pctx, &v3d->fragtex);
+ for (int s = 0; s < PIPE_SHADER_TYPES; s++)
+ v3d_predraw_check_textures(pctx, &v3d->tex[s]);
struct v3d_job *job = v3d_get_job_for_fbo(v3d);
* on the last submitted render, rather than tracking the last
* rendering to each texture's BO.
*/
- if (v3d->verttex.num_textures) {
+ if (v3d->tex[PIPE_SHADER_VERTEX].num_textures) {
perf_debug("Blocking binner on last render "
"due to vertex texturing.\n");
job->submit.in_sync_bcl = v3d->out_sync;
* the view, so we merge them together at draw time.
*/
if (v3d->dirty & VC5_DIRTY_FRAGTEX)
- emit_textures(v3d, &v3d->fragtex);
+ emit_textures(v3d, &v3d->tex[PIPE_SHADER_FRAGMENT]);
if (v3d->dirty & VC5_DIRTY_VERTTEX)
- emit_textures(v3d, &v3d->verttex);
+ emit_textures(v3d, &v3d->tex[PIPE_SHADER_VERTEX]);
#endif
if (v3d->dirty & VC5_DIRTY_FLAT_SHADE_FLAGS) {
v3d->dirty |= VC5_DIRTY_FRAMEBUFFER;
}
-static struct v3d_texture_stateobj *
-v3d_get_stage_tex(struct v3d_context *v3d, enum pipe_shader_type shader)
-{
- switch (shader) {
- case PIPE_SHADER_FRAGMENT:
- v3d->dirty |= VC5_DIRTY_FRAGTEX;
- return &v3d->fragtex;
- break;
- case PIPE_SHADER_VERTEX:
- v3d->dirty |= VC5_DIRTY_VERTTEX;
- return &v3d->verttex;
- break;
- default:
- fprintf(stderr, "Unknown shader target %d\n", shader);
- abort();
- }
-}
-
static uint32_t translate_wrap(uint32_t pipe_wrap, bool using_nearest)
{
switch (pipe_wrap) {
unsigned nr, void **hwcso)
{
struct v3d_context *v3d = v3d_context(pctx);
- struct v3d_texture_stateobj *stage_tex = v3d_get_stage_tex(v3d, shader);
+ struct v3d_texture_stateobj *stage_tex = &v3d->tex[shader];
assert(start == 0);
unsigned i;
struct pipe_sampler_view **views)
{
struct v3d_context *v3d = v3d_context(pctx);
- struct v3d_texture_stateobj *stage_tex = v3d_get_stage_tex(v3d, shader);
+ struct v3d_texture_stateobj *stage_tex = &v3d->tex[shader];
unsigned i;
unsigned new_nr = 0;