mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 13:38:00 +00:00
Roll shaderc
This commit is contained in:
committed by
Corentin Wallez
parent
ae7f113fe8
commit
b6fb5f3149
@@ -102,12 +102,11 @@ void init() {
|
||||
|
||||
nxt::ShaderModule fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"(
|
||||
#version 450
|
||||
out vec4 fragColor;
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
layout(location = 0) in vec4 v_color;
|
||||
void main() {
|
||||
fragColor = v_color;
|
||||
})"
|
||||
);
|
||||
})");
|
||||
|
||||
renderpass = CreateDefaultRenderPass(device);
|
||||
depthStencilView = CreateDefaultDepthStencilView(device);
|
||||
|
||||
@@ -52,7 +52,7 @@ void init() {
|
||||
|
||||
const char* fs =
|
||||
"#version 450\n"
|
||||
"out vec4 fragColor;"
|
||||
"layout(location = 0) out vec4 fragColor;"
|
||||
"void main() {\n"
|
||||
" fragColor = vec4(1.0, 0.0, 0.0, 1.0);\n"
|
||||
"}\n";
|
||||
|
||||
@@ -109,7 +109,7 @@ void initRender() {
|
||||
|
||||
nxt::ShaderModule fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"(
|
||||
#version 450
|
||||
out vec4 fragColor;
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
void main() {
|
||||
fragColor = vec4(1.0);
|
||||
}
|
||||
|
||||
@@ -93,17 +93,17 @@ void init() {
|
||||
})"
|
||||
);
|
||||
|
||||
nxt::ShaderModule fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"(
|
||||
nxt::ShaderModule fsModule =
|
||||
utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"(
|
||||
#version 450
|
||||
layout(set = 0, binding = 0) uniform myBlock {
|
||||
int a;
|
||||
float b;
|
||||
} myUbo;
|
||||
out vec4 fragColor;
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
void main() {
|
||||
fragColor = vec4(1.0, myUbo.a / 255.0, myUbo.b, 1.0);
|
||||
})"
|
||||
);
|
||||
})");
|
||||
|
||||
nxt::BindGroupLayout bgl = device.CreateBindGroupLayoutBuilder()
|
||||
.SetBindingsType(nxt::ShaderStageBit::Fragment, nxt::BindingType::UniformBuffer, 0, 1)
|
||||
|
||||
@@ -142,20 +142,19 @@ void init() {
|
||||
nxt::ShaderModule fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"(
|
||||
#version 450
|
||||
layout(location = 2) in vec3 f_col;
|
||||
out vec4 fragColor;
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
void main() {
|
||||
fragColor = vec4(f_col, 1.0);
|
||||
})"
|
||||
);
|
||||
})");
|
||||
|
||||
nxt::ShaderModule fsReflectionModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"(
|
||||
nxt::ShaderModule fsReflectionModule =
|
||||
utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"(
|
||||
#version 450
|
||||
layout(location = 2) in vec3 f_col;
|
||||
out vec4 fragColor;
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
void main() {
|
||||
fragColor = vec4(mix(f_col, vec3(0.5, 0.5, 0.5), 0.5), 1.0);
|
||||
})"
|
||||
);
|
||||
})");
|
||||
|
||||
auto inputState = device.CreateInputStateBuilder()
|
||||
.SetAttribute(0, 0, nxt::VertexFormat::FloatR32G32B32, 0)
|
||||
|
||||
@@ -64,11 +64,10 @@ void init() {
|
||||
|
||||
nxt::ShaderModule fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"(
|
||||
#version 450
|
||||
out vec4 fragColor;
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
void main() {
|
||||
fragColor = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
})"
|
||||
);
|
||||
})");
|
||||
|
||||
auto inputState = device.CreateInputStateBuilder()
|
||||
.SetAttribute(0, 0, nxt::VertexFormat::FloatR32G32B32A32, 0)
|
||||
|
||||
@@ -68,11 +68,10 @@ void init() {
|
||||
|
||||
nxt::ShaderModule fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"(
|
||||
#version 450
|
||||
out vec4 fragColor;
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
void main() {
|
||||
fragColor = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
})"
|
||||
);
|
||||
})");
|
||||
|
||||
auto inputState = device.CreateInputStateBuilder()
|
||||
.SetAttribute(0, 0, nxt::VertexFormat::FloatR32G32B32A32, 0)
|
||||
|
||||
@@ -102,11 +102,10 @@ void init() {
|
||||
layout(set = 0, binding = 0) uniform sampler mySampler;
|
||||
layout(set = 0, binding = 1) uniform texture2D myTexture;
|
||||
|
||||
out vec4 fragColor;
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
void main() {
|
||||
fragColor = texture(sampler2D(myTexture, mySampler), gl_FragCoord.xy / vec2(640.0, 480.0));
|
||||
})"
|
||||
);
|
||||
})");
|
||||
|
||||
auto inputState = device.CreateInputStateBuilder()
|
||||
.SetAttribute(0, 0, nxt::VertexFormat::FloatR32G32B32A32, 0)
|
||||
|
||||
@@ -50,11 +50,10 @@ void init() {
|
||||
int a;
|
||||
float b;
|
||||
} myUbo;
|
||||
out vec4 fragColor;
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
void main() {
|
||||
fragColor = vec4(1.0, myUbo.a / 255.0, myUbo.b, 1.0);
|
||||
})"
|
||||
);
|
||||
})");
|
||||
|
||||
nxt::BindGroupLayout bgl = device.CreateBindGroupLayoutBuilder()
|
||||
.SetBindingsType(nxt::ShaderStageBit::Fragment, nxt::BindingType::UniformBuffer, 0, 1)
|
||||
|
||||
Reference in New Issue
Block a user