Commit Graph

192 Commits

Author SHA1 Message Date
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 548a1b5ab7 Implement array type handling
Since all glsl_type objects are flyweights, support is added to track all
known array types.  This accounts for most of the changes.
2010-03-30 16:58:19 -07:00
Ian Romanick 066304679c Add proper wrappers so that C++ code can use hash_table type 2010-03-30 16:57:29 -07:00
Ian Romanick 1cf43a4331 Initial bits of constant expression evaluator
Currently only works for constants.  The rest will be added later.
2010-03-30 16:56:50 -07:00
Ian Romanick 84960f01cb Add some array declaration tests 2010-03-30 16:56:22 -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 8901eeefc9 Add several tests for vertex shader attributes 2010-03-29 17:19:13 -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 06e5308e29 Add parser support for texture rectangle types 2010-03-29 16:44:29 -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 70348543ac Add glsl_type::is_array and glsl_type::is_float queries 2010-03-29 16:17:15 -07:00
Ian Romanick 8a24cd5cea Allow single-component constructors
This causes the following tests to pass:

    glslparsertest/shaders/CorrectVersion.V110.frag
    shaders/glsl-vs-sqrt-zero.frag
    shaders/glsl-vs-sqrt-zero.vert

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/attribute1.vert
    glslparsertest/shaders/attribute2.vert
    glslparsertest/shaders/main2.vert
2010-03-29 16:07:34 -07:00
Ian Romanick 32a494586f Add tests for :? operator 2010-03-29 15:34: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 721efc04da Add several simple if-statement tests 2010-03-29 14:11:10 -07:00
Ian Romanick 17d86f4371 Add a variable to the symbol table after processing the initializer 2010-03-29 12:59:02 -07:00
Ian Romanick 521c2983b4 Trivial code cleanup in ir_dereference::is_lvalue 2010-03-29 12:52:00 -07:00
Eric Anholt d1e31952ed Add support for builtin radians() and degrees(). 2010-03-29 12:48:45 -07:00
Eric Anholt 78fe3c9150 Add definitions for 1.10 built-in uniforms for ff state. 2010-03-29 12:48:45 -07:00
Eric Anholt a9fafc6504 Don't let swizzles with duplicated components be considered as lvalues.
Fixes swizzle2.frag.
2010-03-29 12:48:45 -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 3cb4358f38 Add the instruction for the parameter variable declarations of builtin funcs.
Matches constructor setup, but I'm not really sure why we make the
variable twice.
2010-03-29 12:48:45 -07:00
Eric Anholt 76a91e1afb Implement dot() builtin. 2010-03-29 12:48:45 -07:00
Eric Anholt 01665262e5 Implement exp2() and log2(), and make ir_unop_exp and ir_unop_log be base e.
Making the base e functions IR operations is not a clear win.  i965
doesn't support it, it doesn't look like r600 supports it, but r500
does. It should be easily supportable as a lowering pass, though.
2010-03-29 12:48:45 -07:00
Eric Anholt 53afc3609d Implement builtin length() function. 2010-03-29 12:48:45 -07:00
Eric Anholt 44d68fd06f Add sqrt() builtin as an IR operation.
Following a discussion in #dri-devel, I think this makes more sense
than implementing it as RSQ RCP CMP as Mesa did.  The i965 has a
hardware sqrt that should work, and AMD is suppposed to be able to
implement it as RSQ RCP with an alternate floating point mode so that
the 0.0 case is handled like we want.
2010-03-29 12:48:45 -07:00
Eric Anholt ddd2e83db2 Add builtin pow() function. 2010-03-29 12:48:45 -07:00
Eric Anholt 0f09aea3bf Add support for builtin deprecated fs varyings.
Fixes glsl-color.frag.
2010-03-29 12:48:45 -07:00
Eric Anholt bfe380a721 Implement some binary gentype builtin functions. 2010-03-29 12:48:45 -07:00
Eric Anholt 2eec73f735 Implement additional unary gentype builtins. 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 72fc47f0b0 Set variables with the sampler base type to read only.
Fixes increment3.frag.
2010-03-26 17:51:41 -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