[dawn] Support additional 1-component vertex formats
As well as unorm8x4-bgra. These formats weren't added to WebGPU earlier
as they were not available on macOS 10.13 and below. They are now
guaranteed on all platforms that support WebGPU and we can add them.
The Tint vertex pulling transform is updated to support the new formats,
but unorm8x4-bgra will require an additional transform for GLSL that
swizzles some of the attributes.
Bug: 376924407
Change-Id: I9779a5b732528920e12c55d16a3507e78e94481e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/213435
Reviewed-by: Loko Kung <lokokung@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/dawn/dawn.json b/src/dawn/dawn.json
index 374119a..5bbcba3 100644
--- a/src/dawn/dawn.json
+++ b/src/dawn/dawn.json
@@ -4421,37 +4421,47 @@
"vertex format": {
"category": "enum",
"values": [
- {"value": 1, "name": "uint8x2"},
- {"value": 2, "name": "uint8x4"},
- {"value": 3, "name": "sint8x2"},
- {"value": 4, "name": "sint8x4"},
- {"value": 5, "name": "unorm8x2"},
- {"value": 6, "name": "unorm8x4"},
- {"value": 7, "name": "snorm8x2"},
- {"value": 8, "name": "snorm8x4"},
- {"value": 9, "name": "uint16x2"},
- {"value": 10, "name": "uint16x4"},
- {"value": 11, "name": "sint16x2"},
- {"value": 12, "name": "sint16x4"},
- {"value": 13, "name": "unorm16x2"},
- {"value": 14, "name": "unorm16x4"},
- {"value": 15, "name": "snorm16x2"},
- {"value": 16, "name": "snorm16x4"},
- {"value": 17, "name": "float16x2"},
- {"value": 18, "name": "float16x4"},
- {"value": 19, "name": "float32"},
- {"value": 20, "name": "float32x2"},
- {"value": 21, "name": "float32x3"},
- {"value": 22, "name": "float32x4"},
- {"value": 23, "name": "uint32"},
- {"value": 24, "name": "uint32x2"},
- {"value": 25, "name": "uint32x3"},
- {"value": 26, "name": "uint32x4"},
- {"value": 27, "name": "sint32"},
- {"value": 28, "name": "sint32x2"},
- {"value": 29, "name": "sint32x3"},
- {"value": 30, "name": "sint32x4"},
- {"value": 31, "name": "unorm 10_10_10_2", "jsrepr": "'unorm10-10-10-2'"}
+ {"value": 1, "name": "uint8"},
+ {"value": 2, "name": "uint8x2"},
+ {"value": 3, "name": "uint8x4"},
+ {"value": 4, "name": "sint8"},
+ {"value": 5, "name": "sint8x2"},
+ {"value": 6, "name": "sint8x4"},
+ {"value": 7, "name": "unorm8"},
+ {"value": 8, "name": "unorm8x2"},
+ {"value": 9, "name": "unorm8x4"},
+ {"value": 10, "name": "snorm8"},
+ {"value": 11, "name": "snorm8x2"},
+ {"value": 12, "name": "snorm8x4"},
+ {"value": 13, "name": "uint16"},
+ {"value": 14, "name": "uint16x2"},
+ {"value": 15, "name": "uint16x4"},
+ {"value": 16, "name": "sint16"},
+ {"value": 17, "name": "sint16x2"},
+ {"value": 18, "name": "sint16x4"},
+ {"value": 19, "name": "unorm16"},
+ {"value": 20, "name": "unorm16x2"},
+ {"value": 21, "name": "unorm16x4"},
+ {"value": 22, "name": "snorm16"},
+ {"value": 23, "name": "snorm16x2"},
+ {"value": 24, "name": "snorm16x4"},
+ {"value": 25, "name": "float16"},
+ {"value": 26, "name": "float16x2"},
+ {"value": 27, "name": "float16x4"},
+ {"value": 28, "name": "float32"},
+ {"value": 29, "name": "float32x2"},
+ {"value": 30, "name": "float32x3"},
+ {"value": 31, "name": "float32x4"},
+ {"value": 32, "name": "uint32"},
+ {"value": 33, "name": "uint32x2"},
+ {"value": 34, "name": "uint32x3"},
+ {"value": 35, "name": "uint32x4"},
+ {"value": 36, "name": "sint32"},
+ {"value": 37, "name": "sint32x2"},
+ {"value": 38, "name": "sint32x3"},
+ {"value": 39, "name": "sint32x4"},
+ {"value": 40, "name": "unorm 10_10_10_2", "jsrepr": "'unorm10-10-10-2'"},
+ {"value": 41, "name": "unorm8x4 BGRA", "jsrepr": "'unorm8x4-bgra'"}
]
},
"WGSL feature name": {
diff --git a/src/dawn/native/RenderPipeline.cpp b/src/dawn/native/RenderPipeline.cpp
index 49f9c8b..96b94af 100644
--- a/src/dawn/native/RenderPipeline.cpp
+++ b/src/dawn/native/RenderPipeline.cpp
@@ -48,28 +48,37 @@
namespace dawn::native {
-static constexpr ityp::array<wgpu::VertexFormat, VertexFormatInfo, 32> sVertexFormatTable =
+static constexpr ityp::array<wgpu::VertexFormat, VertexFormatInfo, 42> sVertexFormatTable =
[]() constexpr {
- ityp::array<wgpu::VertexFormat, VertexFormatInfo, 32> table{};
+ ityp::array<wgpu::VertexFormat, VertexFormatInfo, 42> table{};
// clang-format off
+ table[wgpu::VertexFormat::Uint8 ] = { 1, 1, VertexFormatBaseType::Uint };
table[wgpu::VertexFormat::Uint8x2 ] = { 2, 2, VertexFormatBaseType::Uint };
table[wgpu::VertexFormat::Uint8x4 ] = { 4, 4, VertexFormatBaseType::Uint };
+ table[wgpu::VertexFormat::Sint8 ] = { 1, 1, VertexFormatBaseType::Sint };
table[wgpu::VertexFormat::Sint8x2 ] = { 2, 2, VertexFormatBaseType::Sint };
table[wgpu::VertexFormat::Sint8x4 ] = { 4, 4, VertexFormatBaseType::Sint };
+ table[wgpu::VertexFormat::Unorm8 ] = { 1, 1, VertexFormatBaseType::Float};
table[wgpu::VertexFormat::Unorm8x2 ] = { 2, 2, VertexFormatBaseType::Float};
table[wgpu::VertexFormat::Unorm8x4 ] = { 4, 4, VertexFormatBaseType::Float};
+ table[wgpu::VertexFormat::Snorm8 ] = { 1, 1, VertexFormatBaseType::Float};
table[wgpu::VertexFormat::Snorm8x2 ] = { 2, 2, VertexFormatBaseType::Float};
table[wgpu::VertexFormat::Snorm8x4 ] = { 4, 4, VertexFormatBaseType::Float};
+ table[wgpu::VertexFormat::Uint16 ] = { 2, 1, VertexFormatBaseType::Uint };
table[wgpu::VertexFormat::Uint16x2 ] = { 4, 2, VertexFormatBaseType::Uint };
table[wgpu::VertexFormat::Uint16x4 ] = { 8, 4, VertexFormatBaseType::Uint };
+ table[wgpu::VertexFormat::Sint16 ] = { 2, 1, VertexFormatBaseType::Sint };
table[wgpu::VertexFormat::Sint16x2 ] = { 4, 2, VertexFormatBaseType::Sint };
table[wgpu::VertexFormat::Sint16x4 ] = { 8, 4, VertexFormatBaseType::Sint };
+ table[wgpu::VertexFormat::Unorm16 ] = { 2, 1, VertexFormatBaseType::Float};
table[wgpu::VertexFormat::Unorm16x2 ] = { 4, 2, VertexFormatBaseType::Float};
table[wgpu::VertexFormat::Unorm16x4 ] = { 8, 4, VertexFormatBaseType::Float};
+ table[wgpu::VertexFormat::Snorm16 ] = { 2, 1, VertexFormatBaseType::Float};
table[wgpu::VertexFormat::Snorm16x2 ] = { 4, 2, VertexFormatBaseType::Float};
table[wgpu::VertexFormat::Snorm16x4 ] = { 8, 4, VertexFormatBaseType::Float};
+ table[wgpu::VertexFormat::Float16 ] = { 2, 1, VertexFormatBaseType::Float};
table[wgpu::VertexFormat::Float16x2 ] = { 4, 2, VertexFormatBaseType::Float};
table[wgpu::VertexFormat::Float16x4 ] = { 8, 4, VertexFormatBaseType::Float};
@@ -86,6 +95,7 @@
table[wgpu::VertexFormat::Sint32x3 ] = {12, 3, VertexFormatBaseType::Sint };
table[wgpu::VertexFormat::Sint32x4 ] = {16, 4, VertexFormatBaseType::Sint };
table[wgpu::VertexFormat::Unorm10_10_10_2] = { 4, 4, VertexFormatBaseType::Float};
+ table[wgpu::VertexFormat::Unorm8x4BGRA ] = { 4, 4, VertexFormatBaseType::Float};
// clang-format on
return table;
diff --git a/src/dawn/native/TintUtils.cpp b/src/dawn/native/TintUtils.cpp
index ff1cff9..04fac2b 100644
--- a/src/dawn/native/TintUtils.cpp
+++ b/src/dawn/native/TintUtils.cpp
@@ -57,38 +57,56 @@
tint::ast::transform::VertexFormat ToTintVertexFormat(wgpu::VertexFormat format) {
switch (format) {
+ case wgpu::VertexFormat::Uint8:
+ return tint::ast::transform::VertexFormat::kUint8;
case wgpu::VertexFormat::Uint8x2:
return tint::ast::transform::VertexFormat::kUint8x2;
case wgpu::VertexFormat::Uint8x4:
return tint::ast::transform::VertexFormat::kUint8x4;
+ case wgpu::VertexFormat::Sint8:
+ return tint::ast::transform::VertexFormat::kSint8;
case wgpu::VertexFormat::Sint8x2:
return tint::ast::transform::VertexFormat::kSint8x2;
case wgpu::VertexFormat::Sint8x4:
return tint::ast::transform::VertexFormat::kSint8x4;
+ case wgpu::VertexFormat::Unorm8:
+ return tint::ast::transform::VertexFormat::kUnorm8;
case wgpu::VertexFormat::Unorm8x2:
return tint::ast::transform::VertexFormat::kUnorm8x2;
case wgpu::VertexFormat::Unorm8x4:
return tint::ast::transform::VertexFormat::kUnorm8x4;
+ case wgpu::VertexFormat::Snorm8:
+ return tint::ast::transform::VertexFormat::kSnorm8;
case wgpu::VertexFormat::Snorm8x2:
return tint::ast::transform::VertexFormat::kSnorm8x2;
case wgpu::VertexFormat::Snorm8x4:
return tint::ast::transform::VertexFormat::kSnorm8x4;
+ case wgpu::VertexFormat::Uint16:
+ return tint::ast::transform::VertexFormat::kUint16;
case wgpu::VertexFormat::Uint16x2:
return tint::ast::transform::VertexFormat::kUint16x2;
case wgpu::VertexFormat::Uint16x4:
return tint::ast::transform::VertexFormat::kUint16x4;
+ case wgpu::VertexFormat::Sint16:
+ return tint::ast::transform::VertexFormat::kSint16;
case wgpu::VertexFormat::Sint16x2:
return tint::ast::transform::VertexFormat::kSint16x2;
case wgpu::VertexFormat::Sint16x4:
return tint::ast::transform::VertexFormat::kSint16x4;
+ case wgpu::VertexFormat::Unorm16:
+ return tint::ast::transform::VertexFormat::kUnorm16;
case wgpu::VertexFormat::Unorm16x2:
return tint::ast::transform::VertexFormat::kUnorm16x2;
case wgpu::VertexFormat::Unorm16x4:
return tint::ast::transform::VertexFormat::kUnorm16x4;
+ case wgpu::VertexFormat::Snorm16:
+ return tint::ast::transform::VertexFormat::kSnorm16;
case wgpu::VertexFormat::Snorm16x2:
return tint::ast::transform::VertexFormat::kSnorm16x2;
case wgpu::VertexFormat::Snorm16x4:
return tint::ast::transform::VertexFormat::kSnorm16x4;
+ case wgpu::VertexFormat::Float16:
+ return tint::ast::transform::VertexFormat::kFloat16;
case wgpu::VertexFormat::Float16x2:
return tint::ast::transform::VertexFormat::kFloat16x2;
case wgpu::VertexFormat::Float16x4:
@@ -119,6 +137,8 @@
return tint::ast::transform::VertexFormat::kSint32x4;
case wgpu::VertexFormat::Unorm10_10_10_2:
return tint::ast::transform::VertexFormat::kUnorm10_10_10_2;
+ case wgpu::VertexFormat::Unorm8x4BGRA:
+ return tint::ast::transform::VertexFormat::kUnorm8x4BGRA;
}
DAWN_UNREACHABLE();
}
diff --git a/src/dawn/native/d3d/UtilsD3D.cpp b/src/dawn/native/d3d/UtilsD3D.cpp
index 6c862f1..dd808a2 100644
--- a/src/dawn/native/d3d/UtilsD3D.cpp
+++ b/src/dawn/native/d3d/UtilsD3D.cpp
@@ -436,38 +436,56 @@
DXGI_FORMAT DXGIVertexFormat(wgpu::VertexFormat format) {
switch (format) {
+ case wgpu::VertexFormat::Uint8:
+ return DXGI_FORMAT_R8_UINT;
case wgpu::VertexFormat::Uint8x2:
return DXGI_FORMAT_R8G8_UINT;
case wgpu::VertexFormat::Uint8x4:
return DXGI_FORMAT_R8G8B8A8_UINT;
+ case wgpu::VertexFormat::Sint8:
+ return DXGI_FORMAT_R8_SINT;
case wgpu::VertexFormat::Sint8x2:
return DXGI_FORMAT_R8G8_SINT;
case wgpu::VertexFormat::Sint8x4:
return DXGI_FORMAT_R8G8B8A8_SINT;
+ case wgpu::VertexFormat::Unorm8:
+ return DXGI_FORMAT_R8_UNORM;
case wgpu::VertexFormat::Unorm8x2:
return DXGI_FORMAT_R8G8_UNORM;
case wgpu::VertexFormat::Unorm8x4:
return DXGI_FORMAT_R8G8B8A8_UNORM;
+ case wgpu::VertexFormat::Snorm8:
+ return DXGI_FORMAT_R8_SNORM;
case wgpu::VertexFormat::Snorm8x2:
return DXGI_FORMAT_R8G8_SNORM;
case wgpu::VertexFormat::Snorm8x4:
return DXGI_FORMAT_R8G8B8A8_SNORM;
+ case wgpu::VertexFormat::Uint16:
+ return DXGI_FORMAT_R16_UINT;
case wgpu::VertexFormat::Uint16x2:
return DXGI_FORMAT_R16G16_UINT;
case wgpu::VertexFormat::Uint16x4:
return DXGI_FORMAT_R16G16B16A16_UINT;
+ case wgpu::VertexFormat::Sint16:
+ return DXGI_FORMAT_R16_SINT;
case wgpu::VertexFormat::Sint16x2:
return DXGI_FORMAT_R16G16_SINT;
case wgpu::VertexFormat::Sint16x4:
return DXGI_FORMAT_R16G16B16A16_SINT;
+ case wgpu::VertexFormat::Unorm16:
+ return DXGI_FORMAT_R16_UNORM;
case wgpu::VertexFormat::Unorm16x2:
return DXGI_FORMAT_R16G16_UNORM;
case wgpu::VertexFormat::Unorm16x4:
return DXGI_FORMAT_R16G16B16A16_UNORM;
+ case wgpu::VertexFormat::Snorm16:
+ return DXGI_FORMAT_R16_SNORM;
case wgpu::VertexFormat::Snorm16x2:
return DXGI_FORMAT_R16G16_SNORM;
case wgpu::VertexFormat::Snorm16x4:
return DXGI_FORMAT_R16G16B16A16_SNORM;
+ case wgpu::VertexFormat::Float16:
+ return DXGI_FORMAT_R16_FLOAT;
case wgpu::VertexFormat::Float16x2:
return DXGI_FORMAT_R16G16_FLOAT;
case wgpu::VertexFormat::Float16x4:
@@ -498,6 +516,8 @@
return DXGI_FORMAT_R32G32B32A32_SINT;
case wgpu::VertexFormat::Unorm10_10_10_2:
return DXGI_FORMAT_R10G10B10A2_UNORM;
+ case wgpu::VertexFormat::Unorm8x4BGRA:
+ return DXGI_FORMAT_B8G8R8A8_UNORM;
default:
DAWN_UNREACHABLE();
}
diff --git a/src/dawn/native/metal/RenderPipelineMTL.mm b/src/dawn/native/metal/RenderPipelineMTL.mm
index cc12cc3..9361bda 100644
--- a/src/dawn/native/metal/RenderPipelineMTL.mm
+++ b/src/dawn/native/metal/RenderPipelineMTL.mm
@@ -43,38 +43,56 @@
namespace {
MTLVertexFormat VertexFormatType(wgpu::VertexFormat format) {
switch (format) {
+ case wgpu::VertexFormat::Uint8:
+ return MTLVertexFormatUChar;
case wgpu::VertexFormat::Uint8x2:
return MTLVertexFormatUChar2;
case wgpu::VertexFormat::Uint8x4:
return MTLVertexFormatUChar4;
+ case wgpu::VertexFormat::Sint8:
+ return MTLVertexFormatChar;
case wgpu::VertexFormat::Sint8x2:
return MTLVertexFormatChar2;
case wgpu::VertexFormat::Sint8x4:
return MTLVertexFormatChar4;
+ case wgpu::VertexFormat::Unorm8:
+ return MTLVertexFormatUCharNormalized;
case wgpu::VertexFormat::Unorm8x2:
return MTLVertexFormatUChar2Normalized;
case wgpu::VertexFormat::Unorm8x4:
return MTLVertexFormatUChar4Normalized;
+ case wgpu::VertexFormat::Snorm8:
+ return MTLVertexFormatCharNormalized;
case wgpu::VertexFormat::Snorm8x2:
return MTLVertexFormatChar2Normalized;
case wgpu::VertexFormat::Snorm8x4:
return MTLVertexFormatChar4Normalized;
+ case wgpu::VertexFormat::Uint16:
+ return MTLVertexFormatUShort;
case wgpu::VertexFormat::Uint16x2:
return MTLVertexFormatUShort2;
case wgpu::VertexFormat::Uint16x4:
return MTLVertexFormatUShort4;
+ case wgpu::VertexFormat::Sint16:
+ return MTLVertexFormatShort;
case wgpu::VertexFormat::Sint16x2:
return MTLVertexFormatShort2;
case wgpu::VertexFormat::Sint16x4:
return MTLVertexFormatShort4;
+ case wgpu::VertexFormat::Unorm16:
+ return MTLVertexFormatUShortNormalized;
case wgpu::VertexFormat::Unorm16x2:
return MTLVertexFormatUShort2Normalized;
case wgpu::VertexFormat::Unorm16x4:
return MTLVertexFormatUShort4Normalized;
+ case wgpu::VertexFormat::Snorm16:
+ return MTLVertexFormatShortNormalized;
case wgpu::VertexFormat::Snorm16x2:
return MTLVertexFormatShort2Normalized;
case wgpu::VertexFormat::Snorm16x4:
return MTLVertexFormatShort4Normalized;
+ case wgpu::VertexFormat::Float16:
+ return MTLVertexFormatHalf;
case wgpu::VertexFormat::Float16x2:
return MTLVertexFormatHalf2;
case wgpu::VertexFormat::Float16x4:
@@ -105,6 +123,8 @@
return MTLVertexFormatInt4;
case wgpu::VertexFormat::Unorm10_10_10_2:
return MTLVertexFormatUInt1010102Normalized;
+ case wgpu::VertexFormat::Unorm8x4BGRA:
+ return MTLVertexFormatUChar4Normalized_BGRA;
default:
DAWN_UNREACHABLE();
}
diff --git a/src/dawn/native/opengl/CommandBufferGL.cpp b/src/dawn/native/opengl/CommandBufferGL.cpp
index 08b2d51..3f0d3ea 100644
--- a/src/dawn/native/opengl/CommandBufferGL.cpp
+++ b/src/dawn/native/opengl/CommandBufferGL.cpp
@@ -72,26 +72,36 @@
GLenum VertexFormatType(wgpu::VertexFormat format) {
switch (format) {
+ case wgpu::VertexFormat::Uint8:
case wgpu::VertexFormat::Uint8x2:
case wgpu::VertexFormat::Uint8x4:
+ case wgpu::VertexFormat::Unorm8:
case wgpu::VertexFormat::Unorm8x2:
case wgpu::VertexFormat::Unorm8x4:
+ case wgpu::VertexFormat::Unorm8x4BGRA:
return GL_UNSIGNED_BYTE;
+ case wgpu::VertexFormat::Sint8:
case wgpu::VertexFormat::Sint8x2:
case wgpu::VertexFormat::Sint8x4:
+ case wgpu::VertexFormat::Snorm8:
case wgpu::VertexFormat::Snorm8x2:
case wgpu::VertexFormat::Snorm8x4:
return GL_BYTE;
+ case wgpu::VertexFormat::Uint16:
case wgpu::VertexFormat::Uint16x2:
case wgpu::VertexFormat::Uint16x4:
+ case wgpu::VertexFormat::Unorm16:
case wgpu::VertexFormat::Unorm16x2:
case wgpu::VertexFormat::Unorm16x4:
return GL_UNSIGNED_SHORT;
+ case wgpu::VertexFormat::Sint16:
case wgpu::VertexFormat::Sint16x2:
case wgpu::VertexFormat::Sint16x4:
+ case wgpu::VertexFormat::Snorm16:
case wgpu::VertexFormat::Snorm16x2:
case wgpu::VertexFormat::Snorm16x4:
return GL_SHORT;
+ case wgpu::VertexFormat::Float16:
case wgpu::VertexFormat::Float16x2:
case wgpu::VertexFormat::Float16x4:
return GL_HALF_FLOAT;
@@ -119,12 +129,17 @@
GLboolean VertexFormatIsNormalized(wgpu::VertexFormat format) {
switch (format) {
+ case wgpu::VertexFormat::Unorm8:
case wgpu::VertexFormat::Unorm8x2:
case wgpu::VertexFormat::Unorm8x4:
+ case wgpu::VertexFormat::Unorm8x4BGRA:
+ case wgpu::VertexFormat::Snorm8:
case wgpu::VertexFormat::Snorm8x2:
case wgpu::VertexFormat::Snorm8x4:
+ case wgpu::VertexFormat::Unorm16:
case wgpu::VertexFormat::Unorm16x2:
case wgpu::VertexFormat::Unorm16x4:
+ case wgpu::VertexFormat::Snorm16:
case wgpu::VertexFormat::Snorm16x2:
case wgpu::VertexFormat::Snorm16x4:
case wgpu::VertexFormat::Unorm10_10_10_2:
@@ -136,12 +151,16 @@
bool VertexFormatIsInt(wgpu::VertexFormat format) {
switch (format) {
+ case wgpu::VertexFormat::Uint8:
case wgpu::VertexFormat::Uint8x2:
case wgpu::VertexFormat::Uint8x4:
+ case wgpu::VertexFormat::Sint8:
case wgpu::VertexFormat::Sint8x2:
case wgpu::VertexFormat::Sint8x4:
+ case wgpu::VertexFormat::Uint16:
case wgpu::VertexFormat::Uint16x2:
case wgpu::VertexFormat::Uint16x4:
+ case wgpu::VertexFormat::Sint16:
case wgpu::VertexFormat::Sint16x2:
case wgpu::VertexFormat::Sint16x4:
case wgpu::VertexFormat::Uint32:
diff --git a/src/dawn/native/opengl/PipelineGL.cpp b/src/dawn/native/opengl/PipelineGL.cpp
index 2142af6..0dcba7a 100644
--- a/src/dawn/native/opengl/PipelineGL.cpp
+++ b/src/dawn/native/opengl/PipelineGL.cpp
@@ -70,6 +70,8 @@
PerStage<CombinedSamplerInfo> combinedSamplers;
bool needsPlaceholderSampler = false;
std::vector<GLuint> glShaders;
+ // TODO(376924407): Add information for a transform that swizzles vertex inputs for the
+ // unorm8x4-bgra vertex format.
for (SingleShaderStage stage : IterateStages(activeStages)) {
const ShaderModule* module = ToBackend(stages[stage].module.Get());
GLuint shader;
@@ -78,6 +80,7 @@
gl, stages[stage], stage, usesVertexIndex, usesInstanceIndex, usesFragDepth,
&combinedSamplers[stage], layout, &needsPlaceholderSampler,
&mNeedsTextureBuiltinUniformBuffer, &mBindingPointEmulatedBuiltins));
+ // XXX transform to flip some attributes from RGBA to BGRA
gl.AttachShader(mProgram, shader);
glShaders.push_back(shader);
}
diff --git a/src/dawn/native/vulkan/RenderPipelineVk.cpp b/src/dawn/native/vulkan/RenderPipelineVk.cpp
index 151bec7..0b7e3c9 100644
--- a/src/dawn/native/vulkan/RenderPipelineVk.cpp
+++ b/src/dawn/native/vulkan/RenderPipelineVk.cpp
@@ -63,38 +63,56 @@
VkFormat VulkanVertexFormat(wgpu::VertexFormat format) {
switch (format) {
+ case wgpu::VertexFormat::Uint8:
+ return VK_FORMAT_R8_UINT;
case wgpu::VertexFormat::Uint8x2:
return VK_FORMAT_R8G8_UINT;
case wgpu::VertexFormat::Uint8x4:
return VK_FORMAT_R8G8B8A8_UINT;
+ case wgpu::VertexFormat::Sint8:
+ return VK_FORMAT_R8_SINT;
case wgpu::VertexFormat::Sint8x2:
return VK_FORMAT_R8G8_SINT;
case wgpu::VertexFormat::Sint8x4:
return VK_FORMAT_R8G8B8A8_SINT;
+ case wgpu::VertexFormat::Unorm8:
+ return VK_FORMAT_R8_UNORM;
case wgpu::VertexFormat::Unorm8x2:
return VK_FORMAT_R8G8_UNORM;
case wgpu::VertexFormat::Unorm8x4:
return VK_FORMAT_R8G8B8A8_UNORM;
+ case wgpu::VertexFormat::Snorm8:
+ return VK_FORMAT_R8_SNORM;
case wgpu::VertexFormat::Snorm8x2:
return VK_FORMAT_R8G8_SNORM;
case wgpu::VertexFormat::Snorm8x4:
return VK_FORMAT_R8G8B8A8_SNORM;
+ case wgpu::VertexFormat::Uint16:
+ return VK_FORMAT_R16_UINT;
case wgpu::VertexFormat::Uint16x2:
return VK_FORMAT_R16G16_UINT;
case wgpu::VertexFormat::Uint16x4:
return VK_FORMAT_R16G16B16A16_UINT;
+ case wgpu::VertexFormat::Sint16:
+ return VK_FORMAT_R16_SINT;
case wgpu::VertexFormat::Sint16x2:
return VK_FORMAT_R16G16_SINT;
case wgpu::VertexFormat::Sint16x4:
return VK_FORMAT_R16G16B16A16_SINT;
+ case wgpu::VertexFormat::Unorm16:
+ return VK_FORMAT_R16_UNORM;
case wgpu::VertexFormat::Unorm16x2:
return VK_FORMAT_R16G16_UNORM;
case wgpu::VertexFormat::Unorm16x4:
return VK_FORMAT_R16G16B16A16_UNORM;
+ case wgpu::VertexFormat::Snorm16:
+ return VK_FORMAT_R16_SNORM;
case wgpu::VertexFormat::Snorm16x2:
return VK_FORMAT_R16G16_SNORM;
case wgpu::VertexFormat::Snorm16x4:
return VK_FORMAT_R16G16B16A16_SNORM;
+ case wgpu::VertexFormat::Float16:
+ return VK_FORMAT_R16_SFLOAT;
case wgpu::VertexFormat::Float16x2:
return VK_FORMAT_R16G16_SFLOAT;
case wgpu::VertexFormat::Float16x4:
@@ -125,6 +143,8 @@
return VK_FORMAT_R32G32B32A32_SINT;
case wgpu::VertexFormat::Unorm10_10_10_2:
return VK_FORMAT_A2B10G10R10_UNORM_PACK32;
+ case wgpu::VertexFormat::Unorm8x4BGRA:
+ return VK_FORMAT_B8G8R8A8_UNORM;
default:
DAWN_UNREACHABLE();
}
diff --git a/src/dawn/node/binding/Converter.cpp b/src/dawn/node/binding/Converter.cpp
index 0e14fad..25cc5cc 100644
--- a/src/dawn/node/binding/Converter.cpp
+++ b/src/dawn/node/binding/Converter.cpp
@@ -1136,54 +1136,81 @@
bool Converter::Convert(wgpu::VertexFormat& out, const interop::GPUVertexFormat& in) {
switch (in) {
+ case interop::GPUVertexFormat::kUint8:
+ out = wgpu::VertexFormat::Uint8;
+ return true;
case interop::GPUVertexFormat::kUint8X2:
out = wgpu::VertexFormat::Uint8x2;
return true;
case interop::GPUVertexFormat::kUint8X4:
out = wgpu::VertexFormat::Uint8x4;
return true;
+ case interop::GPUVertexFormat::kSint8:
+ out = wgpu::VertexFormat::Sint8;
+ return true;
case interop::GPUVertexFormat::kSint8X2:
out = wgpu::VertexFormat::Sint8x2;
return true;
case interop::GPUVertexFormat::kSint8X4:
out = wgpu::VertexFormat::Sint8x4;
return true;
+ case interop::GPUVertexFormat::kUnorm8:
+ out = wgpu::VertexFormat::Unorm8;
+ return true;
case interop::GPUVertexFormat::kUnorm8X2:
out = wgpu::VertexFormat::Unorm8x2;
return true;
case interop::GPUVertexFormat::kUnorm8X4:
out = wgpu::VertexFormat::Unorm8x4;
return true;
+ case interop::GPUVertexFormat::kSnorm8:
+ out = wgpu::VertexFormat::Snorm8;
+ return true;
case interop::GPUVertexFormat::kSnorm8X2:
out = wgpu::VertexFormat::Snorm8x2;
return true;
case interop::GPUVertexFormat::kSnorm8X4:
out = wgpu::VertexFormat::Snorm8x4;
return true;
+ case interop::GPUVertexFormat::kUint16:
+ out = wgpu::VertexFormat::Uint16;
+ return true;
case interop::GPUVertexFormat::kUint16X2:
out = wgpu::VertexFormat::Uint16x2;
return true;
case interop::GPUVertexFormat::kUint16X4:
out = wgpu::VertexFormat::Uint16x4;
return true;
+ case interop::GPUVertexFormat::kSint16:
+ out = wgpu::VertexFormat::Sint16;
+ return true;
case interop::GPUVertexFormat::kSint16X2:
out = wgpu::VertexFormat::Sint16x2;
return true;
case interop::GPUVertexFormat::kSint16X4:
out = wgpu::VertexFormat::Sint16x4;
return true;
+ case interop::GPUVertexFormat::kUnorm16:
+ out = wgpu::VertexFormat::Unorm16;
+ return true;
case interop::GPUVertexFormat::kUnorm16X2:
out = wgpu::VertexFormat::Unorm16x2;
return true;
case interop::GPUVertexFormat::kUnorm16X4:
out = wgpu::VertexFormat::Unorm16x4;
return true;
+ case interop::GPUVertexFormat::kSnorm16:
+ out = wgpu::VertexFormat::Snorm16;
+ return true;
case interop::GPUVertexFormat::kSnorm16X2:
out = wgpu::VertexFormat::Snorm16x2;
return true;
case interop::GPUVertexFormat::kSnorm16X4:
out = wgpu::VertexFormat::Snorm16x4;
return true;
+ case interop::GPUVertexFormat::kFloat16:
+ out = wgpu::VertexFormat::Float16;
+ return true;
case interop::GPUVertexFormat::kFloat16X2:
out = wgpu::VertexFormat::Float16x2;
return true;
@@ -1229,6 +1256,9 @@
case interop::GPUVertexFormat::kUnorm1010102:
out = wgpu::VertexFormat::Unorm10_10_10_2;
return true;
+ case interop::GPUVertexFormat::kUnorm8X4Bgra:
+ out = wgpu::VertexFormat::Unorm8x4BGRA;
+ return true;
default:
break;
}
diff --git a/src/dawn/tests/end2end/VertexFormatTests.cpp b/src/dawn/tests/end2end/VertexFormatTests.cpp
index 37147bd..b6624ae 100644
--- a/src/dawn/tests/end2end/VertexFormatTests.cpp
+++ b/src/dawn/tests/end2end/VertexFormatTests.cpp
@@ -74,12 +74,17 @@
bool IsNormalizedFormat(wgpu::VertexFormat format) {
switch (format) {
+ case wgpu::VertexFormat::Unorm8:
case wgpu::VertexFormat::Unorm8x2:
case wgpu::VertexFormat::Unorm8x4:
+ case wgpu::VertexFormat::Unorm8x4BGRA:
+ case wgpu::VertexFormat::Snorm8:
case wgpu::VertexFormat::Snorm8x2:
case wgpu::VertexFormat::Snorm8x4:
+ case wgpu::VertexFormat::Unorm16:
case wgpu::VertexFormat::Unorm16x2:
case wgpu::VertexFormat::Unorm16x4:
+ case wgpu::VertexFormat::Snorm16:
case wgpu::VertexFormat::Snorm16x2:
case wgpu::VertexFormat::Snorm16x4:
case wgpu::VertexFormat::Unorm10_10_10_2:
@@ -91,15 +96,20 @@
uint32_t NormalizationFactor(wgpu::VertexFormat format, uint32_t component) {
switch (format) {
+ case wgpu::VertexFormat::Unorm8:
case wgpu::VertexFormat::Unorm8x2:
case wgpu::VertexFormat::Unorm8x4:
+ case wgpu::VertexFormat::Unorm8x4BGRA:
return 255;
+ case wgpu::VertexFormat::Snorm8:
case wgpu::VertexFormat::Snorm8x2:
case wgpu::VertexFormat::Snorm8x4:
return 127;
+ case wgpu::VertexFormat::Unorm16:
case wgpu::VertexFormat::Unorm16x2:
case wgpu::VertexFormat::Unorm16x4:
return 65535;
+ case wgpu::VertexFormat::Snorm16:
case wgpu::VertexFormat::Snorm16x2:
case wgpu::VertexFormat::Snorm16x4:
return 32767;
@@ -112,16 +122,21 @@
bool IsUnsignedFormat(wgpu::VertexFormat format) {
switch (format) {
- case wgpu::VertexFormat::Uint32:
+ case wgpu::VertexFormat::Uint8:
case wgpu::VertexFormat::Uint8x2:
case wgpu::VertexFormat::Uint8x4:
+ case wgpu::VertexFormat::Uint16:
case wgpu::VertexFormat::Uint16x2:
case wgpu::VertexFormat::Uint16x4:
+ case wgpu::VertexFormat::Uint32:
case wgpu::VertexFormat::Uint32x2:
case wgpu::VertexFormat::Uint32x3:
case wgpu::VertexFormat::Uint32x4:
+ case wgpu::VertexFormat::Unorm8:
case wgpu::VertexFormat::Unorm8x2:
case wgpu::VertexFormat::Unorm8x4:
+ case wgpu::VertexFormat::Unorm8x4BGRA:
+ case wgpu::VertexFormat::Unorm16:
case wgpu::VertexFormat::Unorm16x2:
case wgpu::VertexFormat::Unorm16x4:
case wgpu::VertexFormat::Unorm10_10_10_2:
@@ -133,6 +148,7 @@
bool IsFloatFormat(wgpu::VertexFormat format) {
switch (format) {
+ case wgpu::VertexFormat::Float16:
case wgpu::VertexFormat::Float16x2:
case wgpu::VertexFormat::Float16x4:
case wgpu::VertexFormat::Float32:
@@ -147,6 +163,7 @@
bool IsHalfFormat(wgpu::VertexFormat format) {
switch (format) {
+ case wgpu::VertexFormat::Float16:
case wgpu::VertexFormat::Float16x2:
case wgpu::VertexFormat::Float16x4:
return true;
@@ -157,10 +174,20 @@
uint32_t ByteSize(wgpu::VertexFormat format) {
switch (format) {
+ case wgpu::VertexFormat::Sint8:
+ case wgpu::VertexFormat::Snorm8:
+ case wgpu::VertexFormat::Uint8:
+ case wgpu::VertexFormat::Unorm8:
+ return 1;
case wgpu::VertexFormat::Sint8x2:
case wgpu::VertexFormat::Snorm8x2:
case wgpu::VertexFormat::Uint8x2:
case wgpu::VertexFormat::Unorm8x2:
+ case wgpu::VertexFormat::Sint16:
+ case wgpu::VertexFormat::Snorm16:
+ case wgpu::VertexFormat::Uint16:
+ case wgpu::VertexFormat::Unorm16:
+ case wgpu::VertexFormat::Float16:
return 2;
case wgpu::VertexFormat::Float16x2:
case wgpu::VertexFormat::Float32:
@@ -175,6 +202,7 @@
case wgpu::VertexFormat::Uint8x4:
case wgpu::VertexFormat::Unorm16x2:
case wgpu::VertexFormat::Unorm8x4:
+ case wgpu::VertexFormat::Unorm8x4BGRA:
return 4;
case wgpu::VertexFormat::Float16x4:
case wgpu::VertexFormat::Float32x2:
@@ -200,6 +228,15 @@
uint32_t ComponentCount(wgpu::VertexFormat format) {
switch (format) {
+ case wgpu::VertexFormat::Uint8:
+ case wgpu::VertexFormat::Sint8:
+ case wgpu::VertexFormat::Unorm8:
+ case wgpu::VertexFormat::Snorm8:
+ case wgpu::VertexFormat::Float16:
+ case wgpu::VertexFormat::Uint16:
+ case wgpu::VertexFormat::Sint16:
+ case wgpu::VertexFormat::Unorm16:
+ case wgpu::VertexFormat::Snorm16:
case wgpu::VertexFormat::Float32:
case wgpu::VertexFormat::Uint32:
case wgpu::VertexFormat::Sint32:
@@ -224,6 +261,7 @@
case wgpu::VertexFormat::Uint8x4:
case wgpu::VertexFormat::Sint8x4:
case wgpu::VertexFormat::Unorm8x4:
+ case wgpu::VertexFormat::Unorm8x4BGRA:
case wgpu::VertexFormat::Snorm8x4:
case wgpu::VertexFormat::Uint16x4:
case wgpu::VertexFormat::Sint16x4:
@@ -465,6 +503,31 @@
}
};
+TEST_P(VertexFormatTest, Uint8) {
+ std::vector<uint8_t> vertexData = {
+ std::numeric_limits<uint8_t>::max(),
+ 0, // padding three bytes for stride
+ 0,
+ 0,
+ std::numeric_limits<uint8_t>::min(),
+ 0, // padding three bytes for stride
+ 0,
+ 0,
+ 200,
+ 0, // padding three bytes for stride
+ 0,
+ 0,
+ };
+
+ std::vector<uint8_t> expectedData = {
+ std::numeric_limits<uint8_t>::max(),
+ std::numeric_limits<uint8_t>::min(),
+ 200,
+ };
+
+ DoVertexFormatTest(wgpu::VertexFormat::Uint8, vertexData, expectedData);
+}
+
TEST_P(VertexFormatTest, Uint8x2) {
std::vector<uint8_t> vertexData = {
std::numeric_limits<uint8_t>::max(),
@@ -507,6 +570,31 @@
DoVertexFormatTest(wgpu::VertexFormat::Uint8x4, vertexData, vertexData);
}
+TEST_P(VertexFormatTest, Sint8) {
+ std::vector<int8_t> vertexData = {
+ std::numeric_limits<int8_t>::max(),
+ 0, // padding three bytes for stride
+ 0,
+ 0,
+ std::numeric_limits<int8_t>::min(),
+ 0, // padding three bytes for stride
+ 0,
+ 0,
+ -121,
+ 0, // padding two bytes for buffer copy
+ 0,
+ 0,
+ };
+
+ std::vector<int8_t> expectedData = {
+ std::numeric_limits<int8_t>::max(),
+ std::numeric_limits<int8_t>::min(),
+ -121,
+ };
+
+ DoVertexFormatTest(wgpu::VertexFormat::Sint8, vertexData, expectedData);
+}
+
TEST_P(VertexFormatTest, Sint8x2) {
std::vector<int8_t> vertexData = {
std::numeric_limits<int8_t>::max(),
@@ -549,6 +637,31 @@
DoVertexFormatTest(wgpu::VertexFormat::Sint8x4, vertexData, vertexData);
}
+TEST_P(VertexFormatTest, Unorm8) {
+ std::vector<uint8_t> vertexData = {
+ std::numeric_limits<uint8_t>::max(),
+ 0, // padding three bytes for stride
+ 0,
+ 0,
+ std::numeric_limits<uint8_t>::min(),
+ 0, // padding three bytes for stride
+ 0,
+ 0,
+ 200,
+ 0, // padding three bytes for stride
+ 0,
+ 0,
+ };
+
+ std::vector<uint8_t> expectedData = {
+ std::numeric_limits<uint8_t>::max(),
+ std::numeric_limits<uint8_t>::min(),
+ 200,
+ };
+
+ DoVertexFormatTest(wgpu::VertexFormat::Unorm8, vertexData, expectedData);
+}
+
TEST_P(VertexFormatTest, Unorm8x2) {
std::vector<uint8_t> vertexData = {
std::numeric_limits<uint8_t>::max(),
@@ -592,6 +705,65 @@
DoVertexFormatTest(wgpu::VertexFormat::Unorm8x4, vertexData, vertexData);
}
+TEST_P(VertexFormatTest, Unorm8x4BGRA) {
+ // TODO(376924407): OpenGL needs a shader transform to support the BGRA format as it doesn't
+ // have any swizzled vertex format.
+ DAWN_SUPPRESS_TEST_IF(IsOpenGL() || IsOpenGLES());
+
+ std::vector<uint8_t> vertexData = {std::numeric_limits<uint8_t>::max(),
+ std::numeric_limits<uint8_t>::min(),
+ 0,
+ 0,
+ std::numeric_limits<uint8_t>::max() / 2u,
+ std::numeric_limits<uint8_t>::min() / 2u,
+ 0,
+ 0,
+ 200,
+ 201,
+ 202,
+ 203};
+
+ std::vector<uint8_t> expectedData = {0,
+ std::numeric_limits<uint8_t>::min(),
+ std::numeric_limits<uint8_t>::max(),
+ 0,
+ 0,
+ std::numeric_limits<uint8_t>::min() / 2u,
+ std::numeric_limits<uint8_t>::max() / 2u,
+ 0,
+ 202,
+ 201,
+ 200,
+ 203};
+
+ DoVertexFormatTest(wgpu::VertexFormat::Unorm8x4BGRA, vertexData, expectedData);
+}
+
+TEST_P(VertexFormatTest, Snorm8) {
+ std::vector<int8_t> vertexData = {
+ std::numeric_limits<int8_t>::max(),
+ 0, // padding three bytes for stride
+ 0,
+ 0,
+ std::numeric_limits<int8_t>::min(),
+ 0, // padding two bytes for stride
+ 0,
+ 0,
+ -121,
+ 0, // padding two bytes for stride
+ 0,
+ 0,
+ };
+
+ std::vector<int8_t> expectedData = {
+ std::numeric_limits<int8_t>::max(),
+ std::numeric_limits<int8_t>::min(),
+ -121,
+ };
+
+ DoVertexFormatTest(wgpu::VertexFormat::Snorm8, vertexData, expectedData);
+}
+
TEST_P(VertexFormatTest, Snorm8x2) {
std::vector<int8_t> vertexData = {
std::numeric_limits<int8_t>::max(),
@@ -637,6 +809,25 @@
DoVertexFormatTest(wgpu::VertexFormat::Snorm8x4, vertexData, vertexData);
}
+TEST_P(VertexFormatTest, Uint16) {
+ std::vector<uint16_t> vertexData = {
+ std::numeric_limits<uint16_t>::max(),
+ 0, // Padding
+ std::numeric_limits<uint16_t>::min(),
+ 0, // Padding
+ 65432,
+ 0, // Padding
+ };
+
+ std::vector<uint16_t> expectedData = {
+ std::numeric_limits<uint16_t>::max(),
+ std::numeric_limits<uint16_t>::min(),
+ 65432,
+ };
+
+ DoVertexFormatTest(wgpu::VertexFormat::Uint16, vertexData, expectedData);
+}
+
TEST_P(VertexFormatTest, Uint16x2) {
std::vector<uint16_t> vertexData = {std::numeric_limits<uint16_t>::max(),
0,
@@ -667,6 +858,22 @@
DoVertexFormatTest(wgpu::VertexFormat::Uint16x4, vertexData, vertexData);
}
+TEST_P(VertexFormatTest, Sint16) {
+ std::vector<int16_t> vertexData = {
+ std::numeric_limits<int16_t>::max(),
+ 0, // Padding
+ std::numeric_limits<int16_t>::min(),
+ 0, // Padding
+ -3948,
+ 0, // Padding
+ };
+
+ std::vector<int16_t> expectedData = {std::numeric_limits<int16_t>::max(),
+ std::numeric_limits<int16_t>::min(), -3948};
+
+ DoVertexFormatTest(wgpu::VertexFormat::Sint16, vertexData, expectedData);
+}
+
TEST_P(VertexFormatTest, Sint16x2) {
std::vector<int16_t> vertexData = {std::numeric_limits<int16_t>::max(),
0,
@@ -697,6 +904,25 @@
DoVertexFormatTest(wgpu::VertexFormat::Sint16x4, vertexData, vertexData);
}
+TEST_P(VertexFormatTest, Unorm16) {
+ std::vector<uint16_t> vertexData = {
+ std::numeric_limits<uint16_t>::max(),
+ 0, // Padding
+ std::numeric_limits<uint16_t>::min(),
+ 0, // Padding
+ 3456,
+ 0, // Padding
+ };
+
+ std::vector<uint16_t> expectedData = {
+ std::numeric_limits<uint16_t>::max(),
+ std::numeric_limits<uint16_t>::min(),
+ 3456,
+ };
+
+ DoVertexFormatTest(wgpu::VertexFormat::Unorm16, vertexData, expectedData);
+}
+
TEST_P(VertexFormatTest, Unorm16x2) {
std::vector<uint16_t> vertexData = {std::numeric_limits<uint16_t>::max(),
std::numeric_limits<uint16_t>::min(),
@@ -725,6 +951,25 @@
DoVertexFormatTest(wgpu::VertexFormat::Unorm16x4, vertexData, vertexData);
}
+TEST_P(VertexFormatTest, Snorm16) {
+ std::vector<int16_t> vertexData = {
+ std::numeric_limits<int16_t>::max(),
+ 0, // Padding
+ std::numeric_limits<int16_t>::min(),
+ 0, // Padding
+ -6789,
+ 0, // Padding
+ };
+
+ std::vector<int16_t> expectedData = {
+ std::numeric_limits<int16_t>::max(),
+ std::numeric_limits<int16_t>::min(),
+ -6789,
+ };
+
+ DoVertexFormatTest(wgpu::VertexFormat::Snorm16, vertexData, expectedData);
+}
+
TEST_P(VertexFormatTest, Snorm16x2) {
std::vector<int16_t> vertexData = {std::numeric_limits<int16_t>::max(),
std::numeric_limits<int16_t>::min(),
@@ -753,6 +998,19 @@
DoVertexFormatTest(wgpu::VertexFormat::Snorm16x4, vertexData, vertexData);
}
+TEST_P(VertexFormatTest, Float16) {
+ // Fails on NVIDIA's Vulkan drivers on CQ but passes locally.
+ // TODO(dawn:1566) Might pass when using rectify_f32?
+ DAWN_SUPPRESS_TEST_IF(IsVulkan() && IsNvidia());
+
+ std::vector<uint16_t> vertexData =
+ Float32ToFloat16(std::vector<float>({14.8f, 0.0f, -0.0f, 0.0f, -24.8f, 0.0f}));
+ std::vector<uint16_t> expectedData =
+ Float32ToFloat16(std::vector<float>({14.8f, -0.0f, -24.8f}));
+
+ DoVertexFormatTest(wgpu::VertexFormat::Float16, vertexData, expectedData);
+}
+
TEST_P(VertexFormatTest, Float16x2) {
// Fails on NVIDIA's Vulkan drivers on CQ but passes locally.
// TODO(dawn:1566) Might pass when using rectify_f32?
diff --git a/src/dawn/tests/unittests/validation/VertexStateValidationTests.cpp b/src/dawn/tests/unittests/validation/VertexStateValidationTests.cpp
index c889162..c0fd053 100644
--- a/src/dawn/tests/unittests/validation/VertexStateValidationTests.cpp
+++ b/src/dawn/tests/unittests/validation/VertexStateValidationTests.cpp
@@ -414,6 +414,11 @@
DoTest(wgpu::VertexFormat::Unorm10_10_10_2, "i32", false);
DoTest(wgpu::VertexFormat::Unorm10_10_10_2, "u32", false);
+ // Test that unorm8x4-unorm format is compatible only with f32.
+ DoTest(wgpu::VertexFormat::Unorm8x4BGRA, "f32", true);
+ DoTest(wgpu::VertexFormat::Unorm8x4BGRA, "i32", false);
+ DoTest(wgpu::VertexFormat::Unorm8x4BGRA, "u32", false);
+
// Test that an snorm format is compatible only with f32.
DoTest(wgpu::VertexFormat::Snorm16x4, "f32", true);
DoTest(wgpu::VertexFormat::Snorm16x4, "i32", false);
diff --git a/src/dawn/utils/TestUtils.cpp b/src/dawn/utils/TestUtils.cpp
index 575a76c..eeb7aa9 100644
--- a/src/dawn/utils/TestUtils.cpp
+++ b/src/dawn/utils/TestUtils.cpp
@@ -165,10 +165,20 @@
uint32_t VertexFormatSize(wgpu::VertexFormat format) {
switch (format) {
+ case wgpu::VertexFormat::Uint8:
+ case wgpu::VertexFormat::Sint8:
+ case wgpu::VertexFormat::Unorm8:
+ case wgpu::VertexFormat::Snorm8:
+ return 1;
case wgpu::VertexFormat::Uint8x2:
case wgpu::VertexFormat::Sint8x2:
case wgpu::VertexFormat::Unorm8x2:
case wgpu::VertexFormat::Snorm8x2:
+ case wgpu::VertexFormat::Uint16:
+ case wgpu::VertexFormat::Sint16:
+ case wgpu::VertexFormat::Unorm16:
+ case wgpu::VertexFormat::Snorm16:
+ case wgpu::VertexFormat::Float16:
return 2;
case wgpu::VertexFormat::Uint8x4:
case wgpu::VertexFormat::Sint8x4:
@@ -183,6 +193,7 @@
case wgpu::VertexFormat::Uint32:
case wgpu::VertexFormat::Sint32:
case wgpu::VertexFormat::Unorm10_10_10_2:
+ case wgpu::VertexFormat::Unorm8x4BGRA:
return 4;
case wgpu::VertexFormat::Uint16x4:
case wgpu::VertexFormat::Sint16x4:
diff --git a/src/tint/lang/wgsl/ast/transform/vertex_pulling.cc b/src/tint/lang/wgsl/ast/transform/vertex_pulling.cc
index dd4a308..0a602ae 100644
--- a/src/tint/lang/wgsl/ast/transform/vertex_pulling.cc
+++ b/src/tint/lang/wgsl/ast/transform/vertex_pulling.cc
@@ -78,38 +78,56 @@
/// @returns out so calls can be chained
diag::Diagnostic& operator<<(diag::Diagnostic& out, VertexFormat format) {
switch (format) {
+ case VertexFormat::kUint8:
+ return out << "uint8";
case VertexFormat::kUint8x2:
return out << "uint8x2";
case VertexFormat::kUint8x4:
return out << "uint8x4";
+ case VertexFormat::kSint8:
+ return out << "sint8";
case VertexFormat::kSint8x2:
return out << "sint8x2";
case VertexFormat::kSint8x4:
return out << "sint8x4";
+ case VertexFormat::kUnorm8:
+ return out << "unorm8";
case VertexFormat::kUnorm8x2:
return out << "unorm8x2";
case VertexFormat::kUnorm8x4:
return out << "unorm8x4";
+ case VertexFormat::kSnorm8:
+ return out << "snorm8";
case VertexFormat::kSnorm8x2:
return out << "snorm8x2";
case VertexFormat::kSnorm8x4:
return out << "snorm8x4";
+ case VertexFormat::kUint16:
+ return out << "uint16";
case VertexFormat::kUint16x2:
return out << "uint16x2";
case VertexFormat::kUint16x4:
return out << "uint16x4";
+ case VertexFormat::kSint16:
+ return out << "sint16";
case VertexFormat::kSint16x2:
return out << "sint16x2";
case VertexFormat::kSint16x4:
return out << "sint16x4";
+ case VertexFormat::kUnorm16:
+ return out << "unorm16";
case VertexFormat::kUnorm16x2:
return out << "unorm16x2";
case VertexFormat::kUnorm16x4:
return out << "unorm16x4";
+ case VertexFormat::kSnorm16:
+ return out << "snorm16";
case VertexFormat::kSnorm16x2:
return out << "snorm16x2";
case VertexFormat::kSnorm16x4:
return out << "snorm16x4";
+ case VertexFormat::kFloat16:
+ return out << "float16";
case VertexFormat::kFloat16x2:
return out << "float16x2";
case VertexFormat::kFloat16x4:
@@ -140,6 +158,8 @@
return out << "sint32x4";
case VertexFormat::kUnorm10_10_10_2:
return out << "unorm10-10-10-2";
+ case VertexFormat::kUnorm8x4BGRA:
+ return out << "unorm8x4-bgra";
}
return out << "<unknown>";
}
@@ -196,6 +216,8 @@
VertexFormatType VertexFormatTypeOf(VertexFormat format) {
switch (format) {
+ case VertexFormat::kUint8:
+ case VertexFormat::kUint16:
case VertexFormat::kUint32:
return {VertexDataType::kUInt, 1};
case VertexFormat::kUint8x2:
@@ -208,6 +230,8 @@
case VertexFormat::kUint16x4:
case VertexFormat::kUint32x4:
return {VertexDataType::kUInt, 4};
+ case VertexFormat::kSint8:
+ case VertexFormat::kSint16:
case VertexFormat::kSint32:
return {VertexDataType::kSInt, 1};
case VertexFormat::kSint8x2:
@@ -220,6 +244,11 @@
case VertexFormat::kSint16x4:
case VertexFormat::kSint32x4:
return {VertexDataType::kSInt, 4};
+ case VertexFormat::kUnorm8:
+ case VertexFormat::kSnorm8:
+ case VertexFormat::kUnorm16:
+ case VertexFormat::kSnorm16:
+ case VertexFormat::kFloat16:
case VertexFormat::kFloat32:
return {VertexDataType::kFloat, 1};
case VertexFormat::kUnorm8x2:
@@ -238,6 +267,7 @@
case VertexFormat::kFloat16x4:
case VertexFormat::kFloat32x4:
case VertexFormat::kUnorm10_10_10_2:
+ case VertexFormat::kUnorm8x4BGRA:
return {VertexDataType::kFloat, 4};
}
return {VertexDataType::kInvalid, 0};
@@ -552,6 +582,31 @@
// The low 16 bits are 0.
auto load_i16_h = [&] { return b.Bitcast<i32>(load_u16_h()); };
+ // Returns a u8 loaded from offset, in the low 8 bits of a u32. Other bits are 0.
+ auto load_u8_l = [&] {
+ auto u32_offset = offset & ~3u;
+ auto remainder_offset = offset - u32_offset;
+
+ auto* u8s = LoadPrimitive(array_base, u32_offset, buffer, VertexFormat::kUint32);
+ auto* shifts = b.Call<vec4<u32>>(0_u, 8_u, 16_u, 24_u);
+ auto* shift = b.IndexAccessor(shifts, u32(remainder_offset));
+
+ return b.And(b.Shr(u8s, shift), 0xFF_u);
+ };
+
+ // Returns an i8 loaded from offset, in the low 8 bits of a u32. Other bits are 0.
+ auto load_i8_l = [&] {
+ auto u32_offset = offset & ~3u;
+ auto remainder_offset = offset - u32_offset;
+
+ auto* i8s = LoadPrimitive(array_base, u32_offset, buffer, VertexFormat::kSint32);
+ auto* shifts = b.Call<vec4<u32>>(24_u, 16_u, 8_u, 0_u);
+ auto* shift = b.IndexAccessor(shifts, u32(remainder_offset));
+
+ auto* i8_high = b.Shl(i8s, shift);
+ return b.Shr(i8_high, 24_u);
+ };
+
// Assumptions are made that alignment must be at least as large as the size
// of a single component.
switch (format) {
@@ -584,6 +639,9 @@
return LoadVec(array_base, offset, buffer, 4, b.ty.f32(), VertexFormat::kFloat32,
4);
+ case VertexFormat::kUint8: {
+ return load_u8_l();
+ }
case VertexFormat::kUint8x2: {
// yyxx0000, yyxx0000
auto* u16s = b.Call<vec2<u32>>(load_u16_h());
@@ -600,6 +658,9 @@
// 000000xx, 000000yy, 000000zz, 000000ww
return b.Shr(shl, b.Call<vec4<u32>>(24_u));
}
+ case VertexFormat::kUint16: {
+ return load_u16_l();
+ }
case VertexFormat::kUint16x2: {
// yyyyxxxx, yyyyxxxx
auto* u32s = b.Call<vec2<u32>>(load_u32());
@@ -618,6 +679,9 @@
// 0000xxxx, 0000yyyy, 0000zzzz, 0000wwww
return b.Shr(shl, b.Call<vec4<u32>>(16_u));
}
+ case VertexFormat::kSint8: {
+ return load_i8_l();
+ }
case VertexFormat::kSint8x2: {
// yyxx0000, yyxx0000
auto* i16s = b.Call<vec2<i32>>(load_i16_h());
@@ -634,6 +698,9 @@
// ssssssxx, ssssssyy, sssssszz, ssssssww
return b.Shr(shl, b.Call<vec4<u32>>(24_u));
}
+ case VertexFormat::kSint16: {
+ return b.Shr(load_i16_h(), 16_u);
+ }
case VertexFormat::kSint16x2: {
// yyyyxxxx, yyyyxxxx
auto* i32s = b.Call<vec2<i32>>(load_i32());
@@ -652,6 +719,10 @@
// ssssxxxx, ssssyyyy, sssszzzz, sssswwww
return b.Shr(shl, b.Call<vec4<u32>>(16_u));
}
+ case VertexFormat::kUnorm8:
+ return b.MemberAccessor(b.Call("unpack4x8unorm", load_u8_l()), "x");
+ case VertexFormat::kSnorm8:
+ return b.MemberAccessor(b.Call("unpack4x8snorm", load_u8_l()), "x");
case VertexFormat::kUnorm8x2:
return b.MemberAccessor(b.Call("unpack4x8unorm", load_u16_l()), "xy");
case VertexFormat::kSnorm8x2:
@@ -660,6 +731,12 @@
return b.Call("unpack4x8unorm", load_u32());
case VertexFormat::kSnorm8x4:
return b.Call("unpack4x8snorm", load_u32());
+ case VertexFormat::kUnorm16:
+ return b.MemberAccessor(b.Call("unpack2x16unorm", load_u16_l()), "x");
+ case VertexFormat::kSnorm16:
+ return b.MemberAccessor(b.Call("unpack2x16snorm", load_u16_l()), "x");
+ case VertexFormat::kFloat16:
+ return b.MemberAccessor(b.Call("unpack2x16float", load_u16_l()), "x");
case VertexFormat::kUnorm16x2:
return b.Call("unpack2x16unorm", load_u32());
case VertexFormat::kSnorm16x2:
@@ -675,7 +752,7 @@
case VertexFormat::kFloat16x4:
return b.Call<vec4<f32>>(b.Call("unpack2x16float", load_u32()),
b.Call("unpack2x16float", load_next_u32()));
- case VertexFormat::kUnorm10_10_10_2:
+ case VertexFormat::kUnorm10_10_10_2: {
auto* u32s = b.Call<vec4<u32>>(load_u32());
// shr = u32s >> vec4u(0, 10, 20, 30);
auto* shr = b.Shr(u32s, b.Call<vec4<u32>>(0_u, 10_u, 20_u, 30_u));
@@ -684,6 +761,10 @@
// return vec4f(mask) / vec4f(1023, 1023, 1023, 3);
return b.Div(b.Call<vec4<f32>>(mask),
b.Call<vec4<f32>>(1023_f, 1023_f, 1023_f, 3_f));
+ }
+ case VertexFormat::kUnorm8x4BGRA: {
+ return b.MemberAccessor(b.Call("unpack4x8unorm", load_u32()), "zyxw");
+ }
}
TINT_UNREACHABLE() << "format " << static_cast<int>(format);
diff --git a/src/tint/lang/wgsl/ast/transform/vertex_pulling.h b/src/tint/lang/wgsl/ast/transform/vertex_pulling.h
index a0b77a1..8218316 100644
--- a/src/tint/lang/wgsl/ast/transform/vertex_pulling.h
+++ b/src/tint/lang/wgsl/ast/transform/vertex_pulling.h
@@ -40,22 +40,31 @@
/// Describes the format of data in a vertex buffer
enum class VertexFormat {
+ kUint8, // uint8
kUint8x2, // uint8x2
kUint8x4, // uint8x4
+ kSint8, // sint8
kSint8x2, // sint8x2
kSint8x4, // sint8x4
+ kUnorm8, // unorm8
kUnorm8x2, // unorm8x2
kUnorm8x4, // unorm8x4
+ kSnorm8, // snorm8
kSnorm8x2, // snorm8x2
kSnorm8x4, // snorm8x4
+ kUint16, // uint16
kUint16x2, // uint16x2
kUint16x4, // uint16x4
+ kSint16, // sint16
kSint16x2, // sint16x2
kSint16x4, // sint16x4
+ kUnorm16, // unorm16
kUnorm16x2, // unorm16x2
kUnorm16x4, // unorm16x4
+ kSnorm16, // snorm16
kSnorm16x2, // snorm16x2
kSnorm16x4, // snorm16x4
+ kFloat16, // float16
kFloat16x2, // float16x2
kFloat16x4, // float16x4
kFloat32, // float32
@@ -71,6 +80,7 @@
kSint32x3, // sint32x3
kSint32x4, // sint32x4
kUnorm10_10_10_2, // unorm10-10-10-2
+ kUnorm8x4BGRA, // unorm8x4-bgra
};
/// Describes if a vertex attributes increments with vertex index or instance
diff --git a/src/tint/lang/wgsl/ast/transform/vertex_pulling_test.cc b/src/tint/lang/wgsl/ast/transform/vertex_pulling_test.cc
index 0a038a9..175a9f1 100644
--- a/src/tint/lang/wgsl/ast/transform/vertex_pulling_test.cc
+++ b/src/tint/lang/wgsl/ast/transform/vertex_pulling_test.cc
@@ -865,14 +865,16 @@
auto* src = R"(
@vertex
fn main(
- @location(0) sint8x2 : vec2<i32>,
- @location(1) sint8x4 : vec4<i32>,
- @location(2) sint16x2 : vec2<i32>,
- @location(3) sint16x4 : vec4<i32>,
- @location(4) sint32 : i32,
- @location(5) sint32x2 : vec2<i32>,
- @location(6) sint32x3 : vec3<i32>,
- @location(7) sint32x4 : vec4<i32>
+ @location(0) sint8 : i32,
+ @location(1) sint8x2 : vec2<i32>,
+ @location(2) sint8x4 : vec4<i32>,
+ @location(3) sint16 : i32,
+ @location(4) sint16x2 : vec2<i32>,
+ @location(5) sint16x4 : vec4<i32>,
+ @location(6) sint32 : i32,
+ @location(7) sint32x2 : vec2<i32>,
+ @location(8) sint32x3 : vec3<i32>,
+ @location(9) sint32x4 : vec4<i32>
) -> @builtin(position) vec4<f32> {
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
}
@@ -887,8 +889,10 @@
@vertex
fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4<f32> {
+ var sint8 : i32;
var sint8x2 : vec2<i32>;
var sint8x4 : vec4<i32>;
+ var sint16 : i32;
var sint16x2 : vec2<i32>;
var sint16x4 : vec4<i32>;
var sint32 : i32;
@@ -897,8 +901,10 @@
var sint32x4 : vec4<i32>;
{
let buffer_array_base_0 = (tint_pulling_vertex_index * 64u);
+ sint8 = ((bitcast<i32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]) << vec4<u32>(24u, 16u, 8u, 0u)[0u]) >> 24u);
sint8x2 = ((vec2<i32>(bitcast<i32>((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 16u))) << vec2<u32>(8u, 0u)) >> vec2<u32>(24u));
sint8x4 = ((vec4<i32>(bitcast<i32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)])) << vec4<u32>(24u, 16u, 8u, 0u)) >> vec4<u32>(24u));
+ sint16 = (bitcast<i32>((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 16u)) >> 16u);
sint16x2 = ((vec2<i32>(bitcast<i32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)])) << vec2<u32>(16u, 0u)) >> vec2<u32>(16u));
sint16x4 = ((vec2<i32>(bitcast<i32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), bitcast<i32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)])).xxyy << vec4<u32>(16u, 0u, 16u, 0u)) >> vec4<u32>(16u));
sint32 = bitcast<i32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]);
@@ -914,14 +920,16 @@
cfg.vertex_state = {{{256,
VertexStepMode::kVertex,
{
- {VertexFormat::kSint8x2, 64, 0},
- {VertexFormat::kSint8x4, 64, 1},
- {VertexFormat::kSint16x2, 64, 2},
- {VertexFormat::kSint16x4, 64, 3},
- {VertexFormat::kSint32, 64, 4},
- {VertexFormat::kSint32x2, 64, 5},
- {VertexFormat::kSint32x3, 64, 6},
- {VertexFormat::kSint32x4, 64, 7},
+ {VertexFormat::kSint8, 64, 0},
+ {VertexFormat::kSint8x2, 64, 1},
+ {VertexFormat::kSint8x4, 64, 2},
+ {VertexFormat::kSint16, 64, 3},
+ {VertexFormat::kSint16x2, 64, 4},
+ {VertexFormat::kSint16x4, 64, 5},
+ {VertexFormat::kSint32, 64, 6},
+ {VertexFormat::kSint32x2, 64, 7},
+ {VertexFormat::kSint32x3, 64, 8},
+ {VertexFormat::kSint32x4, 64, 9},
}}}};
DataMap data;
@@ -935,14 +943,16 @@
auto* src = R"(
@vertex
fn main(
- @location(0) uint8x2 : vec2<u32>,
- @location(1) uint8x4 : vec4<u32>,
- @location(2) uint16x2 : vec2<u32>,
- @location(3) uint16x4 : vec4<u32>,
- @location(4) uint32 : u32,
- @location(5) uint32x2 : vec2<u32>,
- @location(6) uint32x3 : vec3<u32>,
- @location(7) uint32x4 : vec4<u32>,
+ @location(0) uint8 : u32,
+ @location(1) uint8x2 : vec2<u32>,
+ @location(2) uint8x4 : vec4<u32>,
+ @location(3) uint16 : u32,
+ @location(4) uint16x2 : vec2<u32>,
+ @location(5) uint16x4 : vec4<u32>,
+ @location(6) uint32 : u32,
+ @location(7) uint32x2 : vec2<u32>,
+ @location(8) uint32x3 : vec3<u32>,
+ @location(9) uint32x4 : vec4<u32>,
) -> @builtin(position) vec4<f32> {
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
}
@@ -957,8 +967,10 @@
@vertex
fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4<f32> {
+ var uint8 : u32;
var uint8x2 : vec2<u32>;
var uint8x4 : vec4<u32>;
+ var uint16 : u32;
var uint16x2 : vec2<u32>;
var uint16x4 : vec4<u32>;
var uint32 : u32;
@@ -967,8 +979,10 @@
var uint32x4 : vec4<u32>;
{
let buffer_array_base_0 = (tint_pulling_vertex_index * 64u);
+ uint8 = ((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> vec4<u32>(0u, 8u, 16u, 24u)[0u]) & 255u);
uint8x2 = ((vec2<u32>((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 16u)) << vec2<u32>(8u, 0u)) >> vec2<u32>(24u));
uint8x4 = ((vec4<u32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]) << vec4<u32>(24u, 16u, 8u, 0u)) >> vec4<u32>(24u));
+ uint16 = (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u);
uint16x2 = ((vec2<u32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]) << vec2<u32>(16u, 0u)) >> vec2<u32>(16u));
uint16x4 = ((vec2<u32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)], tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)]).xxyy << vec4<u32>(16u, 0u, 16u, 0u)) >> vec4<u32>(16u));
uint32 = tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)];
@@ -984,14 +998,16 @@
cfg.vertex_state = {{{256,
VertexStepMode::kVertex,
{
- {VertexFormat::kUint8x2, 64, 0},
- {VertexFormat::kUint8x4, 64, 1},
- {VertexFormat::kUint16x2, 64, 2},
- {VertexFormat::kUint16x4, 64, 3},
- {VertexFormat::kUint32, 64, 4},
- {VertexFormat::kUint32x2, 64, 5},
- {VertexFormat::kUint32x3, 64, 6},
- {VertexFormat::kUint32x4, 64, 7},
+ {VertexFormat::kUint8, 64, 0},
+ {VertexFormat::kUint8x2, 64, 1},
+ {VertexFormat::kUint8x4, 64, 2},
+ {VertexFormat::kUint16, 64, 3},
+ {VertexFormat::kUint16x2, 64, 4},
+ {VertexFormat::kUint16x4, 64, 5},
+ {VertexFormat::kUint32, 64, 6},
+ {VertexFormat::kUint32x2, 64, 7},
+ {VertexFormat::kUint32x3, 64, 8},
+ {VertexFormat::kUint32x4, 64, 9},
}}}};
DataMap data;
@@ -1005,21 +1021,27 @@
auto* src = R"(
@vertex
fn main(
- @location(0) unorm8x2 : vec2<f32>,
- @location(1) unorm8x4 : vec4<f32>,
- @location(2) snorm8x2 : vec2<f32>,
- @location(3) snorm8x4 : vec4<f32>,
- @location(4) unorm16x2 : vec2<f32>,
- @location(5) unorm16x4 : vec4<f32>,
- @location(6) snorm16x2 : vec2<f32>,
- @location(7) snorm16x4 : vec4<f32>,
- @location(8) float16x2 : vec2<f32>,
- @location(9) float16x4 : vec4<f32>,
- @location(10) float32 : f32,
- @location(11) float32x2 : vec2<f32>,
- @location(12) float32x3 : vec3<f32>,
- @location(13) float32x4 : vec4<f32>,
- @location(14) unorm10_10_10_2 : vec4<f32>,
+ @location(0) unorm8 : f32,
+ @location(1) unorm8x2 : vec2<f32>,
+ @location(2) unorm8x4 : vec4<f32>,
+ @location(3) snorm8 : f32,
+ @location(4) snorm8x2 : vec2<f32>,
+ @location(5) snorm8x4 : vec4<f32>,
+ @location(6) unorm16 : f32,
+ @location(7) unorm16x2 : vec2<f32>,
+ @location(8) unorm16x4 : vec4<f32>,
+ @location(9) snorm16 : f32,
+ @location(10) snorm16x2 : vec2<f32>,
+ @location(11) snorm16x4 : vec4<f32>,
+ @location(12) float16 : f32,
+ @location(13) float16x2 : vec2<f32>,
+ @location(14) float16x4 : vec4<f32>,
+ @location(15) float32 : f32,
+ @location(16) float32x2 : vec2<f32>,
+ @location(17) float32x3 : vec3<f32>,
+ @location(18) float32x4 : vec4<f32>,
+ @location(19) unorm10_10_10_2 : vec4<f32>,
+ @location(20) unorm8x4_bgra : vec4<f32>,
) -> @builtin(position) vec4<f32> {
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
}
@@ -1034,14 +1056,19 @@
@vertex
fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4<f32> {
+ var unorm8 : f32;
var unorm8x2 : vec2<f32>;
var unorm8x4 : vec4<f32>;
+ var snorm8 : f32;
var snorm8x2 : vec2<f32>;
var snorm8x4 : vec4<f32>;
+ var unorm16 : f32;
var unorm16x2 : vec2<f32>;
var unorm16x4 : vec4<f32>;
+ var snorm16 : f32;
var snorm16x2 : vec2<f32>;
var snorm16x4 : vec4<f32>;
+ var float16 : f32;
var float16x2 : vec2<f32>;
var float16x4 : vec4<f32>;
var float32 : f32;
@@ -1049,16 +1076,22 @@
var float32x3 : vec3<f32>;
var float32x4 : vec4<f32>;
var unorm10_10_10_2 : vec4<f32>;
+ var unorm8x4_bgra : vec4<f32>;
{
let buffer_array_base_0 = (tint_pulling_vertex_index * 64u);
+ unorm8 = unpack4x8unorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> vec4<u32>(0u, 8u, 16u, 24u)[0u]) & 255u)).x;
unorm8x2 = unpack4x8unorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).xy;
unorm8x4 = unpack4x8unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]);
+ snorm8 = unpack4x8snorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> vec4<u32>(0u, 8u, 16u, 24u)[0u]) & 255u)).x;
snorm8x2 = unpack4x8snorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).xy;
snorm8x4 = unpack4x8snorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]);
+ unorm16 = unpack2x16unorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).x;
unorm16x2 = unpack2x16unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]);
unorm16x4 = vec4<f32>(unpack2x16unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), unpack2x16unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)]));
+ snorm16 = unpack2x16snorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).x;
snorm16x2 = unpack2x16snorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]);
snorm16x4 = vec4<f32>(unpack2x16snorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), unpack2x16snorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)]));
+ float16 = unpack2x16float((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).x;
float16x2 = unpack2x16float(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]);
float16x4 = vec4<f32>(unpack2x16float(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), unpack2x16float(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)]));
float32 = bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]);
@@ -1066,31 +1099,29 @@
float32x3 = vec3<f32>(bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 18u)]));
float32x4 = vec4<f32>(bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 18u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 19u)]));
unorm10_10_10_2 = (vec4<f32>(((vec4<u32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]) >> vec4<u32>(0u, 10u, 20u, 30u)) & vec4<u32>(1023u, 1023u, 1023u, 3u))) / vec4<f32>(1023.0f, 1023.0f, 1023.0f, 3.0f));
+ unorm8x4_bgra = unpack4x8unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]).zyxw;
}
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
}
)";
VertexPulling::Config cfg;
- cfg.vertex_state = {{{256,
- VertexStepMode::kVertex,
- {
- {VertexFormat::kUnorm8x2, 64, 0},
- {VertexFormat::kUnorm8x4, 64, 1},
- {VertexFormat::kSnorm8x2, 64, 2},
- {VertexFormat::kSnorm8x4, 64, 3},
- {VertexFormat::kUnorm16x2, 64, 4},
- {VertexFormat::kUnorm16x4, 64, 5},
- {VertexFormat::kSnorm16x2, 64, 6},
- {VertexFormat::kSnorm16x4, 64, 7},
- {VertexFormat::kFloat16x2, 64, 8},
- {VertexFormat::kFloat16x4, 64, 9},
- {VertexFormat::kFloat32, 64, 10},
- {VertexFormat::kFloat32x2, 64, 11},
- {VertexFormat::kFloat32x3, 64, 12},
- {VertexFormat::kFloat32x4, 64, 13},
- {VertexFormat::kUnorm10_10_10_2, 64, 14},
- }}}};
+ cfg.vertex_state = {
+ {{256,
+ VertexStepMode::kVertex,
+ {
+ {VertexFormat::kUnorm8, 64, 0}, {VertexFormat::kUnorm8x2, 64, 1},
+ {VertexFormat::kUnorm8x4, 64, 2}, {VertexFormat::kSnorm8, 64, 3},
+ {VertexFormat::kSnorm8x2, 64, 4}, {VertexFormat::kSnorm8x4, 64, 5},
+ {VertexFormat::kUnorm16, 64, 6}, {VertexFormat::kUnorm16x2, 64, 7},
+ {VertexFormat::kUnorm16x4, 64, 8}, {VertexFormat::kSnorm16, 64, 9},
+ {VertexFormat::kSnorm16x2, 64, 10}, {VertexFormat::kSnorm16x4, 64, 11},
+ {VertexFormat::kFloat16, 64, 12}, {VertexFormat::kFloat16x2, 64, 13},
+ {VertexFormat::kFloat16x4, 64, 14}, {VertexFormat::kFloat32, 64, 15},
+ {VertexFormat::kFloat32x2, 64, 16}, {VertexFormat::kFloat32x3, 64, 17},
+ {VertexFormat::kFloat32x4, 64, 18}, {VertexFormat::kUnorm10_10_10_2, 64, 19},
+ {VertexFormat::kUnorm8x4BGRA, 64, 20},
+ }}}};
DataMap data;
data.Add<VertexPulling::Config>(cfg);
@@ -1105,20 +1136,27 @@
@vertex
fn main(
- @location(0) unorm8x2 : vec2<f16>,
- @location(1) unorm8x4 : vec4<f16>,
- @location(2) snorm8x2 : vec2<f16>,
- @location(3) snorm8x4 : vec4<f16>,
- @location(4) unorm16x2 : vec2<f16>,
- @location(5) unorm16x4 : vec4<f16>,
- @location(6) snorm16x2 : vec2<f16>,
- @location(7) snorm16x4 : vec4<f16>,
- @location(8) float16x2 : vec2<f16>,
- @location(9) float16x4 : vec4<f16>,
- @location(10) float32 : f16,
- @location(11) float32x2 : vec2<f16>,
- @location(12) float32x3 : vec3<f16>,
- @location(13) float32x4 : vec4<f16>,
+ @location(0) unorm8 : f16,
+ @location(1) unorm8x2 : vec2<f16>,
+ @location(2) unorm8x4 : vec4<f16>,
+ @location(3) snorm8 : f16,
+ @location(4) snorm8x2 : vec2<f16>,
+ @location(5) snorm8x4 : vec4<f16>,
+ @location(6) unorm16 : f16,
+ @location(7) unorm16x2 : vec2<f16>,
+ @location(8) unorm16x4 : vec4<f16>,
+ @location(9) snorm16 : f16,
+ @location(10) snorm16x2 : vec2<f16>,
+ @location(11) snorm16x4 : vec4<f16>,
+ @location(12) float16 : f16,
+ @location(13) float16x2 : vec2<f16>,
+ @location(14) float16x4 : vec4<f16>,
+ @location(15) float32 : f16,
+ @location(16) float32x2 : vec2<f16>,
+ @location(17) float32x3 : vec3<f16>,
+ @location(18) float32x4 : vec4<f16>,
+ @location(19) unorm10_10_10_2 : vec4<f16>,
+ @location(20) unorm8x4_bgra : vec4<f16>,
) -> @builtin(position) vec4<f32> {
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
}
@@ -1135,60 +1173,72 @@
@vertex
fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4<f32> {
+ var unorm8 : f16;
var unorm8x2 : vec2<f16>;
var unorm8x4 : vec4<f16>;
+ var snorm8 : f16;
var snorm8x2 : vec2<f16>;
var snorm8x4 : vec4<f16>;
+ var unorm16 : f16;
var unorm16x2 : vec2<f16>;
var unorm16x4 : vec4<f16>;
+ var snorm16 : f16;
var snorm16x2 : vec2<f16>;
var snorm16x4 : vec4<f16>;
+ var float16 : f16;
var float16x2 : vec2<f16>;
var float16x4 : vec4<f16>;
var float32 : f16;
var float32x2 : vec2<f16>;
var float32x3 : vec3<f16>;
var float32x4 : vec4<f16>;
+ var unorm10_10_10_2 : vec4<f16>;
+ var unorm8x4_bgra : vec4<f16>;
{
let buffer_array_base_0 = (tint_pulling_vertex_index * 64u);
+ unorm8 = f16(unpack4x8unorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> vec4<u32>(0u, 8u, 16u, 24u)[0u]) & 255u)).x);
unorm8x2 = vec2<f16>(unpack4x8unorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).xy);
unorm8x4 = vec4<f16>(unpack4x8unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]));
+ snorm8 = f16(unpack4x8snorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> vec4<u32>(0u, 8u, 16u, 24u)[0u]) & 255u)).x);
snorm8x2 = vec2<f16>(unpack4x8snorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).xy);
snorm8x4 = vec4<f16>(unpack4x8snorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]));
+ unorm16 = f16(unpack2x16unorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).x);
unorm16x2 = vec2<f16>(unpack2x16unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]));
unorm16x4 = vec4<f16>(vec4<f32>(unpack2x16unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), unpack2x16unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)])));
+ snorm16 = f16(unpack2x16snorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).x);
snorm16x2 = vec2<f16>(unpack2x16snorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]));
snorm16x4 = vec4<f16>(vec4<f32>(unpack2x16snorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), unpack2x16snorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)])));
+ float16 = f16(unpack2x16float((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).x);
float16x2 = vec2<f16>(unpack2x16float(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]));
float16x4 = vec4<f16>(vec4<f32>(unpack2x16float(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), unpack2x16float(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)])));
float32 = f16(bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]));
float32x2 = vec2<f16>(vec2<f32>(bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)])));
float32x3 = vec3<f16>(vec3<f32>(bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 18u)])));
float32x4 = vec4<f16>(vec4<f32>(bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 18u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 19u)])));
+ unorm10_10_10_2 = vec4<f16>((vec4<f32>(((vec4<u32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]) >> vec4<u32>(0u, 10u, 20u, 30u)) & vec4<u32>(1023u, 1023u, 1023u, 3u))) / vec4<f32>(1023.0f, 1023.0f, 1023.0f, 3.0f)));
+ unorm8x4_bgra = vec4<f16>(unpack4x8unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]).zyxw);
}
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
}
)";
VertexPulling::Config cfg;
- cfg.vertex_state = {{{256,
- VertexStepMode::kVertex,
- {
- {VertexFormat::kUnorm8x2, 64, 0},
- {VertexFormat::kUnorm8x4, 64, 1},
- {VertexFormat::kSnorm8x2, 64, 2},
- {VertexFormat::kSnorm8x4, 64, 3},
- {VertexFormat::kUnorm16x2, 64, 4},
- {VertexFormat::kUnorm16x4, 64, 5},
- {VertexFormat::kSnorm16x2, 64, 6},
- {VertexFormat::kSnorm16x4, 64, 7},
- {VertexFormat::kFloat16x2, 64, 8},
- {VertexFormat::kFloat16x4, 64, 9},
- {VertexFormat::kFloat32, 64, 10},
- {VertexFormat::kFloat32x2, 64, 11},
- {VertexFormat::kFloat32x3, 64, 12},
- {VertexFormat::kFloat32x4, 64, 13},
- }}}};
+ cfg.vertex_state = {
+ {{256,
+ VertexStepMode::kVertex,
+ {
+ {VertexFormat::kUnorm8, 64, 0}, {VertexFormat::kUnorm8x2, 64, 1},
+ {VertexFormat::kUnorm8x4, 64, 2}, {VertexFormat::kSnorm8, 64, 3},
+ {VertexFormat::kSnorm8x2, 64, 4}, {VertexFormat::kSnorm8x4, 64, 5},
+ {VertexFormat::kUnorm16, 64, 6}, {VertexFormat::kUnorm16x2, 64, 7},
+ {VertexFormat::kUnorm16x4, 64, 8}, {VertexFormat::kSnorm16, 64, 9},
+ {VertexFormat::kSnorm16x2, 64, 10}, {VertexFormat::kSnorm16x4, 64, 11},
+ {VertexFormat::kFloat16, 64, 12}, {VertexFormat::kFloat16x2, 64, 13},
+ {VertexFormat::kFloat16x4, 64, 14}, {VertexFormat::kFloat32, 64, 15},
+ {VertexFormat::kFloat32x2, 64, 16}, {VertexFormat::kFloat32x3, 64, 17},
+ {VertexFormat::kFloat32x4, 64, 18}, {VertexFormat::kUnorm10_10_10_2, 64, 19},
+ {VertexFormat::kUnorm8x4BGRA, 64, 20},
+ }}}};
DataMap data;
data.Add<VertexPulling::Config>(cfg);
@@ -1201,14 +1251,16 @@
auto* src = R"(
@vertex
fn main(
- @location(0) sint8x2 : vec2<i32>,
- @location(1) sint8x4 : vec4<i32>,
- @location(2) sint16x2 : vec2<i32>,
- @location(3) sint16x4 : vec4<i32>,
- @location(4) sint32 : i32,
- @location(5) sint32x2 : vec2<i32>,
- @location(6) sint32x3 : vec3<i32>,
- @location(7) sint32x4 : vec4<i32>
+ @location(0) sint8 : i32,
+ @location(1) sint8x2 : vec2<i32>,
+ @location(2) sint8x4 : vec4<i32>,
+ @location(3) sint16 : i32,
+ @location(4) sint16x2 : vec2<i32>,
+ @location(5) sint16x4 : vec4<i32>,
+ @location(6) sint32 : i32,
+ @location(7) sint32x2 : vec2<i32>,
+ @location(8) sint32x3 : vec3<i32>,
+ @location(9) sint32x4 : vec4<i32>
) -> @builtin(position) vec4<f32> {
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
}
@@ -1223,8 +1275,10 @@
@vertex
fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4<f32> {
+ var sint8 : i32;
var sint8x2 : vec2<i32>;
var sint8x4 : vec4<i32>;
+ var sint16 : i32;
var sint16x2 : vec2<i32>;
var sint16x4 : vec4<i32>;
var sint32 : i32;
@@ -1233,8 +1287,10 @@
var sint32x4 : vec4<i32>;
{
let buffer_array_base_0 = (tint_pulling_vertex_index * 64u);
+ sint8 = ((bitcast<i32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)]) << vec4<u32>(24u, 16u, 8u, 0u)[3u]) >> 24u);
sint8x2 = ((vec2<i32>(bitcast<i32>((((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 8u)) & 4294901760u))) << vec2<u32>(8u, 0u)) >> vec2<u32>(24u));
sint8x4 = ((vec4<i32>(bitcast<i32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u)))) << vec4<u32>(24u, 16u, 8u, 0u)) >> vec4<u32>(24u));
+ sint16x2 = vec2<i32>((bitcast<i32>((((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 8u)) & 4294901760u)) >> 16u), 0);
sint16x2 = ((vec2<i32>(bitcast<i32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u)))) << vec2<u32>(16u, 0u)) >> vec2<u32>(16u));
sint16x4 = ((vec2<i32>(bitcast<i32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u))), bitcast<i32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)] << 8u)))).xxyy << vec4<u32>(16u, 0u, 16u, 0u)) >> vec4<u32>(16u));
sint32 = bitcast<i32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u)));
@@ -1250,14 +1306,16 @@
cfg.vertex_state = {{{256,
VertexStepMode::kVertex,
{
- {VertexFormat::kSint8x2, 63, 0},
- {VertexFormat::kSint8x4, 63, 1},
- {VertexFormat::kSint16x2, 63, 2},
- {VertexFormat::kSint16x4, 63, 3},
- {VertexFormat::kSint32, 63, 4},
- {VertexFormat::kSint32x2, 64, 5},
- {VertexFormat::kSint32x3, 63, 6},
- {VertexFormat::kSint32x4, 63, 7},
+ {VertexFormat::kSint8, 63, 0},
+ {VertexFormat::kSint8x2, 63, 1},
+ {VertexFormat::kSint8x4, 63, 2},
+ {VertexFormat::kSint16, 63, 4},
+ {VertexFormat::kSint16x2, 63, 4},
+ {VertexFormat::kSint16x4, 63, 5},
+ {VertexFormat::kSint32, 63, 6},
+ {VertexFormat::kSint32x2, 64, 7},
+ {VertexFormat::kSint32x3, 63, 8},
+ {VertexFormat::kSint32x4, 63, 9},
}}}};
DataMap data;
@@ -1271,14 +1329,16 @@
auto* src = R"(
@vertex
fn main(
- @location(0) uint8x2 : vec2<u32>,
- @location(1) uint8x4 : vec4<u32>,
- @location(2) uint16x2 : vec2<u32>,
- @location(3) uint16x4 : vec4<u32>,
- @location(4) uint32 : u32,
- @location(5) uint32x2 : vec2<u32>,
- @location(6) uint32x3 : vec3<u32>,
- @location(7) uint32x4 : vec4<u32>,
+ @location(0) uint8 : u32,
+ @location(1) uint8x2 : vec2<u32>,
+ @location(2) uint8x4 : vec4<u32>,
+ @location(3) uint16 : u32,
+ @location(4) uint16x2 : vec2<u32>,
+ @location(5) uint16x4 : vec4<u32>,
+ @location(6) uint32 : u32,
+ @location(7) uint32x2 : vec2<u32>,
+ @location(8) uint32x3 : vec3<u32>,
+ @location(9) uint32x4 : vec4<u32>,
) -> @builtin(position) vec4<f32> {
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
}
@@ -1293,8 +1353,10 @@
@vertex
fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4<f32> {
+ var uint8 : u32;
var uint8x2 : vec2<u32>;
var uint8x4 : vec4<u32>;
+ var uint16 : u32;
var uint16x2 : vec2<u32>;
var uint16x4 : vec4<u32>;
var uint32 : u32;
@@ -1303,8 +1365,10 @@
var uint32x4 : vec4<u32>;
{
let buffer_array_base_0 = (tint_pulling_vertex_index * 64u);
+ uint8 = ((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> vec4<u32>(0u, 8u, 16u, 24u)[3u]) & 255u);
uint8x2 = ((vec2<u32>((((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 8u)) & 4294901760u)) << vec2<u32>(8u, 0u)) >> vec2<u32>(24u));
uint8x4 = ((vec4<u32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u))) << vec4<u32>(24u, 16u, 8u, 0u)) >> vec4<u32>(24u));
+ uint16 = (((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u)) & 65535u);
uint16x2 = ((vec2<u32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u))) << vec2<u32>(16u, 0u)) >> vec2<u32>(16u));
uint16x4 = ((vec2<u32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u)), ((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)] << 8u))).xxyy << vec4<u32>(16u, 0u, 16u, 0u)) >> vec4<u32>(16u));
uint32 = ((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u));
@@ -1320,14 +1384,16 @@
cfg.vertex_state = {{{256,
VertexStepMode::kVertex,
{
- {VertexFormat::kUint8x2, 63, 0},
- {VertexFormat::kUint8x4, 63, 1},
- {VertexFormat::kUint16x2, 63, 2},
- {VertexFormat::kUint16x4, 63, 3},
- {VertexFormat::kUint32, 63, 4},
- {VertexFormat::kUint32x2, 63, 5},
- {VertexFormat::kUint32x3, 63, 6},
- {VertexFormat::kUint32x4, 63, 7},
+ {VertexFormat::kUint8, 63, 0},
+ {VertexFormat::kUint8x2, 63, 1},
+ {VertexFormat::kUint8x4, 63, 2},
+ {VertexFormat::kUint16, 63, 3},
+ {VertexFormat::kUint16x2, 63, 4},
+ {VertexFormat::kUint16x4, 63, 5},
+ {VertexFormat::kUint32, 63, 6},
+ {VertexFormat::kUint32x2, 63, 7},
+ {VertexFormat::kUint32x3, 63, 8},
+ {VertexFormat::kUint32x4, 63, 9},
}}}};
DataMap data;
@@ -1341,21 +1407,27 @@
auto* src = R"(
@vertex
fn main(
- @location(0) unorm8x2 : vec2<f32>,
- @location(1) unorm8x4 : vec4<f32>,
- @location(2) snorm8x2 : vec2<f32>,
- @location(3) snorm8x4 : vec4<f32>,
- @location(4) unorm16x2 : vec2<f32>,
- @location(5) unorm16x4 : vec4<f32>,
- @location(6) snorm16x2 : vec2<f32>,
- @location(7) snorm16x4 : vec4<f32>,
- @location(8) float16x2 : vec2<f32>,
- @location(9) float16x4 : vec4<f32>,
- @location(10) float32 : f32,
- @location(11) float32x2 : vec2<f32>,
- @location(12) float32x3 : vec3<f32>,
- @location(13) float32x4 : vec4<f32>,
- @location(14) unorm10_10_10_2 : vec4<f32>,
+ @location(0) unorm8 : f32,
+ @location(1) unorm8x2 : vec2<f32>,
+ @location(2) unorm8x4 : vec4<f32>,
+ @location(3) snorm8 : f32,
+ @location(4) snorm8x2 : vec2<f32>,
+ @location(5) snorm8x4 : vec4<f32>,
+ @location(6) unorm16 : f32,
+ @location(7) unorm16x2 : vec2<f32>,
+ @location(8) unorm16x4 : vec4<f32>,
+ @location(9) snorm16 : f32,
+ @location(10) snorm16x2 : vec2<f32>,
+ @location(11) snorm16x4 : vec4<f32>,
+ @location(12) float16 : f32,
+ @location(13) float16x2 : vec2<f32>,
+ @location(14) float16x4 : vec4<f32>,
+ @location(15) float32 : f32,
+ @location(16) float32x2 : vec2<f32>,
+ @location(17) float32x3 : vec3<f32>,
+ @location(18) float32x4 : vec4<f32>,
+ @location(19) unorm10_10_10_2 : vec4<f32>,
+ @location(20) unorm8x4_bgra : vec4<f32>,
) -> @builtin(position) vec4<f32> {
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
}
@@ -1370,14 +1442,19 @@
@vertex
fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4<f32> {
+ var unorm8 : f32;
var unorm8x2 : vec2<f32>;
var unorm8x4 : vec4<f32>;
+ var snorm8 : f32;
var snorm8x2 : vec2<f32>;
var snorm8x4 : vec4<f32>;
+ var unorm16 : f32;
var unorm16x2 : vec2<f32>;
var unorm16x4 : vec4<f32>;
+ var snorm16 : f32;
var snorm16x2 : vec2<f32>;
var snorm16x4 : vec4<f32>;
+ var float16 : f32;
var float16x2 : vec2<f32>;
var float16x4 : vec4<f32>;
var float32 : f32;
@@ -1385,48 +1462,52 @@
var float32x3 : vec3<f32>;
var float32x4 : vec4<f32>;
var unorm10_10_10_2 : vec4<f32>;
+ var unorm8x4_bgra : vec4<f32>;
{
let buffer_array_base_0 = (tint_pulling_vertex_index * 64u);
- unorm8x2 = unpack4x8unorm((((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u)) & 65535u)).xy;
- unorm8x4 = unpack4x8unorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u)));
- snorm8x2 = unpack4x8snorm((((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u)) & 65535u)).xy;
- snorm8x4 = unpack4x8snorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u)));
- unorm16x2 = unpack2x16unorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u)));
- unorm16x4 = vec4<f32>(unpack2x16unorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u))), unpack2x16unorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)] << 8u))));
- snorm16x2 = unpack2x16snorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u)));
- snorm16x4 = vec4<f32>(unpack2x16snorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u))), unpack2x16snorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)] << 8u))));
- float16x2 = unpack2x16float(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u)));
- float16x4 = vec4<f32>(unpack2x16float(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u))), unpack2x16float(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)] << 8u))));
- float32 = bitcast<f32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u)));
- float32x2 = vec2<f32>(bitcast<f32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u))), bitcast<f32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)] << 8u))));
- float32x3 = vec3<f32>(bitcast<f32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u))), bitcast<f32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)] << 8u))), bitcast<f32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 18u)] << 8u))));
- float32x4 = vec4<f32>(bitcast<f32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u))), bitcast<f32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)] << 8u))), bitcast<f32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 18u)] << 8u))), bitcast<f32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 18u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 19u)] << 8u))));
- unorm10_10_10_2 = (vec4<f32>(((vec4<u32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u))) >> vec4<u32>(0u, 10u, 20u, 30u)) & vec4<u32>(1023u, 1023u, 1023u, 3u))) / vec4<f32>(1023.0f, 1023.0f, 1023.0f, 3.0f));
+ unorm8 = unpack4x8unorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> vec4<u32>(0u, 8u, 16u, 24u)[0u]) & 255u)).x;
+ unorm8x2 = unpack4x8unorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).xy;
+ unorm8x4 = unpack4x8unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]);
+ snorm8 = unpack4x8snorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> vec4<u32>(0u, 8u, 16u, 24u)[0u]) & 255u)).x;
+ snorm8x2 = unpack4x8snorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).xy;
+ snorm8x4 = unpack4x8snorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]);
+ unorm16 = unpack2x16unorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).x;
+ unorm16x2 = unpack2x16unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]);
+ unorm16x4 = vec4<f32>(unpack2x16unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), unpack2x16unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)]));
+ snorm16 = unpack2x16snorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).x;
+ snorm16x2 = unpack2x16snorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]);
+ snorm16x4 = vec4<f32>(unpack2x16snorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), unpack2x16snorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)]));
+ float16 = unpack2x16float((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).x;
+ float16x2 = unpack2x16float(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]);
+ float16x4 = vec4<f32>(unpack2x16float(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), unpack2x16float(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)]));
+ float32 = bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]);
+ float32x2 = vec2<f32>(bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)]));
+ float32x3 = vec3<f32>(bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 18u)]));
+ float32x4 = vec4<f32>(bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 18u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 19u)]));
+ unorm10_10_10_2 = (vec4<f32>(((vec4<u32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]) >> vec4<u32>(0u, 10u, 20u, 30u)) & vec4<u32>(1023u, 1023u, 1023u, 3u))) / vec4<f32>(1023.0f, 1023.0f, 1023.0f, 3.0f));
+ unorm8x4_bgra = unpack4x8unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]).zyxw;
}
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
}
)";
VertexPulling::Config cfg;
- cfg.vertex_state = {{{256,
- VertexStepMode::kVertex,
- {
- {VertexFormat::kUnorm8x2, 63, 0},
- {VertexFormat::kUnorm8x4, 63, 1},
- {VertexFormat::kSnorm8x2, 63, 2},
- {VertexFormat::kSnorm8x4, 63, 3},
- {VertexFormat::kUnorm16x2, 63, 4},
- {VertexFormat::kUnorm16x4, 63, 5},
- {VertexFormat::kSnorm16x2, 63, 6},
- {VertexFormat::kSnorm16x4, 63, 7},
- {VertexFormat::kFloat16x2, 63, 8},
- {VertexFormat::kFloat16x4, 63, 9},
- {VertexFormat::kFloat32, 63, 10},
- {VertexFormat::kFloat32x2, 63, 11},
- {VertexFormat::kFloat32x3, 63, 12},
- {VertexFormat::kFloat32x4, 63, 13},
- {VertexFormat::kUnorm10_10_10_2, 63, 14},
- }}}};
+ cfg.vertex_state = {
+ {{256,
+ VertexStepMode::kVertex,
+ {
+ {VertexFormat::kUnorm8, 64, 0}, {VertexFormat::kUnorm8x2, 64, 1},
+ {VertexFormat::kUnorm8x4, 64, 2}, {VertexFormat::kSnorm8, 64, 3},
+ {VertexFormat::kSnorm8x2, 64, 4}, {VertexFormat::kSnorm8x4, 64, 5},
+ {VertexFormat::kUnorm16, 64, 6}, {VertexFormat::kUnorm16x2, 64, 7},
+ {VertexFormat::kUnorm16x4, 64, 8}, {VertexFormat::kSnorm16, 64, 9},
+ {VertexFormat::kSnorm16x2, 64, 10}, {VertexFormat::kSnorm16x4, 64, 11},
+ {VertexFormat::kFloat16, 64, 12}, {VertexFormat::kFloat16x2, 64, 13},
+ {VertexFormat::kFloat16x4, 64, 14}, {VertexFormat::kFloat32, 64, 15},
+ {VertexFormat::kFloat32x2, 64, 16}, {VertexFormat::kFloat32x3, 64, 17},
+ {VertexFormat::kFloat32x4, 64, 18}, {VertexFormat::kUnorm10_10_10_2, 64, 19},
+ {VertexFormat::kUnorm8x4BGRA, 64, 20},
+ }}}};
DataMap data;
data.Add<VertexPulling::Config>(cfg);
@@ -1441,20 +1522,27 @@
@vertex
fn main(
- @location(0) unorm8x2 : vec2<f16>,
- @location(1) unorm8x4 : vec4<f16>,
- @location(2) snorm8x2 : vec2<f16>,
- @location(3) snorm8x4 : vec4<f16>,
- @location(4) unorm16x2 : vec2<f16>,
- @location(5) unorm16x4 : vec4<f16>,
- @location(6) snorm16x2 : vec2<f16>,
- @location(7) snorm16x4 : vec4<f16>,
- @location(8) float16x2 : vec2<f16>,
- @location(9) float16x4 : vec4<f16>,
- @location(10) float32 : f16,
- @location(11) float32x2 : vec2<f16>,
- @location(12) float32x3 : vec3<f16>,
- @location(13) float32x4 : vec4<f16>,
+ @location(0) unorm8 : f16,
+ @location(1) unorm8x2 : vec2<f16>,
+ @location(2) unorm8x4 : vec4<f16>,
+ @location(3) snorm8 : f16,
+ @location(4) snorm8x2 : vec2<f16>,
+ @location(5) snorm8x4 : vec4<f16>,
+ @location(6) unorm16 : f16,
+ @location(7) unorm16x2 : vec2<f16>,
+ @location(8) unorm16x4 : vec4<f16>,
+ @location(9) snorm16 : f16,
+ @location(10) snorm16x2 : vec2<f16>,
+ @location(11) snorm16x4 : vec4<f16>,
+ @location(12) float16 : f16,
+ @location(13) float16x2 : vec2<f16>,
+ @location(14) float16x4 : vec4<f16>,
+ @location(15) float32 : f16,
+ @location(16) float32x2 : vec2<f16>,
+ @location(17) float32x3 : vec3<f16>,
+ @location(18) float32x4 : vec4<f16>,
+ @location(19) unorm10_10_10_2 : vec4<f16>,
+ @location(20) unorm8x4_bgra : vec4<f16>,
) -> @builtin(position) vec4<f32> {
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
}
@@ -1471,60 +1559,72 @@
@vertex
fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4<f32> {
+ var unorm8 : f16;
var unorm8x2 : vec2<f16>;
var unorm8x4 : vec4<f16>;
+ var snorm8 : f16;
var snorm8x2 : vec2<f16>;
var snorm8x4 : vec4<f16>;
+ var unorm16 : f16;
var unorm16x2 : vec2<f16>;
var unorm16x4 : vec4<f16>;
+ var snorm16 : f16;
var snorm16x2 : vec2<f16>;
var snorm16x4 : vec4<f16>;
+ var float16 : f16;
var float16x2 : vec2<f16>;
var float16x4 : vec4<f16>;
var float32 : f16;
var float32x2 : vec2<f16>;
var float32x3 : vec3<f16>;
var float32x4 : vec4<f16>;
+ var unorm10_10_10_2 : vec4<f16>;
+ var unorm8x4_bgra : vec4<f16>;
{
let buffer_array_base_0 = (tint_pulling_vertex_index * 64u);
- unorm8x2 = vec2<f16>(unpack4x8unorm((((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u)) & 65535u)).xy);
- unorm8x4 = vec4<f16>(unpack4x8unorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u))));
- snorm8x2 = vec2<f16>(unpack4x8snorm((((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u)) & 65535u)).xy);
- snorm8x4 = vec4<f16>(unpack4x8snorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u))));
- unorm16x2 = vec2<f16>(unpack2x16unorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u))));
- unorm16x4 = vec4<f16>(vec4<f32>(unpack2x16unorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u))), unpack2x16unorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)] << 8u)))));
- snorm16x2 = vec2<f16>(unpack2x16snorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u))));
- snorm16x4 = vec4<f16>(vec4<f32>(unpack2x16snorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u))), unpack2x16snorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)] << 8u)))));
- float16x2 = vec2<f16>(unpack2x16float(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u))));
- float16x4 = vec4<f16>(vec4<f32>(unpack2x16float(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u))), unpack2x16float(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)] << 8u)))));
- float32 = f16(bitcast<f32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u))));
- float32x2 = vec2<f16>(vec2<f32>(bitcast<f32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u))), bitcast<f32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)] << 8u)))));
- float32x3 = vec3<f16>(vec3<f32>(bitcast<f32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u))), bitcast<f32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)] << 8u))), bitcast<f32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 18u)] << 8u)))));
- float32x4 = vec4<f16>(vec4<f32>(bitcast<f32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 15u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 8u))), bitcast<f32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)] << 8u))), bitcast<f32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 18u)] << 8u))), bitcast<f32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 18u)] >> 24u) | (tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 19u)] << 8u)))));
+ unorm8 = f16(unpack4x8unorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> vec4<u32>(0u, 8u, 16u, 24u)[0u]) & 255u)).x);
+ unorm8x2 = vec2<f16>(unpack4x8unorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).xy);
+ unorm8x4 = vec4<f16>(unpack4x8unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]));
+ snorm8 = f16(unpack4x8snorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> vec4<u32>(0u, 8u, 16u, 24u)[0u]) & 255u)).x);
+ snorm8x2 = vec2<f16>(unpack4x8snorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).xy);
+ snorm8x4 = vec4<f16>(unpack4x8snorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]));
+ unorm16 = f16(unpack2x16unorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).x);
+ unorm16x2 = vec2<f16>(unpack2x16unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]));
+ unorm16x4 = vec4<f16>(vec4<f32>(unpack2x16unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), unpack2x16unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)])));
+ snorm16 = f16(unpack2x16snorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).x);
+ snorm16x2 = vec2<f16>(unpack2x16snorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]));
+ snorm16x4 = vec4<f16>(vec4<f32>(unpack2x16snorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), unpack2x16snorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)])));
+ float16 = f16(unpack2x16float((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).x);
+ float16x2 = vec2<f16>(unpack2x16float(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]));
+ float16x4 = vec4<f16>(vec4<f32>(unpack2x16float(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), unpack2x16float(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)])));
+ float32 = f16(bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]));
+ float32x2 = vec2<f16>(vec2<f32>(bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)])));
+ float32x3 = vec3<f16>(vec3<f32>(bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 18u)])));
+ float32x4 = vec4<f16>(vec4<f32>(bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 18u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 19u)])));
+ unorm10_10_10_2 = vec4<f16>((vec4<f32>(((vec4<u32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]) >> vec4<u32>(0u, 10u, 20u, 30u)) & vec4<u32>(1023u, 1023u, 1023u, 3u))) / vec4<f32>(1023.0f, 1023.0f, 1023.0f, 3.0f)));
+ unorm8x4_bgra = vec4<f16>(unpack4x8unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]).zyxw);
}
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
}
)";
VertexPulling::Config cfg;
- cfg.vertex_state = {{{256,
- VertexStepMode::kVertex,
- {
- {VertexFormat::kUnorm8x2, 63, 0},
- {VertexFormat::kUnorm8x4, 63, 1},
- {VertexFormat::kSnorm8x2, 63, 2},
- {VertexFormat::kSnorm8x4, 63, 3},
- {VertexFormat::kUnorm16x2, 63, 4},
- {VertexFormat::kUnorm16x4, 63, 5},
- {VertexFormat::kSnorm16x2, 63, 6},
- {VertexFormat::kSnorm16x4, 63, 7},
- {VertexFormat::kFloat16x2, 63, 8},
- {VertexFormat::kFloat16x4, 63, 9},
- {VertexFormat::kFloat32, 63, 10},
- {VertexFormat::kFloat32x2, 63, 11},
- {VertexFormat::kFloat32x3, 63, 12},
- {VertexFormat::kFloat32x4, 63, 13},
- }}}};
+ cfg.vertex_state = {
+ {{256,
+ VertexStepMode::kVertex,
+ {
+ {VertexFormat::kUnorm8, 64, 0}, {VertexFormat::kUnorm8x2, 64, 1},
+ {VertexFormat::kUnorm8x4, 64, 2}, {VertexFormat::kSnorm8, 64, 3},
+ {VertexFormat::kSnorm8x2, 64, 4}, {VertexFormat::kSnorm8x4, 64, 5},
+ {VertexFormat::kUnorm16, 64, 6}, {VertexFormat::kUnorm16x2, 64, 7},
+ {VertexFormat::kUnorm16x4, 64, 8}, {VertexFormat::kSnorm16, 64, 9},
+ {VertexFormat::kSnorm16x2, 64, 10}, {VertexFormat::kSnorm16x4, 64, 11},
+ {VertexFormat::kFloat16, 64, 12}, {VertexFormat::kFloat16x2, 64, 13},
+ {VertexFormat::kFloat16x4, 64, 14}, {VertexFormat::kFloat32, 64, 15},
+ {VertexFormat::kFloat32x2, 64, 16}, {VertexFormat::kFloat32x3, 64, 17},
+ {VertexFormat::kFloat32x4, 64, 18}, {VertexFormat::kUnorm10_10_10_2, 64, 19},
+ {VertexFormat::kUnorm8x4BGRA, 64, 20},
+ }}}};
DataMap data;
data.Add<VertexPulling::Config>(cfg);
@@ -1537,16 +1637,22 @@
auto* src = R"(
@vertex
fn main(
- @location(0) vec3_sint8x2 : vec3<i32>,
- @location(1) vec4_sint8x2 : vec4<i32>,
- @location(2) vec3_sint16x2 : vec3<i32>,
- @location(3) vec4_sint16x2 : vec4<i32>,
- @location(4) vec2_sint32 : vec2<i32>,
- @location(5) vec3_sint32 : vec3<i32>,
- @location(6) vec4_sint32 : vec4<i32>,
- @location(7) vec3_sint32x2 : vec3<i32>,
- @location(8) vec4_sint32x2 : vec4<i32>,
- @location(9) vec4_sint32x3 : vec4<i32>,
+ @location(0) vec2_sint8 : vec2<i32>,
+ @location(1) vec3_sint8 : vec3<i32>,
+ @location(2) vec4_sint8 : vec4<i32>,
+ @location(3) vec2_sint16 : vec2<i32>,
+ @location(4) vec3_sint16 : vec3<i32>,
+ @location(5) vec4_sint16 : vec4<i32>,
+ @location(6) vec2_sint32 : vec2<i32>,
+ @location(7) vec3_sint32 : vec3<i32>,
+ @location(8) vec4_sint32 : vec4<i32>,
+ @location(9) vec3_sint8x2 : vec3<i32>,
+ @location(10) vec4_sint8x2 : vec4<i32>,
+ @location(11) vec3_sint16x2 : vec3<i32>,
+ @location(12) vec4_sint16x2 : vec4<i32>,
+ @location(13) vec3_sint32x2 : vec3<i32>,
+ @location(14) vec4_sint32x2 : vec4<i32>,
+ @location(15) vec4_sint32x3 : vec4<i32>,
) -> @builtin(position) vec4<f32> {
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
}
@@ -1561,25 +1667,37 @@
@vertex
fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4<f32> {
+ var vec2_sint8 : vec2<i32>;
+ var vec3_sint8 : vec3<i32>;
+ var vec4_sint8 : vec4<i32>;
+ var vec2_sint16 : vec2<i32>;
+ var vec3_sint16 : vec3<i32>;
+ var vec4_sint16 : vec4<i32>;
+ var vec2_sint32 : vec2<i32>;
+ var vec3_sint32 : vec3<i32>;
+ var vec4_sint32 : vec4<i32>;
var vec3_sint8x2 : vec3<i32>;
var vec4_sint8x2 : vec4<i32>;
var vec3_sint16x2 : vec3<i32>;
var vec4_sint16x2 : vec4<i32>;
- var vec2_sint32 : vec2<i32>;
- var vec3_sint32 : vec3<i32>;
- var vec4_sint32 : vec4<i32>;
var vec3_sint32x2 : vec3<i32>;
var vec4_sint32x2 : vec4<i32>;
var vec4_sint32x3 : vec4<i32>;
{
let buffer_array_base_0 = (tint_pulling_vertex_index * 64u);
+ vec2_sint8 = vec2<i32>(((bitcast<i32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]) << vec4<u32>(24u, 16u, 8u, 0u)[0u]) >> 24u), 0);
+ vec3_sint8 = vec3<i32>(((bitcast<i32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]) << vec4<u32>(24u, 16u, 8u, 0u)[0u]) >> 24u), 0, 0);
+ vec4_sint8 = vec4<i32>(((bitcast<i32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]) << vec4<u32>(24u, 16u, 8u, 0u)[0u]) >> 24u), 0, 0, 1);
+ vec2_sint16 = vec2<i32>((bitcast<i32>((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 16u)) >> 16u), 0);
+ vec3_sint16 = vec3<i32>((bitcast<i32>((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 16u)) >> 16u), 0, 0);
+ vec4_sint16 = vec4<i32>((bitcast<i32>((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 16u)) >> 16u), 0, 0, 1);
+ vec2_sint32 = vec2<i32>(bitcast<i32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), 0);
+ vec3_sint32 = vec3<i32>(bitcast<i32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), 0, 0);
+ vec4_sint32 = vec4<i32>(bitcast<i32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), 0, 0, 1);
vec3_sint8x2 = vec3<i32>(((vec2<i32>(bitcast<i32>((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 16u))) << vec2<u32>(8u, 0u)) >> vec2<u32>(24u)), 0);
vec4_sint8x2 = vec4<i32>(((vec2<i32>(bitcast<i32>((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 16u))) << vec2<u32>(8u, 0u)) >> vec2<u32>(24u)), 0, 1);
vec3_sint16x2 = vec3<i32>(((vec2<i32>(bitcast<i32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)])) << vec2<u32>(16u, 0u)) >> vec2<u32>(16u)), 0);
vec4_sint16x2 = vec4<i32>(((vec2<i32>(bitcast<i32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)])) << vec2<u32>(16u, 0u)) >> vec2<u32>(16u)), 0, 1);
- vec2_sint32 = vec2<i32>(bitcast<i32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), 0);
- vec3_sint32 = vec3<i32>(bitcast<i32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), 0, 0);
- vec4_sint32 = vec4<i32>(bitcast<i32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), 0, 0, 1);
vec3_sint32x2 = vec3<i32>(vec2<i32>(bitcast<i32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), bitcast<i32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)])), 0);
vec4_sint32x2 = vec4<i32>(vec2<i32>(bitcast<i32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), bitcast<i32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)])), 0, 1);
vec4_sint32x3 = vec4<i32>(vec3<i32>(bitcast<i32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), bitcast<i32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)]), bitcast<i32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 18u)])), 1);
@@ -1592,16 +1710,22 @@
cfg.vertex_state = {{{256,
VertexStepMode::kVertex,
{
- {VertexFormat::kSint8x2, 64, 0},
- {VertexFormat::kSint8x2, 64, 1},
- {VertexFormat::kSint16x2, 64, 2},
- {VertexFormat::kSint16x2, 64, 3},
- {VertexFormat::kSint32, 64, 4},
- {VertexFormat::kSint32, 64, 5},
+ {VertexFormat::kSint8, 64, 0},
+ {VertexFormat::kSint8, 64, 1},
+ {VertexFormat::kSint8, 64, 2},
+ {VertexFormat::kSint16, 64, 3},
+ {VertexFormat::kSint16, 64, 4},
+ {VertexFormat::kSint16, 64, 5},
{VertexFormat::kSint32, 64, 6},
- {VertexFormat::kSint32x2, 64, 7},
- {VertexFormat::kSint32x2, 64, 8},
- {VertexFormat::kSint32x3, 64, 9},
+ {VertexFormat::kSint32, 64, 7},
+ {VertexFormat::kSint32, 64, 8},
+ {VertexFormat::kSint8x2, 64, 9},
+ {VertexFormat::kSint8x2, 64, 10},
+ {VertexFormat::kSint16x2, 64, 11},
+ {VertexFormat::kSint16x2, 64, 12},
+ {VertexFormat::kSint32x2, 64, 13},
+ {VertexFormat::kSint32x2, 64, 14},
+ {VertexFormat::kSint32x3, 64, 15},
}}}};
DataMap data;
@@ -1615,16 +1739,22 @@
auto* src = R"(
@vertex
fn main(
- @location(0) vec3_uint8x2 : vec3<u32>,
- @location(1) vec4_uint8x2 : vec4<u32>,
- @location(2) vec3_uint16x2 : vec3<u32>,
- @location(3) vec4_uint16x2 : vec4<u32>,
- @location(4) vec2_uint32 : vec2<u32>,
- @location(5) vec3_uint32 : vec3<u32>,
- @location(6) vec4_uint32 : vec4<u32>,
- @location(7) vec3_uint32x2 : vec3<u32>,
- @location(8) vec4_uint32x2 : vec4<u32>,
- @location(9) vec4_uint32x3 : vec4<u32>,
+ @location(0) vec2_uint8 : vec2<u32>,
+ @location(1) vec3_uint8 : vec3<u32>,
+ @location(2) vec4_uint8 : vec4<u32>,
+ @location(3) vec2_uint16 : vec2<u32>,
+ @location(4) vec3_uint16 : vec3<u32>,
+ @location(5) vec4_uint16 : vec4<u32>,
+ @location(6) vec2_uint32 : vec2<u32>,
+ @location(7) vec3_uint32 : vec3<u32>,
+ @location(8) vec4_uint32 : vec4<u32>,
+ @location(9) vec3_uint8x2 : vec3<u32>,
+ @location(10) vec4_uint8x2 : vec4<u32>,
+ @location(11) vec3_uint16x2 : vec3<u32>,
+ @location(12) vec4_uint16x2 : vec4<u32>,
+ @location(13) vec3_uint32x2 : vec3<u32>,
+ @location(14) vec4_uint32x2 : vec4<u32>,
+ @location(15) vec4_uint32x3 : vec4<u32>,
) -> @builtin(position) vec4<f32> {
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
}
@@ -1639,25 +1769,37 @@
@vertex
fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4<f32> {
+ var vec2_uint8 : vec2<u32>;
+ var vec3_uint8 : vec3<u32>;
+ var vec4_uint8 : vec4<u32>;
+ var vec2_uint16 : vec2<u32>;
+ var vec3_uint16 : vec3<u32>;
+ var vec4_uint16 : vec4<u32>;
+ var vec2_uint32 : vec2<u32>;
+ var vec3_uint32 : vec3<u32>;
+ var vec4_uint32 : vec4<u32>;
var vec3_uint8x2 : vec3<u32>;
var vec4_uint8x2 : vec4<u32>;
var vec3_uint16x2 : vec3<u32>;
var vec4_uint16x2 : vec4<u32>;
- var vec2_uint32 : vec2<u32>;
- var vec3_uint32 : vec3<u32>;
- var vec4_uint32 : vec4<u32>;
var vec3_uint32x2 : vec3<u32>;
var vec4_uint32x2 : vec4<u32>;
var vec4_uint32x3 : vec4<u32>;
{
let buffer_array_base_0 = (tint_pulling_vertex_index * 64u);
+ vec2_uint8 = vec2<u32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> vec4<u32>(0u, 8u, 16u, 24u)[0u]) & 255u), 0);
+ vec3_uint8 = vec3<u32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> vec4<u32>(0u, 8u, 16u, 24u)[0u]) & 255u), 0, 0);
+ vec4_uint8 = vec4<u32>(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> vec4<u32>(0u, 8u, 16u, 24u)[0u]) & 255u), 0, 0, 1);
+ vec2_uint16 = vec2<u32>((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u), 0);
+ vec3_uint16 = vec3<u32>((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u), 0, 0);
+ vec4_uint16 = vec4<u32>((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u), 0, 0, 1);
+ vec2_uint32 = vec2<u32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)], 0);
+ vec3_uint32 = vec3<u32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)], 0, 0);
+ vec4_uint32 = vec4<u32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)], 0, 0, 1);
vec3_uint8x2 = vec3<u32>(((vec2<u32>((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 16u)) << vec2<u32>(8u, 0u)) >> vec2<u32>(24u)), 0);
vec4_uint8x2 = vec4<u32>(((vec2<u32>((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 16u)) << vec2<u32>(8u, 0u)) >> vec2<u32>(24u)), 0, 1);
vec3_uint16x2 = vec3<u32>(((vec2<u32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]) << vec2<u32>(16u, 0u)) >> vec2<u32>(16u)), 0);
vec4_uint16x2 = vec4<u32>(((vec2<u32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]) << vec2<u32>(16u, 0u)) >> vec2<u32>(16u)), 0, 1);
- vec2_uint32 = vec2<u32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)], 0);
- vec3_uint32 = vec3<u32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)], 0, 0);
- vec4_uint32 = vec4<u32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)], 0, 0, 1);
vec3_uint32x2 = vec3<u32>(vec2<u32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)], tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)]), 0);
vec4_uint32x2 = vec4<u32>(vec2<u32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)], tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)]), 0, 1);
vec4_uint32x3 = vec4<u32>(vec3<u32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)], tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)], tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 18u)]), 1);
@@ -1670,16 +1812,22 @@
cfg.vertex_state = {{{256,
VertexStepMode::kVertex,
{
- {VertexFormat::kUint8x2, 64, 0},
- {VertexFormat::kUint8x2, 64, 1},
- {VertexFormat::kUint16x2, 64, 2},
- {VertexFormat::kUint16x2, 64, 3},
- {VertexFormat::kUint32, 64, 4},
- {VertexFormat::kUint32, 64, 5},
+ {VertexFormat::kUint8, 64, 0},
+ {VertexFormat::kUint8, 64, 1},
+ {VertexFormat::kUint8, 64, 2},
+ {VertexFormat::kUint16, 64, 3},
+ {VertexFormat::kUint16, 64, 4},
+ {VertexFormat::kUint16, 64, 5},
{VertexFormat::kUint32, 64, 6},
- {VertexFormat::kUint32x2, 64, 7},
- {VertexFormat::kUint32x2, 64, 8},
- {VertexFormat::kUint32x3, 64, 9},
+ {VertexFormat::kUint32, 64, 7},
+ {VertexFormat::kUint32, 64, 8},
+ {VertexFormat::kUint8x2, 64, 9},
+ {VertexFormat::kUint8x2, 64, 10},
+ {VertexFormat::kUint16x2, 64, 11},
+ {VertexFormat::kUint16x2, 64, 12},
+ {VertexFormat::kUint32x2, 64, 13},
+ {VertexFormat::kUint32x2, 64, 14},
+ {VertexFormat::kUint32x3, 64, 15},
}}}};
DataMap data;
@@ -1693,22 +1841,37 @@
auto* src = R"(
@vertex
fn main(
- @location(0) vec3_unorm8x2 : vec3<f32>,
- @location(1) vec4_unorm8x2 : vec4<f32>,
- @location(2) vec3_snorm8x2 : vec3<f32>,
- @location(3) vec4_snorm8x2 : vec4<f32>,
- @location(4) vec3_unorm16x2 : vec3<f32>,
- @location(5) vec4_unorm16x2 : vec4<f32>,
- @location(6) vec3_snorm16x2 : vec3<f32>,
- @location(7) vec4_snorm16x2 : vec4<f32>,
- @location(8) vec3_float16x2 : vec3<f32>,
- @location(9) vec4_float16x2 : vec4<f32>,
- @location(10) vec2_float32 : vec2<f32>,
- @location(11) vec3_float32 : vec3<f32>,
- @location(12) vec4_float32 : vec4<f32>,
- @location(13) vec3_float32x2 : vec3<f32>,
- @location(14) vec4_float32x2 : vec4<f32>,
- @location(15) vec4_float32x3 : vec4<f32>,
+ @location(0) vec2_unorm8 : vec2<f32>,
+ @location(2) vec3_unorm8 : vec3<f32>,
+ @location(3) vec4_unorm8 : vec4<f32>,
+ @location(4) vec2_snorm8 : vec2<f32>,
+ @location(5) vec3_snorm8 : vec3<f32>,
+ @location(6) vec4_snorm8 : vec4<f32>,
+ @location(7) vec2_unorm16 : vec2<f32>,
+ @location(8) vec3_unorm16 : vec3<f32>,
+ @location(9) vec4_unorm16 : vec4<f32>,
+ @location(10) vec2_snorm16 : vec2<f32>,
+ @location(11) vec3_snorm16 : vec3<f32>,
+ @location(12) vec4_snorm16 : vec4<f32>,
+ @location(13) vec2_float16 : vec2<f32>,
+ @location(14) vec3_float16 : vec3<f32>,
+ @location(15) vec4_float16 : vec4<f32>,
+ @location(16) vec3_unorm8x2 : vec3<f32>,
+ @location(17) vec4_unorm8x2 : vec4<f32>,
+ @location(18) vec3_snorm8x2 : vec3<f32>,
+ @location(19) vec4_snorm8x2 : vec4<f32>,
+ @location(20) vec3_unorm16x2 : vec3<f32>,
+ @location(21) vec4_unorm16x2 : vec4<f32>,
+ @location(22) vec3_snorm16x2 : vec3<f32>,
+ @location(23) vec4_snorm16x2 : vec4<f32>,
+ @location(24) vec3_float16x2 : vec3<f32>,
+ @location(25) vec4_float16x2 : vec4<f32>,
+ @location(26) vec2_float32 : vec2<f32>,
+ @location(27) vec3_float32 : vec3<f32>,
+ @location(28) vec4_float32 : vec4<f32>,
+ @location(29) vec3_float32x2 : vec3<f32>,
+ @location(30) vec4_float32x2 : vec4<f32>,
+ @location(31) vec4_float32x3 : vec4<f32>,
) -> @builtin(position) vec4<f32> {
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
}
@@ -1723,6 +1886,21 @@
@vertex
fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4<f32> {
+ var vec2_unorm8 : vec2<f32>;
+ var vec3_unorm8 : vec3<f32>;
+ var vec4_unorm8 : vec4<f32>;
+ var vec2_snorm8 : vec2<f32>;
+ var vec3_snorm8 : vec3<f32>;
+ var vec4_snorm8 : vec4<f32>;
+ var vec2_unorm16 : vec2<f32>;
+ var vec3_unorm16 : vec3<f32>;
+ var vec4_unorm16 : vec4<f32>;
+ var vec2_snorm16 : vec2<f32>;
+ var vec3_snorm16 : vec3<f32>;
+ var vec4_snorm16 : vec4<f32>;
+ var vec2_float16 : vec2<f32>;
+ var vec3_float16 : vec3<f32>;
+ var vec4_float16 : vec4<f32>;
var vec3_unorm8x2 : vec3<f32>;
var vec4_unorm8x2 : vec4<f32>;
var vec3_snorm8x2 : vec3<f32>;
@@ -1741,6 +1919,21 @@
var vec4_float32x3 : vec4<f32>;
{
let buffer_array_base_0 = (tint_pulling_vertex_index * 64u);
+ vec2_unorm8 = vec2<f32>(unpack4x8unorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> vec4<u32>(0u, 8u, 16u, 24u)[0u]) & 255u)).x, 0.0);
+ vec3_unorm8 = vec3<f32>(unpack4x8unorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> vec4<u32>(0u, 8u, 16u, 24u)[0u]) & 255u)).x, 0.0, 0.0);
+ vec4_unorm8 = vec4<f32>(unpack4x8unorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> vec4<u32>(0u, 8u, 16u, 24u)[0u]) & 255u)).x, 0.0, 0.0, 1.0);
+ vec2_snorm8 = vec2<f32>(unpack4x8snorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> vec4<u32>(0u, 8u, 16u, 24u)[0u]) & 255u)).x, 0.0);
+ vec3_snorm8 = vec3<f32>(unpack4x8snorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> vec4<u32>(0u, 8u, 16u, 24u)[0u]) & 255u)).x, 0.0, 0.0);
+ vec4_snorm8 = vec4<f32>(unpack4x8snorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> vec4<u32>(0u, 8u, 16u, 24u)[0u]) & 255u)).x, 0.0, 0.0, 1.0);
+ vec2_unorm16 = vec2<f32>(unpack2x16unorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).x, 0.0);
+ vec3_unorm16 = vec3<f32>(unpack2x16unorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).x, 0.0, 0.0);
+ vec4_unorm16 = vec4<f32>(unpack2x16unorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).x, 0.0, 0.0, 1.0);
+ vec2_snorm16 = vec2<f32>(unpack2x16snorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).x, 0.0);
+ vec3_snorm16 = vec3<f32>(unpack2x16snorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).x, 0.0, 0.0);
+ vec4_snorm16 = vec4<f32>(unpack2x16snorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).x, 0.0, 0.0, 1.0);
+ vec2_float16 = vec2<f32>(unpack2x16float((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).x, 0.0);
+ vec3_float16 = vec3<f32>(unpack2x16float((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).x, 0.0, 0.0);
+ vec4_float16 = vec4<f32>(unpack2x16float((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).x, 0.0, 0.0, 1.0);
vec3_unorm8x2 = vec3<f32>(unpack4x8unorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).xy, 0.0);
vec4_unorm8x2 = vec4<f32>(unpack4x8unorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).xy, 0.0, 1.0);
vec3_snorm8x2 = vec3<f32>(unpack4x8snorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).xy, 0.0);
@@ -1763,26 +1956,27 @@
)";
VertexPulling::Config cfg;
- cfg.vertex_state = {{{256,
- VertexStepMode::kVertex,
- {
- {VertexFormat::kUnorm8x2, 64, 0},
- {VertexFormat::kUnorm8x2, 64, 1},
- {VertexFormat::kSnorm8x2, 64, 2},
- {VertexFormat::kSnorm8x2, 64, 3},
- {VertexFormat::kUnorm16x2, 64, 4},
- {VertexFormat::kUnorm16x2, 64, 5},
- {VertexFormat::kSnorm16x2, 64, 6},
- {VertexFormat::kSnorm16x2, 64, 7},
- {VertexFormat::kFloat16x2, 64, 8},
- {VertexFormat::kFloat16x2, 64, 9},
- {VertexFormat::kFloat32, 64, 10},
- {VertexFormat::kFloat32, 64, 11},
- {VertexFormat::kFloat32, 64, 12},
- {VertexFormat::kFloat32x2, 64, 13},
- {VertexFormat::kFloat32x2, 64, 14},
- {VertexFormat::kFloat32x3, 64, 15},
- }}}};
+ cfg.vertex_state = {
+ {{256,
+ VertexStepMode::kVertex,
+ {
+ {VertexFormat::kUnorm8, 64, 0}, {VertexFormat::kUnorm8, 64, 2},
+ {VertexFormat::kUnorm8, 64, 3}, {VertexFormat::kSnorm8, 64, 4},
+ {VertexFormat::kSnorm8, 64, 5}, {VertexFormat::kSnorm8, 64, 6},
+ {VertexFormat::kUnorm16, 64, 7}, {VertexFormat::kUnorm16, 64, 8},
+ {VertexFormat::kUnorm16, 64, 9}, {VertexFormat::kSnorm16, 64, 10},
+ {VertexFormat::kSnorm16, 64, 11}, {VertexFormat::kSnorm16, 64, 12},
+ {VertexFormat::kFloat16, 64, 13}, {VertexFormat::kFloat16, 64, 14},
+ {VertexFormat::kFloat16, 64, 15}, {VertexFormat::kUnorm8x2, 64, 16},
+ {VertexFormat::kUnorm8x2, 64, 17}, {VertexFormat::kSnorm8x2, 64, 18},
+ {VertexFormat::kSnorm8x2, 64, 19}, {VertexFormat::kUnorm16x2, 64, 20},
+ {VertexFormat::kUnorm16x2, 64, 21}, {VertexFormat::kSnorm16x2, 64, 22},
+ {VertexFormat::kSnorm16x2, 64, 23}, {VertexFormat::kFloat16x2, 64, 24},
+ {VertexFormat::kFloat16x2, 64, 25}, {VertexFormat::kFloat32, 64, 26},
+ {VertexFormat::kFloat32, 64, 27}, {VertexFormat::kFloat32, 64, 28},
+ {VertexFormat::kFloat32x2, 64, 29}, {VertexFormat::kFloat32x2, 64, 30},
+ {VertexFormat::kFloat32x3, 64, 31},
+ }}}};
DataMap data;
data.Add<VertexPulling::Config>(cfg);
@@ -1797,22 +1991,37 @@
@vertex
fn main(
- @location(0) vec3_unorm8x2 : vec3<f16>,
- @location(1) vec4_unorm8x2 : vec4<f16>,
- @location(2) vec3_snorm8x2 : vec3<f16>,
- @location(3) vec4_snorm8x2 : vec4<f16>,
- @location(4) vec3_unorm16x2 : vec3<f16>,
- @location(5) vec4_unorm16x2 : vec4<f16>,
- @location(6) vec3_snorm16x2 : vec3<f16>,
- @location(7) vec4_snorm16x2 : vec4<f16>,
- @location(8) vec3_float16x2 : vec3<f16>,
- @location(9) vec4_float16x2 : vec4<f16>,
- @location(10) vec2_float32 : vec2<f16>,
- @location(11) vec3_float32 : vec3<f16>,
- @location(12) vec4_float32 : vec4<f16>,
- @location(13) vec3_float32x2 : vec3<f16>,
- @location(14) vec4_float32x2 : vec4<f16>,
- @location(15) vec4_float32x3 : vec4<f16>,
+ @location(0) vec2_unorm8 : vec2<f16>,
+ @location(2) vec3_unorm8 : vec3<f16>,
+ @location(3) vec4_unorm8 : vec4<f16>,
+ @location(4) vec2_snorm8 : vec2<f16>,
+ @location(5) vec3_snorm8 : vec3<f16>,
+ @location(6) vec4_snorm8 : vec4<f16>,
+ @location(7) vec2_unorm16 : vec2<f16>,
+ @location(8) vec3_unorm16 : vec3<f16>,
+ @location(9) vec4_unorm16 : vec4<f16>,
+ @location(10) vec2_snorm16 : vec2<f16>,
+ @location(11) vec3_snorm16 : vec3<f16>,
+ @location(12) vec4_snorm16 : vec4<f16>,
+ @location(13) vec2_float16 : vec2<f16>,
+ @location(14) vec3_float16 : vec3<f16>,
+ @location(15) vec4_float16 : vec4<f16>,
+ @location(16) vec3_unorm8x2 : vec3<f16>,
+ @location(17) vec4_unorm8x2 : vec4<f16>,
+ @location(18) vec3_snorm8x2 : vec3<f16>,
+ @location(19) vec4_snorm8x2 : vec4<f16>,
+ @location(20) vec3_unorm16x2 : vec3<f16>,
+ @location(21) vec4_unorm16x2 : vec4<f16>,
+ @location(22) vec3_snorm16x2 : vec3<f16>,
+ @location(23) vec4_snorm16x2 : vec4<f16>,
+ @location(24) vec3_float16x2 : vec3<f16>,
+ @location(25) vec4_float16x2 : vec4<f16>,
+ @location(26) vec2_float32 : vec2<f16>,
+ @location(27) vec3_float32 : vec3<f16>,
+ @location(28) vec4_float32 : vec4<f16>,
+ @location(29) vec3_float32x2 : vec3<f16>,
+ @location(30) vec4_float32x2 : vec4<f16>,
+ @location(31) vec4_float32x3 : vec4<f16>,
) -> @builtin(position) vec4<f32> {
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
}
@@ -1829,6 +2038,21 @@
@vertex
fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4<f32> {
+ var vec2_unorm8 : vec2<f16>;
+ var vec3_unorm8 : vec3<f16>;
+ var vec4_unorm8 : vec4<f16>;
+ var vec2_snorm8 : vec2<f16>;
+ var vec3_snorm8 : vec3<f16>;
+ var vec4_snorm8 : vec4<f16>;
+ var vec2_unorm16 : vec2<f16>;
+ var vec3_unorm16 : vec3<f16>;
+ var vec4_unorm16 : vec4<f16>;
+ var vec2_snorm16 : vec2<f16>;
+ var vec3_snorm16 : vec3<f16>;
+ var vec4_snorm16 : vec4<f16>;
+ var vec2_float16 : vec2<f16>;
+ var vec3_float16 : vec3<f16>;
+ var vec4_float16 : vec4<f16>;
var vec3_unorm8x2 : vec3<f16>;
var vec4_unorm8x2 : vec4<f16>;
var vec3_snorm8x2 : vec3<f16>;
@@ -1847,6 +2071,21 @@
var vec4_float32x3 : vec4<f16>;
{
let buffer_array_base_0 = (tint_pulling_vertex_index * 64u);
+ vec2_unorm8 = vec2<f16>(f16(unpack4x8unorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> vec4<u32>(0u, 8u, 16u, 24u)[0u]) & 255u)).x), 0.0);
+ vec3_unorm8 = vec3<f16>(f16(unpack4x8unorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> vec4<u32>(0u, 8u, 16u, 24u)[0u]) & 255u)).x), 0.0, 0.0);
+ vec4_unorm8 = vec4<f16>(f16(unpack4x8unorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> vec4<u32>(0u, 8u, 16u, 24u)[0u]) & 255u)).x), 0.0, 0.0, 1.0);
+ vec2_snorm8 = vec2<f16>(f16(unpack4x8snorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> vec4<u32>(0u, 8u, 16u, 24u)[0u]) & 255u)).x), 0.0);
+ vec3_snorm8 = vec3<f16>(f16(unpack4x8snorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> vec4<u32>(0u, 8u, 16u, 24u)[0u]) & 255u)).x), 0.0, 0.0);
+ vec4_snorm8 = vec4<f16>(f16(unpack4x8snorm(((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] >> vec4<u32>(0u, 8u, 16u, 24u)[0u]) & 255u)).x), 0.0, 0.0, 1.0);
+ vec2_unorm16 = vec2<f16>(f16(unpack2x16unorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).x), 0.0);
+ vec3_unorm16 = vec3<f16>(f16(unpack2x16unorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).x), 0.0, 0.0);
+ vec4_unorm16 = vec4<f16>(f16(unpack2x16unorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).x), 0.0, 0.0, 1.0);
+ vec2_snorm16 = vec2<f16>(f16(unpack2x16snorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).x), 0.0);
+ vec3_snorm16 = vec3<f16>(f16(unpack2x16snorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).x), 0.0, 0.0);
+ vec4_snorm16 = vec4<f16>(f16(unpack2x16snorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).x), 0.0, 0.0, 1.0);
+ vec2_float16 = vec2<f16>(f16(unpack2x16float((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).x), 0.0);
+ vec3_float16 = vec3<f16>(f16(unpack2x16float((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).x), 0.0, 0.0);
+ vec4_float16 = vec4<f16>(f16(unpack2x16float((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).x), 0.0, 0.0, 1.0);
vec3_unorm8x2 = vec3<f16>(vec2<f16>(unpack4x8unorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).xy), 0.0);
vec4_unorm8x2 = vec4<f16>(vec2<f16>(unpack4x8unorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).xy), 0.0, 1.0);
vec3_snorm8x2 = vec3<f16>(vec2<f16>(unpack4x8snorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).xy), 0.0);
@@ -1869,26 +2108,27 @@
)";
VertexPulling::Config cfg;
- cfg.vertex_state = {{{256,
- VertexStepMode::kVertex,
- {
- {VertexFormat::kUnorm8x2, 64, 0},
- {VertexFormat::kUnorm8x2, 64, 1},
- {VertexFormat::kSnorm8x2, 64, 2},
- {VertexFormat::kSnorm8x2, 64, 3},
- {VertexFormat::kUnorm16x2, 64, 4},
- {VertexFormat::kUnorm16x2, 64, 5},
- {VertexFormat::kSnorm16x2, 64, 6},
- {VertexFormat::kSnorm16x2, 64, 7},
- {VertexFormat::kFloat16x2, 64, 8},
- {VertexFormat::kFloat16x2, 64, 9},
- {VertexFormat::kFloat32, 64, 10},
- {VertexFormat::kFloat32, 64, 11},
- {VertexFormat::kFloat32, 64, 12},
- {VertexFormat::kFloat32x2, 64, 13},
- {VertexFormat::kFloat32x2, 64, 14},
- {VertexFormat::kFloat32x3, 64, 15},
- }}}};
+ cfg.vertex_state = {
+ {{256,
+ VertexStepMode::kVertex,
+ {
+ {VertexFormat::kUnorm8, 64, 0}, {VertexFormat::kUnorm8, 64, 2},
+ {VertexFormat::kUnorm8, 64, 3}, {VertexFormat::kSnorm8, 64, 4},
+ {VertexFormat::kSnorm8, 64, 5}, {VertexFormat::kSnorm8, 64, 6},
+ {VertexFormat::kUnorm16, 64, 7}, {VertexFormat::kUnorm16, 64, 8},
+ {VertexFormat::kUnorm16, 64, 9}, {VertexFormat::kSnorm16, 64, 10},
+ {VertexFormat::kSnorm16, 64, 11}, {VertexFormat::kSnorm16, 64, 12},
+ {VertexFormat::kFloat16, 64, 13}, {VertexFormat::kFloat16, 64, 14},
+ {VertexFormat::kFloat16, 64, 15}, {VertexFormat::kUnorm8x2, 64, 16},
+ {VertexFormat::kUnorm8x2, 64, 17}, {VertexFormat::kSnorm8x2, 64, 18},
+ {VertexFormat::kSnorm8x2, 64, 19}, {VertexFormat::kUnorm16x2, 64, 20},
+ {VertexFormat::kUnorm16x2, 64, 21}, {VertexFormat::kSnorm16x2, 64, 22},
+ {VertexFormat::kSnorm16x2, 64, 23}, {VertexFormat::kFloat16x2, 64, 24},
+ {VertexFormat::kFloat16x2, 64, 25}, {VertexFormat::kFloat32, 64, 26},
+ {VertexFormat::kFloat32, 64, 27}, {VertexFormat::kFloat32, 64, 28},
+ {VertexFormat::kFloat32x2, 64, 29}, {VertexFormat::kFloat32x2, 64, 30},
+ {VertexFormat::kFloat32x3, 64, 31},
+ }}}};
DataMap data;
data.Add<VertexPulling::Config>(cfg);
@@ -2118,6 +2358,9 @@
@location(26) sclr_unorm10_10_10_2 : f32 ,
@location(27) vec2_unorm10_10_10_2 : vec2<f32>,
@location(28) vec3_unorm10_10_10_2 : vec3<f32>,
+ @location(29) sclr_unorm8x4bgra : f32 ,
+ @location(30) vec2_unorm8x4bgra : vec2<f32>,
+ @location(31) vec3_unorm8x4bgra : vec3<f32>,
) -> @builtin(position) vec4<f32> {
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
}
@@ -2161,6 +2404,9 @@
var sclr_unorm10_10_10_2 : f32;
var vec2_unorm10_10_10_2 : vec2<f32>;
var vec3_unorm10_10_10_2 : vec3<f32>;
+ var sclr_unorm8x4bgra : f32;
+ var vec2_unorm8x4bgra : vec2<f32>;
+ var vec3_unorm8x4bgra : vec3<f32>;
{
let buffer_array_base_0 = (tint_pulling_vertex_index * 64u);
sclr_unorm8x2 = unpack4x8unorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).xy.x;
@@ -2192,6 +2438,9 @@
sclr_unorm10_10_10_2 = ((vec4<f32>(((vec4<u32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]) >> vec4<u32>(0u, 10u, 20u, 30u)) & vec4<u32>(1023u, 1023u, 1023u, 3u))) / vec4<f32>(1023.0f, 1023.0f, 1023.0f, 3.0f))).x;
vec2_unorm10_10_10_2 = ((vec4<f32>(((vec4<u32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]) >> vec4<u32>(0u, 10u, 20u, 30u)) & vec4<u32>(1023u, 1023u, 1023u, 3u))) / vec4<f32>(1023.0f, 1023.0f, 1023.0f, 3.0f))).xy;
vec3_unorm10_10_10_2 = ((vec4<f32>(((vec4<u32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]) >> vec4<u32>(0u, 10u, 20u, 30u)) & vec4<u32>(1023u, 1023u, 1023u, 3u))) / vec4<f32>(1023.0f, 1023.0f, 1023.0f, 3.0f))).xyz;
+ sclr_unorm8x4bgra = unpack4x8unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]).zyxw.x;
+ vec2_unorm8x4bgra = unpack4x8unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]).zyxw.xy;
+ vec3_unorm8x4bgra = unpack4x8unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]).zyxw.xyz;
}
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
}
@@ -2216,7 +2465,8 @@
{VertexFormat::kFloat32x3, 64, 22}, {VertexFormat::kFloat32x4, 64, 23},
{VertexFormat::kFloat32x4, 64, 24}, {VertexFormat::kFloat32x4, 64, 25},
{VertexFormat::kUnorm10_10_10_2, 64, 26}, {VertexFormat::kUnorm10_10_10_2, 64, 27},
- {VertexFormat::kUnorm10_10_10_2, 64, 28},
+ {VertexFormat::kUnorm10_10_10_2, 64, 28}, {VertexFormat::kUnorm8x4BGRA, 64, 29},
+ {VertexFormat::kUnorm8x4BGRA, 64, 30}, {VertexFormat::kUnorm8x4BGRA, 64, 31},
}}}};
DataMap data;
@@ -2258,6 +2508,12 @@
@location(23) sclr_float32x4 : f16 ,
@location(24) vec2_float32x4 : vec2<f16>,
@location(25) vec3_float32x4 : vec3<f16>,
+ @location(26) sclr_unorm10_10_10_2 : f16 ,
+ @location(27) vec2_unorm10_10_10_2 : vec2<f16>,
+ @location(28) vec3_unorm10_10_10_2 : vec3<f16>,
+ @location(29) sclr_unorm8x4bgra : f16 ,
+ @location(30) vec2_unorm8x4bgra : vec2<f16>,
+ @location(31) vec3_unorm8x4bgra : vec3<f16>,
) -> @builtin(position) vec4<f32> {
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
}
@@ -2300,6 +2556,12 @@
var sclr_float32x4 : f16;
var vec2_float32x4 : vec2<f16>;
var vec3_float32x4 : vec3<f16>;
+ var sclr_unorm10_10_10_2 : f16;
+ var vec2_unorm10_10_10_2 : vec2<f16>;
+ var vec3_unorm10_10_10_2 : vec3<f16>;
+ var sclr_unorm8x4bgra : f16;
+ var vec2_unorm8x4bgra : vec2<f16>;
+ var vec3_unorm8x4bgra : vec3<f16>;
{
let buffer_array_base_0 = (tint_pulling_vertex_index * 64u);
sclr_unorm8x2 = vec2<f16>(unpack4x8unorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).xy).x;
@@ -2328,6 +2590,12 @@
sclr_float32x4 = vec4<f16>(vec4<f32>(bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 18u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 19u)]))).x;
vec2_float32x4 = vec4<f16>(vec4<f32>(bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 18u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 19u)]))).xy;
vec3_float32x4 = vec4<f16>(vec4<f32>(bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 18u)]), bitcast<f32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 19u)]))).xyz;
+ sclr_unorm10_10_10_2 = vec4<f16>((vec4<f32>(((vec4<u32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]) >> vec4<u32>(0u, 10u, 20u, 30u)) & vec4<u32>(1023u, 1023u, 1023u, 3u))) / vec4<f32>(1023.0f, 1023.0f, 1023.0f, 3.0f))).x;
+ vec2_unorm10_10_10_2 = vec4<f16>((vec4<f32>(((vec4<u32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]) >> vec4<u32>(0u, 10u, 20u, 30u)) & vec4<u32>(1023u, 1023u, 1023u, 3u))) / vec4<f32>(1023.0f, 1023.0f, 1023.0f, 3.0f))).xy;
+ vec3_unorm10_10_10_2 = vec4<f16>((vec4<f32>(((vec4<u32>(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]) >> vec4<u32>(0u, 10u, 20u, 30u)) & vec4<u32>(1023u, 1023u, 1023u, 3u))) / vec4<f32>(1023.0f, 1023.0f, 1023.0f, 3.0f))).xyz;
+ sclr_unorm8x4bgra = vec4<f16>(unpack4x8unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]).zyxw).x;
+ vec2_unorm8x4bgra = vec4<f16>(unpack4x8unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]).zyxw).xy;
+ vec3_unorm8x4bgra = vec4<f16>(unpack4x8unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]).zyxw).xyz;
}
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
}
@@ -2338,19 +2606,22 @@
{{256,
VertexStepMode::kVertex,
{
- {VertexFormat::kUnorm8x2, 64, 0}, {VertexFormat::kUnorm8x4, 64, 1},
- {VertexFormat::kUnorm8x4, 64, 2}, {VertexFormat::kUnorm8x4, 64, 3},
- {VertexFormat::kSnorm8x2, 64, 4}, {VertexFormat::kSnorm8x4, 64, 5},
- {VertexFormat::kSnorm8x4, 64, 6}, {VertexFormat::kSnorm8x4, 64, 7},
- {VertexFormat::kUnorm16x2, 64, 8}, {VertexFormat::kUnorm16x4, 64, 9},
- {VertexFormat::kUnorm16x4, 64, 10}, {VertexFormat::kUnorm16x4, 64, 11},
- {VertexFormat::kSnorm16x2, 64, 12}, {VertexFormat::kSnorm16x4, 64, 13},
- {VertexFormat::kSnorm16x4, 64, 14}, {VertexFormat::kSnorm16x4, 64, 15},
- {VertexFormat::kFloat16x2, 64, 16}, {VertexFormat::kFloat16x4, 64, 17},
- {VertexFormat::kFloat16x4, 64, 18}, {VertexFormat::kFloat16x4, 64, 19},
- {VertexFormat::kFloat32x2, 64, 20}, {VertexFormat::kFloat32x3, 64, 21},
- {VertexFormat::kFloat32x3, 64, 22}, {VertexFormat::kFloat32x4, 64, 23},
- {VertexFormat::kFloat32x4, 64, 24}, {VertexFormat::kFloat32x4, 64, 25},
+ {VertexFormat::kUnorm8x2, 64, 0}, {VertexFormat::kUnorm8x4, 64, 1},
+ {VertexFormat::kUnorm8x4, 64, 2}, {VertexFormat::kUnorm8x4, 64, 3},
+ {VertexFormat::kSnorm8x2, 64, 4}, {VertexFormat::kSnorm8x4, 64, 5},
+ {VertexFormat::kSnorm8x4, 64, 6}, {VertexFormat::kSnorm8x4, 64, 7},
+ {VertexFormat::kUnorm16x2, 64, 8}, {VertexFormat::kUnorm16x4, 64, 9},
+ {VertexFormat::kUnorm16x4, 64, 10}, {VertexFormat::kUnorm16x4, 64, 11},
+ {VertexFormat::kSnorm16x2, 64, 12}, {VertexFormat::kSnorm16x4, 64, 13},
+ {VertexFormat::kSnorm16x4, 64, 14}, {VertexFormat::kSnorm16x4, 64, 15},
+ {VertexFormat::kFloat16x2, 64, 16}, {VertexFormat::kFloat16x4, 64, 17},
+ {VertexFormat::kFloat16x4, 64, 18}, {VertexFormat::kFloat16x4, 64, 19},
+ {VertexFormat::kFloat32x2, 64, 20}, {VertexFormat::kFloat32x3, 64, 21},
+ {VertexFormat::kFloat32x3, 64, 22}, {VertexFormat::kFloat32x4, 64, 23},
+ {VertexFormat::kFloat32x4, 64, 24}, {VertexFormat::kFloat32x4, 64, 25},
+ {VertexFormat::kUnorm10_10_10_2, 64, 26}, {VertexFormat::kUnorm10_10_10_2, 64, 27},
+ {VertexFormat::kUnorm10_10_10_2, 64, 28}, {VertexFormat::kUnorm8x4BGRA, 64, 29},
+ {VertexFormat::kUnorm8x4BGRA, 64, 30}, {VertexFormat::kUnorm8x4BGRA, 64, 31},
}}}};
DataMap data;