glsl: added type layout field and new type compare func

Note: because of a weird dependency checking bug, a 'make clean' may be
needed before recompiling.
This commit is contained in:
Brian Paul
2010-02-13 13:52:37 -07:00
parent b947b1d433
commit 26661ac0e1
2 changed files with 45 additions and 2 deletions
+27
View File
@@ -258,6 +258,7 @@ slang_fully_specified_type_copy(slang_fully_specified_type * x,
z.precision = y->precision;
z.variant = y->variant;
z.centroid = y->centroid;
z.layout = y->layout;
z.array_len = y->array_len;
if (!slang_type_specifier_copy(&z.specifier, &y->specifier)) {
slang_fully_specified_type_destruct(&z);
@@ -269,6 +270,32 @@ slang_fully_specified_type_copy(slang_fully_specified_type * x,
}
/**
* Test if two fully specified types are compatible. This is a bit
* looser than testing for equality. We don't check the precision,
* variant, centroid, etc. information.
* XXX this may need some tweaking.
*/
GLboolean
slang_fully_specified_types_compatible(const slang_fully_specified_type * x,
const slang_fully_specified_type * y)
{
if (!slang_type_specifier_equal(&x->specifier, &y->specifier))
return GL_FALSE;
if (x->qualifier == SLANG_QUAL_FIXEDINPUT &&
y->qualifier == SLANG_QUAL_VARYING)
; /* ok */
else if (x->qualifier != y->qualifier)
return GL_FALSE;
/* Note: don't compare precision, variant, centroid */
/* XXX array length? */
return GL_TRUE;
}
GLvoid
slang_type_specifier_ctr(slang_type_specifier * self)
+18 -2
View File
@@ -68,6 +68,18 @@ typedef enum slang_type_centroid_
} slang_type_centroid;
/**
* These only apply to gl_FragCoord, but other layout qualifiers may
* appear in the future.
*/
typedef enum slang_layout_qualifier_
{
SLANG_LAYOUT_NONE = 0x0,
SLANG_LAYOUT_UPPER_LEFT_BIT = 0x1,
SLANG_LAYOUT_PIXEL_CENTER_INTEGER_BIT = 0x2
} slang_layout_qualifier;
typedef enum slang_type_qualifier_
{
SLANG_QUAL_NONE,
@@ -170,8 +182,8 @@ slang_type_specifier_equal(const slang_type_specifier *,
extern GLboolean
slang_type_specifier_compatible(const slang_type_specifier * x,
const slang_type_specifier * y);
slang_type_specifier_compatible(const slang_type_specifier *x,
const slang_type_specifier *y);
typedef struct slang_fully_specified_type_
@@ -181,6 +193,7 @@ typedef struct slang_fully_specified_type_
slang_type_precision precision;
slang_type_variant variant;
slang_type_centroid centroid;
slang_layout_qualifier layout;
GLint array_len; /**< -1 if not an array type */
} slang_fully_specified_type;
@@ -194,6 +207,9 @@ extern int
slang_fully_specified_type_copy(slang_fully_specified_type *,
const slang_fully_specified_type *);
GLboolean
slang_fully_specified_types_compatible(const slang_fully_specified_type * x,
const slang_fully_specified_type * y);
typedef struct slang_typeinfo_