diff options
author | Ilia Mirkin <[email protected]> | 2016-05-30 11:50:07 -0400 |
---|---|---|
committer | Ilia Mirkin <[email protected]> | 2016-08-30 20:25:15 -0400 |
commit | 891d7e3c9eb71ba42a7aea20dc45bdb3d624fc82 (patch) | |
tree | 9dc459a006ffdbee45e8ad0bb761649d2e028c8e /src/compiler | |
parent | 10663c648e58762eb39c7670c9397b74521e8134 (diff) |
glsl: add gl_BoundingBox and associated varying slots
Signed-off-by: Ilia Mirkin <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/glsl/builtin_variables.cpp | 12 | ||||
-rw-r--r-- | src/compiler/glsl/ir_set_program_inouts.cpp | 4 | ||||
-rw-r--r-- | src/compiler/shader_enums.c | 2 | ||||
-rw-r--r-- | src/compiler/shader_enums.h | 4 |
4 files changed, 21 insertions, 1 deletions
diff --git a/src/compiler/glsl/builtin_variables.cpp b/src/compiler/glsl/builtin_variables.cpp index f4ddeb99cde..90278d635c6 100644 --- a/src/compiler/glsl/builtin_variables.cpp +++ b/src/compiler/glsl/builtin_variables.cpp @@ -1045,6 +1045,18 @@ builtin_variable_generator::generate_tcs_special_vars() "gl_TessLevelOuter")->data.patch = 1; add_output(VARYING_SLOT_TESS_LEVEL_INNER, array(float_t, 2), "gl_TessLevelInner")->data.patch = 1; + /* XXX What to do if multiple are flipped on? */ + int bbox_slot = state->ctx->Const.NoPrimitiveBoundingBoxOutput ? -1 : + VARYING_SLOT_BOUNDING_BOX0; + if (state->EXT_primitive_bounding_box_enable) + add_output(bbox_slot, array(vec4_t, 2), "gl_BoundingBoxEXT") + ->data.patch = 1; + if (state->OES_primitive_bounding_box_enable) + add_output(bbox_slot, array(vec4_t, 2), "gl_BoundingBoxOES") + ->data.patch = 1; + if (state->is_version(0, 320) || state->ARB_ES3_2_compatibility_enable) + add_output(bbox_slot, array(vec4_t, 2), "gl_BoundingBox") + ->data.patch = 1; } diff --git a/src/compiler/glsl/ir_set_program_inouts.cpp b/src/compiler/glsl/ir_set_program_inouts.cpp index 4f6c886b6b3..48ed3c5c9e2 100644 --- a/src/compiler/glsl/ir_set_program_inouts.cpp +++ b/src/compiler/glsl/ir_set_program_inouts.cpp @@ -99,7 +99,9 @@ mark(struct gl_program *prog, ir_variable *var, int offset, int len, int idx = var->data.location + offset + i; bool is_patch_generic = var->data.patch && idx != VARYING_SLOT_TESS_LEVEL_INNER && - idx != VARYING_SLOT_TESS_LEVEL_OUTER; + idx != VARYING_SLOT_TESS_LEVEL_OUTER && + idx != VARYING_SLOT_BOUNDING_BOX0 && + idx != VARYING_SLOT_BOUNDING_BOX1; GLbitfield64 bitfield; if (is_patch_generic) { diff --git a/src/compiler/shader_enums.c b/src/compiler/shader_enums.c index 00261d1988c..729a3583b1b 100644 --- a/src/compiler/shader_enums.c +++ b/src/compiler/shader_enums.c @@ -158,6 +158,8 @@ gl_varying_slot_name(gl_varying_slot slot) ENUM(VARYING_SLOT_PNTC), ENUM(VARYING_SLOT_TESS_LEVEL_OUTER), ENUM(VARYING_SLOT_TESS_LEVEL_INNER), + ENUM(VARYING_SLOT_BOUNDING_BOX0), + ENUM(VARYING_SLOT_BOUNDING_BOX1), ENUM(VARYING_SLOT_VAR0), ENUM(VARYING_SLOT_VAR1), ENUM(VARYING_SLOT_VAR2), diff --git a/src/compiler/shader_enums.h b/src/compiler/shader_enums.h index e128b172c20..c3a62e09dbe 100644 --- a/src/compiler/shader_enums.h +++ b/src/compiler/shader_enums.h @@ -214,6 +214,8 @@ typedef enum VARYING_SLOT_PNTC, /* FS only */ VARYING_SLOT_TESS_LEVEL_OUTER, /* Only appears as TCS output. */ VARYING_SLOT_TESS_LEVEL_INNER, /* Only appears as TCS output. */ + VARYING_SLOT_BOUNDING_BOX0, /* Only appears as TCS output. */ + VARYING_SLOT_BOUNDING_BOX1, /* Only appears as TCS output. */ VARYING_SLOT_VAR0, /* First generic varying slot */ /* the remaining are simply for the benefit of gl_varying_slot_name() * and not to be construed as an upper bound: @@ -294,6 +296,8 @@ const char *gl_varying_slot_name(gl_varying_slot slot); #define VARYING_BIT_PNTC BITFIELD64_BIT(VARYING_SLOT_PNTC) #define VARYING_BIT_TESS_LEVEL_OUTER BITFIELD64_BIT(VARYING_SLOT_TESS_LEVEL_OUTER) #define VARYING_BIT_TESS_LEVEL_INNER BITFIELD64_BIT(VARYING_SLOT_TESS_LEVEL_INNER) +#define VARYING_BIT_BOUNDING_BOX0 BITFIELD64_BIT(VARYING_SLOT_BOUNDING_BOX0) +#define VARYING_BIT_BOUNDING_BOX1 BITFIELD64_BIT(VARYING_SLOT_BOUNDING_BOX1) #define VARYING_BIT_VAR(V) BITFIELD64_BIT(VARYING_SLOT_VAR0 + (V)) /*@}*/ |