Commit Graph

80 Commits

Author SHA1 Message Date
Eric Anholt
0ed6125725 Test that const declarations include initializers.
Fixes dataType6.frag, and also array2.frag for an unexpected but valid
reason.
2010-03-31 13:17:23 -07:00
Ian Romanick
e0800062da Reject declarations with 'in' or 'out' qualifiers
'in' and 'out' can only be used in function parameter lists or at
global scope (1.30 and later).  This change enforces this.
2010-03-31 13:15:23 -07:00
Ian Romanick
d8065d86e8 Fix comment bug and printf bug in previous commit 2010-03-31 13:03:56 -07:00
Ian Romanick
b168e53452 Require that 'uniform' and 'varying' variables be declared at global scope
This causes the following tests to pass:

    glslparsertest/shaders/uniform.frag
    glslparsertest/shaders/varying.frag
2010-03-31 12:31:18 -07:00
Ian Romanick
e1c1a3f3bd Slightly refector checks for declarations that must be at global scope 2010-03-31 12:26:03 -07:00
Eric Anholt
b82c0c31ae Implement logical operators.
Fixes parser9.frag.
2010-03-31 09:17:39 -10:00
Eric Anholt
b97ee2e260 Test that variable names don't use the reserved gl_ prefix.
Fixes identifier2.frag.
2010-03-31 09:17:35 -10:00
Eric Anholt
b980207707 Test that discard only appears in the fragment shader.
Fixes fragmentOnly4.vert.
2010-03-30 23:40:14 -10:00
Eric Anholt
174cc03edc Test that main doesn't take any parameters.
Fixes main2.vert.
2010-03-30 23:37:51 -10:00
Eric Anholt
aad7c77937 Test that a non-void function returns a value. 2010-03-30 23:30:11 -10:00
Eric Anholt
ab79d4ec6e Test that a void function doesn't return a value.
Fixes function1.frag.
2010-03-30 23:28:17 -10:00
Eric Anholt
794ea61006 Fix unused variable warning. 2010-03-30 18:31:32 -10:00
Ian Romanick
a80cbd6d82 Forbid array comparisons in GLSL 1.10
This causes the following tests to pass:

    glslparsertest/shaders/array3.frag
2010-03-30 17:04:48 -07:00
Ian Romanick
28009cd75c Begin handling array declarations
This causes the following tests to pass:

    glslparsertest/shaders/array4.frag
    glslparsertest/shaders/array5.frag

This causes the following tests to fail.  These shaders were
previously failing to compile, but they were all failing for the wrong
reasons.

    glslparsertest/shaders/array3.frag
2010-03-30 16:59:47 -07:00
Ian Romanick
2d816204c8 Arrays are not allowed as vertex shader inputs in GLSL 1.30 either 2010-03-29 17:42:43 -07:00
Ian Romanick
fb9f5b0675 Add some checking for vertex shader inputs / attributes
This causes the following tests to pass:

     glslparsertest/shaders/attribute.vert
     glslparsertest/shaders/attribute1.vert
     glslparsertest/shaders/attribute2.vert
2010-03-29 17:16:35 -07:00
Ian Romanick
bfb09c2a94 Use call-by-reference for apply_implicit_conversion
I'm not sure if this is a win or not.  It makes the code in
apply_implicit_conversion more clear, but it obscures the fact that it
may change the pointers.
2010-03-29 16:32:55 -07:00
Ian Romanick
db9be2e7aa Apply implicit conversions to ?: operator 2010-03-29 16:29:26 -07:00
Ian Romanick
212b0327b4 Apply implicit conversions to equality operators 2010-03-29 16:29:26 -07:00
Ian Romanick
0150f5f20e Apply implicit conversions to relational operators 2010-03-29 16:29:26 -07:00
Ian Romanick
0104536568 Apply implicit conversions to arithmetic operators 2010-03-29 16:29:21 -07:00
Ian Romanick
96f9cea116 Implement HIR conversion for ?: operator 2010-03-29 15:33:54 -07:00
Ian Romanick
5185a5f7d5 Add generate_temporary to generate an anonymous temporary 2010-03-29 15:20:42 -07:00
Ian Romanick
6e659caaa9 Implement HIR conversion for ast_nequal and ast_equal
The following tests now pass:

    shaders/glsl-unused-varying.frag
    shaders/glsl-fs-sqrt-branch.frag
2010-03-29 15:18:31 -07:00
Ian Romanick
251eb75318 Add missing break-statements in ast_expression::hir
The ast_conditional case was flowing right into ast_pre_inc.
2010-03-29 15:17:16 -07:00
Ian Romanick
3c6fea3048 Implement ir_if (for if-statments) and conversion from AST
The following tests now pass:

    glslparsertest/shaders/if1.frag
    glslparsertest/shaders/if2.frag

The following tests that used to pass now fail.  It appears that most
of these fail because ast_nequal and ast_equal are not converted to HIR.

    shaders/glsl-unused-varying.frag
    shaders/glsl-fs-sqrt-branch.frag
2010-03-29 15:17:11 -07:00
Ian Romanick
17d86f4371 Add a variable to the symbol table after processing the initializer 2010-03-29 12:59:02 -07:00
Eric Anholt
ab372dab2a Reject main() declarations with a non-void return value.
Fixes main3.vert.
2010-03-29 12:48:45 -07:00
Eric Anholt
2e063f1adf Reject variables marked with attribute in the fragment shader.
Fixes attribute.frag.
2010-03-29 12:48:45 -07:00
Eric Anholt
c22c40015d Implement the first builtin function: exp(). 2010-03-29 12:48:45 -07:00
Ian Romanick
43de172820 Generate more correctly diagnostics from some invalid initializers 2010-03-28 17:03:16 -07:00
Ian Romanick
66faec4895 Initial bits to process initializers in variable declarations
As a result, the following tests pass:

    glslparsertest/array3.frag
    glslparsertest/CGStandardLibrary.frag
    glslparsertest/ConstantConversions.frag
    glslparsertest/constructor1.frag
    glslparsertest/constructor2.frag
    glslparsertest/constructor3.V110.frag
    glslparsertest/dataType4.frag
    glslparsertest/dataType5.frag
    glslparsertest/dataType13.frag
    glslparsertest/dataType19.frag
    glslparsertest/matrix.V110.frag
    glslparsertest/parser7.frag
    glslparsertest/swizzle3.frag

The following tests also pass, but it is just by dumb luck.  In these
cases the shader fails to compile, but it fails for the wrong reason:

    glslparsertest/array6.frag
    glslparsertest/comma2.frag
    glslparsertest/conditional1.frag
    glslparsertest/conditional2.frag
    glslparsertest/conditional3.frag
    glslparsertest/constFunc.frag
    glslparsertest/ParseTest3.frag
    glslparsertest/ParseTest4.frag
    glslparsertest/varying3.frag
    glslparsertest/parser8.frag (also segfaults)
    glslparsertest/parser9.frag (also segfaults)

The following tests now fail.  As far as I can tell, these are all
cases where the shader was failing to compile, but it was failing for
the wrong reason.

    glslparsertest/CorrectMatComma.frag
    glslparsertest/CorrectModule.frag
    glslparsertest/CorrectSwizzle2.vert
    glslparsertest/shaders/glsl-fs-bug25902.frag
2010-03-27 18:56:53 -07:00
Ian Romanick
19360152f5 Reject uniform initializers in GLSL 1.10 mode
Now both glslparsertest/dataType3.frag and glslparsertest/dataType2.frag pass.
2010-03-26 18:05:27 -07:00
Eric Anholt
8518e75d28 Set the var_type for arrays to error_type until it's implemented.
"Fixes" segfaults in array tests.
2010-03-26 17:51:41 -07:00
Eric Anholt
76ea56c007 Add support for ast_to_hir of pre inc/dec. 2010-03-26 17:51:41 -07:00
Eric Anholt
de38f0ed53 Add support for ast_to_hir of post inc/dec. 2010-03-26 17:51:41 -07:00
Eric Anholt
48a0e64b7d Add support for %= in ast_to_hir. 2010-03-26 17:51:41 -07:00
Eric Anholt
10a6852186 Factor out assignment setup in ast_to_hir. 2010-03-26 17:51:40 -07:00
Ian Romanick
cef3baecf6 Replace remaining use of is_error_type with glsl_type::is_error 2010-03-26 14:41:32 -07:00
Ian Romanick
a6d653dcbb Replace remaining uses of is_numeric_base_type with glsl_type::is_numeric 2010-03-26 14:40:37 -07:00
Ian Romanick
40176e249f Replace is_integer_base_type macro with glsl_type::is_integer method 2010-03-26 14:38:37 -07:00
Ian Romanick
0471e8b089 Make glsl_*_type glsl_type class static data 2010-03-26 14:33:41 -07:00
Ian Romanick
a43817a483 Use glsl_type::is_error instead of comparison with glsl_error_type pointer 2010-03-26 14:27:23 -07:00
Kenneth Graunke
affc1413ac Move swizzles out of ir_dereference and into their own class.
Also turn generate_swizzle into a static "create" method of the new
class; we'll want to use it for the IR reader as well.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2010-03-26 14:00:59 -07:00
Kenneth Graunke
fb9fb5f51d Add new abstract ir_rvalue class; rework accordingly.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2010-03-26 13:58:48 -07:00
Kenneth Graunke
44e1dfa2df Replace "mode" type tag with virtual as_foo() downcasting functions.
These should work well even in a non-flat IR hierarchy.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2010-03-26 12:50:40 -07:00
Ian Romanick
b7592c362b Merge branch 'anholt' 2010-03-25 18:41:41 -07:00
Eric Anholt
ece0a51160 Fix assignment operators: *=, /=, +=, -=.
Basically, replace everything different from operator_assign other
than the creation of the rhs value from the lvalue and rvalue with the
contents of operator_assign.  Fixes a segfault in
CorrectSwizzle1.frag, and fixes parser10.frag.
2010-03-25 17:10:44 -07:00
Ian Romanick
a4e92c4b26 Before generating HIR for user code, generate constructors for built-in types 2010-03-25 17:02:22 -07:00
Ian Romanick
c1bd3a1a61 Use glsl_type::row_type and glsl_type::column type in arithmetic_result_type
This substantially clarifies the code for matching matrix types.  It
also eliminates some uses of glsl_type member data.
2010-03-25 13:06:58 -07:00