diff options
author | Kenneth Graunke <[email protected]> | 2016-05-26 20:21:58 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2016-06-15 12:47:37 -0700 |
commit | 2b867264d2cce59bd65bd3599ff0e3c5439bc9d4 (patch) | |
tree | 5547dade3548cd8da3e7a550786a39fac0c3af3c /src/compiler | |
parent | 1bc194cd64085d07f1aae319cb6fb3c99d69aaeb (diff) |
glsl: Optionally lower TCS gl_PatchVerticesIn to a uniform.
i965 has no special hardware for this, so the best way to implement
this is to pass it in via a uniform.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Alejandro PiƱeiro <[email protected]>
Cc: [email protected]
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/glsl/builtin_variables.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/compiler/glsl/builtin_variables.cpp b/src/compiler/glsl/builtin_variables.cpp index e5e73802126..e1a95e3bf8c 100644 --- a/src/compiler/glsl/builtin_variables.cpp +++ b/src/compiler/glsl/builtin_variables.cpp @@ -37,6 +37,11 @@ static const struct gl_builtin_uniform_element gl_NumSamples_elements[] = { {NULL, {STATE_NUM_SAMPLES, 0, 0}, SWIZZLE_XXXX} }; +/* only for TCS */ +static const struct gl_builtin_uniform_element gl_PatchVerticesIn_elements[] = { + {NULL, {STATE_INTERNAL, STATE_TCS_PATCH_VERTICES_IN}, SWIZZLE_XXXX} +}; + static const struct gl_builtin_uniform_element gl_DepthRange_elements[] = { {"near", {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_XXXX}, {"far", {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_YYYY}, @@ -234,6 +239,7 @@ static const struct gl_builtin_uniform_element gl_NormalMatrix_elements[] = { #define STATEVAR(name) {#name, name ## _elements, ARRAY_SIZE(name ## _elements)} static const struct gl_builtin_uniform_desc _mesa_builtin_uniform_desc[] = { + STATEVAR(gl_PatchVerticesIn), STATEVAR(gl_NumSamples), STATEVAR(gl_DepthRange), STATEVAR(gl_ClipPlane), @@ -1029,9 +1035,14 @@ void builtin_variable_generator::generate_tcs_special_vars() { add_system_value(SYSTEM_VALUE_PRIMITIVE_ID, int_t, "gl_PrimitiveID"); - add_system_value(SYSTEM_VALUE_VERTICES_IN, int_t, "gl_PatchVerticesIn"); add_system_value(SYSTEM_VALUE_INVOCATION_ID, int_t, "gl_InvocationID"); + if (state->ctx->Const.LowerTCSPatchVerticesIn) { + add_uniform(int_t, "gl_PatchVerticesIn"); + } else { + add_system_value(SYSTEM_VALUE_VERTICES_IN, int_t, "gl_PatchVerticesIn"); + } + add_output(VARYING_SLOT_TESS_LEVEL_OUTER, array(float_t, 4), "gl_TessLevelOuter")->data.patch = 1; add_output(VARYING_SLOT_TESS_LEVEL_INNER, array(float_t, 2), |