aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/lower_packed_varyings.cpp
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-05-08 00:18:25 +0200
committermarha <marha@users.sourceforge.net>2014-05-08 00:18:25 +0200
commit683155917770af9e63a938bc450df25d1904d567 (patch)
tree5eb9d2d0bba27ed4e8afe58c195d1918282c343b /mesalib/src/glsl/lower_packed_varyings.cpp
parentea0cd87ecbe9fc3c5503ccad7f87a895a458d6d4 (diff)
downloadvcxsrv-683155917770af9e63a938bc450df25d1904d567.tar.gz
vcxsrv-683155917770af9e63a938bc450df25d1904d567.tar.bz2
vcxsrv-683155917770af9e63a938bc450df25d1904d567.zip
xserver xcb-proto mesa pixman xkeyboard-config git update 7 May 2014
xserver commit a5b9757142a2ab471ca26651dce9cc5f5e351f3d libxcb commit d978a4f69b30b630f28d07f1003cf290284d24d8 libxcb/xcb-proto commit 389889e2f95af19e7fc7ac89e7faeb2f28652415 xkeyboard-config commit 3e54f31b1f118f00c240f59d72d7ddb685c6db79 libX11 commit 8be4610939b833587954957f5963eb4191b43d19 libXdmcp commit 089081dca4ba3598c6f9bf401c029378943b5854 libXext commit 11aad96bd689d54156064d2e81213dc827a689d1 libfontenc commit 0037a42107b952c9d903719615747e760e4e7247 libXinerama commit edd95182b26eb5d576d4878c559e0f17dddaa909 libXau commit 1e4635be11154dd8262f37b379511bd627defa2a xkbcomp commit d4e02a09258063c6d024c3ccd42d6b22212e6e18 pixman commit 91f32ce961bc85f98b3372b95681ad8918d24b18 xextproto commit 66afec3f49e8eb0d4c2e9af7088fc3116d4bafd7 randrproto commit a4a6694c059d74247c16527eef4a0ec9f56bbef6 glproto commit f84853d97d5749308992412a215fa518b6536eb3 mkfontscale commit 399db42a151687f1181ae23d28a76d31125a2853 xwininfo commit ba0d1b0da21d2dbdd81098ed5778f3792b472e13 libXft commit 4acfdaf95adb0a05c2a25550bdde036c865902f4 libXmu commit 22d9c590901e121936f50dee97dc60c4f7defb63 libxtrans commit a57a7f62242e1ea972b81414741729bf3dbae0a4 fontconfig commit 81664fe54f117e4781fda5a30429b51858302e91 mesa commit 9ced3fc649ec04710a5f5c855bfb582b898cff83
Diffstat (limited to 'mesalib/src/glsl/lower_packed_varyings.cpp')
-rw-r--r--mesalib/src/glsl/lower_packed_varyings.cpp39
1 files changed, 16 insertions, 23 deletions
diff --git a/mesalib/src/glsl/lower_packed_varyings.cpp b/mesalib/src/glsl/lower_packed_varyings.cpp
index 8c1b8850b..e8654748f 100644
--- a/mesalib/src/glsl/lower_packed_varyings.cpp
+++ b/mesalib/src/glsl/lower_packed_varyings.cpp
@@ -160,8 +160,7 @@ namespace {
class lower_packed_varyings_visitor
{
public:
- lower_packed_varyings_visitor(void *mem_ctx, unsigned location_base,
- unsigned locations_used,
+ lower_packed_varyings_visitor(void *mem_ctx, unsigned locations_used,
ir_variable_mode mode,
unsigned gs_input_vertices,
exec_list *out_instructions);
@@ -190,18 +189,10 @@ private:
void * const mem_ctx;
/**
- * Location representing the first generic varying slot for this shader
- * stage (e.g. VARYING_SLOT_VAR0 if we are packing vertex shader outputs).
- * Varyings whose location is less than this value are assumed to
- * correspond to special fixed function hardware, so they are not lowered.
- */
- const unsigned location_base;
-
- /**
* Number of generic varying slots which are used by this shader. This is
* used to allocate temporary intermediate data structures. If any varying
* used by this shader has a location greater than or equal to
- * location_base + locations_used, an assertion will fire.
+ * VARYING_SLOT_VAR0 + locations_used, an assertion will fire.
*/
const unsigned locations_used;
@@ -235,11 +226,9 @@ private:
} /* anonymous namespace */
lower_packed_varyings_visitor::lower_packed_varyings_visitor(
- void *mem_ctx, unsigned location_base, unsigned locations_used,
- ir_variable_mode mode, unsigned gs_input_vertices,
- exec_list *out_instructions)
+ void *mem_ctx, unsigned locations_used, ir_variable_mode mode,
+ unsigned gs_input_vertices, exec_list *out_instructions)
: mem_ctx(mem_ctx),
- location_base(location_base),
locations_used(locations_used),
packed_varyings((ir_variable **)
rzalloc_array_size(mem_ctx, sizeof(*packed_varyings),
@@ -259,7 +248,7 @@ lower_packed_varyings_visitor::run(exec_list *instructions)
continue;
if (var->data.mode != this->mode ||
- var->data.location < (int) this->location_base ||
+ var->data.location < VARYING_SLOT_VAR0 ||
!this->needs_lowering(var))
continue;
@@ -542,7 +531,7 @@ lower_packed_varyings_visitor::get_packed_varying_deref(
unsigned location, ir_variable *unpacked_var, const char *name,
unsigned vertex_index)
{
- unsigned slot = location - this->location_base;
+ unsigned slot = location - VARYING_SLOT_VAR0;
assert(slot < locations_used);
if (this->packed_varyings[slot] == NULL) {
char *packed_name = ralloc_asprintf(this->mem_ctx, "packed:%s", name);
@@ -595,7 +584,12 @@ lower_packed_varyings_visitor::get_packed_varying_deref(
bool
lower_packed_varyings_visitor::needs_lowering(ir_variable *var)
{
- /* Things composed of vec4's don't need lowering. Everything else does. */
+ /* Things composed of vec4's and varyings with explicitly assigned
+ * locations don't need lowering. Everything else does.
+ */
+ if (var->data.explicit_location)
+ return false;
+
const glsl_type *type = var->type;
if (this->gs_input_vertices != 0) {
assert(type->is_array());
@@ -654,9 +648,9 @@ lower_packed_varyings_gs_splicer::visit(ir_emit_vertex *ev)
void
-lower_packed_varyings(void *mem_ctx, unsigned location_base,
- unsigned locations_used, ir_variable_mode mode,
- unsigned gs_input_vertices, gl_shader *shader)
+lower_packed_varyings(void *mem_ctx, unsigned locations_used,
+ ir_variable_mode mode, unsigned gs_input_vertices,
+ gl_shader *shader)
{
exec_list *instructions = shader->ir;
ir_function *main_func = shader->symbols->get_function("main");
@@ -664,8 +658,7 @@ lower_packed_varyings(void *mem_ctx, unsigned location_base,
ir_function_signature *main_func_sig
= main_func->matching_signature(NULL, &void_parameters);
exec_list new_instructions;
- lower_packed_varyings_visitor visitor(mem_ctx, location_base,
- locations_used, mode,
+ lower_packed_varyings_visitor visitor(mem_ctx, locations_used, mode,
gs_input_vertices, &new_instructions);
visitor.run(instructions);
if (mode == ir_var_shader_out) {