glsl: use an enum for AMD_conservative_depth layout qualifiers

The main idea behind this is to free some bits in the flags.q
struct because currently all 64-bits are used and we can't
add more layout qualifiers without reaching a static assert.

In order to do that (mainly for ARB_bindless_texture), use an
enumeration for the AMD_conservative_depth layout qualifiers
because it's forbidden to declare more than one depth qualifier
for gl_FragDepth.

Note that ast_type_qualifier::merge_qualifier() will prevent
using duplicate layout qualifiers by returning a compile-time
error.

No piglit regressions found (including compiler tests) with
RX480 on RadeonSI.

v2: use a switch case

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Andres Gomez <agomez@igalia.com> (v1)
This commit is contained in:
Samuel Pitoiset
2017-02-23 18:07:58 +01:00
parent de2727925a
commit 87ee1729d0
4 changed files with 40 additions and 35 deletions

View File

@@ -463,6 +463,14 @@ enum {
ast_precision_low
};
enum {
ast_depth_none = 0, /**< Absence of depth qualifier. */
ast_depth_any,
ast_depth_greater,
ast_depth_less,
ast_depth_unchanged
};
struct ast_type_qualifier {
DECLARE_RALLOC_CXX_OPERATORS(ast_type_qualifier);
@@ -528,10 +536,7 @@ struct ast_type_qualifier {
/** \name Layout qualifiers for GL_AMD_conservative_depth */
/** \{ */
unsigned depth_any:1;
unsigned depth_greater:1;
unsigned depth_less:1;
unsigned depth_unchanged:1;
unsigned depth_type:1;
/** \} */
/** \name Layout qualifiers for GL_ARB_uniform_buffer_object */
@@ -630,6 +635,9 @@ struct ast_type_qualifier {
/** Precision of the type (highp/medium/lowp). */
unsigned precision:2;
/** Type of layout qualifiers for GL_AMD_conservative_depth. */
unsigned depth_type:3;
/**
* Alignment specified via GL_ARB_enhanced_layouts "align" layout qualifier
*/