Updated glsl-optimizer.

This commit is contained in:
bkaradzic 2013-03-19 23:34:17 -07:00
parent 1648c34b84
commit f3c22c5b9d
14 changed files with 553 additions and 525 deletions

View File

@ -1484,7 +1484,7 @@ ast_function_expression::hir(exec_list *instructions,
var->constant_value = matrix->constant_expression_value(); var->constant_value = matrix->constant_expression_value();
/* Replace the matrix with dereferences of its columns. */ /* Replace the matrix with dereferences of its columns. */
for (int i = 0; i < matrix->type->matrix_columns; i++) { for (int i = 0; i < (int)matrix->type->matrix_columns; i++) {
matrix->insert_before(new (ctx) ir_dereference_array(var, matrix->insert_before(new (ctx) ir_dereference_array(var,
new(ctx) ir_constant(i))); new(ctx) ir_constant(i)));
} }

View File

@ -50,7 +50,7 @@ typedef struct token_list token_list_t;
typedef union YYSTYPE typedef union YYSTYPE
{ {
intmax_t ival; int64_t ival;
char *str; char *str;
string_list_t *string_list; string_list_t *string_list;
token_t *token; token_t *token;

View File

@ -107,7 +107,7 @@ remove_line_continuations(glcpp_parser_t *ctx, const char *shader)
const char *backslash = NULL; const char *backslash = NULL;
/* # of characters preceding the newline. */ /* # of characters preceding the newline. */
int n = newline - shader; size_t n = newline - shader;
/* Find the preceding '\', if it exists */ /* Find the preceding '\', if it exists */
if (n >= 1 && newline[-1] == '\\') if (n >= 1 && newline[-1] == '\\')

File diff suppressed because it is too large Load Diff

View File

@ -28,6 +28,11 @@
#include "glsl_parser_extras.h" #include "glsl_parser_extras.h"
#include "glsl_parser.h" #include "glsl_parser.h"
#if defined(_MSC_VER)
# pragma warning(disable: 4065) // warning C4065: switch statement contains 'default' but no 'case' labels
# pragma warning(disable: 4244) // warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
#endif // defined(_MSC_VER)
static int classify_identifier(struct _mesa_glsl_parse_state *, const char *); static int classify_identifier(struct _mesa_glsl_parse_state *, const char *);
#ifdef _MSC_VER #ifdef _MSC_VER

File diff suppressed because it is too large Load Diff

View File

@ -245,7 +245,7 @@ typedef union YYSTYPE
{ {
/* Line 2068 of yacc.c */ /* Line 2068 of yacc.c */
#line 59 "src/glsl/glsl_parser.yy" #line 64 "src/glsl/glsl_parser.yy"
int n; int n;
float real; float real;

View File

@ -31,6 +31,11 @@
#include "glsl_types.h" #include "glsl_types.h"
#include "main/context.h" #include "main/context.h"
#if defined(_MSC_VER)
# pragma warning(disable: 4065) // warning C4065: switch statement contains 'default' but no 'case' labels
# pragma warning(disable: 4244) // warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
#endif // defined(_MSC_VER)
#define YYLEX_PARAM state->scanner #define YYLEX_PARAM state->scanner
#undef yyerror #undef yyerror

View File

@ -394,7 +394,7 @@ glsl_type::glsl_type(const glsl_type *array, unsigned length) :
* for 32-bits of ~0. The extra 3 are for the '[', ']', and terminating * for 32-bits of ~0. The extra 3 are for the '[', ']', and terminating
* NUL. * NUL.
*/ */
const unsigned name_length = strlen(array->name) + 10 + 3; const unsigned name_length = (unsigned)strlen(array->name) + 10 + 3;
char *const n = (char *) ralloc_size(this->mem_ctx, name_length); char *const n = (char *) ralloc_size(this->mem_ctx, name_length);
if (length == 0) if (length == 0)

View File

@ -567,7 +567,7 @@ ir_reader::read_assignment(s_expression *expr)
s_pattern mask_pat[] = { mask_symbol }; s_pattern mask_pat[] = { mask_symbol };
if (MATCH(mask_list, mask_pat)) { if (MATCH(mask_list, mask_pat)) {
const char *mask_str = mask_symbol->value(); const char *mask_str = mask_symbol->value();
unsigned mask_length = strlen(mask_str); unsigned mask_length = (unsigned)strlen(mask_str);
if (mask_length > 4) { if (mask_length > 4) {
ir_read_error(expr, "invalid write mask: %s", mask_str); ir_read_error(expr, "invalid write mask: %s", mask_str);
return NULL; return NULL;

View File

@ -177,7 +177,7 @@ reralloc_size(const void *ctx, void *ptr, size_t size)
} }
void * void *
ralloc_array_size(const void *ctx, size_t size, unsigned count) ralloc_array_size(const void *ctx, size_t size, size_t count)
{ {
if (count > SIZE_MAX/size) if (count > SIZE_MAX/size)
return NULL; return NULL;
@ -186,7 +186,7 @@ ralloc_array_size(const void *ctx, size_t size, unsigned count)
} }
void * void *
rzalloc_array_size(const void *ctx, size_t size, unsigned count) rzalloc_array_size(const void *ctx, size_t size, size_t count)
{ {
if (count > SIZE_MAX/size) if (count > SIZE_MAX/size)
return NULL; return NULL;
@ -195,7 +195,7 @@ rzalloc_array_size(const void *ctx, size_t size, unsigned count)
} }
void * void *
reralloc_array_size(const void *ctx, void *ptr, size_t size, unsigned count) reralloc_array_size(const void *ctx, void *ptr, size_t size, size_t count)
{ {
if (count > SIZE_MAX/size) if (count > SIZE_MAX/size)
return NULL; return NULL;

View File

@ -184,7 +184,7 @@ void *reralloc_size(const void *ctx, void *ptr, size_t size);
* More than a convenience function, this also checks for integer overflow when * More than a convenience function, this also checks for integer overflow when
* multiplying \p size and \p count. This is necessary for security. * multiplying \p size and \p count. This is necessary for security.
*/ */
void *ralloc_array_size(const void *ctx, size_t size, unsigned count); void *ralloc_array_size(const void *ctx, size_t size, size_t count);
/** /**
* Allocate a zero-initialized array chained off the given context. * Allocate a zero-initialized array chained off the given context.
@ -194,7 +194,7 @@ void *ralloc_array_size(const void *ctx, size_t size, unsigned count);
* More than a convenience function, this also checks for integer overflow when * More than a convenience function, this also checks for integer overflow when
* multiplying \p size and \p count. This is necessary for security. * multiplying \p size and \p count. This is necessary for security.
*/ */
void *rzalloc_array_size(const void *ctx, size_t size, unsigned count); void *rzalloc_array_size(const void *ctx, size_t size, size_t count);
/** /**
* Resize a ralloc-managed array, preserving data. * Resize a ralloc-managed array, preserving data.
@ -215,7 +215,7 @@ void *rzalloc_array_size(const void *ctx, size_t size, unsigned count);
* \return True unless allocation failed. * \return True unless allocation failed.
*/ */
void *reralloc_array_size(const void *ctx, void *ptr, size_t size, void *reralloc_array_size(const void *ctx, void *ptr, size_t size,
unsigned count); size_t count);
/// @} /// @}
/** /**

View File

@ -195,7 +195,7 @@ hash_table_call_foreach(struct hash_table *ht,
{ {
int bucket; int bucket;
for (bucket = 0; bucket < ht->num_buckets; bucket++) { for (bucket = 0; bucket < (int)ht->num_buckets; bucket++) {
struct node *node, *temp; struct node *node, *temp;
foreach_s(node, temp, &ht->buckets[bucket]) { foreach_s(node, temp, &ht->buckets[bucket]) {
struct hash_node *hn = (struct hash_node *) node; struct hash_node *hn = (struct hash_node *) node;

View File

@ -10,6 +10,10 @@ project "shaderc"
GLSL_OPTIMIZER .. "src/glsl/msvc", GLSL_OPTIMIZER .. "src/glsl/msvc",
} }
buildoptions {
"/wd4996" -- warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup.
}
configuration { "windows", "vs*" } configuration { "windows", "vs*" }
includedirs { includedirs {
GLSL_OPTIMIZER .. "include/c99", GLSL_OPTIMIZER .. "include/c99",
@ -28,10 +32,14 @@ project "shaderc"
configuration {} configuration {}
defines { -- fcpp defines {
-- fcpp
"NINCLUDE=64", "NINCLUDE=64",
"NWORK=65536", "NWORK=65536",
"NBUFF=65536", "NBUFF=65536",
-- glsl-optimizer
"__STDC_VERSION__=199901L",
} }
includedirs { includedirs {