This repository was archived by the owner on Aug 2, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +53
-1
lines changed
Expand file tree Collapse file tree 1 file changed +53
-1
lines changed Original file line number Diff line number Diff line change @@ -248,7 +248,7 @@ int main(int argc, char const *argv[])
248248```
249249
250250```cpp
251- // src/window.cpp
251+ // src/window.hpp
252252
253253#pragma once
254254
@@ -349,3 +349,55 @@ struct AppWindow {
349349 }
350350};
351351```
352+
353+ ``` cpp
354+ // src/shaders/shared.inl
355+
356+ #pragma once
357+
358+ #include < daxa/daxa.inl>
359+
360+ struct MyVertex
361+ {
362+ daxa_f32vec3 position;
363+ daxa_f32vec3 color;
364+ };
365+
366+ DAXA_DECL_BUFFER_PTR (MyVertex)
367+
368+ struct MyPushConstant
369+ {
370+ daxa_BufferPtr(MyVertex) my_vertex_ptr;
371+ };
372+ ```
373+
374+ ```cpp
375+ // src/shaders/main.glsl
376+
377+ #include <daxa/daxa.inl>
378+ #include <shared.inl>
379+
380+ DAXA_DECL_PUSH_CONSTANT(MyPushConstant, push)
381+
382+ #if DAXA_SHADER_STAGE == DAXA_SHADER_STAGE_VERTEX
383+
384+ layout(location = 0) out daxa_f32vec3 v_col;
385+ void main()
386+ {
387+ MyVertex vert = deref(push.my_vertex_ptr[gl_VertexIndex]);
388+ gl_Position = daxa_f32vec4(vert.position, 1);
389+ v_col = vert.color;
390+ }
391+
392+ #elif DAXA_SHADER_STAGE == DAXA_SHADER_STAGE_FRAGMENT
393+
394+ layout(location = 0) in daxa_f32vec3 v_col;
395+ layout(location = 0) out daxa_f32vec4 color;
396+ void main()
397+ {
398+ color = daxa_f32vec4(v_col, 1);
399+ debugPrintfEXT("test\n");
400+ }
401+
402+ #endif
403+ ```
You can’t perform that action at this time.
0 commit comments