summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2010-06-08 15:34:37 -0700
committerKenneth Graunke <[email protected]>2010-06-09 11:14:58 -0700
commitc34a624c9f50edc73d8ac65e7fd1e50c30d5929e (patch)
tree864a58f81fbbb86580d85cf5fd59edd65c6a11b6
parent538da120920d4fce107da26bf94d30d063183deb (diff)
texture_builtins.py: Fixes for Array variants.
The array layer is now included as part of the texture coordinate.
-rwxr-xr-xbuiltins/tools/texture_builtins.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/builtins/tools/texture_builtins.py b/builtins/tools/texture_builtins.py
index 404d7e8d415..d4648a2aee0 100755
--- a/builtins/tools/texture_builtins.py
+++ b/builtins/tools/texture_builtins.py
@@ -13,20 +13,24 @@ def vec_type(g, size):
return g + "vec" + str(size)
# Get the base dimension - i.e. sampler3D gives 3
+# Array samplers also get +1 here since the layer is really an extra coordinate
def get_coord_dim(sampler_type):
if sampler_type[0].isdigit():
- return int(sampler_type[0])
+ coord_dim = int(sampler_type[0])
elif sampler_type.startswith("Cube"):
- return 3
- assert False ("coord_dim: invalid sampler_type: " + sampler_type)
+ coord_dim = 3
+ else:
+ assert False ("coord_dim: invalid sampler_type: " + sampler_type)
+
+ if sampler_type.find("Array") != -1:
+ coord_dim += 1
+ return coord_dim
# Get the number of extra vector components (i.e. shadow comparitor)
def get_extra_dim(sampler_type, use_proj, unused_fields):
extra_dim = unused_fields
if sampler_type.find("Shadow") != -1:
extra_dim += 1
- if sampler_type.find("Array") != -1:
- extra_dim += 1
if use_proj:
extra_dim += 1
return extra_dim