diff options
author | Kenneth Graunke <kenneth@whitecape.org> | 2013-09-11 11:14:14 -0700 |
---|---|---|
committer | Kenneth Graunke <kenneth@whitecape.org> | 2013-09-11 22:48:32 -0700 |
commit | 694be9115d43b93610f5386b36117ec9a31ed47c (patch) | |
tree | ba7158eb8db628768d8dc99a1fcf380501c141c2 /src/glsl/glsl_types.h | |
parent | 5eb7ff1175a644ffe3b0f1a75cb235400355f9fb (diff) | |
download | external_mesa3d-694be9115d43b93610f5386b36117ec9a31ed47c.zip external_mesa3d-694be9115d43b93610f5386b36117ec9a31ed47c.tar.gz external_mesa3d-694be9115d43b93610f5386b36117ec9a31ed47c.tar.bz2 |
glsl: Add a new glsl_type::sampler_coordinate_components() function.
This computes the number of components necessary to address a sampler
based on its dimensionality. It will be useful for texturing built-ins.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Diffstat (limited to 'src/glsl/glsl_types.h')
-rw-r--r-- | src/glsl/glsl_types.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h index 647867a..9f61eee 100644 --- a/src/glsl/glsl_types.h +++ b/src/glsl/glsl_types.h @@ -498,6 +498,18 @@ struct glsl_type { return is_array() ? length : -1; } + /** + * Return the number of coordinate components needed for this sampler type. + * + * This is based purely on the sampler's dimensionality. For example, this + * returns 1 for sampler1D, and 3 for sampler2DArray. + * + * Note that this is often different than actual coordinate type used in + * a texturing built-in function, since those pack additional values (such + * as the shadow comparitor or projector) into the coordinate type. + */ + int sampler_coordinate_components() const; + private: /** * ralloc context for all glsl_type allocations |