aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/glsl_types.cpp
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-03-04 12:18:13 +0100
committermarha <marha@users.sourceforge.net>2014-03-04 12:23:48 +0100
commit45392e4a0642880b569ea5d4a350cdc395a2c7db (patch)
treec3c2a49de903a18c3f8e1bf79684c29337ebcf7c /mesalib/src/glsl/glsl_types.cpp
parent5ec0616d4e3c4c6095f4975abbe9c21e5b6af967 (diff)
parent321c01267ae1c446f1bd22b642567fcafa016c02 (diff)
downloadvcxsrv-45392e4a0642880b569ea5d4a350cdc395a2c7db.tar.gz
vcxsrv-45392e4a0642880b569ea5d4a350cdc395a2c7db.tar.bz2
vcxsrv-45392e4a0642880b569ea5d4a350cdc395a2c7db.zip
Merge remote-tracking branch 'origin/released'
* origin/released: libX11 libxcb mesa xserver xcb-proto xkeyboard-config git update 4 Mar 2014 Conflicts: mesalib/src/mapi/glapi/glapi.h mesalib/src/mapi/glapi/glthread.c mesalib/src/mesa/drivers/dri/common/dri_util.c mesalib/src/mesa/main/bufferobj.c xorg-server/dix/dispatch.c xorg-server/hw/xwin/glx/gen_gl_wrappers.py xorg-server/hw/xwin/winmultiwindowwm.c
Diffstat (limited to 'mesalib/src/glsl/glsl_types.cpp')
-rw-r--r--mesalib/src/glsl/glsl_types.cpp36
1 files changed, 30 insertions, 6 deletions
diff --git a/mesalib/src/glsl/glsl_types.cpp b/mesalib/src/glsl/glsl_types.cpp
index 1b0b3ef88..849a79af4 100644
--- a/mesalib/src/glsl/glsl_types.cpp
+++ b/mesalib/src/glsl/glsl_types.cpp
@@ -64,20 +64,26 @@ glsl_type::glsl_type(GLenum gl_type,
memset(& fields, 0, sizeof(fields));
}
-glsl_type::glsl_type(GLenum gl_type,
+glsl_type::glsl_type(GLenum gl_type, glsl_base_type base_type,
enum glsl_sampler_dim dim, bool shadow, bool array,
unsigned type, const char *name) :
gl_type(gl_type),
- base_type(GLSL_TYPE_SAMPLER),
+ base_type(base_type),
sampler_dimensionality(dim), sampler_shadow(shadow),
sampler_array(array), sampler_type(type), interface_packing(0),
- vector_elements(0), matrix_columns(0),
length(0)
{
init_ralloc_type_ctx();
assert(name != NULL);
this->name = ralloc_strdup(this->mem_ctx, name);
memset(& fields, 0, sizeof(fields));
+
+ if (base_type == GLSL_TYPE_SAMPLER) {
+ /* Samplers take no storage whatsoever. */
+ matrix_columns = vector_elements = 0;
+ } else {
+ matrix_columns = vector_elements = 1;
+ }
}
glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields,
@@ -174,6 +180,7 @@ bool
glsl_type::contains_opaque() const {
switch (base_type) {
case GLSL_TYPE_SAMPLER:
+ case GLSL_TYPE_IMAGE:
case GLSL_TYPE_ATOMIC_UINT:
return true;
case GLSL_TYPE_ARRAY:
@@ -219,6 +226,21 @@ glsl_type::sampler_index() const
}
}
+bool
+glsl_type::contains_image() const
+{
+ if (this->is_array()) {
+ return this->fields.array->contains_image();
+ } else if (this->is_record()) {
+ for (unsigned int i = 0; i < this->length; i++) {
+ if (this->fields.structure[i].type->contains_image())
+ return true;
+ }
+ return false;
+ } else {
+ return this->is_image();
+ }
+}
const glsl_type *glsl_type::get_base_type() const
{
@@ -642,6 +664,9 @@ glsl_type::component_slots() const
case GLSL_TYPE_ARRAY:
return this->length * this->fields.array->component_slots();
+ case GLSL_TYPE_IMAGE:
+ return 1;
+
case GLSL_TYPE_SAMPLER:
case GLSL_TYPE_ATOMIC_UINT:
case GLSL_TYPE_VOID:
@@ -932,6 +957,7 @@ glsl_type::count_attribute_slots() const
return this->length * this->fields.array->count_attribute_slots();
case GLSL_TYPE_SAMPLER:
+ case GLSL_TYPE_IMAGE:
case GLSL_TYPE_ATOMIC_UINT:
case GLSL_TYPE_VOID:
case GLSL_TYPE_ERROR:
@@ -944,10 +970,8 @@ glsl_type::count_attribute_slots() const
}
int
-glsl_type::sampler_coordinate_components() const
+glsl_type::coordinate_components() const
{
- assert(is_sampler());
-
int size;
switch (sampler_dimensionality) {