Remove usage of deprecated WGSL IO in perf/unit/whitebox tests
Also drive-by fixes some other deprecated constructs (const -> let, and a disabled test having ancient WGSL). Bug: dawn:755 Change-Id: I924dfbcbd0a7d0478f3e9b3766585751a0392499 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/47620 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Auto-Submit: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
21bd02becf
commit
78d27e88de
|
@ -33,10 +33,10 @@ namespace {
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr char kVertexShader[] = R"(
|
constexpr char kVertexShader[] = R"(
|
||||||
[[location(0)]] var<in> pos : vec4<f32>;
|
[[stage(vertex)]] fn main(
|
||||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
[[location(0)]] pos : vec4<f32>
|
||||||
[[stage(vertex)]] fn main() {
|
) -> [[builtin(position)]] vec4<f32> {
|
||||||
Position = pos;
|
return pos;
|
||||||
})";
|
})";
|
||||||
|
|
||||||
constexpr char kFragmentShaderA[] = R"(
|
constexpr char kFragmentShaderA[] = R"(
|
||||||
|
@ -44,9 +44,8 @@ namespace {
|
||||||
color : vec3<f32>;
|
color : vec3<f32>;
|
||||||
};
|
};
|
||||||
[[group(0), binding(0)]] var<uniform> uniforms : Uniforms;
|
[[group(0), binding(0)]] var<uniform> uniforms : Uniforms;
|
||||||
[[location(0)]] var<out> fragColor : vec4<f32>;
|
[[stage(fragment)]] fn main() -> [[location(0)]] vec4<f32> {
|
||||||
[[stage(fragment)]] fn main() {
|
return vec4<f32>(uniforms.color * (1.0 / 5000.0), 1.0);
|
||||||
fragColor = vec4<f32>(uniforms.color * (1.0 / 5000.0), 1.0);
|
|
||||||
})";
|
})";
|
||||||
|
|
||||||
constexpr char kFragmentShaderB[] = R"(
|
constexpr char kFragmentShaderB[] = R"(
|
||||||
|
@ -59,10 +58,8 @@ namespace {
|
||||||
[[group(0), binding(0)]] var<uniform> constants : Constants;
|
[[group(0), binding(0)]] var<uniform> constants : Constants;
|
||||||
[[group(1), binding(0)]] var<uniform> uniforms : Uniforms;
|
[[group(1), binding(0)]] var<uniform> uniforms : Uniforms;
|
||||||
|
|
||||||
[[location(0)]] var<out> fragColor : vec4<f32>;
|
[[stage(fragment)]] fn main() -> [[location(0)]] vec4<f32> {
|
||||||
|
return vec4<f32>((constants.color + uniforms.color) * (1.0 / 5000.0), 1.0);
|
||||||
[[stage(fragment)]] fn main() {
|
|
||||||
fragColor = vec4<f32>((constants.color + uniforms.color) * (1.0 / 5000.0), 1.0);
|
|
||||||
})";
|
})";
|
||||||
|
|
||||||
enum class Pipeline {
|
enum class Pipeline {
|
||||||
|
|
|
@ -71,17 +71,15 @@ class SubresourceTrackingPerf : public DawnPerfTestWithParams<SubresourceTrackin
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
|
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
|
||||||
pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"(
|
pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"(
|
||||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
[[stage(vertex)]] fn main() {
|
return vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||||
Position = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
pipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"(
|
pipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"(
|
||||||
[[location(0)]] var<out> FragColor : vec4<f32>;
|
|
||||||
[[group(0), binding(0)]] var materials : texture_2d<f32>;
|
[[group(0), binding(0)]] var materials : texture_2d<f32>;
|
||||||
[[stage(fragment)]] fn main() {
|
[[stage(fragment)]] fn main() -> [[location(0)]] vec4<f32> {
|
||||||
const foo : vec2<i32> = textureDimensions(materials);
|
let foo : vec2<i32> = textureDimensions(materials);
|
||||||
FragColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
return vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
mPipeline = device.CreateRenderPipeline2(&pipelineDesc);
|
mPipeline = device.CreateRenderPipeline2(&pipelineDesc);
|
||||||
|
|
|
@ -24,15 +24,13 @@ class DrawIndirectValidationTest : public ValidationTest {
|
||||||
ValidationTest::SetUp();
|
ValidationTest::SetUp();
|
||||||
|
|
||||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
[[stage(vertex)]] fn main() {
|
return vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
||||||
Position = vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
|
||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[location(0)]] var<out> fragColor : vec4<f32>;
|
[[stage(fragment)]] fn main() -> [[location(0)]] vec4<f32>{
|
||||||
[[stage(fragment)]] fn main() {
|
return vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
||||||
fragColor = vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
|
||||||
})");
|
})");
|
||||||
|
|
||||||
// Set up render pipeline
|
// Set up render pipeline
|
||||||
|
|
|
@ -23,15 +23,13 @@ class IndexBufferValidationTest : public ValidationTest {
|
||||||
wgpu::RenderPipeline MakeTestPipeline(wgpu::IndexFormat format,
|
wgpu::RenderPipeline MakeTestPipeline(wgpu::IndexFormat format,
|
||||||
wgpu::PrimitiveTopology primitiveTopology) {
|
wgpu::PrimitiveTopology primitiveTopology) {
|
||||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
[[stage(vertex)]] fn main() {
|
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
||||||
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
|
||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[location(0)]] var<out> fragColor : vec4<f32>;
|
[[stage(fragment)]] fn main() -> [[location(0)]] vec4<f32> {
|
||||||
[[stage(fragment)]] fn main() {
|
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||||
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
|
|
|
@ -175,15 +175,13 @@ namespace {
|
||||||
};
|
};
|
||||||
|
|
||||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
[[stage(vertex)]] fn main() {
|
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
||||||
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
|
||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[location(0)]] var<out> fragColor : vec4<f32>;
|
[[stage(fragment)]] fn main() -> [[location(0)]] vec4<f32> {
|
||||||
[[stage(fragment)]] fn main() {
|
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||||
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
|
|
|
@ -28,14 +28,12 @@ namespace {
|
||||||
ValidationTest::SetUp();
|
ValidationTest::SetUp();
|
||||||
|
|
||||||
vsModule = utils::CreateShaderModule(device, R"(
|
vsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[location(0)]] var<in> pos : vec2<f32>;
|
|
||||||
|
|
||||||
[[block]] struct S {
|
[[block]] struct S {
|
||||||
transform : mat2x2<f32>;
|
transform : mat2x2<f32>;
|
||||||
};
|
};
|
||||||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||||
|
|
||||||
[[stage(vertex)]] fn main() {
|
[[stage(vertex)]] fn main([[location(0)]] pos : vec2<f32>) {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
fsModule = utils::CreateShaderModule(device, R"(
|
fsModule = utils::CreateShaderModule(device, R"(
|
||||||
|
|
|
@ -27,15 +27,13 @@ class RenderPipelineValidationTest : public ValidationTest {
|
||||||
ValidationTest::SetUp();
|
ValidationTest::SetUp();
|
||||||
|
|
||||||
vsModule = utils::CreateShaderModule(device, R"(
|
vsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
[[stage(vertex)]] fn main() {
|
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
||||||
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
|
||||||
})");
|
})");
|
||||||
|
|
||||||
fsModule = utils::CreateShaderModule(device, R"(
|
fsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[location(0)]] var<out> fragColor : vec4<f32>;
|
[[stage(fragment)]] fn main() -> [[location(0)]] vec4<f32> {
|
||||||
[[stage(fragment)]] fn main() {
|
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||||
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
|
||||||
})");
|
})");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,9 +189,11 @@ TEST_F(RenderPipelineValidationTest, FragmentOutputFormatCompatibility) {
|
||||||
|
|
||||||
std::ostringstream stream;
|
std::ostringstream stream;
|
||||||
stream << R"(
|
stream << R"(
|
||||||
[[location(0)]] var<out> fragColor : vec4<)"
|
[[stage(fragment)]] fn main() -> [[location(0)]] vec4<)"
|
||||||
|
<< kScalarTypes[i] << R"(> {
|
||||||
|
var result : vec4<)"
|
||||||
<< kScalarTypes[i] << R"(>;
|
<< kScalarTypes[i] << R"(>;
|
||||||
[[stage(fragment)]] fn main() {
|
return result;
|
||||||
})";
|
})";
|
||||||
descriptor.cFragment.module = utils::CreateShaderModule(device, stream.str().c_str());
|
descriptor.cFragment.module = utils::CreateShaderModule(device, stream.str().c_str());
|
||||||
|
|
||||||
|
@ -484,8 +484,7 @@ TEST_F(RenderPipelineValidationTest, StorageBufferInVertexShaderNoLayout) {
|
||||||
data : array<u32, 100>;
|
data : array<u32, 100>;
|
||||||
};
|
};
|
||||||
[[group(0), binding(0)]] var<storage> dst : [[access(read_write)]] Dst;
|
[[group(0), binding(0)]] var<storage> dst : [[access(read_write)]] Dst;
|
||||||
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
|
[[stage(vertex)]] fn main([[builtin(vertex_index)]] VertexIndex : u32) {
|
||||||
[[stage(vertex)]] fn main() {
|
|
||||||
dst.data[VertexIndex] = 0x1234u;
|
dst.data[VertexIndex] = 0x1234u;
|
||||||
})");
|
})");
|
||||||
|
|
||||||
|
@ -591,16 +590,12 @@ TEST_F(RenderPipelineValidationTest, DepthCompareUndefinedIsError) {
|
||||||
// Test that the entryPoint names must be present for the correct stage in the shader module.
|
// Test that the entryPoint names must be present for the correct stage in the shader module.
|
||||||
TEST_F(RenderPipelineValidationTest, EntryPointNameValidation) {
|
TEST_F(RenderPipelineValidationTest, EntryPointNameValidation) {
|
||||||
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
|
||||||
[[builtin(position)]] var<out> position : vec4<f32>;
|
[[stage(vertex)]] fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||||
[[stage(vertex)]] fn vertex_main() {
|
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
||||||
position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[[location(0)]] var<out> color : vec4<f32>;
|
[[stage(fragment)]] fn fragment_main() -> [[location(0)]] vec4<f32> {
|
||||||
[[stage(fragment)]] fn fragment_main() {
|
return vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||||
color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
|
|
||||||
|
@ -641,17 +636,13 @@ TEST_F(RenderPipelineValidationTest, EntryPointNameValidation) {
|
||||||
// Test that vertex attrib validation is for the correct entryPoint
|
// Test that vertex attrib validation is for the correct entryPoint
|
||||||
TEST_F(RenderPipelineValidationTest, VertexAttribCorrectEntryPoint) {
|
TEST_F(RenderPipelineValidationTest, VertexAttribCorrectEntryPoint) {
|
||||||
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
|
||||||
[[builtin(position)]] var<out> position : vec4<f32>;
|
[[stage(vertex)]] fn vertex0([[location(0)]] attrib0 : vec4<f32>)
|
||||||
[[location(0)]] var<in> attrib0 : vec4<f32>;
|
-> [[builtin(position)]] vec4<f32> {
|
||||||
[[location(1)]] var<in> attrib1 : vec4<f32>;
|
return attrib0;
|
||||||
|
|
||||||
[[stage(vertex)]] fn vertex0() {
|
|
||||||
position = attrib0;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
[[stage(vertex)]] fn vertex1() {
|
[[stage(vertex)]] fn vertex1([[location(1)]] attrib1 : vec4<f32>)
|
||||||
position = attrib1;
|
-> [[builtin(position)]] vec4<f32> {
|
||||||
return;
|
return attrib1;
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
|
|
||||||
|
@ -687,16 +678,11 @@ TEST_F(RenderPipelineValidationTest, VertexAttribCorrectEntryPoint) {
|
||||||
// Test that fragment output validation is for the correct entryPoint
|
// Test that fragment output validation is for the correct entryPoint
|
||||||
TEST_F(RenderPipelineValidationTest, FragmentOutputCorrectEntryPoint) {
|
TEST_F(RenderPipelineValidationTest, FragmentOutputCorrectEntryPoint) {
|
||||||
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
|
||||||
[[location(0)]] var<out> colorFloat : vec4<f32>;
|
[[stage(fragment)]] fn fragmentFloat() -> [[location(0)]] vec4<f32> {
|
||||||
[[location(0)]] var<out> colorUint : vec4<u32>;
|
return vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
||||||
|
|
||||||
[[stage(fragment)]] fn fragmentFloat() {
|
|
||||||
colorFloat = vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
[[stage(fragment)]] fn fragmentUint() {
|
[[stage(fragment)]] fn fragmentUint() -> [[location(0)]] vec4<u32> {
|
||||||
colorUint = vec4<u32>(0u, 0u, 0u, 0u);
|
return vec4<u32>(0u, 0u, 0u, 0u);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
|
|
||||||
|
@ -730,21 +716,15 @@ TEST_F(RenderPipelineValidationTest, DISABLED_BindingsFromCorrectEntryPoint) {
|
||||||
[[block]] struct Uniforms {
|
[[block]] struct Uniforms {
|
||||||
data : vec4<f32>;
|
data : vec4<f32>;
|
||||||
};
|
};
|
||||||
[[binding 0, set 0]] var<uniform> var0 : Uniforms;
|
[[group(0), binding(0)]] var<uniform> var0 : Uniforms;
|
||||||
[[binding 1, set 0]] var<uniform> var1 : Uniforms;
|
[[group(0), binding(1)]] var<uniform> var1 : Uniforms;
|
||||||
[[builtin(position)]] var<out> position : vec4<f32>;
|
|
||||||
|
|
||||||
fn vertex0() {
|
[[stage(vertex)]] fn vertex0() -> [[builtin(position)]] vec4<f32> {
|
||||||
position = var0.data;
|
return var0.data;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
fn vertex1() {
|
[[stage(vertex)]] fn vertex1() -> [[builtin(position)]] vec4<f32> {
|
||||||
position = var1.data;
|
return var1.data;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
entry_point vertex = vertex0;
|
|
||||||
entry_point vertex = vertex1;
|
|
||||||
)");
|
)");
|
||||||
|
|
||||||
wgpu::BindGroupLayout bgl0 = utils::MakeBindGroupLayout(
|
wgpu::BindGroupLayout bgl0 = utils::MakeBindGroupLayout(
|
||||||
|
|
|
@ -60,9 +60,9 @@ TEST_F(ShaderModuleValidationTest, CreationSuccess) {
|
||||||
// be compiled.
|
// be compiled.
|
||||||
TEST_F(ShaderModuleValidationTest, FragmentOutputLocationExceedsMaxColorAttachments) {
|
TEST_F(ShaderModuleValidationTest, FragmentOutputLocationExceedsMaxColorAttachments) {
|
||||||
std::ostringstream stream;
|
std::ostringstream stream;
|
||||||
stream << "[[location(" << kMaxColorAttachments << R"()]] var<out> fragColor : vec4<f32>;
|
stream << "[[stage(fragment)]] fn main() -> [[location(" << kMaxColorAttachments
|
||||||
[[stage(fragment)]] fn main() {
|
<< R"()]] vec4<f32> {
|
||||||
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||||
})";
|
})";
|
||||||
ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, stream.str().c_str()));
|
ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, stream.str().c_str()));
|
||||||
}
|
}
|
||||||
|
@ -162,12 +162,10 @@ TEST_F(ShaderModuleValidationTest, CompilationMessages) {
|
||||||
// is not the case on the wire.
|
// is not the case on the wire.
|
||||||
DAWN_SKIP_TEST_IF(UsesWire());
|
DAWN_SKIP_TEST_IF(UsesWire());
|
||||||
|
|
||||||
std::ostringstream stream;
|
wgpu::ShaderModule shaderModule = utils::CreateShaderModule(device, R"(
|
||||||
stream << R"([[location(0)]] var<out> fragColor : vec4<f32>;
|
[[stage(fragment)]] fn main() -> [[location(0)]] vec4<f32> {
|
||||||
[[stage(fragment)]] fn main() {
|
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||||
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
})");
|
||||||
})";
|
|
||||||
wgpu::ShaderModule shaderModule = utils::CreateShaderModule(device, stream.str().c_str());
|
|
||||||
|
|
||||||
dawn_native::ShaderModuleBase* shaderModuleBase =
|
dawn_native::ShaderModuleBase* shaderModuleBase =
|
||||||
reinterpret_cast<dawn_native::ShaderModuleBase*>(shaderModule.Get());
|
reinterpret_cast<dawn_native::ShaderModuleBase*>(shaderModule.Get());
|
||||||
|
|
|
@ -24,14 +24,12 @@ class StorageTextureValidationTests : public ValidationTest {
|
||||||
ValidationTest::SetUp();
|
ValidationTest::SetUp();
|
||||||
|
|
||||||
mDefaultVSModule = utils::CreateShaderModule(device, R"(
|
mDefaultVSModule = utils::CreateShaderModule(device, R"(
|
||||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
[[stage(vertex)]] fn main() {
|
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
||||||
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
|
||||||
})");
|
})");
|
||||||
mDefaultFSModule = utils::CreateShaderModule(device, R"(
|
mDefaultFSModule = utils::CreateShaderModule(device, R"(
|
||||||
[[location(0)]] var<out> fragColor : vec4<f32>;
|
[[stage(fragment)]] fn main() -> [[location(0)]] vec4<f32> {
|
||||||
[[stage(fragment)]] fn main() {
|
return vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||||
fragColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
|
||||||
})");
|
})");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,10 +120,10 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) {
|
||||||
{
|
{
|
||||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[group(0), binding(0)]] var image0 : [[access(read)]] texture_storage_2d<rgba8unorm>;
|
[[group(0), binding(0)]] var image0 : [[access(read)]] texture_storage_2d<rgba8unorm>;
|
||||||
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
|
[[stage(vertex)]] fn main(
|
||||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
[[builtin(vertex_index)]] VertexIndex : u32
|
||||||
[[stage(vertex)]] fn main() {
|
) -> [[builtin(position)]] vec4<f32> {
|
||||||
Position = textureLoad(image0, vec2<i32>(i32(VertexIndex), 0));
|
return textureLoad(image0, vec2<i32>(i32(VertexIndex), 0));
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
|
@ -139,10 +137,10 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) {
|
||||||
{
|
{
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[group(0), binding(0)]] var image0 : [[access(read)]] texture_storage_2d<rgba8unorm>;
|
[[group(0), binding(0)]] var image0 : [[access(read)]] texture_storage_2d<rgba8unorm>;
|
||||||
[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;
|
[[stage(fragment)]] fn main(
|
||||||
[[location(0)]] var<out> fragColor : vec4<f32>;
|
[[builtin(frag_coord)]] FragCoord : vec4<f32>
|
||||||
[[stage(fragment)]] fn main() {
|
) -> [[location(0)]] vec4<f32> {
|
||||||
fragColor = textureLoad(image0, vec2<i32>(FragCoord.xy));
|
return textureLoad(image0, vec2<i32>(FragCoord.xy));
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
|
@ -155,9 +153,8 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) {
|
||||||
// Write-only storage textures cannot be declared in a vertex shader.
|
// Write-only storage textures cannot be declared in a vertex shader.
|
||||||
if ((false) /* TODO(https://crbug.com/tint/449) */) {
|
if ((false) /* TODO(https://crbug.com/tint/449) */) {
|
||||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[builtin(vertex_index)]] var<in> vertex_index : u32;
|
|
||||||
[[group(0), binding(0)]] var image0 : [[access(write)]] texture_storage_2d<rgba8unorm>;
|
[[group(0), binding(0)]] var image0 : [[access(write)]] texture_storage_2d<rgba8unorm>;
|
||||||
[[stage(vertex)]] fn main() {
|
[[stage(vertex)]] fn main([[builtin(vertex_index)]] vertex_index : u32) {
|
||||||
textureStore(image0, vec2<i32>(i32(vertex_index), 0), vec4<f32>(1.0, 0.0, 0.0, 1.0));
|
textureStore(image0, vec2<i32>(i32(vertex_index), 0), vec4<f32>(1.0, 0.0, 0.0, 1.0));
|
||||||
})");
|
})");
|
||||||
|
|
||||||
|
@ -171,9 +168,8 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) {
|
||||||
// Write-only storage textures can be declared in a fragment shader.
|
// Write-only storage textures can be declared in a fragment shader.
|
||||||
{
|
{
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[builtin(frag_coord)]] var<in> frag_coord : vec4<f32>;
|
|
||||||
[[group(0), binding(0)]] var image0 : [[access(write)]] texture_storage_2d<rgba8unorm>;
|
[[group(0), binding(0)]] var image0 : [[access(write)]] texture_storage_2d<rgba8unorm>;
|
||||||
[[stage(fragment)]] fn main() {
|
[[stage(fragment)]] fn main([[builtin(frag_coord)]] frag_coord : vec4<f32>) {
|
||||||
textureStore(image0, vec2<i32>(frag_coord.xy), vec4<f32>(1.0, 0.0, 0.0, 1.0));
|
textureStore(image0, vec2<i32>(frag_coord.xy), vec4<f32>(1.0, 0.0, 0.0, 1.0));
|
||||||
})");
|
})");
|
||||||
|
|
||||||
|
@ -192,14 +188,13 @@ TEST_F(StorageTextureValidationTests, ComputePipeline) {
|
||||||
{
|
{
|
||||||
wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"(
|
||||||
[[group(0), binding(0)]] var image0 : [[access(read)]] texture_storage_2d<rgba8unorm>;
|
[[group(0), binding(0)]] var image0 : [[access(read)]] texture_storage_2d<rgba8unorm>;
|
||||||
[[builtin(local_invocation_id)]] var<in> LocalInvocationID : vec3<u32>;
|
|
||||||
|
|
||||||
[[block]] struct Buf {
|
[[block]] struct Buf {
|
||||||
data : f32;
|
data : f32;
|
||||||
};
|
};
|
||||||
[[group(0), binding(1)]] var<storage> buf : [[access(read_write)]] Buf;
|
[[group(0), binding(1)]] var<storage> buf : [[access(read_write)]] Buf;
|
||||||
|
|
||||||
[[stage(compute)]] fn main() {
|
[[stage(compute)]] fn main([[builtin(local_invocation_id)]] LocalInvocationID : vec3<u32>) {
|
||||||
buf.data = textureLoad(image0, vec2<i32>(LocalInvocationID.xy)).x;
|
buf.data = textureLoad(image0, vec2<i32>(LocalInvocationID.xy)).x;
|
||||||
})");
|
})");
|
||||||
|
|
||||||
|
@ -215,9 +210,8 @@ TEST_F(StorageTextureValidationTests, ComputePipeline) {
|
||||||
{
|
{
|
||||||
wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"(
|
||||||
[[group(0), binding(0)]] var image0 : [[access(write)]] texture_storage_2d<rgba8unorm>;
|
[[group(0), binding(0)]] var image0 : [[access(write)]] texture_storage_2d<rgba8unorm>;
|
||||||
[[builtin(local_invocation_id)]] var<in> LocalInvocationID : vec3<u32>;
|
|
||||||
|
|
||||||
[[stage(compute)]] fn main() {
|
[[stage(compute)]] fn main([[builtin(local_invocation_id)]] LocalInvocationID : vec3<u32>) {
|
||||||
textureStore(image0, vec2<i32>(LocalInvocationID.xy), vec4<f32>(0.0, 0.0, 0.0, 0.0));
|
textureStore(image0, vec2<i32>(LocalInvocationID.xy), vec4<f32>(0.0, 0.0, 0.0, 0.0));
|
||||||
})");
|
})");
|
||||||
|
|
||||||
|
|
|
@ -26,9 +26,8 @@ class VertexBufferValidationTest : public ValidationTest {
|
||||||
ValidationTest::SetUp();
|
ValidationTest::SetUp();
|
||||||
|
|
||||||
fsModule = utils::CreateShaderModule(device, R"(
|
fsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[location(0)]] var<out> fragColor : vec4<f32>;
|
[[stage(fragment)]] fn main() -> [[location(0)]] vec4<f32> {
|
||||||
[[stage(fragment)]] fn main() {
|
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||||
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
|
||||||
})");
|
})");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,13 +41,18 @@ class VertexBufferValidationTest : public ValidationTest {
|
||||||
|
|
||||||
wgpu::ShaderModule MakeVertexShader(unsigned int bufferCount) {
|
wgpu::ShaderModule MakeVertexShader(unsigned int bufferCount) {
|
||||||
std::ostringstream vs;
|
std::ostringstream vs;
|
||||||
|
vs << "[[stage(vertex)]] fn main(\n";
|
||||||
for (unsigned int i = 0; i < bufferCount; ++i) {
|
for (unsigned int i = 0; i < bufferCount; ++i) {
|
||||||
vs << "[[location(" << i << ")]] var<in> a_position" << i << " : vec3<f32>;\n";
|
// TODO(cwallez@chromium.org): remove this special handling of 0 once Tint supports
|
||||||
|
// trailing commas in argument lists.
|
||||||
|
if (i != 0) {
|
||||||
|
vs << ", ";
|
||||||
|
}
|
||||||
|
vs << "[[location(" << i << ")]] a_position" << i << " : vec3<f32>\n";
|
||||||
}
|
}
|
||||||
vs << "[[builtin(position)]] var<out> Position : vec4<f32>;";
|
vs << ") -> [[builtin(position)]] vec4<f32> {";
|
||||||
vs << "[[stage(vertex)]] fn main() {\n";
|
|
||||||
|
|
||||||
vs << "Position = vec4<f32>(";
|
vs << "return vec4<f32>(";
|
||||||
for (unsigned int i = 0; i < bufferCount; ++i) {
|
for (unsigned int i = 0; i < bufferCount; ++i) {
|
||||||
vs << "a_position" << i;
|
vs << "a_position" << i;
|
||||||
if (i != bufferCount - 1) {
|
if (i != bufferCount - 1) {
|
||||||
|
|
|
@ -24,9 +24,8 @@ class VertexStateTest : public ValidationTest {
|
||||||
const char* vertexSource) {
|
const char* vertexSource) {
|
||||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, vertexSource);
|
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, vertexSource);
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[location(0)]] var<out> fragColor : vec4<f32>;
|
[[stage(fragment)]] fn main() -> [[location(0)]] vec4<f32> {
|
||||||
[[stage(fragment)]] fn main() {
|
return vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||||
fragColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
|
|
||||||
|
@ -45,9 +44,8 @@ class VertexStateTest : public ValidationTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* kDummyVertexShader = R"(
|
const char* kDummyVertexShader = R"(
|
||||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
[[stage(vertex)]] fn main() {
|
return vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
||||||
Position = vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
};
|
};
|
||||||
|
@ -99,29 +97,29 @@ TEST_F(VertexStateTest, PipelineCompatibility) {
|
||||||
|
|
||||||
// Control case: pipeline with one input per attribute
|
// Control case: pipeline with one input per attribute
|
||||||
CreatePipeline(true, state, R"(
|
CreatePipeline(true, state, R"(
|
||||||
[[location(0)]] var<in> a : vec4<f32>;
|
[[stage(vertex)]] fn main(
|
||||||
[[location(1)]] var<in> b : vec4<f32>;
|
[[location(0)]] a : vec4<f32>,
|
||||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
[[location(1)]] b : vec4<f32>
|
||||||
[[stage(vertex)]] fn main() {
|
) -> [[builtin(position)]] vec4<f32> {
|
||||||
Position = vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
return vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
|
|
||||||
// Check it is valid for the pipeline to use a subset of the VertexState
|
// Check it is valid for the pipeline to use a subset of the VertexState
|
||||||
CreatePipeline(true, state, R"(
|
CreatePipeline(true, state, R"(
|
||||||
[[location(0)]] var<in> a : vec4<f32>;
|
[[stage(vertex)]] fn main(
|
||||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
[[location(0)]] a : vec4<f32>
|
||||||
[[stage(vertex)]] fn main() {
|
) -> [[builtin(position)]] vec4<f32> {
|
||||||
Position = vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
return vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
|
|
||||||
// Check for an error when the pipeline uses an attribute not in the vertex input
|
// Check for an error when the pipeline uses an attribute not in the vertex input
|
||||||
CreatePipeline(false, state, R"(
|
CreatePipeline(false, state, R"(
|
||||||
[[location(2)]] var<in> a : vec4<f32>;
|
[[stage(vertex)]] fn main(
|
||||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
[[location(2)]] a : vec4<f32>
|
||||||
[[stage(vertex)]] fn main() {
|
) -> [[builtin(position)]] vec4<f32> {
|
||||||
Position = vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
return vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,16 +40,16 @@ class D3D12DescriptorHeapTests : public DawnTest {
|
||||||
mD3DDevice = reinterpret_cast<Device*>(device.Get());
|
mD3DDevice = reinterpret_cast<Device*>(device.Get());
|
||||||
|
|
||||||
mSimpleVSModule = utils::CreateShaderModule(device, R"(
|
mSimpleVSModule = utils::CreateShaderModule(device, R"(
|
||||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
|
||||||
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
|
|
||||||
|
|
||||||
[[stage(vertex)]] fn main() {
|
[[stage(vertex)]] fn main(
|
||||||
|
[[builtin(vertex_index)]] VertexIndex : u32
|
||||||
|
) -> [[builtin(position)]] vec4<f32> {
|
||||||
const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
|
const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
|
||||||
vec2<f32>(-1.0, 1.0),
|
vec2<f32>(-1.0, 1.0),
|
||||||
vec2<f32>( 1.0, 1.0),
|
vec2<f32>( 1.0, 1.0),
|
||||||
vec2<f32>(-1.0, -1.0)
|
vec2<f32>(-1.0, -1.0)
|
||||||
);
|
);
|
||||||
Position = vec4<f32>(pos[VertexIndex], 0.0, 1.0);
|
return vec4<f32>(pos[VertexIndex], 0.0, 1.0);
|
||||||
})");
|
})");
|
||||||
|
|
||||||
mSimpleFSModule = utils::CreateShaderModule(device, R"(
|
mSimpleFSModule = utils::CreateShaderModule(device, R"(
|
||||||
|
@ -57,10 +57,9 @@ class D3D12DescriptorHeapTests : public DawnTest {
|
||||||
color : vec4<f32>;
|
color : vec4<f32>;
|
||||||
};
|
};
|
||||||
[[group(0), binding(0)]] var<uniform> colorBuffer : U;
|
[[group(0), binding(0)]] var<uniform> colorBuffer : U;
|
||||||
[[location(0)]] var<out> FragColor : vec4<f32>;
|
|
||||||
|
|
||||||
[[stage(fragment)]] fn main() {
|
[[stage(fragment)]] fn main() -> [[location(0)]] vec4<f32> {
|
||||||
FragColor = colorBuffer.color;
|
return colorBuffer.color;
|
||||||
})");
|
})");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,17 +176,15 @@ TEST_P(D3D12DescriptorHeapTests, NoSwitchOverSamplerHeap) {
|
||||||
// sampler bindgroup each draw. After HEAP_SIZE + 1 draws, the heaps WILL NOT switch over
|
// sampler bindgroup each draw. After HEAP_SIZE + 1 draws, the heaps WILL NOT switch over
|
||||||
// because the sampler heap allocations are de-duplicated.
|
// because the sampler heap allocations are de-duplicated.
|
||||||
renderPipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"(
|
renderPipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"(
|
||||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
[[stage(vertex)]] fn main() {
|
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
||||||
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
|
||||||
})");
|
})");
|
||||||
|
|
||||||
renderPipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"(
|
renderPipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"(
|
||||||
[[location(0)]] var<out> FragColor : vec4<f32>;
|
|
||||||
[[group(0), binding(0)]] var sampler0 : sampler;
|
[[group(0), binding(0)]] var sampler0 : sampler;
|
||||||
[[stage(fragment)]] fn main() {
|
[[stage(fragment)]] fn main() -> [[location(0)]] vec4<f32> {
|
||||||
let referenceSampler : sampler = sampler0;
|
let referenceSampler : sampler = sampler0;
|
||||||
FragColor = vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
return vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
|
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
|
||||||
|
@ -787,16 +784,16 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBOAndSamplers) {
|
||||||
transform : mat2x2<f32>;
|
transform : mat2x2<f32>;
|
||||||
};
|
};
|
||||||
[[group(0), binding(0)]] var<uniform> buffer0 : U;
|
[[group(0), binding(0)]] var<uniform> buffer0 : U;
|
||||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
|
||||||
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
|
|
||||||
|
|
||||||
[[stage(vertex)]] fn main() {
|
[[stage(vertex)]] fn main(
|
||||||
|
[[builtin(vertex_index)]] VertexIndex : u32
|
||||||
|
) -> [[builtin(position)]] vec4<f32> {
|
||||||
const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
|
const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
|
||||||
vec2<f32>(-1.0, 1.0),
|
vec2<f32>(-1.0, 1.0),
|
||||||
vec2<f32>( 1.0, 1.0),
|
vec2<f32>( 1.0, 1.0),
|
||||||
vec2<f32>(-1.0, -1.0)
|
vec2<f32>(-1.0, -1.0)
|
||||||
);
|
);
|
||||||
Position = vec4<f32>(buffer0.transform * (pos[VertexIndex]), 0.0, 1.0);
|
return vec4<f32>(buffer0.transform * (pos[VertexIndex]), 0.0, 1.0);
|
||||||
})");
|
})");
|
||||||
pipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"(
|
pipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"(
|
||||||
[[block]] struct U {
|
[[block]] struct U {
|
||||||
|
@ -806,11 +803,10 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBOAndSamplers) {
|
||||||
[[group(0), binding(2)]] var texture0 : texture_2d<f32>;
|
[[group(0), binding(2)]] var texture0 : texture_2d<f32>;
|
||||||
[[group(0), binding(3)]] var<uniform> buffer0 : U;
|
[[group(0), binding(3)]] var<uniform> buffer0 : U;
|
||||||
|
|
||||||
[[location(0)]] var<out> FragColor : vec4<f32>;
|
[[stage(fragment)]] fn main(
|
||||||
[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;
|
[[builtin(frag_coord)]] FragCoord : vec4<f32>
|
||||||
|
) -> [[location(0)]] vec4<f32> {
|
||||||
[[stage(fragment)]] fn main() {
|
return textureSample(texture0, sampler0, FragCoord.xy) + buffer0.color;
|
||||||
FragColor = textureSample(texture0, sampler0, FragCoord.xy) + buffer0.color;
|
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||||
|
|
|
@ -339,16 +339,15 @@ TEST_P(D3D12DescriptorResidencyTests, SwitchedViewHeapResidency) {
|
||||||
// Fill in a view heap with "view only" bindgroups (1x view per group) by creating a
|
// Fill in a view heap with "view only" bindgroups (1x view per group) by creating a
|
||||||
// view bindgroup each draw. After HEAP_SIZE + 1 draws, the heaps must switch over.
|
// view bindgroup each draw. After HEAP_SIZE + 1 draws, the heaps must switch over.
|
||||||
renderPipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"(
|
renderPipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"(
|
||||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
[[stage(vertex)]] fn main(
|
||||||
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
|
[[builtin(vertex_index)]] VertexIndex : u32
|
||||||
|
) -> [[builtin(position)]] vec4<f32> {
|
||||||
[[stage(vertex)]] fn main() {
|
|
||||||
const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
|
const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
|
||||||
vec2<f32>(-1.0, 1.0),
|
vec2<f32>(-1.0, 1.0),
|
||||||
vec2<f32>( 1.0, 1.0),
|
vec2<f32>( 1.0, 1.0),
|
||||||
vec2<f32>(-1.0, -1.0)
|
vec2<f32>(-1.0, -1.0)
|
||||||
);
|
);
|
||||||
Position = vec4<f32>(pos[VertexIndex], 0.0, 1.0);
|
return vec4<f32>(pos[VertexIndex], 0.0, 1.0);
|
||||||
})");
|
})");
|
||||||
|
|
||||||
renderPipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"(
|
renderPipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"(
|
||||||
|
@ -356,10 +355,9 @@ TEST_P(D3D12DescriptorResidencyTests, SwitchedViewHeapResidency) {
|
||||||
color : vec4<f32>;
|
color : vec4<f32>;
|
||||||
};
|
};
|
||||||
[[group(0), binding(0)]] var<uniform> colorBuffer : U;
|
[[group(0), binding(0)]] var<uniform> colorBuffer : U;
|
||||||
[[location(0)]] var<out> FragColor : vec4<f32>;
|
|
||||||
|
|
||||||
[[stage(fragment)]] fn main() {
|
[[stage(fragment)]] fn main() -> [[location(0)]] vec4<f32> {
|
||||||
FragColor = colorBuffer.color;
|
return colorBuffer.color;
|
||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
|
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
|
||||||
|
|
Loading…
Reference in New Issue