Remove [[block]] attribute from all shaders
This has been removed from WGSL and is now deprecated in Tint. Bug: tint:1324 Change-Id: Ic187ce3c5ce0723db6f3ca6483e9f5e73ce27acc Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/72880 Auto-Submit: James Price <jrprice@google.com> Reviewed-by: Corentin Wallez <cwallez@google.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
16ae3b8b95
commit
d4f8c39f52
|
@ -58,7 +58,7 @@ void init() {
|
|||
640, 480);
|
||||
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Constants {
|
||||
struct Constants {
|
||||
scale : f32;
|
||||
time : f32;
|
||||
offsetX : f32;
|
||||
|
|
|
@ -151,7 +151,7 @@ void initSim() {
|
|||
pos : vec2<f32>;
|
||||
vel : vec2<f32>;
|
||||
};
|
||||
[[block]] struct SimParams {
|
||||
struct SimParams {
|
||||
deltaT : f32;
|
||||
rule1Distance : f32;
|
||||
rule2Distance : f32;
|
||||
|
@ -161,7 +161,7 @@ void initSim() {
|
|||
rule3Scale : f32;
|
||||
particleCount : u32;
|
||||
};
|
||||
[[block]] struct Particles {
|
||||
struct Particles {
|
||||
particles : array<Particle>;
|
||||
};
|
||||
[[binding(0), group(0)]] var<uniform> params : SimParams;
|
||||
|
|
|
@ -45,18 +45,18 @@ namespace dawn_native {
|
|||
// Type 'bool' cannot be used in storage class 'uniform' as it is non-host-shareable.
|
||||
Ref<ShaderModuleBase> shaderModule;
|
||||
DAWN_TRY_ASSIGN(shaderModule, utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct UniformParams {
|
||||
struct UniformParams {
|
||||
maxComputeWorkgroupsPerDimension: u32;
|
||||
clientOffsetInU32: u32;
|
||||
enableValidation: u32;
|
||||
duplicateNumWorkgroups: u32;
|
||||
};
|
||||
|
||||
[[block]] struct IndirectParams {
|
||||
struct IndirectParams {
|
||||
data: array<u32>;
|
||||
};
|
||||
|
||||
[[block]] struct ValidatedParams {
|
||||
struct ValidatedParams {
|
||||
data: array<u32>;
|
||||
};
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace dawn_native {
|
|||
padding: u32;
|
||||
};
|
||||
|
||||
[[block]] struct Uniforms { // offset align size
|
||||
struct Uniforms { // offset align size
|
||||
scale: vec2<f32>; // 0 8 8
|
||||
offset: vec2<f32>; // 8 8 8
|
||||
steps_mask: u32; // 16 4 4
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace dawn_native {
|
|||
let kBaseVertexEntry = 3u;
|
||||
let kFirstInstanceEntry = 4u;
|
||||
|
||||
[[block]] struct BatchInfo {
|
||||
struct BatchInfo {
|
||||
numIndexBufferElementsLow: u32;
|
||||
numIndexBufferElementsHigh: u32;
|
||||
numDraws: u32;
|
||||
|
@ -61,7 +61,7 @@ namespace dawn_native {
|
|||
indirectOffsets: array<u32>;
|
||||
};
|
||||
|
||||
[[block]] struct IndirectParams {
|
||||
struct IndirectParams {
|
||||
data: array<u32>;
|
||||
};
|
||||
|
||||
|
|
|
@ -40,15 +40,15 @@ namespace dawn_native {
|
|||
high : u32;
|
||||
};
|
||||
|
||||
[[block]] struct TimestampArr {
|
||||
struct TimestampArr {
|
||||
t : array<Timestamp>;
|
||||
};
|
||||
|
||||
[[block]] struct AvailabilityArr {
|
||||
struct AvailabilityArr {
|
||||
v : array<u32>;
|
||||
};
|
||||
|
||||
[[block]] struct TimestampParams {
|
||||
struct TimestampParams {
|
||||
first : u32;
|
||||
count : u32;
|
||||
offset : u32;
|
||||
|
|
|
@ -1146,7 +1146,7 @@ std::ostringstream& DawnTestBase::ExpectSampledFloatDataImpl(wgpu::TextureView t
|
|||
shaderSource << "let width : u32 = " << width << "u;\n";
|
||||
shaderSource << "[[group(0), binding(0)]] var tex : " << wgslTextureType << ";\n";
|
||||
shaderSource << R"(
|
||||
[[block]] struct Result {
|
||||
struct Result {
|
||||
values : array<f32>;
|
||||
};
|
||||
[[group(0), binding(1)]] var<storage, read_write> result : Result;
|
||||
|
|
|
@ -67,7 +67,7 @@ class BindGroupTests : public DawnTest {
|
|||
|
||||
std::ostringstream fs;
|
||||
for (size_t i = 0; i < bindingTypes.size(); ++i) {
|
||||
fs << "[[block]] struct Buffer" << i << R"( {
|
||||
fs << "struct Buffer" << i << R"( {
|
||||
color : vec4<f32>;
|
||||
};)";
|
||||
|
||||
|
@ -129,7 +129,7 @@ class BindGroupTests : public DawnTest {
|
|||
// This test passes by not asserting or crashing.
|
||||
TEST_P(BindGroupTests, ReusedBindGroupSingleSubmit) {
|
||||
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Contents {
|
||||
struct Contents {
|
||||
f : f32;
|
||||
};
|
||||
[[group(0), binding(0)]] var <uniform> contents: Contents;
|
||||
|
@ -164,7 +164,7 @@ TEST_P(BindGroupTests, ReusedUBO) {
|
|||
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||
// TODO(crbug.com/tint/369): Use a mat2x2 when Tint translates it correctly.
|
||||
[[block]] struct VertexUniformBuffer {
|
||||
struct VertexUniformBuffer {
|
||||
transform : vec4<f32>;
|
||||
};
|
||||
|
||||
|
@ -182,7 +182,7 @@ TEST_P(BindGroupTests, ReusedUBO) {
|
|||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct FragmentUniformBuffer {
|
||||
struct FragmentUniformBuffer {
|
||||
color : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(1)]] var <uniform> fragmentUbo : FragmentUniformBuffer;
|
||||
|
@ -242,7 +242,7 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
|
|||
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||
// TODO(crbug.com/tint/369): Use a mat2x2 when Tint translates it correctly.
|
||||
[[block]] struct VertexUniformBuffer {
|
||||
struct VertexUniformBuffer {
|
||||
transform : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var <uniform> vertexUbo : VertexUniformBuffer;
|
||||
|
@ -345,7 +345,7 @@ TEST_P(BindGroupTests, MultipleBindLayouts) {
|
|||
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||
// TODO(crbug.com/tint/369): Use a mat2x2 when Tint translates it correctly.
|
||||
[[block]] struct VertexUniformBuffer {
|
||||
struct VertexUniformBuffer {
|
||||
transform : vec4<f32>;
|
||||
};
|
||||
|
||||
|
@ -366,7 +366,7 @@ TEST_P(BindGroupTests, MultipleBindLayouts) {
|
|||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct FragmentUniformBuffer {
|
||||
struct FragmentUniformBuffer {
|
||||
color : vec4<f32>;
|
||||
};
|
||||
|
||||
|
@ -435,7 +435,7 @@ TEST_P(BindGroupTests, MultipleBindLayouts) {
|
|||
// This test passes by not asserting or crashing.
|
||||
TEST_P(BindGroupTests, MultipleEntryPointsWithMultipleNonZeroGroups) {
|
||||
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Contents {
|
||||
struct Contents {
|
||||
f : f32;
|
||||
};
|
||||
[[group(0), binding(0)]] var <uniform> contents0: Contents;
|
||||
|
@ -1035,11 +1035,11 @@ TEST_P(BindGroupTests, DynamicOffsetOrder) {
|
|||
|
||||
wgpu::ComputePipelineDescriptor pipelineDescriptor;
|
||||
pipelineDescriptor.compute.module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Buffer {
|
||||
struct Buffer {
|
||||
value : u32;
|
||||
};
|
||||
|
||||
[[block]] struct OutputBuffer {
|
||||
struct OutputBuffer {
|
||||
value : vec3<u32>;
|
||||
};
|
||||
|
||||
|
@ -1118,11 +1118,11 @@ TEST_P(BindGroupTests, DynamicAndNonDynamicBindingsDoNotConflictAfterRemapping)
|
|||
|
||||
wgpu::ComputePipelineDescriptor pipelineDescriptor;
|
||||
pipelineDescriptor.compute.module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Buffer {
|
||||
struct Buffer {
|
||||
value : u32;
|
||||
};
|
||||
|
||||
[[block]] struct OutputBuffer {
|
||||
struct OutputBuffer {
|
||||
value : vec2<u32>;
|
||||
};
|
||||
|
||||
|
@ -1244,7 +1244,7 @@ TEST_P(BindGroupTests, ArbitraryBindingNumbers) {
|
|||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Ubo {
|
||||
struct Ubo {
|
||||
color : vec4<f32>;
|
||||
};
|
||||
|
||||
|
@ -1386,7 +1386,7 @@ TEST_P(BindGroupTests, ReadonlyStorage) {
|
|||
})");
|
||||
|
||||
pipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Buffer0 {
|
||||
struct Buffer0 {
|
||||
color : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<storage, read> buffer0 : Buffer0;
|
||||
|
@ -1501,7 +1501,7 @@ TEST_P(BindGroupTests, ReallyLargeBindGroup) {
|
|||
device, wgpu::BufferUsage::Uniform, {expectedValue, 0, 0, 0});
|
||||
bgEntries.push_back({nullptr, binding, buffer, 0, 4 * sizeof(uint32_t), nullptr, nullptr});
|
||||
|
||||
interface << "[[block]] struct UniformBuffer" << i << R"({
|
||||
interface << "struct UniformBuffer" << i << R"({
|
||||
value : u32;
|
||||
};
|
||||
)";
|
||||
|
@ -1518,7 +1518,7 @@ TEST_P(BindGroupTests, ReallyLargeBindGroup) {
|
|||
device, wgpu::BufferUsage::Storage, {expectedValue});
|
||||
bgEntries.push_back({nullptr, binding, buffer, 0, sizeof(uint32_t), nullptr, nullptr});
|
||||
|
||||
interface << "[[block]] struct ReadOnlyStorageBuffer" << i << R"({
|
||||
interface << "struct ReadOnlyStorageBuffer" << i << R"({
|
||||
value : u32;
|
||||
};
|
||||
)";
|
||||
|
@ -1534,7 +1534,7 @@ TEST_P(BindGroupTests, ReallyLargeBindGroup) {
|
|||
device, wgpu::BufferUsage::Storage | wgpu::BufferUsage::CopySrc, {0});
|
||||
bgEntries.push_back({nullptr, binding, result, 0, sizeof(uint32_t), nullptr, nullptr});
|
||||
|
||||
interface << R"([[block]] struct ReadWriteStorageBuffer{
|
||||
interface << R"(struct ReadWriteStorageBuffer{
|
||||
value : u32;
|
||||
};
|
||||
)";
|
||||
|
|
|
@ -997,7 +997,7 @@ TEST_P(BufferZeroInitTest, BoundAsUniformBuffer) {
|
|||
|
||||
constexpr uint32_t kBoundBufferSize = 16u;
|
||||
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct UBO {
|
||||
struct UBO {
|
||||
value : vec4<u32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> ubo : UBO;
|
||||
|
@ -1036,7 +1036,7 @@ TEST_P(BufferZeroInitTest, BoundAsReadonlyStorageBuffer) {
|
|||
|
||||
constexpr uint32_t kBoundBufferSize = 16u;
|
||||
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct SSBO {
|
||||
struct SSBO {
|
||||
value : vec4<u32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<storage, read> ssbo : SSBO;
|
||||
|
@ -1075,7 +1075,7 @@ TEST_P(BufferZeroInitTest, BoundAsStorageBuffer) {
|
|||
|
||||
constexpr uint32_t kBoundBufferSize = 32u;
|
||||
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct SSBO {
|
||||
struct SSBO {
|
||||
value : array<vec4<u32>, 2>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<storage, read_write> ssbo : SSBO;
|
||||
|
|
|
@ -61,7 +61,7 @@ class ColorStateTest : public DawnTest {
|
|||
// attachment. basePipeline has no blending
|
||||
void SetupSingleSourcePipelines(wgpu::ColorTargetState colorTargetState) {
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct MyBlock {
|
||||
struct MyBlock {
|
||||
color : vec4<f32>;
|
||||
};
|
||||
|
||||
|
@ -791,7 +791,7 @@ TEST_P(ColorStateTest, IndependentColorState) {
|
|||
{renderTargetViews[0], renderTargetViews[1], renderTargetViews[2], renderTargetViews[3]});
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct MyBlock {
|
||||
struct MyBlock {
|
||||
color0 : vec4<f32>;
|
||||
color1 : vec4<f32>;
|
||||
color2 : vec4<f32>;
|
||||
|
@ -915,7 +915,7 @@ TEST_P(ColorStateTest, IndependentColorState) {
|
|||
// Test that the default blend color is correctly set at the beginning of every subpass
|
||||
TEST_P(ColorStateTest, DefaultBlendColor) {
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct MyBlock {
|
||||
struct MyBlock {
|
||||
color : vec4<f32>;
|
||||
};
|
||||
|
||||
|
@ -1041,7 +1041,7 @@ TEST_P(ColorStateTest, DefaultBlendColor) {
|
|||
// attachment.
|
||||
TEST_P(ColorStateTest, ColorWriteMaskDoesNotAffectRenderPassLoadOpClear) {
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct MyBlock {
|
||||
struct MyBlock {
|
||||
color : vec4<f32>;
|
||||
};
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ void ComputeCopyStorageBufferTests::BasicTest(const char* shader) {
|
|||
// Test that a trivial compute-shader memcpy implementation works.
|
||||
TEST_P(ComputeCopyStorageBufferTests, SizedArrayOfBasic) {
|
||||
BasicTest(R"(
|
||||
[[block]] struct Buf {
|
||||
struct Buf {
|
||||
s : array<vec4<u32>, 4>;
|
||||
};
|
||||
|
||||
|
@ -111,7 +111,7 @@ TEST_P(ComputeCopyStorageBufferTests, SizedArrayOfStruct) {
|
|||
b : vec2<u32>;
|
||||
};
|
||||
|
||||
[[block]] struct Buf {
|
||||
struct Buf {
|
||||
s : array<S, 4>;
|
||||
};
|
||||
|
||||
|
@ -129,7 +129,7 @@ TEST_P(ComputeCopyStorageBufferTests, SizedArrayOfStruct) {
|
|||
// Test that a trivial compute-shader memcpy implementation works.
|
||||
TEST_P(ComputeCopyStorageBufferTests, UnsizedArrayOfBasic) {
|
||||
BasicTest(R"(
|
||||
[[block]] struct Buf {
|
||||
struct Buf {
|
||||
s : array<vec4<u32>>;
|
||||
};
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ class ComputeDispatchTests : public DawnTest {
|
|||
// Write workgroup number into the output buffer if we saw the biggest dispatch
|
||||
// To make sure the dispatch was not called, write maximum u32 value for 0 dispatches
|
||||
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct OutputBuf {
|
||||
struct OutputBuf {
|
||||
workGroups : vec3<u32>;
|
||||
};
|
||||
|
||||
|
@ -54,10 +54,10 @@ class ComputeDispatchTests : public DawnTest {
|
|||
|
||||
// Test the use of the compute pipelines without using [[num_workgroups]]
|
||||
wgpu::ShaderModule moduleWithoutNumWorkgroups = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct InputBuf {
|
||||
struct InputBuf {
|
||||
expectedDispatch : vec3<u32>;
|
||||
};
|
||||
[[block]] struct OutputBuf {
|
||||
struct OutputBuf {
|
||||
workGroups : vec3<u32>;
|
||||
};
|
||||
|
||||
|
|
|
@ -174,17 +174,17 @@ struct Data {
|
|||
footer : u32;
|
||||
};
|
||||
|
||||
[[block]] struct Input {
|
||||
struct Input {
|
||||
header : u32;
|
||||
{data_align}data : Data;
|
||||
{footer_align}footer : u32;
|
||||
};
|
||||
|
||||
[[block]] struct Output {
|
||||
struct Output {
|
||||
data : {field_type};
|
||||
};
|
||||
|
||||
[[block]] struct Status {
|
||||
struct Status {
|
||||
code : u32;
|
||||
};
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ TEST_P(ComputeSharedMemoryTests, Basic) {
|
|||
let kTileSize : u32 = 4u;
|
||||
let kInstances : u32 = 11u;
|
||||
|
||||
[[block]] struct Dst {
|
||||
struct Dst {
|
||||
x : u32;
|
||||
};
|
||||
|
||||
|
@ -110,7 +110,7 @@ TEST_P(ComputeSharedMemoryTests, AssortedTypes) {
|
|||
m: mat2x2<f32>;
|
||||
};
|
||||
|
||||
[[block]] struct Dst {
|
||||
struct Dst {
|
||||
d_struct : StructValues;
|
||||
d_matrix : mat2x2<f32>;
|
||||
d_array : array<u32, 4>;
|
||||
|
|
|
@ -32,7 +32,7 @@ TEST_P(ComputeStorageBufferBarrierTests, AddIncrement) {
|
|||
device, data.data(), bufferSize, wgpu::BufferUsage::Storage | wgpu::BufferUsage::CopySrc);
|
||||
|
||||
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Buf {
|
||||
struct Buf {
|
||||
data : array<u32, 100>;
|
||||
};
|
||||
|
||||
|
@ -82,7 +82,7 @@ TEST_P(ComputeStorageBufferBarrierTests, AddPingPong) {
|
|||
device, data.data(), bufferSize, wgpu::BufferUsage::Storage | wgpu::BufferUsage::CopySrc);
|
||||
|
||||
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Buf {
|
||||
struct Buf {
|
||||
data : array<u32, 100>;
|
||||
};
|
||||
|
||||
|
@ -148,7 +148,7 @@ TEST_P(ComputeStorageBufferBarrierTests, StorageAndReadonlyStoragePingPongInOneP
|
|||
device, data.data(), bufferSize, wgpu::BufferUsage::Storage | wgpu::BufferUsage::CopySrc);
|
||||
|
||||
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Buf {
|
||||
struct Buf {
|
||||
data : array<u32, 100>;
|
||||
};
|
||||
|
||||
|
@ -216,7 +216,7 @@ TEST_P(ComputeStorageBufferBarrierTests, UniformToStorageAddPingPong) {
|
|||
wgpu::BufferUsage::Storage | wgpu::BufferUsage::Uniform | wgpu::BufferUsage::CopySrc);
|
||||
|
||||
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Buf {
|
||||
struct Buf {
|
||||
data : array<vec4<u32>, 25>;
|
||||
};
|
||||
|
||||
|
@ -284,7 +284,7 @@ TEST_P(ComputeStorageBufferBarrierTests, UniformToStorageAddPingPongInOnePass) {
|
|||
wgpu::BufferUsage::Storage | wgpu::BufferUsage::Uniform | wgpu::BufferUsage::CopySrc);
|
||||
|
||||
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Buf {
|
||||
struct Buf {
|
||||
data : array<vec4<u32>, 25>;
|
||||
};
|
||||
|
||||
|
@ -342,7 +342,7 @@ TEST_P(ComputeStorageBufferBarrierTests, IndirectBufferCorrectBarrier) {
|
|||
wgpu::ComputePipelineDescriptor step2PipelineDesc;
|
||||
step2PipelineDesc.compute.entryPoint = "main";
|
||||
step2PipelineDesc.compute.module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Buf {
|
||||
struct Buf {
|
||||
data : array<u32, 3>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<storage, read_write> buf : Buf;
|
||||
|
@ -356,12 +356,12 @@ TEST_P(ComputeStorageBufferBarrierTests, IndirectBufferCorrectBarrier) {
|
|||
wgpu::ComputePipelineDescriptor step3PipelineDesc;
|
||||
step3PipelineDesc.compute.entryPoint = "main";
|
||||
step3PipelineDesc.compute.module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Buf {
|
||||
struct Buf {
|
||||
data : array<u32, 3>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<storage, read> buf : Buf;
|
||||
|
||||
[[block]] struct Result {
|
||||
struct Result {
|
||||
data : u32;
|
||||
};
|
||||
[[group(0), binding(1)]] var<storage, read_write> result : Result;
|
||||
|
|
|
@ -247,7 +247,7 @@ class CopyTextureForBrowserTests : public Parent {
|
|||
// comparing a value generated on CPU to the one generated on GPU.
|
||||
wgpu::ComputePipeline MakeTestPipeline() {
|
||||
wgpu::ShaderModule csModule = utils::CreateShaderModule(this->device, R"(
|
||||
[[block]] struct Uniforms {
|
||||
struct Uniforms {
|
||||
dstTextureFlipY : u32;
|
||||
channelCount : u32;
|
||||
srcCopyOrigin : vec2<u32>;
|
||||
|
@ -255,7 +255,7 @@ class CopyTextureForBrowserTests : public Parent {
|
|||
copySize : vec2<u32>;
|
||||
alphaOp : u32;
|
||||
};
|
||||
[[block]] struct OutputBuf {
|
||||
struct OutputBuf {
|
||||
result : array<u32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var src : texture_2d<f32>;
|
||||
|
|
|
@ -133,7 +133,7 @@ class CreatePipelineAsyncTest : public DawnTest {
|
|||
TEST_P(CreatePipelineAsyncTest, BasicUseOfCreateComputePipelineAsync) {
|
||||
wgpu::ComputePipelineDescriptor csDesc;
|
||||
csDesc.compute.module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct SSBO {
|
||||
struct SSBO {
|
||||
value : u32;
|
||||
};
|
||||
[[group(0), binding(0)]] var<storage, read_write> ssbo : SSBO;
|
||||
|
@ -163,7 +163,7 @@ TEST_P(CreatePipelineAsyncTest, BasicUseOfCreateComputePipelineAsync) {
|
|||
TEST_P(CreatePipelineAsyncTest, ReleaseEntryPointAfterCreatComputePipelineAsync) {
|
||||
wgpu::ComputePipelineDescriptor csDesc;
|
||||
csDesc.compute.module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct SSBO {
|
||||
struct SSBO {
|
||||
value : u32;
|
||||
};
|
||||
[[group(0), binding(0)]] var<storage, read_write> ssbo : SSBO;
|
||||
|
@ -202,7 +202,7 @@ TEST_P(CreatePipelineAsyncTest, CreateComputePipelineFailed) {
|
|||
|
||||
wgpu::ComputePipelineDescriptor csDesc;
|
||||
csDesc.compute.module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct SSBO {
|
||||
struct SSBO {
|
||||
value : u32;
|
||||
};
|
||||
[[group(0), binding(0)]] var<storage, read_write> ssbo : SSBO;
|
||||
|
@ -482,7 +482,7 @@ TEST_P(CreatePipelineAsyncTest, DestroyDeviceBeforeCallbackOfCreateRenderPipelin
|
|||
TEST_P(CreatePipelineAsyncTest, CreateSameComputePipelineTwice) {
|
||||
wgpu::ComputePipelineDescriptor csDesc;
|
||||
csDesc.compute.module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct SSBO {
|
||||
struct SSBO {
|
||||
value : u32;
|
||||
};
|
||||
[[group(0), binding(0)]] var<storage, read_write> ssbo : SSBO;
|
||||
|
@ -541,7 +541,7 @@ TEST_P(CreatePipelineAsyncTest, CreateSameComputePipelineTwiceAtSameTime) {
|
|||
wgpu::ComputePipelineDescriptor csDesc;
|
||||
csDesc.layout = pipelineLayout;
|
||||
csDesc.compute.module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct SSBO {
|
||||
struct SSBO {
|
||||
value : u32;
|
||||
};
|
||||
[[group(0), binding(0)]] var<storage, read_write> ssbo : SSBO;
|
||||
|
|
|
@ -208,7 +208,7 @@ TEST_P(D3D12CachingTests, ReuseShaderWithMultipleEntryPointsPerStage) {
|
|||
// of HLSL shaders. WGSL shader should result into caching 1 HLSL shader (stage x entrypoints)
|
||||
TEST_P(D3D12CachingTests, ReuseShaderWithMultipleEntryPoints) {
|
||||
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Data {
|
||||
struct Data {
|
||||
data : u32;
|
||||
};
|
||||
[[binding(0), group(0)]] var<storage, read_write> data : Data;
|
||||
|
|
|
@ -70,10 +70,10 @@ class DepthStencilSamplingTest : public DawnTest {
|
|||
std::ostringstream& shaderBody) {
|
||||
shaderSource << "type StencilValues = array<u32, " << components.size() << ">;\n";
|
||||
shaderSource << R"(
|
||||
[[block]] struct DepthResult {
|
||||
struct DepthResult {
|
||||
value : f32;
|
||||
};
|
||||
[[block]] struct StencilResult {
|
||||
struct StencilResult {
|
||||
values : StencilValues;
|
||||
};)";
|
||||
shaderSource << "\n";
|
||||
|
@ -181,7 +181,7 @@ class DepthStencilSamplingTest : public DawnTest {
|
|||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
[[group(0), binding(0)]] var samp : sampler_comparison;
|
||||
[[group(0), binding(1)]] var tex : texture_depth_2d;
|
||||
[[block]] struct Uniforms {
|
||||
struct Uniforms {
|
||||
compareRef : f32;
|
||||
};
|
||||
[[group(0), binding(2)]] var<uniform> uniforms : Uniforms;
|
||||
|
@ -203,12 +203,12 @@ class DepthStencilSamplingTest : public DawnTest {
|
|||
wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"(
|
||||
[[group(0), binding(0)]] var samp : sampler_comparison;
|
||||
[[group(0), binding(1)]] var tex : texture_depth_2d;
|
||||
[[block]] struct Uniforms {
|
||||
struct Uniforms {
|
||||
compareRef : f32;
|
||||
};
|
||||
[[group(0), binding(2)]] var<uniform> uniforms : Uniforms;
|
||||
|
||||
[[block]] struct SamplerResult {
|
||||
struct SamplerResult {
|
||||
value : f32;
|
||||
};
|
||||
[[group(0), binding(3)]] var<storage, read_write> samplerResult : SamplerResult;
|
||||
|
|
|
@ -56,7 +56,7 @@ class DepthStencilStateTest : public DawnTest {
|
|||
depthTextureView = depthTexture.CreateView();
|
||||
|
||||
vsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct UBO {
|
||||
struct UBO {
|
||||
color : vec3<f32>;
|
||||
depth : f32;
|
||||
};
|
||||
|
@ -75,7 +75,7 @@ class DepthStencilStateTest : public DawnTest {
|
|||
})");
|
||||
|
||||
fsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct UBO {
|
||||
struct UBO {
|
||||
color : vec3<f32>;
|
||||
depth : f32;
|
||||
};
|
||||
|
|
|
@ -112,7 +112,7 @@ TEST_P(DeviceLostTest, CreateBindGroupLayoutFails) {
|
|||
// Test that GetBindGroupLayout fails when device is lost
|
||||
TEST_P(DeviceLostTest, GetBindGroupLayoutFails) {
|
||||
wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct UniformBuffer {
|
||||
struct UniformBuffer {
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> ubo : UniformBuffer;
|
||||
|
|
|
@ -595,8 +595,8 @@ TEST_P(DrawIndexedIndirectTest, ValidateReusedBundleWithChangingParams) {
|
|||
|
||||
wgpu::ShaderModule paramWriterModule = utils::CreateShaderModule(device,
|
||||
R"(
|
||||
[[block]] struct Input { firstIndex: u32; };
|
||||
[[block]] struct Params {
|
||||
struct Input { firstIndex: u32; };
|
||||
struct Params {
|
||||
indexCount: u32;
|
||||
instanceCount: u32;
|
||||
firstIndex: u32;
|
||||
|
|
|
@ -115,7 +115,7 @@ class DynamicBufferOffsetTests : public DawnTest {
|
|||
std::ostringstream fs;
|
||||
std::string multipleNumber = isInheritedPipeline ? "2" : "1";
|
||||
fs << R"(
|
||||
[[block]] struct Buf {
|
||||
struct Buf {
|
||||
value : vec2<u32>;
|
||||
};
|
||||
|
||||
|
@ -165,7 +165,7 @@ class DynamicBufferOffsetTests : public DawnTest {
|
|||
std::ostringstream cs;
|
||||
std::string multipleNumber = isInheritedPipeline ? "2" : "1";
|
||||
cs << R"(
|
||||
[[block]] struct Buf {
|
||||
struct Buf {
|
||||
value : vec2<u32>;
|
||||
};
|
||||
|
||||
|
@ -453,7 +453,7 @@ TEST_P(ClampedOOBDynamicBufferOffsetTests, CheckOOBAccess) {
|
|||
switch (GetParam().mReadBufferUsage) {
|
||||
case wgpu::BufferUsage::Uniform:
|
||||
shader << R"(
|
||||
[[block]] struct Src {
|
||||
struct Src {
|
||||
values : array<vec4<u32>, kArrayLength>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> src : Src;
|
||||
|
@ -461,7 +461,7 @@ TEST_P(ClampedOOBDynamicBufferOffsetTests, CheckOOBAccess) {
|
|||
break;
|
||||
case wgpu::BufferUsage::Storage:
|
||||
shader << R"(
|
||||
[[block]] struct Src {
|
||||
struct Src {
|
||||
values : array<vec4<u32>>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<storage, read> src : Src;
|
||||
|
@ -472,7 +472,7 @@ TEST_P(ClampedOOBDynamicBufferOffsetTests, CheckOOBAccess) {
|
|||
}
|
||||
|
||||
shader << R"(
|
||||
[[block]] struct Dst {
|
||||
struct Dst {
|
||||
values : array<vec4<u32>>;
|
||||
};
|
||||
[[group(0), binding(1)]] var<storage, read_write> dst : Dst;
|
||||
|
|
|
@ -78,7 +78,7 @@ TEST_P(EntryPointTests, TwoComputeInModule) {
|
|||
wgpu::PipelineLayout pipelineLayout = device.CreatePipelineLayout(&pipelineLayoutDesc);
|
||||
|
||||
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Data {
|
||||
struct Data {
|
||||
data : u32;
|
||||
};
|
||||
[[binding(0), group(0)]] var<storage, read_write> data : Data;
|
||||
|
|
|
@ -127,7 +127,7 @@ struct VertexOutputs {
|
|||
})";
|
||||
|
||||
std::string fragmentShader = R"(
|
||||
[[block]] struct IndexVals {
|
||||
struct IndexVals {
|
||||
vertex_index : atomic<u32>;
|
||||
instance_index : atomic<u32>;
|
||||
};
|
||||
|
|
|
@ -36,7 +36,7 @@ class GpuMemorySyncTests : public DawnTest {
|
|||
std::tuple<wgpu::ComputePipeline, wgpu::BindGroup> CreatePipelineAndBindGroupForCompute(
|
||||
const wgpu::Buffer& buffer) {
|
||||
wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Data {
|
||||
struct Data {
|
||||
a : i32;
|
||||
};
|
||||
[[group(0), binding(0)]] var<storage, read_write> data : Data;
|
||||
|
@ -63,7 +63,7 @@ class GpuMemorySyncTests : public DawnTest {
|
|||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Data {
|
||||
struct Data {
|
||||
i : i32;
|
||||
};
|
||||
[[group(0), binding(0)]] var<storage, read_write> data : Data;
|
||||
|
@ -243,7 +243,7 @@ class StorageToUniformSyncTests : public DawnTest {
|
|||
|
||||
std::tuple<wgpu::ComputePipeline, wgpu::BindGroup> CreatePipelineAndBindGroupForCompute() {
|
||||
wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Data {
|
||||
struct Data {
|
||||
a : f32;
|
||||
};
|
||||
[[group(0), binding(0)]] var<storage, read_write> data : Data;
|
||||
|
@ -269,7 +269,7 @@ class StorageToUniformSyncTests : public DawnTest {
|
|||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Contents {
|
||||
struct Contents {
|
||||
color : f32;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> contents : Contents;
|
||||
|
@ -440,17 +440,17 @@ class MultipleWriteThenMultipleReadTests : public DawnTest {
|
|||
TEST_P(MultipleWriteThenMultipleReadTests, SeparateBuffers) {
|
||||
// Create pipeline, bind group, and different buffers for compute pass.
|
||||
wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct VBContents {
|
||||
struct VBContents {
|
||||
pos : array<vec4<f32>, 4>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<storage, read_write> vbContents : VBContents;
|
||||
|
||||
[[block]] struct IBContents {
|
||||
struct IBContents {
|
||||
indices : array<vec4<i32>, 2>;
|
||||
};
|
||||
[[group(0), binding(1)]] var<storage, read_write> ibContents : IBContents;
|
||||
|
||||
[[block]] struct ColorContents {
|
||||
struct ColorContents {
|
||||
color : f32;
|
||||
};
|
||||
[[group(0), binding(2)]] var<storage, read_write> uniformContents : ColorContents;
|
||||
|
@ -503,7 +503,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, SeparateBuffers) {
|
|||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Buf {
|
||||
struct Buf {
|
||||
color : f32;
|
||||
};
|
||||
|
||||
|
@ -562,7 +562,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, OneBuffer) {
|
|||
|
||||
// Create pipeline, bind group, and a complex buffer for compute pass.
|
||||
wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Contents {
|
||||
struct Contents {
|
||||
[[align(256)]] pos : array<vec4<f32>, 4>;
|
||||
[[align(256)]] indices : array<vec4<i32>, 2>;
|
||||
[[align(256)]] color0 : f32;
|
||||
|
@ -620,7 +620,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, OneBuffer) {
|
|||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Buf {
|
||||
struct Buf {
|
||||
color : f32;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uniformBuffer : Buf;
|
||||
|
|
|
@ -33,7 +33,7 @@ TEST_P(MaxLimitTests, MaxComputeWorkgroupStorageSize) {
|
|||
GetSupportedLimits().limits.maxComputeWorkgroupStorageSize;
|
||||
|
||||
std::string shader = R"(
|
||||
[[block]] struct Dst {
|
||||
struct Dst {
|
||||
value0 : u32;
|
||||
value1 : u32;
|
||||
};
|
||||
|
@ -129,11 +129,11 @@ TEST_P(MaxLimitTests, MaxBufferBindingSize) {
|
|||
std::min(maxBufferBindingSize, uint64_t(512) * 1024 * 1024);
|
||||
}
|
||||
shader = R"(
|
||||
[[block]] struct Buf {
|
||||
struct Buf {
|
||||
values : array<u32>;
|
||||
};
|
||||
|
||||
[[block]] struct Result {
|
||||
struct Result {
|
||||
value0 : u32;
|
||||
value1 : u32;
|
||||
};
|
||||
|
@ -156,7 +156,7 @@ TEST_P(MaxLimitTests, MaxBufferBindingSize) {
|
|||
uint64_t(std::numeric_limits<int32_t>::max()) + 8);
|
||||
|
||||
shader = R"(
|
||||
[[block]] struct Buf {
|
||||
struct Buf {
|
||||
value0 : u32;
|
||||
// padding such that value0 and value1 are the first and last bytes of the memory.
|
||||
[[size()" +
|
||||
|
@ -164,7 +164,7 @@ TEST_P(MaxLimitTests, MaxBufferBindingSize) {
|
|||
value1 : u32;
|
||||
};
|
||||
|
||||
[[block]] struct Result {
|
||||
struct Result {
|
||||
value0 : u32;
|
||||
value1 : u32;
|
||||
};
|
||||
|
|
|
@ -45,7 +45,7 @@ class MultisampledRenderingTest : public DawnTest {
|
|||
bool alphaToCoverageEnabled = false,
|
||||
bool flipTriangle = false) {
|
||||
const char* kFsOneOutputWithDepth = R"(
|
||||
[[block]] struct U {
|
||||
struct U {
|
||||
color : vec4<f32>;
|
||||
depth : f32;
|
||||
};
|
||||
|
@ -64,7 +64,7 @@ class MultisampledRenderingTest : public DawnTest {
|
|||
})";
|
||||
|
||||
const char* kFsOneOutputWithoutDepth = R"(
|
||||
[[block]] struct U {
|
||||
struct U {
|
||||
color : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uBuffer : U;
|
||||
|
@ -83,7 +83,7 @@ class MultisampledRenderingTest : public DawnTest {
|
|||
uint32_t sampleMask = 0xFFFFFFFF,
|
||||
bool alphaToCoverageEnabled = false) {
|
||||
const char* kFsTwoOutputs = R"(
|
||||
[[block]] struct U {
|
||||
struct U {
|
||||
color0 : vec4<f32>;
|
||||
color1 : vec4<f32>;
|
||||
};
|
||||
|
@ -777,7 +777,7 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DTextureWithSampleMaskAndShaderOut
|
|||
constexpr float kMSAACoverage = 0.25f;
|
||||
constexpr uint32_t kSampleMask = kFirstSampleMaskBit | kThirdSampleMaskBit;
|
||||
const char* fs = R"(
|
||||
[[block]] struct U {
|
||||
struct U {
|
||||
color : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uBuffer : U;
|
||||
|
@ -838,7 +838,7 @@ TEST_P(MultisampledRenderingTest, ResolveIntoMultipleResolveTargetsWithShaderOut
|
|||
// only the first one is covered by the triangle.
|
||||
constexpr float kMSAACoverage = 0.25f;
|
||||
const char* fs = R"(
|
||||
[[block]] struct U {
|
||||
struct U {
|
||||
color0 : vec4<f32>;
|
||||
color1 : vec4<f32>;
|
||||
};
|
||||
|
|
|
@ -99,7 +99,7 @@ class MultisampledSamplingTest : public DawnTest {
|
|||
[[group(0), binding(0)]] var texture0 : texture_multisampled_2d<f32>;
|
||||
[[group(0), binding(1)]] var texture1 : texture_depth_multisampled_2d;
|
||||
|
||||
[[block]] struct Results {
|
||||
struct Results {
|
||||
colorSamples : array<f32, 4>;
|
||||
depthSamples : array<f32, 4>;
|
||||
};
|
||||
|
|
|
@ -53,7 +53,7 @@ class OpArrayLengthTest : public DawnTest {
|
|||
// Common shader code to use these buffers in shaders, assuming they are in bindgroup index
|
||||
// 0.
|
||||
mShaderInterface = R"(
|
||||
[[block]] struct DataBuffer {
|
||||
struct DataBuffer {
|
||||
data : [[stride(4)]] array<f32>;
|
||||
};
|
||||
|
||||
|
@ -70,7 +70,7 @@ class OpArrayLengthTest : public DawnTest {
|
|||
b : i32;
|
||||
};
|
||||
|
||||
[[block]] struct Buffer3 {
|
||||
struct Buffer3 {
|
||||
[[size(64)]] garbage : mat4x4<f32>;
|
||||
data : [[stride(8)]] array<Buffer3Data>;
|
||||
};
|
||||
|
@ -120,7 +120,7 @@ TEST_P(OpArrayLengthTest, Compute) {
|
|||
pipelineDesc.layout = pl;
|
||||
pipelineDesc.compute.entryPoint = "main";
|
||||
pipelineDesc.compute.module = utils::CreateShaderModule(device, (R"(
|
||||
[[block]] struct ResultBuffer {
|
||||
struct ResultBuffer {
|
||||
data : [[stride(4)]] array<u32, 3>;
|
||||
};
|
||||
[[group(1), binding(0)]] var<storage, read_write> result : ResultBuffer;
|
||||
|
|
|
@ -45,7 +45,7 @@ class DepthClampingTest : public DawnTest {
|
|||
depthTextureView = depthTexture.CreateView();
|
||||
|
||||
vsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct UBO {
|
||||
struct UBO {
|
||||
color : vec3<f32>;
|
||||
depth : f32;
|
||||
};
|
||||
|
@ -56,7 +56,7 @@ class DepthClampingTest : public DawnTest {
|
|||
})");
|
||||
|
||||
fsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct UBO {
|
||||
struct UBO {
|
||||
color : vec3<f32>;
|
||||
depth : f32;
|
||||
};
|
||||
|
|
|
@ -38,7 +38,7 @@ class RenderBundleTest : public DawnTest {
|
|||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Ubo {
|
||||
struct Ubo {
|
||||
color : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> fragmentUniformBuffer : Ubo;
|
||||
|
|
|
@ -38,7 +38,7 @@ class SamplerFilterAnisotropicTest : public DawnTest {
|
|||
mRenderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Uniforms {
|
||||
struct Uniforms {
|
||||
matrix : mat4x4<f32>;
|
||||
};
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ TEST_P(ShaderTests, ComputeLog2) {
|
|||
wgpu::Buffer buffer = CreateBuffer(kSteps);
|
||||
|
||||
std::string shader = R"(
|
||||
[[block]] struct Buf {
|
||||
struct Buf {
|
||||
data : array<u32, 19>;
|
||||
};
|
||||
|
||||
|
@ -335,7 +335,7 @@ struct Inputs {
|
|||
};
|
||||
|
||||
// [1] a binding point that conflicts with the regitster
|
||||
[[block]] struct S1 { data : array<vec4<u32>, 20>; };
|
||||
struct S1 { data : array<vec4<u32>, 20>; };
|
||||
[[group(0), binding(1)]] var<uniform> providedData1 : S1;
|
||||
|
||||
[[stage(vertex)]] fn vsMain(input : Inputs) -> [[builtin(position)]] vec4<f32> {
|
||||
|
@ -412,7 +412,7 @@ TEST_P(ShaderTests, OverridableConstants) {
|
|||
[[override]] let c9: u32 = 0u; // default override
|
||||
[[override]] let c10: u32 = 10u; // default
|
||||
|
||||
[[block]] struct Buf {
|
||||
struct Buf {
|
||||
data : array<u32, 11>;
|
||||
};
|
||||
|
||||
|
@ -482,7 +482,7 @@ TEST_P(ShaderTests, OverridableConstantsNumericIdentifiers) {
|
|||
[[override(1003)]] let c3: u32 = 3u; // default
|
||||
[[override(1004)]] let c4: u32; // default unspecified
|
||||
|
||||
[[block]] struct Buf {
|
||||
struct Buf {
|
||||
data : array<u32, 4>;
|
||||
};
|
||||
|
||||
|
@ -539,7 +539,7 @@ TEST_P(ShaderTests, OverridableConstantsPrecision) {
|
|||
[[override(1001)]] let c1: f32;
|
||||
[[override(1002)]] let c2: f32;
|
||||
|
||||
[[block]] struct Buf {
|
||||
struct Buf {
|
||||
data : array<f32, 2>;
|
||||
};
|
||||
|
||||
|
@ -593,7 +593,7 @@ TEST_P(ShaderTests, OverridableConstantsMultipleEntryPoints) {
|
|||
[[override(1001)]] let c1: u32;
|
||||
[[override(1002)]] let c2: u32;
|
||||
|
||||
[[block]] struct Buf {
|
||||
struct Buf {
|
||||
data : array<u32, 1>;
|
||||
};
|
||||
|
||||
|
|
|
@ -983,7 +983,7 @@ TEST_P(TextureZeroInitTest, ComputePassSampledTextureClear) {
|
|||
wgpu::ProgrammableStageDescriptor compute;
|
||||
const char* cs = R"(
|
||||
[[group(0), binding(0)]] var tex : texture_2d<f32>;
|
||||
[[block]] struct Result {
|
||||
struct Result {
|
||||
value : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(1)]] var<storage, read_write> result : Result;
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace {
|
|||
})";
|
||||
|
||||
constexpr char kFragmentShaderA[] = R"(
|
||||
[[block]] struct Uniforms {
|
||||
struct Uniforms {
|
||||
color : vec3<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uniforms : Uniforms;
|
||||
|
@ -48,10 +48,10 @@ namespace {
|
|||
})";
|
||||
|
||||
constexpr char kFragmentShaderB[] = R"(
|
||||
[[block]] struct Constants {
|
||||
struct Constants {
|
||||
color : vec3<f32>;
|
||||
};
|
||||
[[block]] struct Uniforms {
|
||||
struct Uniforms {
|
||||
color : vec3<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> constants : Constants;
|
||||
|
|
|
@ -20,12 +20,12 @@ namespace {
|
|||
constexpr uint32_t kTileSize = 32u;
|
||||
|
||||
const std::string& kMatMulFloatHeader = R"(
|
||||
[[block]] struct Uniforms {
|
||||
struct Uniforms {
|
||||
dimAOuter : u32;
|
||||
dimInner : u32;
|
||||
dimBOuter : u32;
|
||||
};
|
||||
[[block]] struct Matrix {
|
||||
struct Matrix {
|
||||
numbers: array<f32>;
|
||||
};
|
||||
|
||||
|
@ -187,12 +187,12 @@ namespace {
|
|||
|
||||
// The vec4 version requires that dimInner and dimBOuter are divisible by 4.
|
||||
const std::string& kMatMulVec4Header = R"(
|
||||
[[block]] struct Uniforms {
|
||||
struct Uniforms {
|
||||
dimAOuter : u32;
|
||||
dimInner : u32;
|
||||
dimBOuter : u32;
|
||||
};
|
||||
[[block]] struct Matrix {
|
||||
struct Matrix {
|
||||
numbers: array<vec4<f32>>;
|
||||
};
|
||||
|
||||
|
|
|
@ -1419,7 +1419,7 @@ class SetBindGroupValidationTest : public ValidationTest {
|
|||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct S {
|
||||
struct S {
|
||||
value : vec2<f32>;
|
||||
};
|
||||
|
||||
|
@ -1443,7 +1443,7 @@ class SetBindGroupValidationTest : public ValidationTest {
|
|||
|
||||
wgpu::ComputePipeline CreateComputePipeline() {
|
||||
wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct S {
|
||||
struct S {
|
||||
value : vec2<f32>;
|
||||
};
|
||||
|
||||
|
@ -1871,7 +1871,7 @@ class SetBindGroupPersistenceValidationTest : public ValidationTest {
|
|||
device.CreatePipelineLayout(&pipelineLayoutDescriptor);
|
||||
|
||||
std::stringstream ss;
|
||||
ss << "[[block]] struct S { value : vec2<f32>; };";
|
||||
ss << "struct S { value : vec2<f32>; };";
|
||||
|
||||
// Build a shader which has bindings that match the pipeline layout.
|
||||
for (uint32_t l = 0; l < layouts.size(); ++l) {
|
||||
|
@ -2051,7 +2051,7 @@ class BindGroupLayoutCompatibilityTest : public ValidationTest {
|
|||
|
||||
wgpu::RenderPipeline CreateRenderPipeline(std::vector<wgpu::BindGroupLayout> bindGroupLayouts) {
|
||||
return CreateFSRenderPipeline(R"(
|
||||
[[block]] struct S {
|
||||
struct S {
|
||||
value : vec2<f32>;
|
||||
};
|
||||
|
||||
|
@ -2086,7 +2086,7 @@ class BindGroupLayoutCompatibilityTest : public ValidationTest {
|
|||
wgpu::ComputePipeline CreateComputePipeline(
|
||||
std::vector<wgpu::BindGroupLayout> bindGroupLayouts) {
|
||||
return CreateComputePipeline(R"(
|
||||
[[block]] struct S {
|
||||
struct S {
|
||||
value : vec2<f32>;
|
||||
};
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ TEST_F(GetBindGroupLayoutTests, SameObject) {
|
|||
DAWN_SKIP_TEST_IF(UsesWire());
|
||||
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct S {
|
||||
struct S {
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uniform0 : S;
|
||||
|
@ -59,12 +59,12 @@ TEST_F(GetBindGroupLayoutTests, SameObject) {
|
|||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct S2 {
|
||||
struct S2 {
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(2), binding(0)]] var<uniform> uniform2 : S2;
|
||||
|
||||
[[block]] struct S3 {
|
||||
struct S3 {
|
||||
pos : mat4x4<f32>;
|
||||
};
|
||||
[[group(3), binding(0)]] var<storage, read_write> storage3 : S3;
|
||||
|
@ -98,7 +98,7 @@ TEST_F(GetBindGroupLayoutTests, SameObject) {
|
|||
// Test that default BindGroupLayouts cannot be used in the creation of a new PipelineLayout
|
||||
TEST_F(GetBindGroupLayoutTests, DefaultBindGroupLayoutPipelineCompatibility) {
|
||||
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
||||
[[block]] struct S {
|
||||
struct S {
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||
|
@ -120,7 +120,7 @@ TEST_F(GetBindGroupLayoutTests, DefaultShaderStageAndDynamicOffsets) {
|
|||
DAWN_SKIP_TEST_IF(UsesWire());
|
||||
|
||||
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
||||
[[block]] struct S {
|
||||
struct S {
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||
|
@ -290,7 +290,7 @@ TEST_F(GetBindGroupLayoutTests, ComputePipeline) {
|
|||
DAWN_SKIP_TEST_IF(UsesWire());
|
||||
|
||||
wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct S {
|
||||
struct S {
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||
|
@ -343,7 +343,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
|
|||
binding.visibility = wgpu::ShaderStage::Fragment;
|
||||
binding.buffer.type = wgpu::BufferBindingType::Storage;
|
||||
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
||||
[[block]] struct S {
|
||||
struct S {
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<storage, read_write> ssbo : S;
|
||||
|
@ -357,7 +357,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
|
|||
{
|
||||
binding.buffer.type = wgpu::BufferBindingType::Uniform;
|
||||
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
||||
[[block]] struct S {
|
||||
struct S {
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||
|
@ -372,7 +372,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
|
|||
{
|
||||
binding.buffer.type = wgpu::BufferBindingType::ReadOnlyStorage;
|
||||
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
||||
[[block]] struct S {
|
||||
struct S {
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<storage, read> ssbo : S;
|
||||
|
@ -612,7 +612,7 @@ TEST_F(GetBindGroupLayoutTests, BindingIndices) {
|
|||
{
|
||||
binding.binding = 0;
|
||||
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
||||
[[block]] struct S {
|
||||
struct S {
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||
|
@ -627,7 +627,7 @@ TEST_F(GetBindGroupLayoutTests, BindingIndices) {
|
|||
{
|
||||
binding.binding = 1;
|
||||
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
||||
[[block]] struct S {
|
||||
struct S {
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(1)]] var<uniform> uniforms : S;
|
||||
|
@ -642,7 +642,7 @@ TEST_F(GetBindGroupLayoutTests, BindingIndices) {
|
|||
{
|
||||
binding.binding = 2;
|
||||
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
||||
[[block]] struct S {
|
||||
struct S {
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(1)]] var<uniform> uniforms : S;
|
||||
|
@ -658,7 +658,7 @@ TEST_F(GetBindGroupLayoutTests, BindingIndices) {
|
|||
// Test it is valid to have duplicate bindings in the shaders.
|
||||
TEST_F(GetBindGroupLayoutTests, DuplicateBinding) {
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct S {
|
||||
struct S {
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uniform0 : S;
|
||||
|
@ -671,7 +671,7 @@ TEST_F(GetBindGroupLayoutTests, DuplicateBinding) {
|
|||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct S {
|
||||
struct S {
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(1), binding(0)]] var<uniform> uniforms : S;
|
||||
|
@ -697,7 +697,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) {
|
|||
DAWN_SKIP_TEST_IF(UsesWire());
|
||||
|
||||
wgpu::ShaderModule vsModule4 = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct S {
|
||||
struct S {
|
||||
pos : f32;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||
|
@ -708,7 +708,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) {
|
|||
})");
|
||||
|
||||
wgpu::ShaderModule vsModule64 = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct S {
|
||||
struct S {
|
||||
pos : mat4x4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||
|
@ -719,7 +719,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) {
|
|||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule4 = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct S {
|
||||
struct S {
|
||||
pos : f32;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||
|
@ -729,7 +729,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) {
|
|||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule64 = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct S {
|
||||
struct S {
|
||||
pos : mat4x4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||
|
@ -864,7 +864,7 @@ TEST_F(GetBindGroupLayoutTests, StageAggregation) {
|
|||
// Test it is invalid to have conflicting binding types in the shaders.
|
||||
TEST_F(GetBindGroupLayoutTests, ConflictingBindingType) {
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct S {
|
||||
struct S {
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> ubo : S;
|
||||
|
@ -875,7 +875,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingType) {
|
|||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct S {
|
||||
struct S {
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<storage, read_write> ssbo : S;
|
||||
|
@ -988,7 +988,7 @@ TEST_F(GetBindGroupLayoutTests, UnusedIndex) {
|
|||
DAWN_SKIP_TEST_IF(UsesWire());
|
||||
|
||||
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
||||
[[block]] struct S {
|
||||
struct S {
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uniforms0 : S;
|
||||
|
@ -1041,7 +1041,7 @@ TEST_F(GetBindGroupLayoutTests, Reflection) {
|
|||
wgpu::PipelineLayout pipelineLayout = device.CreatePipelineLayout(&pipelineLayoutDesc);
|
||||
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct S {
|
||||
struct S {
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||
|
@ -1082,7 +1082,7 @@ TEST_F(GetBindGroupLayoutTests, Reflection) {
|
|||
// Test that fragment output validation is for the correct entryPoint
|
||||
TEST_F(GetBindGroupLayoutTests, FromCorrectEntryPoint) {
|
||||
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Data {
|
||||
struct Data {
|
||||
data : f32;
|
||||
};
|
||||
[[group(0), binding(0)]] var<storage, read_write> data0 : Data;
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace {
|
|||
std::ostringstream ostream;
|
||||
size_t index = 0;
|
||||
for (const BindingDescriptor& b : bindings) {
|
||||
ostream << "[[block]] struct S" << index << " { " << b.decl << "};\n";
|
||||
ostream << "struct S" << index << " { " << b.decl << "};\n";
|
||||
ostream << "[[group(" << b.group << "), binding(" << b.binding << ")]] ";
|
||||
switch (b.type) {
|
||||
case wgpu::BufferBindingType::Uniform:
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace {
|
|||
ValidationTest::SetUp();
|
||||
|
||||
vsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct S {
|
||||
struct S {
|
||||
transform : mat2x2<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||
|
@ -38,12 +38,12 @@ namespace {
|
|||
})");
|
||||
|
||||
fsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Uniforms {
|
||||
struct Uniforms {
|
||||
color : vec4<f32>;
|
||||
};
|
||||
[[group(1), binding(0)]] var<uniform> uniforms : Uniforms;
|
||||
|
||||
[[block]] struct Storage {
|
||||
struct Storage {
|
||||
dummy : array<f32>;
|
||||
};
|
||||
[[group(1), binding(1)]] var<storage, read_write> ssbo : Storage;
|
||||
|
|
|
@ -765,7 +765,7 @@ TEST_F(RenderPipelineValidationTest, TextureViewDimensionCompatibility) {
|
|||
// cause crash.
|
||||
TEST_F(RenderPipelineValidationTest, StorageBufferInVertexShaderNoLayout) {
|
||||
wgpu::ShaderModule vsModuleWithStorageBuffer = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Dst {
|
||||
struct Dst {
|
||||
data : array<u32, 100>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<storage, read_write> dst : Dst;
|
||||
|
@ -1124,7 +1124,7 @@ TEST_F(RenderPipelineValidationTest, UnwrittenFragmentOutputsMask0) {
|
|||
// Test that fragment output validation is for the correct entryPoint
|
||||
TEST_F(RenderPipelineValidationTest, BindingsFromCorrectEntryPoint) {
|
||||
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Uniforms {
|
||||
struct Uniforms {
|
||||
data : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> var0 : Uniforms;
|
||||
|
|
|
@ -761,7 +761,7 @@ namespace {
|
|||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct RBuffer {
|
||||
struct RBuffer {
|
||||
value : f32;
|
||||
};
|
||||
[[group(0), binding(0)]] var<storage, read> rBuffer : RBuffer;
|
||||
|
|
|
@ -503,7 +503,7 @@ TEST_F(ShaderModuleValidationTest, OverridableConstantsNumericIDConflicts) {
|
|||
[[override(1234)]] let c0: u32;
|
||||
[[override(1234)]] let c1: u32;
|
||||
|
||||
[[block]] struct Buf {
|
||||
struct Buf {
|
||||
data : array<u32, 2>;
|
||||
};
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ class D3D12DescriptorHeapTests : public DawnTest {
|
|||
})");
|
||||
|
||||
mSimpleFSModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct U {
|
||||
struct U {
|
||||
color : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> colorBuffer : U;
|
||||
|
@ -444,7 +444,7 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBO) {
|
|||
pipelineDescriptor.vertex.module = mSimpleVSModule;
|
||||
|
||||
pipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct U {
|
||||
struct U {
|
||||
heapSize : f32;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> buffer0 : U;
|
||||
|
@ -777,7 +777,7 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBOAndSamplers) {
|
|||
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
|
||||
|
||||
pipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct U {
|
||||
struct U {
|
||||
transform : mat2x2<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> buffer0 : U;
|
||||
|
@ -793,7 +793,7 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBOAndSamplers) {
|
|||
return vec4<f32>(buffer0.transform * (pos[VertexIndex]), 0.0, 1.0);
|
||||
})");
|
||||
pipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct U {
|
||||
struct U {
|
||||
color : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(1)]] var sampler0 : sampler;
|
||||
|
|
|
@ -353,7 +353,7 @@ TEST_P(D3D12DescriptorResidencyTests, SwitchedViewHeapResidency) {
|
|||
})");
|
||||
|
||||
renderPipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct U {
|
||||
struct U {
|
||||
color : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> colorBuffer : U;
|
||||
|
|
|
@ -31,7 +31,7 @@ class InternalStorageBufferBindingTests : public DawnTest {
|
|||
|
||||
wgpu::ComputePipeline CreateComputePipelineWithInternalStorage() {
|
||||
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Buf {
|
||||
struct Buf {
|
||||
data : array<u32, 4>;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue