summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/Makefile8
-rw-r--r--src/glsl/apps/compile.c7
-rw-r--r--src/glsl/apps/process.c3
-rw-r--r--src/glsl/apps/purify.c3
-rw-r--r--src/glsl/apps/tokenise.c3
-rw-r--r--src/glsl/apps/version.c3
-rw-r--r--src/glsl/cl/sl_cl_parse.c40
-rw-r--r--src/glsl/glsl_symbol_table.h2
-rw-r--r--src/glsl/linker.cpp2
-rw-r--r--src/glsl/program.h4
10 files changed, 45 insertions, 30 deletions
diff --git a/src/glsl/Makefile b/src/glsl/Makefile
index f4b0fb55a78..462d49e8840 100644
--- a/src/glsl/Makefile
+++ b/src/glsl/Makefile
@@ -70,8 +70,8 @@ LIBS = \
APPS = glsl_compiler glcpp/glcpp
GLSL2_C_SOURCES = \
- ../mesa/shader/hash_table.c \
- ../mesa/shader/symbol_table.c
+ ../mesa/program/hash_table.c \
+ ../mesa/program/symbol_table.c
GLSL2_CXX_SOURCES = \
main.cpp
@@ -87,7 +87,7 @@ DEFINES = \
GLCPP_OBJECTS = \
$(GLCPP_SOURCES:.c=.o) \
- ../mesa/shader/hash_table.o
+ ../mesa/program/hash_table.o
OBJECTS = \
$(C_SOURCES:.c=.o) \
@@ -97,7 +97,7 @@ INCLUDES = \
-I. \
-I../mesa \
-I../mapi \
- -I../mesa/shader \
+ -I../mesa/program \
-I../../include \
$(LIBRARY_INCLUDES)
diff --git a/src/glsl/apps/compile.c b/src/glsl/apps/compile.c
index 21c2b7617e9..3aa4fd4d53e 100644
--- a/src/glsl/apps/compile.c
+++ b/src/glsl/apps/compile.c
@@ -37,7 +37,7 @@ static void
usage(void)
{
printf("Usage:\n");
- printf(" compile fragment|vertex <source> <output>\n");
+ printf(" compile fragment|vertex|geometry <source> <output>\n");
}
int
@@ -65,6 +65,8 @@ main(int argc,
shader_type = 1;
} else if (!strcmp(argv[1], "vertex")) {
shader_type = 2;
+ } else if (!strcmp(argv[1], "geometry")) {
+ shader_type = 3;
} else {
usage();
return 1;
@@ -80,6 +82,9 @@ main(int argc,
fseek(in, 0, SEEK_END);
size = ftell(in);
assert(size != -1);
+ if (size == -1) {
+ return 1;
+ }
fseek(in, 0, SEEK_SET);
out = fopen(argv[3], "w");
diff --git a/src/glsl/apps/process.c b/src/glsl/apps/process.c
index c8a1a1868cc..caf72a71cf1 100644
--- a/src/glsl/apps/process.c
+++ b/src/glsl/apps/process.c
@@ -59,6 +59,9 @@ main(int argc,
fseek(in, 0, SEEK_END);
size = ftell(in);
assert(size != -1);
+ if (size == -1) {
+ return 1;
+ }
fseek(in, 0, SEEK_SET);
out = fopen(argv[2], "wb");
diff --git a/src/glsl/apps/purify.c b/src/glsl/apps/purify.c
index 5ab6bae96d1..0f09b157efd 100644
--- a/src/glsl/apps/purify.c
+++ b/src/glsl/apps/purify.c
@@ -58,6 +58,9 @@ main(int argc,
fseek(in, 0, SEEK_END);
size = ftell(in);
assert(size != -1);
+ if (size == -1) {
+ return 1;
+ }
fseek(in, 0, SEEK_SET);
out = fopen(argv[2], "wb");
diff --git a/src/glsl/apps/tokenise.c b/src/glsl/apps/tokenise.c
index b4c6d609300..f89f47d0611 100644
--- a/src/glsl/apps/tokenise.c
+++ b/src/glsl/apps/tokenise.c
@@ -58,6 +58,9 @@ main(int argc,
fseek(in, 0, SEEK_END);
size = ftell(in);
assert(size != -1);
+ if (size == -1) {
+ return 1;
+ }
fseek(in, 0, SEEK_SET);
out = fopen(argv[2], "wb");
diff --git a/src/glsl/apps/version.c b/src/glsl/apps/version.c
index 9820ad94dc9..fa5c226da83 100644
--- a/src/glsl/apps/version.c
+++ b/src/glsl/apps/version.c
@@ -57,6 +57,9 @@ main(int argc,
fseek(in, 0, SEEK_END);
size = ftell(in);
assert(size != -1);
+ if (size == -1) {
+ return 1;
+ }
fseek(in, 0, SEEK_SET);
out = fopen(argv[2], "wb");
diff --git a/src/glsl/cl/sl_cl_parse.c b/src/glsl/cl/sl_cl_parse.c
index 663436dde99..09456f5219a 100644
--- a/src/glsl/cl/sl_cl_parse.c
+++ b/src/glsl/cl/sl_cl_parse.c
@@ -246,6 +246,7 @@
#define PARAM_QUALIFIER_IN 0
#define PARAM_QUALIFIER_OUT 1
#define PARAM_QUALIFIER_INOUT 2
+#define PARAM_QUALIFIER_NONE 3
/* function parameter */
#define PARAMETER_NONE 0
@@ -836,7 +837,6 @@ _parse_storage_qualifier(struct parse_context *ctx,
return 0;
}
-
static int
_parse_struct_declarator(struct parse_context *ctx,
struct parse_state *ps)
@@ -1114,6 +1114,21 @@ _parse_type_specifier(struct parse_context *ctx,
return 0;
}
+static int
+_parse_parameter_qualifier(struct parse_context *ctx,
+ struct parse_state *ps)
+{
+ unsigned int e = _emit(ctx, &ps->out, PARAM_QUALIFIER_NONE);
+
+ if (_parse_id(ctx, ctx->dict.in, ps) == 0) {
+ _update(ctx, e, PARAM_QUALIFIER_IN);
+ } else if (_parse_id(ctx, ctx->dict.out, ps) == 0) {
+ _update(ctx, e, PARAM_QUALIFIER_OUT);
+ } else if (_parse_id(ctx, ctx->dict.inout, ps) == 0) {
+ _update(ctx, e, PARAM_QUALIFIER_INOUT);
+ }
+ return 0;
+}
static int
_parse_fully_specified_type(struct parse_context *ctx,
@@ -1136,6 +1151,7 @@ _parse_fully_specified_type(struct parse_context *ctx,
if (_parse_storage_qualifier(ctx, &p)) {
_emit(ctx, &p.out, TYPE_QUALIFIER_NONE);
}
+ _parse_parameter_qualifier(ctx, &p);
if (_parse_precision(ctx, &p)) {
_emit(ctx, &p.out, PRECISION_DEFAULT);
}
@@ -1168,23 +1184,6 @@ _parse_function_header(struct parse_context *ctx,
static int
-_parse_parameter_qualifier(struct parse_context *ctx,
- struct parse_state *ps)
-{
- unsigned int e = _emit(ctx, &ps->out, PARAM_QUALIFIER_IN);
-
- if (_parse_id(ctx, ctx->dict.out, ps) == 0) {
- _update(ctx, e, PARAM_QUALIFIER_OUT);
- } else if (_parse_id(ctx, ctx->dict.inout, ps) == 0) {
- _update(ctx, e, PARAM_QUALIFIER_INOUT);
- } else {
- _parse_id(ctx, ctx->dict.in, ps);
- }
- return 0;
-}
-
-
-static int
_parse_function_identifier(struct parse_context *ctx,
struct parse_state *ps)
{
@@ -2192,9 +2191,8 @@ _parse_asm_statement(struct parse_context *ctx,
if (_parse_identifier(ctx, &p)) {
return -1;
}
- if (_parse_asm_arguments(ctx, &p)) {
- return -1;
- }
+ /* optional arguments */
+ _parse_asm_arguments(ctx, &p);
if (_parse_token(ctx, SL_PP_SEMICOLON, &p)) {
return -1;
}
diff --git a/src/glsl/glsl_symbol_table.h b/src/glsl/glsl_symbol_table.h
index 8fbc66c974d..27e825597c5 100644
--- a/src/glsl/glsl_symbol_table.h
+++ b/src/glsl/glsl_symbol_table.h
@@ -29,7 +29,7 @@
#include <new>
extern "C" {
-#include "symbol_table.h"
+#include "program/symbol_table.h"
}
#include "ir.h"
#include "glsl_types.h"
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 7c30a40a6ce..ea0274eac33 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -74,11 +74,11 @@ extern "C" {
#include "main/mtypes.h"
#include "main/macros.h"
+#include "main/shaderobj.h"
#include "glsl_symbol_table.h"
#include "ir.h"
#include "program.h"
#include "hash_table.h"
-#include "shader_api.h"
#include "linker.h"
#include "ir_optimization.h"
diff --git a/src/glsl/program.h b/src/glsl/program.h
index bb1cd919cd6..0a49203d4b2 100644
--- a/src/glsl/program.h
+++ b/src/glsl/program.h
@@ -25,8 +25,8 @@
#include "main/mtypes.h"
extern "C" {
-#include "shader/prog_parameter.h"
-#include "shader/prog_uniform.h"
+#include "program/prog_parameter.h"
+#include "program/prog_uniform.h"
}
extern void