Move shaders into glsl and hlsl directories
Move `data/shaders` to `data/shaders/glsl` Move `data/hlsl` to `data/shaders/hlsl` Fix up shader paths in the cpp files to point to the new glsl location. `data/shaders/hlsl/compile.py` still overwrites the glsl .spv files (for now). Issue: #723
This commit is contained in:
parent
cac1d2e850
commit
ca884587a4
1043 changed files with 1207 additions and 1201 deletions
20
data/shaders/hlsl/imgui/scene.frag
Normal file
20
data/shaders/hlsl/imgui/scene.frag
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright 2020 Google LLC
|
||||
|
||||
struct VSOutput
|
||||
{
|
||||
[[vk::location(0)]] float3 Normal : NORMAL0;
|
||||
[[vk::location(1)]] float3 Color : COLOR0;
|
||||
[[vk::location(2)]] float3 ViewVec : TEXCOORD1;
|
||||
[[vk::location(3)]] float3 LightVec : TEXCOORD2;
|
||||
};
|
||||
|
||||
float4 main(VSOutput input) : SV_TARGET
|
||||
{
|
||||
float3 N = normalize(input.Normal);
|
||||
float3 L = normalize(input.LightVec);
|
||||
float3 V = normalize(input.ViewVec);
|
||||
float3 R = reflect(-L, N);
|
||||
float diffuse = max(dot(N, L), 0.0);
|
||||
float3 specular = pow(max(dot(R, V), 0.0), 16.0) * float3(0.75, 0.75, 0.75);
|
||||
return float4(diffuse * input.Color + specular, 1.0);
|
||||
}
|
||||
41
data/shaders/hlsl/imgui/scene.vert
Normal file
41
data/shaders/hlsl/imgui/scene.vert
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
// Copyright 2020 Google LLC
|
||||
|
||||
struct VSInput
|
||||
{
|
||||
[[vk::location(0)]] float3 Pos : POSITION0;
|
||||
[[vk::location(1)]] float3 Normal : NORMAL0;
|
||||
[[vk::location(2)]] float3 Color : COLOR0;
|
||||
};
|
||||
|
||||
struct UBO
|
||||
{
|
||||
float4x4 projection;
|
||||
float4x4 model;
|
||||
float4 lightPos;
|
||||
};
|
||||
|
||||
cbuffer ubo : register(b0) { UBO ubo; }
|
||||
|
||||
struct VSOutput
|
||||
{
|
||||
float4 Pos : SV_POSITION;
|
||||
[[vk::location(0)]] float3 Normal : NORMAL0;
|
||||
[[vk::location(1)]] float3 Color : COLOR0;
|
||||
[[vk::location(2)]] float3 ViewVec : TEXCOORD1;
|
||||
[[vk::location(3)]] float3 LightVec : TEXCOORD2;
|
||||
};
|
||||
|
||||
VSOutput main(VSInput input)
|
||||
{
|
||||
VSOutput output = (VSOutput)0;
|
||||
output.Normal = input.Normal;
|
||||
output.Color = input.Color;
|
||||
output.Pos = mul(ubo.projection, mul(ubo.model, float4(input.Pos.xyz, 1.0)));
|
||||
|
||||
float4 pos = mul(ubo.model, float4(input.Pos, 1.0));
|
||||
output.Normal = mul((float4x3)ubo.model, input.Normal).xyz;
|
||||
float3 lPos = mul((float4x3)ubo.model, ubo.lightPos.xyz).xyz;
|
||||
output.LightVec = lPos - pos.xyz;
|
||||
output.ViewVec = -pos.xyz;
|
||||
return output;
|
||||
}
|
||||
15
data/shaders/hlsl/imgui/ui.frag
Normal file
15
data/shaders/hlsl/imgui/ui.frag
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Google LLC
|
||||
|
||||
Texture2D fontTexture : register(t0);
|
||||
SamplerState fontSampler : register(s0);
|
||||
|
||||
struct VSOutput
|
||||
{
|
||||
[[vk::location(0)]] float2 UV : TEXCOORD0;
|
||||
[[vk::location(1)]] float4 Color : COLOR0;
|
||||
};
|
||||
|
||||
float4 main(VSOutput input) : SV_TARGET
|
||||
{
|
||||
return input.Color * fontTexture.Sample(fontSampler, input.UV);
|
||||
}
|
||||
33
data/shaders/hlsl/imgui/ui.vert
Normal file
33
data/shaders/hlsl/imgui/ui.vert
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
// Copyright 2020 Google LLC
|
||||
|
||||
struct VSInput
|
||||
{
|
||||
[[vk::location(0)]] float2 Pos : POSITION0;
|
||||
[[vk::location(1)]] float2 UV : TEXCOORD0;
|
||||
[[vk::location(2)]] float4 Color : COLOR0;
|
||||
};
|
||||
|
||||
struct PushConstants
|
||||
{
|
||||
float2 scale;
|
||||
float2 translate;
|
||||
};
|
||||
|
||||
[[vk::push_constant]]
|
||||
PushConstants pushConstants;
|
||||
|
||||
struct VSOutput
|
||||
{
|
||||
float4 Pos : SV_POSITION;
|
||||
[[vk::location(0)]] float2 UV : TEXCOORD0;
|
||||
[[vk::location(1)]] float4 Color : COLOR0;
|
||||
};
|
||||
|
||||
VSOutput main(VSInput input)
|
||||
{
|
||||
VSOutput output = (VSOutput)0;
|
||||
output.UV = input.UV;
|
||||
output.Color = input.Color;
|
||||
output.Pos = float4(input.Pos * pushConstants.scale + pushConstants.translate, 0.0, 1.0);
|
||||
return output;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue