Commit 0dc50c0
authored
Rework Shader API (#307)
* add initial shader builder dsl
* continue work on shader api
* flesh out more of new Shader api
* update shader api to include compute shader
* add MainShaderBlock and MainShaderBlockBuilder
* add a shaderBlock dsl builder
* add include shaderblockbuilder functionality
* update ShaderCode to format blocks when generating source
* start implementing standard shaders & blocks with new api
* add ShaderBlockBindGroup
* update ShaderCode to allow for tracking bind groups
* continue work on building shader code api
* update Shader to use a ShaderCode
* add PBR functions
* start adding shader struct types
* update ShaderStruct to calculate offset, alignment, and size
* add more shader struct offset tests
* add shader bindings and bind groups
* rework more of the shader builder
* twaek src generating for shader code
* fix extending shadercode with duplicate mains
* fix up extending & including shaders
* fix shader rules replacement string logic to format better
* tweak after instert rules
* add shader bind group builder & bindings to shader code
* update shader block missing appendLine
* add multiple bindgroup shader test
* add shader binding group test for textures and samplers
* add generating bindgrouplayout descriptors and bindgroup layout entries
* clean up and start rewokring CommonShaderBlocks and StandardShaders
* add more shader code builder tests
* tweak marker regex to handle anything in between % symmbols
add more shader code tests
* uncomment the rest of the standrd common blocks & shaders and add test vertex attribute layout to tests
* update shader code main entry points to be main shader blcok specific ('vs_', 'fs_', 'cmp_')
* rework ShaderBlocks to require a name/id to be unique for deduplication when extending a shader
update ShaderCode to dedupe bind groups using the same group id & combine them
* rework 3d pipeline to use new shader code shaders
* fix SpriteBatch & SpriteCache shaders and usages
* remove unusuded old shader builder code
* add render function to ModelBatch to override current material for mesh primtiive
shader: update setBindGroup to handle unused bindings (such as Material)
tweak UnlitMaterail to handle create bindgrouplayout for null usages
* examples: add a DepthSlice and Depth materials for debugging1 parent 2da77a5 commit 0dc50c0
File tree
75 files changed
+4143
-1896
lines changed- core/src
- commonMain/kotlin/com/littlekt/graphics
- g2d
- util
- g3d
- material
- shader
- blocks
- util
- shader
- shader
- builder
- util
- webgpu
- commonTest/kotlin/com/littlekt
- graphics/shader
- mesh/layout
- jsMain/kotlin/com/littlekt/graphics/webgpu
- jvmMain/kotlin/com/littlekt/graphics/webgpu
- examples/src/commonMain/kotlin/com/littlekt/examples
- debug
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
75 files changed
+4143
-1896
lines changedLines changed: 5 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
113 | | - | |
114 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| |||
616 | 616 | | |
617 | 617 | | |
618 | 618 | | |
619 | | - | |
| 619 | + | |
620 | 620 | | |
621 | 621 | | |
622 | 622 | | |
| |||
727 | 727 | | |
728 | 728 | | |
729 | 729 | | |
730 | | - | |
731 | | - | |
732 | | - | |
733 | | - | |
734 | | - | |
| 730 | + | |
735 | 731 | | |
736 | 732 | | |
737 | 733 | | |
| |||
Lines changed: 20 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
59 | 77 | | |
60 | 78 | | |
61 | 79 | | |
62 | 80 | | |
63 | 81 | | |
64 | 82 | | |
65 | 83 | | |
66 | | - | |
| 84 | + | |
67 | 85 | | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
| 86 | + | |
Lines changed: 2 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
229 | | - | |
| 229 | + | |
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
| |||
459 | 459 | | |
460 | 460 | | |
461 | 461 | | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
| 462 | + | |
467 | 463 | | |
468 | 464 | | |
469 | 465 | | |
| |||
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
144 | 145 | | |
145 | 146 | | |
146 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
147 | 165 | | |
148 | 166 | | |
149 | 167 | | |
| |||
Lines changed: 15 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| |||
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
23 | | - | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| |||
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
77 | 63 | | |
78 | 64 | | |
79 | 65 | | |
| |||
84 | 70 | | |
85 | 71 | | |
86 | 72 | | |
87 | | - | |
| 73 | + | |
88 | 74 | | |
89 | 75 | | |
90 | 76 | | |
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | | - | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
| 12 | + | |
| 13 | + | |
Lines changed: 53 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
120 | 132 | | |
121 | 133 | | |
122 | 134 | | |
123 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
124 | 144 | | |
125 | 145 | | |
126 | 146 | | |
| |||
152 | 172 | | |
153 | 173 | | |
154 | 174 | | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
155 | 206 | | |
156 | 207 | | |
157 | 208 | | |
| |||
166 | 217 | | |
167 | 218 | | |
168 | 219 | | |
169 | | - | |
170 | | - | |
| 220 | + | |
| 221 | + | |
171 | 222 | | |
172 | 223 | | |
173 | 224 | | |
| |||
0 commit comments