WGSL: Replace last uses of var<in> and var<out>
Bug: dawn:755 Change-Id: Idaca6965fd2b5d0f2e0028d8edfff6c507050a45 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/48240 Auto-Submit: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Ben Clayton <bclayton@google.com> Reviewed-by: Brandon Jones <bajones@chromium.org> Commit-Queue: Brandon Jones <bajones@chromium.org>
This commit is contained in:
parent
a584ae7770
commit
bda3796da9
|
@ -38,16 +38,23 @@ namespace dawn_native {
|
||||||
u_scale : vec2<f32>;
|
u_scale : vec2<f32>;
|
||||||
u_offset : vec2<f32>;
|
u_offset : vec2<f32>;
|
||||||
};
|
};
|
||||||
|
[[binding(0), group(0)]] var<uniform> uniforms : Uniforms;
|
||||||
|
|
||||||
const texcoord : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
|
const texcoord : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
|
||||||
vec2<f32>(-0.5, 0.0),
|
vec2<f32>(-0.5, 0.0),
|
||||||
vec2<f32>( 1.5, 0.0),
|
vec2<f32>( 1.5, 0.0),
|
||||||
vec2<f32>( 0.5, 2.0));
|
vec2<f32>( 0.5, 2.0));
|
||||||
[[location(0)]] var<out> v_texcoord: vec2<f32>;
|
|
||||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
struct VertexOutputs {
|
||||||
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
|
[[location(0)]] texcoords : vec2<f32>;
|
||||||
[[binding(0), group(0)]] var<uniform> uniforms : Uniforms;
|
[[builtin(position)]] position : vec4<f32>;
|
||||||
[[stage(vertex)]] fn main() {
|
};
|
||||||
Position = vec4<f32>((texcoord[VertexIndex] * 2.0 - vec2<f32>(1.0, 1.0)), 0.0, 1.0);
|
|
||||||
|
[[stage(vertex)]] fn main(
|
||||||
|
[[builtin(vertex_index)]] VertexIndex : u32
|
||||||
|
) -> VertexOutputs {
|
||||||
|
var output : VertexOutputs;
|
||||||
|
output.position = vec4<f32>((texcoord[VertexIndex] * 2.0 - vec2<f32>(1.0, 1.0)), 0.0, 1.0);
|
||||||
|
|
||||||
// Y component of scale is calculated by the copySizeHeight / textureHeight. Only
|
// Y component of scale is calculated by the copySizeHeight / textureHeight. Only
|
||||||
// flipY case can get negative number.
|
// flipY case can get negative number.
|
||||||
|
@ -59,33 +66,38 @@ namespace dawn_native {
|
||||||
// We need to get the mirror positions(mirrored based on y = 0.5) on flip cases.
|
// We need to get the mirror positions(mirrored based on y = 0.5) on flip cases.
|
||||||
// Adopt transform to src texture and then mapping it to triangle coord which
|
// Adopt transform to src texture and then mapping it to triangle coord which
|
||||||
// do a +1 shift on Y dimension will help us got that mirror position perfectly.
|
// do a +1 shift on Y dimension will help us got that mirror position perfectly.
|
||||||
v_texcoord = (texcoord[VertexIndex] * uniforms.u_scale + uniforms.u_offset) *
|
output.texcoords = (texcoord[VertexIndex] * uniforms.u_scale + uniforms.u_offset) *
|
||||||
vec2<f32>(1.0, -1.0) + vec2<f32>(0.0, 1.0);
|
vec2<f32>(1.0, -1.0) + vec2<f32>(0.0, 1.0);
|
||||||
} else {
|
} else {
|
||||||
// For the normal case, we need to get the exact position.
|
// For the normal case, we need to get the exact position.
|
||||||
// So mapping texture to triangle firstly then adopt the transform.
|
// So mapping texture to triangle firstly then adopt the transform.
|
||||||
v_texcoord = (texcoord[VertexIndex] *
|
output.texcoords = (texcoord[VertexIndex] *
|
||||||
vec2<f32>(1.0, -1.0) + vec2<f32>(0.0, 1.0)) *
|
vec2<f32>(1.0, -1.0) + vec2<f32>(0.0, 1.0)) *
|
||||||
uniforms.u_scale + uniforms.u_offset;
|
uniforms.u_scale + uniforms.u_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return output;
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
|
|
||||||
static const char sCopyTextureForBrowserFragment[] = R"(
|
static const char sCopyTextureForBrowserFragment[] = R"(
|
||||||
[[binding(1), group(0)]] var mySampler: sampler;
|
[[binding(1), group(0)]] var mySampler: sampler;
|
||||||
[[binding(2), group(0)]] var myTexture: texture_2d<f32>;
|
[[binding(2), group(0)]] var myTexture: texture_2d<f32>;
|
||||||
[[location(0)]] var<in> v_texcoord : vec2<f32>;
|
|
||||||
[[location(0)]] var<out> outputColor : vec4<f32>;
|
[[stage(fragment)]] fn main(
|
||||||
[[stage(fragment)]] fn main() {
|
[[location(0)]] texcoord : vec2<f32>
|
||||||
|
) -> [[location(0)]] vec4<f32> {
|
||||||
// Clamp the texcoord and discard the out-of-bound pixels.
|
// Clamp the texcoord and discard the out-of-bound pixels.
|
||||||
var clampedTexcoord : vec2<f32> =
|
var clampedTexcoord : vec2<f32> =
|
||||||
clamp(v_texcoord, vec2<f32>(0.0, 0.0), vec2<f32>(1.0, 1.0));
|
clamp(texcoord, vec2<f32>(0.0, 0.0), vec2<f32>(1.0, 1.0));
|
||||||
if (all(clampedTexcoord == v_texcoord)) {
|
if (!all(clampedTexcoord == texcoord)) {
|
||||||
var srcColor : vec4<f32> = textureSample(myTexture, mySampler, v_texcoord);
|
discard;
|
||||||
// Swizzling of texture formats when sampling / rendering is handled by the
|
|
||||||
// hardware so we don't need special logic in this shader. This is covered by tests.
|
|
||||||
outputColor = srcColor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var srcColor : vec4<f32> = textureSample(myTexture, mySampler, texcoord);
|
||||||
|
// Swizzling of texture formats when sampling / rendering is handled by the
|
||||||
|
// hardware so we don't need special logic in this shader. This is covered by tests.
|
||||||
|
return srcColor;
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
|
|
||||||
|
|
|
@ -58,12 +58,11 @@ namespace dawn_native {
|
||||||
var<storage> availability : [[access(read)]] AvailabilityArr;
|
var<storage> availability : [[access(read)]] AvailabilityArr;
|
||||||
[[group(0), binding(2)]] var<uniform> params : TimestampParams;
|
[[group(0), binding(2)]] var<uniform> params : TimestampParams;
|
||||||
|
|
||||||
[[builtin(global_invocation_id)]] var<in> GlobalInvocationID : vec3<u32>;
|
|
||||||
|
|
||||||
const sizeofTimestamp : u32 = 8u;
|
const sizeofTimestamp : u32 = 8u;
|
||||||
|
|
||||||
[[stage(compute), workgroup_size(8, 1, 1)]]
|
[[stage(compute), workgroup_size(8, 1, 1)]]
|
||||||
fn main() {
|
fn main([[builtin(global_invocation_id)]] GlobalInvocationID : vec3<u32>) {
|
||||||
if (GlobalInvocationID.x >= params.count) { return; }
|
if (GlobalInvocationID.x >= params.count) { return; }
|
||||||
|
|
||||||
var index : u32 = GlobalInvocationID.x + params.offset / sizeofTimestamp;
|
var index : u32 = GlobalInvocationID.x + params.offset / sizeofTimestamp;
|
||||||
|
|
|
@ -538,16 +538,15 @@ class VertexFormatDeprecationTests : public DeprecationTests {
|
||||||
protected:
|
protected:
|
||||||
// Runs the test
|
// Runs the test
|
||||||
void DoTest(const wgpu::VertexFormat vertexFormat, bool deprecated) {
|
void DoTest(const wgpu::VertexFormat vertexFormat, bool deprecated) {
|
||||||
std::string attribute = "[[location(0)]] var<in> a : ";
|
std::string attribute = "[[location(0)]] a : ";
|
||||||
attribute += dawn::GetWGSLVertexFormatType(vertexFormat);
|
attribute += dawn::GetWGSLVertexFormatType(vertexFormat);
|
||||||
attribute += ";";
|
|
||||||
|
|
||||||
std::string attribAccess = dawn::VertexFormatNumComponents(vertexFormat) > 1
|
std::string attribAccess = dawn::VertexFormatNumComponents(vertexFormat) > 1
|
||||||
? "vec4<f32>(f32(a.x), 0.0, 0.0, 1.0)"
|
? "vec4<f32>(f32(a.x), 0.0, 0.0, 1.0)"
|
||||||
: "vec4<f32>(f32(a), 0.0, 0.0, 1.0)";
|
: "vec4<f32>(f32(a), 0.0, 0.0, 1.0)";
|
||||||
|
|
||||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, (attribute + R"(
|
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, (R"(
|
||||||
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
[[stage(vertex)]] fn main()" + attribute + R"() -> [[builtin(position)]] vec4<f32> {
|
||||||
return )" + attribAccess + R"(;
|
return )" + attribAccess + R"(;
|
||||||
}
|
}
|
||||||
)")
|
)")
|
||||||
|
|
|
@ -73,6 +73,7 @@ class DepthStencilSamplingTest : public DawnTest {
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
||||||
|
|
||||||
std::ostringstream shaderSource;
|
std::ostringstream shaderSource;
|
||||||
|
std::ostringstream shaderOutputStruct;
|
||||||
std::ostringstream shaderBody;
|
std::ostringstream shaderBody;
|
||||||
|
|
||||||
uint32_t index = 0;
|
uint32_t index = 0;
|
||||||
|
@ -82,10 +83,10 @@ class DepthStencilSamplingTest : public DawnTest {
|
||||||
shaderSource << "[[group(0), binding(" << index << ")]] var tex" << index
|
shaderSource << "[[group(0), binding(" << index << ")]] var tex" << index
|
||||||
<< " : texture_2d<f32>;\n";
|
<< " : texture_2d<f32>;\n";
|
||||||
|
|
||||||
shaderSource << "[[location(" << index << ")]] var<out> result" << index
|
shaderOutputStruct << " [[location(" << index << ")]] result" << index
|
||||||
<< " : f32;\n";
|
<< " : f32;\n";
|
||||||
|
|
||||||
shaderBody << "\nresult" << index << " = textureLoad(tex" << index
|
shaderBody << "\n output.result" << index << " = textureLoad(tex" << index
|
||||||
<< ", vec2<i32>(0, 0), 0)[" << componentIndex << "];\n";
|
<< ", vec2<i32>(0, 0), 0)[" << componentIndex << "];\n";
|
||||||
pipelineDescriptor.cTargets[index].format = wgpu::TextureFormat::R32Float;
|
pipelineDescriptor.cTargets[index].format = wgpu::TextureFormat::R32Float;
|
||||||
break;
|
break;
|
||||||
|
@ -93,10 +94,10 @@ class DepthStencilSamplingTest : public DawnTest {
|
||||||
shaderSource << "[[group(0), binding(" << index << ")]] var tex" << index
|
shaderSource << "[[group(0), binding(" << index << ")]] var tex" << index
|
||||||
<< " : texture_2d<u32>;\n";
|
<< " : texture_2d<u32>;\n";
|
||||||
|
|
||||||
shaderSource << "[[location(" << index << ")]] var<out> result" << index
|
shaderOutputStruct << " [[location(" << index << ")]] result" << index
|
||||||
<< " : u32;\n";
|
<< " : u32;\n";
|
||||||
|
|
||||||
shaderBody << "\nresult" << index << " = textureLoad(tex" << index
|
shaderBody << "\n output.result" << index << " = textureLoad(tex" << index
|
||||||
<< ", vec2<i32>(0, 0), 0)[" << componentIndex << "];\n";
|
<< ", vec2<i32>(0, 0), 0)[" << componentIndex << "];\n";
|
||||||
pipelineDescriptor.cTargets[index].format = wgpu::TextureFormat::R8Uint;
|
pipelineDescriptor.cTargets[index].format = wgpu::TextureFormat::R8Uint;
|
||||||
break;
|
break;
|
||||||
|
@ -105,7 +106,10 @@ class DepthStencilSamplingTest : public DawnTest {
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
shaderSource << "[[stage(fragment)]] fn main() { " << shaderBody.str() << "\n}";
|
shaderSource << "struct FragOutputs {\n" << shaderOutputStruct.str() << "};\n";
|
||||||
|
shaderSource << "[[stage(fragment)]] fn main() -> FragOutputs {\n";
|
||||||
|
shaderSource << " var output : FragOutputs;\n"
|
||||||
|
<< shaderBody.str() << " return output;\n}";
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, shaderSource.str().c_str());
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, shaderSource.str().c_str());
|
||||||
pipelineDescriptor.vertex.module = vsModule;
|
pipelineDescriptor.vertex.module = vsModule;
|
||||||
|
|
|
@ -86,77 +86,68 @@ void FirstIndexOffsetTests::TestImpl(DrawMode mode,
|
||||||
uint32_t firstVertex,
|
uint32_t firstVertex,
|
||||||
uint32_t firstInstance) {
|
uint32_t firstInstance) {
|
||||||
using wgpu::operator&;
|
using wgpu::operator&;
|
||||||
std::stringstream vertexShader;
|
|
||||||
std::stringstream fragmentShader;
|
std::stringstream vertexInputs;
|
||||||
|
std::stringstream vertexOutputs;
|
||||||
|
std::stringstream vertexBody;
|
||||||
|
std::stringstream fragmentInputs;
|
||||||
|
std::stringstream fragmentBody;
|
||||||
|
|
||||||
|
vertexInputs << " [[location(0)]] position : vec4<f32>;\n";
|
||||||
|
vertexOutputs << " [[builtin(position)]] position : vec4<f32>;\n";
|
||||||
|
|
||||||
if ((checkIndex & CheckIndex::Vertex) != 0) {
|
if ((checkIndex & CheckIndex::Vertex) != 0) {
|
||||||
vertexShader << R"(
|
vertexInputs << " [[builtin(vertex_index)]] vertex_index : u32;\n";
|
||||||
[[builtin(vertex_index)]] var<in> vertex_index : u32;
|
vertexOutputs << " [[location(1)]] vertex_index : u32;\n";
|
||||||
[[location(1)]] var<out> out_vertex_index : u32;
|
vertexBody << " output.vertex_index = input.vertex_index;\n";
|
||||||
)";
|
|
||||||
fragmentShader << R"(
|
fragmentInputs << " [[location(1)]] vertex_index : u32;\n";
|
||||||
[[location(1)]] var<in> in_vertex_index : u32;
|
fragmentBody << " idx_vals.vertex_index = input.vertex_index;\n";
|
||||||
)";
|
|
||||||
}
|
}
|
||||||
if ((checkIndex & CheckIndex::Instance) != 0) {
|
if ((checkIndex & CheckIndex::Instance) != 0) {
|
||||||
vertexShader << R"(
|
vertexInputs << " [[builtin(instance_index)]] instance_index : u32;\n";
|
||||||
[[builtin(instance_index)]] var<in> instance_index : u32;
|
vertexOutputs << " [[location(2)]] instance_index : u32;\n";
|
||||||
[[location(2)]] var<out> out_instance_index : u32;
|
vertexBody << " output.instance_index = input.instance_index;\n";
|
||||||
)";
|
|
||||||
fragmentShader << R"(
|
fragmentInputs << " [[location(2)]] instance_index : u32;\n";
|
||||||
[[location(2)]] var<in> in_instance_index : u32;
|
fragmentBody << " idx_vals.instance_index = input.instance_index;\n";
|
||||||
)";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vertexShader << R"(
|
std::string vertexShader = R"(
|
||||||
[[builtin(position)]] var<out> position : vec4<f32>;
|
struct VertexInputs {
|
||||||
[[location(0)]] var<in> pos : vec4<f32>;
|
)" + vertexInputs.str() + R"(
|
||||||
|
};
|
||||||
|
struct VertexOutputs {
|
||||||
|
)" + vertexOutputs.str() + R"(
|
||||||
|
};
|
||||||
|
[[stage(vertex)]] fn main(input : VertexInputs) -> VertexOutputs {
|
||||||
|
var output : VertexOutputs;
|
||||||
|
)" + vertexBody.str() + R"(
|
||||||
|
output.position = input.position;
|
||||||
|
return output;
|
||||||
|
})";
|
||||||
|
|
||||||
[[stage(vertex)]] fn main() {)";
|
std::string fragmentShader = R"(
|
||||||
fragmentShader << R"(
|
[[block]] struct IndexVals {
|
||||||
[[block]] struct IndexVals {
|
vertex_index : u32;
|
||||||
vertex_index : u32;
|
instance_index : u32;
|
||||||
instance_index : u32;
|
};
|
||||||
};
|
[[group(0), binding(0)]] var<storage> idx_vals : [[access(read_write)]] IndexVals;
|
||||||
|
|
||||||
[[group(0), binding(0)]] var<storage> idx_vals : [[access(read_write)]] IndexVals;
|
struct FragInputs {
|
||||||
|
)" + fragmentInputs.str() + R"(
|
||||||
[[stage(fragment)]] fn main() {
|
};
|
||||||
)";
|
[[stage(fragment)]] fn main(input : FragInputs) {
|
||||||
|
)" + fragmentBody.str() + R"(
|
||||||
if ((checkIndex & CheckIndex::Vertex) != 0) {
|
})";
|
||||||
vertexShader << R"(
|
|
||||||
out_vertex_index = vertex_index;
|
|
||||||
)";
|
|
||||||
fragmentShader << R"(
|
|
||||||
idx_vals.vertex_index = in_vertex_index;
|
|
||||||
)";
|
|
||||||
}
|
|
||||||
if ((checkIndex & CheckIndex::Instance) != 0) {
|
|
||||||
vertexShader << R"(
|
|
||||||
out_instance_index = instance_index;
|
|
||||||
)";
|
|
||||||
fragmentShader << R"(
|
|
||||||
idx_vals.instance_index = in_instance_index;
|
|
||||||
)";
|
|
||||||
}
|
|
||||||
|
|
||||||
vertexShader << R"(
|
|
||||||
position = pos;
|
|
||||||
return;
|
|
||||||
})";
|
|
||||||
|
|
||||||
fragmentShader << R"(
|
|
||||||
return;
|
|
||||||
})";
|
|
||||||
|
|
||||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||||
|
|
||||||
constexpr uint32_t kComponentsPerVertex = 4;
|
constexpr uint32_t kComponentsPerVertex = 4;
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
|
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
|
||||||
pipelineDesc.vertex.module = utils::CreateShaderModule(device, vertexShader.str().c_str());
|
pipelineDesc.vertex.module = utils::CreateShaderModule(device, vertexShader.c_str());
|
||||||
pipelineDesc.cFragment.module = utils::CreateShaderModule(device, fragmentShader.str().c_str());
|
pipelineDesc.cFragment.module = utils::CreateShaderModule(device, fragmentShader.c_str());
|
||||||
pipelineDesc.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
pipelineDesc.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||||
pipelineDesc.vertex.bufferCount = 1;
|
pipelineDesc.vertex.bufferCount = 1;
|
||||||
pipelineDesc.cBuffers[0].arrayStride = kComponentsPerVertex * sizeof(float);
|
pipelineDesc.cBuffers[0].arrayStride = kComponentsPerVertex * sizeof(float);
|
||||||
|
|
|
@ -30,10 +30,12 @@ class VertexBufferRobustnessTest : public DawnTest {
|
||||||
// Creates a vertex module that tests an expression with given attributes. If successful, the
|
// Creates a vertex module that tests an expression with given attributes. If successful, the
|
||||||
// point drawn would be moved out of the viewport. On failure, the point is kept inside the
|
// point drawn would be moved out of the viewport. On failure, the point is kept inside the
|
||||||
// viewport.
|
// viewport.
|
||||||
wgpu::ShaderModule CreateVertexModule(const std::string& attributes,
|
wgpu::ShaderModule CreateVertexModule(const std::string& attribute,
|
||||||
const std::string& successExpression) {
|
const std::string& successExpression) {
|
||||||
return utils::CreateShaderModule(device, (attributes + R"(
|
return utils::CreateShaderModule(device, (R"(
|
||||||
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
[[stage(vertex)]] fn main(
|
||||||
|
)" + attribute + R"(
|
||||||
|
) -> [[builtin(position)]] vec4<f32> {
|
||||||
if ()" + successExpression + R"() {
|
if ()" + successExpression + R"() {
|
||||||
// Success case, move the vertex out of the viewport
|
// Success case, move the vertex out of the viewport
|
||||||
return vec4<f32>(-10.0, 0.0, 0.0, 1.0);
|
return vec4<f32>(-10.0, 0.0, 0.0, 1.0);
|
||||||
|
@ -102,7 +104,7 @@ TEST_P(VertexBufferRobustnessTest, DetectInvalidValues) {
|
||||||
wgpu::Buffer vertexBuffer = utils::CreateBufferFromData(device, kVertices, sizeof(kVertices),
|
wgpu::Buffer vertexBuffer = utils::CreateBufferFromData(device, kVertices, sizeof(kVertices),
|
||||||
wgpu::BufferUsage::Vertex);
|
wgpu::BufferUsage::Vertex);
|
||||||
|
|
||||||
DoTest("[[location(0)]] var<in> a : f32;", "a == 473.0", vertexState, vertexBuffer, 0, false);
|
DoTest("[[location(0)]] a : f32", "a == 473.0", vertexState, vertexBuffer, 0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(VertexBufferRobustnessTest, FloatClamp) {
|
TEST_P(VertexBufferRobustnessTest, FloatClamp) {
|
||||||
|
@ -119,7 +121,7 @@ TEST_P(VertexBufferRobustnessTest, FloatClamp) {
|
||||||
wgpu::Buffer vertexBuffer = utils::CreateBufferFromData(device, kVertices, sizeof(kVertices),
|
wgpu::Buffer vertexBuffer = utils::CreateBufferFromData(device, kVertices, sizeof(kVertices),
|
||||||
wgpu::BufferUsage::Vertex);
|
wgpu::BufferUsage::Vertex);
|
||||||
|
|
||||||
DoTest("[[location(0)]] var<in> a : f32;", "a == 473.0", vertexState, vertexBuffer, 4, true);
|
DoTest("[[location(0)]] a : f32", "a == 473.0", vertexState, vertexBuffer, 4, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(VertexBufferRobustnessTest, IntClamp) {
|
TEST_P(VertexBufferRobustnessTest, IntClamp) {
|
||||||
|
@ -136,7 +138,7 @@ TEST_P(VertexBufferRobustnessTest, IntClamp) {
|
||||||
wgpu::Buffer vertexBuffer = utils::CreateBufferFromData(device, kVertices, sizeof(kVertices),
|
wgpu::Buffer vertexBuffer = utils::CreateBufferFromData(device, kVertices, sizeof(kVertices),
|
||||||
wgpu::BufferUsage::Vertex);
|
wgpu::BufferUsage::Vertex);
|
||||||
|
|
||||||
DoTest("[[location(0)]] var<in> a : i32;", "a == 473", vertexState, vertexBuffer, 4, true);
|
DoTest("[[location(0)]] a : i32", "a == 473", vertexState, vertexBuffer, 4, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(VertexBufferRobustnessTest, UIntClamp) {
|
TEST_P(VertexBufferRobustnessTest, UIntClamp) {
|
||||||
|
@ -153,7 +155,7 @@ TEST_P(VertexBufferRobustnessTest, UIntClamp) {
|
||||||
wgpu::Buffer vertexBuffer = utils::CreateBufferFromData(device, kVertices, sizeof(kVertices),
|
wgpu::Buffer vertexBuffer = utils::CreateBufferFromData(device, kVertices, sizeof(kVertices),
|
||||||
wgpu::BufferUsage::Vertex);
|
wgpu::BufferUsage::Vertex);
|
||||||
|
|
||||||
DoTest("[[location(0)]] var<in> a : u32;", "a == 473u", vertexState, vertexBuffer, 4, true);
|
DoTest("[[location(0)]] a : u32", "a == 473u", vertexState, vertexBuffer, 4, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(VertexBufferRobustnessTest, Float2Clamp) {
|
TEST_P(VertexBufferRobustnessTest, Float2Clamp) {
|
||||||
|
@ -170,7 +172,7 @@ TEST_P(VertexBufferRobustnessTest, Float2Clamp) {
|
||||||
wgpu::Buffer vertexBuffer = utils::CreateBufferFromData(device, kVertices, sizeof(kVertices),
|
wgpu::Buffer vertexBuffer = utils::CreateBufferFromData(device, kVertices, sizeof(kVertices),
|
||||||
wgpu::BufferUsage::Vertex);
|
wgpu::BufferUsage::Vertex);
|
||||||
|
|
||||||
DoTest("[[location(0)]] var<in> a : vec2<f32>;", "a[0] == 473.0 && a[1] == 473.0",
|
DoTest("[[location(0)]] a : vec2<f32>", "a[0] == 473.0 && a[1] == 473.0",
|
||||||
std::move(vertexState), vertexBuffer, 8, true);
|
std::move(vertexState), vertexBuffer, 8, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,7 +190,7 @@ TEST_P(VertexBufferRobustnessTest, Float3Clamp) {
|
||||||
wgpu::Buffer vertexBuffer = utils::CreateBufferFromData(device, kVertices, sizeof(kVertices),
|
wgpu::Buffer vertexBuffer = utils::CreateBufferFromData(device, kVertices, sizeof(kVertices),
|
||||||
wgpu::BufferUsage::Vertex);
|
wgpu::BufferUsage::Vertex);
|
||||||
|
|
||||||
DoTest("[[location(0)]] var<in> a : vec3<f32>;",
|
DoTest("[[location(0)]] a : vec3<f32>",
|
||||||
"a[0] == 473.0 && a[1] == 473.0 && a[2] == 473.0", vertexState, vertexBuffer, 12, true);
|
"a[0] == 473.0 && a[1] == 473.0 && a[2] == 473.0", vertexState, vertexBuffer, 12, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,7 +208,7 @@ TEST_P(VertexBufferRobustnessTest, Float4Clamp) {
|
||||||
wgpu::Buffer vertexBuffer = utils::CreateBufferFromData(device, kVertices, sizeof(kVertices),
|
wgpu::Buffer vertexBuffer = utils::CreateBufferFromData(device, kVertices, sizeof(kVertices),
|
||||||
wgpu::BufferUsage::Vertex);
|
wgpu::BufferUsage::Vertex);
|
||||||
|
|
||||||
DoTest("[[location(0)]] var<in> a : vec4<f32>;",
|
DoTest("[[location(0)]] a : vec4<f32>",
|
||||||
"a[0] == 473.0 && a[1] == 473.0 && a[2] == 473.0 && a[3] == 473.0", vertexState,
|
"a[0] == 473.0 && a[1] == 473.0 && a[2] == 473.0 && a[3] == 473.0", vertexState,
|
||||||
vertexBuffer, 16, true);
|
vertexBuffer, 16, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -448,10 +448,9 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBO) {
|
||||||
heapSize : f32;
|
heapSize : f32;
|
||||||
};
|
};
|
||||||
[[group(0), binding(0)]] var<uniform> buffer0 : U;
|
[[group(0), binding(0)]] var<uniform> buffer0 : U;
|
||||||
[[location(0)]] var<out> FragColor : f32;
|
|
||||||
|
|
||||||
[[stage(fragment)]] fn main() {
|
[[stage(fragment)]] fn main() -> [[location(0)]] f32 {
|
||||||
FragColor = buffer0.heapSize;
|
return buffer0.heapSize;
|
||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::BlendState blend;
|
wgpu::BlendState blend;
|
||||||
|
|
Loading…
Reference in New Issue