Update more Dawn tests to use WGSL
Bug: dawn:572 Change-Id: I0f567da883005d909d498a7a88e9b73137201919 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41820 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
a5ba2827f5
commit
0b17eb8e19
|
@ -162,14 +162,13 @@ class BufferZeroInitTest : public DawnTest {
|
||||||
expectedValues.size()));
|
expectedValues.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestBufferZeroInitInBindGroup(const char* computeShader,
|
void TestBufferZeroInitInBindGroup(wgpu::ShaderModule module,
|
||||||
uint64_t bufferOffset,
|
uint64_t bufferOffset,
|
||||||
uint64_t boundBufferSize,
|
uint64_t boundBufferSize,
|
||||||
const std::vector<uint32_t>& expectedBufferData) {
|
const std::vector<uint32_t>& expectedBufferData) {
|
||||||
wgpu::ComputePipelineDescriptor pipelineDescriptor;
|
wgpu::ComputePipelineDescriptor pipelineDescriptor;
|
||||||
pipelineDescriptor.layout = nullptr;
|
pipelineDescriptor.layout = nullptr;
|
||||||
pipelineDescriptor.computeStage.module =
|
pipelineDescriptor.computeStage.module = module;
|
||||||
utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, computeShader);
|
|
||||||
pipelineDescriptor.computeStage.entryPoint = "main";
|
pipelineDescriptor.computeStage.entryPoint = "main";
|
||||||
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDescriptor);
|
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDescriptor);
|
||||||
|
|
||||||
|
@ -201,6 +200,15 @@ class BufferZeroInitTest : public DawnTest {
|
||||||
EXPECT_PIXEL_RGBA8_EQ(kExpectedColor, outputTexture, 0u, 0u);
|
EXPECT_PIXEL_RGBA8_EQ(kExpectedColor, outputTexture, 0u, 0u);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestBufferZeroInitInBindGroup(const char* glslComputeShader,
|
||||||
|
uint64_t bufferOffset,
|
||||||
|
uint64_t boundBufferSize,
|
||||||
|
const std::vector<uint32_t>& expectedBufferData) {
|
||||||
|
return TestBufferZeroInitInBindGroup(
|
||||||
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, glslComputeShader),
|
||||||
|
bufferOffset, boundBufferSize, expectedBufferData);
|
||||||
|
}
|
||||||
|
|
||||||
wgpu::RenderPipeline CreateRenderPipelineForTest(const char* vertexShader,
|
wgpu::RenderPipeline CreateRenderPipelineForTest(const char* vertexShader,
|
||||||
uint32_t vertexBufferCount = 1u) {
|
uint32_t vertexBufferCount = 1u) {
|
||||||
constexpr wgpu::TextureFormat kColorAttachmentFormat = wgpu::TextureFormat::RGBA8Unorm;
|
constexpr wgpu::TextureFormat kColorAttachmentFormat = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
|
@ -417,16 +425,16 @@ class BufferZeroInitTest : public DawnTest {
|
||||||
// As long as the comptue shader is executed once, the pixel color of outImage will be set
|
// As long as the comptue shader is executed once, the pixel color of outImage will be set
|
||||||
// to red.
|
// to red.
|
||||||
const char* computeShader = R"(
|
const char* computeShader = R"(
|
||||||
#version 450
|
[[group(0), binding(0)]] var outImage : [[access(write)]] texture_storage_2d<rgba8unorm>;
|
||||||
layout(set = 0, binding = 0, rgba8) uniform writeonly image2D outImage;
|
|
||||||
void main() {
|
[[stage(compute)]] fn main() -> void {
|
||||||
imageStore(outImage, ivec2(0, 0), vec4(1.f, 0.f, 0.f, 1.f));
|
textureStore(outImage, vec2<i32>(0, 0), vec4<f32>(1.0, 0.0, 0.0, 1.0));
|
||||||
})";
|
})";
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor pipelineDescriptor;
|
wgpu::ComputePipelineDescriptor pipelineDescriptor;
|
||||||
pipelineDescriptor.layout = nullptr;
|
pipelineDescriptor.layout = nullptr;
|
||||||
pipelineDescriptor.computeStage.module =
|
pipelineDescriptor.computeStage.module =
|
||||||
utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, computeShader);
|
utils::CreateShaderModuleFromWGSL(device, computeShader);
|
||||||
pipelineDescriptor.computeStage.entryPoint = "main";
|
pipelineDescriptor.computeStage.entryPoint = "main";
|
||||||
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDescriptor);
|
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDescriptor);
|
||||||
|
|
||||||
|
@ -984,26 +992,29 @@ TEST_P(BufferZeroInitTest, BoundAsUniformBuffer) {
|
||||||
DAWN_SKIP_TEST_IF(IsOpenGLES() && IsBackendValidationEnabled());
|
DAWN_SKIP_TEST_IF(IsOpenGLES() && IsBackendValidationEnabled());
|
||||||
|
|
||||||
const char* computeShader = R"(
|
const char* computeShader = R"(
|
||||||
#version 450
|
[[block]] struct UBO {
|
||||||
layout(set = 0, binding = 0, std140) uniform UBO {
|
[[offset(0)]] value : vec4<u32>;
|
||||||
uvec4 value;
|
};
|
||||||
} ubo;
|
[[group(0), binding(0)]] var<uniform> ubo : UBO;
|
||||||
layout(set = 0, binding = 1, rgba8) uniform writeonly image2D outImage;
|
[[group(0), binding(1)]] var outImage : [[access(write)]] texture_storage_2d<rgba8unorm>;
|
||||||
void main() {
|
|
||||||
if (ubo.value == uvec4(0, 0, 0, 0)) {
|
[[stage(compute)]] fn main() -> void {
|
||||||
imageStore(outImage, ivec2(0, 0), vec4(0.f, 1.f, 0.f, 1.f));
|
if (all(ubo.value == vec4<u32>(0, 0, 0, 0))) {
|
||||||
|
textureStore(outImage, vec2<i32>(0, 0), vec4<f32>(0.0, 1.0, 0.0, 1.0));
|
||||||
} else {
|
} else {
|
||||||
imageStore(outImage, ivec2(0, 0), vec4(1.f, 0.f, 0.f, 1.f));
|
textureStore(outImage, vec2<i32>(0, 0), vec4<f32>(1.0, 0.0, 0.0, 1.0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
|
|
||||||
constexpr uint32_t kBoundBufferSize = 16u;
|
constexpr uint32_t kBoundBufferSize = 16u;
|
||||||
|
|
||||||
|
wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, computeShader);
|
||||||
|
|
||||||
// Bind the whole buffer
|
// Bind the whole buffer
|
||||||
{
|
{
|
||||||
const std::vector<uint32_t> expected(kBoundBufferSize / sizeof(uint32_t), 0u);
|
const std::vector<uint32_t> expected(kBoundBufferSize / sizeof(uint32_t), 0u);
|
||||||
TestBufferZeroInitInBindGroup(computeShader, 0, kBoundBufferSize, expected);
|
TestBufferZeroInitInBindGroup(module, 0, kBoundBufferSize, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bind a range of a buffer
|
// Bind a range of a buffer
|
||||||
|
@ -1012,7 +1023,7 @@ TEST_P(BufferZeroInitTest, BoundAsUniformBuffer) {
|
||||||
constexpr uint32_t kExtraBytes = 16u;
|
constexpr uint32_t kExtraBytes = 16u;
|
||||||
const std::vector<uint32_t> expected(
|
const std::vector<uint32_t> expected(
|
||||||
(kBoundBufferSize + kOffset + kExtraBytes) / sizeof(uint32_t), 0u);
|
(kBoundBufferSize + kOffset + kExtraBytes) / sizeof(uint32_t), 0u);
|
||||||
TestBufferZeroInitInBindGroup(computeShader, kOffset, kBoundBufferSize, expected);
|
TestBufferZeroInitInBindGroup(module, kOffset, kBoundBufferSize, expected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1023,26 +1034,28 @@ TEST_P(BufferZeroInitTest, BoundAsReadonlyStorageBuffer) {
|
||||||
DAWN_SKIP_TEST_IF(IsOpenGLES() && IsBackendValidationEnabled());
|
DAWN_SKIP_TEST_IF(IsOpenGLES() && IsBackendValidationEnabled());
|
||||||
|
|
||||||
const char* computeShader = R"(
|
const char* computeShader = R"(
|
||||||
#version 450
|
[[block]] struct SSBO {
|
||||||
layout(set = 0, binding = 0, std140) readonly buffer SSBO {
|
[[offset(0)]] value : vec4<u32>;
|
||||||
uvec4 value;
|
};
|
||||||
} ssbo;
|
[[group(0), binding(0)]] var<storage> ssbo : SSBO;
|
||||||
layout(set = 0, binding = 1, rgba8) uniform writeonly image2D outImage;
|
[[group(0), binding(1)]] var outImage : [[access(write)]] texture_storage_2d<rgba8unorm>;
|
||||||
void main() {
|
|
||||||
if (ssbo.value == uvec4(0, 0, 0, 0)) {
|
[[stage(compute)]] fn main() -> void {
|
||||||
imageStore(outImage, ivec2(0, 0), vec4(0.f, 1.f, 0.f, 1.f));
|
if (all(ssbo.value == vec4<u32>(0, 0, 0, 0))) {
|
||||||
|
textureStore(outImage, vec2<i32>(0, 0), vec4<f32>(0.0, 1.0, 0.0, 1.0));
|
||||||
} else {
|
} else {
|
||||||
imageStore(outImage, ivec2(0, 0), vec4(1.f, 0.f, 0.f, 1.f));
|
textureStore(outImage, vec2<i32>(0, 0), vec4<f32>(1.0, 0.0, 0.0, 1.0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
|
|
||||||
constexpr uint32_t kBoundBufferSize = 16u;
|
constexpr uint32_t kBoundBufferSize = 16u;
|
||||||
|
wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, computeShader);
|
||||||
|
|
||||||
// Bind the whole buffer
|
// Bind the whole buffer
|
||||||
{
|
{
|
||||||
const std::vector<uint32_t> expected(kBoundBufferSize / sizeof(uint32_t), 0u);
|
const std::vector<uint32_t> expected(kBoundBufferSize / sizeof(uint32_t), 0u);
|
||||||
TestBufferZeroInitInBindGroup(computeShader, 0, kBoundBufferSize, expected);
|
TestBufferZeroInitInBindGroup(module, 0, kBoundBufferSize, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bind a range of a buffer
|
// Bind a range of a buffer
|
||||||
|
@ -1051,7 +1064,7 @@ TEST_P(BufferZeroInitTest, BoundAsReadonlyStorageBuffer) {
|
||||||
constexpr uint32_t kExtraBytes = 16u;
|
constexpr uint32_t kExtraBytes = 16u;
|
||||||
const std::vector<uint32_t> expected(
|
const std::vector<uint32_t> expected(
|
||||||
(kBoundBufferSize + kOffset + kExtraBytes) / sizeof(uint32_t), 0u);
|
(kBoundBufferSize + kOffset + kExtraBytes) / sizeof(uint32_t), 0u);
|
||||||
TestBufferZeroInitInBindGroup(computeShader, kOffset, kBoundBufferSize, expected);
|
TestBufferZeroInitInBindGroup(module, kOffset, kBoundBufferSize, expected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,14 +68,13 @@ class TextureZeroInitTest : public DawnTest {
|
||||||
wgpu::RenderPipeline CreatePipelineForTest(float depth = 0.f) {
|
wgpu::RenderPipeline CreatePipelineForTest(float depth = 0.f) {
|
||||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||||
pipelineDescriptor.vertexStage.module = CreateBasicVertexShaderForTest(depth);
|
pipelineDescriptor.vertexStage.module = CreateBasicVertexShaderForTest(depth);
|
||||||
const char* fs =
|
const char* fs = R"(
|
||||||
R"(#version 450
|
[[location(0)]] var<out> fragColor : vec4<f32>;
|
||||||
layout(location = 0) out vec4 fragColor;
|
[[stage(fragment)]] fn main() -> void {
|
||||||
void main() {
|
fragColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||||
fragColor = vec4(1.0, 0.0, 0.0, 1.0);
|
}
|
||||||
})";
|
)";
|
||||||
pipelineDescriptor.cFragmentStage.module =
|
pipelineDescriptor.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, fs);
|
||||||
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fs);
|
|
||||||
|
|
||||||
pipelineDescriptor.cDepthStencilState.depthCompare = wgpu::CompareFunction::Equal;
|
pipelineDescriptor.cDepthStencilState.depthCompare = wgpu::CompareFunction::Equal;
|
||||||
pipelineDescriptor.cDepthStencilState.stencilFront.compare = wgpu::CompareFunction::Equal;
|
pipelineDescriptor.cDepthStencilState.stencilFront.compare = wgpu::CompareFunction::Equal;
|
||||||
|
@ -84,30 +83,34 @@ class TextureZeroInitTest : public DawnTest {
|
||||||
return device.CreateRenderPipeline(&pipelineDescriptor);
|
return device.CreateRenderPipeline(&pipelineDescriptor);
|
||||||
}
|
}
|
||||||
wgpu::ShaderModule CreateBasicVertexShaderForTest(float depth = 0.f) {
|
wgpu::ShaderModule CreateBasicVertexShaderForTest(float depth = 0.f) {
|
||||||
std::string source = R"(#version 450
|
std::string source = R"(
|
||||||
const vec2 pos[6] = vec2[6](vec2(-1.0f, -1.0f),
|
const pos : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
|
||||||
vec2(-1.0f, 1.0f),
|
vec2<f32>(-1.0, -1.0),
|
||||||
vec2( 1.0f, -1.0f),
|
vec2<f32>(-1.0, 1.0),
|
||||||
vec2( 1.0f, 1.0f),
|
vec2<f32>( 1.0, -1.0),
|
||||||
vec2(-1.0f, 1.0f),
|
vec2<f32>( 1.0, 1.0),
|
||||||
vec2( 1.0f, -1.0f)
|
vec2<f32>(-1.0, 1.0),
|
||||||
|
vec2<f32>( 1.0, -1.0)
|
||||||
);
|
);
|
||||||
|
|
||||||
void main() {
|
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
|
||||||
gl_Position = vec4(pos[gl_VertexIndex], )" +
|
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||||
|
|
||||||
|
[[stage(vertex)]] fn main() -> void {
|
||||||
|
Position = vec4<f32>(pos[VertexIndex], )" +
|
||||||
std::to_string(depth) + R"(, 1.0);
|
std::to_string(depth) + R"(, 1.0);
|
||||||
})";
|
})";
|
||||||
return utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, source.c_str());
|
return utils::CreateShaderModuleFromWGSL(device, source.c_str());
|
||||||
}
|
}
|
||||||
wgpu::ShaderModule CreateSampledTextureFragmentShaderForTest() {
|
wgpu::ShaderModule CreateSampledTextureFragmentShaderForTest() {
|
||||||
return utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment,
|
return utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
R"(#version 450
|
[[group(0), binding(0)]] var texture0 : texture_2d<f32>;
|
||||||
layout(set = 0, binding = 0) uniform sampler sampler0;
|
[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;
|
||||||
layout(set = 0, binding = 1) uniform texture2D texture0;
|
[[location(0)]] var<out> fragColor : vec4<f32>;
|
||||||
layout(location = 0) out vec4 fragColor;
|
[[stage(fragment)]] fn main() -> void {
|
||||||
void main() {
|
fragColor = textureLoad(texture0, vec2<i32>(FragCoord.xy), 0);
|
||||||
fragColor = texelFetch(sampler2D(texture0, sampler0), ivec2(gl_FragCoord), 0);
|
}
|
||||||
})");
|
)");
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr static uint32_t kSize = 128;
|
constexpr static uint32_t kSize = 128;
|
||||||
|
@ -853,8 +856,6 @@ TEST_P(TextureZeroInitTest, RenderPassSampledTextureClear) {
|
||||||
1, 1, wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment, kColorFormat);
|
1, 1, wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment, kColorFormat);
|
||||||
wgpu::Texture renderTexture = device.CreateTexture(&renderTextureDescriptor);
|
wgpu::Texture renderTexture = device.CreateTexture(&renderTextureDescriptor);
|
||||||
|
|
||||||
wgpu::Sampler sampler = device.CreateSampler();
|
|
||||||
|
|
||||||
// Create render pipeline
|
// Create render pipeline
|
||||||
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor(device);
|
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor(device);
|
||||||
renderPipelineDescriptor.cColorStates[0].format = kColorFormat;
|
renderPipelineDescriptor.cColorStates[0].format = kColorFormat;
|
||||||
|
@ -864,7 +865,7 @@ TEST_P(TextureZeroInitTest, RenderPassSampledTextureClear) {
|
||||||
|
|
||||||
// Create bindgroup
|
// Create bindgroup
|
||||||
wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, renderPipeline.GetBindGroupLayout(0),
|
wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, renderPipeline.GetBindGroupLayout(0),
|
||||||
{{0, sampler}, {1, texture.CreateView()}});
|
{{0, texture.CreateView()}});
|
||||||
|
|
||||||
// Encode pass and submit
|
// Encode pass and submit
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
|
@ -921,11 +922,8 @@ TEST_P(TextureZeroInitTest, TextureBothSampledAndAttachmentClear) {
|
||||||
renderPipelineDescriptor.cFragmentStage.module = CreateSampledTextureFragmentShaderForTest();
|
renderPipelineDescriptor.cFragmentStage.module = CreateSampledTextureFragmentShaderForTest();
|
||||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
|
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
|
||||||
|
|
||||||
// Create bindgroup
|
wgpu::BindGroup bindGroup =
|
||||||
wgpu::Sampler sampler = device.CreateSampler();
|
utils::MakeBindGroup(device, renderPipeline.GetBindGroupLayout(0), {{0, sampleView}});
|
||||||
|
|
||||||
wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, renderPipeline.GetBindGroupLayout(0),
|
|
||||||
{{0, sampler}, {1, sampleView}});
|
|
||||||
|
|
||||||
// Encode pass and submit
|
// Encode pass and submit
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
|
@ -975,27 +973,25 @@ TEST_P(TextureZeroInitTest, ComputePassSampledTextureClear) {
|
||||||
// Create compute pipeline
|
// Create compute pipeline
|
||||||
wgpu::ComputePipelineDescriptor computePipelineDescriptor;
|
wgpu::ComputePipelineDescriptor computePipelineDescriptor;
|
||||||
wgpu::ProgrammableStageDescriptor computeStage;
|
wgpu::ProgrammableStageDescriptor computeStage;
|
||||||
const char* cs =
|
const char* cs = R"(
|
||||||
R"(#version 450
|
[[group(0), binding(0)]] var tex : texture_2d<f32>;
|
||||||
layout(binding = 0) uniform texture2D sampleTex;
|
[[block]] struct Result {
|
||||||
layout(std430, binding = 1) buffer BufferTex {
|
[[offset(0)]] value : vec4<f32>;
|
||||||
vec4 result;
|
};
|
||||||
} bufferTex;
|
[[group(0), binding(1)]] var<storage> result : Result;
|
||||||
layout(binding = 2) uniform sampler sampler0;
|
[[stage(compute)]] fn main() -> void {
|
||||||
void main() {
|
result.value = textureLoad(tex, vec2<i32>(0,0), 0);
|
||||||
bufferTex.result =
|
}
|
||||||
texelFetch(sampler2D(sampleTex, sampler0), ivec2(0,0), 0);
|
)";
|
||||||
})";
|
computePipelineDescriptor.computeStage.module = utils::CreateShaderModuleFromWGSL(device, cs);
|
||||||
computePipelineDescriptor.computeStage.module =
|
|
||||||
utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, cs);
|
|
||||||
computePipelineDescriptor.computeStage.entryPoint = "main";
|
computePipelineDescriptor.computeStage.entryPoint = "main";
|
||||||
wgpu::ComputePipeline computePipeline =
|
wgpu::ComputePipeline computePipeline =
|
||||||
device.CreateComputePipeline(&computePipelineDescriptor);
|
device.CreateComputePipeline(&computePipelineDescriptor);
|
||||||
|
|
||||||
// Create bindgroup
|
// Create bindgroup
|
||||||
wgpu::BindGroup bindGroup = utils::MakeBindGroup(
|
wgpu::BindGroup bindGroup =
|
||||||
device, computePipeline.GetBindGroupLayout(0),
|
utils::MakeBindGroup(device, computePipeline.GetBindGroupLayout(0),
|
||||||
{{0, texture.CreateView()}, {1, bufferTex, 0, bufferSize}, {2, sampler}});
|
{{0, texture.CreateView()}, {1, bufferTex, 0, bufferSize}});
|
||||||
|
|
||||||
// Encode the pass and submit
|
// Encode the pass and submit
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
|
@ -1131,8 +1127,6 @@ TEST_P(TextureZeroInitTest, RenderPassStoreOpClear) {
|
||||||
1, 1, wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment, kColorFormat);
|
1, 1, wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment, kColorFormat);
|
||||||
wgpu::Texture renderTexture = device.CreateTexture(&renderTextureDescriptor);
|
wgpu::Texture renderTexture = device.CreateTexture(&renderTextureDescriptor);
|
||||||
|
|
||||||
wgpu::Sampler sampler = device.CreateSampler();
|
|
||||||
|
|
||||||
// Fill the sample texture with data
|
// Fill the sample texture with data
|
||||||
std::vector<uint8_t> data(kFormatBlockByteSize * kSize * kSize, 1);
|
std::vector<uint8_t> data(kFormatBlockByteSize * kSize * kSize, 1);
|
||||||
wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(
|
wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(
|
||||||
|
@ -1156,7 +1150,7 @@ TEST_P(TextureZeroInitTest, RenderPassStoreOpClear) {
|
||||||
|
|
||||||
// Create bindgroup
|
// Create bindgroup
|
||||||
wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, renderPipeline.GetBindGroupLayout(0),
|
wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, renderPipeline.GetBindGroupLayout(0),
|
||||||
{{0, sampler}, {1, texture.CreateView()}});
|
{{0, texture.CreateView()}});
|
||||||
|
|
||||||
// Encode pass and submit
|
// Encode pass and submit
|
||||||
encoder = device.CreateCommandEncoder();
|
encoder = device.CreateCommandEncoder();
|
||||||
|
@ -1273,8 +1267,6 @@ TEST_P(TextureZeroInitTest, PreservesInitializedMip) {
|
||||||
kColorFormat);
|
kColorFormat);
|
||||||
wgpu::Texture sampleTexture = device.CreateTexture(&sampleTextureDescriptor);
|
wgpu::Texture sampleTexture = device.CreateTexture(&sampleTextureDescriptor);
|
||||||
|
|
||||||
wgpu::Sampler sampler = device.CreateSampler();
|
|
||||||
|
|
||||||
wgpu::TextureDescriptor renderTextureDescriptor = CreateTextureDescriptor(
|
wgpu::TextureDescriptor renderTextureDescriptor = CreateTextureDescriptor(
|
||||||
1, 1, wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment, kColorFormat);
|
1, 1, wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment, kColorFormat);
|
||||||
wgpu::Texture renderTexture = device.CreateTexture(&renderTextureDescriptor);
|
wgpu::Texture renderTexture = device.CreateTexture(&renderTextureDescriptor);
|
||||||
|
@ -1303,9 +1295,8 @@ TEST_P(TextureZeroInitTest, PreservesInitializedMip) {
|
||||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
|
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
|
||||||
|
|
||||||
// Create bindgroup
|
// Create bindgroup
|
||||||
wgpu::BindGroup bindGroup =
|
wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, renderPipeline.GetBindGroupLayout(0),
|
||||||
utils::MakeBindGroup(device, renderPipeline.GetBindGroupLayout(0),
|
{{0, sampleTexture.CreateView()}});
|
||||||
{{0, sampler}, {1, sampleTexture.CreateView()}});
|
|
||||||
|
|
||||||
// Encode pass and submit
|
// Encode pass and submit
|
||||||
encoder = device.CreateCommandEncoder();
|
encoder = device.CreateCommandEncoder();
|
||||||
|
@ -1354,8 +1345,6 @@ TEST_P(TextureZeroInitTest, PreservesInitializedArrayLayer) {
|
||||||
kColorFormat);
|
kColorFormat);
|
||||||
wgpu::Texture sampleTexture = device.CreateTexture(&sampleTextureDescriptor);
|
wgpu::Texture sampleTexture = device.CreateTexture(&sampleTextureDescriptor);
|
||||||
|
|
||||||
wgpu::Sampler sampler = device.CreateSampler();
|
|
||||||
|
|
||||||
wgpu::TextureDescriptor renderTextureDescriptor = CreateTextureDescriptor(
|
wgpu::TextureDescriptor renderTextureDescriptor = CreateTextureDescriptor(
|
||||||
1, 1, wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment, kColorFormat);
|
1, 1, wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment, kColorFormat);
|
||||||
wgpu::Texture renderTexture = device.CreateTexture(&renderTextureDescriptor);
|
wgpu::Texture renderTexture = device.CreateTexture(&renderTextureDescriptor);
|
||||||
|
@ -1390,7 +1379,7 @@ TEST_P(TextureZeroInitTest, PreservesInitializedArrayLayer) {
|
||||||
// Create bindgroup
|
// Create bindgroup
|
||||||
wgpu::BindGroup bindGroup =
|
wgpu::BindGroup bindGroup =
|
||||||
utils::MakeBindGroup(device, renderPipeline.GetBindGroupLayout(0),
|
utils::MakeBindGroup(device, renderPipeline.GetBindGroupLayout(0),
|
||||||
{{0, sampler}, {1, sampleTexture.CreateView(&textureViewDescriptor)}});
|
{{0, sampleTexture.CreateView(&textureViewDescriptor)}});
|
||||||
|
|
||||||
// Encode pass and submit
|
// Encode pass and submit
|
||||||
encoder = device.CreateCommandEncoder();
|
encoder = device.CreateCommandEncoder();
|
||||||
|
@ -1808,13 +1797,11 @@ class CompressedTextureZeroInitTest : public TextureZeroInitTest {
|
||||||
device.CreateRenderPipeline(&renderPipelineDescriptor);
|
device.CreateRenderPipeline(&renderPipelineDescriptor);
|
||||||
pass.SetPipeline(renderPipeline);
|
pass.SetPipeline(renderPipeline);
|
||||||
|
|
||||||
wgpu::Sampler sampler = device.CreateSampler();
|
|
||||||
|
|
||||||
wgpu::TextureViewDescriptor textureViewDescriptor = CreateTextureViewDescriptor(
|
wgpu::TextureViewDescriptor textureViewDescriptor = CreateTextureViewDescriptor(
|
||||||
viewMipmapLevel, baseArrayLayer, textureDescriptor.format);
|
viewMipmapLevel, baseArrayLayer, textureDescriptor.format);
|
||||||
wgpu::BindGroup bindGroup = utils::MakeBindGroup(
|
wgpu::BindGroup bindGroup =
|
||||||
device, renderPipeline.GetBindGroupLayout(0),
|
utils::MakeBindGroup(device, renderPipeline.GetBindGroupLayout(0),
|
||||||
{{0, sampler}, {1, bcTexture.CreateView(&textureViewDescriptor)}});
|
{{0, bcTexture.CreateView(&textureViewDescriptor)}});
|
||||||
pass.SetBindGroup(0, bindGroup);
|
pass.SetBindGroup(0, bindGroup);
|
||||||
pass.Draw(6);
|
pass.Draw(6);
|
||||||
pass.EndPass();
|
pass.EndPass();
|
||||||
|
|
|
@ -70,41 +70,45 @@ class VertexStateTest : public DawnTest {
|
||||||
int multiplier,
|
int multiplier,
|
||||||
const std::vector<ShaderTestSpec>& testSpec) {
|
const std::vector<ShaderTestSpec>& testSpec) {
|
||||||
std::ostringstream vs;
|
std::ostringstream vs;
|
||||||
vs << "#version 450\n";
|
|
||||||
|
|
||||||
// TODO(cwallez@chromium.org): this only handles float attributes, we should extend it to
|
// TODO(cwallez@chromium.org): this only handles float attributes, we should extend it to
|
||||||
// other types Adds line of the form
|
// other types Adds line of the form
|
||||||
// layout(location=1) in vec4 input1;
|
// [[location(1) var<in> input1 : vec4<f32>;
|
||||||
for (const auto& input : testSpec) {
|
for (const auto& input : testSpec) {
|
||||||
vs << "layout(location=" << input.location << ") in vec4 input" << input.location
|
vs << "[[location(" << input.location << ")]] var<in> input" << input.location
|
||||||
<< ";\n";
|
<< " : vec4<f32>;\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
vs << "layout(location = 0) out vec4 color;\n";
|
vs << "[[builtin(vertex_index)]] var<in> VertexIndex : u32;\n";
|
||||||
vs << "void main() {\n";
|
vs << "[[builtin(instance_index)]] var<in> InstanceIndex : u32;\n";
|
||||||
|
vs << "[[location(0)]] var<out> color : vec4<f32>;\n";
|
||||||
|
vs << "[[builtin(position)]] var<out> Position : vec4<f32>;\n";
|
||||||
|
vs << "[[stage(vertex)]] fn main() -> void {\n";
|
||||||
|
|
||||||
// Hard code the triangle in the shader so that we don't have to add a vertex input for it.
|
// Hard code the triangle in the shader so that we don't have to add a vertex input for it.
|
||||||
// Also this places the triangle in the grid based on its VertexID and InstanceID
|
// Also this places the triangle in the grid based on its VertexID and InstanceID
|
||||||
vs << " const vec2 pos[3] = vec2[3](vec2(0.5f, 1.0f), vec2(0.0f, 0.0f), vec2(1.0f, "
|
vs << " const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(\n"
|
||||||
"0.0f));\n";
|
" vec2<f32>(0.5, 1.0), vec2<f32>(0.0, 0.0), vec2<f32>(1.0, 0.0));\n";
|
||||||
vs << " vec2 offset = vec2(float(gl_VertexIndex / 3), float(gl_InstanceIndex));\n";
|
vs << " var offset : vec2<f32> = vec2<f32>(f32(VertexIndex / 3u), "
|
||||||
vs << " vec2 worldPos = pos[gl_VertexIndex % 3] + offset;\n";
|
"f32(InstanceIndex));\n";
|
||||||
vs << " vec4 position = vec4(worldPos / 2 - vec2(1.0f), 0.0f, 1.0f);\n";
|
vs << " var worldPos : vec2<f32> = pos[VertexIndex % 3u] + offset;\n";
|
||||||
vs << " gl_Position = vec4(position.x, -position.y, position.z, position.w);\n";
|
vs << " var position : vec4<f32> = vec4<f32>(0.5 * worldPos - vec2<f32>(1.0, 1.0), 0.0, "
|
||||||
|
"1.0);\n";
|
||||||
|
vs << " Position = vec4<f32>(position.x, -position.y, position.z, position.w);\n";
|
||||||
|
|
||||||
// Perform the checks by successively ANDing a boolean
|
// Perform the checks by successively ANDing a boolean
|
||||||
vs << " bool success = true;\n";
|
vs << " var success : bool = true;\n";
|
||||||
for (const auto& input : testSpec) {
|
for (const auto& input : testSpec) {
|
||||||
for (int component = 0; component < 4; ++component) {
|
for (int component = 0; component < 4; ++component) {
|
||||||
vs << " success = success && (input" << input.location << "[" << component
|
vs << " success = success && (input" << input.location << "[" << component
|
||||||
<< "] == ";
|
<< "] == ";
|
||||||
if (ShouldComponentBeDefault(input.format, component)) {
|
if (ShouldComponentBeDefault(input.format, component)) {
|
||||||
vs << (component == 3 ? "1.0f" : "0.0f");
|
vs << (component == 3 ? "1.0" : "0.0");
|
||||||
} else {
|
} else {
|
||||||
if (input.step == InputStepMode::Vertex) {
|
if (input.step == InputStepMode::Vertex) {
|
||||||
vs << multiplier << " * gl_VertexIndex + " << component << ".0f";
|
vs << "f32(" << multiplier << " * VertexIndex) + " << component << ".0";
|
||||||
} else {
|
} else {
|
||||||
vs << multiplier << " * gl_InstanceIndex + " << component << ".0f";
|
vs << "f32(" << multiplier << " * InstanceIndex) + " << component << ".0";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vs << ");\n";
|
vs << ");\n";
|
||||||
|
@ -113,22 +117,20 @@ class VertexStateTest : public DawnTest {
|
||||||
|
|
||||||
// Choose the color
|
// Choose the color
|
||||||
vs << " if (success) {\n";
|
vs << " if (success) {\n";
|
||||||
vs << " color = vec4(0.0f, 1.0f, 0.0f, 1.0f);\n";
|
vs << " color = vec4<f32>(0.0, 1.0, 0.0, 1.0);\n";
|
||||||
vs << " } else {\n";
|
vs << " } else {\n";
|
||||||
vs << " color = vec4(1.0f, 0.0f, 0.0f, 1.0f);\n";
|
vs << " color = vec4<f32>(1.0, 0.0, 0.0, 1.0);\n";
|
||||||
vs << " }\n;";
|
vs << " }\n";
|
||||||
vs << "}\n";
|
vs << "}\n";
|
||||||
|
|
||||||
wgpu::ShaderModule vsModule =
|
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, vs.str().c_str());
|
||||||
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, vs.str().c_str());
|
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
wgpu::ShaderModule fsModule =
|
[[location(0)]] var<in> color : vec4<f32>;
|
||||||
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
[[location(0)]] var<out> fragColor : vec4<f32>;
|
||||||
#version 450
|
[[stage(fragment)]] fn main() -> void {
|
||||||
layout(location = 0) in vec4 color;
|
|
||||||
layout(location = 0) out vec4 fragColor;
|
|
||||||
void main() {
|
|
||||||
fragColor = color;
|
fragColor = color;
|
||||||
})");
|
}
|
||||||
|
)");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||||
descriptor.vertexStage.module = vsModule;
|
descriptor.vertexStage.module = vsModule;
|
||||||
|
@ -534,9 +536,6 @@ TEST_P(VertexStateTest, LastAllowedVertexBuffer) {
|
||||||
|
|
||||||
// Test that overlapping vertex attributes are permitted and load data correctly
|
// Test that overlapping vertex attributes are permitted and load data correctly
|
||||||
TEST_P(VertexStateTest, OverlappingVertexAttributes) {
|
TEST_P(VertexStateTest, OverlappingVertexAttributes) {
|
||||||
// TODO(crbug.com/tint/114): Tint needs to support 1.4 version of OpSelect
|
|
||||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
|
||||||
|
|
||||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 3, 3);
|
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 3, 3);
|
||||||
|
|
||||||
utils::ComboVertexStateDescriptor vertexState;
|
utils::ComboVertexStateDescriptor vertexState;
|
||||||
|
@ -563,36 +562,36 @@ TEST_P(VertexStateTest, OverlappingVertexAttributes) {
|
||||||
utils::CreateBufferFromData(device, &data, sizeof(data), wgpu::BufferUsage::Vertex);
|
utils::CreateBufferFromData(device, &data, sizeof(data), wgpu::BufferUsage::Vertex);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor pipelineDesc(device);
|
utils::ComboRenderPipelineDescriptor pipelineDesc(device);
|
||||||
pipelineDesc.vertexStage.module =
|
pipelineDesc.vertexStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
[[location(0)]] var<in> attr0 : vec4<f32>;
|
||||||
#version 450
|
[[location(1)]] var<in> attr1 : vec2<u32>;
|
||||||
layout(location = 0) in vec4 attr0;
|
[[location(2)]] var<in> attr2 : vec4<f32>;
|
||||||
layout(location = 1) in uvec2 attr1;
|
[[location(3)]] var<in> attr3 : f32;
|
||||||
layout(location = 2) in vec4 attr2;
|
|
||||||
layout(location = 3) in float attr3;
|
|
||||||
|
|
||||||
layout(location = 0) out vec4 color;
|
[[location(0)]] var<out> color : vec4<f32>;
|
||||||
|
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||||
|
|
||||||
void main() {
|
[[stage(vertex)]] fn main() -> void {
|
||||||
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
|
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
||||||
gl_PointSize = 1.0;
|
|
||||||
|
|
||||||
bool success = (
|
var success : bool = (
|
||||||
attr0.x == 1.0f &&
|
attr0.x == 1.0 &&
|
||||||
attr1.x == 2u &&
|
attr1.x == 2u &&
|
||||||
attr1.y == 3u &&
|
attr1.y == 3u &&
|
||||||
attr2.z == 4.0f &&
|
attr2.z == 4.0 &&
|
||||||
attr2.w == 5.0f &&
|
attr2.w == 5.0 &&
|
||||||
attr3 == 1.0f
|
attr3 == 1.0
|
||||||
);
|
);
|
||||||
color = success ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
|
if (success) {
|
||||||
|
color = vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||||
|
} else {
|
||||||
|
color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||||
|
}
|
||||||
})");
|
})");
|
||||||
pipelineDesc.cFragmentStage.module =
|
pipelineDesc.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
[[location(0)]] var<in> color : vec4<f32>;
|
||||||
#version 450
|
[[location(0)]] var<out> fragColor : vec4<f32>;
|
||||||
layout(location = 0) in vec4 color;
|
[[stage(fragment)]] fn main() -> void {
|
||||||
layout(location = 0) out vec4 fragColor;
|
|
||||||
void main() {
|
|
||||||
fragColor = color;
|
fragColor = color;
|
||||||
})");
|
})");
|
||||||
pipelineDesc.vertexState = &vertexState;
|
pipelineDesc.vertexState = &vertexState;
|
||||||
|
@ -634,20 +633,16 @@ class OptionalVertexStateTest : public DawnTest {};
|
||||||
TEST_P(OptionalVertexStateTest, Basic) {
|
TEST_P(OptionalVertexStateTest, Basic) {
|
||||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 3, 3);
|
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 3, 3);
|
||||||
|
|
||||||
wgpu::ShaderModule vsModule =
|
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||||
#version 450
|
[[stage(vertex)]] fn main() -> void {
|
||||||
void main() {
|
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
||||||
gl_Position = vec4(0.0f, 0.0f, 0.0f, 1.0f);
|
|
||||||
gl_PointSize = 1.0;
|
|
||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule =
|
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
[[location(0)]] var<out> fragColor : vec4<f32>;
|
||||||
#version 450
|
[[stage(fragment)]] fn main() -> void {
|
||||||
layout(location = 0) out vec4 fragColor;
|
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||||
void main() {
|
|
||||||
fragColor = vec4(0.0f, 1.0f, 0.0f, 1.0f);
|
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||||
|
|
|
@ -33,33 +33,36 @@ namespace {
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr char kVertexShader[] = R"(
|
constexpr char kVertexShader[] = R"(
|
||||||
#version 450
|
[[location(0)]] var<in> pos : vec4<f32>;
|
||||||
layout(location = 0) in vec4 pos;
|
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||||
void main() {
|
[[stage(vertex)]] fn main() -> void {
|
||||||
gl_Position = pos;
|
Position = pos;
|
||||||
})";
|
})";
|
||||||
|
|
||||||
constexpr char kFragmentShaderA[] = R"(
|
constexpr char kFragmentShaderA[] = R"(
|
||||||
#version 450
|
[[block]] struct Uniforms {
|
||||||
layout (std140, set = 0, binding = 0) uniform Uniforms {
|
[[offset(0)]] color : vec3<f32>;
|
||||||
vec3 color;
|
|
||||||
};
|
};
|
||||||
layout(location = 0) out vec4 fragColor;
|
[[group(0), binding(0)]] var<uniform> uniforms : Uniforms;
|
||||||
void main() {
|
[[location(0)]] var<out> fragColor : vec4<f32>;
|
||||||
fragColor = vec4(color / 5000., 1.0);
|
[[stage(fragment)]] fn main() -> void {
|
||||||
|
fragColor = vec4<f32>(uniforms.color * (1.0 / 5000.0), 1.0);
|
||||||
})";
|
})";
|
||||||
|
|
||||||
constexpr char kFragmentShaderB[] = R"(
|
constexpr char kFragmentShaderB[] = R"(
|
||||||
#version 450
|
[[block]] struct Constants {
|
||||||
layout (std140, set = 0, binding = 0) uniform Constants {
|
[[offset(0)]] color : vec3<f32>;
|
||||||
vec3 colorA;
|
|
||||||
};
|
};
|
||||||
layout (std140, set = 1, binding = 0) uniform Uniforms {
|
[[block]] struct Uniforms {
|
||||||
vec3 colorB;
|
[[offset(0)]] color : vec3<f32>;
|
||||||
};
|
};
|
||||||
layout(location = 0) out vec4 fragColor;
|
[[group(0), binding(0)]] var<uniform> constants : Constants;
|
||||||
void main() {
|
[[group(1), binding(0)]] var<uniform> uniforms : Uniforms;
|
||||||
fragColor = vec4((colorA + colorB) / 5000., 1.0);
|
|
||||||
|
[[location(0)]] var<out> fragColor : vec4<f32>;
|
||||||
|
|
||||||
|
[[stage(fragment)]] fn main() -> void {
|
||||||
|
fragColor = vec4<f32>((constants.color + uniforms.color) * (1.0 / 5000.0), 1.0);
|
||||||
})";
|
})";
|
||||||
|
|
||||||
enum class Pipeline {
|
enum class Pipeline {
|
||||||
|
@ -364,10 +367,8 @@ void DrawCallPerf::SetUp() {
|
||||||
wgpu::PipelineLayout pipelineLayout = device.CreatePipelineLayout(&pipelineLayoutDesc);
|
wgpu::PipelineLayout pipelineLayout = device.CreatePipelineLayout(&pipelineLayoutDesc);
|
||||||
|
|
||||||
// Create the shaders for the first pipeline.
|
// Create the shaders for the first pipeline.
|
||||||
wgpu::ShaderModule vsModule =
|
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, kVertexShader);
|
||||||
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, kVertexShader);
|
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, kFragmentShaderA);
|
||||||
wgpu::ShaderModule fsModule =
|
|
||||||
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, kFragmentShaderA);
|
|
||||||
|
|
||||||
// Create the first pipeline.
|
// Create the first pipeline.
|
||||||
renderPipelineDesc.layout = pipelineLayout;
|
renderPipelineDesc.layout = pipelineLayout;
|
||||||
|
@ -395,8 +396,7 @@ void DrawCallPerf::SetUp() {
|
||||||
|
|
||||||
// Create the fragment shader module. This shader matches the pipeline layout described
|
// Create the fragment shader module. This shader matches the pipeline layout described
|
||||||
// above.
|
// above.
|
||||||
wgpu::ShaderModule fsModule =
|
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, kFragmentShaderB);
|
||||||
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, kFragmentShaderB);
|
|
||||||
|
|
||||||
// Create the pipeline.
|
// Create the pipeline.
|
||||||
renderPipelineDesc.layout = pipelineLayout;
|
renderPipelineDesc.layout = pipelineLayout;
|
||||||
|
|
Loading…
Reference in New Issue