Roll shaderc

This commit is contained in:
Corentin Wallez 2017-08-29 13:37:45 -04:00 committed by Corentin Wallez
parent ae7f113fe8
commit b6fb5f3149
18 changed files with 34 additions and 43 deletions

View File

@ -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);

View File

@ -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";

View File

@ -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);
}

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -180,11 +180,10 @@ class PrimitiveTopologyTest : public NXTTest {
fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"(
#version 450
out vec4 fragColor;
layout(location = 0) out vec4 fragColor;
void main() {
fragColor = vec4(0.0, 1.0, 0.0, 1.0);
})"
);
})");
inputState = device.CreateInputStateBuilder()
.SetAttribute(0, 0, nxt::VertexFormat::FloatR32G32B32A32, 0)

View File

@ -88,7 +88,7 @@ class RenderPassLoadOpTests : public NXTTest {
)";
const char* fsSource = R"(
#version 450
out vec4 color;
layout(location = 0) out vec4 color;
void main() {
color = vec4(0.f, 0.f, 1.f, 1.f);
}

View File

@ -32,7 +32,7 @@ class InputStateTest : public ValidationTest {
nxt::ShaderModuleBuilder fsModuleBuilder = AssertWillBeSuccess(device.CreateShaderModuleBuilder());
utils::FillShaderModuleBuilder(fsModuleBuilder, 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);
}

View File

@ -38,11 +38,10 @@ class RenderPipelineValidationTest : public ValidationTest {
fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"(
#version 450
out vec4 fragColor;
layout(location = 0) out vec4 fragColor;
void main() {
fragColor = vec4(0.0, 1.0, 0.0, 1.0);
})"
);
})");
}
nxt::RenderPipelineBuilder& AddDefaultStates(nxt::RenderPipelineBuilder&& builder) {

View File

@ -25,11 +25,10 @@ class VertexBufferValidationTest : public ValidationTest {
fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"(
#version 450
out vec4 fragColor;
layout(location = 0) out vec4 fragColor;
void main() {
fragColor = vec4(0.0, 1.0, 0.0, 1.0);
})"
);
})");
}
void MakeRenderPassAndFrameBuffer(uint32_t subpassCount) {

2
third_party/glslang vendored

@ -1 +1 @@
Subproject commit f00c245a5f697cde2257e1280969429314a84958
Subproject commit b5b08462442239e6537315ea1405b6afcd53043e

2
third_party/shaderc vendored

@ -1 +1 @@
Subproject commit 01921d49da5d4d4311f3e2bd1ae2a27834974ab6
Subproject commit c60725343fd6c0822bb7f580661d2ec6460391c0

@ -1 +1 @@
Subproject commit 661ad91124e6af2272afd00f804d8aa276e17107
Subproject commit 061097878467b8e040fbf153a837d844ef9f9f96

@ -1 +1 @@
Subproject commit 06d4fd52c244ee5abf6819f721b9f68e5a3fcdb0
Subproject commit 90862fe4b1c6763b32ce683d2d32c2f281f577cf