Skip to content
This repository was archived by the owner on Aug 2, 2025. It is now read-only.

Commit 7070396

Browse files
committed
Add "final code" in Finishing up page
1 parent 24e063a commit 7070396

File tree

1 file changed

+53
-1
lines changed

1 file changed

+53
-1
lines changed

docs/03_Getting_started/09_Finishing_up.md

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff 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+
```

0 commit comments

Comments
 (0)