Skip to content

Commit

Permalink
Use shaders with include section to show off ShaderParser
Browse files Browse the repository at this point in the history
  • Loading branch information
deccer committed Nov 23, 2022
1 parent de04fed commit 20fdf67
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
14 changes: 14 additions & 0 deletions examples/Swapchain/Swapchain.Assets/Shaders/Common.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
layout(binding = 0, std140) uniform GpuConstants
{
mat4 ViewProj;
};

struct GpuObject
{
mat4 World;
};

layout(binding = 1, std430) readonly buffer ObjectBuffer
{
GpuObject Objects[];
} objectBuffer;
6 changes: 5 additions & 1 deletion examples/Swapchain/Swapchain.Assets/Shaders/FST.vs.glsl
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#version 460 core

layout(location = 0) out vec2 fs_uv;
layout (location = 0) out gl_PerVertex
{
vec4 gl_Position;
};
layout(location = 1) out vec2 fs_uv;

void main()
{
Expand Down
19 changes: 5 additions & 14 deletions examples/Swapchain/Swapchain.Assets/Shaders/Scene.vs.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,16 @@ layout(location = 1) in vec3 i_normal;
layout(location = 2) in vec2 i_uv;
layout(location = 3) in vec2 i_tangent;

layout (location = 0) out gl_PerVertex
{
vec4 gl_Position;
};
layout(location = 0) out vec3 v_position;
layout(location = 1) out vec3 v_normal;
layout(location = 2) out vec2 v_uv;
layout(location = 3) out flat int v_object_id;

layout(binding = 0, std140) uniform GpuConstants
{
mat4 ViewProj;
};

struct GpuObject
{
mat4 World;
};

layout(binding = 1, std430) readonly buffer ObjectBuffer
{
GpuObject Objects[];
} objectBuffer;
#include "Common.glsl"

void main()
{
Expand Down

0 comments on commit 20fdf67

Please sign in to comment.