iris: NOS mechanics

This commit is contained in:
Kenneth Graunke
2018-07-16 16:21:22 -07:00
parent a6d480f892
commit d223b316ad
3 changed files with 32 additions and 0 deletions

View File

@@ -97,6 +97,22 @@ struct blorp_params;
#define IRIS_DIRTY_SO_DECL_LIST (1ull << 49) #define IRIS_DIRTY_SO_DECL_LIST (1ull << 49)
#define IRIS_DIRTY_STREAMOUT (1ull << 50) #define IRIS_DIRTY_STREAMOUT (1ull << 50)
/**
* Non-orthogonal state (NOS) dependency flags.
*
* Shader programs may depend on non-orthogonal state. These flags are
* used to indicate that a shader's key depends on the state provided by
* a certain Gallium CSO.
*/
enum iris_nos_dep {
IRIS_NOS_FRAMEBUFFER,
IRIS_NOS_DEPTH_STENCIL_ALPHA,
IRIS_NOS_RASTERIZER,
IRIS_NOS_BLEND,
IRIS_NOS_COUNT,
};
struct iris_depth_stencil_alpha_state; struct iris_depth_stencil_alpha_state;
enum iris_program_cache_id { enum iris_program_cache_id {
@@ -264,6 +280,7 @@ struct iris_context {
struct { struct {
uint64_t dirty; uint64_t dirty;
uint64_t dirty_for_nos[IRIS_NOS_COUNT];
unsigned num_viewports; unsigned num_viewports;
unsigned sample_mask; unsigned sample_mask;
struct iris_blend_state *cso_blend; struct iris_blend_state *cso_blend;

View File

@@ -42,6 +42,9 @@ get_new_program_id(struct iris_screen *screen)
struct iris_uncompiled_shader { struct iris_uncompiled_shader {
struct pipe_shader_state base; struct pipe_shader_state base;
unsigned program_id; unsigned program_id;
/** Bitfield of (1 << IRIS_NOS_*) flags. */
unsigned nos;
}; };
// XXX: need unify_interfaces() at link time... // XXX: need unify_interfaces() at link time...
@@ -91,6 +94,13 @@ bind_state(struct iris_context *ice,
ice->shaders.uncompiled[stage] = ish; ice->shaders.uncompiled[stage] = ish;
ice->state.dirty |= dirty_bit; ice->state.dirty |= dirty_bit;
for (int i = 0; i < IRIS_NOS_COUNT; i++) {
if (ish->nos & (1 << i))
ice->state.dirty_for_nos[i] |= dirty_bit;
else
ice->state.dirty_for_nos[i] &= ~dirty_bit;
}
} }
static void static void

View File

@@ -532,6 +532,7 @@ iris_bind_blend_state(struct pipe_context *ctx, void *state)
ice->state.cso_blend = state; ice->state.cso_blend = state;
ice->state.dirty |= IRIS_DIRTY_PS_BLEND; ice->state.dirty |= IRIS_DIRTY_PS_BLEND;
ice->state.dirty |= IRIS_DIRTY_BLEND_STATE; ice->state.dirty |= IRIS_DIRTY_BLEND_STATE;
ice->state.dirty |= ice->state.dirty_for_nos[IRIS_NOS_BLEND];
} }
struct iris_depth_stencil_alpha_state { struct iris_depth_stencil_alpha_state {
@@ -603,6 +604,7 @@ iris_bind_zsa_state(struct pipe_context *ctx, void *state)
ice->state.cso_zsa = new_cso; ice->state.cso_zsa = new_cso;
ice->state.dirty |= IRIS_DIRTY_CC_VIEWPORT; ice->state.dirty |= IRIS_DIRTY_CC_VIEWPORT;
ice->state.dirty |= IRIS_DIRTY_WM_DEPTH_STENCIL; ice->state.dirty |= IRIS_DIRTY_WM_DEPTH_STENCIL;
ice->state.dirty |= ice->state.dirty_for_nos[IRIS_NOS_DEPTH_STENCIL_ALPHA];
} }
struct iris_rasterizer_state { struct iris_rasterizer_state {
@@ -784,6 +786,7 @@ iris_bind_rasterizer_state(struct pipe_context *ctx, void *state)
ice->state.cso_rast = new_cso; ice->state.cso_rast = new_cso;
ice->state.dirty |= IRIS_DIRTY_RASTER; ice->state.dirty |= IRIS_DIRTY_RASTER;
ice->state.dirty |= IRIS_DIRTY_CLIP; ice->state.dirty |= IRIS_DIRTY_CLIP;
ice->state.dirty |= ice->state.dirty_for_nos[IRIS_NOS_RASTERIZER];
} }
static uint32_t static uint32_t
@@ -1410,6 +1413,8 @@ iris_set_framebuffer_state(struct pipe_context *ctx,
/* Render target change */ /* Render target change */
ice->state.dirty |= IRIS_DIRTY_BINDINGS_FS; ice->state.dirty |= IRIS_DIRTY_BINDINGS_FS;
ice->state.dirty |= ice->state.dirty_for_nos[IRIS_NOS_FRAMEBUFFER];
} }
static void static void