├── .gitignore ├── CMakeLists.txt ├── Changelog.md ├── LICENSE.txt ├── README.md ├── TODO.txt ├── hlslang.sln ├── hlslang.vcxproj ├── hlslang.vcxproj.filters ├── hlslang.xcodeproj ├── project.pbxproj └── xcshareddata │ └── xcschemes │ └── hlsl2glsl.xcscheme ├── hlslang ├── GLSLCodeGen │ ├── glslCommon.cpp │ ├── glslCommon.h │ ├── glslFunction.cpp │ ├── glslFunction.h │ ├── glslOutput.cpp │ ├── glslOutput.h │ ├── glslStruct.cpp │ ├── glslStruct.h │ ├── glslSymbol.cpp │ ├── glslSymbol.h │ ├── hlslCrossCompiler.cpp │ ├── hlslCrossCompiler.h │ ├── hlslLinker.cpp │ ├── hlslLinker.h │ ├── hlslSupportLib.cpp │ ├── hlslSupportLib.h │ ├── propagateMutable.cpp │ ├── propagateMutable.h │ ├── typeSamplers.cpp │ └── typeSamplers.h ├── Include │ ├── BaseTypes.h │ ├── Common.h │ ├── InfoSink.h │ ├── InitializeGlobals.h │ ├── InitializeParseContext.h │ ├── PoolAlloc.h │ ├── Types.h │ └── intermediate.h ├── MachineIndependent │ ├── ConstantFolding.cpp │ ├── HLSL2GLSL.cpp │ ├── InfoSink.cpp │ ├── Initialize.cpp │ ├── Initialize.h │ ├── IntermTraverse.cpp │ ├── Intermediate.cpp │ ├── ParseHelper.cpp │ ├── ParseHelper.h │ ├── PoolAlloc.cpp │ ├── RemoveTree.cpp │ ├── RemoveTree.h │ ├── SymbolTable.cpp │ ├── SymbolTable.h │ ├── hlslang.l │ ├── hlslang.y │ ├── intermOut.cpp │ ├── localintermediate.h │ └── preprocessor │ │ ├── mojoshader.cpp │ │ ├── mojoshader.h │ │ ├── mojoshader_common.cpp │ │ ├── mojoshader_internal.h │ │ ├── mojoshader_lexer.cpp │ │ ├── mojoshader_lexer.re │ │ ├── mojoshader_preprocessor.cpp │ │ ├── sourceloc.cpp │ │ └── sourceloc.h └── OSDependent │ ├── Linux │ ├── osinclude.h │ └── ossource.cpp │ ├── Mac │ ├── osinclude.h │ └── ossource.cpp │ └── Windows │ ├── osinclude.h │ ├── ossource.cpp │ └── unistd.h ├── include └── hlsl2glsl.h ├── tests ├── combined │ ├── index-matrix-assignment-fragment-out.txt │ ├── index-matrix-assignment-in.txt │ └── index-matrix-assignment-vertex-out.txt ├── fragment-120 │ ├── array-globalconst-init-in.txt │ ├── array-globalconst-init-out.txt │ ├── array-globalconst-init-out120arr.txt │ ├── array-globalconst-init-outES3.txt │ ├── array-unsized-in.txt │ ├── array-unsized-out.txt │ ├── array-unsized-out120arr.txt │ ├── array-unsized-outES3.txt │ ├── const-var-from-function-in.txt │ ├── const-var-from-function-out.txt │ ├── const-var-from-function-out120arr.txt │ ├── const-var-from-function-outES3.txt │ ├── decl-multiple-in.txt │ ├── decl-multiple-out.txt │ ├── decl-multiple-out120arr.txt │ ├── decl-multiple-outES3.txt │ ├── matrix-in.txt │ ├── matrix-out.txt │ ├── matrix-out120arr.txt │ ├── matrix-outES3.txt │ ├── uniforms-in.txt │ ├── uniforms-out.txt │ ├── uniforms-out120arr.txt │ └── uniforms-outES3.txt ├── fragment-failures │ ├── matrix-in.txt │ ├── matrix-out.txt │ ├── matrixnonsquare-in.txt │ ├── matrixnonsquare-out.txt │ ├── non-matching-type-init-in.txt │ ├── non-matching-type-init-out.txt │ ├── ops-shiftbitwise-in.txt │ ├── ops-shiftbitwise-out.txt │ ├── pp-else-error-in.txt │ ├── pp-else-error-out.txt │ ├── pp-if-error-in.txt │ ├── pp-if-error-out.txt │ ├── pp-if-nonclosed-in.txt │ ├── pp-if-nonclosed-out.txt │ ├── pp-ifdef-error-in.txt │ ├── pp-ifdef-error-out.txt │ ├── pp-redefinition-in.txt │ ├── pp-redefinition-out.txt │ ├── pp-redefinitionfile-in.txt │ ├── pp-redefinitionfile-out.txt │ ├── pp-redefinitionline-in.txt │ ├── pp-redefinitionline-out.txt │ ├── pp-too-many-macro-args-in.txt │ ├── pp-too-many-macro-args-out.txt │ ├── pp-undef-empty-in.txt │ ├── pp-undef-empty-out.txt │ ├── pp-undef-file-in.txt │ ├── pp-undef-file-out.txt │ ├── pp-undef-filetwice-in.txt │ ├── pp-undef-filetwice-out.txt │ ├── pp-undef-line-in.txt │ ├── pp-undef-line-out.txt │ ├── unknown-out-semantics-in.txt │ └── unknown-out-semantics-out.txt ├── fragment │ ├── array-const-in.txt │ ├── array-const-out.txt │ ├── array-const-outES.txt │ ├── array-const-outES3.txt │ ├── array-constconst-in.txt │ ├── array-constconst-out.txt │ ├── array-constconst-outES.txt │ ├── array-constconst-outES3.txt │ ├── array-globalconst-init-in.txt │ ├── array-globalconst-init-out.txt │ ├── array-globalconst-init-outES.txt │ ├── array-globalconst-init-outES3.txt │ ├── array-unsized-in.txt │ ├── array-unsized-out.txt │ ├── array-unsized-outES.txt │ ├── array-unsized-outES3.txt │ ├── arrays-in.txt │ ├── arrays-out.txt │ ├── arrays-outES.txt │ ├── arrays-outES3.txt │ ├── basic-in.txt │ ├── basic-out.txt │ ├── basic-outES.txt │ ├── basic-outES3.txt │ ├── bug-inout-color-anywhere-causes-framebuffer-fetch-in.txt │ ├── bug-inout-color-anywhere-causes-framebuffer-fetch-out.txt │ ├── bug-inout-color-anywhere-causes-framebuffer-fetch-outES.txt │ ├── bug-inout-color-anywhere-causes-framebuffer-fetch-outES3.txt │ ├── const-float-from-int-in.txt │ ├── const-float-from-int-out.txt │ ├── const-float-from-int-outES.txt │ ├── const-float-from-int-outES3.txt │ ├── const-global-matrix-init-in.txt │ ├── const-global-matrix-init-out.txt │ ├── const-global-matrix-init-outES.txt │ ├── const-global-matrix-init-outES3.txt │ ├── const-matrix-init-in.txt │ ├── const-matrix-init-out.txt │ ├── const-matrix-init-outES.txt │ ├── const-matrix-init-outES3.txt │ ├── const-var-from-function-in.txt │ ├── const-var-from-function-out.txt │ ├── const-var-from-function-outES.txt │ ├── const-var-from-function-outES3.txt │ ├── const-var-from-struct-in.txt │ ├── const-var-from-struct-out.txt │ ├── const-var-from-struct-outES.txt │ ├── const-var-from-struct-outES3.txt │ ├── const-var-from-var-in.txt │ ├── const-var-from-var-out.txt │ ├── const-var-from-var-outES.txt │ ├── const-var-from-var-outES3.txt │ ├── derivatives-in.txt │ ├── derivatives-out.txt │ ├── derivatives-outES.txt │ ├── derivatives-outES3.txt │ ├── fragdepth-in.txt │ ├── fragdepth-out.txt │ ├── fragdepth-outES.txt │ ├── fragdepth-outES3.txt │ ├── framebuffer_fetch-in.txt │ ├── framebuffer_fetch-out.txt │ ├── framebuffer_fetch-outES.txt │ ├── framebuffer_fetch-outES3.txt │ ├── in-struct-ret-vals-in.txt │ ├── in-struct-ret-vals-out.txt │ ├── in-struct-ret-vals-outES.txt │ ├── in-struct-ret-vals-outES3.txt │ ├── in-vals-ret-vals-in.txt │ ├── in-vals-ret-vals-out.txt │ ├── in-vals-ret-vals-outES.txt │ ├── in-vals-ret-vals-outES3.txt │ ├── intrinsics-in.txt │ ├── intrinsics-out.txt │ ├── intrinsics-outES.txt │ ├── intrinsics-outES3.txt │ ├── loops-empty-in.txt │ ├── loops-empty-out.txt │ ├── loops-empty-outES.txt │ ├── loops-empty-outES3.txt │ ├── matrix-ops-in.txt │ ├── matrix-ops-out.txt │ ├── matrix-ops-outES.txt │ ├── matrix-ops-outES3.txt │ ├── mrt-in.txt │ ├── mrt-out.txt │ ├── mrt-outES.txt │ ├── mrt-outES3.txt │ ├── overloading-in.txt │ ├── overloading-out.txt │ ├── overloading-outES.txt │ ├── overloading-outES3.txt │ ├── pos-in.txt │ ├── pos-out.txt │ ├── pos-outES.txt │ ├── pos-outES3.txt │ ├── pos-unused-in.txt │ ├── pos-unused-out.txt │ ├── pos-unused-outES.txt │ ├── pos-unused-outES3.txt │ ├── pp-after-block-comment-in.txt │ ├── pp-after-block-comment-out.txt │ ├── pp-complex1-in.txt │ ├── pp-complex1-out.txt │ ├── pp-complex1-outES.txt │ ├── pp-complex1-outES3.txt │ ├── pp-complex2-in.txt │ ├── pp-complex2-out.txt │ ├── pp-complex2-outES.txt │ ├── pp-complex2-outES3.txt │ ├── pp-concat-operator-basic-in.txt │ ├── pp-concat-operator-basic-out.txt │ ├── pp-concat-operator-define-override-in.txt │ ├── pp-concat-operator-define-override-out.txt │ ├── pp-concat-operator-ignore-non-args-in.txt │ ├── pp-concat-operator-ignore-non-args-out.txt │ ├── pp-concat-operator-multiple-in.txt │ ├── pp-concat-operator-multiple-out.txt │ ├── pp-concat-operator-stacked-override-in.txt │ ├── pp-concat-operator-stacked-override-out.txt │ ├── pp-elif-after-macro-in.txt │ ├── pp-elif-after-macro-out.txt │ ├── pp-elif-after-macro-with-args-in.txt │ ├── pp-elif-after-macro-with-args-out.txt │ ├── pp-empty-macro-with-arg-in.txt │ ├── pp-empty-macro-with-arg-out.txt │ ├── pp-if-with-embedded-parens-in.txt │ ├── pp-if-with-embedded-parens-out.txt │ ├── pp-include-in.txt │ ├── pp-include-out.txt │ ├── pp-includedfile-ascii.txt │ ├── pp-includedfile-нонасции.txt │ ├── pp-line-directive-filename-in.txt │ ├── pp-line-directive-filename-out.txt │ ├── pp-line-directive-no-filename-in.txt │ ├── pp-line-directive-no-filename-out.txt │ ├── pp-line-directive-whitespace-filename-in.txt │ ├── pp-line-directive-whitespace-filename-out.txt │ ├── pp-line-macro-in.txt │ ├── pp-line-macro-out.txt │ ├── pp-linenumbers1-in.txt │ ├── pp-linenumbers1-out.txt │ ├── pp-linenumbers1-outES.txt │ ├── pp-linenumbers1-outES3.txt │ ├── pp-linenumbers2-in.txt │ ├── pp-linenumbers2-out.txt │ ├── pp-linenumbers2-outES.txt │ ├── pp-linenumbers2-outES3.txt │ ├── pp-macro-1-arg-accepts-void-in.txt │ ├── pp-macro-1-arg-accepts-void-out.txt │ ├── pp-macro-arg-in.txt │ ├── pp-macro-arg-out.txt │ ├── pp-macro-arg-overrides-define-in.txt │ ├── pp-macro-arg-overrides-define-out.txt │ ├── pp-macro-args-in.txt │ ├── pp-macro-args-out.txt │ ├── pp-macro-args-with-whitespace-in.txt │ ├── pp-macro-args-with-whitespace-out.txt │ ├── pp-macro-blank-arg-in.txt │ ├── pp-macro-blank-arg-out.txt │ ├── pp-macro-continuation-in.txt │ ├── pp-macro-continuation-out.txt │ ├── pp-macro-empty-arg-in.txt │ ├── pp-macro-empty-arg-out.txt │ ├── pp-macro-longarg-in.txt │ ├── pp-macro-longarg-out.txt │ ├── pp-macro-multi-args-with-whitespace-in.txt │ ├── pp-macro-multi-args-with-whitespace-out.txt │ ├── pp-macro-paren-stacking-in.txt │ ├── pp-macro-paren-stacking-out.txt │ ├── pp-macro-void-arg-in.txt │ ├── pp-macro-void-arg-out.txt │ ├── pp-macro-with-arg-as-macro-arg-in.txt │ ├── pp-macro-with-arg-as-macro-arg-out.txt │ ├── pp-nested-macro-args-in.txt │ ├── pp-nested-macro-args-out.txt │ ├── pp-pragma-directive-line-break-in.txt │ ├── pp-pragma-directive-line-break-out.txt │ ├── pp-tokenpaste-in.txt │ ├── pp-tokenpaste-out.txt │ ├── pp-tokenpaste-outES.txt │ ├── pp-tokenpaste-outES3.txt │ ├── sampler2dshadow-in.txt │ ├── sampler2dshadow-out.txt │ ├── sampler2dshadow-outES.txt │ ├── sampler2dshadow-outES3.txt │ ├── samplerstate-in.txt │ ├── samplerstate-out.txt │ ├── samplerstate-outES.txt │ ├── samplerstate-outES3.txt │ ├── struct-semantics-in.txt │ ├── struct-semantics-out.txt │ ├── struct-semantics-outES.txt │ ├── struct-semantics-outES3.txt │ ├── sv_target-works-in.txt │ ├── sv_target-works-out.txt │ ├── sv_target-works-outES.txt │ ├── sv_target-works-outES3.txt │ ├── syntax-in.txt │ ├── syntax-out.txt │ ├── syntax-outES.txt │ ├── syntax-outES3.txt │ ├── ternary-in.txt │ ├── ternary-out.txt │ ├── ternary-outES.txt │ ├── ternary-outES3.txt │ ├── ternary-vec4-in.txt │ ├── ternary-vec4-out.txt │ ├── ternary-vec4-outES.txt │ ├── ternary-vec4-outES3.txt │ ├── tex2DArray-in.txt │ ├── tex2DArray-out.txt │ ├── tex2DArray-outES.txt │ ├── tex2DArray-outES3.txt │ ├── tex2d-func-call-in.txt │ ├── tex2d-func-call-out.txt │ ├── tex2d-func-call-outES.txt │ ├── tex2d-func-call-outES3.txt │ ├── tex2dlod-in.txt │ ├── tex2dlod-out.txt │ ├── tex2dlod-outES.txt │ ├── tex2dlod-outES3.txt │ ├── texture-ops-in.txt │ ├── texture-ops-out.txt │ ├── texture-ops-outES.txt │ ├── texture-ops-outES3.txt │ ├── texture-samplers-in.txt │ ├── texture-samplers-out.txt │ ├── texture-samplers-outES.txt │ ├── texture-samplers-outES3.txt │ ├── uniforms-in.txt │ ├── uniforms-mutable-in.txt │ ├── uniforms-mutable-out.txt │ ├── uniforms-mutable-outES.txt │ ├── uniforms-mutable-outES3.txt │ ├── uniforms-out.txt │ ├── uniforms-outES.txt │ ├── uniforms-outES3.txt │ ├── upwardpromotion-in.txt │ ├── upwardpromotion-out.txt │ ├── upwardpromotion-outES.txt │ ├── upwardpromotion-outES3.txt │ ├── varyings-in.txt │ ├── varyings-out.txt │ ├── varyings-outES.txt │ ├── varyings-outES3.txt │ ├── vface-in.txt │ ├── vface-out.txt │ ├── vface-outES.txt │ ├── vface-outES3.txt │ ├── vpos-in.txt │ ├── vpos-out.txt │ ├── vpos-outES.txt │ ├── vpos-outES3.txt │ ├── z-MotionBlur-in.txt │ ├── z-MotionBlur-out.txt │ ├── z-MotionBlur-outES.txt │ ├── z-MotionBlur-outES3.txt │ ├── z-MotionBlurNeighborMax-in.txt │ ├── z-MotionBlurNeighborMax-out.txt │ ├── z-MotionBlurNeighborMax-outES.txt │ ├── z-MotionBlurNeighborMax-outES3.txt │ ├── z-SurfaceMutableUniform-in.txt │ ├── z-SurfaceMutableUniform-out.txt │ ├── z-SurfaceMutableUniform-outES.txt │ ├── z-SurfaceMutableUniform-outES3.txt │ ├── z-WaterDisplRefr-in.txt │ ├── z-WaterDisplRefr-out.txt │ ├── z-WaterDisplRefr-outES.txt │ ├── z-WaterDisplRefr-outES3.txt │ ├── z-collectshadows-in.txt │ ├── z-collectshadows-out.txt │ ├── z-collectshadows-outES.txt │ ├── z-collectshadows-outES3.txt │ ├── z-flare-in.txt │ ├── z-flare-out.txt │ ├── z-flare-outES.txt │ ├── z-flare-outES3.txt │ ├── z-fxaa-preset1-in.txt │ ├── z-fxaa-preset1-out.txt │ ├── z-fxaa-preset1-outES.txt │ ├── z-fxaa-preset1-outES3.txt │ ├── z-fxaa-preset3-in.txt │ ├── z-fxaa-preset3-out.txt │ ├── z-fxaa-preset3-outES.txt │ ├── z-fxaa-preset3-outES3.txt │ ├── z-fxaa3-11-consolepc-in.txt │ ├── z-fxaa3-11-consolepc-out.txt │ ├── z-fxaa3-11-consolepc-outES.txt │ ├── z-fxaa3-11-consolepc-outES3.txt │ ├── z-fxaa3-11-pc39-in.txt │ ├── z-fxaa3-11-pc39-out.txt │ ├── z-fxaa3-11-pc39-outES.txt │ ├── z-fxaa3-11-pc39-outES3.txt │ ├── z-mia-lightmap-in.txt │ ├── z-mia-lightmap-out.txt │ ├── z-mia-lightmap-outES.txt │ ├── z-mia-lightmap-outES3.txt │ ├── z-mia-rt-in.txt │ ├── z-mia-rt-out.txt │ ├── z-mia-rt-outES.txt │ ├── z-mia-rt-outES3.txt │ ├── z-ogre-grass1-in.txt │ ├── z-ogre-grass1-out.txt │ ├── z-ogre-grass1-outES.txt │ ├── z-ogre-grass1-outES3.txt │ ├── z-ogre-grass2-in.txt │ ├── z-ogre-grass2-out.txt │ ├── z-ogre-grass2-outES.txt │ ├── z-ogre-grass2-outES3.txt │ ├── z-ogre-pssm-in.txt │ ├── z-ogre-pssm-out.txt │ ├── z-ogre-pssm-outES.txt │ ├── z-ogre-pssm-outES3.txt │ ├── z-ogre-radialblur-in.txt │ ├── z-ogre-radialblur-out.txt │ ├── z-ogre-radialblur-outES.txt │ ├── z-ogre-radialblur-outES3.txt │ ├── z-particle-in.txt │ ├── z-particle-out.txt │ ├── z-particle-outES.txt │ ├── z-particle-outES3.txt │ ├── z-prepasslight-in.txt │ ├── z-prepasslight-out.txt │ ├── z-prepasslight-outES.txt │ ├── z-prepasslight-outES3.txt │ ├── z-skin-in.txt │ ├── z-skin-out.txt │ ├── z-skin-outES.txt │ ├── z-skin-outES3.txt │ ├── z-ssao-in.txt │ ├── z-ssao-out.txt │ ├── z-ssao-outES.txt │ ├── z-ssao-outES3.txt │ ├── z-treeleaf-in.txt │ ├── z-treeleaf-out.txt │ ├── z-treeleaf-outES.txt │ ├── z-treeleaf-outES3.txt │ ├── z-treeleafloop-in.txt │ ├── z-treeleafloop-out.txt │ ├── z-treeleafloop-outES.txt │ └── z-treeleafloop-outES3.txt ├── hlsl2glsltest │ ├── hlsl2glsltest.cpp │ ├── hlsl2glsltest.vcxproj │ └── hlsl2glsltest.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ └── xcschemes │ │ └── hlsl2glsltest.xcscheme ├── minimal │ └── combined │ │ └── simple-in.txt ├── vertex-120 │ ├── const-expr-init-in.txt │ ├── const-expr-init-out.txt │ ├── const-expr-init-out120arr.txt │ ├── const-expr-init-outES3.txt │ ├── global-init-in.txt │ ├── global-init-out.txt │ ├── global-init-out120arr.txt │ ├── global-init-outES.txt │ └── global-init-outES3.txt ├── vertex-failures │ ├── array-size-in.txt │ ├── array-size-out.txt │ ├── const-expr-arraysize-in.txt │ ├── const-expr-arraysize-out.txt │ ├── error-lines-in.txt │ ├── error-lines-out.txt │ ├── missing-field-selection-no-assert-in.txt │ ├── missing-field-selection-no-assert-out.txt │ ├── multiple-file-lines-in.txt │ ├── multiple-file-lines-out.txt │ ├── nested-unknown-types-in.txt │ ├── nested-unknown-types-out.txt │ ├── no-entry-point-in.txt │ ├── no-entry-point-out.txt │ ├── qualifiers-in.txt │ ├── qualifiers-out.txt │ ├── undefined-type-in.txt │ └── undefined-type-out.txt └── vertex │ ├── MF-GodRays-in.txt │ ├── MF-GodRays-out.txt │ ├── MF-GodRays-outES.txt │ ├── MF-GodRays-outES3.txt │ ├── basic-mul-in.txt │ ├── basic-mul-out.txt │ ├── basic-mul-outES.txt │ ├── basic-mul-outES3.txt │ ├── const-arg-in.txt │ ├── const-arg-out.txt │ ├── const-arg-outES.txt │ ├── const-arg-outES3.txt │ ├── const-expr-arraysize-in.txt │ ├── const-expr-arraysize-out.txt │ ├── const-expr-arraysize-outES.txt │ ├── const-expr-arraysize-outES3.txt │ ├── const-expr-init-in.txt │ ├── const-expr-init-out.txt │ ├── const-expr-init-outES.txt │ ├── const-expr-init-outES3.txt │ ├── const-main-arg-in.txt │ ├── const-main-arg-out.txt │ ├── const-main-arg-outES.txt │ ├── const-main-arg-outES3.txt │ ├── construct-matrix-in.txt │ ├── construct-matrix-out.txt │ ├── construct-matrix-outES.txt │ ├── construct-matrix-outES3.txt │ ├── decl-multiple-in.txt │ ├── decl-multiple-out.txt │ ├── decl-multiple-outES.txt │ ├── decl-multiple-outES3.txt │ ├── dupe-sem-name-mapping-in.txt │ ├── dupe-sem-name-mapping-out.txt │ ├── dupe-sem-name-mapping-outES.txt │ ├── dupe-sem-name-mapping-outES3.txt │ ├── dupe-sem-name-s-in-s-in.txt │ ├── dupe-sem-name-s-in-s-out.txt │ ├── dupe-sem-name-s-in-s-outES.txt │ ├── dupe-sem-name-s-in-s-outES3.txt │ ├── funccalls-in.txt │ ├── funccalls-out.txt │ ├── funccalls-outES.txt │ ├── funccalls-outES3.txt │ ├── funccalls2-in.txt │ ├── funccalls2-out.txt │ ├── funccalls2-outES.txt │ ├── funccalls2-outES3.txt │ ├── funccalls3-in.txt │ ├── funccalls3-out.txt │ ├── funccalls3-outES.txt │ ├── funccalls3-outES3.txt │ ├── global-init-in.txt │ ├── global-init-out.txt │ ├── global-init-outES.txt │ ├── global-init-outES3.txt │ ├── if-in.txt │ ├── if-out.txt │ ├── if-outES.txt │ ├── if-outES3.txt │ ├── in-struct-dupe-sem-ret-struct-in.txt │ ├── in-struct-dupe-sem-ret-struct-out.txt │ ├── in-struct-dupe-sem-ret-struct-outES.txt │ ├── in-struct-dupe-sem-ret-struct-outES3.txt │ ├── in-struct-ret-struct-in.txt │ ├── in-struct-ret-struct-out.txt │ ├── in-struct-ret-struct-outES.txt │ ├── in-struct-ret-struct-outES3.txt │ ├── in-struct-ret-struct-struct-in.txt │ ├── in-struct-ret-struct-struct-out.txt │ ├── in-struct-ret-struct-struct-outES.txt │ ├── in-struct-ret-struct-struct-outES3.txt │ ├── in-struct-ret-vals-in.txt │ ├── in-struct-ret-vals-out.txt │ ├── in-struct-ret-vals-outES.txt │ ├── in-struct-ret-vals-outES3.txt │ ├── in-vals-ret-struct-in.txt │ ├── in-vals-ret-struct-out.txt │ ├── in-vals-ret-struct-outES.txt │ ├── in-vals-ret-struct-outES3.txt │ ├── in-vals-ret-vals-in.txt │ ├── in-vals-ret-vals-out.txt │ ├── in-vals-ret-vals-outES.txt │ ├── in-vals-ret-vals-outES3.txt │ ├── index-matrix-in.txt │ ├── index-matrix-out.txt │ ├── index-matrix-outES.txt │ ├── index-matrix-outES3.txt │ ├── loops-for-in.txt │ ├── loops-for-out.txt │ ├── loops-for-outES.txt │ ├── loops-for-outES3.txt │ ├── loops-formultiple-in.txt │ ├── loops-formultiple-out.txt │ ├── loops-formultiple-outES.txt │ ├── loops-formultiple-outES3.txt │ ├── loops-forvarious-in.txt │ ├── loops-forvarious-out.txt │ ├── loops-forvarious-outES.txt │ ├── loops-forvarious-outES3.txt │ ├── nestedscope-in.txt │ ├── nestedscope-out.txt │ ├── nestedscope-outES.txt │ ├── nestedscope-outES3.txt │ ├── psize-in.txt │ ├── psize-out.txt │ ├── psize-outES.txt │ ├── psize-outES3.txt │ ├── qualifiers-in.txt │ ├── qualifiers-out.txt │ ├── qualifiers-outES.txt │ ├── qualifiers-outES3.txt │ ├── reserved-names-in.txt │ ├── reserved-names-out.txt │ ├── reserved-names-outES.txt │ ├── reserved-names-outES3.txt │ ├── return-struct-of-struct-in.txt │ ├── return-struct-of-struct-out.txt │ ├── return-struct-of-struct-outES.txt │ ├── return-struct-of-struct-outES3.txt │ ├── sampler2dshadow-in.txt │ ├── sampler2dshadow-out.txt │ ├── sampler2dshadow-outES.txt │ ├── sampler2dshadow-outES3.txt │ ├── struct-in.txt │ ├── struct-out.txt │ ├── struct-outES.txt │ ├── struct-outES3.txt │ ├── swizzle-in.txt │ ├── swizzle-out.txt │ ├── swizzle-outES.txt │ ├── swizzle-outES3.txt │ ├── systemvals-in.txt │ ├── systemvals-out.txt │ ├── systemvals-outES.txt │ ├── systemvals-outES3.txt │ ├── tex2dlod-in.txt │ ├── tex2dlod-out.txt │ ├── tex2dlod-outES.txt │ ├── tex2dlod-outES3.txt │ ├── token-pasting-in.txt │ ├── token-pasting-out.txt │ ├── token-pasting-outES.txt │ ├── token-pasting-outES3.txt │ ├── types-in.txt │ ├── types-out.txt │ ├── types-outES.txt │ ├── types-outES3.txt │ ├── z-WaterDisplRefr-in.txt │ ├── z-WaterDisplRefr-out.txt │ ├── z-WaterDisplRefr-outES.txt │ ├── z-WaterDisplRefr-outES3.txt │ ├── z-collectshadows-in.txt │ ├── z-collectshadows-out.txt │ ├── z-collectshadows-outES.txt │ ├── z-collectshadows-outES3.txt │ ├── z-flare-in.txt │ ├── z-flare-out.txt │ ├── z-flare-outES.txt │ ├── z-flare-outES3.txt │ ├── z-mia-lightmap-in.txt │ ├── z-mia-lightmap-out.txt │ ├── z-mia-lightmap-outES.txt │ ├── z-mia-lightmap-outES3.txt │ ├── z-mia-rt-in.txt │ ├── z-mia-rt-out.txt │ ├── z-mia-rt-outES.txt │ ├── z-mia-rt-outES3.txt │ ├── z-ogre-grass1-in.txt │ ├── z-ogre-grass1-out.txt │ ├── z-ogre-grass1-outES.txt │ ├── z-ogre-grass1-outES3.txt │ ├── z-ogre-grass2-in.txt │ ├── z-ogre-grass2-out.txt │ ├── z-ogre-grass2-outES.txt │ ├── z-ogre-grass2-outES3.txt │ ├── z-ogre-pssm-in.txt │ ├── z-ogre-pssm-out.txt │ ├── z-ogre-pssm-outES.txt │ ├── z-ogre-pssm-outES3.txt │ ├── z-particle-in.txt │ ├── z-particle-out.txt │ ├── z-particle-outES.txt │ ├── z-particle-outES3.txt │ ├── z-prepasslight-in.txt │ ├── z-prepasslight-out.txt │ ├── z-prepasslight-outES.txt │ ├── z-prepasslight-outES3.txt │ ├── z-treeleaf-in.txt │ ├── z-treeleaf-out.txt │ ├── z-treeleaf-outES.txt │ └── z-treeleaf-outES3.txt └── tools ├── bin ├── bison.exe ├── cygwin1.dll ├── libiconv2.dll ├── libintl3.dll ├── m4.exe └── regex2.dll ├── flex.exe └── share └── bison ├── bison.m4 ├── c-skel.m4 ├── c.m4 ├── m4sugar ├── foreach.m4 └── m4sugar.m4 └── yacc.c /.gitignore: -------------------------------------------------------------------------------- 1 | *.user 2 | *.ncb 3 | *.suo 4 | *.ilk 5 | *.pbxuser 6 | *.perspectivev3 7 | *.xcworkspace 8 | xcuserdata 9 | *.cmake 10 | *.wwdb 11 | .svn/ 12 | .DS_Store 13 | 14 | _ReSharper.* 15 | *.sdf 16 | *.opensdf 17 | 18 | CMakeFiles/ 19 | CMakeCache.txt 20 | Makefile 21 | build/ 22 | lib/ 23 | Gen_hlslang.cpp 24 | gen_hlslang.cpp 25 | Gen_hlslang_tab.cpp 26 | hlslang_tab.cpp 27 | hlslang.output 28 | hlslang_tab.h 29 | tests/out-*.txt 30 | *.dSYM 31 | tests/hlsl2glsltest/hlsl2glsltest 32 | tests/hlsl2glsltest/out.txt 33 | *-res.txt 34 | /.vs/ 35 | -------------------------------------------------------------------------------- /TODO.txt: -------------------------------------------------------------------------------- 1 | Very rough list of to do items: 2 | 3 | * Cleanup AST structures and expose them (would like to use in Unity's surface shader analysis) 4 | * Full support for integer types & ops (emit as EXT_gpu_shader4) 5 | * Output of existing feature set into GLSL ES 3.00 syntax 6 | * Parse DX10+ HLSL; object types, template-like stuff etc. 7 | * Output into GLSL 3.20+ 8 | * Translate geometry shaders 9 | * Translate hull & domain shaders 10 | * Translate compute shaders 11 | -------------------------------------------------------------------------------- /hlslang/GLSLCodeGen/hlslSupportLib.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) The HLSL2GLSLFork Project Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE.txt file. 4 | 5 | 6 | #ifndef HLSL_SUPPORT_LIB_H 7 | #define HLSL_SUPPORT_LIB_H 8 | 9 | #include 10 | #include 11 | #include "../Include/intermediate.h" 12 | #include "../../include/hlsl2glsl.h" // for ETargetVersion 13 | 14 | void initializeHLSLSupportLibrary(ETargetVersion targetVersion); 15 | void finalizeHLSLSupportLibrary(); 16 | 17 | typedef std::set ExtensionSet; 18 | 19 | std::string getHLSLSupportCode (TOperator op, ExtensionSet& extensions, bool vertexShader, bool gles); 20 | 21 | #endif //HLSL_SUPPORT_LIB_H 22 | -------------------------------------------------------------------------------- /hlslang/GLSLCodeGen/propagateMutable.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) The HLSL2GLSLFork Project Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE.txt file. 4 | 5 | 6 | #ifndef PROPAGATE_MUTABLE_H 7 | #define PROPAGATE_MUTABLE_H 8 | 9 | class TIntermNode; 10 | class TInfoSink; 11 | 12 | // HLSL allows "modifying" global variables; a concept that does not exist in GLSL. 13 | // So this HLSL: 14 | // 15 | // uniform float f; 16 | // void vs() { f *= 2; use f; } 17 | // 18 | // would need to end up like this in GLSL 19 | // 20 | // uniform float f; 21 | // float mutable_f; // not uniform! 22 | // void main() { 23 | // mutable_f = f; 24 | // mutable_f *= 2.0; 25 | // use mutable_f; 26 | // } 27 | void PropagateMutableUniforms (TIntermNode* root, TInfoSink &info); 28 | 29 | 30 | #endif //PROPAGATE_MUTABLE_H 31 | -------------------------------------------------------------------------------- /hlslang/GLSLCodeGen/typeSamplers.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) The HLSL2GLSLFork Project Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE.txt file. 4 | 5 | 6 | #ifndef TYPE_SAMPLERS_H 7 | #define TYPE_SAMPLERS_H 8 | 9 | class TIntermNode; 10 | class TInfoSink; 11 | 12 | // Iterates over the intermediate tree and sets untyped sampler symbols to have types based on the 13 | // type of texture operation the samplers are used for 14 | void PropagateSamplerTypes (TIntermNode* root, TInfoSink &info); 15 | 16 | #endif //TYPE_SAMPLERS_H 17 | -------------------------------------------------------------------------------- /hlslang/Include/InitializeGlobals.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) The HLSL2GLSLFork Project Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE.txt file. 4 | 5 | #ifndef __INITIALIZE_GLOBALS_INCLUDED_ 6 | #define __INITIALIZE_GLOBALS_INCLUDED_ 7 | 8 | void InitializeGlobalPools(); 9 | void FreeGlobalPools(); 10 | bool InitializePoolIndex(); 11 | void FreePoolIndex(); 12 | 13 | #endif // __INITIALIZE_GLOBALS_INCLUDED_ 14 | -------------------------------------------------------------------------------- /hlslang/Include/InitializeParseContext.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) The HLSL2GLSLFork Project Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE.txt file. 4 | 5 | 6 | #ifndef __INITIALIZE_PARSE_CONTEXT_INCLUDED_ 7 | #define __INITIALIZE_PARSE_CONTEXT_INCLUDED_ 8 | 9 | bool InitializeParseContextIndex(); 10 | bool InitializeGlobalParseContext(); 11 | bool FreeParseContext(); 12 | bool FreeParseContextIndex(); 13 | 14 | 15 | #endif // __INITIALIZE_PARSE_CONTEXT_INCLUDED_ 16 | -------------------------------------------------------------------------------- /hlslang/MachineIndependent/InfoSink.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) The HLSL2GLSLFork Project Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE.txt file. 4 | 5 | #include "../Include/InfoSink.h" 6 | #include 7 | 8 | void TInfoSinkBase::append(const char *s) 9 | { 10 | checkMem(strlen(s)); 11 | sink.append(s); 12 | } 13 | 14 | void TInfoSinkBase::append(int count, char c) 15 | { 16 | checkMem(count); 17 | sink.append(count, c); 18 | } 19 | 20 | void TInfoSinkBase::append(const std::string& t) 21 | { 22 | checkMem(t.size()); 23 | sink.append(t); 24 | } 25 | 26 | void TInfoSinkBase::append(const TString& t) 27 | { 28 | checkMem(t.size()); 29 | sink.append(t.c_str()); 30 | } 31 | 32 | -------------------------------------------------------------------------------- /hlslang/MachineIndependent/Initialize.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) The HLSL2GLSLFork Project Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE.txt file. 4 | 5 | 6 | #ifndef _INITIALIZE_INCLUDED_ 7 | #define _INITIALIZE_INCLUDED_ 8 | 9 | #include "../Include/Common.h" 10 | #include "SymbolTable.h" 11 | #include "../../include/hlsl2glsl.h" 12 | 13 | typedef TVector TBuiltInStrings; 14 | 15 | class TBuiltIns 16 | { 17 | public: 18 | POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator) 19 | void initialize(); 20 | TBuiltInStrings* getBuiltInStrings() 21 | { 22 | return builtInStrings; 23 | } 24 | 25 | private: 26 | 27 | TBuiltInStrings builtInStrings[EShLangCount]; 28 | }; 29 | 30 | void IdentifyBuiltIns(EShLanguage, TSymbolTable&); 31 | 32 | #endif // _INITIALIZE_INCLUDED_ 33 | 34 | -------------------------------------------------------------------------------- /hlslang/MachineIndependent/RemoveTree.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) The HLSL2GLSLFork Project Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE.txt file. 4 | 5 | 6 | void ir_remove_tree(TIntermNode*); 7 | -------------------------------------------------------------------------------- /hlslang/MachineIndependent/preprocessor/mojoshader.cpp: -------------------------------------------------------------------------------- 1 | // Stripped down code from Mojoshader, originally under zlib license. 2 | 3 | /** 4 | * MojoShader; generate shader programs from bytecode of compiled 5 | * Direct3D shaders. 6 | * 7 | * Please see the file LICENSE.txt in the source's root directory. 8 | * 9 | * This file written by Ryan C. Gordon. 10 | */ 11 | 12 | #define __MOJOSHADER_INTERNAL__ 1 13 | #include "mojoshader_internal.h" 14 | 15 | // Convenience functions for allocators... 16 | #if !MOJOSHADER_hlslang_FORCE_ALLOCATOR 17 | void *MOJOSHADER_hlslang_internal_malloc(int bytes, void *d) { return malloc(bytes); } 18 | void MOJOSHADER_hlslang_internal_free(void *ptr, void *d) { free(ptr); } 19 | #endif 20 | 21 | MOJOSHADER_hlslang_error MOJOSHADER_hlslang_out_of_mem_error = { 22 | "Out of memory", NULL, MOJOSHADER_hlslang_POSITION_NONE 23 | }; 24 | 25 | 26 | // end of mojoshader.c ... 27 | 28 | -------------------------------------------------------------------------------- /hlslang/MachineIndependent/preprocessor/sourceloc.cpp: -------------------------------------------------------------------------------- 1 | #include "sourceloc.h" 2 | #include "../../Include/Common.h" 3 | 4 | void SetLineNumber(TSourceLoc line, TSourceLoc& outLine) 5 | { 6 | outLine.file = NULL; 7 | outLine.line = line.line; 8 | 9 | if (line.file && line.file[0]) 10 | { 11 | // GLSL does not permit quoted strings in #line directives 12 | 13 | if(line.file[0] == '"') 14 | { 15 | TString stripped(line.file + 1); 16 | size_t len = stripped.size(); 17 | if(stripped[len - 1] == '"') 18 | { 19 | stripped.resize(len - 1); 20 | } 21 | 22 | outLine.file = NewPoolTString(stripped.c_str())->c_str(); 23 | } 24 | else 25 | { 26 | outLine.file = NewPoolTString(line.file)->c_str(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /hlslang/OSDependent/Windows/unistd.h: -------------------------------------------------------------------------------- 1 | // Just needed for generated flex/bison files, 2 | // since some versions of Flex do not respect 3 | // the YY_NO_UNISTD_H 4 | -------------------------------------------------------------------------------- /tests/fragment-120/array-globalconst-init-in.txt: -------------------------------------------------------------------------------- 1 | static const float lut1[3] = { 0.1, 0.2, 0.3 }; 2 | static const float2 lut2[] = { float2(0.1,0.2), float2(0.2,0.3) }; 3 | static const float4 lut4[1] = { float4(0.1,0.2,0.3,0.4) }; 4 | 5 | float4 main() : COLOR 6 | { 7 | float4 c = 0.0; 8 | for (int i = 0; i < 3; ++i) 9 | c.x += lut1[i]; 10 | for (int i = 0; i < 2; ++i) 11 | c.xy += lut2[i]; 12 | c += lut4[0]; 13 | return c; 14 | } 15 | -------------------------------------------------------------------------------- /tests/fragment-120/array-globalconst-init-out.txt: -------------------------------------------------------------------------------- 1 | #version 120 2 | const float[3] lut1 = float[3]( 0.1, 0.2, 0.3); 3 | const vec2[2] lut2 = vec2[2]( vec2( 0.1, 0.2), vec2( 0.2, 0.3)); 4 | #line 3 5 | const vec4[1] lut4 = vec4[1]( vec4( 0.1, 0.2, 0.3, 0.4)); 6 | #line 5 7 | vec4 xlat_main( ) { 8 | #line 7 9 | vec4 c = vec4( 0.0); 10 | int i = 0; 11 | for ( ; (i < 3); (++i)) { 12 | c.x += lut1[i]; 13 | } 14 | int i_1 = 0; 15 | for ( ; (i_1 < 2); (++i_1)) { 16 | c.xy += lut2[i_1]; 17 | } 18 | #line 12 19 | c += lut4[0]; 20 | return c; 21 | } 22 | void main() { 23 | vec4 xl_retval; 24 | xl_retval = xlat_main( ); 25 | gl_FragData[0] = vec4(xl_retval); 26 | } 27 | -------------------------------------------------------------------------------- /tests/fragment-120/array-globalconst-init-outES3.txt: -------------------------------------------------------------------------------- 1 | const highp float[3] lut1 = float[3]( 0.1, 0.2, 0.3); 2 | const highp vec2[2] lut2 = vec2[2]( vec2( 0.1, 0.2), vec2( 0.2, 0.3)); 3 | #line 3 4 | const highp vec4[1] lut4 = vec4[1]( vec4( 0.1, 0.2, 0.3, 0.4)); 5 | #line 5 6 | highp vec4 xlat_main( ) { 7 | #line 7 8 | highp vec4 c = vec4( 0.0); 9 | highp int i = 0; 10 | for ( ; (i < 3); (++i)) { 11 | c.x += lut1[i]; 12 | } 13 | highp int i_1 = 0; 14 | for ( ; (i_1 < 2); (++i_1)) { 15 | c.xy += lut2[i_1]; 16 | } 17 | #line 12 18 | c += lut4[0]; 19 | return c; 20 | } 21 | void main() { 22 | highp vec4 xl_retval; 23 | xl_retval = xlat_main( ); 24 | gl_FragData[0] = vec4(xl_retval); 25 | } 26 | -------------------------------------------------------------------------------- /tests/fragment-120/array-unsized-in.txt: -------------------------------------------------------------------------------- 1 | // GLSL 1.20 tests will make hlsl2glsl test driver 2 | // enable "full GLSL 1.20" array printing mode. 3 | // This is a test to ensure it keeps on working. 4 | 5 | half4 main () : COLOR0 { 6 | float2 lut[] = { 7 | float2(-1, 0.1), 8 | float2(0, 0.5), 9 | float2(1, 0.1) 10 | }; 11 | half4 c = 0; 12 | for (int i = 0; i < 3; ++i) 13 | c.xy += lut[i]; 14 | return c; 15 | } 16 | -------------------------------------------------------------------------------- /tests/fragment-120/array-unsized-out.txt: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | #line 5 4 | vec4 xlat_main( ) { 5 | #line 6 6 | vec2[3] lut = vec2[3]( vec2( -1.0, 0.1), vec2( 0.0, 0.5), vec2( 1.0, 0.1)); 7 | #line 11 8 | vec4 c = vec4( 0.0); 9 | int i = 0; 10 | for ( ; (i < 3); (++i)) { 11 | c.xy += lut[i]; 12 | } 13 | return c; 14 | } 15 | void main() { 16 | vec4 xl_retval; 17 | xl_retval = xlat_main( ); 18 | gl_FragData[0] = vec4(xl_retval); 19 | } 20 | -------------------------------------------------------------------------------- /tests/fragment-120/array-unsized-out120arr.txt: -------------------------------------------------------------------------------- 1 | #version 120 2 | vec4 xlat_main( ); 3 | #line 5 4 | vec4 xlat_main( ) { 5 | #line 6 6 | #if defined(HLSL2GLSL_ENABLE_ARRAY_120_WORKAROUND) 7 | vec2 lut[3]; 8 | lut[0] = vec2( -1.0, 0.1); 9 | lut[1] = vec2( 0.0, 0.5); 10 | lut[2] = vec2( 1.0, 0.1); 11 | #else 12 | vec2[3] lut = vec2[3]( vec2( -1.0, 0.1), vec2( 0.0, 0.5), vec2( 1.0, 0.1)); 13 | #endif 14 | #line 11 15 | vec4 c = vec4( 0.0); 16 | int i = 0; 17 | for ( ; (i < 3); (++i)) { 18 | c.xy += lut[i]; 19 | } 20 | return c; 21 | } 22 | void main() { 23 | vec4 xl_retval; 24 | xl_retval = xlat_main( ); 25 | gl_FragData[0] = vec4(xl_retval); 26 | } 27 | -------------------------------------------------------------------------------- /tests/fragment-120/array-unsized-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 5 3 | mediump vec4 xlat_main( ) { 4 | #line 6 5 | highp vec2[3] lut = vec2[3]( vec2( -1.0, 0.1), vec2( 0.0, 0.5), vec2( 1.0, 0.1)); 6 | #line 11 7 | mediump vec4 c = vec4( 0.0); 8 | highp int i = 0; 9 | for ( ; (i < 3); (++i)) { 10 | c.xy += lut[i]; 11 | } 12 | return c; 13 | } 14 | void main() { 15 | mediump vec4 xl_retval; 16 | xl_retval = xlat_main( ); 17 | gl_FragData[0] = vec4(xl_retval); 18 | } 19 | -------------------------------------------------------------------------------- /tests/fragment-120/const-var-from-function-in.txt: -------------------------------------------------------------------------------- 1 | uniform half4 _Color; 2 | 3 | half4 main() : COLOR0 4 | { 5 | const half c1 = max(_Color.r, _Color.g); 6 | const half c2 = _Color.b * _Color.a; 7 | 8 | // This is GLSL 1.20 9 | // ...which means this one can stay const 10 | // since it only calls built-in function 11 | const float c3 = log2(4 * 4); 12 | 13 | const float c4 = -_Color.r; 14 | return half4(c1, c2, c3, c4); 15 | } 16 | -------------------------------------------------------------------------------- /tests/fragment-120/const-var-from-function-out.txt: -------------------------------------------------------------------------------- 1 | #version 120 2 | uniform vec4 _Color; 3 | #line 3 4 | #line 3 5 | vec4 xlat_main( ) { 6 | float c1 = max( _Color.x, _Color.y); 7 | float c2 = (_Color.z * _Color.w); 8 | #line 11 9 | float c3 = log2(16.0); 10 | float c4 = (-_Color.x); 11 | return vec4( c1, c2, c3, c4); 12 | } 13 | void main() { 14 | vec4 xl_retval; 15 | xl_retval = xlat_main( ); 16 | gl_FragData[0] = vec4(xl_retval); 17 | } 18 | 19 | // uniforms: 20 | // _Color: type 12 arrsize 0 21 | -------------------------------------------------------------------------------- /tests/fragment-120/const-var-from-function-out120arr.txt: -------------------------------------------------------------------------------- 1 | #version 120 2 | uniform vec4 _Color; 3 | #line 3 4 | vec4 xlat_main( ); 5 | #line 3 6 | vec4 xlat_main( ) { 7 | float c1 = max( _Color.x, _Color.y); 8 | float c2 = (_Color.z * _Color.w); 9 | #line 11 10 | float c3 = log2(16.0); 11 | float c4 = (-_Color.x); 12 | return vec4( c1, c2, c3, c4); 13 | } 14 | void main() { 15 | vec4 xl_retval; 16 | xl_retval = xlat_main( ); 17 | gl_FragData[0] = vec4(xl_retval); 18 | } 19 | 20 | // uniforms: 21 | // _Color: type 12 arrsize 0 22 | -------------------------------------------------------------------------------- /tests/fragment-120/const-var-from-function-outES3.txt: -------------------------------------------------------------------------------- 1 | uniform mediump vec4 _Color; 2 | #line 3 3 | #line 3 4 | mediump vec4 xlat_main( ) { 5 | mediump float c1 = max( _Color.x, _Color.y); 6 | mediump float c2 = (_Color.z * _Color.w); 7 | #line 11 8 | highp float c3 = log2(16.0); 9 | highp float c4 = (-_Color.x); 10 | return vec4( c1, c2, c3, c4); 11 | } 12 | void main() { 13 | mediump vec4 xl_retval; 14 | xl_retval = xlat_main( ); 15 | gl_FragData[0] = vec4(xl_retval); 16 | } 17 | 18 | // uniforms: 19 | // _Color: type 12 arrsize 0 20 | -------------------------------------------------------------------------------- /tests/fragment-120/decl-multiple-in.txt: -------------------------------------------------------------------------------- 1 | half4 main (float4 c : TEXCOORD0) : COLOR0 2 | { 3 | // there was a crash bug in 'stackPos' declared like this 4 | int stack[64], stackPos = 0, node = 0; 5 | 6 | // test more variants 7 | float fltArrInit[] = {1,2,3,4}; 8 | float fltArrInit2[] = {1,2,3,4}, fltInit2 = 1.3, fltArrInit2a[5], fltArrInit2b[6] = {1,2,3,4,5,6}; 9 | float fltInit3 = 1.3, fltArrInit3[] = {1,2,3,4}, fltArrInit3a[5]; 10 | 11 | return c; 12 | } 13 | -------------------------------------------------------------------------------- /tests/fragment-120/decl-multiple-out.txt: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | #line 1 4 | vec4 xlat_main( in vec4 c ) { 5 | #line 4 6 | int stack[64]; 7 | int stackPos = 0; 8 | int node = 0; 9 | float[4] fltArrInit = float[4]( 1, 2, 3, 4); 10 | #line 8 11 | float[4] fltArrInit2 = float[4]( 1, 2, 3, 4); 12 | float fltInit2 = 1.3; 13 | float fltArrInit2a[5]; 14 | float[6] fltArrInit2b = float[6]( 1, 2, 3, 4, 5, 6); 15 | float fltInit3 = 1.3; 16 | float[4] fltArrInit3 = float[4]( 1, 2, 3, 4); 17 | float fltArrInit3a[5]; 18 | return c; 19 | } 20 | varying vec4 xlv_TEXCOORD0; 21 | void main() { 22 | vec4 xl_retval; 23 | xl_retval = xlat_main( vec4(xlv_TEXCOORD0)); 24 | gl_FragData[0] = vec4(xl_retval); 25 | } 26 | -------------------------------------------------------------------------------- /tests/fragment-120/decl-multiple-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | mediump vec4 xlat_main( in highp vec4 c ) { 4 | #line 4 5 | highp int stack[64]; 6 | highp int stackPos = 0; 7 | highp int node = 0; 8 | highp float[4] fltArrInit = float[4]( 1, 2, 3, 4); 9 | #line 8 10 | highp float[4] fltArrInit2 = float[4]( 1, 2, 3, 4); 11 | highp float fltInit2 = 1.3; 12 | highp float fltArrInit2a[5]; 13 | highp float[6] fltArrInit2b = float[6]( 1, 2, 3, 4, 5, 6); 14 | highp float fltInit3 = 1.3; 15 | highp float[4] fltArrInit3 = float[4]( 1, 2, 3, 4); 16 | highp float fltArrInit3a[5]; 17 | return c; 18 | } 19 | in highp vec4 xlv_TEXCOORD0; 20 | void main() { 21 | mediump vec4 xl_retval; 22 | xl_retval = xlat_main( vec4(xlv_TEXCOORD0)); 23 | gl_FragData[0] = vec4(xl_retval); 24 | } 25 | -------------------------------------------------------------------------------- /tests/fragment-120/matrix-in.txt: -------------------------------------------------------------------------------- 1 | void vec_upcast(float4 f) 2 | { 3 | } 4 | 5 | void vec_downcast(float2 f) 6 | { 7 | } 8 | 9 | float2 mat_downcast(float2x3 m) 10 | { 11 | float2x2 m22 = m; 12 | return m22[0].xx; 13 | } 14 | 15 | uniform float val; 16 | float4 main() : COLOR0 17 | { 18 | vec_upcast(float2(0)); 19 | vec_downcast(float4(1)); 20 | 21 | float4x4 m = val; 22 | float2x4 m2 = m; 23 | float2x2 m3 = m2; 24 | 25 | float2x2 m5 = m3 + m2; 26 | 27 | return float4(m[3] * mat_downcast(m2), 0, 0); 28 | } 29 | -------------------------------------------------------------------------------- /tests/fragment-120/uniforms-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "uniforms-in.txt" 2 | float uni1 : register(c0); 3 | uniform float uni2 : register(c1); 4 | 5 | float uniInit1 = 13.0; 6 | uniform float uniInit2 = 14.0; 7 | fixed4 main (float4 uv:TEXCOORD0, uniform float4 unicolor, uniform float4 reg : register(c2), uniform float4 lights[2]) : COLOR0 { 8 | return uv + unicolor + fixed4(uni1+uni2) + reg + lights[1] + uniInit1.xxxx + uniInit2.xxxx; 9 | } 10 | -------------------------------------------------------------------------------- /tests/fragment-failures/matrix-in.txt: -------------------------------------------------------------------------------- 1 | // uses non square matrices, should result in errors on GLSL 1.10 / ES 1.00 2 | 3 | void vec_upcast(float4 f) 4 | { 5 | } 6 | 7 | void vec_downcast(float2 f) 8 | { 9 | } 10 | 11 | float2 mat_downcast(float2x3 m) 12 | { 13 | return m[0].xx; 14 | } 15 | 16 | uniform float val; 17 | float4 main() : COLOR0 18 | { 19 | vec_upcast(float2(0)); 20 | vec_downcast(float4(1)); 21 | 22 | float4x4 m = val; 23 | float2x4 m2 = m; 24 | float2x2 m3 = m2; 25 | 26 | float2x2 m5 = m3 + m2; 27 | 28 | return float4(m[3] * mat_downcast(m2), 0, 0); 29 | } 30 | -------------------------------------------------------------------------------- /tests/fragment-failures/matrix-out.txt: -------------------------------------------------------------------------------- 1 | (11): ERROR: 'float2x3' : not supported in pre-GLSL1.20 2 | (23): ERROR: 'float2x4' : not supported in pre-GLSL1.20 3 | -------------------------------------------------------------------------------- /tests/fragment-failures/matrixnonsquare-in.txt: -------------------------------------------------------------------------------- 1 | // uses non square matrices, should result in errors on GLSL 1.10 / ES 1.00 2 | 3 | uniform float2x3 u23; 4 | uniform float4x3 u43; 5 | uniform float3x2 u32; 6 | 7 | float2 mat_downcast(float2x2 m) 8 | { 9 | return m[0].xx; 10 | } 11 | 12 | uniform float val; 13 | 14 | float4 main() : COLOR0 15 | { 16 | float4x4 m = val; 17 | float2x4 m2 = m; 18 | float2x2 m3 = m; 19 | float3x2 m4 = m; 20 | float3x3 m5 = m; 21 | 22 | return float4(m[3] * mat_downcast(m2), 0, 0); 23 | } 24 | -------------------------------------------------------------------------------- /tests/fragment-failures/matrixnonsquare-out.txt: -------------------------------------------------------------------------------- 1 | (3): ERROR: 'float2x3' : not supported in pre-GLSL1.20 2 | (4): ERROR: 'float4x3' : not supported in pre-GLSL1.20 3 | (5): ERROR: 'float3x2' : not supported in pre-GLSL1.20 4 | (17): ERROR: 'float2x4' : not supported in pre-GLSL1.20 5 | (19): ERROR: 'float3x2' : not supported in pre-GLSL1.20 6 | -------------------------------------------------------------------------------- /tests/fragment-failures/non-matching-type-init-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "non-matching-type-init-in.txt" 2 | uniform half4 _Color; 3 | 4 | half4 main() : COLOR0 5 | { 6 | const half r = _Color.rg; 7 | const half g = _Color.g; 8 | const half b = _Color.b; 9 | const half a = _Color.a; 10 | return half4(r, g, b, a); 11 | } 12 | -------------------------------------------------------------------------------- /tests/fragment-failures/non-matching-type-init-out.txt: -------------------------------------------------------------------------------- 1 | non-matching-type-init-in.txt(5): ERROR: 'const' : non-matching types for const initializer 2 | -------------------------------------------------------------------------------- /tests/fragment-failures/ops-shiftbitwise-in.txt: -------------------------------------------------------------------------------- 1 | // most of shifts and bitwise operations are errors in early 2 | // GLSL versions, so this should produce bunch of errors 3 | 4 | uniform bool ub; 5 | uniform bool4 ub4; 6 | uniform int ui; 7 | uniform int4 ui4; 8 | uniform float uf; 9 | uniform float4 uf4; 10 | 11 | 12 | fixed4 main() : COLOR0 13 | { 14 | bool b = !ub; 15 | 16 | int i = !ui; 17 | i = ~ui; 18 | i = i << 2; 19 | i = i >> 3; 20 | i <<= 4; 21 | i >>= 5; 22 | 23 | i %= 7; 24 | i &= 15; 25 | i ^= 3; 26 | i |= 15; 27 | 28 | int4 i4 = -ui4; 29 | i4 = ~ui4; 30 | i4 = i4 << 2; 31 | i4 = i4 >> 3; 32 | i4 <<= 4; 33 | i4 >>= 5; 34 | 35 | i4 %= 7; 36 | i4 &= 15; 37 | i4 ^= 3; 38 | i4 |= 15; 39 | 40 | float f = !uf; 41 | float4 f4 = !uf4; 42 | 43 | return 0.5; 44 | } 45 | -------------------------------------------------------------------------------- /tests/fragment-failures/pp-else-error-in.txt: -------------------------------------------------------------------------------- 1 | #if 1 2 | #else 1 3 | #endif 4 | float4 main() : COLOR { return 0; } 5 | -------------------------------------------------------------------------------- /tests/fragment-failures/pp-else-error-out.txt: -------------------------------------------------------------------------------- 1 | (2): ERROR: '' : Invalid #else directive 2 | (2): ERROR: '' : syntax error syntax error 3 | -------------------------------------------------------------------------------- /tests/fragment-failures/pp-if-error-in.txt: -------------------------------------------------------------------------------- 1 | #if 1 1 2 | #endif 3 | float4 main() : COLOR { return 0; } 4 | -------------------------------------------------------------------------------- /tests/fragment-failures/pp-if-error-out.txt: -------------------------------------------------------------------------------- 1 | (2): ERROR: '' : Invalid expression 2 | (2): ERROR: '' : syntax error syntax error 3 | -------------------------------------------------------------------------------- /tests/fragment-failures/pp-if-nonclosed-in.txt: -------------------------------------------------------------------------------- 1 | #if 1 2 | float4 main() : COLOR { return 0; } 3 | -------------------------------------------------------------------------------- /tests/fragment-failures/pp-if-nonclosed-out.txt: -------------------------------------------------------------------------------- 1 | (3): ERROR: '' : Unterminated #if 2 | -------------------------------------------------------------------------------- /tests/fragment-failures/pp-ifdef-error-in.txt: -------------------------------------------------------------------------------- 1 | #ifdef A B 2 | #endif 3 | float4 main() : COLOR { return 0; } 4 | -------------------------------------------------------------------------------- /tests/fragment-failures/pp-ifdef-error-out.txt: -------------------------------------------------------------------------------- 1 | (1): ERROR: '' : Invalid #ifdef directive 2 | (1): ERROR: '' : syntax error syntax error 3 | -------------------------------------------------------------------------------- /tests/fragment-failures/pp-redefinition-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "pp-redefinition-in.txt" 2 | #define x 1 3 | #define x 2 4 | float4 main() : COLOR { return 0; } 5 | -------------------------------------------------------------------------------- /tests/fragment-failures/pp-redefinition-out.txt: -------------------------------------------------------------------------------- 1 | pp-redefinition-in.txt(3): ERROR: '' : 'x' already defined 2 | pp-redefinition-in.txt(3): ERROR: '' : syntax error syntax error 3 | -------------------------------------------------------------------------------- /tests/fragment-failures/pp-redefinitionfile-in.txt: -------------------------------------------------------------------------------- 1 | #define __FILE__ 3 2 | float4 main() : COLOR { return 0; } 3 | -------------------------------------------------------------------------------- /tests/fragment-failures/pp-redefinitionfile-out.txt: -------------------------------------------------------------------------------- 1 | (2): ERROR: '' : '__FILE__' already defined 2 | (2): ERROR: '' : syntax error syntax error 3 | -------------------------------------------------------------------------------- /tests/fragment-failures/pp-redefinitionline-in.txt: -------------------------------------------------------------------------------- 1 | #define __LINE__ "wrong" 2 | 3 | float4 main() : COLOR { return 0; } 4 | -------------------------------------------------------------------------------- /tests/fragment-failures/pp-redefinitionline-out.txt: -------------------------------------------------------------------------------- 1 | (2): ERROR: '' : '__LINE__' already defined 2 | (2): ERROR: '' : syntax error syntax error 3 | -------------------------------------------------------------------------------- /tests/fragment-failures/pp-too-many-macro-args-in.txt: -------------------------------------------------------------------------------- 1 | // This should produce an error, not anything like "WRONG 7 )" 2 | #define x(a) a 3 | x(WRONG, 7) 4 | 5 | float4 main() : COLOR { return 0; } 6 | -------------------------------------------------------------------------------- /tests/fragment-failures/pp-too-many-macro-args-out.txt: -------------------------------------------------------------------------------- 1 | (3): ERROR: ')' : syntax error syntax error 2 | -------------------------------------------------------------------------------- /tests/fragment-failures/pp-undef-empty-in.txt: -------------------------------------------------------------------------------- 1 | #undef 2 | float4 main() : COLOR { return 0; } 3 | -------------------------------------------------------------------------------- /tests/fragment-failures/pp-undef-empty-out.txt: -------------------------------------------------------------------------------- 1 | (2): ERROR: '' : Macro names must be indentifiers 2 | (2): ERROR: '' : syntax error syntax error 3 | -------------------------------------------------------------------------------- /tests/fragment-failures/pp-undef-file-in.txt: -------------------------------------------------------------------------------- 1 | #undef __FILE__ 2 | float4 main() : COLOR { return 0; } 3 | -------------------------------------------------------------------------------- /tests/fragment-failures/pp-undef-file-out.txt: -------------------------------------------------------------------------------- 1 | (2): ERROR: '' : undefining "__FILE__" 2 | (2): ERROR: '' : syntax error syntax error 3 | -------------------------------------------------------------------------------- /tests/fragment-failures/pp-undef-filetwice-in.txt: -------------------------------------------------------------------------------- 1 | // this should only produce one warning. 2 | #undef __FILE__ 3 | #undef __FILE__ 4 | 5 | float4 main() : COLOR { return 0; } 6 | -------------------------------------------------------------------------------- /tests/fragment-failures/pp-undef-filetwice-out.txt: -------------------------------------------------------------------------------- 1 | (3): ERROR: '' : undefining "__FILE__" 2 | (3): ERROR: '' : syntax error syntax error 3 | -------------------------------------------------------------------------------- /tests/fragment-failures/pp-undef-line-in.txt: -------------------------------------------------------------------------------- 1 | #undef __LINE__ 2 | 3 | float4 main() : COLOR { return 0; } 4 | -------------------------------------------------------------------------------- /tests/fragment-failures/pp-undef-line-out.txt: -------------------------------------------------------------------------------- 1 | (2): ERROR: '' : undefining "__LINE__" 2 | (2): ERROR: '' : syntax error syntax error 3 | -------------------------------------------------------------------------------- /tests/fragment-failures/unknown-out-semantics-in.txt: -------------------------------------------------------------------------------- 1 | // pixel shader output with unknown semantics; 2 | // should report an error (used to generate invalid GLSL 3 | // code at some point) 4 | half4 main (float4 uv : TEXCOORD0) : SV_MYTARGET 5 | { 6 | return uv; 7 | } 8 | -------------------------------------------------------------------------------- /tests/fragment-failures/unknown-out-semantics-out.txt: -------------------------------------------------------------------------------- 1 | (1): ERROR: Unsupported return type for shader entry function (vec4) or wrong semantic (SV_MYTARGET) 2 | -------------------------------------------------------------------------------- /tests/fragment/array-const-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "array-const-in.txt" 2 | half4 main () : COLOR0 { 3 | float2 poisson[8] = { 4 | float2( 0.0, 0.0), 5 | float2( 0.527837,-0.085868), 6 | float2(-0.040088, 0.536087), 7 | float2(-0.670445,-0.179949), 8 | float2(-0.419418,-0.616039), 9 | float2( 0.440453,-0.639399), 10 | float2(-0.757088, 0.349334), 11 | float2( 0.574619, 0.685879), 12 | }; 13 | half4 c = 0; 14 | for (int i = 0; i < 8; ++i) 15 | c.xy += poisson[i]; 16 | return c; 17 | } 18 | -------------------------------------------------------------------------------- /tests/fragment/array-const-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | vec4 xlat_main( ) { 4 | #line 2 5 | vec2 poisson[8]; 6 | poisson[0] = vec2( 0.0, 0.0); 7 | poisson[1] = vec2( 0.527837, -0.085868); 8 | poisson[2] = vec2( -0.040088, 0.536087); 9 | poisson[3] = vec2( -0.670445, -0.179949); 10 | poisson[4] = vec2( -0.419418, -0.616039); 11 | poisson[5] = vec2( 0.440453, -0.639399); 12 | poisson[6] = vec2( -0.757088, 0.349334); 13 | poisson[7] = vec2( 0.574619, 0.685879); 14 | #line 12 15 | vec4 c = vec4( 0.0); 16 | int i = 0; 17 | for ( ; (i < 8); (++i)) { 18 | c.xy += poisson[i]; 19 | } 20 | return c; 21 | } 22 | void main() { 23 | vec4 xl_retval; 24 | xl_retval = xlat_main( ); 25 | gl_FragData[0] = vec4(xl_retval); 26 | } 27 | -------------------------------------------------------------------------------- /tests/fragment/array-const-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | mediump vec4 xlat_main( ) { 4 | #line 2 5 | highp vec2 poisson[8]; 6 | poisson[0] = vec2( 0.0, 0.0); 7 | poisson[1] = vec2( 0.527837, -0.085868); 8 | poisson[2] = vec2( -0.040088, 0.536087); 9 | poisson[3] = vec2( -0.670445, -0.179949); 10 | poisson[4] = vec2( -0.419418, -0.616039); 11 | poisson[5] = vec2( 0.440453, -0.639399); 12 | poisson[6] = vec2( -0.757088, 0.349334); 13 | poisson[7] = vec2( 0.574619, 0.685879); 14 | #line 12 15 | mediump vec4 c = vec4( 0.0); 16 | highp int i = 0; 17 | for ( ; (i < 8); (++i)) { 18 | c.xy += poisson[i]; 19 | } 20 | return c; 21 | } 22 | void main() { 23 | mediump vec4 xl_retval; 24 | xl_retval = xlat_main( ); 25 | gl_FragData[0] = vec4(xl_retval); 26 | } 27 | -------------------------------------------------------------------------------- /tests/fragment/array-const-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | mediump vec4 xlat_main( ) { 4 | #line 2 5 | highp vec2[8] poisson = vec2[8]( vec2( 0.0, 0.0), vec2( 0.527837, -0.085868), vec2( -0.040088, 0.536087), vec2( -0.670445, -0.179949), vec2( -0.419418, -0.616039), vec2( 0.440453, -0.639399), vec2( -0.757088, 0.349334), vec2( 0.574619, 0.685879)); 6 | #line 12 7 | mediump vec4 c = vec4( 0.0); 8 | highp int i = 0; 9 | for ( ; (i < 8); (++i)) { 10 | c.xy += poisson[i]; 11 | } 12 | return c; 13 | } 14 | void main() { 15 | mediump vec4 xl_retval; 16 | xl_retval = xlat_main( ); 17 | gl_FragData[0] = vec4(xl_retval); 18 | } 19 | -------------------------------------------------------------------------------- /tests/fragment/array-constconst-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "array-constconst-in.txt" 2 | half4 main () : COLOR0 { 3 | const float2 poisson[8] = { 4 | float2( 0.0, 0.0), 5 | float2( 0.527837,-0.085868), 6 | float2(-0.040088, 0.536087), 7 | float2(-0.670445,-0.179949), 8 | float2(-0.419418,-0.616039), 9 | float2( 0.440453,-0.639399), 10 | float2(-0.757088, 0.349334), 11 | float2( 0.574619, 0.685879), 12 | }; 13 | half4 c = 0; 14 | for (int i = 0; i < 8; ++i) 15 | c.xy += poisson[i]; 16 | return c; 17 | } 18 | -------------------------------------------------------------------------------- /tests/fragment/array-constconst-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | vec4 xlat_main( ) { 4 | #line 2 5 | vec2 poisson[8]; 6 | poisson[0] = vec2( 0.0, 0.0); 7 | poisson[1] = vec2( 0.527837, -0.085868); 8 | poisson[2] = vec2( -0.040088, 0.536087); 9 | poisson[3] = vec2( -0.670445, -0.179949); 10 | poisson[4] = vec2( -0.419418, -0.616039); 11 | poisson[5] = vec2( 0.440453, -0.639399); 12 | poisson[6] = vec2( -0.757088, 0.349334); 13 | poisson[7] = vec2( 0.574619, 0.685879); 14 | #line 12 15 | vec4 c = vec4( 0.0); 16 | int i = 0; 17 | for ( ; (i < 8); (++i)) { 18 | c.xy += poisson[i]; 19 | } 20 | return c; 21 | } 22 | void main() { 23 | vec4 xl_retval; 24 | xl_retval = xlat_main( ); 25 | gl_FragData[0] = vec4(xl_retval); 26 | } 27 | -------------------------------------------------------------------------------- /tests/fragment/array-constconst-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | mediump vec4 xlat_main( ) { 4 | #line 2 5 | highp vec2 poisson[8]; 6 | poisson[0] = vec2( 0.0, 0.0); 7 | poisson[1] = vec2( 0.527837, -0.085868); 8 | poisson[2] = vec2( -0.040088, 0.536087); 9 | poisson[3] = vec2( -0.670445, -0.179949); 10 | poisson[4] = vec2( -0.419418, -0.616039); 11 | poisson[5] = vec2( 0.440453, -0.639399); 12 | poisson[6] = vec2( -0.757088, 0.349334); 13 | poisson[7] = vec2( 0.574619, 0.685879); 14 | #line 12 15 | mediump vec4 c = vec4( 0.0); 16 | highp int i = 0; 17 | for ( ; (i < 8); (++i)) { 18 | c.xy += poisson[i]; 19 | } 20 | return c; 21 | } 22 | void main() { 23 | mediump vec4 xl_retval; 24 | xl_retval = xlat_main( ); 25 | gl_FragData[0] = vec4(xl_retval); 26 | } 27 | -------------------------------------------------------------------------------- /tests/fragment/array-constconst-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | mediump vec4 xlat_main( ) { 4 | #line 2 5 | const highp vec2[8] poisson = vec2[8]( vec2( 0.0, 0.0), vec2( 0.527837, -0.085868), vec2( -0.040088, 0.536087), vec2( -0.670445, -0.179949), vec2( -0.419418, -0.616039), vec2( 0.440453, -0.639399), vec2( -0.757088, 0.349334), vec2( 0.574619, 0.685879)); 6 | #line 12 7 | mediump vec4 c = vec4( 0.0); 8 | highp int i = 0; 9 | for ( ; (i < 8); (++i)) { 10 | c.xy += poisson[i]; 11 | } 12 | return c; 13 | } 14 | void main() { 15 | mediump vec4 xl_retval; 16 | xl_retval = xlat_main( ); 17 | gl_FragData[0] = vec4(xl_retval); 18 | } 19 | -------------------------------------------------------------------------------- /tests/fragment/array-globalconst-init-in.txt: -------------------------------------------------------------------------------- 1 | static const float lut1[3] = { 0.1, 0.2, 0.3 }; 2 | static const float2 lut2[] = { float2(0.1,0.2), float2(0.2,0.3) }; 3 | static const float4 lut4[1] = { float4(0.1,0.2,0.3,0.4) }; 4 | 5 | float4 main() : COLOR 6 | { 7 | float4 c = 0.0; 8 | for (int i = 0; i < 3; ++i) 9 | c.x += lut1[i]; 10 | for (int i = 0; i < 2; ++i) 11 | c.xy += lut2[i]; 12 | c += lut4[0]; 13 | return c; 14 | } 15 | -------------------------------------------------------------------------------- /tests/fragment/array-globalconst-init-out.txt: -------------------------------------------------------------------------------- 1 | float lut1[3]; 2 | vec2 lut2[2]; 3 | #line 3 4 | vec4 lut4[1]; 5 | #line 5 6 | vec4 xlat_main( ) { 7 | #line 7 8 | vec4 c = vec4( 0.0); 9 | int i = 0; 10 | for ( ; (i < 3); (++i)) { 11 | c.x += lut1[i]; 12 | } 13 | int i_1 = 0; 14 | for ( ; (i_1 < 2); (++i_1)) { 15 | c.xy += lut2[i_1]; 16 | } 17 | #line 12 18 | c += lut4[0]; 19 | return c; 20 | } 21 | void main() { 22 | lut1[0] = 0.1; 23 | lut1[1] = 0.2; 24 | lut1[2] = 0.3; 25 | lut2[0] = vec2( 0.1, 0.2); 26 | lut2[1] = vec2( 0.2, 0.3); 27 | lut4[0] = vec4( 0.1, 0.2, 0.3, 0.4); 28 | vec4 xl_retval; 29 | xl_retval = xlat_main( ); 30 | gl_FragData[0] = vec4(xl_retval); 31 | } 32 | -------------------------------------------------------------------------------- /tests/fragment/array-globalconst-init-outES.txt: -------------------------------------------------------------------------------- 1 | highp float lut1[3]; 2 | highp vec2 lut2[2]; 3 | #line 3 4 | highp vec4 lut4[1]; 5 | #line 5 6 | highp vec4 xlat_main( ) { 7 | #line 7 8 | highp vec4 c = vec4( 0.0); 9 | highp int i = 0; 10 | for ( ; (i < 3); (++i)) { 11 | c.x += lut1[i]; 12 | } 13 | highp int i_1 = 0; 14 | for ( ; (i_1 < 2); (++i_1)) { 15 | c.xy += lut2[i_1]; 16 | } 17 | #line 12 18 | c += lut4[0]; 19 | return c; 20 | } 21 | void main() { 22 | lut1[0] = 0.1; 23 | lut1[1] = 0.2; 24 | lut1[2] = 0.3; 25 | lut2[0] = vec2( 0.1, 0.2); 26 | lut2[1] = vec2( 0.2, 0.3); 27 | lut4[0] = vec4( 0.1, 0.2, 0.3, 0.4); 28 | highp vec4 xl_retval; 29 | xl_retval = xlat_main( ); 30 | gl_FragData[0] = vec4(xl_retval); 31 | } 32 | -------------------------------------------------------------------------------- /tests/fragment/array-globalconst-init-outES3.txt: -------------------------------------------------------------------------------- 1 | const highp float[3] lut1 = float[3]( 0.1, 0.2, 0.3); 2 | const highp vec2[2] lut2 = vec2[2]( vec2( 0.1, 0.2), vec2( 0.2, 0.3)); 3 | #line 3 4 | const highp vec4[1] lut4 = vec4[1]( vec4( 0.1, 0.2, 0.3, 0.4)); 5 | #line 5 6 | highp vec4 xlat_main( ) { 7 | #line 7 8 | highp vec4 c = vec4( 0.0); 9 | highp int i = 0; 10 | for ( ; (i < 3); (++i)) { 11 | c.x += lut1[i]; 12 | } 13 | highp int i_1 = 0; 14 | for ( ; (i_1 < 2); (++i_1)) { 15 | c.xy += lut2[i_1]; 16 | } 17 | #line 12 18 | c += lut4[0]; 19 | return c; 20 | } 21 | void main() { 22 | highp vec4 xl_retval; 23 | xl_retval = xlat_main( ); 24 | gl_FragData[0] = vec4(xl_retval); 25 | } 26 | -------------------------------------------------------------------------------- /tests/fragment/array-unsized-in.txt: -------------------------------------------------------------------------------- 1 | half4 main () : COLOR0 { 2 | float2 lut[] = { 3 | float2(-1, 0.1), 4 | float2(0, 0.5), 5 | float2(1, 0.1) 6 | }; 7 | half4 c = 0; 8 | for (int i = 0; i < 3; ++i) 9 | c.xy += lut[i]; 10 | return c; 11 | } 12 | -------------------------------------------------------------------------------- /tests/fragment/array-unsized-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | vec4 xlat_main( ) { 4 | vec2 lut[3]; 5 | lut[0] = vec2( -1.0, 0.1); 6 | lut[1] = vec2( 0.0, 0.5); 7 | lut[2] = vec2( 1.0, 0.1); 8 | #line 7 9 | vec4 c = vec4( 0.0); 10 | int i = 0; 11 | for ( ; (i < 3); (++i)) { 12 | c.xy += lut[i]; 13 | } 14 | return c; 15 | } 16 | void main() { 17 | vec4 xl_retval; 18 | xl_retval = xlat_main( ); 19 | gl_FragData[0] = vec4(xl_retval); 20 | } 21 | -------------------------------------------------------------------------------- /tests/fragment/array-unsized-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | mediump vec4 xlat_main( ) { 4 | highp vec2 lut[3]; 5 | lut[0] = vec2( -1.0, 0.1); 6 | lut[1] = vec2( 0.0, 0.5); 7 | lut[2] = vec2( 1.0, 0.1); 8 | #line 7 9 | mediump vec4 c = vec4( 0.0); 10 | highp int i = 0; 11 | for ( ; (i < 3); (++i)) { 12 | c.xy += lut[i]; 13 | } 14 | return c; 15 | } 16 | void main() { 17 | mediump vec4 xl_retval; 18 | xl_retval = xlat_main( ); 19 | gl_FragData[0] = vec4(xl_retval); 20 | } 21 | -------------------------------------------------------------------------------- /tests/fragment/array-unsized-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | mediump vec4 xlat_main( ) { 4 | highp vec2[3] lut = vec2[3]( vec2( -1.0, 0.1), vec2( 0.0, 0.5), vec2( 1.0, 0.1)); 5 | #line 7 6 | mediump vec4 c = vec4( 0.0); 7 | highp int i = 0; 8 | for ( ; (i < 3); (++i)) { 9 | c.xy += lut[i]; 10 | } 11 | return c; 12 | } 13 | void main() { 14 | mediump vec4 xl_retval; 15 | xl_retval = xlat_main( ); 16 | gl_FragData[0] = vec4(xl_retval); 17 | } 18 | -------------------------------------------------------------------------------- /tests/fragment/arrays-in.txt: -------------------------------------------------------------------------------- 1 | uniform float index; 2 | uniform float table[10]; 3 | float4 main() : COLOR0 4 | { 5 | return table[index]; 6 | } 7 | -------------------------------------------------------------------------------- /tests/fragment/arrays-out.txt: -------------------------------------------------------------------------------- 1 | uniform float index; 2 | uniform float table[10]; 3 | #line 3 4 | #line 3 5 | vec4 xlat_main( ) { 6 | return vec4( table[int(index)]); 7 | } 8 | void main() { 9 | vec4 xl_retval; 10 | xl_retval = xlat_main( ); 11 | gl_FragData[0] = vec4(xl_retval); 12 | } 13 | 14 | // uniforms: 15 | // index: type 9 arrsize 0 16 | // table: type 9 arrsize 10 17 | -------------------------------------------------------------------------------- /tests/fragment/arrays-outES.txt: -------------------------------------------------------------------------------- 1 | uniform highp float index; 2 | uniform highp float table[10]; 3 | #line 3 4 | #line 3 5 | highp vec4 xlat_main( ) { 6 | return vec4( table[int(index)]); 7 | } 8 | void main() { 9 | highp vec4 xl_retval; 10 | xl_retval = xlat_main( ); 11 | gl_FragData[0] = vec4(xl_retval); 12 | } 13 | 14 | // uniforms: 15 | // index: type 9 arrsize 0 16 | // table: type 9 arrsize 10 17 | -------------------------------------------------------------------------------- /tests/fragment/arrays-outES3.txt: -------------------------------------------------------------------------------- 1 | uniform highp float index; 2 | uniform highp float table[10]; 3 | #line 3 4 | #line 3 5 | highp vec4 xlat_main( ) { 6 | return vec4( table[int(index)]); 7 | } 8 | void main() { 9 | highp vec4 xl_retval; 10 | xl_retval = xlat_main( ); 11 | gl_FragData[0] = vec4(xl_retval); 12 | } 13 | 14 | // uniforms: 15 | // index: type 9 arrsize 0 16 | // table: type 9 arrsize 10 17 | -------------------------------------------------------------------------------- /tests/fragment/basic-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "basic-in.txt" 2 | half4 main() : COLOR0 { 3 | return 1.0; 4 | } 5 | -------------------------------------------------------------------------------- /tests/fragment/basic-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | vec4 xlat_main( ) { 4 | #line 2 5 | return vec4( 1.0); 6 | } 7 | void main() { 8 | vec4 xl_retval; 9 | xl_retval = xlat_main( ); 10 | gl_FragData[0] = vec4(xl_retval); 11 | } 12 | -------------------------------------------------------------------------------- /tests/fragment/basic-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | mediump vec4 xlat_main( ) { 4 | #line 2 5 | return vec4( 1.0); 6 | } 7 | void main() { 8 | mediump vec4 xl_retval; 9 | xl_retval = xlat_main( ); 10 | gl_FragData[0] = vec4(xl_retval); 11 | } 12 | -------------------------------------------------------------------------------- /tests/fragment/basic-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | mediump vec4 xlat_main( ) { 4 | #line 2 5 | return vec4( 1.0); 6 | } 7 | void main() { 8 | mediump vec4 xl_retval; 9 | xl_retval = xlat_main( ); 10 | gl_FragData[0] = vec4(xl_retval); 11 | } 12 | -------------------------------------------------------------------------------- /tests/fragment/bug-inout-color-anywhere-causes-framebuffer-fetch-in.txt: -------------------------------------------------------------------------------- 1 | // Used to have a bug where unused inout something with COLOR 2 | // semantic would kick in framebuffer fetch in the translated GLES 3 | // shader. 4 | 5 | struct v2f 6 | { 7 | float4 pos : SV_POSITION; 8 | fixed4 color : COLOR; 9 | float2 uv : TEXCOORD1; 10 | }; 11 | 12 | void unusedFunctionWithInOutCOLORSemantic (inout v2f o) 13 | { 14 | } 15 | 16 | half4 main (v2f i) : SV_Target 17 | { 18 | return i.uv.x; 19 | } 20 | -------------------------------------------------------------------------------- /tests/fragment/bug-inout-color-anywhere-causes-framebuffer-fetch-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 5 3 | struct v2f { 4 | vec4 pos; 5 | vec4 color; 6 | vec2 uv; 7 | }; 8 | #line 12 9 | #line 16 10 | #line 16 11 | vec4 xlat_main( in v2f i ) { 12 | return vec4( i.uv.x); 13 | } 14 | varying vec4 xlv_COLOR; 15 | varying vec2 xlv_TEXCOORD1; 16 | void main() { 17 | vec4 xl_retval; 18 | v2f xlt_i; 19 | xlt_i.pos = vec4(0.0); 20 | xlt_i.color = vec4(xlv_COLOR); 21 | xlt_i.uv = vec2(xlv_TEXCOORD1); 22 | xl_retval = xlat_main( xlt_i); 23 | gl_FragData[0] = vec4(xl_retval); 24 | } 25 | -------------------------------------------------------------------------------- /tests/fragment/bug-inout-color-anywhere-causes-framebuffer-fetch-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 5 3 | struct v2f { 4 | highp vec4 pos; 5 | lowp vec4 color; 6 | highp vec2 uv; 7 | }; 8 | #line 12 9 | #line 16 10 | #line 16 11 | mediump vec4 xlat_main( in v2f i ) { 12 | return vec4( i.uv.x); 13 | } 14 | varying lowp vec4 xlv_COLOR; 15 | varying highp vec2 xlv_TEXCOORD1; 16 | void main() { 17 | mediump vec4 xl_retval; 18 | v2f xlt_i; 19 | xlt_i.pos = vec4(0.0); 20 | xlt_i.color = vec4(xlv_COLOR); 21 | xlt_i.uv = vec2(xlv_TEXCOORD1); 22 | xl_retval = xlat_main( xlt_i); 23 | gl_FragData[0] = vec4(xl_retval); 24 | } 25 | -------------------------------------------------------------------------------- /tests/fragment/bug-inout-color-anywhere-causes-framebuffer-fetch-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 5 3 | struct v2f { 4 | highp vec4 pos; 5 | lowp vec4 color; 6 | highp vec2 uv; 7 | }; 8 | #line 12 9 | #line 16 10 | #line 16 11 | mediump vec4 xlat_main( in v2f i ) { 12 | return vec4( i.uv.x); 13 | } 14 | in lowp vec4 xlv_COLOR; 15 | in highp vec2 xlv_TEXCOORD1; 16 | void main() { 17 | mediump vec4 xl_retval; 18 | v2f xlt_i; 19 | xlt_i.pos = vec4(0.0); 20 | xlt_i.color = vec4(xlv_COLOR); 21 | xlt_i.uv = vec2(xlv_TEXCOORD1); 22 | xl_retval = xlat_main( xlt_i); 23 | gl_FragData[0] = vec4(xl_retval); 24 | } 25 | -------------------------------------------------------------------------------- /tests/fragment/const-float-from-int-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "const-float-from-int-in.txt" 2 | half4 main() : COLOR0 3 | { 4 | const half f = 1; 5 | return half4(f, f, f, f); 6 | } 7 | -------------------------------------------------------------------------------- /tests/fragment/const-float-from-int-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | vec4 xlat_main( ) { 4 | #line 3 5 | const float f = 1.0; 6 | return vec4( 1.0, 1.0, 1.0, 1.0); 7 | } 8 | void main() { 9 | vec4 xl_retval; 10 | xl_retval = xlat_main( ); 11 | gl_FragData[0] = vec4(xl_retval); 12 | } 13 | -------------------------------------------------------------------------------- /tests/fragment/const-float-from-int-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | mediump vec4 xlat_main( ) { 4 | #line 3 5 | const mediump float f = 1.0; 6 | return vec4( 1.0, 1.0, 1.0, 1.0); 7 | } 8 | void main() { 9 | mediump vec4 xl_retval; 10 | xl_retval = xlat_main( ); 11 | gl_FragData[0] = vec4(xl_retval); 12 | } 13 | -------------------------------------------------------------------------------- /tests/fragment/const-float-from-int-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | mediump vec4 xlat_main( ) { 4 | #line 3 5 | const mediump float f = 1.0; 6 | return vec4( 1.0, 1.0, 1.0, 1.0); 7 | } 8 | void main() { 9 | mediump vec4 xl_retval; 10 | xl_retval = xlat_main( ); 11 | gl_FragData[0] = vec4(xl_retval); 12 | } 13 | -------------------------------------------------------------------------------- /tests/fragment/const-global-matrix-init-in.txt: -------------------------------------------------------------------------------- 1 | 2 | const static float3x3 unity_DirBasis = float3x3( 3 | float3( 0.81649658, 0.0, 0.57735028), 4 | float3(-0.40824830, 0.70710679, 0.57735027), 5 | float3(-0.40824829, -0.70710678, 0.57735026) 6 | ); 7 | 8 | inline half4 DirLM (fixed3 scale, fixed3 normal) 9 | { 10 | half3 normalInDirBasis = saturate (mul (unity_DirBasis, normal)); 11 | float f = dot (normalInDirBasis, scale); 12 | return f; 13 | } 14 | 15 | sampler2D mytex; 16 | 17 | fixed4 main (half2 uv : TEXCOORD0, fixed3 normal : TEXCOORD1) : COLOR 18 | { 19 | fixed3 scale = tex2D(mytex, uv).rgb; 20 | return DirLM (scale, normal); 21 | } 22 | -------------------------------------------------------------------------------- /tests/fragment/const-matrix-init-in.txt: -------------------------------------------------------------------------------- 1 | 2 | #define UNITY_DIRBASIS \ 3 | const float3x3 unity_DirBasis = float3x3( \ 4 | float3( 0.81649658, 0.0, 0.57735028), \ 5 | float3(-0.40824830, 0.70710679, 0.57735027), \ 6 | float3(-0.40824829, -0.70710678, 0.57735026) \ 7 | ); 8 | 9 | inline half4 DirLM (fixed3 scale, fixed3 normal) 10 | { 11 | UNITY_DIRBASIS 12 | half3 normalInDirBasis = saturate (mul (unity_DirBasis, normal)); 13 | float f = dot (normalInDirBasis, scale); 14 | return f; 15 | } 16 | 17 | sampler2D mytex; 18 | 19 | fixed4 main (half2 uv : TEXCOORD0, fixed3 normal : TEXCOORD1) : COLOR 20 | { 21 | fixed3 scale = tex2D(mytex, uv).rgb; 22 | return DirLM (scale, normal); 23 | } 24 | -------------------------------------------------------------------------------- /tests/fragment/const-var-from-function-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "const-var-from-function-in.txt" 2 | uniform half4 _Color; 3 | 4 | half4 main() : COLOR0 5 | { 6 | // all these, c1..c4 should be turned into non-const 7 | const half c1 = max(_Color.r, _Color.g); 8 | const half c2 = _Color.b * _Color.a; 9 | const float c3 = log2(4 * 4); 10 | const float c4 = -_Color.r; 11 | return half4(c1, c2, c3, c4); 12 | } 13 | -------------------------------------------------------------------------------- /tests/fragment/const-var-from-function-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | uniform vec4 _Color; 4 | #line 3 5 | vec4 xlat_main( ) { 6 | #line 6 7 | float c1 = max( _Color.x, _Color.y); 8 | float c2 = (_Color.z * _Color.w); 9 | float c3 = log2(16.0); 10 | float c4 = (-_Color.x); 11 | #line 10 12 | return vec4( c1, c2, c3, c4); 13 | } 14 | void main() { 15 | vec4 xl_retval; 16 | xl_retval = xlat_main( ); 17 | gl_FragData[0] = vec4(xl_retval); 18 | } 19 | 20 | // uniforms: 21 | // _Color: type 12 arrsize 0 22 | -------------------------------------------------------------------------------- /tests/fragment/const-var-from-function-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | uniform mediump vec4 _Color; 4 | #line 3 5 | mediump vec4 xlat_main( ) { 6 | #line 6 7 | mediump float c1 = max( _Color.x, _Color.y); 8 | mediump float c2 = (_Color.z * _Color.w); 9 | highp float c3 = log2(16.0); 10 | highp float c4 = (-_Color.x); 11 | #line 10 12 | return vec4( c1, c2, c3, c4); 13 | } 14 | void main() { 15 | mediump vec4 xl_retval; 16 | xl_retval = xlat_main( ); 17 | gl_FragData[0] = vec4(xl_retval); 18 | } 19 | 20 | // uniforms: 21 | // _Color: type 12 arrsize 0 22 | -------------------------------------------------------------------------------- /tests/fragment/const-var-from-function-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | uniform mediump vec4 _Color; 4 | #line 3 5 | mediump vec4 xlat_main( ) { 6 | #line 6 7 | mediump float c1 = max( _Color.x, _Color.y); 8 | mediump float c2 = (_Color.z * _Color.w); 9 | highp float c3 = log2(16.0); 10 | highp float c4 = (-_Color.x); 11 | #line 10 12 | return vec4( c1, c2, c3, c4); 13 | } 14 | void main() { 15 | mediump vec4 xl_retval; 16 | xl_retval = xlat_main( ); 17 | gl_FragData[0] = vec4(xl_retval); 18 | } 19 | 20 | // uniforms: 21 | // _Color: type 12 arrsize 0 22 | -------------------------------------------------------------------------------- /tests/fragment/const-var-from-struct-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "const-var-from-struct-in.txt" 2 | uniform half4 _Color; 3 | 4 | half4 main() : COLOR0 5 | { 6 | const half r = _Color.r; 7 | const half g = _Color.g; 8 | const half b = _Color.b; 9 | const half a = _Color.a; 10 | return half4(r, g, b, a); 11 | } 12 | -------------------------------------------------------------------------------- /tests/fragment/const-var-from-struct-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | uniform vec4 _Color; 4 | #line 3 5 | vec4 xlat_main( ) { 6 | #line 5 7 | float r = _Color.x; 8 | float g = _Color.y; 9 | float b = _Color.z; 10 | float a = _Color.w; 11 | #line 9 12 | return vec4( r, g, b, a); 13 | } 14 | void main() { 15 | vec4 xl_retval; 16 | xl_retval = xlat_main( ); 17 | gl_FragData[0] = vec4(xl_retval); 18 | } 19 | 20 | // uniforms: 21 | // _Color: type 12 arrsize 0 22 | -------------------------------------------------------------------------------- /tests/fragment/const-var-from-struct-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | uniform mediump vec4 _Color; 4 | #line 3 5 | mediump vec4 xlat_main( ) { 6 | #line 5 7 | mediump float r = _Color.x; 8 | mediump float g = _Color.y; 9 | mediump float b = _Color.z; 10 | mediump float a = _Color.w; 11 | #line 9 12 | return vec4( r, g, b, a); 13 | } 14 | void main() { 15 | mediump vec4 xl_retval; 16 | xl_retval = xlat_main( ); 17 | gl_FragData[0] = vec4(xl_retval); 18 | } 19 | 20 | // uniforms: 21 | // _Color: type 12 arrsize 0 22 | -------------------------------------------------------------------------------- /tests/fragment/const-var-from-struct-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | uniform mediump vec4 _Color; 4 | #line 3 5 | mediump vec4 xlat_main( ) { 6 | #line 5 7 | mediump float r = _Color.x; 8 | mediump float g = _Color.y; 9 | mediump float b = _Color.z; 10 | mediump float a = _Color.w; 11 | #line 9 12 | return vec4( r, g, b, a); 13 | } 14 | void main() { 15 | mediump vec4 xl_retval; 16 | xl_retval = xlat_main( ); 17 | gl_FragData[0] = vec4(xl_retval); 18 | } 19 | 20 | // uniforms: 21 | // _Color: type 12 arrsize 0 22 | -------------------------------------------------------------------------------- /tests/fragment/const-var-from-var-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "const-var-from-var-in.txt" 2 | uniform half4 _Color; 3 | 4 | half4 main() : COLOR0 5 | { 6 | const half4 c = _Color; 7 | return c; 8 | } 9 | -------------------------------------------------------------------------------- /tests/fragment/const-var-from-var-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | uniform vec4 _Color; 4 | #line 3 5 | vec4 xlat_main( ) { 6 | #line 5 7 | vec4 c = _Color; 8 | return c; 9 | } 10 | void main() { 11 | vec4 xl_retval; 12 | xl_retval = xlat_main( ); 13 | gl_FragData[0] = vec4(xl_retval); 14 | } 15 | 16 | // uniforms: 17 | // _Color: type 12 arrsize 0 18 | -------------------------------------------------------------------------------- /tests/fragment/const-var-from-var-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | uniform mediump vec4 _Color; 4 | #line 3 5 | mediump vec4 xlat_main( ) { 6 | #line 5 7 | mediump vec4 c = _Color; 8 | return c; 9 | } 10 | void main() { 11 | mediump vec4 xl_retval; 12 | xl_retval = xlat_main( ); 13 | gl_FragData[0] = vec4(xl_retval); 14 | } 15 | 16 | // uniforms: 17 | // _Color: type 12 arrsize 0 18 | -------------------------------------------------------------------------------- /tests/fragment/const-var-from-var-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | uniform mediump vec4 _Color; 4 | #line 3 5 | mediump vec4 xlat_main( ) { 6 | #line 5 7 | mediump vec4 c = _Color; 8 | return c; 9 | } 10 | void main() { 11 | mediump vec4 xl_retval; 12 | xl_retval = xlat_main( ); 13 | gl_FragData[0] = vec4(xl_retval); 14 | } 15 | 16 | // uniforms: 17 | // _Color: type 12 arrsize 0 18 | -------------------------------------------------------------------------------- /tests/fragment/derivatives-in.txt: -------------------------------------------------------------------------------- 1 | half4 main (float4 uv : TEXCOORD0) : COLOR0 { 2 | fixed4 res; 3 | res.x = ddx(uv.x); 4 | res.y = ddx(uv.y); 5 | res.z = fwidth(uv.z); 6 | res.w = 1.0; 7 | return res; 8 | } 9 | -------------------------------------------------------------------------------- /tests/fragment/fragdepth-in.txt: -------------------------------------------------------------------------------- 1 | void main (out fixed4 ocol : COLOR0, out half oz : DEPTH) 2 | { 3 | ocol = 0.5; 4 | oz = 0.9; 5 | } 6 | -------------------------------------------------------------------------------- /tests/fragment/fragdepth-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | void xlat_main( out vec4 ocol, out float oz ) { 4 | #line 3 5 | ocol = vec4( 0.5); 6 | oz = 0.9; 7 | } 8 | void main() { 9 | vec4 xlt_ocol; 10 | float xlt_oz; 11 | xlat_main( xlt_ocol, xlt_oz); 12 | gl_FragData[0] = vec4(xlt_ocol); 13 | gl_FragDepth = float(xlt_oz); 14 | ; 15 | } 16 | -------------------------------------------------------------------------------- /tests/fragment/fragdepth-outES.txt: -------------------------------------------------------------------------------- 1 | #extension GL_EXT_frag_depth : require 2 | 3 | #line 1 4 | void xlat_main( out lowp vec4 ocol, out mediump float oz ) { 5 | #line 3 6 | ocol = vec4( 0.5); 7 | oz = 0.9; 8 | } 9 | void main() { 10 | lowp vec4 xlt_ocol; 11 | mediump float xlt_oz; 12 | xlat_main( xlt_ocol, xlt_oz); 13 | gl_FragData[0] = vec4(xlt_ocol); 14 | gl_FragDepthEXT = float(xlt_oz); 15 | ; 16 | } 17 | -------------------------------------------------------------------------------- /tests/fragment/fragdepth-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | void xlat_main( out lowp vec4 ocol, out mediump float oz ) { 4 | #line 3 5 | ocol = vec4( 0.5); 6 | oz = 0.9; 7 | } 8 | void main() { 9 | lowp vec4 xlt_ocol; 10 | mediump float xlt_oz; 11 | xlat_main( xlt_ocol, xlt_oz); 12 | gl_FragData[0] = vec4(xlt_ocol); 13 | gl_FragDepth = float(xlt_oz); 14 | ; 15 | } 16 | -------------------------------------------------------------------------------- /tests/fragment/framebuffer_fetch-in.txt: -------------------------------------------------------------------------------- 1 | void main (float4 col : TEXCOORD0, inout half4 fragColor : COLOR0) 2 | { 3 | fragColor.r = col.r; 4 | fragColor.g *= 2.0; 5 | } 6 | -------------------------------------------------------------------------------- /tests/fragment/framebuffer_fetch-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | void xlat_main( in vec4 col, inout vec4 fragColor ) { 4 | #line 3 5 | fragColor.x = col.x; 6 | fragColor.y *= 2.0; 7 | } 8 | varying vec4 xlv_TEXCOORD0; 9 | varying vec4 xlv_COLOR0; 10 | void main() { 11 | vec4 xlt_fragColor = vec4(xlv_COLOR0); 12 | xlat_main( vec4(xlv_TEXCOORD0), xlt_fragColor); 13 | gl_FragData[0] = vec4(xlt_fragColor); 14 | ; 15 | } 16 | -------------------------------------------------------------------------------- /tests/fragment/framebuffer_fetch-outES.txt: -------------------------------------------------------------------------------- 1 | #extension GL_EXT_shader_framebuffer_fetch : require 2 | 3 | #line 1 4 | void xlat_main( in highp vec4 col, inout mediump vec4 fragColor ) { 5 | #line 3 6 | fragColor.x = col.x; 7 | fragColor.y *= 2.0; 8 | } 9 | varying highp vec4 xlv_TEXCOORD0; 10 | void main() { 11 | mediump vec4 xlt_fragColor = vec4(gl_LastFragData[0]); 12 | xlat_main( vec4(xlv_TEXCOORD0), xlt_fragColor); 13 | gl_FragData[0] = vec4(xlt_fragColor); 14 | ; 15 | } 16 | -------------------------------------------------------------------------------- /tests/fragment/framebuffer_fetch-outES3.txt: -------------------------------------------------------------------------------- 1 | #extension GL_EXT_shader_framebuffer_fetch : require 2 | 3 | #line 1 4 | void xlat_main( in highp vec4 col, inout mediump vec4 fragColor ) { 5 | #line 3 6 | fragColor.x = col.x; 7 | fragColor.y *= 2.0; 8 | } 9 | in highp vec4 xlv_TEXCOORD0; 10 | void main() { 11 | mediump vec4 xlt_fragColor = vec4(gl_FragData[0]); 12 | xlat_main( vec4(xlv_TEXCOORD0), xlt_fragColor); 13 | gl_FragData[0] = vec4(xlt_fragColor); 14 | ; 15 | } 16 | -------------------------------------------------------------------------------- /tests/fragment/in-struct-ret-vals-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "in-struct-ret-vals-in.txt" 2 | struct v2f { 3 | float4 pos : POSITION; 4 | float2 uv : TEXCOORD0; 5 | float4 color : COLOR; 6 | }; 7 | 8 | half4 main (v2f i) : COLOR 9 | { 10 | half4 c; 11 | c = i.color; 12 | c.rg += i.uv; 13 | return c; 14 | } 15 | -------------------------------------------------------------------------------- /tests/fragment/in-struct-ret-vals-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | struct v2f { 4 | vec4 pos; 5 | vec2 uv; 6 | vec4 color; 7 | }; 8 | #line 7 9 | #line 7 10 | vec4 xlat_main( in v2f i ) { 11 | vec4 c; 12 | c = i.color; 13 | #line 11 14 | c.xy += i.uv; 15 | return c; 16 | } 17 | varying vec2 xlv_TEXCOORD0; 18 | varying vec4 xlv_COLOR; 19 | void main() { 20 | vec4 xl_retval; 21 | v2f xlt_i; 22 | xlt_i.pos = vec4(0.0); 23 | xlt_i.uv = vec2(xlv_TEXCOORD0); 24 | xlt_i.color = vec4(xlv_COLOR); 25 | xl_retval = xlat_main( xlt_i); 26 | gl_FragData[0] = vec4(xl_retval); 27 | } 28 | -------------------------------------------------------------------------------- /tests/fragment/in-struct-ret-vals-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | struct v2f { 4 | highp vec4 pos; 5 | highp vec2 uv; 6 | highp vec4 color; 7 | }; 8 | #line 7 9 | #line 7 10 | mediump vec4 xlat_main( in v2f i ) { 11 | mediump vec4 c; 12 | c = i.color; 13 | #line 11 14 | c.xy += i.uv; 15 | return c; 16 | } 17 | varying highp vec2 xlv_TEXCOORD0; 18 | varying highp vec4 xlv_COLOR; 19 | void main() { 20 | mediump vec4 xl_retval; 21 | v2f xlt_i; 22 | xlt_i.pos = vec4(0.0); 23 | xlt_i.uv = vec2(xlv_TEXCOORD0); 24 | xlt_i.color = vec4(xlv_COLOR); 25 | xl_retval = xlat_main( xlt_i); 26 | gl_FragData[0] = vec4(xl_retval); 27 | } 28 | -------------------------------------------------------------------------------- /tests/fragment/in-struct-ret-vals-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | struct v2f { 4 | highp vec4 pos; 5 | highp vec2 uv; 6 | highp vec4 color; 7 | }; 8 | #line 7 9 | #line 7 10 | mediump vec4 xlat_main( in v2f i ) { 11 | mediump vec4 c; 12 | c = i.color; 13 | #line 11 14 | c.xy += i.uv; 15 | return c; 16 | } 17 | in highp vec2 xlv_TEXCOORD0; 18 | in highp vec4 xlv_COLOR; 19 | void main() { 20 | mediump vec4 xl_retval; 21 | v2f xlt_i; 22 | xlt_i.pos = vec4(0.0); 23 | xlt_i.uv = vec2(xlv_TEXCOORD0); 24 | xlt_i.color = vec4(xlv_COLOR); 25 | xl_retval = xlat_main( xlt_i); 26 | gl_FragData[0] = vec4(xl_retval); 27 | } 28 | -------------------------------------------------------------------------------- /tests/fragment/in-vals-ret-vals-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "in-vals-ret-vals-in.txt" 2 | half4 main ( 3 | float2 uv : TEXCOORD0, 4 | float4 color : COLOR 5 | ) : COLOR 6 | { 7 | half4 c; 8 | c = color; 9 | c.rg += uv; 10 | return c; 11 | } 12 | -------------------------------------------------------------------------------- /tests/fragment/in-vals-ret-vals-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 4 3 | vec4 xlat_main( in vec2 uv, in vec4 color ) { 4 | #line 6 5 | vec4 c; 6 | c = color; 7 | c.xy += uv; 8 | return c; 9 | } 10 | varying vec2 xlv_TEXCOORD0; 11 | varying vec4 xlv_COLOR; 12 | void main() { 13 | vec4 xl_retval; 14 | xl_retval = xlat_main( vec2(xlv_TEXCOORD0), vec4(xlv_COLOR)); 15 | gl_FragData[0] = vec4(xl_retval); 16 | } 17 | -------------------------------------------------------------------------------- /tests/fragment/in-vals-ret-vals-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 4 3 | mediump vec4 xlat_main( in highp vec2 uv, in highp vec4 color ) { 4 | #line 6 5 | mediump vec4 c; 6 | c = color; 7 | c.xy += uv; 8 | return c; 9 | } 10 | varying highp vec2 xlv_TEXCOORD0; 11 | varying highp vec4 xlv_COLOR; 12 | void main() { 13 | mediump vec4 xl_retval; 14 | xl_retval = xlat_main( vec2(xlv_TEXCOORD0), vec4(xlv_COLOR)); 15 | gl_FragData[0] = vec4(xl_retval); 16 | } 17 | -------------------------------------------------------------------------------- /tests/fragment/in-vals-ret-vals-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 4 3 | mediump vec4 xlat_main( in highp vec2 uv, in highp vec4 color ) { 4 | #line 6 5 | mediump vec4 c; 6 | c = color; 7 | c.xy += uv; 8 | return c; 9 | } 10 | in highp vec2 xlv_TEXCOORD0; 11 | in highp vec4 xlv_COLOR; 12 | void main() { 13 | mediump vec4 xl_retval; 14 | xl_retval = xlat_main( vec2(xlv_TEXCOORD0), vec4(xlv_COLOR)); 15 | gl_FragData[0] = vec4(xl_retval); 16 | } 17 | -------------------------------------------------------------------------------- /tests/fragment/loops-empty-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "loops-empty-in.txt" 2 | half4 main() : COLOR0 { 3 | for (int i = 0; i < 10; ++i) { 4 | } 5 | int j = 0; 6 | while (j++ < 10) { 7 | } 8 | do { 9 | } while (j-- > 0); 10 | return 1.0; 11 | } 12 | -------------------------------------------------------------------------------- /tests/fragment/loops-empty-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | vec4 xlat_main( ) { 4 | #line 2 5 | int i = 0; 6 | for ( ; (i < 10); (++i)) { 7 | } 8 | int j = 0; 9 | while ( ((j++) < 10) ) { 10 | } 11 | #line 8 12 | do { 13 | } 14 | while ( ((j--) > 0) ) 15 | ; 16 | return vec4( 1.0); 17 | } 18 | void main() { 19 | vec4 xl_retval; 20 | xl_retval = xlat_main( ); 21 | gl_FragData[0] = vec4(xl_retval); 22 | } 23 | -------------------------------------------------------------------------------- /tests/fragment/loops-empty-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | mediump vec4 xlat_main( ) { 4 | #line 2 5 | highp int i = 0; 6 | for ( ; (i < 10); (++i)) { 7 | } 8 | highp int j = 0; 9 | while ( ((j++) < 10) ) { 10 | } 11 | #line 8 12 | do { 13 | } 14 | while ( ((j--) > 0) ) 15 | ; 16 | return vec4( 1.0); 17 | } 18 | void main() { 19 | mediump vec4 xl_retval; 20 | xl_retval = xlat_main( ); 21 | gl_FragData[0] = vec4(xl_retval); 22 | } 23 | -------------------------------------------------------------------------------- /tests/fragment/loops-empty-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | mediump vec4 xlat_main( ) { 4 | #line 2 5 | highp int i = 0; 6 | for ( ; (i < 10); (++i)) { 7 | } 8 | highp int j = 0; 9 | while ( ((j++) < 10) ) { 10 | } 11 | #line 8 12 | do { 13 | } 14 | while ( ((j--) > 0) ) 15 | ; 16 | return vec4( 1.0); 17 | } 18 | void main() { 19 | mediump vec4 xl_retval; 20 | xl_retval = xlat_main( ); 21 | gl_FragData[0] = vec4(xl_retval); 22 | } 23 | -------------------------------------------------------------------------------- /tests/fragment/matrix-ops-in.txt: -------------------------------------------------------------------------------- 1 | float _Speed; 2 | float4 _Time; 3 | float4x4 _MVP; 4 | float4 main(float2 uv : TEXCOORD0) : SV_Target 5 | { 6 | float s = sin(_Speed * _Time.x); 7 | float c = cos(_Speed * _Time.x); 8 | float2x2 rotationMatrix = float2x2(c, -s, s, c); 9 | rotationMatrix = rotationMatrix * 2 - 1; 10 | float3 elems1 = _MVP._41_42_43; 11 | float3 elems2 = _MVP[3].xyz; 12 | return float4(mul(rotationMatrix, uv), dot(elems1,elems2), 0); 13 | } 14 | -------------------------------------------------------------------------------- /tests/fragment/mrt-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "mrt-in.txt" 2 | half4 main (out half4 c1 : COLOR1, out float4 c2 : COLOR2, out half4 c3 : COLOR3) : COLOR0 3 | { 4 | c1 = 1.0; 5 | c2 = 0.5; 6 | c3 = half4(1,2,3,4); 7 | return 2.0; 8 | } 9 | -------------------------------------------------------------------------------- /tests/fragment/mrt-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | vec4 xlat_main( out vec4 c1, out vec4 c2, out vec4 c3 ) { 4 | #line 3 5 | c1 = vec4( 1.0); 6 | c2 = vec4( 0.5); 7 | c3 = vec4( 1.0, 2.0, 3.0, 4.0); 8 | return vec4( 2.0); 9 | } 10 | void main() { 11 | vec4 xl_retval; 12 | vec4 xlt_c1; 13 | vec4 xlt_c2; 14 | vec4 xlt_c3; 15 | xl_retval = xlat_main( xlt_c1, xlt_c2, xlt_c3); 16 | gl_FragData[1] = vec4(xlt_c1); 17 | gl_FragData[2] = vec4(xlt_c2); 18 | gl_FragData[3] = vec4(xlt_c3); 19 | gl_FragData[0] = vec4(xl_retval); 20 | } 21 | -------------------------------------------------------------------------------- /tests/fragment/mrt-outES.txt: -------------------------------------------------------------------------------- 1 | #extension GL_EXT_draw_buffers : require 2 | 3 | #line 1 4 | mediump vec4 xlat_main( out mediump vec4 c1, out highp vec4 c2, out mediump vec4 c3 ) { 5 | #line 3 6 | c1 = vec4( 1.0); 7 | c2 = vec4( 0.5); 8 | c3 = vec4( 1.0, 2.0, 3.0, 4.0); 9 | return vec4( 2.0); 10 | } 11 | void main() { 12 | mediump vec4 xl_retval; 13 | mediump vec4 xlt_c1; 14 | highp vec4 xlt_c2; 15 | mediump vec4 xlt_c3; 16 | xl_retval = xlat_main( xlt_c1, xlt_c2, xlt_c3); 17 | gl_FragData[1] = vec4(xlt_c1); 18 | gl_FragData[2] = vec4(xlt_c2); 19 | gl_FragData[3] = vec4(xlt_c3); 20 | gl_FragData[0] = vec4(xl_retval); 21 | } 22 | -------------------------------------------------------------------------------- /tests/fragment/mrt-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | mediump vec4 xlat_main( out mediump vec4 c1, out highp vec4 c2, out mediump vec4 c3 ) { 4 | #line 3 5 | c1 = vec4( 1.0); 6 | c2 = vec4( 0.5); 7 | c3 = vec4( 1.0, 2.0, 3.0, 4.0); 8 | return vec4( 2.0); 9 | } 10 | void main() { 11 | mediump vec4 xl_retval; 12 | mediump vec4 xlt_c1; 13 | highp vec4 xlt_c2; 14 | mediump vec4 xlt_c3; 15 | xl_retval = xlat_main( xlt_c1, xlt_c2, xlt_c3); 16 | gl_FragData[1] = vec4(xlt_c1); 17 | gl_FragData[2] = vec4(xlt_c2); 18 | gl_FragData[3] = vec4(xlt_c3); 19 | gl_FragData[0] = vec4(xl_retval); 20 | } 21 | -------------------------------------------------------------------------------- /tests/fragment/overloading-in.txt: -------------------------------------------------------------------------------- 1 | uniform float3 uniColor1; 2 | uniform float3 uniColor2; 3 | uniform float uniFactor; 4 | 5 | float4 main() : COLOR0 6 | { 7 | float3 col = lerp(0.5, uniColor2, uniFactor); // should upcast 0.5 and uniFactor to float3 8 | float4 outcol = float4(col, 1); 9 | return lerp(0.5, float3(1), outcol); // should upcast to float4 10 | } 11 | -------------------------------------------------------------------------------- /tests/fragment/overloading-out.txt: -------------------------------------------------------------------------------- 1 | uniform vec3 uniColor1; 2 | uniform vec3 uniColor2; 3 | #line 3 4 | uniform float uniFactor; 5 | #line 5 6 | vec4 xlat_main( ) { 7 | #line 7 8 | vec3 col = mix( vec3( 0.5), uniColor2, vec3( uniFactor)); 9 | vec4 outcol = vec4( col, 1.0); 10 | return mix( vec4( 0.5), vec4( vec3( 1.0), 0.0), outcol); 11 | } 12 | void main() { 13 | vec4 xl_retval; 14 | xl_retval = xlat_main( ); 15 | gl_FragData[0] = vec4(xl_retval); 16 | } 17 | 18 | // uniforms: 19 | // uniColor2: type 11 arrsize 0 20 | // uniFactor: type 9 arrsize 0 21 | -------------------------------------------------------------------------------- /tests/fragment/overloading-outES.txt: -------------------------------------------------------------------------------- 1 | uniform highp vec3 uniColor1; 2 | uniform highp vec3 uniColor2; 3 | #line 3 4 | uniform highp float uniFactor; 5 | #line 5 6 | highp vec4 xlat_main( ) { 7 | #line 7 8 | highp vec3 col = mix( vec3( 0.5), uniColor2, vec3( uniFactor)); 9 | highp vec4 outcol = vec4( col, 1.0); 10 | return mix( vec4( 0.5), vec4( vec3( 1.0), 0.0), outcol); 11 | } 12 | void main() { 13 | highp vec4 xl_retval; 14 | xl_retval = xlat_main( ); 15 | gl_FragData[0] = vec4(xl_retval); 16 | } 17 | 18 | // uniforms: 19 | // uniColor2: type 11 arrsize 0 20 | // uniFactor: type 9 arrsize 0 21 | -------------------------------------------------------------------------------- /tests/fragment/overloading-outES3.txt: -------------------------------------------------------------------------------- 1 | uniform highp vec3 uniColor1; 2 | uniform highp vec3 uniColor2; 3 | #line 3 4 | uniform highp float uniFactor; 5 | #line 5 6 | highp vec4 xlat_main( ) { 7 | #line 7 8 | highp vec3 col = mix( vec3( 0.5), uniColor2, vec3( uniFactor)); 9 | highp vec4 outcol = vec4( col, 1.0); 10 | return mix( vec4( 0.5), vec4( vec3( 1.0), 0.0), outcol); 11 | } 12 | void main() { 13 | highp vec4 xl_retval; 14 | xl_retval = xlat_main( ); 15 | gl_FragData[0] = vec4(xl_retval); 16 | } 17 | 18 | // uniforms: 19 | // uniColor2: type 11 arrsize 0 20 | // uniFactor: type 9 arrsize 0 21 | -------------------------------------------------------------------------------- /tests/fragment/pos-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "pos-in.txt" 2 | half4 main (float4 pos : POSITION) : COLOR0 { 3 | return pos; 4 | } 5 | -------------------------------------------------------------------------------- /tests/fragment/pos-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | vec4 xlat_main( in vec4 pos ) { 4 | #line 2 5 | return pos; 6 | } 7 | void main() { 8 | vec4 xl_retval; 9 | xl_retval = xlat_main( vec4(0.0)); 10 | gl_FragData[0] = vec4(xl_retval); 11 | } 12 | -------------------------------------------------------------------------------- /tests/fragment/pos-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | mediump vec4 xlat_main( in highp vec4 pos ) { 4 | #line 2 5 | return pos; 6 | } 7 | void main() { 8 | mediump vec4 xl_retval; 9 | xl_retval = xlat_main( vec4(0.0)); 10 | gl_FragData[0] = vec4(xl_retval); 11 | } 12 | -------------------------------------------------------------------------------- /tests/fragment/pos-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | mediump vec4 xlat_main( in highp vec4 pos ) { 4 | #line 2 5 | return pos; 6 | } 7 | void main() { 8 | mediump vec4 xl_retval; 9 | xl_retval = xlat_main( vec4(0.0)); 10 | gl_FragData[0] = vec4(xl_retval); 11 | } 12 | -------------------------------------------------------------------------------- /tests/fragment/pos-unused-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "pos-unused-in.txt" 2 | half4 main (float4 pos : POSITION, float4 color : COLOR) : COLOR0 { 3 | return color; 4 | } 5 | -------------------------------------------------------------------------------- /tests/fragment/pos-unused-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | vec4 xlat_main( in vec4 pos, in vec4 color ) { 4 | #line 2 5 | return color; 6 | } 7 | varying vec4 xlv_COLOR; 8 | void main() { 9 | vec4 xl_retval; 10 | xl_retval = xlat_main( vec4(0.0), vec4(xlv_COLOR)); 11 | gl_FragData[0] = vec4(xl_retval); 12 | } 13 | -------------------------------------------------------------------------------- /tests/fragment/pos-unused-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | mediump vec4 xlat_main( in highp vec4 pos, in highp vec4 color ) { 4 | #line 2 5 | return color; 6 | } 7 | varying highp vec4 xlv_COLOR; 8 | void main() { 9 | mediump vec4 xl_retval; 10 | xl_retval = xlat_main( vec4(0.0), vec4(xlv_COLOR)); 11 | gl_FragData[0] = vec4(xl_retval); 12 | } 13 | -------------------------------------------------------------------------------- /tests/fragment/pos-unused-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | mediump vec4 xlat_main( in highp vec4 pos, in highp vec4 color ) { 4 | #line 2 5 | return color; 6 | } 7 | in highp vec4 xlv_COLOR; 8 | void main() { 9 | mediump vec4 xl_retval; 10 | xl_retval = xlat_main( vec4(0.0), vec4(xlv_COLOR)); 11 | gl_FragData[0] = vec4(xl_retval); 12 | } 13 | -------------------------------------------------------------------------------- /tests/fragment/pp-after-block-comment-in.txt: -------------------------------------------------------------------------------- 1 | // There was a bug where block comment followed by preprocessor 2 | // directive on the same line was not working 3 | // (it's allowed in HLSL) 4 | 5 | /* */ #define FOO 6 | 7 | #ifdef FOO 8 | float4 main() : COLOR { return 1.0; } 9 | 10 | /* 11 | comment 12 | */ #endif 13 | -------------------------------------------------------------------------------- /tests/fragment/pp-after-block-comment-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 8 3 | vec4 xlat_main( ) { 4 | #line 8 5 | return vec4( 1.0); 6 | } 7 | void main() { 8 | vec4 xl_retval; 9 | xl_retval = xlat_main( ); 10 | gl_FragData[0] = vec4(xl_retval); 11 | } 12 | -------------------------------------------------------------------------------- /tests/fragment/pp-concat-operator-basic-in.txt: -------------------------------------------------------------------------------- 1 | #define a(b,c) b##c 2 | a(uni, form) float aaa; 3 | a(flo, at4) main() : COLOR 4 | { 5 | return aaa; 6 | } 7 | -------------------------------------------------------------------------------- /tests/fragment/pp-concat-operator-basic-out.txt: -------------------------------------------------------------------------------- 1 | uniform float aaa; 2 | #line 3 3 | #line 3 4 | vec4 xlat_main( ) { 5 | return vec4( aaa); 6 | } 7 | void main() { 8 | vec4 xl_retval; 9 | xl_retval = xlat_main( ); 10 | gl_FragData[0] = vec4(xl_retval); 11 | } 12 | 13 | // uniforms: 14 | // aaa: type 9 arrsize 0 15 | -------------------------------------------------------------------------------- /tests/fragment/pp-concat-operator-define-override-in.txt: -------------------------------------------------------------------------------- 1 | // This should produce "RIGHT" and not "WRONG" 2 | #define RI WR 3 | #define GHT ONG 4 | #define REPLACE(RI, GHT) RI##GHT 5 | float REPLACE(RI, GHT); 6 | 7 | float4 main() : COLOR { return RIGHT; } 8 | -------------------------------------------------------------------------------- /tests/fragment/pp-concat-operator-define-override-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 5 3 | uniform float RIGHT; 4 | #line 7 5 | vec4 xlat_main( ) { 6 | return vec4( RIGHT); 7 | } 8 | void main() { 9 | vec4 xl_retval; 10 | xl_retval = xlat_main( ); 11 | gl_FragData[0] = vec4(xl_retval); 12 | } 13 | 14 | // uniforms: 15 | // RIGHT: type 9 arrsize 0 16 | -------------------------------------------------------------------------------- /tests/fragment/pp-concat-operator-ignore-non-args-in.txt: -------------------------------------------------------------------------------- 1 | // Should produce RIGHT and not WRONG 2 | #define RI WR 3 | #define GHT ONG 4 | #define z(a) RI##GHT 5 | float z(1); 6 | float4 main() : COLOR { return RIGHT; } 7 | -------------------------------------------------------------------------------- /tests/fragment/pp-concat-operator-ignore-non-args-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 5 3 | uniform float RIGHT; 4 | #line 6 5 | vec4 xlat_main( ) { 6 | return vec4( RIGHT); 7 | } 8 | void main() { 9 | vec4 xl_retval; 10 | xl_retval = xlat_main( ); 11 | gl_FragData[0] = vec4(xl_retval); 12 | } 13 | 14 | // uniforms: 15 | // RIGHT: type 9 arrsize 0 16 | -------------------------------------------------------------------------------- /tests/fragment/pp-concat-operator-multiple-in.txt: -------------------------------------------------------------------------------- 1 | /* This should produce "RIGHT" instead of "RI ## G ## HT" */ 2 | #define x(a,b) a##G##b 3 | float x(RI, HT); 4 | 5 | float4 main() : COLOR { return RIGHT; } 6 | -------------------------------------------------------------------------------- /tests/fragment/pp-concat-operator-multiple-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 3 3 | uniform float RIGHT; 4 | #line 5 5 | vec4 xlat_main( ) { 6 | return vec4( RIGHT); 7 | } 8 | void main() { 9 | vec4 xl_retval; 10 | xl_retval = xlat_main( ); 11 | gl_FragData[0] = vec4(xl_retval); 12 | } 13 | 14 | // uniforms: 15 | // RIGHT: type 9 arrsize 0 16 | -------------------------------------------------------------------------------- /tests/fragment/pp-concat-operator-stacked-override-in.txt: -------------------------------------------------------------------------------- 1 | // This should produce "RIGHT" and not "WRONG" 2 | #define WR RI 3 | #define ONG GHT 4 | #define REPLACE(WR, ONG) WR##ONG 5 | #define REPLACE2(WR, ONG) REPLACE(WR, ONG) 6 | float REPLACE2(WR, ONG); 7 | 8 | float4 main() : COLOR { return RIGHT; } 9 | -------------------------------------------------------------------------------- /tests/fragment/pp-concat-operator-stacked-override-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 6 3 | uniform float RIGHT; 4 | #line 8 5 | vec4 xlat_main( ) { 6 | return vec4( RIGHT); 7 | } 8 | void main() { 9 | vec4 xl_retval; 10 | xl_retval = xlat_main( ); 11 | gl_FragData[0] = vec4(xl_retval); 12 | } 13 | 14 | // uniforms: 15 | // RIGHT: type 9 arrsize 0 16 | -------------------------------------------------------------------------------- /tests/fragment/pp-elif-after-macro-in.txt: -------------------------------------------------------------------------------- 1 | // This triggered an error before, when the "== D0" would not pop source. 2 | #define D0 0 3 | #if DA == D0 4 | float a; 5 | #elif D5 >= D4 6 | WRONG 7 | #else 8 | ALSOWRONG 9 | #endif 10 | 11 | float4 main() : COLOR { return a; } 12 | -------------------------------------------------------------------------------- /tests/fragment/pp-elif-after-macro-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 4 3 | uniform float a; 4 | #line 11 5 | #line 11 6 | vec4 xlat_main( ) { 7 | return vec4( a); 8 | } 9 | void main() { 10 | vec4 xl_retval; 11 | xl_retval = xlat_main( ); 12 | gl_FragData[0] = vec4(xl_retval); 13 | } 14 | 15 | // uniforms: 16 | // a: type 9 arrsize 0 17 | -------------------------------------------------------------------------------- /tests/fragment/pp-elif-after-macro-with-args-in.txt: -------------------------------------------------------------------------------- 1 | #define D0(x) 0 2 | #if DA == D0(5) 3 | float a; 4 | #elif D5 >= D4 5 | WRONG 6 | #else 7 | ALSOWRONG 8 | #endif 9 | 10 | float4 main() : COLOR { return a; } 11 | -------------------------------------------------------------------------------- /tests/fragment/pp-elif-after-macro-with-args-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 3 3 | uniform float a; 4 | #line 10 5 | #line 10 6 | vec4 xlat_main( ) { 7 | return vec4( a); 8 | } 9 | void main() { 10 | vec4 xl_retval; 11 | xl_retval = xlat_main( ); 12 | gl_FragData[0] = vec4(xl_retval); 13 | } 14 | 15 | // uniforms: 16 | // a: type 9 arrsize 0 17 | -------------------------------------------------------------------------------- /tests/fragment/pp-empty-macro-with-arg-in.txt: -------------------------------------------------------------------------------- 1 | // This should not crash when using the empty macro. 2 | #define COMPUTE_FOO(a) 3 | COMPUTE_FOO(a) 4 | 5 | float4 main() : COLOR { return 0; } 6 | -------------------------------------------------------------------------------- /tests/fragment/pp-empty-macro-with-arg-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 5 3 | vec4 xlat_main( ) { 4 | #line 5 5 | return vec4( 0.0); 6 | } 7 | void main() { 8 | vec4 xl_retval; 9 | xl_retval = xlat_main( ); 10 | gl_FragData[0] = vec4(xl_retval); 11 | } 12 | -------------------------------------------------------------------------------- /tests/fragment/pp-if-with-embedded-parens-in.txt: -------------------------------------------------------------------------------- 1 | // At some point, the preprocessor incorrectly thought 2 | // that the '+' is a unary operator and would fail to parse the expression. 3 | #if ((1) + (0) < 12) 4 | float a; 5 | #else 6 | WRONG 7 | #endif 8 | 9 | float4 main() : COLOR { return a; } 10 | -------------------------------------------------------------------------------- /tests/fragment/pp-if-with-embedded-parens-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 4 3 | uniform float a; 4 | #line 9 5 | #line 9 6 | vec4 xlat_main( ) { 7 | return vec4( a); 8 | } 9 | void main() { 10 | vec4 xl_retval; 11 | xl_retval = xlat_main( ); 12 | gl_FragData[0] = vec4(xl_retval); 13 | } 14 | 15 | // uniforms: 16 | // a: type 9 arrsize 0 17 | -------------------------------------------------------------------------------- /tests/fragment/pp-include-in.txt: -------------------------------------------------------------------------------- 1 | #include "pp-includedfile-ascii.txt" 2 | // include twice to check if include guards work 3 | #include "pp-includedfile-ascii.txt" 4 | 5 | half4 main() : COLOR0 6 | { 7 | return MyFunc(); 8 | } 9 | -------------------------------------------------------------------------------- /tests/fragment/pp-include-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 6 3 | #line 6 4 | #line 5 5 | #line 6 6 | float MyFunc2( ) { 7 | return 7.0; 8 | } 9 | #line 6 10 | float MyFunc( ) { 11 | return (7.0 + MyFunc2( )); 12 | } 13 | #line 5 14 | vec4 xlat_main( ) { 15 | return vec4( MyFunc( )); 16 | } 17 | void main() { 18 | vec4 xl_retval; 19 | xl_retval = xlat_main( ); 20 | gl_FragData[0] = vec4(xl_retval); 21 | } 22 | -------------------------------------------------------------------------------- /tests/fragment/pp-includedfile-ascii.txt: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDED_FILE_ASCII_INCLUDED 2 | #define INCLUDED_FILE_ASCII_INCLUDED 3 | 4 | #include "pp-includedfile-нонасции.txt" 5 | 6 | float MyFunc() 7 | { 8 | return 7 + MyFunc2(); 9 | } 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /tests/fragment/pp-includedfile-нонасции.txt: -------------------------------------------------------------------------------- 1 | // A file with a very non-ascii name here 2 | 3 | #ifndef INCLUDED_FILE_NONASCII_INCLUDED 4 | #define INCLUDED_FILE_NONASCII_INCLUDED 5 | 6 | float MyFunc2() 7 | { 8 | return 7; 9 | } 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /tests/fragment/pp-line-directive-filename-in.txt: -------------------------------------------------------------------------------- 1 | // This should NOT produce an error 2 | #line 1337 "Some_other_source_file.txt" 3 | 4 | float4 main() : COLOR { return 0; } 5 | -------------------------------------------------------------------------------- /tests/fragment/pp-line-directive-filename-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1338 3 | vec4 xlat_main( ) { 4 | #line 1338 5 | return vec4( 0.0); 6 | } 7 | void main() { 8 | vec4 xl_retval; 9 | xl_retval = xlat_main( ); 10 | gl_FragData[0] = vec4(xl_retval); 11 | } 12 | -------------------------------------------------------------------------------- /tests/fragment/pp-line-directive-no-filename-in.txt: -------------------------------------------------------------------------------- 1 | // This should NOT produce an error 2 | #line 1337 3 | 4 | float4 main() : COLOR { return 0; } 5 | -------------------------------------------------------------------------------- /tests/fragment/pp-line-directive-no-filename-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1338 3 | vec4 xlat_main( ) { 4 | #line 1338 5 | return vec4( 0.0); 6 | } 7 | void main() { 8 | vec4 xl_retval; 9 | xl_retval = xlat_main( ); 10 | gl_FragData[0] = vec4(xl_retval); 11 | } 12 | -------------------------------------------------------------------------------- /tests/fragment/pp-line-directive-whitespace-filename-in.txt: -------------------------------------------------------------------------------- 1 | // This should NOT produce an error 2 | #line 1337 "Some filename with a spaces in it.txt" 3 | 4 | float4 main() : COLOR { return 0; } 5 | -------------------------------------------------------------------------------- /tests/fragment/pp-line-directive-whitespace-filename-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1338 3 | vec4 xlat_main( ) { 4 | #line 1338 5 | return vec4( 0.0); 6 | } 7 | void main() { 8 | vec4 xl_retval; 9 | xl_retval = xlat_main( ); 10 | gl_FragData[0] = vec4(xl_retval); 11 | } 12 | -------------------------------------------------------------------------------- /tests/fragment/pp-line-macro-in.txt: -------------------------------------------------------------------------------- 1 | float4 main() : COLOR 2 | { 3 | float line3 = __LINE__; 4 | 5 | float line5 = __LINE__; 6 | 7 | return line3 + line5; 8 | } 9 | -------------------------------------------------------------------------------- /tests/fragment/pp-line-macro-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | vec4 xlat_main( ) { 4 | #line 3 5 | float line3 = 3.0; 6 | float line5 = 5.0; 7 | #line 7 8 | return vec4( (line3 + line5)); 9 | } 10 | void main() { 11 | vec4 xl_retval; 12 | xl_retval = xlat_main( ); 13 | gl_FragData[0] = vec4(xl_retval); 14 | } 15 | -------------------------------------------------------------------------------- /tests/fragment/pp-linenumbers1-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "pp-linenumbers1-in.txt" 2 | #line 11 3 | struct v2f { 4 | float4 vertex : POSITION; 5 | fixed4 color : COLOR; 6 | half2 texcoord : TEXCOORD0; 7 | }; 8 | fixed4 _TintColor; 9 | sampler2D _MainTex; 10 | half4 main (v2f i) : COLOR 11 | { 12 | return i.color * tex2D (_MainTex, i.texcoord); 13 | } 14 | -------------------------------------------------------------------------------- /tests/fragment/pp-linenumbers1-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 11 3 | struct v2f { 4 | vec4 vertex; 5 | vec4 color; 6 | vec2 texcoord; 7 | }; 8 | #line 16 9 | uniform vec4 _TintColor; 10 | uniform sampler2D _MainTex; 11 | #line 18 12 | vec4 xlat_main( in v2f i ) { 13 | #line 20 14 | return (i.color * texture2D( _MainTex, i.texcoord)); 15 | } 16 | varying vec4 xlv_COLOR; 17 | varying vec2 xlv_TEXCOORD0; 18 | void main() { 19 | vec4 xl_retval; 20 | v2f xlt_i; 21 | xlt_i.vertex = vec4(0.0); 22 | xlt_i.color = vec4(xlv_COLOR); 23 | xlt_i.texcoord = vec2(xlv_TEXCOORD0); 24 | xl_retval = xlat_main( xlt_i); 25 | gl_FragData[0] = vec4(xl_retval); 26 | } 27 | 28 | // uniforms: 29 | // _MainTex: type 25 arrsize 0 30 | -------------------------------------------------------------------------------- /tests/fragment/pp-linenumbers1-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 11 3 | struct v2f { 4 | highp vec4 vertex; 5 | lowp vec4 color; 6 | mediump vec2 texcoord; 7 | }; 8 | #line 16 9 | uniform lowp vec4 _TintColor; 10 | uniform sampler2D _MainTex; 11 | #line 18 12 | mediump vec4 xlat_main( in v2f i ) { 13 | #line 20 14 | return (i.color * texture2D( _MainTex, i.texcoord)); 15 | } 16 | varying lowp vec4 xlv_COLOR; 17 | varying mediump vec2 xlv_TEXCOORD0; 18 | void main() { 19 | mediump vec4 xl_retval; 20 | v2f xlt_i; 21 | xlt_i.vertex = vec4(0.0); 22 | xlt_i.color = vec4(xlv_COLOR); 23 | xlt_i.texcoord = vec2(xlv_TEXCOORD0); 24 | xl_retval = xlat_main( xlt_i); 25 | gl_FragData[0] = vec4(xl_retval); 26 | } 27 | 28 | // uniforms: 29 | // _MainTex: type 25 arrsize 0 30 | -------------------------------------------------------------------------------- /tests/fragment/pp-linenumbers1-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 11 3 | struct v2f { 4 | highp vec4 vertex; 5 | lowp vec4 color; 6 | mediump vec2 texcoord; 7 | }; 8 | #line 16 9 | uniform lowp vec4 _TintColor; 10 | uniform sampler2D _MainTex; 11 | #line 18 12 | mediump vec4 xlat_main( in v2f i ) { 13 | #line 20 14 | return (i.color * texture( _MainTex, i.texcoord)); 15 | } 16 | in lowp vec4 xlv_COLOR; 17 | in mediump vec2 xlv_TEXCOORD0; 18 | void main() { 19 | mediump vec4 xl_retval; 20 | v2f xlt_i; 21 | xlt_i.vertex = vec4(0.0); 22 | xlt_i.color = vec4(xlv_COLOR); 23 | xlt_i.texcoord = vec2(xlv_TEXCOORD0); 24 | xl_retval = xlat_main( xlt_i); 25 | gl_FragData[0] = vec4(xl_retval); 26 | } 27 | 28 | // uniforms: 29 | // _MainTex: type 25 arrsize 0 30 | -------------------------------------------------------------------------------- /tests/fragment/pp-macro-1-arg-accepts-void-in.txt: -------------------------------------------------------------------------------- 1 | // x() should be considered one (blank) argument when there is a macro which 2 | // has one parameter. It should produce "RIGHT" and not "RIGHT()", and no 3 | // errors. 4 | #define x(a) RIGHT a 5 | float x() ; 6 | 7 | float4 main() : COLOR { return RIGHT; } 8 | -------------------------------------------------------------------------------- /tests/fragment/pp-macro-1-arg-accepts-void-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 5 3 | uniform float RIGHT; 4 | #line 7 5 | vec4 xlat_main( ) { 6 | return vec4( RIGHT); 7 | } 8 | void main() { 9 | vec4 xl_retval; 10 | xl_retval = xlat_main( ); 11 | gl_FragData[0] = vec4(xl_retval); 12 | } 13 | 14 | // uniforms: 15 | // RIGHT: type 9 arrsize 0 16 | -------------------------------------------------------------------------------- /tests/fragment/pp-macro-arg-in.txt: -------------------------------------------------------------------------------- 1 | /* This should produce "RIGHT" instead of "WRONG" */ 2 | #define x(WRONG) WRONG 3 | float x(RIGHT) ; 4 | 5 | float4 main() : COLOR { return RIGHT; } 6 | -------------------------------------------------------------------------------- /tests/fragment/pp-macro-arg-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 3 3 | uniform float RIGHT; 4 | #line 5 5 | vec4 xlat_main( ) { 6 | return vec4( RIGHT); 7 | } 8 | void main() { 9 | vec4 xl_retval; 10 | xl_retval = xlat_main( ); 11 | gl_FragData[0] = vec4(xl_retval); 12 | } 13 | 14 | // uniforms: 15 | // RIGHT: type 9 arrsize 0 16 | -------------------------------------------------------------------------------- /tests/fragment/pp-macro-arg-overrides-define-in.txt: -------------------------------------------------------------------------------- 1 | // This should produce THIS_IS_THE_MACRO_ARG and not THIS_IS_THE_DEFINE. 2 | #define x THIS_IS_THE_DEFINE 3 | #define b(x) x 4 | #define z(x) b(x) 5 | float z(THIS_IS_THE_MACRO_ARG) ; 6 | 7 | float4 main() : COLOR { return THIS_IS_THE_MACRO_ARG; } 8 | -------------------------------------------------------------------------------- /tests/fragment/pp-macro-arg-overrides-define-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 5 3 | uniform float THIS_IS_THE_MACRO_ARG; 4 | #line 7 5 | vec4 xlat_main( ) { 6 | return vec4( THIS_IS_THE_MACRO_ARG); 7 | } 8 | void main() { 9 | vec4 xl_retval; 10 | xl_retval = xlat_main( ); 11 | gl_FragData[0] = vec4(xl_retval); 12 | } 13 | 14 | // uniforms: 15 | // THIS_IS_THE_MACRO_ARG: type 9 arrsize 0 16 | -------------------------------------------------------------------------------- /tests/fragment/pp-macro-args-in.txt: -------------------------------------------------------------------------------- 1 | /* This should produce "float a" instead of "WRONG ANDWRONG" */ 2 | #define x(WRONG, ANDWRONG) WRONG ANDWRONG 3 | x(float, a) ; 4 | 5 | float4 main() : COLOR { return a; } 6 | -------------------------------------------------------------------------------- /tests/fragment/pp-macro-args-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 3 3 | uniform float a; 4 | #line 5 5 | vec4 xlat_main( ) { 6 | return vec4( a); 7 | } 8 | void main() { 9 | vec4 xl_retval; 10 | xl_retval = xlat_main( ); 11 | gl_FragData[0] = vec4(xl_retval); 12 | } 13 | 14 | // uniforms: 15 | // a: type 9 arrsize 0 16 | -------------------------------------------------------------------------------- /tests/fragment/pp-macro-args-with-whitespace-in.txt: -------------------------------------------------------------------------------- 1 | #define right( x ) x 2 | float right( RIGHT ) ; 3 | 4 | float4 main() : COLOR { return RIGHT; } 5 | -------------------------------------------------------------------------------- /tests/fragment/pp-macro-args-with-whitespace-out.txt: -------------------------------------------------------------------------------- 1 | uniform float RIGHT; 2 | #line 4 3 | #line 4 4 | vec4 xlat_main( ) { 5 | return vec4( RIGHT); 6 | } 7 | void main() { 8 | vec4 xl_retval; 9 | xl_retval = xlat_main( ); 10 | gl_FragData[0] = vec4(xl_retval); 11 | } 12 | 13 | // uniforms: 14 | // RIGHT: type 9 arrsize 0 15 | -------------------------------------------------------------------------------- /tests/fragment/pp-macro-blank-arg-in.txt: -------------------------------------------------------------------------------- 1 | // This shouldn't produce an error (the "()" should be treated as one 2 | // blank argument. 3 | #define x(y) y 4 | x() 5 | 6 | float4 main() : COLOR { return 0; } 7 | -------------------------------------------------------------------------------- /tests/fragment/pp-macro-blank-arg-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 6 3 | vec4 xlat_main( ) { 4 | #line 6 5 | return vec4( 0.0); 6 | } 7 | void main() { 8 | vec4 xl_retval; 9 | xl_retval = xlat_main( ); 10 | gl_FragData[0] = vec4(xl_retval); 11 | } 12 | -------------------------------------------------------------------------------- /tests/fragment/pp-macro-continuation-in.txt: -------------------------------------------------------------------------------- 1 | // these should evaluate to empty 2 | #define AAA \ 3 | 4 | #define BBB 5 | 6 | #define CCC /* comment */ \ 7 | 8 | #define DDD 9 | 10 | #define EEE \ 11 | 0.0 12 | 13 | 14 | float4 main() : COLOR 15 | { 16 | AAA 17 | BBB 18 | CCC 19 | DDD 20 | return EEE; 21 | } 22 | -------------------------------------------------------------------------------- /tests/fragment/pp-macro-continuation-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 14 3 | vec4 xlat_main( ) { 4 | #line 20 5 | return vec4( 0.0); 6 | } 7 | void main() { 8 | vec4 xl_retval; 9 | xl_retval = xlat_main( ); 10 | gl_FragData[0] = vec4(xl_retval); 11 | } 12 | -------------------------------------------------------------------------------- /tests/fragment/pp-macro-empty-arg-in.txt: -------------------------------------------------------------------------------- 1 | /* This should produce "float a" instead of "WRONG WRONG" (etc) */ 2 | #define x(WRONG,ANDWRONG) WRONG ANDWRONG 3 | x(float,) 4 | x(,a) 5 | x(,) 6 | ; 7 | 8 | float4 main() : COLOR { return a; } 9 | -------------------------------------------------------------------------------- /tests/fragment/pp-macro-empty-arg-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 4 3 | uniform float a; 4 | #line 8 5 | #line 8 6 | vec4 xlat_main( ) { 7 | return vec4( a); 8 | } 9 | void main() { 10 | vec4 xl_retval; 11 | xl_retval = xlat_main( ); 12 | gl_FragData[0] = vec4(xl_retval); 13 | } 14 | 15 | // uniforms: 16 | // a: type 9 arrsize 0 17 | -------------------------------------------------------------------------------- /tests/fragment/pp-macro-longarg-in.txt: -------------------------------------------------------------------------------- 1 | #define SELECT(a) a 2 | #define CONCAT(a,b) a##b 3 | struct v2f { float avariable; }; 4 | 5 | float4 main(v2f i) : COLOR { 6 | float res; 7 | res = SELECT(i.avariable); 8 | res += CONCAT(i.a, variable); 9 | return res; 10 | } 11 | -------------------------------------------------------------------------------- /tests/fragment/pp-macro-longarg-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 3 3 | struct v2f { 4 | float avariable; 5 | }; 6 | #line 5 7 | #line 5 8 | vec4 xlat_main( in v2f i ) { 9 | float res; 10 | res = i.avariable; 11 | res += i.avariable; 12 | #line 9 13 | return vec4( res); 14 | } 15 | varying float xlv_; 16 | void main() { 17 | vec4 xl_retval; 18 | v2f xlt_i; 19 | xlt_i.avariable = float(xlv_); 20 | xl_retval = xlat_main( xlt_i); 21 | gl_FragData[0] = vec4(xl_retval); 22 | } 23 | -------------------------------------------------------------------------------- /tests/fragment/pp-macro-multi-args-with-whitespace-in.txt: -------------------------------------------------------------------------------- 1 | #define right( x , y ) x ## y 2 | float right( RI , GHT ) ; 3 | 4 | float4 main() : COLOR { return RIGHT; } 5 | -------------------------------------------------------------------------------- /tests/fragment/pp-macro-multi-args-with-whitespace-out.txt: -------------------------------------------------------------------------------- 1 | uniform float RIGHT; 2 | #line 4 3 | #line 4 4 | vec4 xlat_main( ) { 5 | return vec4( RIGHT); 6 | } 7 | void main() { 8 | vec4 xl_retval; 9 | xl_retval = xlat_main( ); 10 | gl_FragData[0] = vec4(xl_retval); 11 | } 12 | 13 | // uniforms: 14 | // RIGHT: type 9 arrsize 0 15 | -------------------------------------------------------------------------------- /tests/fragment/pp-macro-paren-stacking-in.txt: -------------------------------------------------------------------------------- 1 | /* Should give you "RIGHT" instead of an error. */ 2 | #define a(a,b) b 3 | float a((1+1), RIGHT) ; 4 | 5 | float4 main() : COLOR { return RIGHT; } 6 | -------------------------------------------------------------------------------- /tests/fragment/pp-macro-paren-stacking-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 3 3 | uniform float RIGHT; 4 | #line 5 5 | vec4 xlat_main( ) { 6 | return vec4( RIGHT); 7 | } 8 | void main() { 9 | vec4 xl_retval; 10 | xl_retval = xlat_main( ); 11 | gl_FragData[0] = vec4(xl_retval); 12 | } 13 | 14 | // uniforms: 15 | // RIGHT: type 9 arrsize 0 16 | -------------------------------------------------------------------------------- /tests/fragment/pp-macro-void-arg-in.txt: -------------------------------------------------------------------------------- 1 | // This should not trigger a preprocessor error. 2 | // Nor should it produce "RIGHT()". 3 | #define x() RIGHT 4 | float x() ; 5 | 6 | float4 main() : COLOR { return RIGHT; } 7 | -------------------------------------------------------------------------------- /tests/fragment/pp-macro-void-arg-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 4 3 | uniform float RIGHT; 4 | #line 6 5 | vec4 xlat_main( ) { 6 | return vec4( RIGHT); 7 | } 8 | void main() { 9 | vec4 xl_retval; 10 | xl_retval = xlat_main( ); 11 | gl_FragData[0] = vec4(xl_retval); 12 | } 13 | 14 | // uniforms: 15 | // RIGHT: type 9 arrsize 0 16 | -------------------------------------------------------------------------------- /tests/fragment/pp-macro-with-arg-as-macro-arg-in.txt: -------------------------------------------------------------------------------- 1 | // Should produce "RIGHT" and not "l(b)" or whatnot. 2 | #define bb(l) l 3 | #define zz(c) c 4 | #define qq(b) zz(bb(b)) 5 | float qq(RIGHT) ; 6 | 7 | float4 main() : COLOR { return RIGHT; } 8 | -------------------------------------------------------------------------------- /tests/fragment/pp-macro-with-arg-as-macro-arg-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 5 3 | uniform float RIGHT; 4 | #line 7 5 | vec4 xlat_main( ) { 6 | return vec4( RIGHT); 7 | } 8 | void main() { 9 | vec4 xl_retval; 10 | xl_retval = xlat_main( ); 11 | gl_FragData[0] = vec4(xl_retval); 12 | } 13 | 14 | // uniforms: 15 | // RIGHT: type 9 arrsize 0 16 | -------------------------------------------------------------------------------- /tests/fragment/pp-nested-macro-args-in.txt: -------------------------------------------------------------------------------- 1 | /* This should produce "RIGHT" instead of "WRONG" */ 2 | #define x(a) a 3 | #define y(WRONG) x(WRONG) 4 | 5 | float y(RIGHT) ; 6 | 7 | float4 main() : COLOR { return RIGHT; } 8 | -------------------------------------------------------------------------------- /tests/fragment/pp-nested-macro-args-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 5 3 | uniform float RIGHT; 4 | #line 7 5 | vec4 xlat_main( ) { 6 | return vec4( RIGHT); 7 | } 8 | void main() { 9 | vec4 xl_retval; 10 | xl_retval = xlat_main( ); 11 | gl_FragData[0] = vec4(xl_retval); 12 | } 13 | 14 | // uniforms: 15 | // RIGHT: type 9 arrsize 0 16 | -------------------------------------------------------------------------------- /tests/fragment/pp-pragma-directive-line-break-in.txt: -------------------------------------------------------------------------------- 1 | #pragma warning (disable:4507) 2 | float should_remain_on_separate_line; 3 | half4 main() : COLOR { return should_remain_on_separate_line; } 4 | -------------------------------------------------------------------------------- /tests/fragment/pp-pragma-directive-line-break-out.txt: -------------------------------------------------------------------------------- 1 | uniform float should_remain_on_separate_line; 2 | #line 3 3 | #line 3 4 | vec4 xlat_main( ) { 5 | return vec4( should_remain_on_separate_line); 6 | } 7 | void main() { 8 | vec4 xl_retval; 9 | xl_retval = xlat_main( ); 10 | gl_FragData[0] = vec4(xl_retval); 11 | } 12 | 13 | // uniforms: 14 | // should_remain_on_separate_line: type 9 arrsize 0 15 | -------------------------------------------------------------------------------- /tests/fragment/pp-tokenpaste-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "pp-tokenpaste-in.txt" 2 | 3 | struct v2f 4 | { 5 | half4 pos : POSITION; 6 | half2 uv : TEXCOORD0; 7 | }; 8 | 9 | // Regular thing 10 | #define TAKE1( x, sampler, i ) x + tex2D (sampler, i.uv) 11 | // Token pasting in several weird ways that works in HLSL & Cg; we also had a bug where 12 | // if a macro parameter name was "i" *and* the passed value was "i" then 13 | // it would fail. 14 | #define TAKE2( x, sampler, i ) x + tex2D (sampler, i##.uv) 15 | #define TAKE3( x, sampler, i ) x + tex2D (sampler, i.##uv) 16 | 17 | sampler2D _MainTex; 18 | fixed4 main( v2f i ) : COLOR 19 | { 20 | fixed4 col = tex2D (_MainTex, i.uv); 21 | col = TAKE1 (col, _MainTex, i); 22 | col = TAKE2 (col, _MainTex, i); 23 | col = TAKE3 (col, _MainTex, i); 24 | return col; 25 | } 26 | -------------------------------------------------------------------------------- /tests/fragment/pp-tokenpaste-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 2 3 | struct v2f { 4 | vec4 pos; 5 | vec2 uv; 6 | }; 7 | #line 16 8 | uniform sampler2D _MainTex; 9 | #line 17 10 | vec4 xlat_main( in v2f i ) { 11 | vec4 col = texture2D( _MainTex, i.uv); 12 | #line 20 13 | col = (col + texture2D( _MainTex, i.uv)); 14 | col = (col + texture2D( _MainTex, i.uv)); 15 | col = (col + texture2D( _MainTex, i.uv)); 16 | return col; 17 | } 18 | varying vec2 xlv_TEXCOORD0; 19 | void main() { 20 | vec4 xl_retval; 21 | v2f xlt_i; 22 | xlt_i.pos = vec4(0.0); 23 | xlt_i.uv = vec2(xlv_TEXCOORD0); 24 | xl_retval = xlat_main( xlt_i); 25 | gl_FragData[0] = vec4(xl_retval); 26 | } 27 | 28 | // uniforms: 29 | // _MainTex: type 25 arrsize 0 30 | -------------------------------------------------------------------------------- /tests/fragment/pp-tokenpaste-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 2 3 | struct v2f { 4 | highp vec4 pos; 5 | mediump vec2 uv; 6 | }; 7 | #line 16 8 | uniform sampler2D _MainTex; 9 | #line 17 10 | lowp vec4 xlat_main( in v2f i ) { 11 | lowp vec4 col = texture2D( _MainTex, i.uv); 12 | #line 20 13 | col = (col + texture2D( _MainTex, i.uv)); 14 | col = (col + texture2D( _MainTex, i.uv)); 15 | col = (col + texture2D( _MainTex, i.uv)); 16 | return col; 17 | } 18 | varying mediump vec2 xlv_TEXCOORD0; 19 | void main() { 20 | lowp vec4 xl_retval; 21 | v2f xlt_i; 22 | xlt_i.pos = vec4(0.0); 23 | xlt_i.uv = vec2(xlv_TEXCOORD0); 24 | xl_retval = xlat_main( xlt_i); 25 | gl_FragData[0] = vec4(xl_retval); 26 | } 27 | 28 | // uniforms: 29 | // _MainTex: type 25 arrsize 0 30 | -------------------------------------------------------------------------------- /tests/fragment/pp-tokenpaste-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 2 3 | struct v2f { 4 | highp vec4 pos; 5 | mediump vec2 uv; 6 | }; 7 | #line 16 8 | uniform sampler2D _MainTex; 9 | #line 17 10 | lowp vec4 xlat_main( in v2f i ) { 11 | lowp vec4 col = texture( _MainTex, i.uv); 12 | #line 20 13 | col = (col + texture( _MainTex, i.uv)); 14 | col = (col + texture( _MainTex, i.uv)); 15 | col = (col + texture( _MainTex, i.uv)); 16 | return col; 17 | } 18 | in mediump vec2 xlv_TEXCOORD0; 19 | void main() { 20 | lowp vec4 xl_retval; 21 | v2f xlt_i; 22 | xlt_i.pos = vec4(0.0); 23 | xlt_i.uv = vec2(xlv_TEXCOORD0); 24 | xl_retval = xlat_main( xlt_i); 25 | gl_FragData[0] = vec4(xl_retval); 26 | } 27 | 28 | // uniforms: 29 | // _MainTex: type 25 arrsize 0 30 | -------------------------------------------------------------------------------- /tests/fragment/sampler2dshadow-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "tex2dshadow-in.txt" 2 | 3 | sampler2DShadow shadowmap; 4 | 5 | fixed4 main (float4 uv : TEXCOORD0) : COLOR0 6 | { 7 | float s1 = shadow2D (shadowmap, uv.xyz); 8 | float s2 = shadow2Dproj (shadowmap, uv); 9 | 10 | s1 = tex2D (shadowmap, uv.xyz); 11 | s2 = tex2Dproj (shadowmap, uv); 12 | 13 | return s1 + s2; 14 | } 15 | -------------------------------------------------------------------------------- /tests/fragment/sampler2dshadow-out.txt: -------------------------------------------------------------------------------- 1 | float xll_shadow2D(sampler2DShadow s, vec3 coord) { return shadow2D (s, coord).r; } 2 | float xll_shadow2Dproj(sampler2DShadow s, vec4 coord) { return shadow2DProj (s, coord).r; } 3 | #line 2 4 | uniform sampler2DShadow shadowmap; 5 | #line 4 6 | vec4 xlat_main( in vec4 uv ) { 7 | #line 6 8 | float s1 = xll_shadow2D( shadowmap, uv.xyz); 9 | float s2 = xll_shadow2Dproj( shadowmap, uv); 10 | s1 = float( shadow2D( shadowmap, uv.xyz)); 11 | #line 10 12 | s2 = float( shadow2DProj( shadowmap, uv)); 13 | return vec4( (s1 + s2)); 14 | } 15 | varying vec4 xlv_TEXCOORD0; 16 | void main() { 17 | vec4 xl_retval; 18 | xl_retval = xlat_main( vec4(xlv_TEXCOORD0)); 19 | gl_FragData[0] = vec4(xl_retval); 20 | } 21 | 22 | // uniforms: 23 | // shadowmap: type 26 arrsize 0 24 | -------------------------------------------------------------------------------- /tests/fragment/sampler2dshadow-outES3.txt: -------------------------------------------------------------------------------- 1 | float xll_shadow2D(mediump sampler2DShadow s, vec3 coord) { return texture (s, coord); } 2 | float xll_shadow2Dproj(mediump sampler2DShadow s, vec4 coord) { return textureProj (s, coord); } 3 | #line 2 4 | uniform lowp sampler2DShadow shadowmap; 5 | #line 4 6 | lowp vec4 xlat_main( in highp vec4 uv ) { 7 | #line 6 8 | highp float s1 = xll_shadow2D( shadowmap, uv.xyz); 9 | highp float s2 = xll_shadow2Dproj( shadowmap, uv); 10 | s1 = float( texture( shadowmap, uv.xyz)); 11 | #line 10 12 | s2 = float( textureProj( shadowmap, uv)); 13 | return vec4( (s1 + s2)); 14 | } 15 | in highp vec4 xlv_TEXCOORD0; 16 | void main() { 17 | lowp vec4 xl_retval; 18 | xl_retval = xlat_main( vec4(xlv_TEXCOORD0)); 19 | gl_FragData[0] = vec4(xl_retval); 20 | } 21 | 22 | // uniforms: 23 | // shadowmap: type 26 arrsize 0 24 | -------------------------------------------------------------------------------- /tests/fragment/samplerstate-in.txt: -------------------------------------------------------------------------------- 1 | 2 | texture sDiffuseMap 3 | < 4 | string ResourceName = ""; 5 | string ResourceType = "2D"; 6 | string UIName = "Diffuse Map"; 7 | >; 8 | 9 | sampler2D Sampler_sDiffuseMap = sampler_state 10 | { 11 | Texture = ; 12 | }; 13 | 14 | struct PS_IN 15 | { 16 | float2 texCoord0 : TEXCOORD0; 17 | }; 18 | 19 | 20 | float4 main(PS_IN inStruct) : COLOR 21 | { 22 | float4 tex = tex2D(Sampler_sDiffuseMap, inStruct.texCoord0); 23 | return tex; 24 | } 25 | -------------------------------------------------------------------------------- /tests/fragment/samplerstate-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 14 3 | struct PS_IN { 4 | vec2 texCoord0; 5 | }; 6 | #line 9 7 | uniform sampler2D Sampler_sDiffuseMap; 8 | #line 20 9 | #line 20 10 | vec4 xlat_main( in PS_IN inStruct ) { 11 | vec4 tex = texture2D( Sampler_sDiffuseMap, inStruct.texCoord0); 12 | return tex; 13 | } 14 | varying vec2 xlv_TEXCOORD0; 15 | void main() { 16 | vec4 xl_retval; 17 | PS_IN xlt_inStruct; 18 | xlt_inStruct.texCoord0 = vec2(xlv_TEXCOORD0); 19 | xl_retval = xlat_main( xlt_inStruct); 20 | gl_FragData[0] = vec4(xl_retval); 21 | } 22 | 23 | // uniforms: 24 | // Sampler_sDiffuseMap: type 25 arrsize 0 25 | -------------------------------------------------------------------------------- /tests/fragment/samplerstate-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 14 3 | struct PS_IN { 4 | highp vec2 texCoord0; 5 | }; 6 | #line 9 7 | uniform sampler2D Sampler_sDiffuseMap; 8 | #line 20 9 | #line 20 10 | highp vec4 xlat_main( in PS_IN inStruct ) { 11 | highp vec4 tex = texture2D( Sampler_sDiffuseMap, inStruct.texCoord0); 12 | return tex; 13 | } 14 | varying highp vec2 xlv_TEXCOORD0; 15 | void main() { 16 | highp vec4 xl_retval; 17 | PS_IN xlt_inStruct; 18 | xlt_inStruct.texCoord0 = vec2(xlv_TEXCOORD0); 19 | xl_retval = xlat_main( xlt_inStruct); 20 | gl_FragData[0] = vec4(xl_retval); 21 | } 22 | 23 | // uniforms: 24 | // Sampler_sDiffuseMap: type 25 arrsize 0 25 | -------------------------------------------------------------------------------- /tests/fragment/samplerstate-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 14 3 | struct PS_IN { 4 | highp vec2 texCoord0; 5 | }; 6 | #line 9 7 | uniform sampler2D Sampler_sDiffuseMap; 8 | #line 20 9 | #line 20 10 | highp vec4 xlat_main( in PS_IN inStruct ) { 11 | highp vec4 tex = texture( Sampler_sDiffuseMap, inStruct.texCoord0); 12 | return tex; 13 | } 14 | in highp vec2 xlv_TEXCOORD0; 15 | void main() { 16 | highp vec4 xl_retval; 17 | PS_IN xlt_inStruct; 18 | xlt_inStruct.texCoord0 = vec2(xlv_TEXCOORD0); 19 | xl_retval = xlat_main( xlt_inStruct); 20 | gl_FragData[0] = vec4(xl_retval); 21 | } 22 | 23 | // uniforms: 24 | // Sampler_sDiffuseMap: type 25 arrsize 0 25 | -------------------------------------------------------------------------------- /tests/fragment/struct-semantics-in.txt: -------------------------------------------------------------------------------- 1 | 2 | struct Input 3 | { 4 | fixed4 color; 5 | half3 interpolator1; 6 | half3 interpolator2; 7 | }; 8 | 9 | struct v2f 10 | { 11 | float4 vertex : SV_POSITION; 12 | // semantics on a nested struct itself. 13 | Input data : TEXCOORD1; 14 | }; 15 | 16 | half4 main(v2f i) : COLOR 17 | { 18 | half4 res = 0; 19 | res += i.data.color; 20 | res.xyz += i.data.interpolator1; 21 | res.xyz += i.data.interpolator2; 22 | return res; 23 | } 24 | -------------------------------------------------------------------------------- /tests/fragment/struct-semantics-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 0 3 | struct Input { 4 | vec4 color; 5 | vec3 interpolator1; 6 | vec3 interpolator2; 7 | }; 8 | #line 9 9 | struct v2f { 10 | vec4 vertex; 11 | Input data; 12 | }; 13 | #line 16 14 | #line 16 15 | vec4 xlat_main( in v2f i ) { 16 | vec4 res = vec4( 0.0); 17 | res += i.data.color; 18 | #line 20 19 | res.xyz += i.data.interpolator1; 20 | res.xyz += i.data.interpolator2; 21 | return res; 22 | } 23 | varying vec4 xlv_TEXCOORD1; 24 | varying vec3 xlv_TEXCOORD2; 25 | varying vec3 xlv_TEXCOORD3; 26 | void main() { 27 | vec4 xl_retval; 28 | v2f xlt_i; 29 | xlt_i.vertex = vec4(0.0); 30 | xlt_i.data.color = vec4(xlv_TEXCOORD1); 31 | xlt_i.data.interpolator1 = vec3(xlv_TEXCOORD2); 32 | xlt_i.data.interpolator2 = vec3(xlv_TEXCOORD3); 33 | xl_retval = xlat_main( xlt_i); 34 | gl_FragData[0] = vec4(xl_retval); 35 | } 36 | -------------------------------------------------------------------------------- /tests/fragment/sv_target-works-in.txt: -------------------------------------------------------------------------------- 1 | // pixel shader output with SV_TARGET semantic should work 2 | // (case insensitive) 3 | half4 main (float4 uv : TEXCOORD0) : SV_TARget 4 | { 5 | return uv; 6 | } 7 | -------------------------------------------------------------------------------- /tests/fragment/sv_target-works-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 3 3 | vec4 xlat_main( in vec4 uv ) { 4 | #line 5 5 | return uv; 6 | } 7 | varying vec4 xlv_TEXCOORD0; 8 | void main() { 9 | vec4 xl_retval; 10 | xl_retval = xlat_main( vec4(xlv_TEXCOORD0)); 11 | gl_FragData[0] = vec4(xl_retval); 12 | } 13 | -------------------------------------------------------------------------------- /tests/fragment/sv_target-works-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 3 3 | mediump vec4 xlat_main( in highp vec4 uv ) { 4 | #line 5 5 | return uv; 6 | } 7 | varying highp vec4 xlv_TEXCOORD0; 8 | void main() { 9 | mediump vec4 xl_retval; 10 | xl_retval = xlat_main( vec4(xlv_TEXCOORD0)); 11 | gl_FragData[0] = vec4(xl_retval); 12 | } 13 | -------------------------------------------------------------------------------- /tests/fragment/sv_target-works-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 3 3 | mediump vec4 xlat_main( in highp vec4 uv ) { 4 | #line 5 5 | return uv; 6 | } 7 | in highp vec4 xlv_TEXCOORD0; 8 | void main() { 9 | mediump vec4 xl_retval; 10 | xl_retval = xlat_main( vec4(xlv_TEXCOORD0)); 11 | gl_FragData[0] = vec4(xl_retval); 12 | } 13 | -------------------------------------------------------------------------------- /tests/fragment/syntax-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "syntax-in.txt" 2 | half4 main() : COLOR0 { 3 | float foo = 1.0; 4 | foo += 1.0f; 5 | foo += 1e5f; 6 | foo += -1.0e-3; 7 | foo += 0.000001; 8 | foo += 1.0e-6; 9 | foo += 1.111111e+6; 10 | foo += 1.111110e+6; 11 | foo += 1.23456789; 12 | foo += 2f; 13 | foo += 3; 14 | 15 | float3 f3; 16 | half4 v; 17 | float boo; 18 | v = half4(f3.zyx, 1); 19 | v = half4(foo.xxx, 1); 20 | v = half4(boo.xxx, 1); 21 | v = foo.xxxx; 22 | v = 2..xxxx; 23 | //const float fci = 1; 24 | //v = fci.xxxx; 25 | const float fcf = 1.9; 26 | v = fcf.xxxx; 27 | 28 | return foo; 29 | } 30 | -------------------------------------------------------------------------------- /tests/fragment/syntax-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | vec4 xlat_main( ) { 4 | #line 2 5 | float foo = 1.0; 6 | foo += 1.0; 7 | foo += 100000.0; 8 | foo += -0.001; 9 | #line 6 10 | foo += 1e-06; 11 | foo += 1e-06; 12 | foo += 1111111.0; 13 | foo += 1111110.0; 14 | #line 10 15 | foo += 1.234568; 16 | foo += 2.0; 17 | foo += 3.0; 18 | #line 14 19 | vec3 f3; 20 | vec4 v; 21 | float boo; 22 | v = vec4( f3.zyx, 1.0); 23 | #line 18 24 | v = vec4( vec3( foo), 1.0); 25 | v = vec4( vec3( boo), 1.0); 26 | v = vec4( foo); 27 | v = vec4( 2.0); 28 | #line 24 29 | const float fcf = 1.9; 30 | v = vec4( 1.9); 31 | return vec4( foo); 32 | } 33 | void main() { 34 | vec4 xl_retval; 35 | xl_retval = xlat_main( ); 36 | gl_FragData[0] = vec4(xl_retval); 37 | } 38 | -------------------------------------------------------------------------------- /tests/fragment/syntax-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | mediump vec4 xlat_main( ) { 4 | #line 2 5 | highp float foo = 1.0; 6 | foo += 1.0; 7 | foo += 100000.0; 8 | foo += -0.001; 9 | #line 6 10 | foo += 1e-06; 11 | foo += 1e-06; 12 | foo += 1111111.0; 13 | foo += 1111110.0; 14 | #line 10 15 | foo += 1.234568; 16 | foo += 2.0; 17 | foo += 3.0; 18 | #line 14 19 | highp vec3 f3; 20 | mediump vec4 v; 21 | highp float boo; 22 | v = vec4( f3.zyx, 1.0); 23 | #line 18 24 | v = vec4( vec3( foo), 1.0); 25 | v = vec4( vec3( boo), 1.0); 26 | v = vec4( foo); 27 | v = vec4( 2.0); 28 | #line 24 29 | const highp float fcf = 1.9; 30 | v = vec4( 1.9); 31 | return vec4( foo); 32 | } 33 | void main() { 34 | mediump vec4 xl_retval; 35 | xl_retval = xlat_main( ); 36 | gl_FragData[0] = vec4(xl_retval); 37 | } 38 | -------------------------------------------------------------------------------- /tests/fragment/syntax-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | mediump vec4 xlat_main( ) { 4 | #line 2 5 | highp float foo = 1.0; 6 | foo += 1.0; 7 | foo += 100000.0; 8 | foo += -0.001; 9 | #line 6 10 | foo += 1e-06; 11 | foo += 1e-06; 12 | foo += 1111111.0; 13 | foo += 1111110.0; 14 | #line 10 15 | foo += 1.234568; 16 | foo += 2.0; 17 | foo += 3.0; 18 | #line 14 19 | highp vec3 f3; 20 | mediump vec4 v; 21 | highp float boo; 22 | v = vec4( f3.zyx, 1.0); 23 | #line 18 24 | v = vec4( vec3( foo), 1.0); 25 | v = vec4( vec3( boo), 1.0); 26 | v = vec4( foo); 27 | v = vec4( 2.0); 28 | #line 24 29 | const highp float fcf = 1.9; 30 | v = vec4( 1.9); 31 | return vec4( foo); 32 | } 33 | void main() { 34 | mediump vec4 xl_retval; 35 | xl_retval = xlat_main( ); 36 | gl_FragData[0] = vec4(xl_retval); 37 | } 38 | -------------------------------------------------------------------------------- /tests/fragment/ternary-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "ternary-in.txt" 2 | half4 main (float4 uv : TEXCOORD0) : COLOR0 { 3 | half4 c = 0; 4 | c += uv.x > 0.5 ? 0.9 : 0.1; 5 | c += uv.x > 0.5 ? float4(0.9) : float4(0.1); 6 | c.rgb += uv.x > 0.5 ? float3(0.9) : float3(0.1); 7 | c.rg += uv.x > 0.5 ? float2(0.9) : float2(0.1); 8 | c.r += frac(uv.x) ? 0.9 : 0.1; 9 | return c; 10 | } 11 | -------------------------------------------------------------------------------- /tests/fragment/ternary-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | vec4 xlat_main( in vec4 uv ) { 4 | #line 2 5 | vec4 c = vec4( 0.0); 6 | c += (( (uv.x > 0.5) ) ? ( 0.9 ) : ( 0.1 )); 7 | c += (( (uv.x > 0.5) ) ? ( vec4( 0.9) ) : ( vec4( 0.1) )); 8 | c.xyz += (( (uv.x > 0.5) ) ? ( vec3( 0.9) ) : ( vec3( 0.1) )); 9 | #line 6 10 | c.xy += (( (uv.x > 0.5) ) ? ( vec2( 0.9) ) : ( vec2( 0.1) )); 11 | c.x += (( bool(fract(uv.x)) ) ? ( 0.9 ) : ( 0.1 )); 12 | return c; 13 | } 14 | varying vec4 xlv_TEXCOORD0; 15 | void main() { 16 | vec4 xl_retval; 17 | xl_retval = xlat_main( vec4(xlv_TEXCOORD0)); 18 | gl_FragData[0] = vec4(xl_retval); 19 | } 20 | -------------------------------------------------------------------------------- /tests/fragment/ternary-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | mediump vec4 xlat_main( in highp vec4 uv ) { 4 | #line 2 5 | mediump vec4 c = vec4( 0.0); 6 | c += (( (uv.x > 0.5) ) ? ( 0.9 ) : ( 0.1 )); 7 | c += (( (uv.x > 0.5) ) ? ( vec4( 0.9) ) : ( vec4( 0.1) )); 8 | c.xyz += (( (uv.x > 0.5) ) ? ( vec3( 0.9) ) : ( vec3( 0.1) )); 9 | #line 6 10 | c.xy += (( (uv.x > 0.5) ) ? ( vec2( 0.9) ) : ( vec2( 0.1) )); 11 | c.x += (( bool(fract(uv.x)) ) ? ( 0.9 ) : ( 0.1 )); 12 | return c; 13 | } 14 | varying highp vec4 xlv_TEXCOORD0; 15 | void main() { 16 | mediump vec4 xl_retval; 17 | xl_retval = xlat_main( vec4(xlv_TEXCOORD0)); 18 | gl_FragData[0] = vec4(xl_retval); 19 | } 20 | -------------------------------------------------------------------------------- /tests/fragment/ternary-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | mediump vec4 xlat_main( in highp vec4 uv ) { 4 | #line 2 5 | mediump vec4 c = vec4( 0.0); 6 | c += (( (uv.x > 0.5) ) ? ( 0.9 ) : ( 0.1 )); 7 | c += (( (uv.x > 0.5) ) ? ( vec4( 0.9) ) : ( vec4( 0.1) )); 8 | c.xyz += (( (uv.x > 0.5) ) ? ( vec3( 0.9) ) : ( vec3( 0.1) )); 9 | #line 6 10 | c.xy += (( (uv.x > 0.5) ) ? ( vec2( 0.9) ) : ( vec2( 0.1) )); 11 | c.x += (( bool(fract(uv.x)) ) ? ( 0.9 ) : ( 0.1 )); 12 | return c; 13 | } 14 | in highp vec4 xlv_TEXCOORD0; 15 | void main() { 16 | mediump vec4 xl_retval; 17 | xl_retval = xlat_main( vec4(xlv_TEXCOORD0)); 18 | gl_FragData[0] = vec4(xl_retval); 19 | } 20 | -------------------------------------------------------------------------------- /tests/fragment/ternary-vec4-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "ternary-vec4-in.txt" 2 | half4 main (float4 uv : TEXCOORD0) : COLOR0 { 3 | float4 a = 0; 4 | a += uv > 0.5 ? float4(1,2,3,4) : float4(5,6,7,8); 5 | a += uv > float4(0.5) ? float4(1,2,3,4) : float4(5,6,7,8); 6 | a += uv > 0.5 ? float4(1) : float4(2); 7 | a += uv > 0.5 ? 1 : 2; 8 | a += frac(uv) ? float4(1) : float4(2); 9 | return a; 10 | } 11 | -------------------------------------------------------------------------------- /tests/fragment/tex2DArray-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "tex2DArray-in.txt" 2 | 3 | sampler2DArray myarr; 4 | 5 | fixed4 main (float4 uv : TEXCOORD0) : COLOR0 6 | { 7 | float4 s = tex2DArray (myarr, uv.xyz); 8 | float4 sswiz = tex2DArray (myarr, uv.xyw); 9 | float4 sbias = tex2DArraybias (myarr, float4(uv.xyz, 1.5)); 10 | 11 | // Looks like Mac GL 2.x does not understand "texture2DArrayLod" 12 | // part of the extension spec, so don't test for that... 13 | //float4 slod = tex2DArraylod (myarr, float4(uv.xyz, 1.5)); 14 | float4 slod = 0; 15 | 16 | return s + sswiz + sbias + slod; 17 | } 18 | -------------------------------------------------------------------------------- /tests/fragment/tex2DArray-out.txt: -------------------------------------------------------------------------------- 1 | #extension GL_EXT_texture_array : require 2 | vec4 xll_tex2DArray(sampler2DArray s, vec3 coord) { return texture2DArray (s, coord); } 3 | vec4 xll_tex2DArrayBias(sampler2DArray s, vec4 coord) { return texture2DArray (s, coord.xyz, coord.w); } 4 | #line 2 5 | uniform sampler2DArray myarr; 6 | #line 4 7 | vec4 xlat_main( in vec4 uv ) { 8 | #line 6 9 | vec4 s = xll_tex2DArray( myarr, uv.xyz); 10 | vec4 sswiz = xll_tex2DArray( myarr, uv.xyw); 11 | vec4 sbias = xll_tex2DArrayBias( myarr, vec4( uv.xyz, 1.5)); 12 | #line 13 13 | vec4 slod = vec4( 0.0); 14 | return (((s + sswiz) + sbias) + slod); 15 | } 16 | varying vec4 xlv_TEXCOORD0; 17 | void main() { 18 | vec4 xl_retval; 19 | xl_retval = xlat_main( vec4(xlv_TEXCOORD0)); 20 | gl_FragData[0] = vec4(xl_retval); 21 | } 22 | 23 | // uniforms: 24 | // myarr: type 31 arrsize 0 25 | -------------------------------------------------------------------------------- /tests/fragment/tex2DArray-outES3.txt: -------------------------------------------------------------------------------- 1 | vec4 xll_tex2DArray(sampler2DArray s, vec3 coord) { return texture (s, coord); } 2 | vec4 xll_tex2DArrayBias(sampler2DArray s, vec4 coord) { return texture (s, coord.xyz, coord.w); } 3 | #line 2 4 | uniform lowp sampler2DArray myarr; 5 | #line 4 6 | lowp vec4 xlat_main( in highp vec4 uv ) { 7 | #line 6 8 | highp vec4 s = xll_tex2DArray( myarr, uv.xyz); 9 | highp vec4 sswiz = xll_tex2DArray( myarr, uv.xyw); 10 | highp vec4 sbias = xll_tex2DArrayBias( myarr, vec4( uv.xyz, 1.5)); 11 | #line 13 12 | highp vec4 slod = vec4( 0.0); 13 | return (((s + sswiz) + sbias) + slod); 14 | } 15 | in highp vec4 xlv_TEXCOORD0; 16 | void main() { 17 | lowp vec4 xl_retval; 18 | xl_retval = xlat_main( vec4(xlv_TEXCOORD0)); 19 | gl_FragData[0] = vec4(xl_retval); 20 | } 21 | 22 | // uniforms: 23 | // myarr: type 31 arrsize 0 24 | -------------------------------------------------------------------------------- /tests/fragment/tex2d-func-call-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "tex2dlod-in.txt" 2 | sampler2D tex; 3 | 4 | float test(float a) 5 | { 6 | return tex2Dlod (tex, float4(a.xx,0,0)); 7 | } 8 | 9 | half4 main (float4 uv : TEXCOORD0) : COLOR0 { 10 | return test(tex2Dlod (tex, float4(uv.xy,0,0))); 11 | } 12 | -------------------------------------------------------------------------------- /tests/fragment/tex2d-func-call-out.txt: -------------------------------------------------------------------------------- 1 | #extension GL_ARB_shader_texture_lod : require 2 | vec4 xll_tex2Dlod(sampler2D s, vec4 coord) { 3 | return texture2DLod( s, coord.xy, coord.w); 4 | } 5 | #line 1 6 | uniform sampler2D tex; 7 | #line 3 8 | float test( in float a ) { 9 | #line 5 10 | return float( xll_tex2Dlod( tex, vec4( vec2( a), 0.0, 0.0))); 11 | } 12 | #line 8 13 | vec4 xlat_main( in vec4 uv ) { 14 | #line 9 15 | return vec4( test( float( xll_tex2Dlod( tex, vec4( uv.xy, 0.0, 0.0))))); 16 | } 17 | varying vec4 xlv_TEXCOORD0; 18 | void main() { 19 | vec4 xl_retval; 20 | xl_retval = xlat_main( vec4(xlv_TEXCOORD0)); 21 | gl_FragData[0] = vec4(xl_retval); 22 | } 23 | 24 | // uniforms: 25 | // tex: type 25 arrsize 0 26 | -------------------------------------------------------------------------------- /tests/fragment/tex2d-func-call-outES.txt: -------------------------------------------------------------------------------- 1 | #extension GL_EXT_shader_texture_lod : require 2 | vec4 xll_tex2Dlod(sampler2D s, vec4 coord) { 3 | return texture2DLodEXT( s, coord.xy, coord.w); 4 | } 5 | #line 1 6 | uniform sampler2D tex; 7 | #line 3 8 | highp float test( in highp float a ) { 9 | #line 5 10 | return float( xll_tex2Dlod( tex, vec4( vec2( a), 0.0, 0.0))); 11 | } 12 | #line 8 13 | mediump vec4 xlat_main( in highp vec4 uv ) { 14 | #line 9 15 | return vec4( test( float( xll_tex2Dlod( tex, vec4( uv.xy, 0.0, 0.0))))); 16 | } 17 | varying highp vec4 xlv_TEXCOORD0; 18 | void main() { 19 | mediump vec4 xl_retval; 20 | xl_retval = xlat_main( vec4(xlv_TEXCOORD0)); 21 | gl_FragData[0] = vec4(xl_retval); 22 | } 23 | 24 | // uniforms: 25 | // tex: type 25 arrsize 0 26 | -------------------------------------------------------------------------------- /tests/fragment/tex2d-func-call-outES3.txt: -------------------------------------------------------------------------------- 1 | vec4 xll_tex2Dlod(sampler2D s, vec4 coord) { 2 | return textureLod( s, coord.xy, coord.w); 3 | } 4 | #line 1 5 | uniform sampler2D tex; 6 | #line 3 7 | highp float test( in highp float a ) { 8 | #line 5 9 | return float( xll_tex2Dlod( tex, vec4( vec2( a), 0.0, 0.0))); 10 | } 11 | #line 8 12 | mediump vec4 xlat_main( in highp vec4 uv ) { 13 | #line 9 14 | return vec4( test( float( xll_tex2Dlod( tex, vec4( uv.xy, 0.0, 0.0))))); 15 | } 16 | in highp vec4 xlv_TEXCOORD0; 17 | void main() { 18 | mediump vec4 xl_retval; 19 | xl_retval = xlat_main( vec4(xlv_TEXCOORD0)); 20 | gl_FragData[0] = vec4(xl_retval); 21 | } 22 | 23 | // uniforms: 24 | // tex: type 25 arrsize 0 25 | -------------------------------------------------------------------------------- /tests/fragment/tex2dlod-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "tex2dlod-in.txt" 2 | sampler2D tex; 3 | 4 | half4 main (float4 uv : TEXCOORD0) : COLOR0 { 5 | return tex2Dlod (tex, float4(uv.xy,0,0)); 6 | } 7 | -------------------------------------------------------------------------------- /tests/fragment/tex2dlod-out.txt: -------------------------------------------------------------------------------- 1 | #extension GL_ARB_shader_texture_lod : require 2 | vec4 xll_tex2Dlod(sampler2D s, vec4 coord) { 3 | return texture2DLod( s, coord.xy, coord.w); 4 | } 5 | #line 1 6 | uniform sampler2D tex; 7 | #line 3 8 | vec4 xlat_main( in vec4 uv ) { 9 | return xll_tex2Dlod( tex, vec4( uv.xy, 0.0, 0.0)); 10 | } 11 | varying vec4 xlv_TEXCOORD0; 12 | void main() { 13 | vec4 xl_retval; 14 | xl_retval = xlat_main( vec4(xlv_TEXCOORD0)); 15 | gl_FragData[0] = vec4(xl_retval); 16 | } 17 | 18 | // uniforms: 19 | // tex: type 25 arrsize 0 20 | -------------------------------------------------------------------------------- /tests/fragment/tex2dlod-outES.txt: -------------------------------------------------------------------------------- 1 | #extension GL_EXT_shader_texture_lod : require 2 | vec4 xll_tex2Dlod(sampler2D s, vec4 coord) { 3 | return texture2DLodEXT( s, coord.xy, coord.w); 4 | } 5 | #line 1 6 | uniform sampler2D tex; 7 | #line 3 8 | mediump vec4 xlat_main( in highp vec4 uv ) { 9 | return xll_tex2Dlod( tex, vec4( uv.xy, 0.0, 0.0)); 10 | } 11 | varying highp vec4 xlv_TEXCOORD0; 12 | void main() { 13 | mediump vec4 xl_retval; 14 | xl_retval = xlat_main( vec4(xlv_TEXCOORD0)); 15 | gl_FragData[0] = vec4(xl_retval); 16 | } 17 | 18 | // uniforms: 19 | // tex: type 25 arrsize 0 20 | -------------------------------------------------------------------------------- /tests/fragment/tex2dlod-outES3.txt: -------------------------------------------------------------------------------- 1 | vec4 xll_tex2Dlod(sampler2D s, vec4 coord) { 2 | return textureLod( s, coord.xy, coord.w); 3 | } 4 | #line 1 5 | uniform sampler2D tex; 6 | #line 3 7 | mediump vec4 xlat_main( in highp vec4 uv ) { 8 | return xll_tex2Dlod( tex, vec4( uv.xy, 0.0, 0.0)); 9 | } 10 | in highp vec4 xlv_TEXCOORD0; 11 | void main() { 12 | mediump vec4 xl_retval; 13 | xl_retval = xlat_main( vec4(xlv_TEXCOORD0)); 14 | gl_FragData[0] = vec4(xl_retval); 15 | } 16 | 17 | // uniforms: 18 | // tex: type 25 arrsize 0 19 | -------------------------------------------------------------------------------- /tests/fragment/texture-ops-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "texture-ops-in.txt" 2 | sampler2D tex; 3 | samplerCUBE cub; 4 | 5 | half4 main (float4 uv : TEXCOORD0) : COLOR0 { 6 | half4 c = 0; 7 | c += texCUBElod (cub, float4(uv.xyz,0)); 8 | c += tex2Dgrad (tex, uv.xy, ddx(uv.xy), ddy(uv.xy)); 9 | c += texCUBEgrad (cub, uv.xyz, ddx(uv.xyz), ddy(uv.xyz)); 10 | return c; 11 | } 12 | -------------------------------------------------------------------------------- /tests/fragment/texture-samplers-in.txt: -------------------------------------------------------------------------------- 1 | sampler2D texlow; 2 | sampler2D_half texmed; 3 | sampler2D_float texhigh; 4 | 5 | samplerCUBE cubelow; 6 | samplerCUBE_half cubemed; 7 | samplerCUBE_float cubehigh; 8 | 9 | half4 main (float4 uv : TEXCOORD0) : COLOR0 10 | { 11 | half4 c; 12 | c = tex2D (texlow, uv.xy); 13 | c += tex2D (texmed, uv.xy); 14 | c += tex2D (texhigh, uv.xy); 15 | c += texCUBE (cubelow, uv.xyz); 16 | c += texCUBE (cubemed, uv.xyz); 17 | c += texCUBE (cubehigh, uv.xyz); 18 | return c; 19 | } 20 | -------------------------------------------------------------------------------- /tests/fragment/uniforms-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "uniforms-in.txt" 2 | float uni1 : register(c0); 3 | uniform float uni2 : register(c1); 4 | 5 | float uniInit1 = 13.0; 6 | uniform float uniInit2 = 14.0; 7 | fixed4 main (float4 uv:TEXCOORD0, uniform float4 unicolor, uniform float4 reg : register(c2), uniform float4 lights[2]) : COLOR0 { 8 | return uv + unicolor + fixed4(uni1+uni2) + reg + lights[1] + uniInit1.xxxx + uniInit2.xxxx; 9 | } 10 | -------------------------------------------------------------------------------- /tests/fragment/uniforms-mutable-in.txt: -------------------------------------------------------------------------------- 1 | float uni1; 2 | half4 uni4; 3 | 4 | sampler2D tex1; 5 | 6 | float3 SampleDiffuse(float2 uv) 7 | { 8 | uni4.xy = uv; // modify uniform! 9 | return tex2D (tex1, uni4.xy); 10 | } 11 | 12 | fixed4 main (float4 uv:TEXCOORD0) : COLOR0 { 13 | fixed4 c = 0.0; 14 | c.x += uni4.x; 15 | c.rgb += SampleDiffuse(uv.xy); 16 | c.z += uni1; 17 | uni1 += 2.0; 18 | c.w += uni1; 19 | return c; 20 | } 21 | -------------------------------------------------------------------------------- /tests/fragment/upwardpromotion-in.txt: -------------------------------------------------------------------------------- 1 | sampler2D _MainTex; 2 | struct u2v { 3 | float4 vertex : POSITION; 4 | half2 texcoord : TEXCOORD0; 5 | }; 6 | struct v2f { 7 | half4 pos : SV_POSITION; 8 | half2 uv : TEXCOORD0; 9 | }; 10 | v2f vert (u2v v) { 11 | v2f o; 12 | o.pos = v.vertex; 13 | o.uv = v.texcoord; 14 | return o; 15 | } 16 | half4 main (v2f i) : SV_Target { 17 | half2 a = half2(i.uv); 18 | bool2 b = step(0.5, a); 19 | half2 c = half2(0,0); 20 | if (b.x) c.x = a.x; 21 | if (b.y) c.y = a.y; 22 | half4 col = tex2Dgrad(_MainTex, i.uv, i.uv.x*0.05, i.uv.y*0.05); 23 | return half4(c, col.z, 1); 24 | }; 25 | -------------------------------------------------------------------------------- /tests/fragment/varyings-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "varyings-in.txt" 2 | half4 main (float4 uv:TEXCOORD0, float4 foobar_xlv_foo : TEXCOORD1) : COLOR0 { 3 | half4 c = 0; 4 | return c; 5 | } 6 | -------------------------------------------------------------------------------- /tests/fragment/varyings-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | vec4 xlat_main( in vec4 uv, in vec4 foobar_xlv_foo ) { 4 | #line 2 5 | vec4 c = vec4( 0.0); 6 | return c; 7 | } 8 | varying vec4 xlv_TEXCOORD0; 9 | varying vec4 xlv_TEXCOORD1; 10 | void main() { 11 | vec4 xl_retval; 12 | xl_retval = xlat_main( vec4(xlv_TEXCOORD0), vec4(xlv_TEXCOORD1)); 13 | gl_FragData[0] = vec4(xl_retval); 14 | } 15 | -------------------------------------------------------------------------------- /tests/fragment/varyings-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | mediump vec4 xlat_main( in highp vec4 uv, in highp vec4 foobar_xlv_foo ) { 4 | #line 2 5 | mediump vec4 c = vec4( 0.0); 6 | return c; 7 | } 8 | varying highp vec4 xlv_TEXCOORD0; 9 | varying highp vec4 xlv_TEXCOORD1; 10 | void main() { 11 | mediump vec4 xl_retval; 12 | xl_retval = xlat_main( vec4(xlv_TEXCOORD0), vec4(xlv_TEXCOORD1)); 13 | gl_FragData[0] = vec4(xl_retval); 14 | } 15 | -------------------------------------------------------------------------------- /tests/fragment/varyings-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | mediump vec4 xlat_main( in highp vec4 uv, in highp vec4 foobar_xlv_foo ) { 4 | #line 2 5 | mediump vec4 c = vec4( 0.0); 6 | return c; 7 | } 8 | in highp vec4 xlv_TEXCOORD0; 9 | in highp vec4 xlv_TEXCOORD1; 10 | void main() { 11 | mediump vec4 xl_retval; 12 | xl_retval = xlat_main( vec4(xlv_TEXCOORD0), vec4(xlv_TEXCOORD1)); 13 | gl_FragData[0] = vec4(xl_retval); 14 | } 15 | -------------------------------------------------------------------------------- /tests/fragment/vface-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "vface-in.txt" 2 | half4 main (float face : VFACE) : COLOR0 { 3 | return face; 4 | } 5 | -------------------------------------------------------------------------------- /tests/fragment/vface-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | vec4 xlat_main( in float face ) { 4 | #line 2 5 | return vec4( face); 6 | } 7 | void main() { 8 | vec4 xl_retval; 9 | xl_retval = xlat_main( float((gl_FrontFacing ? 1.0 : -1.0))); 10 | gl_FragData[0] = vec4(xl_retval); 11 | } 12 | -------------------------------------------------------------------------------- /tests/fragment/vface-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | mediump vec4 xlat_main( in highp float face ) { 4 | #line 2 5 | return vec4( face); 6 | } 7 | void main() { 8 | mediump vec4 xl_retval; 9 | xl_retval = xlat_main( float((gl_FrontFacing ? 1.0 : -1.0))); 10 | gl_FragData[0] = vec4(xl_retval); 11 | } 12 | -------------------------------------------------------------------------------- /tests/fragment/vface-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | mediump vec4 xlat_main( in highp float face ) { 4 | #line 2 5 | return vec4( face); 6 | } 7 | void main() { 8 | mediump vec4 xl_retval; 9 | xl_retval = xlat_main( float((gl_FrontFacing ? 1.0 : -1.0))); 10 | gl_FragData[0] = vec4(xl_retval); 11 | } 12 | -------------------------------------------------------------------------------- /tests/fragment/vpos-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "vpos-in.txt" 2 | half4 main (float2 pos : VPOS) : COLOR0 { 3 | return float4(pos,0,0); 4 | } 5 | -------------------------------------------------------------------------------- /tests/fragment/vpos-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | vec4 xlat_main( in vec2 pos ) { 4 | #line 2 5 | return vec4( pos, 0.0, 0.0); 6 | } 7 | void main() { 8 | vec4 xl_retval; 9 | xl_retval = xlat_main( vec2(gl_FragCoord)); 10 | gl_FragData[0] = vec4(xl_retval); 11 | } 12 | -------------------------------------------------------------------------------- /tests/fragment/vpos-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | mediump vec4 xlat_main( in highp vec2 pos ) { 4 | #line 2 5 | return vec4( pos, 0.0, 0.0); 6 | } 7 | void main() { 8 | mediump vec4 xl_retval; 9 | xl_retval = xlat_main( vec2(gl_FragCoord)); 10 | gl_FragData[0] = vec4(xl_retval); 11 | } 12 | -------------------------------------------------------------------------------- /tests/fragment/vpos-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | mediump vec4 xlat_main( in highp vec2 pos ) { 4 | #line 2 5 | return vec4( pos, 0.0, 0.0); 6 | } 7 | void main() { 8 | mediump vec4 xl_retval; 9 | xl_retval = xlat_main( vec2(gl_FragCoord)); 10 | gl_FragData[0] = vec4(xl_retval); 11 | } 12 | -------------------------------------------------------------------------------- /tests/fragment/z-ogre-grass1-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "complex-ogre-grass1-in.txt" 2 | // grass shadow caster 3 | void main( 4 | float4 position : POSITION, 5 | float2 uv : TEXCOORD0, 6 | float2 depth : TEXCOORD1, 7 | 8 | out float4 result : COLOR, 9 | 10 | uniform sampler2D diffuseMap 11 | ) 12 | { 13 | float alpha = tex2D(diffuseMap, uv).a; 14 | if (alpha > 0.001) 15 | { 16 | result = float4(1.0f, 1.0f, 1.0f, 0.0f); 17 | } 18 | else 19 | { 20 | float finalDepth = depth.x / depth.y; 21 | // just smear across all components 22 | // therefore this one needs high individual channel precision 23 | result = float4(finalDepth.xxx, 1.0f); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tests/fragment/z-ogre-grass1-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 10 3 | void xlat_main( in vec4 position, in vec2 uv, in vec2 depth, out vec4 result, sampler2D diffuseMap ) { 4 | #line 12 5 | float alpha = texture2D( diffuseMap, uv).w; 6 | if ((alpha > 0.001)){ 7 | result = vec4( 1.0, 1.0, 1.0, 0.0); 8 | } 9 | else{ 10 | #line 19 11 | float finalDepth = (depth.x / depth.y); 12 | result = vec4( vec3( finalDepth), 1.0); 13 | } 14 | } 15 | uniform sampler2D xlu_diffuseMap; 16 | varying vec2 xlv_TEXCOORD0; 17 | varying vec2 xlv_TEXCOORD1; 18 | void main() { 19 | vec4 xlt_result; 20 | xlat_main( vec4(0.0), vec2(xlv_TEXCOORD0), vec2(xlv_TEXCOORD1), xlt_result, xlu_diffuseMap); 21 | gl_FragData[0] = vec4(xlt_result); 22 | ; 23 | } 24 | 25 | // uniforms: 26 | // diffuseMap: type 25 arrsize 0 27 | -------------------------------------------------------------------------------- /tests/fragment/z-ogre-grass1-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 10 3 | void xlat_main( in highp vec4 position, in highp vec2 uv, in highp vec2 depth, out highp vec4 result, sampler2D diffuseMap ) { 4 | #line 12 5 | highp float alpha = texture2D( diffuseMap, uv).w; 6 | if ((alpha > 0.001)){ 7 | result = vec4( 1.0, 1.0, 1.0, 0.0); 8 | } 9 | else{ 10 | #line 19 11 | highp float finalDepth = (depth.x / depth.y); 12 | result = vec4( vec3( finalDepth), 1.0); 13 | } 14 | } 15 | uniform sampler2D xlu_diffuseMap; 16 | varying highp vec2 xlv_TEXCOORD0; 17 | varying highp vec2 xlv_TEXCOORD1; 18 | void main() { 19 | highp vec4 xlt_result; 20 | xlat_main( vec4(0.0), vec2(xlv_TEXCOORD0), vec2(xlv_TEXCOORD1), xlt_result, xlu_diffuseMap); 21 | gl_FragData[0] = vec4(xlt_result); 22 | ; 23 | } 24 | 25 | // uniforms: 26 | // diffuseMap: type 25 arrsize 0 27 | -------------------------------------------------------------------------------- /tests/fragment/z-ogre-grass1-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 10 3 | void xlat_main( in highp vec4 position, in highp vec2 uv, in highp vec2 depth, out highp vec4 result, sampler2D diffuseMap ) { 4 | #line 12 5 | highp float alpha = texture( diffuseMap, uv).w; 6 | if ((alpha > 0.001)){ 7 | result = vec4( 1.0, 1.0, 1.0, 0.0); 8 | } 9 | else{ 10 | #line 19 11 | highp float finalDepth = (depth.x / depth.y); 12 | result = vec4( vec3( finalDepth), 1.0); 13 | } 14 | } 15 | uniform sampler2D xlu_diffuseMap; 16 | in highp vec2 xlv_TEXCOORD0; 17 | in highp vec2 xlv_TEXCOORD1; 18 | void main() { 19 | highp vec4 xlt_result; 20 | xlat_main( vec4(0.0), vec2(xlv_TEXCOORD0), vec2(xlv_TEXCOORD1), xlt_result, xlu_diffuseMap); 21 | gl_FragData[0] = vec4(xlt_result); 22 | ; 23 | } 24 | 25 | // uniforms: 26 | // diffuseMap: type 25 arrsize 0 27 | -------------------------------------------------------------------------------- /tests/fragment/z-particle-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "complex-particle-in.txt" 2 | struct v2f { 3 | float4 vertex : POSITION; 4 | fixed4 color : COLOR; 5 | half2 texcoord : TEXCOORD0; 6 | }; 7 | fixed4 _TintColor; 8 | sampler2D _MainTex; 9 | half4 main (v2f i) : COLOR 10 | { 11 | return i.color * tex2D (_MainTex, i.texcoord); 12 | } 13 | -------------------------------------------------------------------------------- /tests/fragment/z-particle-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | struct v2f { 4 | vec4 vertex; 5 | vec4 color; 6 | vec2 texcoord; 7 | }; 8 | #line 6 9 | uniform vec4 _TintColor; 10 | uniform sampler2D _MainTex; 11 | #line 8 12 | vec4 xlat_main( in v2f i ) { 13 | #line 10 14 | return (i.color * texture2D( _MainTex, i.texcoord)); 15 | } 16 | varying vec4 xlv_COLOR; 17 | varying vec2 xlv_TEXCOORD0; 18 | void main() { 19 | vec4 xl_retval; 20 | v2f xlt_i; 21 | xlt_i.vertex = vec4(0.0); 22 | xlt_i.color = vec4(xlv_COLOR); 23 | xlt_i.texcoord = vec2(xlv_TEXCOORD0); 24 | xl_retval = xlat_main( xlt_i); 25 | gl_FragData[0] = vec4(xl_retval); 26 | } 27 | 28 | // uniforms: 29 | // _MainTex: type 25 arrsize 0 30 | -------------------------------------------------------------------------------- /tests/fragment/z-particle-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | struct v2f { 4 | highp vec4 vertex; 5 | lowp vec4 color; 6 | mediump vec2 texcoord; 7 | }; 8 | #line 6 9 | uniform lowp vec4 _TintColor; 10 | uniform sampler2D _MainTex; 11 | #line 8 12 | mediump vec4 xlat_main( in v2f i ) { 13 | #line 10 14 | return (i.color * texture2D( _MainTex, i.texcoord)); 15 | } 16 | varying lowp vec4 xlv_COLOR; 17 | varying mediump vec2 xlv_TEXCOORD0; 18 | void main() { 19 | mediump vec4 xl_retval; 20 | v2f xlt_i; 21 | xlt_i.vertex = vec4(0.0); 22 | xlt_i.color = vec4(xlv_COLOR); 23 | xlt_i.texcoord = vec2(xlv_TEXCOORD0); 24 | xl_retval = xlat_main( xlt_i); 25 | gl_FragData[0] = vec4(xl_retval); 26 | } 27 | 28 | // uniforms: 29 | // _MainTex: type 25 arrsize 0 30 | -------------------------------------------------------------------------------- /tests/fragment/z-particle-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | struct v2f { 4 | highp vec4 vertex; 5 | lowp vec4 color; 6 | mediump vec2 texcoord; 7 | }; 8 | #line 6 9 | uniform lowp vec4 _TintColor; 10 | uniform sampler2D _MainTex; 11 | #line 8 12 | mediump vec4 xlat_main( in v2f i ) { 13 | #line 10 14 | return (i.color * texture( _MainTex, i.texcoord)); 15 | } 16 | in lowp vec4 xlv_COLOR; 17 | in mediump vec2 xlv_TEXCOORD0; 18 | void main() { 19 | mediump vec4 xl_retval; 20 | v2f xlt_i; 21 | xlt_i.vertex = vec4(0.0); 22 | xlt_i.color = vec4(xlv_COLOR); 23 | xlt_i.texcoord = vec2(xlv_TEXCOORD0); 24 | xl_retval = xlat_main( xlt_i); 25 | gl_FragData[0] = vec4(xl_retval); 26 | } 27 | 28 | // uniforms: 29 | // _MainTex: type 25 arrsize 0 30 | -------------------------------------------------------------------------------- /tests/vertex-120/const-expr-init-in.txt: -------------------------------------------------------------------------------- 1 | static const int kInt1 = 3; 2 | const int kInt2 = 7; 3 | static int kInt3 = 11; 4 | 5 | float size1 = 512.0; 6 | float size2 = 1.0 / 64.0; 7 | float size3 = kInt1; 8 | float size4 = kInt2 / 3.0; 9 | float size5 = 5 - kInt2; 10 | float size6 = kInt2 * 512.0; 11 | float size7 = -kInt1; 12 | float size8 = -(1.0 / 4.0 + (4.0 * (-(2.0/4.0)))); 13 | float size9 = -(1.0 / 4 + (4.0 * (-(2/4)))); 14 | 15 | uniform float3 my_vec3a = float3(1,2,3); 16 | uniform float3 my_vec3b = {1,2,3}; 17 | 18 | float4 main() : POSITION 19 | { 20 | return float4(kInt1, kInt2, kInt3, size2 + size8); 21 | } 22 | -------------------------------------------------------------------------------- /tests/vertex-120/const-expr-init-out.txt: -------------------------------------------------------------------------------- 1 | #version 120 2 | const int kInt1 = 3; 3 | const int kInt2 = 7; 4 | #line 3 5 | int kInt3 = 11; 6 | uniform float size1 = 512.0; 7 | uniform float size2 = 0.015625; 8 | #line 7 9 | uniform float size3 = 3.0; 10 | uniform float size4 = 2.333333; 11 | uniform float size5 = -2.0; 12 | uniform float size6 = 3584.0; 13 | #line 11 14 | uniform float size7 = -3.0; 15 | uniform float size8 = 1.75; 16 | uniform float size9 = -0.25; 17 | #line 15 18 | uniform vec3 my_vec3a = vec3( 1.0, 2.0, 3.0); 19 | uniform vec3 my_vec3b = vec3( 1.0, 2.0, 3.0); 20 | #line 18 21 | vec4 xlat_main( ) { 22 | #line 20 23 | return vec4( 3.0, 7.0, float(kInt3), (size2 + size8)); 24 | } 25 | void main() { 26 | vec4 xl_retval; 27 | xl_retval = xlat_main( ); 28 | gl_Position = vec4(xl_retval); 29 | } 30 | 31 | // uniforms: 32 | // size2: type 9 arrsize 0 33 | // size8: type 9 arrsize 0 34 | -------------------------------------------------------------------------------- /tests/vertex-120/const-expr-init-outES3.txt: -------------------------------------------------------------------------------- 1 | const highp int kInt1 = 3; 2 | const highp int kInt2 = 7; 3 | #line 3 4 | highp int kInt3; 5 | uniform highp float size1; 6 | uniform highp float size2; 7 | #line 7 8 | uniform highp float size3; 9 | uniform highp float size4; 10 | uniform highp float size5; 11 | uniform highp float size6; 12 | #line 11 13 | uniform highp float size7; 14 | uniform highp float size8; 15 | uniform highp float size9; 16 | #line 15 17 | uniform highp vec3 my_vec3a; 18 | uniform highp vec3 my_vec3b; 19 | #line 18 20 | highp vec4 xlat_main( ) { 21 | #line 20 22 | return vec4( 3.0, 7.0, float(kInt3), (size2 + size8)); 23 | } 24 | void main() { 25 | kInt3 = 11; 26 | highp vec4 xl_retval; 27 | xl_retval = xlat_main( ); 28 | gl_Position = vec4(xl_retval); 29 | } 30 | 31 | // uniforms: 32 | // size2: type 9 arrsize 0 33 | // size8: type 9 arrsize 0 34 | -------------------------------------------------------------------------------- /tests/vertex-120/global-init-in.txt: -------------------------------------------------------------------------------- 1 | uniform float4 uniVar = 1.; 2 | static float4 staticVar = uniVar; 3 | static float4 staticVar2 = staticVar; 4 | float4 unusedVar = 50; 5 | float uninitializedVar; 6 | 7 | float test() 8 | { 9 | return staticVar.x * 2. + uninitializedVar + staticVar2.y; 10 | } 11 | 12 | float4 main() : POSITION 13 | { 14 | float4 tempVar = uniVar * staticVar * test(); 15 | return tempVar; 16 | } 17 | -------------------------------------------------------------------------------- /tests/vertex-120/global-init-out.txt: -------------------------------------------------------------------------------- 1 | #version 120 2 | uniform vec4 uniVar = vec4( 1.0); 3 | vec4 staticVar = uniVar; 4 | #line 3 5 | vec4 staticVar2 = staticVar; 6 | uniform vec4 unusedVar = vec4( 50.0); 7 | uniform float uninitializedVar; 8 | #line 7 9 | #line 12 10 | #line 7 11 | float test( ) { 12 | return (((staticVar.x * 2.0) + uninitializedVar) + staticVar2.y); 13 | } 14 | #line 12 15 | vec4 xlat_main( ) { 16 | vec4 tempVar = ((uniVar * staticVar) * test( )); 17 | return tempVar; 18 | } 19 | void main() { 20 | vec4 xl_retval; 21 | xl_retval = xlat_main( ); 22 | gl_Position = vec4(xl_retval); 23 | } 24 | 25 | // uniforms: 26 | // uniVar: type 12 arrsize 0 27 | // uninitializedVar: type 9 arrsize 0 28 | -------------------------------------------------------------------------------- /tests/vertex-120/global-init-out120arr.txt: -------------------------------------------------------------------------------- 1 | #version 120 2 | uniform vec4 uniVar = vec4( 1.0); 3 | vec4 staticVar = uniVar; 4 | #line 3 5 | vec4 staticVar2 = staticVar; 6 | uniform vec4 unusedVar = vec4( 50.0); 7 | uniform float uninitializedVar; 8 | #line 7 9 | #line 12 10 | float test( ); 11 | vec4 xlat_main( ); 12 | #line 7 13 | float test( ) { 14 | return (((staticVar.x * 2.0) + uninitializedVar) + staticVar2.y); 15 | } 16 | #line 12 17 | vec4 xlat_main( ) { 18 | vec4 tempVar = ((uniVar * staticVar) * test( )); 19 | return tempVar; 20 | } 21 | void main() { 22 | vec4 xl_retval; 23 | xl_retval = xlat_main( ); 24 | gl_Position = vec4(xl_retval); 25 | } 26 | 27 | // uniforms: 28 | // uniVar: type 12 arrsize 0 29 | // uninitializedVar: type 9 arrsize 0 30 | -------------------------------------------------------------------------------- /tests/vertex-120/global-init-outES.txt: -------------------------------------------------------------------------------- 1 | uniform highp vec4 uniVar = vec4( 1.0); 2 | highp vec4 staticVar = uniVar; 3 | #line 3 4 | highp vec4 staticVar2 = staticVar; 5 | uniform highp vec4 unusedVar = vec4( 50.0); 6 | uniform highp float uninitializedVar; 7 | #line 7 8 | #line 12 9 | highp float test( ); 10 | highp vec4 xlat_main( ); 11 | #line 7 12 | highp float test( ) { 13 | return (((staticVar.x * 2.0) + uninitializedVar) + staticVar2.y); 14 | } 15 | #line 12 16 | highp vec4 xlat_main( ) { 17 | highp vec4 tempVar = ((uniVar * staticVar) * test( )); 18 | return tempVar; 19 | } 20 | void main() { 21 | highp vec4 xl_retval; 22 | xl_retval = xlat_main( ); 23 | gl_Position = vec4(xl_retval); 24 | } 25 | 26 | // uniforms: 27 | // uniVar: type 12 arrsize 0 28 | // uninitializedVar: type 9 arrsize 0 29 | -------------------------------------------------------------------------------- /tests/vertex-120/global-init-outES3.txt: -------------------------------------------------------------------------------- 1 | uniform highp vec4 uniVar; 2 | highp vec4 staticVar; 3 | #line 3 4 | highp vec4 staticVar2; 5 | uniform highp vec4 unusedVar; 6 | uniform highp float uninitializedVar; 7 | #line 7 8 | #line 12 9 | #line 7 10 | highp float test( ) { 11 | return (((staticVar.x * 2.0) + uninitializedVar) + staticVar2.y); 12 | } 13 | #line 12 14 | highp vec4 xlat_main( ) { 15 | highp vec4 tempVar = ((uniVar * staticVar) * test( )); 16 | return tempVar; 17 | } 18 | void main() { 19 | staticVar = uniVar; 20 | staticVar2 = staticVar; 21 | highp vec4 xl_retval; 22 | xl_retval = xlat_main( ); 23 | gl_Position = vec4(xl_retval); 24 | } 25 | 26 | // uniforms: 27 | // uniVar: type 12 arrsize 0 28 | // uninitializedVar: type 9 arrsize 0 29 | -------------------------------------------------------------------------------- /tests/vertex-failures/array-size-in.txt: -------------------------------------------------------------------------------- 1 | int someInt; 2 | float arr1[someInt]; // error 3 | 4 | float arr2[5.0]; // error 5 | 6 | float arr3[10]; 7 | 8 | static const int kSize = 5; 9 | float arr4[kSize*2]; 10 | 11 | float4 main() : POSITION 12 | { 13 | float a = 0.0; 14 | a += arr3[10]; // error, out of bounds 15 | a += arr3[2*5]; // error, out of bounds 16 | a += arr4[10]; // error, out of bounds 17 | a += arr4[kSize*2+1]; // error, out of bounds 18 | return a; 19 | } 20 | -------------------------------------------------------------------------------- /tests/vertex-failures/array-size-out.txt: -------------------------------------------------------------------------------- 1 | (2): ERROR: '' : constant expression required 2 | (2): ERROR: '' : array size must be a constant integer expression 3 | (4): ERROR: '' : array size must be a constant integer expression 4 | (14): ERROR: '[' : array index out of range '10' 5 | (15): ERROR: '[' : array index out of range '10' 6 | (16): ERROR: '[' : array index out of range '10' 7 | (17): ERROR: '[' : array index out of range '11' 8 | -------------------------------------------------------------------------------- /tests/vertex-failures/const-expr-arraysize-in.txt: -------------------------------------------------------------------------------- 1 | 2 | // This given an error right now, since 3 | // no constant folding is performed on int4 4 | // constructors. Ideally this should be fixed! 5 | float params1[int4(1,2,3,4).z * 10]; 6 | 7 | // This given an error right now, since 8 | // no constant folding is performed on variable 9 | // references. Ideally this should be fixed! 10 | static const int4 kFoo4 = int4(1,2,3,4); 11 | float params2[kFoo4.y * 10]; 12 | 13 | 14 | float4 main() : POSITION 15 | { 16 | return 0.0; 17 | } 18 | -------------------------------------------------------------------------------- /tests/vertex-failures/const-expr-arraysize-out.txt: -------------------------------------------------------------------------------- 1 | (5): ERROR: '' : constant expression required 2 | (5): ERROR: '' : array size must be a constant integer expression 3 | (11): ERROR: '' : constant expression required 4 | (11): ERROR: '' : array size must be a constant integer expression 5 | -------------------------------------------------------------------------------- /tests/vertex-failures/error-lines-in.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | // 4 | 5 | static const float line_5_must_be_inited; 6 | 7 | /* 8 | 9 | */ 10 | 11 | #line 100 12 | 13 | 14 | 15 | static const float line_103_must_be_inited; 16 | 17 | #line 200 "somefile.txt" 18 | 19 | 20 | static const float line_202_must_be_inited; 21 | -------------------------------------------------------------------------------- /tests/vertex-failures/error-lines-out.txt: -------------------------------------------------------------------------------- 1 | (5): ERROR: 'line_5_must_be_inited' : variables with qualifier 'const' must be initialized 2 | (103): ERROR: 'line_103_must_be_inited' : variables with qualifier 'const' must be initialized 3 | somefile.txt(202): ERROR: 'line_202_must_be_inited' : variables with qualifier 'const' must be initialized 4 | -------------------------------------------------------------------------------- /tests/vertex-failures/missing-field-selection-no-assert-out.txt: -------------------------------------------------------------------------------- 1 | (31): ERROR: 'glstate' : undeclared identifier 2 | (31): ERROR: 'light' : illegal vector field selection 3 | (31): ERROR: 'glstate' : left of '[' is not of type array, matrix, or vector 4 | (31): ERROR: 'position' : illegal vector field selection 5 | (31): ERROR: 'xyz' : vector field selection out of range 6 | (33): ERROR: 'light' : illegal vector field selection 7 | (33): ERROR: 'glstate' : left of '[' is not of type array, matrix, or vector 8 | (33): ERROR: 'diffuse' : illegal vector field selection 9 | (33): ERROR: 'xyz' : vector field selection out of range 10 | -------------------------------------------------------------------------------- /tests/vertex-failures/multiple-file-lines-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "multiple-file-lines-in.txt" 2 | #line 1 "multiple-file-lines-in.hlsl" 3 | #ifdef FREAKY 4 | #ifdef FREAKY 5 | #ifdef FREAKY 6 | #ifdef FREAKY 7 | #ifdef FREAKY 8 | #ifdef FREAKY 9 | #ifdef FREAKY 10 | #ifdef FREAKY 11 | #ifdef FREAKY 12 | #ifdef FREAKY 13 | #line 2 "multiple-file-lines-in.hlsl" 14 | #endif 15 | #endif 16 | #endif 17 | #endif 18 | #endif 19 | #endif 20 | #endif 21 | #endif 22 | #endif 23 | #endif 24 | void main(out float4 overtex : POSITION) 25 | { 26 | bloat4 b(1.f, 1.f, 1.f, 1.f); 27 | overtex = float4(b.x,b.y,b,z,b.w); 28 | } 29 | 30 | -------------------------------------------------------------------------------- /tests/vertex-failures/multiple-file-lines-out.txt: -------------------------------------------------------------------------------- 1 | multiple-file-lines-in.hlsl(14): ERROR: 'bloat4' : undeclared identifier 2 | multiple-file-lines-in.hlsl(14): ERROR: 'b' : syntax error syntax error 3 | -------------------------------------------------------------------------------- /tests/vertex-failures/nested-unknown-types-in.txt: -------------------------------------------------------------------------------- 1 | struct v2f { 2 | float4 pos : POSITION; 3 | fixed4 color : COLOR0; 4 | }; 5 | 6 | struct appdata { 7 | float4 vertex : POSITION; 8 | float3 normal : NORMAL; 9 | }; 10 | 11 | float4x4 UNITY_MATRIX_IT_MV; 12 | 13 | v2f main (appdata v) 14 | { 15 | v2f o; 16 | o.pos = v.vertex; 17 | 18 | float3 lightDir; 19 | float4 lightColor = 0.1; 20 | for( int i = 0; i < 4; i++ ) 21 | { 22 | // glstate is not declared! 23 | lightDir = mul( glstate.light[i].position.xyz, (float3x3)UNITY_MATRIX_IT_MV ); 24 | float diff = saturate(dot(v.normal, lightDir)); 25 | lightColor.xyz += glstate.light[i].diffuse.xyz * diff; 26 | } 27 | o.color = lightColor; 28 | return o; 29 | } 30 | -------------------------------------------------------------------------------- /tests/vertex-failures/nested-unknown-types-out.txt: -------------------------------------------------------------------------------- 1 | (23): ERROR: 'glstate' : undeclared identifier 2 | (23): ERROR: 'light' : illegal vector field selection 3 | (23): ERROR: 'glstate' : left of '[' is not of type array, matrix, or vector 4 | (23): ERROR: 'position' : illegal vector field selection 5 | (23): ERROR: 'xyz' : vector field selection out of range 6 | (25): ERROR: 'light' : illegal vector field selection 7 | (25): ERROR: 'glstate' : left of '[' is not of type array, matrix, or vector 8 | (25): ERROR: 'diffuse' : illegal vector field selection 9 | (25): ERROR: 'xyz' : vector field selection out of range 10 | -------------------------------------------------------------------------------- /tests/vertex-failures/no-entry-point-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "no-entry-point-in.txt" 2 | float4 some_function() 3 | { 4 | return float4(1.f, 1.f, 2.f, 3.f); 5 | } 6 | -------------------------------------------------------------------------------- /tests/vertex-failures/no-entry-point-out.txt: -------------------------------------------------------------------------------- 1 | Failed to find entry function: 'xlat_main' 2 | -------------------------------------------------------------------------------- /tests/vertex-failures/qualifiers-in.txt: -------------------------------------------------------------------------------- 1 | static const float stat_2; // must be initialized 2 | const float const_3; // must be initialized 3 | 4 | float4 main () : POSITION 5 | { 6 | return stat_2 + const_3; 7 | } 8 | -------------------------------------------------------------------------------- /tests/vertex-failures/qualifiers-out.txt: -------------------------------------------------------------------------------- 1 | (1): ERROR: 'stat_2' : variables with qualifier 'const' must be initialized 2 | (2): ERROR: 'const_3' : variables with qualifier 'const' must be initialized 3 | -------------------------------------------------------------------------------- /tests/vertex-failures/undefined-type-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "undefined-type-in.txt" 2 | #line 1 "undefined-type-in.hlsl" 3 | void main(out float4 overtex : POSITION) 4 | { 5 | bloat4 b(1.f, 1.f, 1.f, 1.f); 6 | overtex = float4(b.x,b.y,b,z,b.w); 7 | } 8 | 9 | -------------------------------------------------------------------------------- /tests/vertex-failures/undefined-type-out.txt: -------------------------------------------------------------------------------- 1 | undefined-type-in.hlsl(3): ERROR: 'bloat4' : undeclared identifier 2 | undefined-type-in.hlsl(3): ERROR: 'b' : syntax error syntax error 3 | -------------------------------------------------------------------------------- /tests/vertex/basic-mul-in.txt: -------------------------------------------------------------------------------- 1 | float4x4 matrix_mvp; 2 | float4x4 matrix_normal; 3 | 4 | void main (float4 vertex : POSITION, out float4 overtex : POSITION, float3 normal : NORMAL, out float3 onormal : TEXCOORD0) 5 | { 6 | overtex = mul (matrix_mvp, vertex); 7 | //onormal = mul ((float3x3)matrix_normal, normal); 8 | } 9 | -------------------------------------------------------------------------------- /tests/vertex/basic-mul-out.txt: -------------------------------------------------------------------------------- 1 | uniform mat4 matrix_mvp; 2 | uniform mat4 matrix_normal; 3 | #line 4 4 | #line 4 5 | void xlat_main( in vec4 vertex, out vec4 overtex, in vec3 normal, out vec3 onormal ) { 6 | overtex = (matrix_mvp * vertex); 7 | } 8 | varying vec3 xlv_TEXCOORD0; 9 | void main() { 10 | vec4 xlt_overtex; 11 | vec3 xlt_onormal; 12 | xlat_main( vec4(gl_Vertex), xlt_overtex, vec3(gl_Normal), xlt_onormal); 13 | gl_Position = vec4(xlt_overtex); 14 | xlv_TEXCOORD0 = vec3(xlt_onormal); 15 | } 16 | 17 | // uniforms: 18 | // matrix_mvp: type 21 arrsize 0 19 | -------------------------------------------------------------------------------- /tests/vertex/basic-mul-outES.txt: -------------------------------------------------------------------------------- 1 | uniform highp mat4 matrix_mvp; 2 | uniform highp mat4 matrix_normal; 3 | #line 4 4 | #line 4 5 | void xlat_main( in highp vec4 vertex, out highp vec4 overtex, in highp vec3 normal, out highp vec3 onormal ) { 6 | overtex = (matrix_mvp * vertex); 7 | } 8 | attribute highp vec4 xlat_attrib_POSITION; 9 | attribute highp vec3 xlat_attrib_NORMAL; 10 | varying highp vec3 xlv_TEXCOORD0; 11 | void main() { 12 | highp vec4 xlt_overtex; 13 | highp vec3 xlt_onormal; 14 | xlat_main( vec4(xlat_attrib_POSITION), xlt_overtex, vec3(xlat_attrib_NORMAL), xlt_onormal); 15 | gl_Position = vec4(xlt_overtex); 16 | xlv_TEXCOORD0 = vec3(xlt_onormal); 17 | } 18 | 19 | // uniforms: 20 | // matrix_mvp: type 21 arrsize 0 21 | -------------------------------------------------------------------------------- /tests/vertex/basic-mul-outES3.txt: -------------------------------------------------------------------------------- 1 | uniform highp mat4 matrix_mvp; 2 | uniform highp mat4 matrix_normal; 3 | #line 4 4 | #line 4 5 | void xlat_main( in highp vec4 vertex, out highp vec4 overtex, in highp vec3 normal, out highp vec3 onormal ) { 6 | overtex = (matrix_mvp * vertex); 7 | } 8 | in highp vec4 xlat_attrib_POSITION; 9 | in highp vec3 xlat_attrib_NORMAL; 10 | out highp vec3 xlv_TEXCOORD0; 11 | void main() { 12 | highp vec4 xlt_overtex; 13 | highp vec3 xlt_onormal; 14 | xlat_main( vec4(xlat_attrib_POSITION), xlt_overtex, vec3(xlat_attrib_NORMAL), xlt_onormal); 15 | gl_Position = vec4(xlt_overtex); 16 | xlv_TEXCOORD0 = vec3(xlt_onormal); 17 | } 18 | 19 | // uniforms: 20 | // matrix_mvp: type 21 arrsize 0 21 | -------------------------------------------------------------------------------- /tests/vertex/const-arg-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "const-arg-in.txt" 2 | struct fake4 3 | { 4 | float fx; 5 | float fy; 6 | float fz; 7 | float fw; 8 | }; 9 | 10 | fake4 fake_splat(const float f) 11 | { 12 | fake4 fake; 13 | fake.fx = f; 14 | fake.fy = f; 15 | fake.fz = f; 16 | fake.fw = f; 17 | 18 | return(fake); 19 | } 20 | 21 | float4 fake_to_float(const in fake4 fake) 22 | { 23 | float4 real; 24 | real.x = fake.fx; 25 | real.y = fake.fy; 26 | real.z = fake.fz; 27 | real.w = fake.fw; 28 | 29 | return(real); 30 | } 31 | 32 | float4 splat(const float f) 33 | { 34 | return(fake_to_float(fake_splat(f))); 35 | } 36 | 37 | float4 main() : POSITION 38 | { 39 | return(splat(1.f)); 40 | } 41 | -------------------------------------------------------------------------------- /tests/vertex/const-expr-arraysize-in.txt: -------------------------------------------------------------------------------- 1 | static const int kNumBones = 4; 2 | float4 sBonePal[kNumBones*3]; 3 | 4 | static const int kNumBones2 = kNumBones; 5 | static const int kNumBones3 = kNumBones2; 6 | float4 sBonePal2[kNumBones3]; 7 | 8 | static const int kOtherConst = kNumBones*2; 9 | float sFoo[kOtherConst*2 + kNumBones + 7]; 10 | 11 | static const int kNeg = -5; 12 | float arrNeg[-kNeg]; 13 | 14 | 15 | float4 main() : POSITION 16 | { 17 | return sBonePal[0] + sFoo[3] + sBonePal2[2] + arrNeg[2]; 18 | } 19 | -------------------------------------------------------------------------------- /tests/vertex/const-expr-arraysize-out.txt: -------------------------------------------------------------------------------- 1 | const int kNumBones = 4; 2 | uniform vec4 sBonePal[12]; 3 | #line 4 4 | const int kNumBones2 = 4; 5 | const int kNumBones3 = 4; 6 | uniform vec4 sBonePal2[4]; 7 | #line 8 8 | const int kOtherConst = 8; 9 | uniform float sFoo[27]; 10 | const int kNeg = -5; 11 | #line 12 12 | uniform float arrNeg[5]; 13 | #line 15 14 | vec4 xlat_main( ) { 15 | #line 17 16 | return (((sBonePal[0] + sFoo[3]) + sBonePal2[2]) + arrNeg[2]); 17 | } 18 | void main() { 19 | vec4 xl_retval; 20 | xl_retval = xlat_main( ); 21 | gl_Position = vec4(xl_retval); 22 | } 23 | 24 | // uniforms: 25 | // arrNeg: type 9 arrsize 5 26 | // sBonePal: type 12 arrsize 12 27 | // sBonePal2: type 12 arrsize 4 28 | // sFoo: type 9 arrsize 27 29 | -------------------------------------------------------------------------------- /tests/vertex/const-expr-arraysize-outES.txt: -------------------------------------------------------------------------------- 1 | const highp int kNumBones = 4; 2 | uniform highp vec4 sBonePal[12]; 3 | #line 4 4 | const highp int kNumBones2 = 4; 5 | const highp int kNumBones3 = 4; 6 | uniform highp vec4 sBonePal2[4]; 7 | #line 8 8 | const highp int kOtherConst = 8; 9 | uniform highp float sFoo[27]; 10 | const highp int kNeg = -5; 11 | #line 12 12 | uniform highp float arrNeg[5]; 13 | #line 15 14 | highp vec4 xlat_main( ) { 15 | #line 17 16 | return (((sBonePal[0] + sFoo[3]) + sBonePal2[2]) + arrNeg[2]); 17 | } 18 | void main() { 19 | highp vec4 xl_retval; 20 | xl_retval = xlat_main( ); 21 | gl_Position = vec4(xl_retval); 22 | } 23 | 24 | // uniforms: 25 | // arrNeg: type 9 arrsize 5 26 | // sBonePal: type 12 arrsize 12 27 | // sBonePal2: type 12 arrsize 4 28 | // sFoo: type 9 arrsize 27 29 | -------------------------------------------------------------------------------- /tests/vertex/const-expr-arraysize-outES3.txt: -------------------------------------------------------------------------------- 1 | const highp int kNumBones = 4; 2 | uniform highp vec4 sBonePal[12]; 3 | #line 4 4 | const highp int kNumBones2 = 4; 5 | const highp int kNumBones3 = 4; 6 | uniform highp vec4 sBonePal2[4]; 7 | #line 8 8 | const highp int kOtherConst = 8; 9 | uniform highp float sFoo[27]; 10 | const highp int kNeg = -5; 11 | #line 12 12 | uniform highp float arrNeg[5]; 13 | #line 15 14 | highp vec4 xlat_main( ) { 15 | #line 17 16 | return (((sBonePal[0] + sFoo[3]) + sBonePal2[2]) + arrNeg[2]); 17 | } 18 | void main() { 19 | highp vec4 xl_retval; 20 | xl_retval = xlat_main( ); 21 | gl_Position = vec4(xl_retval); 22 | } 23 | 24 | // uniforms: 25 | // arrNeg: type 9 arrsize 5 26 | // sBonePal: type 12 arrsize 12 27 | // sBonePal2: type 12 arrsize 4 28 | // sFoo: type 9 arrsize 27 29 | -------------------------------------------------------------------------------- /tests/vertex/const-expr-init-in.txt: -------------------------------------------------------------------------------- 1 | static const int kInt1 = 3; 2 | const int kInt2 = 7; 3 | static int kInt3 = 11; 4 | 5 | float size1 = 512.0; 6 | float size2 = 1.0 / 512.0; 7 | float size3 = kInt1; 8 | float size4 = kInt2 / 3.0; 9 | float size5 = 5 - kInt2; 10 | float size6 = kInt2 * 512.0; 11 | float size7 = -kInt1; 12 | float size8 = -(1.0 / 4.0 + (4.0 * (-(2.0/4.0)))); 13 | float size9 = -(1.0 / 4 + (4.0 * (-(2/4)))); 14 | 15 | uniform float3 my_vec3a = float3(1,2,3); 16 | uniform float3 my_vec3b = {1,2,3}; 17 | 18 | float4 main() : POSITION 19 | { 20 | return float4(kInt1, kInt2, kInt3, size2 + size8); 21 | } 22 | -------------------------------------------------------------------------------- /tests/vertex/const-expr-init-out.txt: -------------------------------------------------------------------------------- 1 | const int kInt1 = 3; 2 | const int kInt2 = 7; 3 | #line 3 4 | int kInt3; 5 | uniform float size1; 6 | uniform float size2; 7 | #line 7 8 | uniform float size3; 9 | uniform float size4; 10 | uniform float size5; 11 | uniform float size6; 12 | #line 11 13 | uniform float size7; 14 | uniform float size8; 15 | uniform float size9; 16 | #line 15 17 | uniform vec3 my_vec3a; 18 | uniform vec3 my_vec3b; 19 | #line 18 20 | vec4 xlat_main( ) { 21 | #line 20 22 | return vec4( 3.0, 7.0, float(kInt3), (size2 + size8)); 23 | } 24 | void main() { 25 | kInt3 = 11; 26 | vec4 xl_retval; 27 | xl_retval = xlat_main( ); 28 | gl_Position = vec4(xl_retval); 29 | } 30 | 31 | // uniforms: 32 | // size2: type 9 arrsize 0 33 | // size8: type 9 arrsize 0 34 | -------------------------------------------------------------------------------- /tests/vertex/const-expr-init-outES.txt: -------------------------------------------------------------------------------- 1 | const highp int kInt1 = 3; 2 | const highp int kInt2 = 7; 3 | #line 3 4 | highp int kInt3; 5 | uniform highp float size1; 6 | uniform highp float size2; 7 | #line 7 8 | uniform highp float size3; 9 | uniform highp float size4; 10 | uniform highp float size5; 11 | uniform highp float size6; 12 | #line 11 13 | uniform highp float size7; 14 | uniform highp float size8; 15 | uniform highp float size9; 16 | #line 15 17 | uniform highp vec3 my_vec3a; 18 | uniform highp vec3 my_vec3b; 19 | #line 18 20 | highp vec4 xlat_main( ) { 21 | #line 20 22 | return vec4( 3.0, 7.0, float(kInt3), (size2 + size8)); 23 | } 24 | void main() { 25 | kInt3 = 11; 26 | highp vec4 xl_retval; 27 | xl_retval = xlat_main( ); 28 | gl_Position = vec4(xl_retval); 29 | } 30 | 31 | // uniforms: 32 | // size2: type 9 arrsize 0 33 | // size8: type 9 arrsize 0 34 | -------------------------------------------------------------------------------- /tests/vertex/const-expr-init-outES3.txt: -------------------------------------------------------------------------------- 1 | const highp int kInt1 = 3; 2 | const highp int kInt2 = 7; 3 | #line 3 4 | highp int kInt3; 5 | uniform highp float size1; 6 | uniform highp float size2; 7 | #line 7 8 | uniform highp float size3; 9 | uniform highp float size4; 10 | uniform highp float size5; 11 | uniform highp float size6; 12 | #line 11 13 | uniform highp float size7; 14 | uniform highp float size8; 15 | uniform highp float size9; 16 | #line 15 17 | uniform highp vec3 my_vec3a; 18 | uniform highp vec3 my_vec3b; 19 | #line 18 20 | highp vec4 xlat_main( ) { 21 | #line 20 22 | return vec4( 3.0, 7.0, float(kInt3), (size2 + size8)); 23 | } 24 | void main() { 25 | kInt3 = 11; 26 | highp vec4 xl_retval; 27 | xl_retval = xlat_main( ); 28 | gl_Position = vec4(xl_retval); 29 | } 30 | 31 | // uniforms: 32 | // size2: type 9 arrsize 0 33 | // size8: type 9 arrsize 0 34 | -------------------------------------------------------------------------------- /tests/vertex/const-main-arg-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "const-main-arg-in.txt" 2 | struct VertexInput 3 | { 4 | float4 pos : POSITION; 5 | }; 6 | 7 | struct VertexOutput 8 | { 9 | float4 pos : POSITION; 10 | }; 11 | 12 | VertexOutput main(const in VertexInput input) 13 | { 14 | VertexOutput output; 15 | output.pos = input.pos; 16 | return(output); 17 | } 18 | -------------------------------------------------------------------------------- /tests/vertex/const-main-arg-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 6 3 | struct VertexOutput { 4 | vec4 pos; 5 | }; 6 | #line 1 7 | struct VertexInput { 8 | vec4 pos; 9 | }; 10 | #line 11 11 | #line 11 12 | VertexOutput xlat_main( const VertexInput xlat_varinput ) { 13 | VertexOutput xlat_varoutput; 14 | xlat_varoutput.pos = xlat_varinput.pos; 15 | #line 15 16 | return xlat_varoutput; 17 | } 18 | void main() { 19 | VertexOutput xl_retval; 20 | VertexInput xlt_xlat_varinput; 21 | xlt_xlat_varinput.pos = vec4(gl_Vertex); 22 | xl_retval = xlat_main( xlt_xlat_varinput); 23 | gl_Position = vec4(xl_retval.pos); 24 | } 25 | -------------------------------------------------------------------------------- /tests/vertex/const-main-arg-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 6 3 | struct VertexOutput { 4 | highp vec4 pos; 5 | }; 6 | #line 1 7 | struct VertexInput { 8 | highp vec4 pos; 9 | }; 10 | #line 11 11 | #line 11 12 | VertexOutput xlat_main( const VertexInput xlat_varinput ) { 13 | VertexOutput xlat_varoutput; 14 | xlat_varoutput.pos = xlat_varinput.pos; 15 | #line 15 16 | return xlat_varoutput; 17 | } 18 | attribute highp vec4 xlat_attrib_POSITION; 19 | void main() { 20 | VertexOutput xl_retval; 21 | VertexInput xlt_xlat_varinput; 22 | xlt_xlat_varinput.pos = vec4(xlat_attrib_POSITION); 23 | xl_retval = xlat_main( xlt_xlat_varinput); 24 | gl_Position = vec4(xl_retval.pos); 25 | } 26 | -------------------------------------------------------------------------------- /tests/vertex/const-main-arg-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 6 3 | struct VertexOutput { 4 | highp vec4 pos; 5 | }; 6 | #line 1 7 | struct VertexInput { 8 | highp vec4 pos; 9 | }; 10 | #line 11 11 | #line 11 12 | VertexOutput xlat_main( const VertexInput xlat_varinput ) { 13 | VertexOutput xlat_varoutput; 14 | xlat_varoutput.pos = xlat_varinput.pos; 15 | #line 15 16 | return xlat_varoutput; 17 | } 18 | in highp vec4 xlat_attrib_POSITION; 19 | void main() { 20 | VertexOutput xl_retval; 21 | VertexInput xlt_xlat_varinput; 22 | xlt_xlat_varinput.pos = vec4(xlat_attrib_POSITION); 23 | xl_retval = xlat_main( xlt_xlat_varinput); 24 | gl_Position = vec4(xl_retval.pos); 25 | } 26 | -------------------------------------------------------------------------------- /tests/vertex/decl-multiple-in.txt: -------------------------------------------------------------------------------- 1 | void main (float4 vertex : POSITION, out float4 overtex : POSITION) 2 | { 3 | // there was a crash bug in 'stackPos' declared like this 4 | //int stack[64], stackPos = 0, node = 0; 5 | 6 | // test more variants 7 | float fltArrInit[] = {1,2,3,4}; 8 | float fltArrInit2[] = {1,2,3,4}, fltInit2 = 1.3, fltArrInit2a[5], fltArrInit2b[6] = {1,2,3,4,5,6}; 9 | float fltInit3 = 1.3, fltArrInit3[] = {1,2,3,4}, fltArrInit3a[5]; 10 | 11 | overtex = vertex; 12 | } 13 | -------------------------------------------------------------------------------- /tests/vertex/decl-multiple-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | void xlat_main( in highp vec4 vertex, out highp vec4 overtex ) { 4 | #line 7 5 | highp float[4] fltArrInit = float[4]( 1, 2, 3, 4); 6 | highp float[4] fltArrInit2 = float[4]( 1, 2, 3, 4); 7 | highp float fltInit2 = 1.3; 8 | highp float fltArrInit2a[5]; 9 | highp float[6] fltArrInit2b = float[6]( 1, 2, 3, 4, 5, 6); 10 | highp float fltInit3 = 1.3; 11 | highp float[4] fltArrInit3 = float[4]( 1, 2, 3, 4); 12 | highp float fltArrInit3a[5]; 13 | #line 11 14 | overtex = vertex; 15 | } 16 | in highp vec4 xlat_attrib_POSITION; 17 | void main() { 18 | highp vec4 xlt_overtex; 19 | xlat_main( vec4(xlat_attrib_POSITION), xlt_overtex); 20 | gl_Position = vec4(xlt_overtex); 21 | } 22 | -------------------------------------------------------------------------------- /tests/vertex/dupe-sem-name-mapping-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "dupe-sem-name-mapping-in.txt" 2 | 3 | struct a2v1 { 4 | float4 texcoord : TEXCOORD; 5 | }; 6 | 7 | struct a2v2 { 8 | float4 texcoord : TEXCOORD0; 9 | }; 10 | 11 | struct v2f { 12 | float4 pos : POSITION; 13 | float4 uv : TEXCOORD; 14 | }; 15 | 16 | v2f main (a2v1 v, a2v2 v2) 17 | { 18 | v2f o; 19 | return o; 20 | } 21 | -------------------------------------------------------------------------------- /tests/vertex/dupe-sem-name-mapping-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 10 3 | struct v2f { 4 | vec4 pos; 5 | vec4 uv; 6 | }; 7 | #line 2 8 | struct a2v1 { 9 | vec4 texcoord; 10 | }; 11 | #line 6 12 | struct a2v2 { 13 | vec4 texcoord; 14 | }; 15 | #line 15 16 | #line 15 17 | v2f xlat_main( in a2v1 v, in a2v2 v2 ) { 18 | v2f o; 19 | return o; 20 | } 21 | varying vec4 xlv_TEXCOORD; 22 | void main() { 23 | v2f xl_retval; 24 | a2v1 xlt_v; 25 | xlt_v.texcoord = vec4(gl_MultiTexCoord0); 26 | a2v2 xlt_v2; 27 | xlt_v2.texcoord = vec4(gl_MultiTexCoord0); 28 | xl_retval = xlat_main( xlt_v, xlt_v2); 29 | gl_Position = vec4(xl_retval.pos); 30 | xlv_TEXCOORD = vec4(xl_retval.uv); 31 | } 32 | -------------------------------------------------------------------------------- /tests/vertex/dupe-sem-name-mapping-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 10 3 | struct v2f { 4 | highp vec4 pos; 5 | highp vec4 uv; 6 | }; 7 | #line 2 8 | struct a2v1 { 9 | highp vec4 texcoord; 10 | }; 11 | #line 6 12 | struct a2v2 { 13 | highp vec4 texcoord; 14 | }; 15 | #line 15 16 | #line 15 17 | v2f xlat_main( in a2v1 v, in a2v2 v2 ) { 18 | v2f o; 19 | return o; 20 | } 21 | attribute highp vec4 xlat_attrib_TEXCOORD; 22 | varying highp vec4 xlv_TEXCOORD; 23 | void main() { 24 | v2f xl_retval; 25 | a2v1 xlt_v; 26 | xlt_v.texcoord = vec4(xlat_attrib_TEXCOORD); 27 | a2v2 xlt_v2; 28 | xlt_v2.texcoord = vec4(xlat_attrib_TEXCOORD); 29 | xl_retval = xlat_main( xlt_v, xlt_v2); 30 | gl_Position = vec4(xl_retval.pos); 31 | xlv_TEXCOORD = vec4(xl_retval.uv); 32 | } 33 | -------------------------------------------------------------------------------- /tests/vertex/dupe-sem-name-mapping-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 10 3 | struct v2f { 4 | highp vec4 pos; 5 | highp vec4 uv; 6 | }; 7 | #line 2 8 | struct a2v1 { 9 | highp vec4 texcoord; 10 | }; 11 | #line 6 12 | struct a2v2 { 13 | highp vec4 texcoord; 14 | }; 15 | #line 15 16 | #line 15 17 | v2f xlat_main( in a2v1 v, in a2v2 v2 ) { 18 | v2f o; 19 | return o; 20 | } 21 | in highp vec4 xlat_attrib_TEXCOORD; 22 | out highp vec4 xlv_TEXCOORD; 23 | void main() { 24 | v2f xl_retval; 25 | a2v1 xlt_v; 26 | xlt_v.texcoord = vec4(xlat_attrib_TEXCOORD); 27 | a2v2 xlt_v2; 28 | xlt_v2.texcoord = vec4(xlat_attrib_TEXCOORD); 29 | xl_retval = xlat_main( xlt_v, xlt_v2); 30 | gl_Position = vec4(xl_retval.pos); 31 | xlv_TEXCOORD = vec4(xl_retval.uv); 32 | } 33 | -------------------------------------------------------------------------------- /tests/vertex/dupe-sem-name-s-in-s-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "dupe-sem-name-mapping-in.txt" 2 | 3 | struct a2v1 { 4 | float4 texcoord4 : TEXCOORD; 5 | }; 6 | 7 | struct a2v2 { 8 | float2 texcoord2 : TEXCOORD; 9 | a2v1 substruct; 10 | }; 11 | 12 | struct v2f { 13 | float4 pos : POSITION; 14 | float4 uv : TEXCOORD; 15 | }; 16 | 17 | v2f main (a2v2 v) 18 | { 19 | v2f o; 20 | return o; 21 | } 22 | -------------------------------------------------------------------------------- /tests/vertex/dupe-sem-name-s-in-s-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 11 3 | struct v2f { 4 | vec4 pos; 5 | vec4 uv; 6 | }; 7 | #line 0 8 | struct a2v1 { 9 | vec4 texcoord4; 10 | }; 11 | #line 6 12 | struct a2v2 { 13 | vec2 texcoord2; 14 | a2v1 substruct; 15 | }; 16 | #line 16 17 | #line 16 18 | v2f xlat_main( in a2v2 v ) { 19 | v2f o; 20 | return o; 21 | } 22 | varying vec4 xlv_TEXCOORD; 23 | void main() { 24 | v2f xl_retval; 25 | a2v2 xlt_v; 26 | xlt_v.texcoord2 = vec2(gl_MultiTexCoord0); 27 | xlt_v.substruct.texcoord4 = vec4(gl_MultiTexCoord0); 28 | xl_retval = xlat_main( xlt_v); 29 | gl_Position = vec4(xl_retval.pos); 30 | xlv_TEXCOORD = vec4(xl_retval.uv); 31 | } 32 | -------------------------------------------------------------------------------- /tests/vertex/dupe-sem-name-s-in-s-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 11 3 | struct v2f { 4 | highp vec4 pos; 5 | highp vec4 uv; 6 | }; 7 | #line 0 8 | struct a2v1 { 9 | highp vec4 texcoord4; 10 | }; 11 | #line 6 12 | struct a2v2 { 13 | highp vec2 texcoord2; 14 | a2v1 substruct; 15 | }; 16 | #line 16 17 | #line 16 18 | v2f xlat_main( in a2v2 v ) { 19 | v2f o; 20 | return o; 21 | } 22 | attribute highp vec4 xlat_attrib_TEXCOORD; 23 | varying highp vec4 xlv_TEXCOORD; 24 | void main() { 25 | v2f xl_retval; 26 | a2v2 xlt_v; 27 | xlt_v.texcoord2 = vec2(xlat_attrib_TEXCOORD); 28 | xlt_v.substruct.texcoord4 = vec4(xlat_attrib_TEXCOORD); 29 | xl_retval = xlat_main( xlt_v); 30 | gl_Position = vec4(xl_retval.pos); 31 | xlv_TEXCOORD = vec4(xl_retval.uv); 32 | } 33 | -------------------------------------------------------------------------------- /tests/vertex/dupe-sem-name-s-in-s-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 11 3 | struct v2f { 4 | highp vec4 pos; 5 | highp vec4 uv; 6 | }; 7 | #line 0 8 | struct a2v1 { 9 | highp vec4 texcoord4; 10 | }; 11 | #line 6 12 | struct a2v2 { 13 | highp vec2 texcoord2; 14 | a2v1 substruct; 15 | }; 16 | #line 16 17 | #line 16 18 | v2f xlat_main( in a2v2 v ) { 19 | v2f o; 20 | return o; 21 | } 22 | in highp vec4 xlat_attrib_TEXCOORD; 23 | out highp vec4 xlv_TEXCOORD; 24 | void main() { 25 | v2f xl_retval; 26 | a2v2 xlt_v; 27 | xlt_v.texcoord2 = vec2(xlat_attrib_TEXCOORD); 28 | xlt_v.substruct.texcoord4 = vec4(xlat_attrib_TEXCOORD); 29 | xl_retval = xlat_main( xlt_v); 30 | gl_Position = vec4(xl_retval.pos); 31 | xlv_TEXCOORD = vec4(xl_retval.uv); 32 | } 33 | -------------------------------------------------------------------------------- /tests/vertex/funccalls-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "funccalls-in.txt" 2 | float4x4 mvp; 3 | 4 | struct a2v { 5 | float4 pos : POSITION; 6 | float2 uv : TEXCOORD0; 7 | float3 normal : NORMAL; 8 | float4 color : COLOR; 9 | }; 10 | 11 | struct v2f { 12 | float4 pos : POSITION; 13 | float fog : FOG; 14 | float2 uv : TEXCOORD0; 15 | float4 color : COLOR; 16 | }; 17 | 18 | float4 DoPosMul (float4 pos, float4x4 mvp) 19 | { 20 | return mul (mvp, pos); 21 | } 22 | 23 | float4 DoColor (float4 color, float3 normal) 24 | { 25 | float4 c = color; 26 | c.rgb += normal; 27 | return c; 28 | } 29 | 30 | v2f main (a2v v) 31 | { 32 | v2f o; 33 | o.pos = DoPosMul (v.pos, mvp); 34 | o.color = DoColor (v.color, v.normal); 35 | o.uv = v.uv; 36 | return o; 37 | } 38 | -------------------------------------------------------------------------------- /tests/vertex/funccalls2-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "funccalls2-in.txt" 2 | float4x4 mvp; 3 | 4 | struct a2v { 5 | float4 pos : POSITION; 6 | }; 7 | 8 | struct v2f { 9 | float4 pos : POSITION; 10 | float4 color : COLOR; 11 | }; 12 | 13 | float4 _LightColor; 14 | float3 _LightPos; 15 | 16 | float ComputeShadow (float3 pos) 17 | { 18 | return pow (pos.x, 4.0); 19 | } 20 | 21 | float ComputeAtten (float3 pos, float3 lightPos) 22 | { 23 | return distance (pos, lightPos) * ComputeShadow (pos); 24 | } 25 | 26 | float4 ComputeSomeLighting (float3 pos) 27 | { 28 | float4 res; 29 | res = _LightColor; 30 | res *= ComputeAtten (pos, _LightPos); 31 | return res; 32 | } 33 | 34 | v2f main (a2v v) 35 | { 36 | v2f o; 37 | float4 pos = mul (mvp, v.pos); 38 | o.pos = pos; 39 | o.color = ComputeSomeLighting (v.pos.xyz); 40 | return o; 41 | } 42 | -------------------------------------------------------------------------------- /tests/vertex/funccalls3-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "funccalls3-in.txt" 2 | float4x4 mvp; 3 | 4 | struct a2v { 5 | float4 pos : POSITION; 6 | }; 7 | 8 | struct v2f { 9 | float4 pos : POSITION; 10 | float4 color : COLOR; 11 | }; 12 | 13 | float4 ComputeColor (float4 pos) 14 | { 15 | pos *= float4(1,-1,-1,1); 16 | pos.xyz *= 0.3; 17 | return pos; 18 | } 19 | 20 | v2f main (a2v v) 21 | { 22 | v2f o; 23 | float4 pos = mul (mvp, v.pos); 24 | o.color = ComputeColor (pos); 25 | o.pos = pos; 26 | return o; 27 | } 28 | -------------------------------------------------------------------------------- /tests/vertex/funccalls3-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 7 3 | struct v2f { 4 | vec4 pos; 5 | vec4 color; 6 | }; 7 | #line 3 8 | struct a2v { 9 | vec4 pos; 10 | }; 11 | #line 1 12 | uniform mat4 mvp; 13 | #line 12 14 | #line 12 15 | vec4 ComputeColor( in vec4 pos ) { 16 | pos *= vec4( 1.0, -1.0, -1.0, 1.0); 17 | pos.xyz *= 0.3; 18 | #line 16 19 | return pos; 20 | } 21 | #line 19 22 | v2f xlat_main( in a2v v ) { 23 | #line 21 24 | v2f o; 25 | vec4 pos = (mvp * v.pos); 26 | o.color = ComputeColor( pos); 27 | o.pos = pos; 28 | #line 25 29 | return o; 30 | } 31 | varying vec4 xlv_COLOR; 32 | void main() { 33 | v2f xl_retval; 34 | a2v xlt_v; 35 | xlt_v.pos = vec4(gl_Vertex); 36 | xl_retval = xlat_main( xlt_v); 37 | gl_Position = vec4(xl_retval.pos); 38 | xlv_COLOR = vec4(xl_retval.color); 39 | } 40 | 41 | // uniforms: 42 | // mvp: type 21 arrsize 0 43 | -------------------------------------------------------------------------------- /tests/vertex/global-init-in.txt: -------------------------------------------------------------------------------- 1 | uniform float4 uniVar = 1.; 2 | static float4 staticVar = uniVar; 3 | static float4 staticVar2 = staticVar; 4 | float4 unusedVar = 50; 5 | float uninitializedVar; 6 | 7 | float test() 8 | { 9 | return staticVar.x * 2. + uninitializedVar + staticVar2.y; 10 | } 11 | 12 | float4 main() : POSITION 13 | { 14 | float4 tempVar = uniVar * staticVar * test(); 15 | return tempVar; 16 | } 17 | -------------------------------------------------------------------------------- /tests/vertex/global-init-out.txt: -------------------------------------------------------------------------------- 1 | uniform vec4 uniVar; 2 | vec4 staticVar; 3 | #line 3 4 | vec4 staticVar2; 5 | uniform vec4 unusedVar; 6 | uniform float uninitializedVar; 7 | #line 7 8 | #line 12 9 | #line 7 10 | float test( ) { 11 | return (((staticVar.x * 2.0) + uninitializedVar) + staticVar2.y); 12 | } 13 | #line 12 14 | vec4 xlat_main( ) { 15 | vec4 tempVar = ((uniVar * staticVar) * test( )); 16 | return tempVar; 17 | } 18 | void main() { 19 | staticVar = uniVar; 20 | staticVar2 = staticVar; 21 | vec4 xl_retval; 22 | xl_retval = xlat_main( ); 23 | gl_Position = vec4(xl_retval); 24 | } 25 | 26 | // uniforms: 27 | // uniVar: type 12 arrsize 0 28 | // uninitializedVar: type 9 arrsize 0 29 | -------------------------------------------------------------------------------- /tests/vertex/global-init-outES.txt: -------------------------------------------------------------------------------- 1 | uniform highp vec4 uniVar; 2 | highp vec4 staticVar; 3 | #line 3 4 | highp vec4 staticVar2; 5 | uniform highp vec4 unusedVar; 6 | uniform highp float uninitializedVar; 7 | #line 7 8 | #line 12 9 | #line 7 10 | highp float test( ) { 11 | return (((staticVar.x * 2.0) + uninitializedVar) + staticVar2.y); 12 | } 13 | #line 12 14 | highp vec4 xlat_main( ) { 15 | highp vec4 tempVar = ((uniVar * staticVar) * test( )); 16 | return tempVar; 17 | } 18 | void main() { 19 | staticVar = uniVar; 20 | staticVar2 = staticVar; 21 | highp vec4 xl_retval; 22 | xl_retval = xlat_main( ); 23 | gl_Position = vec4(xl_retval); 24 | } 25 | 26 | // uniforms: 27 | // uniVar: type 12 arrsize 0 28 | // uninitializedVar: type 9 arrsize 0 29 | -------------------------------------------------------------------------------- /tests/vertex/global-init-outES3.txt: -------------------------------------------------------------------------------- 1 | uniform highp vec4 uniVar; 2 | highp vec4 staticVar; 3 | #line 3 4 | highp vec4 staticVar2; 5 | uniform highp vec4 unusedVar; 6 | uniform highp float uninitializedVar; 7 | #line 7 8 | #line 12 9 | #line 7 10 | highp float test( ) { 11 | return (((staticVar.x * 2.0) + uninitializedVar) + staticVar2.y); 12 | } 13 | #line 12 14 | highp vec4 xlat_main( ) { 15 | highp vec4 tempVar = ((uniVar * staticVar) * test( )); 16 | return tempVar; 17 | } 18 | void main() { 19 | staticVar = uniVar; 20 | staticVar2 = staticVar; 21 | highp vec4 xl_retval; 22 | xl_retval = xlat_main( ); 23 | gl_Position = vec4(xl_retval); 24 | } 25 | 26 | // uniforms: 27 | // uniVar: type 12 arrsize 0 28 | // uninitializedVar: type 9 arrsize 0 29 | -------------------------------------------------------------------------------- /tests/vertex/if-in.txt: -------------------------------------------------------------------------------- 1 | void main (float4 vertex : POSITION, out float4 overtex : POSITION) 2 | { 3 | if (vertex.x == 0.) 4 | { 5 | // empty! 6 | } 7 | overtex.xyzw = float4(0.); 8 | } 9 | -------------------------------------------------------------------------------- /tests/vertex/if-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | void xlat_main( in vec4 vertex, out vec4 overtex ) { 4 | #line 3 5 | if ((vertex.x == 0.0)){ 6 | } 7 | #line 7 8 | overtex.xyzw = vec4( 0.0); 9 | } 10 | void main() { 11 | vec4 xlt_overtex; 12 | xlat_main( vec4(gl_Vertex), xlt_overtex); 13 | gl_Position = vec4(xlt_overtex); 14 | } 15 | -------------------------------------------------------------------------------- /tests/vertex/if-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | void xlat_main( in highp vec4 vertex, out highp vec4 overtex ) { 4 | #line 3 5 | if ((vertex.x == 0.0)){ 6 | } 7 | #line 7 8 | overtex.xyzw = vec4( 0.0); 9 | } 10 | attribute highp vec4 xlat_attrib_POSITION; 11 | void main() { 12 | highp vec4 xlt_overtex; 13 | xlat_main( vec4(xlat_attrib_POSITION), xlt_overtex); 14 | gl_Position = vec4(xlt_overtex); 15 | } 16 | -------------------------------------------------------------------------------- /tests/vertex/if-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | void xlat_main( in highp vec4 vertex, out highp vec4 overtex ) { 4 | #line 3 5 | if ((vertex.x == 0.0)){ 6 | } 7 | #line 7 8 | overtex.xyzw = vec4( 0.0); 9 | } 10 | in highp vec4 xlat_attrib_POSITION; 11 | void main() { 12 | highp vec4 xlt_overtex; 13 | xlat_main( vec4(xlat_attrib_POSITION), xlt_overtex); 14 | gl_Position = vec4(xlt_overtex); 15 | } 16 | -------------------------------------------------------------------------------- /tests/vertex/in-struct-dupe-sem-ret-struct-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "in-struct-dupe-sem-ret-struct-in.txt" 2 | float4x4 mvp; 3 | 4 | struct a2v1 { 5 | float4 pos : POSITION; 6 | float2 uv : TEXCOORD0; 7 | float3 normal : NORMAL; 8 | float4 color : COLOR; 9 | }; 10 | 11 | struct a2v2 { 12 | float4 uvFloat4 : TEXCOORD0; 13 | }; 14 | 15 | struct v2f { 16 | float4 pos : POSITION; 17 | float fog : FOG; 18 | float2 uv : TEXCOORD0; 19 | float4 color : COLOR; 20 | }; 21 | 22 | v2f main (a2v1 v, a2v2 v2) 23 | { 24 | v2f o; 25 | o.pos = mul (mvp, v.pos); 26 | o.color = v.color; 27 | o.color.rgb += v.normal; 28 | o.uv = v.uv; 29 | return o; 30 | } 31 | -------------------------------------------------------------------------------- /tests/vertex/in-struct-ret-struct-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "in-struct-ret-struct-in.txt" 2 | float4x4 mvp; 3 | 4 | struct a2v { 5 | float4 pos : POSITION; 6 | float2 uv : TEXCOORD0; 7 | float3 normal : NORMAL; 8 | float4 color : COLOR; 9 | }; 10 | 11 | struct v2f { 12 | float4 pos : POSITION; 13 | float fog : FOG; 14 | float2 uv : TEXCOORD0; 15 | float4 color : COLOR; 16 | }; 17 | 18 | v2f main (a2v v) 19 | { 20 | v2f o; 21 | o.pos = mul (mvp, v.pos); 22 | o.color = v.color; 23 | o.color.rgb += v.normal; 24 | o.uv = v.uv; 25 | return o; 26 | } 27 | -------------------------------------------------------------------------------- /tests/vertex/in-struct-ret-struct-struct-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "in-struct-ret-struct-struct-in.txt" 2 | float4x4 mvp; 3 | 4 | struct a2v_sub { 5 | float4 color : COLOR; 6 | }; 7 | 8 | struct a2v { 9 | float4 pos : POSITION; 10 | float2 uv : TEXCOORD0; 11 | float3 normal : NORMAL; 12 | a2v_sub ss; 13 | }; 14 | 15 | struct v2f { 16 | float4 pos : POSITION; 17 | float fog : FOG; 18 | float2 uv : TEXCOORD0; 19 | float4 color : COLOR; 20 | }; 21 | 22 | v2f main (a2v v) 23 | { 24 | v2f o; 25 | o.pos = mul (mvp, v.pos); 26 | o.color = v.ss.color; 27 | o.uv = v.uv; 28 | return o; 29 | } 30 | -------------------------------------------------------------------------------- /tests/vertex/in-struct-ret-vals-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "in-struct-ret-vals-in.txt" 2 | float4x4 mvp; 3 | 4 | struct a2v { 5 | float4 pos : POSITION; 6 | float2 uv : TEXCOORD0; 7 | float3 normal : NORMAL; 8 | float4 color : COLOR; 9 | }; 10 | 11 | void main (a2v v, 12 | out float4 opos : POSITION, 13 | out float ofog : FOG, 14 | out float2 ouv : TEXCOORD0, 15 | out float4 ocolor : COLOR 16 | ) 17 | { 18 | opos = mul (mvp, v.pos); 19 | ocolor = v.color; 20 | ocolor.rgb += v.normal; 21 | ouv = v.uv; 22 | } 23 | -------------------------------------------------------------------------------- /tests/vertex/in-vals-ret-struct-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "in-vals-ret-struct-in.txt" 2 | float4x4 mvp; 3 | 4 | struct v2f { 5 | float4 pos : POSITION; 6 | float fog : FOG; 7 | float2 uv : TEXCOORD0; 8 | float4 color : COLOR; 9 | }; 10 | 11 | v2f main ( 12 | float4 pos : POSITION, 13 | float2 uv : TEXCOORD0, 14 | float3 normal : NORMAL, 15 | float4 color : COLOR 16 | ) 17 | { 18 | v2f o; 19 | o.pos = mul (mvp, pos); 20 | o.color = color; 21 | o.color.rgb += normal; 22 | o.uv = uv; 23 | return o; 24 | } 25 | -------------------------------------------------------------------------------- /tests/vertex/in-vals-ret-vals-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "in-vals-ret-vals-in.txt" 2 | float4x4 mvp; 3 | 4 | void main ( 5 | float4 pos : POSITION, 6 | float2 uv : TEXCOORD0, 7 | float3 normal : NORMAL, 8 | float4 color : COLOR, 9 | out float4 opos : POSITION, 10 | out float ofog : FOG, 11 | out float2 ouv : TEXCOORD0, 12 | out float4 ocolor : COLOR 13 | ) 14 | { 15 | opos = mul (mvp, pos); 16 | ocolor = color; 17 | ocolor.rgb += normal; 18 | ouv = uv; 19 | } 20 | -------------------------------------------------------------------------------- /tests/vertex/in-vals-ret-vals-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | uniform mat4 mvp; 4 | #line 12 5 | #line 12 6 | void xlat_main( in vec4 pos, in vec2 uv, in vec3 normal, in vec4 color, out vec4 opos, out float ofog, out vec2 ouv, out vec4 ocolor ) { 7 | opos = (mvp * pos); 8 | ocolor = color; 9 | #line 16 10 | ocolor.xyz += normal; 11 | ouv = uv; 12 | } 13 | varying float xlv_FOG; 14 | varying vec2 xlv_TEXCOORD0; 15 | varying vec4 xlv_COLOR; 16 | void main() { 17 | vec4 xlt_opos; 18 | float xlt_ofog; 19 | vec2 xlt_ouv; 20 | vec4 xlt_ocolor; 21 | xlat_main( vec4(gl_Vertex), vec2(gl_MultiTexCoord0), vec3(gl_Normal), vec4(gl_Color), xlt_opos, xlt_ofog, xlt_ouv, xlt_ocolor); 22 | gl_Position = vec4(xlt_opos); 23 | xlv_FOG = float(xlt_ofog); 24 | xlv_TEXCOORD0 = vec2(xlt_ouv); 25 | xlv_COLOR = vec4(xlt_ocolor); 26 | } 27 | 28 | // uniforms: 29 | // mvp: type 21 arrsize 0 30 | -------------------------------------------------------------------------------- /tests/vertex/loops-formultiple-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "loops-formultiple-in.txt" 2 | float4 unity_LightColor[4]; 3 | 4 | float4x4 UNITY_MATRIX_MVP; 5 | 6 | struct appdata { 7 | float4 vertex : POSITION; 8 | float3 normal : NORMAL; 9 | }; 10 | 11 | struct v2f { 12 | half4 pos : POSITION; 13 | half4 color : TEXCOORD0; 14 | }; 15 | 16 | v2f main (appdata v) 17 | { 18 | v2f o; 19 | o.pos = mul(UNITY_MATRIX_MVP, v.vertex); 20 | o.color = 0; 21 | for (int i = 0; i < 4; ++i) 22 | o.color += max (0, unity_LightColor[i]); 23 | for (int i = 0; i < 4; ++i) 24 | o.color *= min (1, unity_LightColor[i]); 25 | return o; 26 | } 27 | -------------------------------------------------------------------------------- /tests/vertex/nestedscope-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "nestedscope-in.txt" 2 | float4x4 mvp; 3 | 4 | struct a2v { 5 | float4 pos : POSITION; 6 | float2 uv : TEXCOORD0; 7 | float3 normal : NORMAL; 8 | float4 color : COLOR; 9 | }; 10 | 11 | struct v2f { 12 | float4 pos : POSITION; 13 | float fog : FOG; 14 | float2 uv : TEXCOORD0; 15 | float4 color : COLOR; 16 | }; 17 | 18 | v2f main (a2v v) 19 | { 20 | v2f o; 21 | float4 vec = mul (v.pos, mvp); 22 | { 23 | float4 vec = v.color; 24 | vec.rgb += v.normal; 25 | o.color = vec; 26 | } 27 | o.pos = vec; 28 | o.uv = v.uv; 29 | return o; 30 | } 31 | -------------------------------------------------------------------------------- /tests/vertex/psize-in.txt: -------------------------------------------------------------------------------- 1 | void main (out float4 pos : POSITION, out float size : PSIZE) 2 | { 3 | pos = float4(1,2,3,4); 4 | size = 1.5; 5 | } 6 | -------------------------------------------------------------------------------- /tests/vertex/psize-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | void xlat_main( out vec4 pos, out float size ) { 4 | #line 3 5 | pos = vec4( 1.0, 2.0, 3.0, 4.0); 6 | size = 1.5; 7 | } 8 | void main() { 9 | vec4 xlt_pos; 10 | float xlt_size; 11 | xlat_main( xlt_pos, xlt_size); 12 | gl_Position = vec4(xlt_pos); 13 | gl_PointSize = float(xlt_size); 14 | } 15 | -------------------------------------------------------------------------------- /tests/vertex/psize-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | void xlat_main( out highp vec4 pos, out highp float size ) { 4 | #line 3 5 | pos = vec4( 1.0, 2.0, 3.0, 4.0); 6 | size = 1.5; 7 | } 8 | void main() { 9 | highp vec4 xlt_pos; 10 | highp float xlt_size; 11 | xlat_main( xlt_pos, xlt_size); 12 | gl_Position = vec4(xlt_pos); 13 | gl_PointSize = float(xlt_size); 14 | } 15 | -------------------------------------------------------------------------------- /tests/vertex/psize-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | void xlat_main( out highp vec4 pos, out highp float size ) { 4 | #line 3 5 | pos = vec4( 1.0, 2.0, 3.0, 4.0); 6 | size = 1.5; 7 | } 8 | void main() { 9 | highp vec4 xlt_pos; 10 | highp float xlt_size; 11 | xlat_main( xlt_pos, xlt_size); 12 | gl_Position = vec4(xlt_pos); 13 | gl_PointSize = float(xlt_size); 14 | } 15 | -------------------------------------------------------------------------------- /tests/vertex/qualifiers-in.txt: -------------------------------------------------------------------------------- 1 | uniform float uni_1; 2 | float uni_2; 3 | 4 | static float stat_1; 5 | static const float stat_2 = 1.3; 6 | const static float stat_3 = 1.5; 7 | const float const_3 = 1e-6f; 8 | 9 | uniform float mutable_1; 10 | float mutable_2; 11 | 12 | float _mutable_with_underscore; 13 | 14 | // hlsl allows qualifiers on function return values 15 | static float func_static() { return 7.0; } 16 | const float func_const() { return 7.0; } 17 | const static float func_const_static() { return 7.0; } 18 | static const float func_static_const() { return 7.0; } 19 | 20 | float4 main () : POSITION 21 | { 22 | mutable_1 = 3; 23 | mutable_2 = 4; 24 | _mutable_with_underscore = 5; 25 | float func = func_static() + func_const() + func_const_static() + func_static_const(); 26 | return uni_1 + uni_2 + stat_1 + stat_2 + stat_3 + const_3 + mutable_1 + mutable_2 + _mutable_with_underscore + func; 27 | } 28 | -------------------------------------------------------------------------------- /tests/vertex/reserved-names-in.txt: -------------------------------------------------------------------------------- 1 | float4 attribute; // valid in HLSL 2 | float4 varying; // valid in HLSL 3 | float4 mix; // valid in HLSL 4 | float4 atan; // valid in HLSL 5 | 6 | float4 main () : POSITION 7 | { 8 | return attribute + varying + mix + atan; 9 | } 10 | -------------------------------------------------------------------------------- /tests/vertex/reserved-names-out.txt: -------------------------------------------------------------------------------- 1 | uniform vec4 xlat_varattribute; 2 | uniform vec4 xlat_varvarying; 3 | #line 3 4 | uniform vec4 xlat_varmix; 5 | uniform vec4 xlat_varatan; 6 | #line 6 7 | vec4 xlat_main( ) { 8 | #line 8 9 | return (((xlat_varattribute + xlat_varvarying) + xlat_varmix) + xlat_varatan); 10 | } 11 | void main() { 12 | vec4 xl_retval; 13 | xl_retval = xlat_main( ); 14 | gl_Position = vec4(xl_retval); 15 | } 16 | 17 | // uniforms: 18 | // xlat_varatan: type 12 arrsize 0 19 | // xlat_varattribute: type 12 arrsize 0 20 | // xlat_varmix: type 12 arrsize 0 21 | // xlat_varvarying: type 12 arrsize 0 22 | -------------------------------------------------------------------------------- /tests/vertex/reserved-names-outES.txt: -------------------------------------------------------------------------------- 1 | uniform highp vec4 xlat_varattribute; 2 | uniform highp vec4 xlat_varvarying; 3 | #line 3 4 | uniform highp vec4 xlat_varmix; 5 | uniform highp vec4 xlat_varatan; 6 | #line 6 7 | highp vec4 xlat_main( ) { 8 | #line 8 9 | return (((xlat_varattribute + xlat_varvarying) + xlat_varmix) + xlat_varatan); 10 | } 11 | void main() { 12 | highp vec4 xl_retval; 13 | xl_retval = xlat_main( ); 14 | gl_Position = vec4(xl_retval); 15 | } 16 | 17 | // uniforms: 18 | // xlat_varatan: type 12 arrsize 0 19 | // xlat_varattribute: type 12 arrsize 0 20 | // xlat_varmix: type 12 arrsize 0 21 | // xlat_varvarying: type 12 arrsize 0 22 | -------------------------------------------------------------------------------- /tests/vertex/reserved-names-outES3.txt: -------------------------------------------------------------------------------- 1 | uniform highp vec4 xlat_varattribute; 2 | uniform highp vec4 xlat_varvarying; 3 | #line 3 4 | uniform highp vec4 xlat_varmix; 5 | uniform highp vec4 xlat_varatan; 6 | #line 6 7 | highp vec4 xlat_main( ) { 8 | #line 8 9 | return (((xlat_varattribute + xlat_varvarying) + xlat_varmix) + xlat_varatan); 10 | } 11 | void main() { 12 | highp vec4 xl_retval; 13 | xl_retval = xlat_main( ); 14 | gl_Position = vec4(xl_retval); 15 | } 16 | 17 | // uniforms: 18 | // xlat_varatan: type 12 arrsize 0 19 | // xlat_varattribute: type 12 arrsize 0 20 | // xlat_varmix: type 12 arrsize 0 21 | // xlat_varvarying: type 12 arrsize 0 22 | -------------------------------------------------------------------------------- /tests/vertex/return-struct-of-struct-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "return-struct-of-struct-in.txt" 2 | struct v2f_sub { 3 | float4 color : COLOR; 4 | }; 5 | struct v2f { 6 | float4 pos : TEXCOORD; 7 | v2f_sub ss; 8 | }; 9 | v2f main( in float4 pos : POSITION ) 10 | { 11 | v2f o; 12 | o.pos = pos; 13 | o.ss.color = pos; 14 | return o; 15 | } 16 | -------------------------------------------------------------------------------- /tests/vertex/return-struct-of-struct-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 0 3 | struct v2f_sub { 4 | vec4 color; 5 | }; 6 | #line 4 7 | struct v2f { 8 | vec4 pos; 9 | v2f_sub ss; 10 | }; 11 | #line 8 12 | #line 8 13 | v2f xlat_main( in vec4 pos ) { 14 | v2f o; 15 | o.pos = pos; 16 | #line 12 17 | o.ss.color = pos; 18 | return o; 19 | } 20 | varying vec4 xlv_TEXCOORD; 21 | varying vec4 xlv_COLOR; 22 | void main() { 23 | v2f xl_retval; 24 | xl_retval = xlat_main( vec4(gl_Vertex)); 25 | xlv_TEXCOORD = vec4(xl_retval.pos); 26 | xlv_COLOR = vec4(xl_retval.ss.color); 27 | } 28 | -------------------------------------------------------------------------------- /tests/vertex/return-struct-of-struct-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 0 3 | struct v2f_sub { 4 | highp vec4 color; 5 | }; 6 | #line 4 7 | struct v2f { 8 | highp vec4 pos; 9 | v2f_sub ss; 10 | }; 11 | #line 8 12 | #line 8 13 | v2f xlat_main( in highp vec4 pos ) { 14 | v2f o; 15 | o.pos = pos; 16 | #line 12 17 | o.ss.color = pos; 18 | return o; 19 | } 20 | attribute highp vec4 xlat_attrib_POSITION; 21 | varying highp vec4 xlv_TEXCOORD; 22 | varying highp vec4 xlv_COLOR; 23 | void main() { 24 | v2f xl_retval; 25 | xl_retval = xlat_main( vec4(xlat_attrib_POSITION)); 26 | xlv_TEXCOORD = vec4(xl_retval.pos); 27 | xlv_COLOR = vec4(xl_retval.ss.color); 28 | } 29 | -------------------------------------------------------------------------------- /tests/vertex/return-struct-of-struct-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 0 3 | struct v2f_sub { 4 | highp vec4 color; 5 | }; 6 | #line 4 7 | struct v2f { 8 | highp vec4 pos; 9 | v2f_sub ss; 10 | }; 11 | #line 8 12 | #line 8 13 | v2f xlat_main( in highp vec4 pos ) { 14 | v2f o; 15 | o.pos = pos; 16 | #line 12 17 | o.ss.color = pos; 18 | return o; 19 | } 20 | in highp vec4 xlat_attrib_POSITION; 21 | out highp vec4 xlv_TEXCOORD; 22 | out highp vec4 xlv_COLOR; 23 | void main() { 24 | v2f xl_retval; 25 | xl_retval = xlat_main( vec4(xlat_attrib_POSITION)); 26 | xlv_TEXCOORD = vec4(xl_retval.pos); 27 | xlv_COLOR = vec4(xl_retval.ss.color); 28 | } 29 | -------------------------------------------------------------------------------- /tests/vertex/sampler2dshadow-in.txt: -------------------------------------------------------------------------------- 1 | // does sampler2DShadow, when occuring in a vertex shader, gets translated correctly? 2 | 3 | sampler2DShadow shadowmap; 4 | 5 | 6 | float4 main (float4 pos : POSITION) : POSITION 7 | { 8 | return pos; 9 | } 10 | 11 | fixed4 main_frag (float4 uv : TEXCOORD0) : COLOR0 12 | { 13 | float s1 = shadow2D (shadowmap, uv.xyz); 14 | float s2 = shadow2Dproj (shadowmap, uv); 15 | 16 | s1 = tex2D (shadowmap, uv.xyz); 17 | s2 = tex2Dproj (shadowmap, uv); 18 | 19 | return s1 + s2; 20 | } 21 | -------------------------------------------------------------------------------- /tests/vertex/sampler2dshadow-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 3 3 | uniform sampler2DShadow shadowmap; 4 | #line 6 5 | vec4 xlat_main( in vec4 pos ) { 6 | #line 8 7 | return pos; 8 | } 9 | void main() { 10 | vec4 xl_retval; 11 | xl_retval = xlat_main( vec4(gl_Vertex)); 12 | gl_Position = vec4(xl_retval); 13 | } 14 | -------------------------------------------------------------------------------- /tests/vertex/sampler2dshadow-outES.txt: -------------------------------------------------------------------------------- 1 | #extension GL_EXT_shadow_samplers : require 2 | 3 | #line 3 4 | uniform lowp sampler2DShadow shadowmap; 5 | #line 6 6 | highp vec4 xlat_main( in highp vec4 pos ) { 7 | #line 8 8 | return pos; 9 | } 10 | attribute highp vec4 xlat_attrib_POSITION; 11 | void main() { 12 | highp vec4 xl_retval; 13 | xl_retval = xlat_main( vec4(xlat_attrib_POSITION)); 14 | gl_Position = vec4(xl_retval); 15 | } 16 | -------------------------------------------------------------------------------- /tests/vertex/sampler2dshadow-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 3 3 | uniform lowp sampler2DShadow shadowmap; 4 | #line 6 5 | highp vec4 xlat_main( in highp vec4 pos ) { 6 | #line 8 7 | return pos; 8 | } 9 | in highp vec4 xlat_attrib_POSITION; 10 | void main() { 11 | highp vec4 xl_retval; 12 | xl_retval = xlat_main( vec4(xlat_attrib_POSITION)); 13 | gl_Position = vec4(xl_retval); 14 | } 15 | -------------------------------------------------------------------------------- /tests/vertex/swizzle-in.txt: -------------------------------------------------------------------------------- 1 | float4 main() : POSITION 2 | { 3 | const float pos = 1; 4 | float4 pos4 = pos.xxxx; 5 | pos4 = 2..xxxx; 6 | return pos4; 7 | } 8 | -------------------------------------------------------------------------------- /tests/vertex/swizzle-out.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | vec4 xlat_main( ) { 4 | #line 3 5 | const float pos = 1.0; 6 | vec4 pos4 = vec4( 1.0); 7 | pos4 = vec4( 2.0); 8 | return pos4; 9 | } 10 | void main() { 11 | vec4 xl_retval; 12 | xl_retval = xlat_main( ); 13 | gl_Position = vec4(xl_retval); 14 | } 15 | -------------------------------------------------------------------------------- /tests/vertex/swizzle-outES.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | highp vec4 xlat_main( ) { 4 | #line 3 5 | const highp float pos = 1.0; 6 | highp vec4 pos4 = vec4( 1.0); 7 | pos4 = vec4( 2.0); 8 | return pos4; 9 | } 10 | void main() { 11 | highp vec4 xl_retval; 12 | xl_retval = xlat_main( ); 13 | gl_Position = vec4(xl_retval); 14 | } 15 | -------------------------------------------------------------------------------- /tests/vertex/swizzle-outES3.txt: -------------------------------------------------------------------------------- 1 | 2 | #line 1 3 | highp vec4 xlat_main( ) { 4 | #line 3 5 | const highp float pos = 1.0; 6 | highp vec4 pos4 = vec4( 1.0); 7 | pos4 = vec4( 2.0); 8 | return pos4; 9 | } 10 | void main() { 11 | highp vec4 xl_retval; 12 | xl_retval = xlat_main( ); 13 | gl_Position = vec4(xl_retval); 14 | } 15 | -------------------------------------------------------------------------------- /tests/vertex/systemvals-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "systemvals-in.txt" 2 | 3 | float4x4 matrices[64]; 4 | float4x4 matrix_vp; 5 | 6 | half4 colors[64]; 7 | 8 | struct v2f { 9 | float4 pos : SV_Position; 10 | float4 color : COLOR; 11 | }; 12 | 13 | struct appdata { 14 | float4 pos : POSITION; 15 | uint vertexID : SV_VertexID; 16 | }; 17 | 18 | v2f main (appdata v, uint instanceID : SV_InstanceID) 19 | { 20 | v2f o; 21 | float4 wpos = mul(matrices[instanceID], v.pos); 22 | o.pos = mul(matrix_vp, wpos); 23 | o.color = colors[v.vertexID % 64]; 24 | return o; 25 | } 26 | -------------------------------------------------------------------------------- /tests/vertex/tex2dlod-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "tex2dlod-in.txt" 2 | sampler2D tex; 3 | 4 | float4 main (float4 pos : POSITION, float2 uv : TEXCOORD0) : POSITION { 5 | float4 c = tex2Dlod (tex, float4(uv,0,0)); 6 | return pos + c; 7 | } 8 | -------------------------------------------------------------------------------- /tests/vertex/tex2dlod-out.txt: -------------------------------------------------------------------------------- 1 | vec4 xll_tex2Dlod(sampler2D s, vec4 coord) { 2 | return texture2DLod( s, coord.xy, coord.w); 3 | } 4 | #line 1 5 | uniform sampler2D tex; 6 | #line 3 7 | vec4 xlat_main( in vec4 pos, in vec2 uv ) { 8 | vec4 c = xll_tex2Dlod( tex, vec4( uv, 0.0, 0.0)); 9 | #line 5 10 | return (pos + c); 11 | } 12 | void main() { 13 | vec4 xl_retval; 14 | xl_retval = xlat_main( vec4(gl_Vertex), vec2(gl_MultiTexCoord0)); 15 | gl_Position = vec4(xl_retval); 16 | } 17 | 18 | // uniforms: 19 | // tex: type 25 arrsize 0 20 | -------------------------------------------------------------------------------- /tests/vertex/tex2dlod-outES.txt: -------------------------------------------------------------------------------- 1 | vec4 xll_tex2Dlod(sampler2D s, vec4 coord) { 2 | return texture2DLod( s, coord.xy, coord.w); 3 | } 4 | #line 1 5 | uniform sampler2D tex; 6 | #line 3 7 | highp vec4 xlat_main( in highp vec4 pos, in highp vec2 uv ) { 8 | highp vec4 c = xll_tex2Dlod( tex, vec4( uv, 0.0, 0.0)); 9 | #line 5 10 | return (pos + c); 11 | } 12 | attribute highp vec4 xlat_attrib_POSITION; 13 | attribute highp vec2 xlat_attrib_TEXCOORD0; 14 | void main() { 15 | highp vec4 xl_retval; 16 | xl_retval = xlat_main( vec4(xlat_attrib_POSITION), vec2(xlat_attrib_TEXCOORD0)); 17 | gl_Position = vec4(xl_retval); 18 | } 19 | 20 | // uniforms: 21 | // tex: type 25 arrsize 0 22 | -------------------------------------------------------------------------------- /tests/vertex/tex2dlod-outES3.txt: -------------------------------------------------------------------------------- 1 | vec4 xll_tex2Dlod(sampler2D s, vec4 coord) { 2 | return textureLod( s, coord.xy, coord.w); 3 | } 4 | #line 1 5 | uniform sampler2D tex; 6 | #line 3 7 | highp vec4 xlat_main( in highp vec4 pos, in highp vec2 uv ) { 8 | highp vec4 c = xll_tex2Dlod( tex, vec4( uv, 0.0, 0.0)); 9 | #line 5 10 | return (pos + c); 11 | } 12 | in highp vec4 xlat_attrib_POSITION; 13 | in highp vec2 xlat_attrib_TEXCOORD0; 14 | void main() { 15 | highp vec4 xl_retval; 16 | xl_retval = xlat_main( vec4(xlat_attrib_POSITION), vec2(xlat_attrib_TEXCOORD0)); 17 | gl_Position = vec4(xl_retval); 18 | } 19 | 20 | // uniforms: 21 | // tex: type 25 arrsize 0 22 | -------------------------------------------------------------------------------- /tests/vertex/token-pasting-in.txt: -------------------------------------------------------------------------------- 1 | #define MAKE_VAR(first, second) float4 first ## second 2 | MAKE_VAR(pasted, Name); 3 | 4 | 5 | float4 main() : POSITION 6 | { 7 | return pastedName; 8 | } 9 | -------------------------------------------------------------------------------- /tests/vertex/token-pasting-out.txt: -------------------------------------------------------------------------------- 1 | uniform vec4 pastedName; 2 | #line 5 3 | #line 5 4 | vec4 xlat_main( ) { 5 | return pastedName; 6 | } 7 | void main() { 8 | vec4 xl_retval; 9 | xl_retval = xlat_main( ); 10 | gl_Position = vec4(xl_retval); 11 | } 12 | 13 | // uniforms: 14 | // pastedName: type 12 arrsize 0 15 | -------------------------------------------------------------------------------- /tests/vertex/token-pasting-outES.txt: -------------------------------------------------------------------------------- 1 | uniform highp vec4 pastedName; 2 | #line 5 3 | #line 5 4 | highp vec4 xlat_main( ) { 5 | return pastedName; 6 | } 7 | void main() { 8 | highp vec4 xl_retval; 9 | xl_retval = xlat_main( ); 10 | gl_Position = vec4(xl_retval); 11 | } 12 | 13 | // uniforms: 14 | // pastedName: type 12 arrsize 0 15 | -------------------------------------------------------------------------------- /tests/vertex/token-pasting-outES3.txt: -------------------------------------------------------------------------------- 1 | uniform highp vec4 pastedName; 2 | #line 5 3 | #line 5 4 | highp vec4 xlat_main( ) { 5 | return pastedName; 6 | } 7 | void main() { 8 | highp vec4 xl_retval; 9 | xl_retval = xlat_main( ); 10 | gl_Position = vec4(xl_retval); 11 | } 12 | 13 | // uniforms: 14 | // pastedName: type 12 arrsize 0 15 | -------------------------------------------------------------------------------- /tests/vertex/z-collectshadows-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "complex-collectshadows-in.txt" 2 | float4x4 glstate_matrix_mvp; 3 | struct appdata { 4 | float4 vertex : POSITION; 5 | float2 texcoord : TEXCOORD0; 6 | float3 texcoord1 : TEXCOORD1; 7 | }; 8 | 9 | struct v2f { 10 | float4 pos : POSITION; 11 | float2 uv : TEXCOORD0; 12 | float3 ray : TEXCOORD1; 13 | }; 14 | 15 | v2f main (appdata v) 16 | { 17 | v2f o; 18 | o.pos = mul(glstate_matrix_mvp, v.vertex); 19 | o.uv = v.texcoord; 20 | o.ray = v.texcoord1; 21 | return o; 22 | } 23 | -------------------------------------------------------------------------------- /tests/vertex/z-particle-in.txt: -------------------------------------------------------------------------------- 1 | #line 1 "complex-particle-in.txt" 2 | float4x4 glstate_matrix_mvp; 3 | struct appdata_t { 4 | float4 vertex : POSITION; 5 | fixed4 color : COLOR; 6 | float2 texcoord : TEXCOORD0; 7 | }; 8 | struct v2f { 9 | float4 vertex : POSITION; 10 | fixed4 color : COLOR; 11 | half2 texcoord : TEXCOORD0; 12 | }; 13 | float4 _MainTex_ST; 14 | v2f main (appdata_t v) 15 | { 16 | v2f o; 17 | o.vertex = mul (glstate_matrix_mvp, v.vertex); 18 | o.color = v.color; 19 | o.texcoord = (v.texcoord.xy * _MainTex_ST.xy + _MainTex_ST.zw); 20 | return o; 21 | } 22 | -------------------------------------------------------------------------------- /tools/bin/bison.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aras-p/hlsl2glslfork/8d899a244779fc133c2661c58f763a92e5d7a697/tools/bin/bison.exe -------------------------------------------------------------------------------- /tools/bin/cygwin1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aras-p/hlsl2glslfork/8d899a244779fc133c2661c58f763a92e5d7a697/tools/bin/cygwin1.dll -------------------------------------------------------------------------------- /tools/bin/libiconv2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aras-p/hlsl2glslfork/8d899a244779fc133c2661c58f763a92e5d7a697/tools/bin/libiconv2.dll -------------------------------------------------------------------------------- /tools/bin/libintl3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aras-p/hlsl2glslfork/8d899a244779fc133c2661c58f763a92e5d7a697/tools/bin/libintl3.dll -------------------------------------------------------------------------------- /tools/bin/m4.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aras-p/hlsl2glslfork/8d899a244779fc133c2661c58f763a92e5d7a697/tools/bin/m4.exe -------------------------------------------------------------------------------- /tools/bin/regex2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aras-p/hlsl2glslfork/8d899a244779fc133c2661c58f763a92e5d7a697/tools/bin/regex2.dll -------------------------------------------------------------------------------- /tools/flex.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aras-p/hlsl2glslfork/8d899a244779fc133c2661c58f763a92e5d7a697/tools/flex.exe --------------------------------------------------------------------------------