mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 08:27:05 +00:00
Updated VertexFormat enums
Shifts the older enum values up by 30, but if anyone was using values rather than the enums themselves they'd land on the right formats anyway. Bug: dawn:695 Change-Id: I92a177b427fb1bb14b60d9280f89d030c5941a38 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42561 Commit-Queue: Brandon Jones <bajones@chromium.org> Commit-Queue: Kai Ninomiya <kainino@chromium.org> Auto-Submit: Brandon Jones <bajones@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
87649ff09d
commit
e3f10e3d8e
@@ -231,7 +231,7 @@ class BufferZeroInitTest : public DawnTest {
|
||||
descriptor.cVertexState.vertexBufferCount = vertexBufferCount;
|
||||
descriptor.cVertexState.cVertexBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
descriptor.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float4;
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
descriptor.cColorStates[0].format = kColorAttachmentFormat;
|
||||
return device.CreateRenderPipeline(&descriptor);
|
||||
}
|
||||
|
||||
@@ -20,9 +20,12 @@
|
||||
#include "tests/DawnTest.h"
|
||||
|
||||
#include "common/Constants.h"
|
||||
#include "common/VertexFormatUtils.h"
|
||||
#include "utils/ComboRenderPipelineDescriptor.h"
|
||||
#include "utils/WGPUHelpers.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
class DeprecationTests : public DawnTest {
|
||||
protected:
|
||||
void SetUp() override {
|
||||
@@ -194,3 +197,79 @@ class BufferCopyViewDeprecationTests : public DeprecationTests {
|
||||
|
||||
wgpu::Extent3D copySize = {1, 1, 1};
|
||||
};
|
||||
|
||||
// Tests that deprecated vertex formats properly raise a deprecation warning when used
|
||||
class VertexFormatDeprecationTests : public DeprecationTests {
|
||||
protected:
|
||||
// Runs the test
|
||||
void DoTest(const wgpu::VertexFormat vertexFormat, bool deprecated) {
|
||||
std::string attribute = "[[location(0)]] var<in> a : ";
|
||||
attribute += dawn::GetWGSLVertexFormatType(vertexFormat);
|
||||
attribute += ";";
|
||||
|
||||
std::string attribAccess = dawn::VertexFormatNumComponents(vertexFormat) > 1
|
||||
? "vec4<f32>(a.x, 0.0, 0.0, 1.0)"
|
||||
: "vec4<f32>(a, 0.0, 0.0, 1.0)";
|
||||
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, (attribute + R"(
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
|
||||
[[stage(vertex)]] fn main() -> void {
|
||||
Position = )" + attribAccess + R"(;
|
||||
return;
|
||||
}
|
||||
)")
|
||||
.c_str());
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[location(0)]] var<out> outColor : vec4<f32>;
|
||||
|
||||
[[stage(fragment)]] fn main() -> void {
|
||||
outColor = vec4<f32>(1.0, 1.0, 1.0, 1.0);
|
||||
return;
|
||||
}
|
||||
)");
|
||||
|
||||
utils::ComboVertexStateDescriptor vertexState;
|
||||
vertexState.vertexBufferCount = 1;
|
||||
vertexState.cVertexBuffers[0].arrayStride = 32;
|
||||
vertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
vertexState.cAttributes[0].format = vertexFormat;
|
||||
vertexState.cAttributes[0].offset = 0;
|
||||
vertexState.cAttributes[0].shaderLocation = 0;
|
||||
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.primitiveTopology = wgpu::PrimitiveTopology::PointList;
|
||||
descriptor.vertexState = &vertexState;
|
||||
descriptor.cColorStates[0].format = utils::BasicRenderPass::kDefaultColorFormat;
|
||||
|
||||
if (deprecated) {
|
||||
EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline(&descriptor));
|
||||
} else {
|
||||
device.CreateRenderPipeline(&descriptor);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
TEST_P(VertexFormatDeprecationTests, NewVertexFormats) {
|
||||
// Using the new vertex formats does not emit a warning.
|
||||
for (auto& format : dawn::kAllVertexFormats) {
|
||||
DoTest(format, false);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatDeprecationTests, DeprecatedVertexFormats) {
|
||||
// Using deprecated vertex formats does emit a warning.
|
||||
for (auto& format : dawn::kAllDeprecatedVertexFormats) {
|
||||
DoTest(format, true);
|
||||
}
|
||||
}
|
||||
|
||||
DAWN_INSTANTIATE_TEST(VertexFormatDeprecationTests,
|
||||
D3D12Backend(),
|
||||
MetalBackend(),
|
||||
NullBackend(),
|
||||
OpenGLBackend(),
|
||||
OpenGLESBackend(),
|
||||
VulkanBackend());
|
||||
@@ -47,7 +47,7 @@ class DestroyTest : public DawnTest {
|
||||
descriptor.cVertexState.vertexBufferCount = 1;
|
||||
descriptor.cVertexState.cVertexBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
descriptor.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float4;
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
descriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
|
||||
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
|
||||
@@ -47,7 +47,7 @@ class DrawIndexedIndirectTest : public DawnTest {
|
||||
descriptor.cVertexState.vertexBufferCount = 1;
|
||||
descriptor.cVertexState.cVertexBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
descriptor.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float4;
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
descriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
|
||||
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
|
||||
@@ -47,7 +47,7 @@ class DrawIndexedTest : public DawnTest {
|
||||
descriptor.cVertexState.vertexBufferCount = 1;
|
||||
descriptor.cVertexState.cVertexBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
descriptor.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float4;
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
descriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
|
||||
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
|
||||
@@ -47,7 +47,7 @@ class DrawIndirectTest : public DawnTest {
|
||||
descriptor.cVertexState.vertexBufferCount = 1;
|
||||
descriptor.cVertexState.cVertexBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
descriptor.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float4;
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
descriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
|
||||
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
|
||||
@@ -46,7 +46,7 @@ class DrawTest : public DawnTest {
|
||||
descriptor.cVertexState.vertexBufferCount = 1;
|
||||
descriptor.cVertexState.cVertexBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
descriptor.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float4;
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
descriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
|
||||
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
|
||||
@@ -163,7 +163,7 @@ void FirstIndexOffsetTests::TestImpl(DrawMode mode,
|
||||
pipelineDesc.cVertexState.vertexBufferCount = 1;
|
||||
pipelineDesc.cVertexState.cVertexBuffers[0].arrayStride = kComponentsPerVertex * sizeof(float);
|
||||
pipelineDesc.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
pipelineDesc.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float4;
|
||||
pipelineDesc.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
pipelineDesc.cColorStates[0].format = renderPass.colorFormat;
|
||||
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDesc);
|
||||
|
||||
@@ -602,7 +602,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, SeparateBuffers) {
|
||||
rpDesc.cVertexState.vertexBufferCount = 1;
|
||||
rpDesc.cVertexState.cVertexBuffers[0].arrayStride = kVertexBufferStride;
|
||||
rpDesc.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
rpDesc.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float4;
|
||||
rpDesc.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
rpDesc.cColorStates[0].format = renderPass.colorFormat;
|
||||
|
||||
wgpu::RenderPipeline rp = device.CreateRenderPipeline(&rpDesc);
|
||||
@@ -719,7 +719,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, OneBuffer) {
|
||||
rpDesc.cVertexState.vertexBufferCount = 1;
|
||||
rpDesc.cVertexState.cVertexBuffers[0].arrayStride = kVertexBufferStride;
|
||||
rpDesc.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
rpDesc.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float4;
|
||||
rpDesc.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
rpDesc.cColorStates[0].format = renderPass.colorFormat;
|
||||
|
||||
wgpu::RenderPipeline rp = device.CreateRenderPipeline(&rpDesc);
|
||||
|
||||
@@ -59,7 +59,7 @@ class IndexFormatTest : public DawnTest {
|
||||
descriptor.cVertexState.vertexBufferCount = 1;
|
||||
descriptor.cVertexState.cVertexBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
descriptor.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float4;
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
descriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
|
||||
return device.CreateRenderPipeline(&descriptor);
|
||||
|
||||
@@ -72,7 +72,7 @@ class MultisampledSamplingTest : public DawnTest {
|
||||
desc.cVertexState.vertexBufferCount = 1;
|
||||
desc.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
desc.cVertexState.cVertexBuffers[0].arrayStride = 2 * sizeof(float);
|
||||
desc.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float2;
|
||||
desc.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x2;
|
||||
|
||||
desc.cDepthStencilState.format = kDepthFormat;
|
||||
desc.cDepthStencilState.depthWriteEnabled = true;
|
||||
|
||||
@@ -198,7 +198,7 @@ class PrimitiveTopologyTest : public DawnTest {
|
||||
descriptor.cVertexState.vertexBufferCount = 1;
|
||||
descriptor.cVertexState.cVertexBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
descriptor.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float4;
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
descriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
|
||||
@@ -56,7 +56,7 @@ class RenderBundleTest : public DawnTest {
|
||||
descriptor.cVertexState.vertexBufferCount = 1;
|
||||
descriptor.cVertexState.cVertexBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
descriptor.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float4;
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
descriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
|
||||
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
|
||||
@@ -71,10 +71,10 @@ class SamplerFilterAnisotropicTest : public DawnTest {
|
||||
|
||||
utils::ComboVertexStateDescriptor vertexState;
|
||||
vertexState.cVertexBuffers[0].attributeCount = 2;
|
||||
vertexState.cAttributes[0].format = wgpu::VertexFormat::Float4;
|
||||
vertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
vertexState.cAttributes[1].shaderLocation = 1;
|
||||
vertexState.cAttributes[1].offset = 4 * sizeof(float);
|
||||
vertexState.cAttributes[1].format = wgpu::VertexFormat::Float2;
|
||||
vertexState.cAttributes[1].format = wgpu::VertexFormat::Float32x2;
|
||||
vertexState.vertexBufferCount = 1;
|
||||
vertexState.cVertexBuffers[0].arrayStride = 6 * sizeof(float);
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ TEST_P(VertexBufferRobustnessTest, DetectInvalidValues) {
|
||||
vertexState.vertexBufferCount = 1;
|
||||
vertexState.cVertexBuffers[0].arrayStride = sizeof(float);
|
||||
vertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
vertexState.cAttributes[0].format = wgpu::VertexFormat::Float;
|
||||
vertexState.cAttributes[0].format = wgpu::VertexFormat::Float32;
|
||||
vertexState.cAttributes[0].offset = 0;
|
||||
vertexState.cAttributes[0].shaderLocation = 0;
|
||||
|
||||
@@ -116,7 +116,7 @@ TEST_P(VertexBufferRobustnessTest, FloatClamp) {
|
||||
vertexState.vertexBufferCount = 1;
|
||||
vertexState.cVertexBuffers[0].arrayStride = sizeof(float);
|
||||
vertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
vertexState.cAttributes[0].format = wgpu::VertexFormat::Float;
|
||||
vertexState.cAttributes[0].format = wgpu::VertexFormat::Float32;
|
||||
vertexState.cAttributes[0].offset = 0;
|
||||
vertexState.cAttributes[0].shaderLocation = 0;
|
||||
|
||||
@@ -133,7 +133,7 @@ TEST_P(VertexBufferRobustnessTest, IntClamp) {
|
||||
vertexState.vertexBufferCount = 1;
|
||||
vertexState.cVertexBuffers[0].arrayStride = sizeof(int32_t);
|
||||
vertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
vertexState.cAttributes[0].format = wgpu::VertexFormat::Int;
|
||||
vertexState.cAttributes[0].format = wgpu::VertexFormat::Sint32;
|
||||
vertexState.cAttributes[0].offset = 0;
|
||||
vertexState.cAttributes[0].shaderLocation = 0;
|
||||
|
||||
@@ -150,7 +150,7 @@ TEST_P(VertexBufferRobustnessTest, UIntClamp) {
|
||||
vertexState.vertexBufferCount = 1;
|
||||
vertexState.cVertexBuffers[0].arrayStride = sizeof(uint32_t);
|
||||
vertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
vertexState.cAttributes[0].format = wgpu::VertexFormat::UInt;
|
||||
vertexState.cAttributes[0].format = wgpu::VertexFormat::Uint32;
|
||||
vertexState.cAttributes[0].offset = 0;
|
||||
vertexState.cAttributes[0].shaderLocation = 0;
|
||||
|
||||
@@ -167,7 +167,7 @@ TEST_P(VertexBufferRobustnessTest, Float2Clamp) {
|
||||
vertexState.vertexBufferCount = 1;
|
||||
vertexState.cVertexBuffers[0].arrayStride = sizeof(float) * 2;
|
||||
vertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
vertexState.cAttributes[0].format = wgpu::VertexFormat::Float2;
|
||||
vertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x2;
|
||||
vertexState.cAttributes[0].offset = 0;
|
||||
vertexState.cAttributes[0].shaderLocation = 0;
|
||||
|
||||
@@ -185,7 +185,7 @@ TEST_P(VertexBufferRobustnessTest, Float3Clamp) {
|
||||
vertexState.vertexBufferCount = 1;
|
||||
vertexState.cVertexBuffers[0].arrayStride = sizeof(float) * 3;
|
||||
vertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
vertexState.cAttributes[0].format = wgpu::VertexFormat::Float3;
|
||||
vertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x3;
|
||||
vertexState.cAttributes[0].offset = 0;
|
||||
vertexState.cAttributes[0].shaderLocation = 0;
|
||||
|
||||
@@ -203,7 +203,7 @@ TEST_P(VertexBufferRobustnessTest, Float4Clamp) {
|
||||
vertexState.vertexBufferCount = 1;
|
||||
vertexState.cVertexBuffers[0].arrayStride = sizeof(float) * 4;
|
||||
vertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
vertexState.cAttributes[0].format = wgpu::VertexFormat::Float4;
|
||||
vertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
vertexState.cAttributes[0].offset = 0;
|
||||
vertexState.cAttributes[0].shaderLocation = 0;
|
||||
|
||||
|
||||
@@ -56,14 +56,14 @@ class VertexFormatTest : public DawnTest {
|
||||
|
||||
bool IsNormalizedFormat(wgpu::VertexFormat format) {
|
||||
switch (format) {
|
||||
case wgpu::VertexFormat::UChar2Norm:
|
||||
case wgpu::VertexFormat::UChar4Norm:
|
||||
case wgpu::VertexFormat::Char2Norm:
|
||||
case wgpu::VertexFormat::Char4Norm:
|
||||
case wgpu::VertexFormat::UShort2Norm:
|
||||
case wgpu::VertexFormat::UShort4Norm:
|
||||
case wgpu::VertexFormat::Short2Norm:
|
||||
case wgpu::VertexFormat::Short4Norm:
|
||||
case wgpu::VertexFormat::Unorm8x2:
|
||||
case wgpu::VertexFormat::Unorm8x4:
|
||||
case wgpu::VertexFormat::Snorm8x2:
|
||||
case wgpu::VertexFormat::Snorm8x4:
|
||||
case wgpu::VertexFormat::Unorm16x2:
|
||||
case wgpu::VertexFormat::Unorm16x4:
|
||||
case wgpu::VertexFormat::Snorm16x2:
|
||||
case wgpu::VertexFormat::Snorm16x4:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@@ -72,18 +72,18 @@ class VertexFormatTest : public DawnTest {
|
||||
|
||||
bool IsUnsignedFormat(wgpu::VertexFormat format) {
|
||||
switch (format) {
|
||||
case wgpu::VertexFormat::UInt:
|
||||
case wgpu::VertexFormat::UChar2:
|
||||
case wgpu::VertexFormat::UChar4:
|
||||
case wgpu::VertexFormat::UShort2:
|
||||
case wgpu::VertexFormat::UShort4:
|
||||
case wgpu::VertexFormat::UInt2:
|
||||
case wgpu::VertexFormat::UInt3:
|
||||
case wgpu::VertexFormat::UInt4:
|
||||
case wgpu::VertexFormat::UChar2Norm:
|
||||
case wgpu::VertexFormat::UChar4Norm:
|
||||
case wgpu::VertexFormat::UShort2Norm:
|
||||
case wgpu::VertexFormat::UShort4Norm:
|
||||
case wgpu::VertexFormat::Uint32:
|
||||
case wgpu::VertexFormat::Uint8x2:
|
||||
case wgpu::VertexFormat::Uint8x4:
|
||||
case wgpu::VertexFormat::Uint16x2:
|
||||
case wgpu::VertexFormat::Uint16x4:
|
||||
case wgpu::VertexFormat::Uint32x2:
|
||||
case wgpu::VertexFormat::Uint32x3:
|
||||
case wgpu::VertexFormat::Uint32x4:
|
||||
case wgpu::VertexFormat::Unorm8x2:
|
||||
case wgpu::VertexFormat::Unorm8x4:
|
||||
case wgpu::VertexFormat::Unorm16x2:
|
||||
case wgpu::VertexFormat::Unorm16x4:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@@ -92,12 +92,12 @@ class VertexFormatTest : public DawnTest {
|
||||
|
||||
bool IsFloatFormat(wgpu::VertexFormat format) {
|
||||
switch (format) {
|
||||
case wgpu::VertexFormat::Half2:
|
||||
case wgpu::VertexFormat::Half4:
|
||||
case wgpu::VertexFormat::Float:
|
||||
case wgpu::VertexFormat::Float2:
|
||||
case wgpu::VertexFormat::Float3:
|
||||
case wgpu::VertexFormat::Float4:
|
||||
case wgpu::VertexFormat::Float16x2:
|
||||
case wgpu::VertexFormat::Float16x4:
|
||||
case wgpu::VertexFormat::Float32:
|
||||
case wgpu::VertexFormat::Float32x2:
|
||||
case wgpu::VertexFormat::Float32x3:
|
||||
case wgpu::VertexFormat::Float32x4:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@@ -106,8 +106,8 @@ class VertexFormatTest : public DawnTest {
|
||||
|
||||
bool IsHalfFormat(wgpu::VertexFormat format) {
|
||||
switch (format) {
|
||||
case wgpu::VertexFormat::Half2:
|
||||
case wgpu::VertexFormat::Half4:
|
||||
case wgpu::VertexFormat::Float16x2:
|
||||
case wgpu::VertexFormat::Float16x4:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@@ -116,38 +116,38 @@ class VertexFormatTest : public DawnTest {
|
||||
|
||||
uint32_t BytesPerComponents(wgpu::VertexFormat format) {
|
||||
switch (format) {
|
||||
case wgpu::VertexFormat::Char2:
|
||||
case wgpu::VertexFormat::Char4:
|
||||
case wgpu::VertexFormat::UChar2:
|
||||
case wgpu::VertexFormat::UChar4:
|
||||
case wgpu::VertexFormat::UChar2Norm:
|
||||
case wgpu::VertexFormat::UChar4Norm:
|
||||
case wgpu::VertexFormat::Char2Norm:
|
||||
case wgpu::VertexFormat::Char4Norm:
|
||||
case wgpu::VertexFormat::Uint8x2:
|
||||
case wgpu::VertexFormat::Uint8x4:
|
||||
case wgpu::VertexFormat::Sint8x2:
|
||||
case wgpu::VertexFormat::Sint8x4:
|
||||
case wgpu::VertexFormat::Unorm8x2:
|
||||
case wgpu::VertexFormat::Unorm8x4:
|
||||
case wgpu::VertexFormat::Snorm8x2:
|
||||
case wgpu::VertexFormat::Snorm8x4:
|
||||
return 1;
|
||||
case wgpu::VertexFormat::UShort2:
|
||||
case wgpu::VertexFormat::UShort4:
|
||||
case wgpu::VertexFormat::Short2:
|
||||
case wgpu::VertexFormat::Short4:
|
||||
case wgpu::VertexFormat::UShort2Norm:
|
||||
case wgpu::VertexFormat::UShort4Norm:
|
||||
case wgpu::VertexFormat::Short2Norm:
|
||||
case wgpu::VertexFormat::Short4Norm:
|
||||
case wgpu::VertexFormat::Half2:
|
||||
case wgpu::VertexFormat::Half4:
|
||||
case wgpu::VertexFormat::Uint16x2:
|
||||
case wgpu::VertexFormat::Uint16x4:
|
||||
case wgpu::VertexFormat::Unorm16x2:
|
||||
case wgpu::VertexFormat::Unorm16x4:
|
||||
case wgpu::VertexFormat::Sint16x2:
|
||||
case wgpu::VertexFormat::Sint16x4:
|
||||
case wgpu::VertexFormat::Snorm16x2:
|
||||
case wgpu::VertexFormat::Snorm16x4:
|
||||
case wgpu::VertexFormat::Float16x2:
|
||||
case wgpu::VertexFormat::Float16x4:
|
||||
return 2;
|
||||
case wgpu::VertexFormat::UInt:
|
||||
case wgpu::VertexFormat::Int:
|
||||
case wgpu::VertexFormat::Float:
|
||||
case wgpu::VertexFormat::UInt2:
|
||||
case wgpu::VertexFormat::UInt3:
|
||||
case wgpu::VertexFormat::UInt4:
|
||||
case wgpu::VertexFormat::Int2:
|
||||
case wgpu::VertexFormat::Int3:
|
||||
case wgpu::VertexFormat::Int4:
|
||||
case wgpu::VertexFormat::Float2:
|
||||
case wgpu::VertexFormat::Float3:
|
||||
case wgpu::VertexFormat::Float4:
|
||||
case wgpu::VertexFormat::Float32:
|
||||
case wgpu::VertexFormat::Float32x2:
|
||||
case wgpu::VertexFormat::Float32x3:
|
||||
case wgpu::VertexFormat::Float32x4:
|
||||
case wgpu::VertexFormat::Uint32:
|
||||
case wgpu::VertexFormat::Uint32x2:
|
||||
case wgpu::VertexFormat::Uint32x3:
|
||||
case wgpu::VertexFormat::Uint32x4:
|
||||
case wgpu::VertexFormat::Sint32:
|
||||
case wgpu::VertexFormat::Sint32x2:
|
||||
case wgpu::VertexFormat::Sint32x3:
|
||||
case wgpu::VertexFormat::Sint32x4:
|
||||
return 4;
|
||||
default:
|
||||
DAWN_UNREACHABLE();
|
||||
@@ -156,39 +156,39 @@ class VertexFormatTest : public DawnTest {
|
||||
|
||||
uint32_t ComponentCount(wgpu::VertexFormat format) {
|
||||
switch (format) {
|
||||
case wgpu::VertexFormat::UInt:
|
||||
case wgpu::VertexFormat::Int:
|
||||
case wgpu::VertexFormat::Float:
|
||||
case wgpu::VertexFormat::Float32:
|
||||
case wgpu::VertexFormat::Uint32:
|
||||
case wgpu::VertexFormat::Sint32:
|
||||
return 1;
|
||||
case wgpu::VertexFormat::UChar2:
|
||||
case wgpu::VertexFormat::UShort2:
|
||||
case wgpu::VertexFormat::UInt2:
|
||||
case wgpu::VertexFormat::Char2:
|
||||
case wgpu::VertexFormat::Short2:
|
||||
case wgpu::VertexFormat::Int2:
|
||||
case wgpu::VertexFormat::UChar2Norm:
|
||||
case wgpu::VertexFormat::Char2Norm:
|
||||
case wgpu::VertexFormat::UShort2Norm:
|
||||
case wgpu::VertexFormat::Short2Norm:
|
||||
case wgpu::VertexFormat::Half2:
|
||||
case wgpu::VertexFormat::Float2:
|
||||
case wgpu::VertexFormat::Uint8x2:
|
||||
case wgpu::VertexFormat::Sint8x2:
|
||||
case wgpu::VertexFormat::Unorm8x2:
|
||||
case wgpu::VertexFormat::Snorm8x2:
|
||||
case wgpu::VertexFormat::Uint16x2:
|
||||
case wgpu::VertexFormat::Sint16x2:
|
||||
case wgpu::VertexFormat::Unorm16x2:
|
||||
case wgpu::VertexFormat::Snorm16x2:
|
||||
case wgpu::VertexFormat::Float16x2:
|
||||
case wgpu::VertexFormat::Float32x2:
|
||||
case wgpu::VertexFormat::Uint32x2:
|
||||
case wgpu::VertexFormat::Sint32x2:
|
||||
return 2;
|
||||
case wgpu::VertexFormat::Int3:
|
||||
case wgpu::VertexFormat::UInt3:
|
||||
case wgpu::VertexFormat::Float3:
|
||||
case wgpu::VertexFormat::Float32x3:
|
||||
case wgpu::VertexFormat::Uint32x3:
|
||||
case wgpu::VertexFormat::Sint32x3:
|
||||
return 3;
|
||||
case wgpu::VertexFormat::UChar4:
|
||||
case wgpu::VertexFormat::UShort4:
|
||||
case wgpu::VertexFormat::UInt4:
|
||||
case wgpu::VertexFormat::Char4:
|
||||
case wgpu::VertexFormat::Short4:
|
||||
case wgpu::VertexFormat::Int4:
|
||||
case wgpu::VertexFormat::UChar4Norm:
|
||||
case wgpu::VertexFormat::Char4Norm:
|
||||
case wgpu::VertexFormat::UShort4Norm:
|
||||
case wgpu::VertexFormat::Short4Norm:
|
||||
case wgpu::VertexFormat::Half4:
|
||||
case wgpu::VertexFormat::Float4:
|
||||
case wgpu::VertexFormat::Uint8x4:
|
||||
case wgpu::VertexFormat::Sint8x4:
|
||||
case wgpu::VertexFormat::Unorm8x4:
|
||||
case wgpu::VertexFormat::Snorm8x4:
|
||||
case wgpu::VertexFormat::Uint16x4:
|
||||
case wgpu::VertexFormat::Sint16x4:
|
||||
case wgpu::VertexFormat::Unorm16x4:
|
||||
case wgpu::VertexFormat::Snorm16x4:
|
||||
case wgpu::VertexFormat::Float16x4:
|
||||
case wgpu::VertexFormat::Float32x4:
|
||||
case wgpu::VertexFormat::Uint32x4:
|
||||
case wgpu::VertexFormat::Sint32x4:
|
||||
return 4;
|
||||
default:
|
||||
DAWN_UNREACHABLE();
|
||||
@@ -399,7 +399,7 @@ class VertexFormatTest : public DawnTest {
|
||||
}
|
||||
};
|
||||
|
||||
TEST_P(VertexFormatTest, UChar2) {
|
||||
TEST_P(VertexFormatTest, Uint8x2) {
|
||||
// TODO(cwallez@chromium.org): Failing because of a SPIRV-Cross issue.
|
||||
// See http://crbug.com/dawn/259
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||
@@ -423,10 +423,10 @@ TEST_P(VertexFormatTest, UChar2) {
|
||||
std::numeric_limits<uint8_t>::max(), 0, std::numeric_limits<uint8_t>::min(), 2, 200, 201,
|
||||
};
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::UChar2, vertexData, expectedData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Uint8x2, vertexData, expectedData);
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatTest, UChar4) {
|
||||
TEST_P(VertexFormatTest, Uint8x4) {
|
||||
// TODO(cwallez@chromium.org): Failing because of a SPIRV-Cross issue.
|
||||
// See http://crbug.com/dawn/259
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||
@@ -446,10 +446,10 @@ TEST_P(VertexFormatTest, UChar4) {
|
||||
203,
|
||||
};
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::UChar4, vertexData, vertexData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Uint8x4, vertexData, vertexData);
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatTest, Char2) {
|
||||
TEST_P(VertexFormatTest, Sint8x2) {
|
||||
// TODO(cwallez@chromium.org): Failing because of a SPIRV-Cross issue.
|
||||
// See http://crbug.com/dawn/259
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||
@@ -473,10 +473,10 @@ TEST_P(VertexFormatTest, Char2) {
|
||||
std::numeric_limits<int8_t>::max(), 0, std::numeric_limits<int8_t>::min(), -2, 120, -121,
|
||||
};
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Char2, vertexData, expectedData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Sint8x2, vertexData, expectedData);
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatTest, Char4) {
|
||||
TEST_P(VertexFormatTest, Sint8x4) {
|
||||
// TODO(cwallez@chromium.org): Failing because of a SPIRV-Cross issue.
|
||||
// See http://crbug.com/dawn/259
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||
@@ -496,10 +496,10 @@ TEST_P(VertexFormatTest, Char4) {
|
||||
-123,
|
||||
};
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Char4, vertexData, vertexData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Sint8x4, vertexData, vertexData);
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatTest, UChar2Norm) {
|
||||
TEST_P(VertexFormatTest, Unorm8x2) {
|
||||
// TODO(cwallez@chromium.org): Failing because of a SPIRV-Cross issue.
|
||||
// See http://crbug.com/dawn/259
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||
@@ -526,10 +526,10 @@ TEST_P(VertexFormatTest, UChar2Norm) {
|
||||
200,
|
||||
201};
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::UChar2Norm, vertexData, expectedData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Unorm8x2, vertexData, expectedData);
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatTest, UChar4Norm) {
|
||||
TEST_P(VertexFormatTest, Unorm8x4) {
|
||||
// TODO(cwallez@chromium.org): Failing because of a SPIRV-Cross issue.
|
||||
// See http://crbug.com/dawn/259
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||
@@ -547,10 +547,10 @@ TEST_P(VertexFormatTest, UChar4Norm) {
|
||||
202,
|
||||
203};
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::UChar4Norm, vertexData, vertexData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Unorm8x4, vertexData, vertexData);
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatTest, Char2Norm) {
|
||||
TEST_P(VertexFormatTest, Snorm8x2) {
|
||||
// TODO(cwallez@chromium.org): Failing because of a SPIRV-Cross issue.
|
||||
// See http://crbug.com/dawn/259
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||
@@ -579,10 +579,10 @@ TEST_P(VertexFormatTest, Char2Norm) {
|
||||
-121,
|
||||
};
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Char2Norm, vertexData, expectedData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Snorm8x2, vertexData, expectedData);
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatTest, Char4Norm) {
|
||||
TEST_P(VertexFormatTest, Snorm8x4) {
|
||||
// TODO(cwallez@chromium.org): Failing because of a SPIRV-Cross issue.
|
||||
// See http://crbug.com/dawn/259
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||
@@ -600,10 +600,10 @@ TEST_P(VertexFormatTest, Char4Norm) {
|
||||
102,
|
||||
-123};
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Char4Norm, vertexData, vertexData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Snorm8x4, vertexData, vertexData);
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatTest, UShort2) {
|
||||
TEST_P(VertexFormatTest, Uint16x2) {
|
||||
// TODO(cwallez@chromium.org): Failing because of a SPIRV-Cross issue.
|
||||
// See http://crbug.com/dawn/259
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||
@@ -615,10 +615,10 @@ TEST_P(VertexFormatTest, UShort2) {
|
||||
65432,
|
||||
4890};
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::UShort2, vertexData, vertexData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Uint16x2, vertexData, vertexData);
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatTest, UShort4) {
|
||||
TEST_P(VertexFormatTest, Uint16x4) {
|
||||
// TODO(cwallez@chromium.org): Failing because of a SPIRV-Cross issue.
|
||||
// See http://crbug.com/dawn/259
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||
@@ -638,10 +638,10 @@ TEST_P(VertexFormatTest, UShort4) {
|
||||
3467,
|
||||
};
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::UShort4, vertexData, vertexData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Uint16x4, vertexData, vertexData);
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatTest, Short2) {
|
||||
TEST_P(VertexFormatTest, Sint16x2) {
|
||||
// TODO(cwallez@chromium.org): Failing because of a SPIRV-Cross issue.
|
||||
// See http://crbug.com/dawn/259
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||
@@ -653,10 +653,10 @@ TEST_P(VertexFormatTest, Short2) {
|
||||
3876,
|
||||
-3948};
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Short2, vertexData, vertexData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Sint16x2, vertexData, vertexData);
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatTest, Short4) {
|
||||
TEST_P(VertexFormatTest, Sint16x4) {
|
||||
// TODO(cwallez@chromium.org): Failing because of a SPIRV-Cross issue.
|
||||
// See http://crbug.com/dawn/259
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||
@@ -676,10 +676,10 @@ TEST_P(VertexFormatTest, Short4) {
|
||||
-2987,
|
||||
};
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Short4, vertexData, vertexData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Sint16x4, vertexData, vertexData);
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatTest, UShort2Norm) {
|
||||
TEST_P(VertexFormatTest, Unorm16x2) {
|
||||
// TODO(cwallez@chromium.org): Failing because of a SPIRV-Cross issue.
|
||||
// See http://crbug.com/dawn/259
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||
@@ -691,10 +691,10 @@ TEST_P(VertexFormatTest, UShort2Norm) {
|
||||
3456,
|
||||
6543};
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::UShort2Norm, vertexData, vertexData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Unorm16x2, vertexData, vertexData);
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatTest, UShort4Norm) {
|
||||
TEST_P(VertexFormatTest, Unorm16x4) {
|
||||
// TODO(cwallez@chromium.org): Failing because of a SPIRV-Cross issue.
|
||||
// See http://crbug.com/dawn/259
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||
@@ -712,10 +712,10 @@ TEST_P(VertexFormatTest, UShort4Norm) {
|
||||
2987,
|
||||
2987};
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::UShort4Norm, vertexData, vertexData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Unorm16x4, vertexData, vertexData);
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatTest, Short2Norm) {
|
||||
TEST_P(VertexFormatTest, Snorm16x2) {
|
||||
// TODO(cwallez@chromium.org): Failing because of a SPIRV-Cross issue.
|
||||
// See http://crbug.com/dawn/259
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||
@@ -727,10 +727,10 @@ TEST_P(VertexFormatTest, Short2Norm) {
|
||||
4987,
|
||||
-6789};
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Short2Norm, vertexData, vertexData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Snorm16x2, vertexData, vertexData);
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatTest, Short4Norm) {
|
||||
TEST_P(VertexFormatTest, Snorm16x4) {
|
||||
// TODO(cwallez@chromium.org): Failing because of a SPIRV-Cross issue.
|
||||
// See http://crbug.com/dawn/259
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||
@@ -748,10 +748,10 @@ TEST_P(VertexFormatTest, Short4Norm) {
|
||||
20432,
|
||||
-2083};
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Short4Norm, vertexData, vertexData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Snorm16x4, vertexData, vertexData);
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatTest, Half2) {
|
||||
TEST_P(VertexFormatTest, Float16x2) {
|
||||
// TODO(cwallez@chromium.org): Failing because of a SPIRV-Cross issue.
|
||||
// See http://crbug.com/dawn/259
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||
@@ -759,10 +759,10 @@ TEST_P(VertexFormatTest, Half2) {
|
||||
std::vector<uint16_t> vertexData =
|
||||
Float32ToFloat16(std::vector<float>({14.8f, -0.0f, 22.5f, 1.3f, +0.0f, -24.8f}));
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Half2, vertexData, vertexData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Float16x2, vertexData, vertexData);
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatTest, Half4) {
|
||||
TEST_P(VertexFormatTest, Float16x4) {
|
||||
// TODO(cwallez@chromium.org): Failing because of a SPIRV-Cross issue.
|
||||
// See http://crbug.com/dawn/259
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||
@@ -770,34 +770,34 @@ TEST_P(VertexFormatTest, Half4) {
|
||||
std::vector<uint16_t> vertexData = Float32ToFloat16(std::vector<float>(
|
||||
{+0.0f, -16.8f, 18.2f, -0.0f, 12.5f, 1.3f, 14.8f, -12.4f, 22.5f, -48.8f, 47.4f, -24.8f}));
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Half4, vertexData, vertexData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Float16x4, vertexData, vertexData);
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatTest, Float) {
|
||||
TEST_P(VertexFormatTest, Float32) {
|
||||
// TODO(cwallez@chromium.org): Failing because of a SPIRV-Cross issue.
|
||||
// See http://crbug.com/dawn/259
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||
|
||||
std::vector<float> vertexData = {1.3f, +0.0f, -0.0f};
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Float, vertexData, vertexData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Float32, vertexData, vertexData);
|
||||
|
||||
vertexData = std::vector<float>{+1.0f, -1.0f, 18.23f};
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Float, vertexData, vertexData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Float32, vertexData, vertexData);
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatTest, Float2) {
|
||||
TEST_P(VertexFormatTest, Float32x2) {
|
||||
// TODO(cwallez@chromium.org): Failing because of a SPIRV-Cross issue.
|
||||
// See http://crbug.com/dawn/259
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||
|
||||
std::vector<float> vertexData = {18.23f, -0.0f, +0.0f, +1.0f, 1.3f, -1.0f};
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Float2, vertexData, vertexData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Float32x2, vertexData, vertexData);
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatTest, Float3) {
|
||||
TEST_P(VertexFormatTest, Float32x3) {
|
||||
// TODO(cwallez@chromium.org): Failing because of a SPIRV-Cross issue.
|
||||
// See http://crbug.com/dawn/259
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||
@@ -806,10 +806,10 @@ TEST_P(VertexFormatTest, Float3) {
|
||||
+0.0f, -1.0f, -0.0f, 1.0f, 1.3f, 99.45f, 23.6f, -81.2f, 55.0f,
|
||||
};
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Float3, vertexData, vertexData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Float32x3, vertexData, vertexData);
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatTest, Float4) {
|
||||
TEST_P(VertexFormatTest, Float32x4) {
|
||||
// TODO(cwallez@chromium.org): Failing because of a SPIRV-Cross issue.
|
||||
// See http://crbug.com/dawn/259
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||
@@ -818,10 +818,10 @@ TEST_P(VertexFormatTest, Float4) {
|
||||
19.2f, -19.3f, +0.0f, 1.0f, -0.0f, 1.0f, 1.3f, -1.0f, 13.078f, 21.1965f, -1.1f, -1.2f,
|
||||
};
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Float4, vertexData, vertexData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Float32x4, vertexData, vertexData);
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatTest, UInt) {
|
||||
TEST_P(VertexFormatTest, Uint32) {
|
||||
// TODO(cwallez@chromium.org): Failing because of a SPIRV-Cross issue.
|
||||
// See http://crbug.com/dawn/259
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||
@@ -830,10 +830,10 @@ TEST_P(VertexFormatTest, UInt) {
|
||||
std::numeric_limits<uint16_t>::max(),
|
||||
std::numeric_limits<uint8_t>::max()};
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::UInt, vertexData, vertexData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Uint32, vertexData, vertexData);
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatTest, UInt2) {
|
||||
TEST_P(VertexFormatTest, Uint32x2) {
|
||||
// TODO(cwallez@chromium.org): Failing because of a SPIRV-Cross issue.
|
||||
// See http://crbug.com/dawn/259
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||
@@ -842,10 +842,10 @@ TEST_P(VertexFormatTest, UInt2) {
|
||||
std::numeric_limits<uint16_t>::max(), 64,
|
||||
std::numeric_limits<uint8_t>::max(), 128};
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::UInt2, vertexData, vertexData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Uint32x2, vertexData, vertexData);
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatTest, UInt3) {
|
||||
TEST_P(VertexFormatTest, Uint32x3) {
|
||||
// TODO(cwallez@chromium.org): Failing because of a SPIRV-Cross issue.
|
||||
// See http://crbug.com/dawn/259
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||
@@ -854,10 +854,10 @@ TEST_P(VertexFormatTest, UInt3) {
|
||||
std::numeric_limits<uint16_t>::max(), 164, 128,
|
||||
std::numeric_limits<uint8_t>::max(), 1283, 256};
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::UInt3, vertexData, vertexData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Uint32x3, vertexData, vertexData);
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatTest, UInt4) {
|
||||
TEST_P(VertexFormatTest, Uint32x4) {
|
||||
// TODO(cwallez@chromium.org): Failing because of a SPIRV-Cross issue.
|
||||
// See http://crbug.com/dawn/259
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||
@@ -866,10 +866,10 @@ TEST_P(VertexFormatTest, UInt4) {
|
||||
std::numeric_limits<uint16_t>::max(), 164, 128, 0,
|
||||
std::numeric_limits<uint8_t>::max(), 1283, 256, 4567};
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::UInt4, vertexData, vertexData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Uint32x4, vertexData, vertexData);
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatTest, Int) {
|
||||
TEST_P(VertexFormatTest, Sint32) {
|
||||
// TODO(cwallez@chromium.org): Failing because of a SPIRV-Cross issue.
|
||||
// See http://crbug.com/dawn/259
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||
@@ -878,10 +878,10 @@ TEST_P(VertexFormatTest, Int) {
|
||||
std::numeric_limits<int32_t>::min(),
|
||||
std::numeric_limits<int8_t>::max()};
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Int, vertexData, vertexData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Sint32, vertexData, vertexData);
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatTest, Int2) {
|
||||
TEST_P(VertexFormatTest, Sint32x2) {
|
||||
// TODO(cwallez@chromium.org): Failing because of a SPIRV-Cross issue.
|
||||
// See http://crbug.com/dawn/259
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||
@@ -891,10 +891,10 @@ TEST_P(VertexFormatTest, Int2) {
|
||||
std::numeric_limits<int16_t>::max(), std::numeric_limits<int16_t>::min(),
|
||||
std::numeric_limits<int8_t>::max(), std::numeric_limits<int8_t>::min()};
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Int2, vertexData, vertexData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Sint32x2, vertexData, vertexData);
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatTest, Int3) {
|
||||
TEST_P(VertexFormatTest, Sint32x3) {
|
||||
// TODO(cwallez@chromium.org): Failing because of a SPIRV-Cross issue.
|
||||
// See http://crbug.com/dawn/259
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||
@@ -904,10 +904,10 @@ TEST_P(VertexFormatTest, Int3) {
|
||||
std::numeric_limits<int16_t>::max(), std::numeric_limits<int16_t>::min(), 128,
|
||||
std::numeric_limits<int8_t>::max(), std::numeric_limits<int8_t>::min(), 256};
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Int3, vertexData, vertexData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Sint32x3, vertexData, vertexData);
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatTest, Int4) {
|
||||
TEST_P(VertexFormatTest, Sint32x4) {
|
||||
// TODO(cwallez@chromium.org): Failing because of a SPIRV-Cross issue.
|
||||
// See http://crbug.com/dawn/259
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||
@@ -917,7 +917,7 @@ TEST_P(VertexFormatTest, Int4) {
|
||||
std::numeric_limits<int16_t>::max(), std::numeric_limits<int16_t>::min(), -128, 0,
|
||||
std::numeric_limits<int8_t>::max(), std::numeric_limits<int8_t>::min(), 256, -4567};
|
||||
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Int4, vertexData, vertexData);
|
||||
DoVertexFormatTest(wgpu::VertexFormat::Sint32x4, vertexData, vertexData);
|
||||
}
|
||||
|
||||
DAWN_INSTANTIATE_TEST(VertexFormatTest,
|
||||
|
||||
@@ -46,15 +46,15 @@ class VertexStateTest : public DawnTest {
|
||||
bool ShouldComponentBeDefault(VertexFormat format, int component) {
|
||||
EXPECT_TRUE(component >= 0 && component < 4);
|
||||
switch (format) {
|
||||
case VertexFormat::Float4:
|
||||
case VertexFormat::UChar4Norm:
|
||||
case VertexFormat::Float32x4:
|
||||
case VertexFormat::Unorm8x4:
|
||||
return component >= 4;
|
||||
case VertexFormat::Float3:
|
||||
case VertexFormat::Float32x3:
|
||||
return component >= 3;
|
||||
case VertexFormat::Float2:
|
||||
case VertexFormat::UChar2Norm:
|
||||
case VertexFormat::Float32x2:
|
||||
case VertexFormat::Unorm8x2:
|
||||
return component >= 2;
|
||||
case VertexFormat::Float:
|
||||
case VertexFormat::Float32:
|
||||
return component >= 1;
|
||||
default:
|
||||
DAWN_UNREACHABLE();
|
||||
@@ -236,10 +236,10 @@ class VertexStateTest : public DawnTest {
|
||||
// Test compilation and usage of the fixture :)
|
||||
TEST_P(VertexStateTest, Basic) {
|
||||
utils::ComboVertexStateDescriptor vertexState;
|
||||
MakeVertexState({{4 * sizeof(float), InputStepMode::Vertex, {{0, 0, VertexFormat::Float4}}}},
|
||||
MakeVertexState({{4 * sizeof(float), InputStepMode::Vertex, {{0, 0, VertexFormat::Float32x4}}}},
|
||||
&vertexState);
|
||||
wgpu::RenderPipeline pipeline =
|
||||
MakeTestPipeline(vertexState, 1, {{0, VertexFormat::Float4, InputStepMode::Vertex}});
|
||||
MakeTestPipeline(vertexState, 1, {{0, VertexFormat::Float32x4, InputStepMode::Vertex}});
|
||||
|
||||
// clang-format off
|
||||
wgpu::Buffer buffer0 = MakeVertexBuffer<float>({
|
||||
@@ -257,9 +257,9 @@ TEST_P(VertexStateTest, ZeroStride) {
|
||||
DAWN_SKIP_TEST_IF(IsLinux() && IsOpenGL());
|
||||
|
||||
utils::ComboVertexStateDescriptor vertexState;
|
||||
MakeVertexState({{0, InputStepMode::Vertex, {{0, 0, VertexFormat::Float4}}}}, &vertexState);
|
||||
MakeVertexState({{0, InputStepMode::Vertex, {{0, 0, VertexFormat::Float32x4}}}}, &vertexState);
|
||||
wgpu::RenderPipeline pipeline =
|
||||
MakeTestPipeline(vertexState, 0, {{0, VertexFormat::Float4, InputStepMode::Vertex}});
|
||||
MakeTestPipeline(vertexState, 0, {{0, VertexFormat::Float32x4, InputStepMode::Vertex}});
|
||||
|
||||
wgpu::Buffer buffer0 = MakeVertexBuffer<float>({
|
||||
0,
|
||||
@@ -278,9 +278,10 @@ TEST_P(VertexStateTest, AttributeExpanding) {
|
||||
// R32F case
|
||||
{
|
||||
utils::ComboVertexStateDescriptor vertexState;
|
||||
MakeVertexState({{0, InputStepMode::Vertex, {{0, 0, VertexFormat::Float}}}}, &vertexState);
|
||||
MakeVertexState({{0, InputStepMode::Vertex, {{0, 0, VertexFormat::Float32}}}},
|
||||
&vertexState);
|
||||
wgpu::RenderPipeline pipeline =
|
||||
MakeTestPipeline(vertexState, 0, {{0, VertexFormat::Float, InputStepMode::Vertex}});
|
||||
MakeTestPipeline(vertexState, 0, {{0, VertexFormat::Float32, InputStepMode::Vertex}});
|
||||
|
||||
wgpu::Buffer buffer0 = MakeVertexBuffer<float>({0, 1, 2, 3});
|
||||
DoTestDraw(pipeline, 1, 1, {DrawVertexBuffer{0, &buffer0}});
|
||||
@@ -288,9 +289,10 @@ TEST_P(VertexStateTest, AttributeExpanding) {
|
||||
// RG32F case
|
||||
{
|
||||
utils::ComboVertexStateDescriptor vertexState;
|
||||
MakeVertexState({{0, InputStepMode::Vertex, {{0, 0, VertexFormat::Float2}}}}, &vertexState);
|
||||
MakeVertexState({{0, InputStepMode::Vertex, {{0, 0, VertexFormat::Float32x2}}}},
|
||||
&vertexState);
|
||||
wgpu::RenderPipeline pipeline =
|
||||
MakeTestPipeline(vertexState, 0, {{0, VertexFormat::Float2, InputStepMode::Vertex}});
|
||||
MakeTestPipeline(vertexState, 0, {{0, VertexFormat::Float32x2, InputStepMode::Vertex}});
|
||||
|
||||
wgpu::Buffer buffer0 = MakeVertexBuffer<float>({0, 1, 2, 3});
|
||||
DoTestDraw(pipeline, 1, 1, {DrawVertexBuffer{0, &buffer0}});
|
||||
@@ -298,9 +300,10 @@ TEST_P(VertexStateTest, AttributeExpanding) {
|
||||
// RGB32F case
|
||||
{
|
||||
utils::ComboVertexStateDescriptor vertexState;
|
||||
MakeVertexState({{0, InputStepMode::Vertex, {{0, 0, VertexFormat::Float3}}}}, &vertexState);
|
||||
MakeVertexState({{0, InputStepMode::Vertex, {{0, 0, VertexFormat::Float32x3}}}},
|
||||
&vertexState);
|
||||
wgpu::RenderPipeline pipeline =
|
||||
MakeTestPipeline(vertexState, 0, {{0, VertexFormat::Float3, InputStepMode::Vertex}});
|
||||
MakeTestPipeline(vertexState, 0, {{0, VertexFormat::Float32x3, InputStepMode::Vertex}});
|
||||
|
||||
wgpu::Buffer buffer0 = MakeVertexBuffer<float>({0, 1, 2, 3});
|
||||
DoTestDraw(pipeline, 1, 1, {DrawVertexBuffer{0, &buffer0}});
|
||||
@@ -313,10 +316,10 @@ TEST_P(VertexStateTest, StrideLargerThanAttributes) {
|
||||
DAWN_SKIP_TEST_IF(IsLinux() && IsOpenGL());
|
||||
|
||||
utils::ComboVertexStateDescriptor vertexState;
|
||||
MakeVertexState({{8 * sizeof(float), InputStepMode::Vertex, {{0, 0, VertexFormat::Float4}}}},
|
||||
MakeVertexState({{8 * sizeof(float), InputStepMode::Vertex, {{0, 0, VertexFormat::Float32x4}}}},
|
||||
&vertexState);
|
||||
wgpu::RenderPipeline pipeline =
|
||||
MakeTestPipeline(vertexState, 1, {{0, VertexFormat::Float4, InputStepMode::Vertex}});
|
||||
MakeTestPipeline(vertexState, 1, {{0, VertexFormat::Float32x4, InputStepMode::Vertex}});
|
||||
|
||||
// clang-format off
|
||||
wgpu::Buffer buffer0 = MakeVertexBuffer<float>({
|
||||
@@ -334,10 +337,10 @@ TEST_P(VertexStateTest, TwoAttributesAtAnOffsetVertex) {
|
||||
MakeVertexState(
|
||||
{{8 * sizeof(float),
|
||||
InputStepMode::Vertex,
|
||||
{{0, 0, VertexFormat::Float4}, {1, 4 * sizeof(float), VertexFormat::Float4}}}},
|
||||
{{0, 0, VertexFormat::Float32x4}, {1, 4 * sizeof(float), VertexFormat::Float32x4}}}},
|
||||
&vertexState);
|
||||
wgpu::RenderPipeline pipeline =
|
||||
MakeTestPipeline(vertexState, 1, {{0, VertexFormat::Float4, InputStepMode::Vertex}});
|
||||
MakeTestPipeline(vertexState, 1, {{0, VertexFormat::Float32x4, InputStepMode::Vertex}});
|
||||
|
||||
// clang-format off
|
||||
wgpu::Buffer buffer0 = MakeVertexBuffer<float>({
|
||||
@@ -355,10 +358,10 @@ TEST_P(VertexStateTest, TwoAttributesAtAnOffsetInstance) {
|
||||
MakeVertexState(
|
||||
{{8 * sizeof(float),
|
||||
InputStepMode::Instance,
|
||||
{{0, 0, VertexFormat::Float4}, {1, 4 * sizeof(float), VertexFormat::Float4}}}},
|
||||
{{0, 0, VertexFormat::Float32x4}, {1, 4 * sizeof(float), VertexFormat::Float32x4}}}},
|
||||
&vertexState);
|
||||
wgpu::RenderPipeline pipeline =
|
||||
MakeTestPipeline(vertexState, 1, {{0, VertexFormat::Float4, InputStepMode::Instance}});
|
||||
MakeTestPipeline(vertexState, 1, {{0, VertexFormat::Float32x4, InputStepMode::Instance}});
|
||||
|
||||
// clang-format off
|
||||
wgpu::Buffer buffer0 = MakeVertexBuffer<float>({
|
||||
@@ -373,10 +376,11 @@ TEST_P(VertexStateTest, TwoAttributesAtAnOffsetInstance) {
|
||||
// Test a pure-instance input state
|
||||
TEST_P(VertexStateTest, PureInstance) {
|
||||
utils::ComboVertexStateDescriptor vertexState;
|
||||
MakeVertexState({{4 * sizeof(float), InputStepMode::Instance, {{0, 0, VertexFormat::Float4}}}},
|
||||
&vertexState);
|
||||
MakeVertexState(
|
||||
{{4 * sizeof(float), InputStepMode::Instance, {{0, 0, VertexFormat::Float32x4}}}},
|
||||
&vertexState);
|
||||
wgpu::RenderPipeline pipeline =
|
||||
MakeTestPipeline(vertexState, 1, {{0, VertexFormat::Float4, InputStepMode::Instance}});
|
||||
MakeTestPipeline(vertexState, 1, {{0, VertexFormat::Float32x4, InputStepMode::Instance}});
|
||||
|
||||
// clang-format off
|
||||
wgpu::Buffer buffer0 = MakeVertexBuffer<float>({
|
||||
@@ -396,17 +400,17 @@ TEST_P(VertexStateTest, MixedEverything) {
|
||||
MakeVertexState(
|
||||
{{12 * sizeof(float),
|
||||
InputStepMode::Vertex,
|
||||
{{0, 0, VertexFormat::Float}, {1, 6 * sizeof(float), VertexFormat::Float2}}},
|
||||
{{0, 0, VertexFormat::Float32}, {1, 6 * sizeof(float), VertexFormat::Float32x2}}},
|
||||
{10 * sizeof(float),
|
||||
InputStepMode::Instance,
|
||||
{{2, 0, VertexFormat::Float3}, {3, 5 * sizeof(float), VertexFormat::Float4}}}},
|
||||
{{2, 0, VertexFormat::Float32x3}, {3, 5 * sizeof(float), VertexFormat::Float32x4}}}},
|
||||
&vertexState);
|
||||
wgpu::RenderPipeline pipeline =
|
||||
MakeTestPipeline(vertexState, 1,
|
||||
{{0, VertexFormat::Float, InputStepMode::Vertex},
|
||||
{1, VertexFormat::Float2, InputStepMode::Vertex},
|
||||
{2, VertexFormat::Float3, InputStepMode::Instance},
|
||||
{3, VertexFormat::Float4, InputStepMode::Instance}});
|
||||
{{0, VertexFormat::Float32, InputStepMode::Vertex},
|
||||
{1, VertexFormat::Float32x2, InputStepMode::Vertex},
|
||||
{2, VertexFormat::Float32x3, InputStepMode::Instance},
|
||||
{3, VertexFormat::Float32x4, InputStepMode::Instance}});
|
||||
|
||||
// clang-format off
|
||||
wgpu::Buffer buffer0 = MakeVertexBuffer<float>({
|
||||
@@ -429,11 +433,12 @@ TEST_P(VertexStateTest, MixedEverything) {
|
||||
TEST_P(VertexStateTest, UnusedVertexSlot) {
|
||||
// Instance input state, using slot 1
|
||||
utils::ComboVertexStateDescriptor instanceVertexState;
|
||||
MakeVertexState({{0, InputStepMode::Vertex, {}},
|
||||
{4 * sizeof(float), InputStepMode::Instance, {{0, 0, VertexFormat::Float4}}}},
|
||||
&instanceVertexState);
|
||||
MakeVertexState(
|
||||
{{0, InputStepMode::Vertex, {}},
|
||||
{4 * sizeof(float), InputStepMode::Instance, {{0, 0, VertexFormat::Float32x4}}}},
|
||||
&instanceVertexState);
|
||||
wgpu::RenderPipeline instancePipeline = MakeTestPipeline(
|
||||
instanceVertexState, 1, {{0, VertexFormat::Float4, InputStepMode::Instance}});
|
||||
instanceVertexState, 1, {{0, VertexFormat::Float32x4, InputStepMode::Instance}});
|
||||
|
||||
// clang-format off
|
||||
wgpu::Buffer buffer = MakeVertexBuffer<float>({
|
||||
@@ -469,18 +474,19 @@ TEST_P(VertexStateTest, UnusedVertexSlot) {
|
||||
TEST_P(VertexStateTest, MultiplePipelinesMixedVertexState) {
|
||||
// Basic input state, using slot 0
|
||||
utils::ComboVertexStateDescriptor vertexVertexState;
|
||||
MakeVertexState({{4 * sizeof(float), InputStepMode::Vertex, {{0, 0, VertexFormat::Float4}}}},
|
||||
MakeVertexState({{4 * sizeof(float), InputStepMode::Vertex, {{0, 0, VertexFormat::Float32x4}}}},
|
||||
&vertexVertexState);
|
||||
wgpu::RenderPipeline vertexPipeline =
|
||||
MakeTestPipeline(vertexVertexState, 1, {{0, VertexFormat::Float4, InputStepMode::Vertex}});
|
||||
wgpu::RenderPipeline vertexPipeline = MakeTestPipeline(
|
||||
vertexVertexState, 1, {{0, VertexFormat::Float32x4, InputStepMode::Vertex}});
|
||||
|
||||
// Instance input state, using slot 1
|
||||
utils::ComboVertexStateDescriptor instanceVertexState;
|
||||
MakeVertexState({{0, InputStepMode::Instance, {}},
|
||||
{4 * sizeof(float), InputStepMode::Instance, {{0, 0, VertexFormat::Float4}}}},
|
||||
&instanceVertexState);
|
||||
MakeVertexState(
|
||||
{{0, InputStepMode::Instance, {}},
|
||||
{4 * sizeof(float), InputStepMode::Instance, {{0, 0, VertexFormat::Float32x4}}}},
|
||||
&instanceVertexState);
|
||||
wgpu::RenderPipeline instancePipeline = MakeTestPipeline(
|
||||
instanceVertexState, 1, {{0, VertexFormat::Float4, InputStepMode::Instance}});
|
||||
instanceVertexState, 1, {{0, VertexFormat::Float32x4, InputStepMode::Instance}});
|
||||
|
||||
// clang-format off
|
||||
wgpu::Buffer buffer = MakeVertexBuffer<float>({
|
||||
@@ -525,10 +531,10 @@ TEST_P(VertexStateTest, LastAllowedVertexBuffer) {
|
||||
vertexState.cVertexBuffers[kBufferIndex].attributes = &vertexState.cAttributes[0];
|
||||
vertexState.cAttributes[0].shaderLocation = 0;
|
||||
vertexState.cAttributes[0].offset = 0;
|
||||
vertexState.cAttributes[0].format = VertexFormat::Float4;
|
||||
vertexState.cAttributes[0].format = VertexFormat::Float32x4;
|
||||
|
||||
wgpu::RenderPipeline pipeline =
|
||||
MakeTestPipeline(vertexState, 1, {{0, VertexFormat::Float4, InputStepMode::Vertex}});
|
||||
MakeTestPipeline(vertexState, 1, {{0, VertexFormat::Float32x4, InputStepMode::Vertex}});
|
||||
|
||||
wgpu::Buffer buffer0 = MakeVertexBuffer<float>({0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5});
|
||||
DoTestDraw(pipeline, 1, 1, {DrawVertexBuffer{kMaxVertexBuffers - 1, &buffer0}});
|
||||
@@ -543,10 +549,10 @@ TEST_P(VertexStateTest, OverlappingVertexAttributes) {
|
||||
InputStepMode::Vertex,
|
||||
{
|
||||
// "****" represents the bytes we'll actually read in the shader.
|
||||
{0, 0 /* offset */, VertexFormat::Float4}, // |****|----|----|----|
|
||||
{1, 4 /* offset */, VertexFormat::UInt2}, // |****|****|
|
||||
{2, 8 /* offset */, VertexFormat::Half4}, // |-----****|
|
||||
{3, 0 /* offset */, VertexFormat::Float}, // |****|
|
||||
{0, 0 /* offset */, VertexFormat::Float32x4}, // |****|----|----|----|
|
||||
{1, 4 /* offset */, VertexFormat::Uint32x2}, // |****|****|
|
||||
{2, 8 /* offset */, VertexFormat::Float16x4}, // |-----****|
|
||||
{3, 0 /* offset */, VertexFormat::Float32}, // |****|
|
||||
}}},
|
||||
&vertexState);
|
||||
|
||||
|
||||
@@ -355,7 +355,7 @@ void DrawCallPerf::SetUp() {
|
||||
renderPipelineDesc.cVertexState.vertexBufferCount = 1;
|
||||
renderPipelineDesc.cVertexState.cVertexBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
renderPipelineDesc.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
renderPipelineDesc.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float4;
|
||||
renderPipelineDesc.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
renderPipelineDesc.depthStencilState = &renderPipelineDesc.cDepthStencilState;
|
||||
renderPipelineDesc.cDepthStencilState.format = wgpu::TextureFormat::Depth24PlusStencil8;
|
||||
renderPipelineDesc.cColorStates[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace {
|
||||
descriptor->cVertexState.vertexBufferCount = 1;
|
||||
descriptor->cVertexState.cVertexBuffers[0].arrayStride = 2 * sizeof(float);
|
||||
descriptor->cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
descriptor->cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float2;
|
||||
descriptor->cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x2;
|
||||
descriptor->cVertexState.cAttributes[0].shaderLocation = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -646,7 +646,7 @@ TEST_F(RenderPipelineValidationTest, VertexAttribCorrectEntryPoint) {
|
||||
descriptor.cVertexState.vertexBufferCount = 1;
|
||||
descriptor.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
descriptor.cVertexState.cVertexBuffers[0].arrayStride = 16;
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float4;
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
descriptor.cVertexState.cAttributes[0].offset = 0;
|
||||
|
||||
// Success cases, the attribute used by the entryPoint is declared in the pipeline.
|
||||
|
||||
@@ -73,7 +73,7 @@ class VertexBufferValidationTest : public ValidationTest {
|
||||
descriptor.cVertexState.cVertexBuffers[i].attributes =
|
||||
&descriptor.cVertexState.cAttributes[i];
|
||||
descriptor.cVertexState.cAttributes[i].shaderLocation = i;
|
||||
descriptor.cVertexState.cAttributes[i].format = wgpu::VertexFormat::Float3;
|
||||
descriptor.cVertexState.cAttributes[i].format = wgpu::VertexFormat::Float32x3;
|
||||
}
|
||||
descriptor.cVertexState.vertexBufferCount = bufferCount;
|
||||
|
||||
|
||||
@@ -284,7 +284,7 @@ TEST_F(VertexStateTest, SetAttributeOffsetOutOfBounds) {
|
||||
utils::ComboVertexStateDescriptor state;
|
||||
state.vertexBufferCount = 1;
|
||||
state.cVertexBuffers[0].attributeCount = 1;
|
||||
state.cAttributes[0].offset = kMaxVertexBufferStride - sizeof(wgpu::VertexFormat::Float);
|
||||
state.cAttributes[0].offset = kMaxVertexBufferStride - sizeof(wgpu::VertexFormat::Float32);
|
||||
CreatePipeline(true, state, kDummyVertexShader);
|
||||
|
||||
// Test attribute offset out of bounds
|
||||
@@ -321,6 +321,6 @@ TEST_F(VertexStateTest, VertexFormatLargerThanNonZeroStride) {
|
||||
state.vertexBufferCount = 1;
|
||||
state.cVertexBuffers[0].arrayStride = 4;
|
||||
state.cVertexBuffers[0].attributeCount = 1;
|
||||
state.cAttributes[0].format = wgpu::VertexFormat::Float4;
|
||||
state.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
CreatePipeline(false, state, kDummyVertexShader);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user