diff options
author | Eric Anholt <[email protected]> | 2016-05-17 12:57:44 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2016-05-17 18:09:58 -0700 |
commit | 18260d05820eca971873407e939007c12600660c (patch) | |
tree | 3e61d435ab6b06ff00743f10d5f89fb30e5cfee7 | |
parent | 474e2bbcc12b1f7d959c55a1d730ad54ecef98f4 (diff) |
vc4: Add support for vertex color clamping in the rasterizer.
This gets us precompile of vertex shaders at the state tracker level as
well.
-rw-r--r-- | src/gallium/drivers/vc4/vc4_program.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/vc4/vc4_qir.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/vc4/vc4_screen.c | 2 |
3 files changed, 6 insertions, 1 deletions
diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c index 90c4b2d9014..5d036eb2604 100644 --- a/src/gallium/drivers/vc4/vc4_program.c +++ b/src/gallium/drivers/vc4/vc4_program.c @@ -1840,6 +1840,9 @@ vc4_shader_ntq(struct vc4_context *vc4, enum qstage stage, if (c->fs_key && c->fs_key->light_twoside) NIR_PASS_V(c->s, nir_lower_two_sided_color); + if (c->vs_key && c->vs_key->clamp_color) + NIR_PASS_V(c->s, nir_lower_clamp_color_outputs); + if (stage == QSTAGE_FRAG) NIR_PASS_V(c->s, nir_lower_clip_fs, c->key->ucp_enables); else @@ -2214,6 +2217,7 @@ vc4_update_compiled_vs(struct vc4_context *vc4, uint8_t prim_mode) vc4_setup_shared_key(vc4, &key->base, &vc4->verttex); key->base.shader_state = vc4->prog.bind_vs; key->compiled_fs_id = vc4->prog.fs->program_id; + key->clamp_color = vc4->rasterizer->base.clamp_vertex_color; for (int i = 0; i < ARRAY_SIZE(key->attr_formats); i++) key->attr_formats[i] = vc4->vtx->pipe[i].src_format; diff --git a/src/gallium/drivers/vc4/vc4_qir.h b/src/gallium/drivers/vc4/vc4_qir.h index f541c754c88..4ed5f18da16 100644 --- a/src/gallium/drivers/vc4/vc4_qir.h +++ b/src/gallium/drivers/vc4/vc4_qir.h @@ -340,6 +340,7 @@ struct vc4_vs_key { enum pipe_format attr_formats[8]; bool is_coord; bool per_vertex_point_size; + bool clamp_color; }; struct vc4_compile { diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c index 809ba5410aa..1e311117ad3 100644 --- a/src/gallium/drivers/vc4/vc4_screen.c +++ b/src/gallium/drivers/vc4/vc4_screen.c @@ -91,6 +91,7 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) { switch (param) { /* Supported features (boolean caps). */ + case PIPE_CAP_VERTEX_COLOR_CLAMPED: case PIPE_CAP_VERTEX_COLOR_UNCLAMPED: case PIPE_CAP_FRAGMENT_COLOR_CLAMPED: case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT: @@ -157,7 +158,6 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT: case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER: case PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS: - case PIPE_CAP_VERTEX_COLOR_CLAMPED: case PIPE_CAP_USER_VERTEX_BUFFERS: case PIPE_CAP_QUERY_PIPELINE_STATISTICS: case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK: |