Commit Graph

207 Commits

Author SHA1 Message Date
Jérôme Leclercq a4858d6793 Shader: Add comments to surround modules 2022-03-14 18:30:55 +01:00
Jérôme Leclercq 4bded2182c Minor changes 2022-03-14 18:30:55 +01:00
Jérôme Leclercq 53728200ac Shader: Add module ID (UUID) 2022-03-14 18:30:55 +01:00
Jérôme Leclercq 43ac86e85c Shader/Modules: proof of concept 2022-03-14 18:30:55 +01:00
Jérôme Leclercq 7dab1d735f Shader: Add AstExportVisitor 2022-03-14 18:30:55 +01:00
Jérôme Leclercq 073f1dc434 Shader/DependencyCheckerVisitor: Update default config 2022-03-14 18:30:55 +01:00
Jérôme Leclercq b6cd85d6fe Shader: Add import statement (not doing anything for now) 2022-03-14 18:30:55 +01:00
Jérôme Leclercq ca83f363a3 Shader: Add export attribute for structs ([export]) 2022-03-14 18:30:55 +01:00
Jérôme Leclercq a2f4f3c802 Shader: Many fixes 2022-03-14 18:30:55 +01:00
Jérôme Leclercq 1919bd3302 Fix compilation 2022-03-14 18:30:55 +01:00
Jérôme Leclercq 0c3607579e Shader/ShaderLangParser: small refactor 2022-03-14 18:30:55 +01:00
Jérôme Leclercq 99e07e6e1e Shader: Add module statement 2022-03-14 18:30:55 +01:00
Jérôme Leclercq acf1b30355 Shader/AstCompare: Fix missing ConditionalStatement compare 2022-03-06 13:19:19 +01:00
Jérôme Leclercq 36aea2ca0c Shader/SanitizeVisitor: Fix sanitization of already sanitized AST with holes in indices
this happens when you sanitize an AST that went through a remove unused pass
2022-02-28 13:30:53 +01:00
Lynix 1e606f3043 Fix compilation after merge 2022-02-27 20:18:36 +01:00
Lynix 4c226eda0c Merge branch 'master' into nzsl-modules 2022-02-27 20:12:30 +01:00
Lynix 1c986b7431 Fix compilation 2022-02-27 20:04:52 +01:00
Jérôme Leclercq 96d87d9439 Merge fix 2022-02-27 18:54:45 +01:00
Jérôme Leclercq bcfef75ec2 Merge branch 'master' into nzsl-modules 2022-02-27 18:44:44 +01:00
Jérôme Leclercq fbae413620 Shader/GlslWriter: Improve removal of unused code 2022-02-27 18:42:41 +01:00
Jérôme Leclercq a155aa598e Shader: Move DependencyChecker to a public class 2022-02-26 16:08:16 +01:00
Jérôme Leclercq 7ece44b4f4 Shader: Rename Optimize to ConstantPropagation 2022-02-22 13:28:01 +01:00
Jérôme Leclercq 3f7815175b Shader: Add EliminateUnusedPassVisitor and use it when optimizing 2022-02-18 13:06:47 +01:00
Jérôme Leclercq 402e16bd2b Shader: Handle type as expressions 2022-02-17 13:23:56 +01:00
Jérôme Leclercq e6951d54a5 Shader: Switch type<subtype> to type[subtype] 2022-01-26 19:24:46 +01:00
Jérôme Leclercq b8a52b93e8 Shader/SPIRV: Handle arrays properly 2022-01-23 19:59:26 +01:00
Jérôme Leclercq 2463e471cc Shader/SPIRV: Fix issues with loops containing branches and cross product 2022-01-23 19:59:10 +01:00
Jérôme Leclercq 64efd81bf8 Shader: Handle matrix cast properly 2022-01-23 19:58:04 +01:00
Jérôme Leclercq b0a3941f4e Add Phong lighting (WIP) 2022-01-11 19:47:29 +01:00
Jérôme Leclercq 756fd773a9 Shader: Add support for numerical fors 2022-01-06 20:38:55 +01:00
Jérôme Leclercq 2bdcc045cd Shader: Replace const for with [unroll] attribute 2022-01-03 20:21:09 +01:00
Jérôme Leclercq 4fe44339c5 Shader: Add support for for-each statements and improve arrays 2022-01-02 22:02:11 +01:00
Jérôme Leclercq 1f15328fdd Shader: Add initial support for arrays 2022-01-01 23:01:31 +01:00
SirLynix 89c7bbf197 Update copyright date 2022-01-01 15:30:09 +01:00
Jérôme Leclercq 101a3d70da Shader/AstOptimizer: Add swizzle optimization 2021-12-28 20:09:04 +01:00
Jérôme Leclercq a0f66d9e88 Shader/SPIRV: Fix multiple branch handling (by splitting) 2021-12-28 11:48:19 +01:00
Jérôme Leclercq b98fd65a01 Fix a lot of small bugs/warnings 2021-12-25 20:07:53 +01:00
Jérôme Leclercq f98ea6b0ca Shader: Add full support for scalar swizzle 2021-12-25 19:13:08 +01:00
Jérôme Leclercq f798901c23 UnitTests: Use glslang to validate GLSL shaders 2021-12-24 14:54:35 +01:00
Jérôme Leclercq b53d2a0560 Rework shader module unit tests 2021-12-23 17:39:24 +01:00
Jérôme Leclercq a5cc915948 Shader/SPIRV: Fix structs being always decorated as block
They are now only decorated as blocks when used as uniform buffers, which fixes structure nesting
2021-12-23 17:36:40 +01:00
Jérôme Leclercq e2882f6595 Shader: Rename Parse function to ParseFromFile
to avoid ambiguous calls when passing const char*
2021-12-23 17:18:30 +01:00
Jérôme Leclercq 837b72f68e Shader: Rework Swizzle and add support for swizzle store in SPIRV 2021-12-21 14:30:47 +01:00
Jérôme Leclercq e43a638112 Shader/SpirvData: Regenerate SPIRV data (update to 1.6.1) 2021-12-20 22:37:34 +01:00
Jérôme Leclercq 0f9060c45b Shader: Add support for while loops 2021-12-16 23:10:58 +01:00
Jérôme Leclercq 0aec863300 Shader: Add support for exp intrinsic 2021-12-05 17:02:46 +01:00
Lynix 57d39f7eeb Shader/GlslWriter: Rename scaleZPosition to remapZPosition 2021-11-21 16:15:56 +01:00
Jérôme Leclercq c85263c9e7 Shader/GlslWriter: Add depth fix (from [0;1] to [-1;1] 2021-11-14 13:00:15 +01:00
Jérôme Leclercq a02b1952c0 Apply header order fix 2021-10-28 09:53:56 +02:00
Jérôme Leclercq f491ee1e38 Apply inclusion fix 2021-10-27 18:09:19 +02:00
Jérôme Leclercq 93ec196dc4 Apply header guard check 2021-10-26 15:52:46 +02:00
Jérôme Leclercq ed7ab31933 Apply copyright fix to all files 2021-10-26 14:31:35 +02:00
Jérôme Leclercq 8d5276ddac XMake: update SPIRV and Unicode data parsers 2021-10-26 11:14:20 +02:00
Jérôme Leclercq 14fb2b83ae Minor fixes 2021-10-25 15:48:49 +02:00
Jérôme Leclercq 0442db1c53 Shader: Add support for compound operators 2021-09-24 15:39:03 +02:00
Jérôme Leclercq 601ed047ba Fix some initialization order 2021-09-24 15:24:21 +02:00
Jérôme Leclercq ea49f56530 Shader/LangParser: OCD fix 2021-09-23 17:49:36 +02:00
Jérôme Leclercq 02a12d9328 Handle shader options of any type 2021-09-03 19:33:41 +02:00
Jérôme Leclercq ac08afe9f1 Shader: Add missing ! and != parsing 2021-08-19 18:47:11 +02:00
Jérôme Leclercq a5b71f33b9 Shader: Fix support of conditional functions 2021-08-19 18:47:11 +02:00
Jérôme Leclercq 863fb3ea7e Shader: Fix optimization issues
Moving the unique_ptrs but failing to optimize the expression could cause issues
Also the constant query callback defaulted to ConstantValue (without const ref), thanks auto.
2021-07-11 11:17:48 +02:00
Jérôme Leclercq 996b5ef85c Shader: Rename ConstantIndexExpression to ConstantExpression 2021-07-08 15:24:22 +02:00
Jérôme Leclercq 3a31c77524 Shader: Rename ConstantExpression to ConstantValueExpression 2021-07-08 15:22:08 +02:00
Jérôme Leclercq a895e553d4 Graphics: rework ubershaders to prevent duplicate shaders modules
Also rename all remaining conditions to options
2021-07-08 14:52:39 +02:00
Jérôme Leclercq d3e0d8a39f Shader: Replace select_opt by const_select 2021-07-08 10:53:11 +02:00
Jérôme Leclercq 1f6937ab1b Shader: Implement const if and const values 2021-07-07 22:38:24 +02:00
Jérôme Leclercq 72edff30c7 Shader: Add support for logical and/or 2021-07-07 22:38:24 +02:00
Jérôme Leclercq f9af35b489 Shader: Attribute can now have expressions as values and struct fields can be conditionally supported 2021-07-07 22:38:24 +02:00
Jérôme Leclercq ae73f68d8c Shader: Fix variable shadowing with GLSL 2021-07-06 11:43:47 +02:00
Jérôme Leclercq f9b453bd2b Shader: Add support for branching and discard statements 2021-07-03 19:13:22 +02:00
Jérôme Leclercq dfa46ebaa5 Fix shader generation unit tests 2021-06-16 16:50:00 +02:00
Jérôme Leclercq f22b501e25 Add initial support for shader binding sets (WIP) 2021-06-16 16:50:00 +02:00
Jérôme Leclercq 815a7b0c62 Replace const ShaderAst::StatementPtr& by ShaderAst::Statement& in input 2021-06-16 16:50:00 +02:00
Jérôme Leclercq 50bf26d92f Shader: Add support for pow intrinsic 2021-06-05 01:29:36 +02:00
Jérôme Leclercq 4465e230af Shader/NZSL: Add support for array indexing 2021-06-01 16:22:41 +02:00
Jérôme Leclercq 0f3c0abb96 Shader/ShaderAst: Rename AccessMember* to Access* 2021-06-01 12:38:17 +02:00
Jérôme Leclercq 16e2f5f819 Shader: Add support for depth_write and early_fragment_tests attributes (+ FragDepth builtin) 2021-06-01 12:32:24 +02:00
Jérôme Leclercq 465837ff12 Renderer: Add support for cubemaps 2021-06-01 12:30:37 +02:00
Jérôme Leclercq 2f8a82ed05 Shader/ShaderBuild: Fix ambiguity for AccessMember 2021-05-29 00:56:04 +02:00
Jérôme Leclercq 109b2a156e OpenGLRenderer: Allow RenderPipeline without a fragment shader on OpenGL ES 2021-05-29 00:32:00 +02:00
Jérôme Leclercq 58fe411750 Shader/GlslWriter: Move function forward declaration before functions using them
Because of some weird ass shit bug in nvidia driver if functions were forward declared before declaration of UBO they were using
2021-05-26 22:21:57 +02:00
Jérôme Leclercq e7a2573221 Shader: Add support for FragCoord builtin 2021-05-26 22:17:07 +02:00
Jérôme Leclercq f6fd996bf1 Shader: Add support for custom functions calls (and better handle intrinsics) 2021-05-22 13:37:54 +02:00
Jérôme Leclercq a7235ab02d Shader: Add support for max/min intrinsic 2021-05-19 20:31:26 +02:00
Jérôme Leclercq a002d5c210 Shader: Add constant cast optimization 2021-05-18 17:25:37 +02:00
Lynix ccccbfe0ad Shader/SpirV: Fix UInt32 support 2021-05-16 23:14:39 +02:00
Lynix 61d082e61b Shader/ShaderWrite: Add optimize bool 2021-05-16 23:08:36 +02:00
Lynix 525f24af2e Shader/ShaderLang: Add support for Unary operators 2021-05-16 23:07:25 +02:00
Jérôme Leclercq 830ec6ac94 Add a few helper functions 2021-05-14 02:09:25 +02:00
Jérôme Leclercq 51ecff2912 ShaderLang: Add support for length intrinsic 2021-05-14 02:02:12 +02:00
Jérôme Leclercq 2238bbfa0c Shader: Add AstReflect 2021-04-20 18:18:27 +02:00
Jérôme Leclercq 500ccda85a Shader: StatementPtr& => const StatementPtr& 2021-04-20 18:18:27 +02:00
Jérôme Leclercq 1a8599ba29 Shader: Add sanitization of identifiers (fixes GLSL generation) 2021-04-20 18:18:27 +02:00
Jérôme Leclercq 3a7f5c2630 Shader: Fix optimization 2021-04-20 18:18:27 +02:00
Jérôme Leclercq 87ce2edc6e Shader: Add initial support for options (WIP) 2021-04-20 18:18:27 +02:00
Jérôme Leclercq 9fd4249a87 Shader: compilation fixes 2021-04-20 18:18:27 +02:00
Jérôme Leclercq d335d44d6a Shader: Cleanup and rename AST files 2021-04-20 18:18:27 +02:00
Jérôme Leclercq afe3a0ea93 Shader: Merge AstScopedVisitor, AstValidator and TransformVisitor to SanitizeVisitor 2021-04-20 18:18:27 +02:00
Jérôme Leclercq 8515c9cea1 Shader: Improve ShaderAstCloner 2021-04-20 18:18:27 +02:00
Jérôme Leclercq 0bb9c37a38 Shader/Lang: [[attribute]] => [attribute] 2021-04-20 18:18:27 +02:00