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"(
|
nxt::ShaderModule fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
layout(location = 0) in vec4 v_color;
|
layout(location = 0) in vec4 v_color;
|
||||||
void main() {
|
void main() {
|
||||||
fragColor = v_color;
|
fragColor = v_color;
|
||||||
})"
|
})");
|
||||||
);
|
|
||||||
|
|
||||||
renderpass = CreateDefaultRenderPass(device);
|
renderpass = CreateDefaultRenderPass(device);
|
||||||
depthStencilView = CreateDefaultDepthStencilView(device);
|
depthStencilView = CreateDefaultDepthStencilView(device);
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ void init() {
|
|||||||
|
|
||||||
const char* fs =
|
const char* fs =
|
||||||
"#version 450\n"
|
"#version 450\n"
|
||||||
"out vec4 fragColor;"
|
"layout(location = 0) out vec4 fragColor;"
|
||||||
"void main() {\n"
|
"void main() {\n"
|
||||||
" fragColor = vec4(1.0, 0.0, 0.0, 1.0);\n"
|
" fragColor = vec4(1.0, 0.0, 0.0, 1.0);\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ void initRender() {
|
|||||||
|
|
||||||
nxt::ShaderModule fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"(
|
nxt::ShaderModule fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main() {
|
void main() {
|
||||||
fragColor = vec4(1.0);
|
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
|
#version 450
|
||||||
layout(set = 0, binding = 0) uniform myBlock {
|
layout(set = 0, binding = 0) uniform myBlock {
|
||||||
int a;
|
int a;
|
||||||
float b;
|
float b;
|
||||||
} myUbo;
|
} myUbo;
|
||||||
out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main() {
|
void main() {
|
||||||
fragColor = vec4(1.0, myUbo.a / 255.0, myUbo.b, 1.0);
|
fragColor = vec4(1.0, myUbo.a / 255.0, myUbo.b, 1.0);
|
||||||
})"
|
})");
|
||||||
);
|
|
||||||
|
|
||||||
nxt::BindGroupLayout bgl = device.CreateBindGroupLayoutBuilder()
|
nxt::BindGroupLayout bgl = device.CreateBindGroupLayoutBuilder()
|
||||||
.SetBindingsType(nxt::ShaderStageBit::Fragment, nxt::BindingType::UniformBuffer, 0, 1)
|
.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"(
|
nxt::ShaderModule fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 2) in vec3 f_col;
|
layout(location = 2) in vec3 f_col;
|
||||||
out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main() {
|
void main() {
|
||||||
fragColor = vec4(f_col, 1.0);
|
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
|
#version 450
|
||||||
layout(location = 2) in vec3 f_col;
|
layout(location = 2) in vec3 f_col;
|
||||||
out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main() {
|
void main() {
|
||||||
fragColor = vec4(mix(f_col, vec3(0.5, 0.5, 0.5), 0.5), 1.0);
|
fragColor = vec4(mix(f_col, vec3(0.5, 0.5, 0.5), 0.5), 1.0);
|
||||||
})"
|
})");
|
||||||
);
|
|
||||||
|
|
||||||
auto inputState = device.CreateInputStateBuilder()
|
auto inputState = device.CreateInputStateBuilder()
|
||||||
.SetAttribute(0, 0, nxt::VertexFormat::FloatR32G32B32, 0)
|
.SetAttribute(0, 0, nxt::VertexFormat::FloatR32G32B32, 0)
|
||||||
|
|||||||
@@ -64,11 +64,10 @@ void init() {
|
|||||||
|
|
||||||
nxt::ShaderModule fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"(
|
nxt::ShaderModule fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main() {
|
void main() {
|
||||||
fragColor = vec4(1.0, 0.0, 0.0, 1.0);
|
fragColor = vec4(1.0, 0.0, 0.0, 1.0);
|
||||||
})"
|
})");
|
||||||
);
|
|
||||||
|
|
||||||
auto inputState = device.CreateInputStateBuilder()
|
auto inputState = device.CreateInputStateBuilder()
|
||||||
.SetAttribute(0, 0, nxt::VertexFormat::FloatR32G32B32A32, 0)
|
.SetAttribute(0, 0, nxt::VertexFormat::FloatR32G32B32A32, 0)
|
||||||
|
|||||||
@@ -68,11 +68,10 @@ void init() {
|
|||||||
|
|
||||||
nxt::ShaderModule fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"(
|
nxt::ShaderModule fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main() {
|
void main() {
|
||||||
fragColor = vec4(1.0, 0.0, 0.0, 1.0);
|
fragColor = vec4(1.0, 0.0, 0.0, 1.0);
|
||||||
})"
|
})");
|
||||||
);
|
|
||||||
|
|
||||||
auto inputState = device.CreateInputStateBuilder()
|
auto inputState = device.CreateInputStateBuilder()
|
||||||
.SetAttribute(0, 0, nxt::VertexFormat::FloatR32G32B32A32, 0)
|
.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 = 0) uniform sampler mySampler;
|
||||||
layout(set = 0, binding = 1) uniform texture2D myTexture;
|
layout(set = 0, binding = 1) uniform texture2D myTexture;
|
||||||
|
|
||||||
out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main() {
|
void main() {
|
||||||
fragColor = texture(sampler2D(myTexture, mySampler), gl_FragCoord.xy / vec2(640.0, 480.0));
|
fragColor = texture(sampler2D(myTexture, mySampler), gl_FragCoord.xy / vec2(640.0, 480.0));
|
||||||
})"
|
})");
|
||||||
);
|
|
||||||
|
|
||||||
auto inputState = device.CreateInputStateBuilder()
|
auto inputState = device.CreateInputStateBuilder()
|
||||||
.SetAttribute(0, 0, nxt::VertexFormat::FloatR32G32B32A32, 0)
|
.SetAttribute(0, 0, nxt::VertexFormat::FloatR32G32B32A32, 0)
|
||||||
|
|||||||
@@ -50,11 +50,10 @@ void init() {
|
|||||||
int a;
|
int a;
|
||||||
float b;
|
float b;
|
||||||
} myUbo;
|
} myUbo;
|
||||||
out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main() {
|
void main() {
|
||||||
fragColor = vec4(1.0, myUbo.a / 255.0, myUbo.b, 1.0);
|
fragColor = vec4(1.0, myUbo.a / 255.0, myUbo.b, 1.0);
|
||||||
})"
|
})");
|
||||||
);
|
|
||||||
|
|
||||||
nxt::BindGroupLayout bgl = device.CreateBindGroupLayoutBuilder()
|
nxt::BindGroupLayout bgl = device.CreateBindGroupLayoutBuilder()
|
||||||
.SetBindingsType(nxt::ShaderStageBit::Fragment, nxt::BindingType::UniformBuffer, 0, 1)
|
.SetBindingsType(nxt::ShaderStageBit::Fragment, nxt::BindingType::UniformBuffer, 0, 1)
|
||||||
|
|||||||
@@ -180,11 +180,10 @@ class PrimitiveTopologyTest : public NXTTest {
|
|||||||
|
|
||||||
fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"(
|
fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main() {
|
void main() {
|
||||||
fragColor = vec4(0.0, 1.0, 0.0, 1.0);
|
fragColor = vec4(0.0, 1.0, 0.0, 1.0);
|
||||||
})"
|
})");
|
||||||
);
|
|
||||||
|
|
||||||
inputState = device.CreateInputStateBuilder()
|
inputState = device.CreateInputStateBuilder()
|
||||||
.SetAttribute(0, 0, nxt::VertexFormat::FloatR32G32B32A32, 0)
|
.SetAttribute(0, 0, nxt::VertexFormat::FloatR32G32B32A32, 0)
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ class RenderPassLoadOpTests : public NXTTest {
|
|||||||
)";
|
)";
|
||||||
const char* fsSource = R"(
|
const char* fsSource = R"(
|
||||||
#version 450
|
#version 450
|
||||||
out vec4 color;
|
layout(location = 0) out vec4 color;
|
||||||
void main() {
|
void main() {
|
||||||
color = vec4(0.f, 0.f, 1.f, 1.f);
|
color = vec4(0.f, 0.f, 1.f, 1.f);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class InputStateTest : public ValidationTest {
|
|||||||
nxt::ShaderModuleBuilder fsModuleBuilder = AssertWillBeSuccess(device.CreateShaderModuleBuilder());
|
nxt::ShaderModuleBuilder fsModuleBuilder = AssertWillBeSuccess(device.CreateShaderModuleBuilder());
|
||||||
utils::FillShaderModuleBuilder(fsModuleBuilder, nxt::ShaderStage::Fragment, R"(
|
utils::FillShaderModuleBuilder(fsModuleBuilder, nxt::ShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main() {
|
void main() {
|
||||||
fragColor = vec4(1.0, 0.0, 0.0, 1.0);
|
fragColor = vec4(1.0, 0.0, 0.0, 1.0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,11 +38,10 @@ class RenderPipelineValidationTest : public ValidationTest {
|
|||||||
|
|
||||||
fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"(
|
fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main() {
|
void main() {
|
||||||
fragColor = vec4(0.0, 1.0, 0.0, 1.0);
|
fragColor = vec4(0.0, 1.0, 0.0, 1.0);
|
||||||
})"
|
})");
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nxt::RenderPipelineBuilder& AddDefaultStates(nxt::RenderPipelineBuilder&& builder) {
|
nxt::RenderPipelineBuilder& AddDefaultStates(nxt::RenderPipelineBuilder&& builder) {
|
||||||
|
|||||||
@@ -25,11 +25,10 @@ class VertexBufferValidationTest : public ValidationTest {
|
|||||||
|
|
||||||
fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"(
|
fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main() {
|
void main() {
|
||||||
fragColor = vec4(0.0, 1.0, 0.0, 1.0);
|
fragColor = vec4(0.0, 1.0, 0.0, 1.0);
|
||||||
})"
|
})");
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MakeRenderPassAndFrameBuffer(uint32_t subpassCount) {
|
void MakeRenderPassAndFrameBuffer(uint32_t subpassCount) {
|
||||||
|
|||||||
2
third_party/glslang
vendored
2
third_party/glslang
vendored
Submodule third_party/glslang updated: f00c245a5f...b5b0846244
2
third_party/shaderc
vendored
2
third_party/shaderc
vendored
Submodule third_party/shaderc updated: 01921d49da...c60725343f
2
third_party/spirv-headers
vendored
2
third_party/spirv-headers
vendored
Submodule third_party/spirv-headers updated: 661ad91124...0610978784
2
third_party/spirv-tools
vendored
2
third_party/spirv-tools
vendored
Submodule third_party/spirv-tools updated: 06d4fd52c2...90862fe4b1
Reference in New Issue
Block a user