diff options
author | Jose Maria Casanova Crespo <[email protected]> | 2019-07-19 16:45:58 +0200 |
---|---|---|
committer | Jose Maria Casanova Crespo <[email protected]> | 2019-09-12 12:20:17 +0100 |
commit | 068c8889dd96d17a3edcc44a565957bc859c5fac (patch) | |
tree | ad3c7a575fecb4cb6f88c7557b14251103bae1d5 /src | |
parent | 175c32e9bdc8b7b9c43f605cb59cd82415075f67 (diff) |
v3d: flag dirty state when binding compute states
As introduced in "v3d: flag dirty state when binding new sampler states"
we need to add support for compute states. New flag VC5_DIRTY_COMPTEX and
VC5_DIRTY_UNCOMPILED_CS are introduced.
Reaching 33 flags at the dirty field forces us to change the type to
uint_64. Flags are reordered and empty continuous bits are available
for future pipeline stages.
v2: Update flag conditions to compile cs shader. (Eric Antholt)
Now dirty flags use uint_64t and flags are reordered.
Added VC5_DIRTY_UNCOMPILED_CS flag.
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/v3d/v3d_context.h | 70 | ||||
-rw-r--r-- | src/gallium/drivers/v3d/v3d_program.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/v3d/v3d_uniforms.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/v3d/v3dx_state.c | 3 |
4 files changed, 47 insertions, 38 deletions
diff --git a/src/gallium/drivers/v3d/v3d_context.h b/src/gallium/drivers/v3d/v3d_context.h index 133a3fcf095..4ff17da66cb 100644 --- a/src/gallium/drivers/v3d/v3d_context.h +++ b/src/gallium/drivers/v3d/v3d_context.h @@ -54,37 +54,41 @@ void v3d_job_add_bo(struct v3d_job *job, struct v3d_bo *bo); #define using_v3d_simulator false #endif -#define VC5_DIRTY_BLEND (1 << 0) -#define VC5_DIRTY_RASTERIZER (1 << 1) -#define VC5_DIRTY_ZSA (1 << 2) -#define VC5_DIRTY_FRAGTEX (1 << 3) -#define VC5_DIRTY_VERTTEX (1 << 4) -#define VC5_DIRTY_SHADER_IMAGE (1 << 5) - -#define VC5_DIRTY_BLEND_COLOR (1 << 7) -#define VC5_DIRTY_STENCIL_REF (1 << 8) -#define VC5_DIRTY_SAMPLE_STATE (1 << 9) -#define VC5_DIRTY_FRAMEBUFFER (1 << 10) -#define VC5_DIRTY_STIPPLE (1 << 11) -#define VC5_DIRTY_VIEWPORT (1 << 12) -#define VC5_DIRTY_CONSTBUF (1 << 13) -#define VC5_DIRTY_VTXSTATE (1 << 14) -#define VC5_DIRTY_VTXBUF (1 << 15) -#define VC5_DIRTY_SCISSOR (1 << 17) -#define VC5_DIRTY_FLAT_SHADE_FLAGS (1 << 18) -#define VC5_DIRTY_PRIM_MODE (1 << 19) -#define VC5_DIRTY_CLIP (1 << 20) -#define VC5_DIRTY_UNCOMPILED_VS (1 << 21) -#define VC5_DIRTY_UNCOMPILED_FS (1 << 22) -#define VC5_DIRTY_COMPILED_CS (1 << 23) -#define VC5_DIRTY_COMPILED_VS (1 << 24) -#define VC5_DIRTY_COMPILED_FS (1 << 25) -#define VC5_DIRTY_FS_INPUTS (1 << 26) -#define VC5_DIRTY_STREAMOUT (1 << 27) -#define VC5_DIRTY_OQ (1 << 28) -#define VC5_DIRTY_CENTROID_FLAGS (1 << 29) -#define VC5_DIRTY_NOPERSPECTIVE_FLAGS (1 << 30) -#define VC5_DIRTY_SSBO (1 << 31) +#define VC5_DIRTY_BLEND (1ull << 0) +#define VC5_DIRTY_RASTERIZER (1ull << 1) +#define VC5_DIRTY_ZSA (1ull << 2) +#define VC5_DIRTY_COMPTEX (1ull << 3) +#define VC5_DIRTY_VERTTEX (1ull << 4) +#define VC5_DIRTY_FRAGTEX (1ull << 5) + +#define VC5_DIRTY_SHADER_IMAGE (1ull << 9) +#define VC5_DIRTY_BLEND_COLOR (1ull << 10) +#define VC5_DIRTY_STENCIL_REF (1ull << 11) +#define VC5_DIRTY_SAMPLE_STATE (1ull << 12) +#define VC5_DIRTY_FRAMEBUFFER (1ull << 13) +#define VC5_DIRTY_STIPPLE (1ull << 14) +#define VC5_DIRTY_VIEWPORT (1ull << 15) +#define VC5_DIRTY_CONSTBUF (1ull << 16) +#define VC5_DIRTY_VTXSTATE (1ull << 17) +#define VC5_DIRTY_VTXBUF (1ull << 18) +#define VC5_DIRTY_SCISSOR (1ull << 19) +#define VC5_DIRTY_FLAT_SHADE_FLAGS (1ull << 20) +#define VC5_DIRTY_PRIM_MODE (1ull << 21) +#define VC5_DIRTY_CLIP (1ull << 22) +#define VC5_DIRTY_UNCOMPILED_CS (1ull << 23) +#define VC5_DIRTY_UNCOMPILED_VS (1ull << 24) +#define VC5_DIRTY_UNCOMPILED_FS (1ull << 25) + +#define VC5_DIRTY_COMPILED_CS (1ull << 29) +#define VC5_DIRTY_COMPILED_VS (1ull << 30) +#define VC5_DIRTY_COMPILED_FS (1ull << 31) + +#define VC5_DIRTY_FS_INPUTS (1ull << 35) +#define VC5_DIRTY_STREAMOUT (1ull << 36) +#define VC5_DIRTY_OQ (1ull << 37) +#define VC5_DIRTY_CENTROID_FLAGS (1ull << 38) +#define VC5_DIRTY_NOPERSPECTIVE_FLAGS (1ull << 39) +#define VC5_DIRTY_SSBO (1ull << 40) #define VC5_MAX_FS_INPUTS 64 @@ -211,7 +215,7 @@ struct v3d_compiled_shader { * uniforms have to be rewritten (and therefore the shader state * reemitted). */ - uint32_t uniform_dirty_bits; + uint64_t uniform_dirty_bits; }; struct v3d_program_stateobj { @@ -437,7 +441,7 @@ struct v3d_context { struct blitter_context *blitter; /** bitfield of VC5_DIRTY_* */ - uint32_t dirty; + uint64_t dirty; struct primconvert_context *primconvert; diff --git a/src/gallium/drivers/v3d/v3d_program.c b/src/gallium/drivers/v3d/v3d_program.c index bfd1ebdf7de..ff91b332cd2 100644 --- a/src/gallium/drivers/v3d/v3d_program.c +++ b/src/gallium/drivers/v3d/v3d_program.c @@ -679,9 +679,8 @@ v3d_update_compiled_cs(struct v3d_context *v3d) struct v3d_key local_key; struct v3d_key *key = &local_key; - if (!(v3d->dirty & (~0 | /* XXX */ - VC5_DIRTY_VERTTEX | - VC5_DIRTY_UNCOMPILED_FS))) { + if (!(v3d->dirty & (VC5_DIRTY_UNCOMPILED_CS | + VC5_DIRTY_COMPTEX))) { return; } @@ -786,6 +785,7 @@ v3d_compute_state_bind(struct pipe_context *pctx, void *state) struct v3d_context *v3d = v3d_context(pctx); v3d->prog.bind_compute = state; + v3d->dirty |= VC5_DIRTY_UNCOMPILED_CS; } static void * diff --git a/src/gallium/drivers/v3d/v3d_uniforms.c b/src/gallium/drivers/v3d/v3d_uniforms.c index 77101947e2b..436a40908b5 100644 --- a/src/gallium/drivers/v3d/v3d_uniforms.c +++ b/src/gallium/drivers/v3d/v3d_uniforms.c @@ -434,7 +434,8 @@ v3d_set_shader_uniform_dirty_flags(struct v3d_compiled_shader *shader) /* We could flag this on just the stage we're * compiling for, but it's not passed in. */ - dirty |= VC5_DIRTY_FRAGTEX | VC5_DIRTY_VERTTEX; + dirty |= VC5_DIRTY_FRAGTEX | VC5_DIRTY_VERTTEX | + VC5_DIRTY_COMPTEX; break; case QUNIFORM_SSBO_OFFSET: @@ -461,7 +462,8 @@ v3d_set_shader_uniform_dirty_flags(struct v3d_compiled_shader *shader) default: assert(quniform_contents_is_texture_p0(shader->prog_data.base->uniforms.contents[i])); - dirty |= VC5_DIRTY_FRAGTEX | VC5_DIRTY_VERTTEX; + dirty |= VC5_DIRTY_FRAGTEX | VC5_DIRTY_VERTTEX | + VC5_DIRTY_COMPTEX; break; } } diff --git a/src/gallium/drivers/v3d/v3dx_state.c b/src/gallium/drivers/v3d/v3dx_state.c index c709b476f99..95b28048dd2 100644 --- a/src/gallium/drivers/v3d/v3dx_state.c +++ b/src/gallium/drivers/v3d/v3dx_state.c @@ -781,6 +781,9 @@ v3d_flag_dirty_sampler_state(struct v3d_context *v3d, case PIPE_SHADER_FRAGMENT: v3d->dirty |= VC5_DIRTY_FRAGTEX; break; + case PIPE_SHADER_COMPUTE: + v3d->dirty |= VC5_DIRTY_COMPTEX; + break; default: unreachable("Unsupported shader stage"); } |