Match vertex format in dawn with webgpu
BUG=dawn:41 Change-Id: If16e615ccf6b9c7e85d41adcdb6d66baa07179da Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5280 Commit-Queue: Shaobo Yan <shaobo.yan@intel.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
54e4d47db4
commit
e105f962cf
42
dawn.json
42
dawn.json
|
@ -1094,18 +1094,36 @@
|
|||
"vertex format": {
|
||||
"category": "enum",
|
||||
"values": [
|
||||
{"value": 0, "name": "float r32 g32 b32 a32"},
|
||||
{"value": 1, "name": "float r32 g32 b32"},
|
||||
{"value": 2, "name": "float r32 g32"},
|
||||
{"value": 3, "name": "float r32"},
|
||||
{"value": 4, "name": "int r32 g32 b32 a32"},
|
||||
{"value": 5, "name": "int r32 g32 b32"},
|
||||
{"value": 6, "name": "int r32 g32"},
|
||||
{"value": 7, "name": "int r32"},
|
||||
{"value": 8, "name": "ushort r16 g16 b16 a16"},
|
||||
{"value": 9, "name": "ushort r16 g16"},
|
||||
{"value": 10, "name": "unorm r8 g8 b8 a8"},
|
||||
{"value": 11, "name": "unorm r8 g8"}
|
||||
{"value": 0, "name": "uChar2"},
|
||||
{"value": 1, "name": "uChar4"},
|
||||
{"value": 2, "name": "char2"},
|
||||
{"value": 3, "name": "char4"},
|
||||
{"value": 4, "name": "uChar2 norm"},
|
||||
{"value": 5, "name": "uChar4 norm"},
|
||||
{"value": 6, "name": "char2 norm"},
|
||||
{"value": 7, "name": "char4 norm"},
|
||||
{"value": 8, "name": "uShort2"},
|
||||
{"value": 9, "name": "uShort4"},
|
||||
{"value": 10, "name": "short2"},
|
||||
{"value": 11, "name": "short4"},
|
||||
{"value": 12, "name": "uShort2 norm"},
|
||||
{"value": 13, "name": "uShort4 norm"},
|
||||
{"value": 14, "name": "short2 norm"},
|
||||
{"value": 15, "name": "short4 norm"},
|
||||
{"value": 16, "name": "half2"},
|
||||
{"value": 17, "name": "half4"},
|
||||
{"value": 18, "name": "float"},
|
||||
{"value": 19, "name": "float2"},
|
||||
{"value": 20, "name": "float3"},
|
||||
{"value": 21, "name": "float4"},
|
||||
{"value": 22, "name": "uInt"},
|
||||
{"value": 23, "name": "uInt2"},
|
||||
{"value": 24, "name": "uInt3"},
|
||||
{"value": 25, "name": "uInt4"},
|
||||
{"value": 26, "name": "int"},
|
||||
{"value": 27, "name": "int2"},
|
||||
{"value": 28, "name": "int3"},
|
||||
{"value": 29, "name": "int4"}
|
||||
]
|
||||
},
|
||||
"ObjectType": {
|
||||
|
|
|
@ -118,13 +118,13 @@ void initRender() {
|
|||
attribute1.shaderLocation = 0;
|
||||
attribute1.inputSlot = 0;
|
||||
attribute1.offset = offsetof(Particle, pos);
|
||||
attribute1.format = dawn::VertexFormat::FloatR32G32;
|
||||
attribute1.format = dawn::VertexFormat::Float2;
|
||||
|
||||
dawn::VertexAttributeDescriptor attribute2;
|
||||
attribute2.shaderLocation = 1;
|
||||
attribute2.inputSlot = 0;
|
||||
attribute2.offset = offsetof(Particle, vel);
|
||||
attribute2.format = dawn::VertexFormat::FloatR32G32;
|
||||
attribute2.format = dawn::VertexFormat::Float2;
|
||||
|
||||
dawn::VertexInputDescriptor input1;
|
||||
input1.inputSlot = 0;
|
||||
|
@ -135,7 +135,7 @@ void initRender() {
|
|||
attribute3.shaderLocation = 2;
|
||||
attribute3.inputSlot = 1;
|
||||
attribute3.offset = 0;
|
||||
attribute3.format = dawn::VertexFormat::FloatR32G32;
|
||||
attribute3.format = dawn::VertexFormat::Float2;
|
||||
|
||||
dawn::VertexInputDescriptor input2;
|
||||
input2.inputSlot = 1;
|
||||
|
|
|
@ -115,7 +115,7 @@ void init() {
|
|||
attribute.shaderLocation = 0;
|
||||
attribute.inputSlot = 0;
|
||||
attribute.offset = 0;
|
||||
attribute.format = dawn::VertexFormat::FloatR32G32B32A32;
|
||||
attribute.format = dawn::VertexFormat::Float4;
|
||||
|
||||
dawn::VertexInputDescriptor input;
|
||||
input.inputSlot = 0;
|
||||
|
|
|
@ -160,13 +160,13 @@ void init() {
|
|||
attribute1.shaderLocation = 0;
|
||||
attribute1.inputSlot = 0;
|
||||
attribute1.offset = 0;
|
||||
attribute1.format = dawn::VertexFormat::FloatR32G32B32;
|
||||
attribute1.format = dawn::VertexFormat::Float3;
|
||||
|
||||
dawn::VertexAttributeDescriptor attribute2;
|
||||
attribute2.shaderLocation = 1;
|
||||
attribute2.inputSlot = 0;
|
||||
attribute2.offset = 3 * sizeof(float);
|
||||
attribute2.format = dawn::VertexFormat::FloatR32G32B32;
|
||||
attribute2.format = dawn::VertexFormat::Float3;
|
||||
|
||||
dawn::VertexInputDescriptor input;
|
||||
input.inputSlot = 0;
|
||||
|
|
|
@ -107,13 +107,13 @@ namespace {
|
|||
bool techniqueParameterTypeToVertexFormat(int type, dawn::VertexFormat *format) {
|
||||
switch (type) {
|
||||
case gl::FloatVec2:
|
||||
*format = dawn::VertexFormat::FloatR32G32;
|
||||
*format = dawn::VertexFormat::Float2;
|
||||
return true;
|
||||
case gl::FloatVec3:
|
||||
*format = dawn::VertexFormat::FloatR32G32B32;
|
||||
*format = dawn::VertexFormat::Float3;
|
||||
return true;
|
||||
case gl::FloatVec4:
|
||||
*format = dawn::VertexFormat::FloatR32G32B32A32;
|
||||
*format = dawn::VertexFormat::Float4;
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
@ -290,7 +290,7 @@ namespace {
|
|||
attribute.offset = 0;
|
||||
attribute.shaderLocation = i;
|
||||
attribute.inputSlot = i;
|
||||
attribute.format = dawn::VertexFormat::FloatR32G32B32A32;
|
||||
attribute.format = dawn::VertexFormat::Float4;
|
||||
|
||||
dawn::VertexInputDescriptor input;
|
||||
input.inputSlot = i;
|
||||
|
|
|
@ -33,23 +33,42 @@ namespace dawn_native {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO(shaobo.yan@intel.com): Add end2end test to cover all the formats.
|
||||
uint32_t VertexFormatNumComponents(dawn::VertexFormat format) {
|
||||
switch (format) {
|
||||
case dawn::VertexFormat::FloatR32G32B32A32:
|
||||
case dawn::VertexFormat::IntR32G32B32A32:
|
||||
case dawn::VertexFormat::UshortR16G16B16A16:
|
||||
case dawn::VertexFormat::UnormR8G8B8A8:
|
||||
case dawn::VertexFormat::UChar4:
|
||||
case dawn::VertexFormat::Char4:
|
||||
case dawn::VertexFormat::UChar4Norm:
|
||||
case dawn::VertexFormat::Char4Norm:
|
||||
case dawn::VertexFormat::UShort4:
|
||||
case dawn::VertexFormat::Short4:
|
||||
case dawn::VertexFormat::UShort4Norm:
|
||||
case dawn::VertexFormat::Short4Norm:
|
||||
case dawn::VertexFormat::Half4:
|
||||
case dawn::VertexFormat::Float4:
|
||||
case dawn::VertexFormat::UInt4:
|
||||
case dawn::VertexFormat::Int4:
|
||||
return 4;
|
||||
case dawn::VertexFormat::FloatR32G32B32:
|
||||
case dawn::VertexFormat::IntR32G32B32:
|
||||
case dawn::VertexFormat::Float3:
|
||||
case dawn::VertexFormat::UInt3:
|
||||
case dawn::VertexFormat::Int3:
|
||||
return 3;
|
||||
case dawn::VertexFormat::FloatR32G32:
|
||||
case dawn::VertexFormat::IntR32G32:
|
||||
case dawn::VertexFormat::UshortR16G16:
|
||||
case dawn::VertexFormat::UnormR8G8:
|
||||
case dawn::VertexFormat::UChar2:
|
||||
case dawn::VertexFormat::Char2:
|
||||
case dawn::VertexFormat::UChar2Norm:
|
||||
case dawn::VertexFormat::Char2Norm:
|
||||
case dawn::VertexFormat::UShort2:
|
||||
case dawn::VertexFormat::Short2:
|
||||
case dawn::VertexFormat::UShort2Norm:
|
||||
case dawn::VertexFormat::Short2Norm:
|
||||
case dawn::VertexFormat::Half2:
|
||||
case dawn::VertexFormat::Float2:
|
||||
case dawn::VertexFormat::UInt2:
|
||||
case dawn::VertexFormat::Int2:
|
||||
return 2;
|
||||
case dawn::VertexFormat::FloatR32:
|
||||
case dawn::VertexFormat::IntR32:
|
||||
case dawn::VertexFormat::Float:
|
||||
case dawn::VertexFormat::UInt:
|
||||
case dawn::VertexFormat::Int:
|
||||
return 1;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
|
@ -58,22 +77,40 @@ namespace dawn_native {
|
|||
|
||||
size_t VertexFormatComponentSize(dawn::VertexFormat format) {
|
||||
switch (format) {
|
||||
case dawn::VertexFormat::FloatR32G32B32A32:
|
||||
case dawn::VertexFormat::FloatR32G32B32:
|
||||
case dawn::VertexFormat::FloatR32G32:
|
||||
case dawn::VertexFormat::FloatR32:
|
||||
return sizeof(float);
|
||||
case dawn::VertexFormat::IntR32G32B32A32:
|
||||
case dawn::VertexFormat::IntR32G32B32:
|
||||
case dawn::VertexFormat::IntR32G32:
|
||||
case dawn::VertexFormat::IntR32:
|
||||
return sizeof(int32_t);
|
||||
case dawn::VertexFormat::UshortR16G16B16A16:
|
||||
case dawn::VertexFormat::UshortR16G16:
|
||||
case dawn::VertexFormat::UChar2:
|
||||
case dawn::VertexFormat::UChar4:
|
||||
case dawn::VertexFormat::Char2:
|
||||
case dawn::VertexFormat::Char4:
|
||||
case dawn::VertexFormat::UChar2Norm:
|
||||
case dawn::VertexFormat::UChar4Norm:
|
||||
case dawn::VertexFormat::Char2Norm:
|
||||
case dawn::VertexFormat::Char4Norm:
|
||||
return sizeof(char);
|
||||
case dawn::VertexFormat::UShort2:
|
||||
case dawn::VertexFormat::UShort4:
|
||||
case dawn::VertexFormat::UShort2Norm:
|
||||
case dawn::VertexFormat::UShort4Norm:
|
||||
case dawn::VertexFormat::Short2:
|
||||
case dawn::VertexFormat::Short4:
|
||||
case dawn::VertexFormat::Short2Norm:
|
||||
case dawn::VertexFormat::Short4Norm:
|
||||
case dawn::VertexFormat::Half2:
|
||||
case dawn::VertexFormat::Half4:
|
||||
return sizeof(uint16_t);
|
||||
case dawn::VertexFormat::UnormR8G8B8A8:
|
||||
case dawn::VertexFormat::UnormR8G8:
|
||||
return sizeof(uint8_t);
|
||||
case dawn::VertexFormat::Float:
|
||||
case dawn::VertexFormat::Float2:
|
||||
case dawn::VertexFormat::Float3:
|
||||
case dawn::VertexFormat::Float4:
|
||||
return sizeof(float);
|
||||
case dawn::VertexFormat::UInt:
|
||||
case dawn::VertexFormat::UInt2:
|
||||
case dawn::VertexFormat::UInt3:
|
||||
case dawn::VertexFormat::UInt4:
|
||||
case dawn::VertexFormat::Int:
|
||||
case dawn::VertexFormat::Int2:
|
||||
case dawn::VertexFormat::Int3:
|
||||
case dawn::VertexFormat::Int4:
|
||||
return sizeof(int32_t);
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
|
|
@ -20,30 +20,66 @@ namespace dawn_native { namespace d3d12 {
|
|||
|
||||
static DXGI_FORMAT VertexFormatType(dawn::VertexFormat format) {
|
||||
switch (format) {
|
||||
case dawn::VertexFormat::FloatR32G32B32A32:
|
||||
return DXGI_FORMAT_R32G32B32A32_FLOAT;
|
||||
case dawn::VertexFormat::FloatR32G32B32:
|
||||
return DXGI_FORMAT_R32G32B32_FLOAT;
|
||||
case dawn::VertexFormat::FloatR32G32:
|
||||
return DXGI_FORMAT_R32G32_FLOAT;
|
||||
case dawn::VertexFormat::FloatR32:
|
||||
return DXGI_FORMAT_R32_FLOAT;
|
||||
case dawn::VertexFormat::IntR32G32B32A32:
|
||||
return DXGI_FORMAT_R32G32B32A32_SINT;
|
||||
case dawn::VertexFormat::IntR32G32B32:
|
||||
return DXGI_FORMAT_R32G32B32_SINT;
|
||||
case dawn::VertexFormat::IntR32G32:
|
||||
return DXGI_FORMAT_R32G32_SINT;
|
||||
case dawn::VertexFormat::IntR32:
|
||||
return DXGI_FORMAT_R32_SINT;
|
||||
case dawn::VertexFormat::UshortR16G16B16A16:
|
||||
return DXGI_FORMAT_R16G16B16A16_UINT;
|
||||
case dawn::VertexFormat::UshortR16G16:
|
||||
return DXGI_FORMAT_R16G16_UINT;
|
||||
case dawn::VertexFormat::UnormR8G8B8A8:
|
||||
return DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
case dawn::VertexFormat::UnormR8G8:
|
||||
case dawn::VertexFormat::UChar2:
|
||||
return DXGI_FORMAT_R8G8_UINT;
|
||||
case dawn::VertexFormat::UChar4:
|
||||
return DXGI_FORMAT_R8G8B8A8_UINT;
|
||||
case dawn::VertexFormat::Char2:
|
||||
return DXGI_FORMAT_R8G8_SINT;
|
||||
case dawn::VertexFormat::Char4:
|
||||
return DXGI_FORMAT_R8G8B8A8_SINT;
|
||||
case dawn::VertexFormat::UChar2Norm:
|
||||
return DXGI_FORMAT_R8G8_UNORM;
|
||||
case dawn::VertexFormat::UChar4Norm:
|
||||
return DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
case dawn::VertexFormat::Char2Norm:
|
||||
return DXGI_FORMAT_R8G8_SNORM;
|
||||
case dawn::VertexFormat::Char4Norm:
|
||||
return DXGI_FORMAT_R8G8B8A8_SNORM;
|
||||
case dawn::VertexFormat::UShort2:
|
||||
return DXGI_FORMAT_R16G16_UINT;
|
||||
case dawn::VertexFormat::UShort4:
|
||||
return DXGI_FORMAT_R16G16B16A16_UINT;
|
||||
case dawn::VertexFormat::Short2:
|
||||
return DXGI_FORMAT_R16G16_SINT;
|
||||
case dawn::VertexFormat::Short4:
|
||||
return DXGI_FORMAT_R16G16B16A16_SINT;
|
||||
case dawn::VertexFormat::UShort2Norm:
|
||||
return DXGI_FORMAT_R16G16_UNORM;
|
||||
case dawn::VertexFormat::UShort4Norm:
|
||||
return DXGI_FORMAT_R16G16B16A16_UNORM;
|
||||
case dawn::VertexFormat::Short2Norm:
|
||||
return DXGI_FORMAT_R16G16_SNORM;
|
||||
case dawn::VertexFormat::Short4Norm:
|
||||
return DXGI_FORMAT_R16G16B16A16_SNORM;
|
||||
case dawn::VertexFormat::Half2:
|
||||
return DXGI_FORMAT_R16G16_FLOAT;
|
||||
case dawn::VertexFormat::Half4:
|
||||
return DXGI_FORMAT_R16G16B16A16_FLOAT;
|
||||
case dawn::VertexFormat::Float:
|
||||
return DXGI_FORMAT_R32_FLOAT;
|
||||
case dawn::VertexFormat::Float2:
|
||||
return DXGI_FORMAT_R32G32_FLOAT;
|
||||
case dawn::VertexFormat::Float3:
|
||||
return DXGI_FORMAT_R32G32B32_FLOAT;
|
||||
case dawn::VertexFormat::Float4:
|
||||
return DXGI_FORMAT_R32G32B32A32_FLOAT;
|
||||
case dawn::VertexFormat::UInt:
|
||||
return DXGI_FORMAT_R32_UINT;
|
||||
case dawn::VertexFormat::UInt2:
|
||||
return DXGI_FORMAT_R32G32_UINT;
|
||||
case dawn::VertexFormat::UInt3:
|
||||
return DXGI_FORMAT_R32G32B32_UINT;
|
||||
case dawn::VertexFormat::UInt4:
|
||||
return DXGI_FORMAT_R32G32B32A32_UINT;
|
||||
case dawn::VertexFormat::Int:
|
||||
return DXGI_FORMAT_R32_SINT;
|
||||
case dawn::VertexFormat::Int2:
|
||||
return DXGI_FORMAT_R32G32_SINT;
|
||||
case dawn::VertexFormat::Int3:
|
||||
return DXGI_FORMAT_R32G32B32_SINT;
|
||||
case dawn::VertexFormat::Int4:
|
||||
return DXGI_FORMAT_R32G32B32A32_SINT;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
|
|
@ -21,30 +21,66 @@ namespace dawn_native { namespace metal {
|
|||
namespace {
|
||||
MTLVertexFormat VertexFormatType(dawn::VertexFormat format) {
|
||||
switch (format) {
|
||||
case dawn::VertexFormat::FloatR32G32B32A32:
|
||||
return MTLVertexFormatFloat4;
|
||||
case dawn::VertexFormat::FloatR32G32B32:
|
||||
return MTLVertexFormatFloat3;
|
||||
case dawn::VertexFormat::FloatR32G32:
|
||||
return MTLVertexFormatFloat2;
|
||||
case dawn::VertexFormat::FloatR32:
|
||||
return MTLVertexFormatFloat;
|
||||
case dawn::VertexFormat::IntR32G32B32A32:
|
||||
return MTLVertexFormatInt4;
|
||||
case dawn::VertexFormat::IntR32G32B32:
|
||||
return MTLVertexFormatInt3;
|
||||
case dawn::VertexFormat::IntR32G32:
|
||||
return MTLVertexFormatInt2;
|
||||
case dawn::VertexFormat::IntR32:
|
||||
return MTLVertexFormatInt;
|
||||
case dawn::VertexFormat::UshortR16G16B16A16:
|
||||
return MTLVertexFormatUShort4;
|
||||
case dawn::VertexFormat::UshortR16G16:
|
||||
return MTLVertexFormatUShort2;
|
||||
case dawn::VertexFormat::UnormR8G8B8A8:
|
||||
return MTLVertexFormatUChar4Normalized;
|
||||
case dawn::VertexFormat::UnormR8G8:
|
||||
case dawn::VertexFormat::UChar2:
|
||||
return MTLVertexFormatUChar2;
|
||||
case dawn::VertexFormat::UChar4:
|
||||
return MTLVertexFormatUChar4;
|
||||
case dawn::VertexFormat::Char2:
|
||||
return MTLVertexFormatChar2;
|
||||
case dawn::VertexFormat::Char4:
|
||||
return MTLVertexFormatChar4;
|
||||
case dawn::VertexFormat::UChar2Norm:
|
||||
return MTLVertexFormatUChar2Normalized;
|
||||
case dawn::VertexFormat::UChar4Norm:
|
||||
return MTLVertexFormatUChar4Normalized;
|
||||
case dawn::VertexFormat::Char2Norm:
|
||||
return MTLVertexFormatChar2Normalized;
|
||||
case dawn::VertexFormat::Char4Norm:
|
||||
return MTLVertexFormatChar4Normalized;
|
||||
case dawn::VertexFormat::UShort2:
|
||||
return MTLVertexFormatUShort2;
|
||||
case dawn::VertexFormat::UShort4:
|
||||
return MTLVertexFormatUShort4;
|
||||
case dawn::VertexFormat::Short2:
|
||||
return MTLVertexFormatShort2;
|
||||
case dawn::VertexFormat::Short4:
|
||||
return MTLVertexFormatShort4;
|
||||
case dawn::VertexFormat::UShort2Norm:
|
||||
return MTLVertexFormatUShort2Normalized;
|
||||
case dawn::VertexFormat::UShort4Norm:
|
||||
return MTLVertexFormatUShort4Normalized;
|
||||
case dawn::VertexFormat::Short2Norm:
|
||||
return MTLVertexFormatShort2Normalized;
|
||||
case dawn::VertexFormat::Short4Norm:
|
||||
return MTLVertexFormatShort4Normalized;
|
||||
case dawn::VertexFormat::Half2:
|
||||
return MTLVertexFormatHalf2;
|
||||
case dawn::VertexFormat::Half4:
|
||||
return MTLVertexFormatHalf4;
|
||||
case dawn::VertexFormat::Float:
|
||||
return MTLVertexFormatFloat;
|
||||
case dawn::VertexFormat::Float2:
|
||||
return MTLVertexFormatFloat2;
|
||||
case dawn::VertexFormat::Float3:
|
||||
return MTLVertexFormatFloat3;
|
||||
case dawn::VertexFormat::Float4:
|
||||
return MTLVertexFormatFloat4;
|
||||
case dawn::VertexFormat::UInt:
|
||||
return MTLVertexFormatUInt;
|
||||
case dawn::VertexFormat::UInt2:
|
||||
return MTLVertexFormatUInt2;
|
||||
case dawn::VertexFormat::UInt3:
|
||||
return MTLVertexFormatUInt3;
|
||||
case dawn::VertexFormat::UInt4:
|
||||
return MTLVertexFormatUInt4;
|
||||
case dawn::VertexFormat::Int:
|
||||
return MTLVertexFormatInt;
|
||||
case dawn::VertexFormat::Int2:
|
||||
return MTLVertexFormatInt2;
|
||||
case dawn::VertexFormat::Int3:
|
||||
return MTLVertexFormatInt3;
|
||||
case dawn::VertexFormat::Int4:
|
||||
return MTLVertexFormatInt4;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,22 +47,44 @@ namespace dawn_native { namespace opengl {
|
|||
|
||||
GLenum VertexFormatType(dawn::VertexFormat format) {
|
||||
switch (format) {
|
||||
case dawn::VertexFormat::FloatR32G32B32A32:
|
||||
case dawn::VertexFormat::FloatR32G32B32:
|
||||
case dawn::VertexFormat::FloatR32G32:
|
||||
case dawn::VertexFormat::FloatR32:
|
||||
return GL_FLOAT;
|
||||
case dawn::VertexFormat::IntR32G32B32A32:
|
||||
case dawn::VertexFormat::IntR32G32B32:
|
||||
case dawn::VertexFormat::IntR32G32:
|
||||
case dawn::VertexFormat::IntR32:
|
||||
return GL_INT;
|
||||
case dawn::VertexFormat::UshortR16G16B16A16:
|
||||
case dawn::VertexFormat::UshortR16G16:
|
||||
return GL_UNSIGNED_SHORT;
|
||||
case dawn::VertexFormat::UnormR8G8B8A8:
|
||||
case dawn::VertexFormat::UnormR8G8:
|
||||
case dawn::VertexFormat::UChar2:
|
||||
case dawn::VertexFormat::UChar4:
|
||||
case dawn::VertexFormat::UChar2Norm:
|
||||
case dawn::VertexFormat::UChar4Norm:
|
||||
return GL_UNSIGNED_BYTE;
|
||||
case dawn::VertexFormat::Char2:
|
||||
case dawn::VertexFormat::Char4:
|
||||
case dawn::VertexFormat::Char2Norm:
|
||||
case dawn::VertexFormat::Char4Norm:
|
||||
return GL_BYTE;
|
||||
case dawn::VertexFormat::UShort2:
|
||||
case dawn::VertexFormat::UShort4:
|
||||
case dawn::VertexFormat::UShort2Norm:
|
||||
case dawn::VertexFormat::UShort4Norm:
|
||||
return GL_UNSIGNED_SHORT;
|
||||
case dawn::VertexFormat::Short2:
|
||||
case dawn::VertexFormat::Short4:
|
||||
case dawn::VertexFormat::Short2Norm:
|
||||
case dawn::VertexFormat::Short4Norm:
|
||||
return GL_SHORT;
|
||||
case dawn::VertexFormat::Half2:
|
||||
case dawn::VertexFormat::Half4:
|
||||
return GL_HALF_FLOAT;
|
||||
case dawn::VertexFormat::Float:
|
||||
case dawn::VertexFormat::Float2:
|
||||
case dawn::VertexFormat::Float3:
|
||||
case dawn::VertexFormat::Float4:
|
||||
return GL_FLOAT;
|
||||
case dawn::VertexFormat::UInt:
|
||||
case dawn::VertexFormat::UInt2:
|
||||
case dawn::VertexFormat::UInt3:
|
||||
case dawn::VertexFormat::UInt4:
|
||||
return GL_UNSIGNED_INT;
|
||||
case dawn::VertexFormat::Int:
|
||||
case dawn::VertexFormat::Int2:
|
||||
case dawn::VertexFormat::Int3:
|
||||
case dawn::VertexFormat::Int4:
|
||||
return GL_INT;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
@ -70,8 +92,14 @@ namespace dawn_native { namespace opengl {
|
|||
|
||||
GLboolean VertexFormatIsNormalized(dawn::VertexFormat format) {
|
||||
switch (format) {
|
||||
case dawn::VertexFormat::UnormR8G8B8A8:
|
||||
case dawn::VertexFormat::UnormR8G8:
|
||||
case dawn::VertexFormat::UChar2Norm:
|
||||
case dawn::VertexFormat::UChar4Norm:
|
||||
case dawn::VertexFormat::Char2Norm:
|
||||
case dawn::VertexFormat::Char4Norm:
|
||||
case dawn::VertexFormat::UShort2Norm:
|
||||
case dawn::VertexFormat::UShort4Norm:
|
||||
case dawn::VertexFormat::Short2Norm:
|
||||
case dawn::VertexFormat::Short4Norm:
|
||||
return GL_TRUE;
|
||||
default:
|
||||
return GL_FALSE;
|
||||
|
|
|
@ -33,30 +33,66 @@ namespace dawn_native { namespace vulkan {
|
|||
|
||||
VkFormat VulkanVertexFormat(dawn::VertexFormat format) {
|
||||
switch (format) {
|
||||
case dawn::VertexFormat::FloatR32G32B32A32:
|
||||
return VK_FORMAT_R32G32B32A32_SFLOAT;
|
||||
case dawn::VertexFormat::FloatR32G32B32:
|
||||
return VK_FORMAT_R32G32B32_SFLOAT;
|
||||
case dawn::VertexFormat::FloatR32G32:
|
||||
return VK_FORMAT_R32G32_SFLOAT;
|
||||
case dawn::VertexFormat::FloatR32:
|
||||
return VK_FORMAT_R32_SFLOAT;
|
||||
case dawn::VertexFormat::IntR32G32B32A32:
|
||||
return VK_FORMAT_R32G32B32A32_SINT;
|
||||
case dawn::VertexFormat::IntR32G32B32:
|
||||
return VK_FORMAT_R32G32B32_SINT;
|
||||
case dawn::VertexFormat::IntR32G32:
|
||||
return VK_FORMAT_R32G32_SINT;
|
||||
case dawn::VertexFormat::IntR32:
|
||||
return VK_FORMAT_R32_SINT;
|
||||
case dawn::VertexFormat::UshortR16G16B16A16:
|
||||
return VK_FORMAT_R16G16B16A16_UINT;
|
||||
case dawn::VertexFormat::UshortR16G16:
|
||||
return VK_FORMAT_R16G16_UINT;
|
||||
case dawn::VertexFormat::UnormR8G8B8A8:
|
||||
return VK_FORMAT_R8G8B8A8_UNORM;
|
||||
case dawn::VertexFormat::UnormR8G8:
|
||||
case dawn::VertexFormat::UChar2:
|
||||
return VK_FORMAT_R8G8_UINT;
|
||||
case dawn::VertexFormat::UChar4:
|
||||
return VK_FORMAT_R8G8B8A8_UINT;
|
||||
case dawn::VertexFormat::Char2:
|
||||
return VK_FORMAT_R8G8_SINT;
|
||||
case dawn::VertexFormat::Char4:
|
||||
return VK_FORMAT_R8G8B8A8_SINT;
|
||||
case dawn::VertexFormat::UChar2Norm:
|
||||
return VK_FORMAT_R8G8_UNORM;
|
||||
case dawn::VertexFormat::UChar4Norm:
|
||||
return VK_FORMAT_R8G8B8A8_UNORM;
|
||||
case dawn::VertexFormat::Char2Norm:
|
||||
return VK_FORMAT_R8G8_SNORM;
|
||||
case dawn::VertexFormat::Char4Norm:
|
||||
return VK_FORMAT_R8G8B8A8_SNORM;
|
||||
case dawn::VertexFormat::UShort2:
|
||||
return VK_FORMAT_R16G16_UINT;
|
||||
case dawn::VertexFormat::UShort4:
|
||||
return VK_FORMAT_R16G16B16A16_UINT;
|
||||
case dawn::VertexFormat::Short2:
|
||||
return VK_FORMAT_R16G16_SINT;
|
||||
case dawn::VertexFormat::Short4:
|
||||
return VK_FORMAT_R16G16B16A16_SINT;
|
||||
case dawn::VertexFormat::UShort2Norm:
|
||||
return VK_FORMAT_R16G16_UNORM;
|
||||
case dawn::VertexFormat::UShort4Norm:
|
||||
return VK_FORMAT_R16G16B16A16_UNORM;
|
||||
case dawn::VertexFormat::Short2Norm:
|
||||
return VK_FORMAT_R16G16_SNORM;
|
||||
case dawn::VertexFormat::Short4Norm:
|
||||
return VK_FORMAT_R16G16B16A16_SNORM;
|
||||
case dawn::VertexFormat::Half2:
|
||||
return VK_FORMAT_R16G16_SFLOAT;
|
||||
case dawn::VertexFormat::Half4:
|
||||
return VK_FORMAT_R16G16B16A16_SFLOAT;
|
||||
case dawn::VertexFormat::Float:
|
||||
return VK_FORMAT_R32_SFLOAT;
|
||||
case dawn::VertexFormat::Float2:
|
||||
return VK_FORMAT_R32G32_SFLOAT;
|
||||
case dawn::VertexFormat::Float3:
|
||||
return VK_FORMAT_R32G32B32_SFLOAT;
|
||||
case dawn::VertexFormat::Float4:
|
||||
return VK_FORMAT_R32G32B32A32_SFLOAT;
|
||||
case dawn::VertexFormat::UInt:
|
||||
return VK_FORMAT_R32_UINT;
|
||||
case dawn::VertexFormat::UInt2:
|
||||
return VK_FORMAT_R32G32_UINT;
|
||||
case dawn::VertexFormat::UInt3:
|
||||
return VK_FORMAT_R32G32B32_UINT;
|
||||
case dawn::VertexFormat::UInt4:
|
||||
return VK_FORMAT_R32G32B32A32_UINT;
|
||||
case dawn::VertexFormat::Int:
|
||||
return VK_FORMAT_R32_SINT;
|
||||
case dawn::VertexFormat::Int2:
|
||||
return VK_FORMAT_R32G32_SINT;
|
||||
case dawn::VertexFormat::Int3:
|
||||
return VK_FORMAT_R32G32B32_SINT;
|
||||
case dawn::VertexFormat::Int4:
|
||||
return VK_FORMAT_R32G32B32A32_SINT;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ class DestroyBufferTest : public DawnTest {
|
|||
attribute.shaderLocation = 0;
|
||||
attribute.inputSlot = 0;
|
||||
attribute.offset = 0;
|
||||
attribute.format = dawn::VertexFormat::FloatR32G32B32A32;
|
||||
attribute.format = dawn::VertexFormat::Float4;
|
||||
|
||||
dawn::InputState inputState =
|
||||
device.CreateInputStateBuilder().SetInput(&input).SetAttribute(&attribute).GetResult();
|
||||
|
|
|
@ -35,7 +35,7 @@ class DrawIndexedTest : public DawnTest {
|
|||
attribute.shaderLocation = 0;
|
||||
attribute.inputSlot = 0;
|
||||
attribute.offset = 0;
|
||||
attribute.format = dawn::VertexFormat::FloatR32G32B32A32;
|
||||
attribute.format = dawn::VertexFormat::Float4;
|
||||
|
||||
dawn::InputState inputState = device.CreateInputStateBuilder()
|
||||
.SetInput(&input)
|
||||
|
|
|
@ -35,7 +35,7 @@ class DrawTest : public DawnTest {
|
|||
attribute.shaderLocation = 0;
|
||||
attribute.inputSlot = 0;
|
||||
attribute.offset = 0;
|
||||
attribute.format = dawn::VertexFormat::FloatR32G32B32A32;
|
||||
attribute.format = dawn::VertexFormat::Float4;
|
||||
|
||||
dawn::InputState inputState =
|
||||
device.CreateInputStateBuilder().SetInput(&input).SetAttribute(&attribute).GetResult();
|
||||
|
|
|
@ -40,7 +40,7 @@ class IndexFormatTest : public DawnTest {
|
|||
attribute.shaderLocation = 0;
|
||||
attribute.inputSlot = 0;
|
||||
attribute.offset = 0;
|
||||
attribute.format = dawn::VertexFormat::FloatR32G32B32A32;
|
||||
attribute.format = dawn::VertexFormat::Float4;
|
||||
|
||||
dawn::InputState inputState = device.CreateInputStateBuilder()
|
||||
.SetInput(&input)
|
||||
|
|
|
@ -44,15 +44,15 @@ class InputStateTest : public DawnTest {
|
|||
bool ShouldComponentBeDefault(VertexFormat format, int component) {
|
||||
EXPECT_TRUE(component >= 0 && component < 4);
|
||||
switch (format) {
|
||||
case VertexFormat::FloatR32G32B32A32:
|
||||
case VertexFormat::UnormR8G8B8A8:
|
||||
case VertexFormat::Float4:
|
||||
case VertexFormat::UChar4Norm:
|
||||
return component >= 4;
|
||||
case VertexFormat::FloatR32G32B32:
|
||||
case VertexFormat::Float3:
|
||||
return component >= 3;
|
||||
case VertexFormat::FloatR32G32:
|
||||
case VertexFormat::UnormR8G8:
|
||||
case VertexFormat::Float2:
|
||||
case VertexFormat::UChar2Norm:
|
||||
return component >= 2;
|
||||
case VertexFormat::FloatR32:
|
||||
case VertexFormat::Float:
|
||||
return component >= 1;
|
||||
default:
|
||||
DAWN_UNREACHABLE();
|
||||
|
@ -221,11 +221,11 @@ TEST_P(InputStateTest, Basic) {
|
|||
dawn::InputState inputState = MakeInputState({
|
||||
{0, 4 * sizeof(float), InputStepMode::Vertex}
|
||||
}, {
|
||||
{0, 0, 0, VertexFormat::FloatR32G32B32A32}
|
||||
{0, 0, 0, VertexFormat::Float4}
|
||||
}
|
||||
);
|
||||
dawn::RenderPipeline pipeline = MakeTestPipeline(inputState, 1, {
|
||||
{0, VertexFormat::FloatR32G32B32A32, InputStepMode::Vertex}
|
||||
{0, VertexFormat::Float4, InputStepMode::Vertex}
|
||||
});
|
||||
|
||||
dawn::Buffer buffer0 = MakeVertexBuffer<float>({
|
||||
|
@ -244,11 +244,11 @@ TEST_P(InputStateTest, ZeroStride) {
|
|||
dawn::InputState inputState = MakeInputState({
|
||||
{0, 0, InputStepMode::Vertex}
|
||||
}, {
|
||||
{0, 0, 0, VertexFormat::FloatR32G32B32A32}
|
||||
{0, 0, 0, VertexFormat::Float4}
|
||||
}
|
||||
);
|
||||
dawn::RenderPipeline pipeline = MakeTestPipeline(inputState, 0, {
|
||||
{0, VertexFormat::FloatR32G32B32A32, InputStepMode::Vertex}
|
||||
{0, VertexFormat::Float4, InputStepMode::Vertex}
|
||||
});
|
||||
|
||||
dawn::Buffer buffer0 = MakeVertexBuffer<float>({
|
||||
|
@ -267,11 +267,11 @@ TEST_P(InputStateTest, AttributeExpanding) {
|
|||
dawn::InputState inputState = MakeInputState({
|
||||
{0, 0, InputStepMode::Vertex}
|
||||
}, {
|
||||
{0, 0, 0, VertexFormat::FloatR32}
|
||||
{0, 0, 0, VertexFormat::Float}
|
||||
}
|
||||
);
|
||||
dawn::RenderPipeline pipeline = MakeTestPipeline(inputState, 0, {
|
||||
{0, VertexFormat::FloatR32, InputStepMode::Vertex}
|
||||
{0, VertexFormat::Float, InputStepMode::Vertex}
|
||||
});
|
||||
|
||||
dawn::Buffer buffer0 = MakeVertexBuffer<float>({
|
||||
|
@ -284,11 +284,11 @@ TEST_P(InputStateTest, AttributeExpanding) {
|
|||
dawn::InputState inputState = MakeInputState({
|
||||
{0, 0, InputStepMode::Vertex}
|
||||
}, {
|
||||
{0, 0, 0, VertexFormat::FloatR32G32}
|
||||
{0, 0, 0, VertexFormat::Float2}
|
||||
}
|
||||
);
|
||||
dawn::RenderPipeline pipeline = MakeTestPipeline(inputState, 0, {
|
||||
{0, VertexFormat::FloatR32G32, InputStepMode::Vertex}
|
||||
{0, VertexFormat::Float2, InputStepMode::Vertex}
|
||||
});
|
||||
|
||||
dawn::Buffer buffer0 = MakeVertexBuffer<float>({
|
||||
|
@ -301,11 +301,11 @@ TEST_P(InputStateTest, AttributeExpanding) {
|
|||
dawn::InputState inputState = MakeInputState({
|
||||
{0, 0, InputStepMode::Vertex}
|
||||
}, {
|
||||
{0, 0, 0, VertexFormat::FloatR32G32B32}
|
||||
{0, 0, 0, VertexFormat::Float3}
|
||||
}
|
||||
);
|
||||
dawn::RenderPipeline pipeline = MakeTestPipeline(inputState, 0, {
|
||||
{0, VertexFormat::FloatR32G32B32, InputStepMode::Vertex}
|
||||
{0, VertexFormat::Float3, InputStepMode::Vertex}
|
||||
});
|
||||
|
||||
dawn::Buffer buffer0 = MakeVertexBuffer<float>({
|
||||
|
@ -323,11 +323,11 @@ TEST_P(InputStateTest, StrideLargerThanAttributes) {
|
|||
dawn::InputState inputState = MakeInputState({
|
||||
{0, 8 * sizeof(float), InputStepMode::Vertex}
|
||||
}, {
|
||||
{0, 0, 0, VertexFormat::FloatR32G32B32A32}
|
||||
{0, 0, 0, VertexFormat::Float4}
|
||||
}
|
||||
);
|
||||
dawn::RenderPipeline pipeline = MakeTestPipeline(inputState, 1, {
|
||||
{0, VertexFormat::FloatR32G32B32A32, InputStepMode::Vertex}
|
||||
{0, VertexFormat::Float4, InputStepMode::Vertex}
|
||||
});
|
||||
|
||||
dawn::Buffer buffer0 = MakeVertexBuffer<float>({
|
||||
|
@ -343,12 +343,12 @@ TEST_P(InputStateTest, TwoAttributesAtAnOffsetVertex) {
|
|||
dawn::InputState inputState = MakeInputState({
|
||||
{0, 8 * sizeof(float), InputStepMode::Vertex}
|
||||
}, {
|
||||
{0, 0, 0, VertexFormat::FloatR32G32B32A32},
|
||||
{1, 0, 4 * sizeof(float), VertexFormat::FloatR32G32B32A32}
|
||||
{0, 0, 0, VertexFormat::Float4},
|
||||
{1, 0, 4 * sizeof(float), VertexFormat::Float4}
|
||||
}
|
||||
);
|
||||
dawn::RenderPipeline pipeline = MakeTestPipeline(inputState, 1, {
|
||||
{0, VertexFormat::FloatR32G32B32A32, InputStepMode::Vertex}
|
||||
{0, VertexFormat::Float4, InputStepMode::Vertex}
|
||||
});
|
||||
|
||||
dawn::Buffer buffer0 = MakeVertexBuffer<float>({
|
||||
|
@ -364,12 +364,12 @@ TEST_P(InputStateTest, TwoAttributesAtAnOffsetInstance) {
|
|||
dawn::InputState inputState = MakeInputState({
|
||||
{0, 8 * sizeof(float), InputStepMode::Instance}
|
||||
}, {
|
||||
{0, 0, 0, VertexFormat::FloatR32G32B32A32},
|
||||
{1, 0, 4 * sizeof(float), VertexFormat::FloatR32G32B32A32}
|
||||
{0, 0, 0, VertexFormat::Float4},
|
||||
{1, 0, 4 * sizeof(float), VertexFormat::Float4}
|
||||
}
|
||||
);
|
||||
dawn::RenderPipeline pipeline = MakeTestPipeline(inputState, 1, {
|
||||
{0, VertexFormat::FloatR32G32B32A32, InputStepMode::Instance}
|
||||
{0, VertexFormat::Float4, InputStepMode::Instance}
|
||||
});
|
||||
|
||||
dawn::Buffer buffer0 = MakeVertexBuffer<float>({
|
||||
|
@ -385,11 +385,11 @@ TEST_P(InputStateTest, PureInstance) {
|
|||
dawn::InputState inputState = MakeInputState({
|
||||
{0, 4 * sizeof(float), InputStepMode::Instance}
|
||||
}, {
|
||||
{0, 0, 0, VertexFormat::FloatR32G32B32A32}
|
||||
{0, 0, 0, VertexFormat::Float4}
|
||||
}
|
||||
);
|
||||
dawn::RenderPipeline pipeline = MakeTestPipeline(inputState, 1, {
|
||||
{0, VertexFormat::FloatR32G32B32A32, InputStepMode::Instance}
|
||||
{0, VertexFormat::Float4, InputStepMode::Instance}
|
||||
});
|
||||
|
||||
dawn::Buffer buffer0 = MakeVertexBuffer<float>({
|
||||
|
@ -408,17 +408,17 @@ TEST_P(InputStateTest, MixedEverything) {
|
|||
{0, 12 * sizeof(float), InputStepMode::Vertex},
|
||||
{1, 10 * sizeof(float), InputStepMode::Instance},
|
||||
}, {
|
||||
{0, 0, 0, VertexFormat::FloatR32},
|
||||
{1, 0, 6 * sizeof(float), VertexFormat::FloatR32G32},
|
||||
{2, 1, 0, VertexFormat::FloatR32G32B32},
|
||||
{3, 1, 5 * sizeof(float), VertexFormat::FloatR32G32B32A32}
|
||||
{0, 0, 0, VertexFormat::Float},
|
||||
{1, 0, 6 * sizeof(float), VertexFormat::Float2},
|
||||
{2, 1, 0, VertexFormat::Float3},
|
||||
{3, 1, 5 * sizeof(float), VertexFormat::Float4}
|
||||
}
|
||||
);
|
||||
dawn::RenderPipeline pipeline = MakeTestPipeline(inputState, 1, {
|
||||
{0, VertexFormat::FloatR32, InputStepMode::Vertex},
|
||||
{1, VertexFormat::FloatR32G32, InputStepMode::Vertex},
|
||||
{2, VertexFormat::FloatR32G32B32, InputStepMode::Instance},
|
||||
{3, VertexFormat::FloatR32G32B32A32, InputStepMode::Instance}
|
||||
{0, VertexFormat::Float, InputStepMode::Vertex},
|
||||
{1, VertexFormat::Float2, InputStepMode::Vertex},
|
||||
{2, VertexFormat::Float3, InputStepMode::Instance},
|
||||
{3, VertexFormat::Float4, InputStepMode::Instance}
|
||||
});
|
||||
|
||||
dawn::Buffer buffer0 = MakeVertexBuffer<float>({
|
||||
|
@ -441,9 +441,9 @@ TEST_P(InputStateTest, UnusedVertexSlot) {
|
|||
// Instance input state, using slot 1
|
||||
dawn::InputState instanceInputState =
|
||||
MakeInputState({{1, 4 * sizeof(float), InputStepMode::Instance}},
|
||||
{{0, 1, 0, VertexFormat::FloatR32G32B32A32}});
|
||||
{{0, 1, 0, VertexFormat::Float4}});
|
||||
dawn::RenderPipeline instancePipeline = MakeTestPipeline(
|
||||
instanceInputState, 1, {{0, VertexFormat::FloatR32G32B32A32, InputStepMode::Instance}});
|
||||
instanceInputState, 1, {{0, VertexFormat::Float4, InputStepMode::Instance}});
|
||||
|
||||
dawn::Buffer buffer = MakeVertexBuffer<float>({
|
||||
0, 1, 2, 3,
|
||||
|
@ -479,16 +479,16 @@ TEST_P(InputStateTest, MultiplePipelinesMixedInputState) {
|
|||
// Basic input state, using slot 0
|
||||
dawn::InputState vertexInputState =
|
||||
MakeInputState({{0, 4 * sizeof(float), InputStepMode::Vertex}},
|
||||
{{0, 0, 0, VertexFormat::FloatR32G32B32A32}});
|
||||
{{0, 0, 0, VertexFormat::Float4}});
|
||||
dawn::RenderPipeline vertexPipeline = MakeTestPipeline(
|
||||
vertexInputState, 1, {{0, VertexFormat::FloatR32G32B32A32, InputStepMode::Vertex}});
|
||||
vertexInputState, 1, {{0, VertexFormat::Float4, InputStepMode::Vertex}});
|
||||
|
||||
// Instance input state, using slot 1
|
||||
dawn::InputState instanceInputState =
|
||||
MakeInputState({{1, 4 * sizeof(float), InputStepMode::Instance}},
|
||||
{{0, 1, 0, VertexFormat::FloatR32G32B32A32}});
|
||||
{{0, 1, 0, VertexFormat::Float4}});
|
||||
dawn::RenderPipeline instancePipeline = MakeTestPipeline(
|
||||
instanceInputState, 1, {{0, VertexFormat::FloatR32G32B32A32, InputStepMode::Instance}});
|
||||
instanceInputState, 1, {{0, VertexFormat::Float4, InputStepMode::Instance}});
|
||||
|
||||
dawn::Buffer buffer = MakeVertexBuffer<float>({
|
||||
0, 1, 2, 3,
|
||||
|
|
|
@ -169,7 +169,7 @@ class PrimitiveTopologyTest : public DawnTest {
|
|||
attribute.shaderLocation = 0;
|
||||
attribute.inputSlot = 0;
|
||||
attribute.offset = 0;
|
||||
attribute.format = dawn::VertexFormat::FloatR32G32B32A32;
|
||||
attribute.format = dawn::VertexFormat::Float4;
|
||||
|
||||
dawn::VertexInputDescriptor input;
|
||||
input.inputSlot = 0;
|
||||
|
|
|
@ -68,13 +68,13 @@ TEST_F(InputStateTest, PipelineCompatibility) {
|
|||
attribute1.shaderLocation = 0;
|
||||
attribute1.inputSlot = 0;
|
||||
attribute1.offset = 0;
|
||||
attribute1.format = dawn::VertexFormat::FloatR32;
|
||||
attribute1.format = dawn::VertexFormat::Float;
|
||||
|
||||
dawn::VertexAttributeDescriptor attribute2;
|
||||
attribute2.shaderLocation = 1;
|
||||
attribute2.inputSlot = 0;
|
||||
attribute2.offset = sizeof(float);
|
||||
attribute2.format = dawn::VertexFormat::FloatR32;
|
||||
attribute2.format = dawn::VertexFormat::Float;
|
||||
|
||||
dawn::VertexInputDescriptor input;
|
||||
input.inputSlot = 0;
|
||||
|
@ -126,7 +126,7 @@ TEST_F(InputStateTest, StrideZero) {
|
|||
attribute.shaderLocation = 0;
|
||||
attribute.inputSlot = 0;
|
||||
attribute.offset = 128;
|
||||
attribute.format = dawn::VertexFormat::FloatR32;
|
||||
attribute.format = dawn::VertexFormat::Float;
|
||||
|
||||
AssertWillBeSuccess(device.CreateInputStateBuilder())
|
||||
.SetInput(&kBaseInput)
|
||||
|
@ -182,7 +182,7 @@ TEST_F(InputStateTest, AlreadySetAttribute) {
|
|||
attribute.shaderLocation = 0;
|
||||
attribute.inputSlot = 0;
|
||||
attribute.offset = 0;
|
||||
attribute.format = dawn::VertexFormat::FloatR32;
|
||||
attribute.format = dawn::VertexFormat::Float;
|
||||
|
||||
AssertWillBeSuccess(device.CreateInputStateBuilder())
|
||||
.SetInput(&kBaseInput)
|
||||
|
@ -204,7 +204,7 @@ TEST_F(InputStateTest, SetAttributeLocationOutOfBounds) {
|
|||
attribute.shaderLocation = kMaxVertexAttributes - 1;
|
||||
attribute.inputSlot = 0;
|
||||
attribute.offset = 0;
|
||||
attribute.format = dawn::VertexFormat::FloatR32;
|
||||
attribute.format = dawn::VertexFormat::Float;
|
||||
|
||||
AssertWillBeSuccess(device.CreateInputStateBuilder())
|
||||
.SetInput(&kBaseInput)
|
||||
|
@ -225,8 +225,8 @@ TEST_F(InputStateTest, SetAttributeOffsetOutOfBounds) {
|
|||
dawn::VertexAttributeDescriptor attribute;
|
||||
attribute.shaderLocation = 0;
|
||||
attribute.inputSlot = 0;
|
||||
attribute.offset = kMaxVertexAttributeEnd - sizeof(dawn::VertexFormat::FloatR32);
|
||||
attribute.format = dawn::VertexFormat::FloatR32;
|
||||
attribute.offset = kMaxVertexAttributeEnd - sizeof(dawn::VertexFormat::Float);
|
||||
attribute.format = dawn::VertexFormat::Float;
|
||||
AssertWillBeSuccess(device.CreateInputStateBuilder())
|
||||
.SetInput(&kBaseInput)
|
||||
.SetAttribute(&attribute)
|
||||
|
@ -246,7 +246,7 @@ TEST_F(InputStateTest, SetAttributeOffsetOverflow) {
|
|||
attribute.shaderLocation = 0;
|
||||
attribute.inputSlot = 0;
|
||||
attribute.offset = std::numeric_limits<uint32_t>::max();
|
||||
attribute.format = dawn::VertexFormat::FloatR32;
|
||||
attribute.format = dawn::VertexFormat::Float;
|
||||
AssertWillBeError(device.CreateInputStateBuilder())
|
||||
.SetInput(&kBaseInput)
|
||||
.SetAttribute(&attribute)
|
||||
|
@ -260,7 +260,7 @@ TEST_F(InputStateTest, RequireInputForAttribute) {
|
|||
attribute.shaderLocation = 0;
|
||||
attribute.inputSlot = 0;
|
||||
attribute.offset = 0;
|
||||
attribute.format = dawn::VertexFormat::FloatR32;
|
||||
attribute.format = dawn::VertexFormat::Float;
|
||||
|
||||
AssertWillBeSuccess(device.CreateInputStateBuilder())
|
||||
.SetInput(&kBaseInput)
|
||||
|
@ -282,7 +282,7 @@ TEST_F(InputStateTest, SetAttributeOOBCheckForInputs) {
|
|||
attribute.shaderLocation = 0;
|
||||
attribute.inputSlot = 0;
|
||||
attribute.offset = 0;
|
||||
attribute.format = dawn::VertexFormat::FloatR32;
|
||||
attribute.format = dawn::VertexFormat::Float;
|
||||
|
||||
AssertWillBeSuccess(device.CreateInputStateBuilder())
|
||||
.SetInput(&kBaseInput)
|
||||
|
|
|
@ -71,7 +71,7 @@ class VertexBufferValidationTest : public ValidationTest {
|
|||
auto builder = device.CreateInputStateBuilder();
|
||||
dawn::VertexAttributeDescriptor attribute;
|
||||
attribute.offset = 0;
|
||||
attribute.format = dawn::VertexFormat::FloatR32G32B32;
|
||||
attribute.format = dawn::VertexFormat::Float3;
|
||||
|
||||
dawn::VertexInputDescriptor input;
|
||||
input.stride = 0;
|
||||
|
|
Loading…
Reference in New Issue