summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2016-09-24 17:59:55 -0700
committerKenneth Graunke <[email protected]>2017-01-07 22:22:28 -0800
commita4fd84ef5f247f50a3683ecdf7f9d801a6e3cf15 (patch)
treedcf2a26e9a8cde7d6bc77fee2aaf8b655fe11adc /src/mesa/state_tracker
parent9bb89175e6487186389b69e8ee0b587d38ed8015 (diff)
mesa: Introduce a compiler enum for tessellation spacing.
It feels weird using GL_* enums in a Vulkan driver. v2: Fix the TESS_SPACING -> PIPE_TESS_SPACING conversion. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_program.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 7d548d51c13..96c6bb3fcf8 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -1607,21 +1607,14 @@ st_translate_tesseval_program(struct st_context *st,
ureg_property(ureg, TGSI_PROPERTY_TES_PRIM_MODE,
sttep->Base.info.tes.primitive_mode);
- switch (sttep->Base.info.tes.spacing) {
- case GL_EQUAL:
- ureg_property(ureg, TGSI_PROPERTY_TES_SPACING, PIPE_TESS_SPACING_EQUAL);
- break;
- case GL_FRACTIONAL_EVEN:
- ureg_property(ureg, TGSI_PROPERTY_TES_SPACING,
- PIPE_TESS_SPACING_FRACTIONAL_EVEN);
- break;
- case GL_FRACTIONAL_ODD:
- ureg_property(ureg, TGSI_PROPERTY_TES_SPACING,
- PIPE_TESS_SPACING_FRACTIONAL_ODD);
- break;
- default:
- assert(0);
- }
+ STATIC_ASSERT((TESS_SPACING_EQUAL + 1) % 3 == PIPE_TESS_SPACING_EQUAL);
+ STATIC_ASSERT((TESS_SPACING_FRACTIONAL_ODD + 1) % 3 ==
+ PIPE_TESS_SPACING_FRACTIONAL_ODD);
+ STATIC_ASSERT((TESS_SPACING_FRACTIONAL_EVEN + 1) % 3 ==
+ PIPE_TESS_SPACING_FRACTIONAL_EVEN);
+
+ ureg_property(ureg, TGSI_PROPERTY_TES_SPACING,
+ (sttep->Base.info.tes.spacing + 1) % 3);
ureg_property(ureg, TGSI_PROPERTY_TES_VERTEX_ORDER_CW,
!sttep->Base.info.tes.ccw);