mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-12 14:46:08 +00:00
Implement support for all Int32 vertex formats. (#179)
This commit is contained in:
committed by
Corentin Wallez
parent
e5ae3274a3
commit
10a659ad91
@@ -35,16 +35,20 @@ namespace backend {
|
||||
uint32_t VertexFormatNumComponents(nxt::VertexFormat format) {
|
||||
switch (format) {
|
||||
case nxt::VertexFormat::FloatR32G32B32A32:
|
||||
case nxt::VertexFormat::IntR32G32B32A32:
|
||||
case nxt::VertexFormat::UshortR16G16B16A16:
|
||||
case nxt::VertexFormat::UnormR8G8B8A8:
|
||||
return 4;
|
||||
case nxt::VertexFormat::FloatR32G32B32:
|
||||
case nxt::VertexFormat::IntR32G32B32:
|
||||
return 3;
|
||||
case nxt::VertexFormat::FloatR32G32:
|
||||
case nxt::VertexFormat::IntR32G32:
|
||||
case nxt::VertexFormat::UshortR16G16:
|
||||
case nxt::VertexFormat::UnormR8G8:
|
||||
return 2;
|
||||
case nxt::VertexFormat::FloatR32:
|
||||
case nxt::VertexFormat::IntR32:
|
||||
return 1;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@@ -58,6 +62,11 @@ namespace backend {
|
||||
case nxt::VertexFormat::FloatR32G32:
|
||||
case nxt::VertexFormat::FloatR32:
|
||||
return sizeof(float);
|
||||
case nxt::VertexFormat::IntR32G32B32A32:
|
||||
case nxt::VertexFormat::IntR32G32B32:
|
||||
case nxt::VertexFormat::IntR32G32:
|
||||
case nxt::VertexFormat::IntR32:
|
||||
return sizeof(int32_t);
|
||||
case nxt::VertexFormat::UshortR16G16B16A16:
|
||||
case nxt::VertexFormat::UshortR16G16:
|
||||
return sizeof(uint16_t);
|
||||
|
||||
@@ -28,6 +28,14 @@ namespace backend { namespace d3d12 {
|
||||
return DXGI_FORMAT_R32G32_FLOAT;
|
||||
case nxt::VertexFormat::FloatR32:
|
||||
return DXGI_FORMAT_R32_FLOAT;
|
||||
case nxt::VertexFormat::IntR32G32B32A32:
|
||||
return DXGI_FORMAT_R32G32B32A32_SINT;
|
||||
case nxt::VertexFormat::IntR32G32B32:
|
||||
return DXGI_FORMAT_R32G32B32_SINT;
|
||||
case nxt::VertexFormat::IntR32G32:
|
||||
return DXGI_FORMAT_R32G32_SINT;
|
||||
case nxt::VertexFormat::IntR32:
|
||||
return DXGI_FORMAT_R32_SINT;
|
||||
case nxt::VertexFormat::UshortR16G16B16A16:
|
||||
return DXGI_FORMAT_R16G16B16A16_UINT;
|
||||
case nxt::VertexFormat::UshortR16G16:
|
||||
|
||||
@@ -30,6 +30,14 @@ namespace backend { namespace metal {
|
||||
return MTLVertexFormatFloat2;
|
||||
case nxt::VertexFormat::FloatR32:
|
||||
return MTLVertexFormatFloat;
|
||||
case nxt::VertexFormat::IntR32G32B32A32:
|
||||
return MTLVertexFormatInt4;
|
||||
case nxt::VertexFormat::IntR32G32B32:
|
||||
return MTLVertexFormatInt3;
|
||||
case nxt::VertexFormat::IntR32G32:
|
||||
return MTLVertexFormatInt2;
|
||||
case nxt::VertexFormat::IntR32:
|
||||
return MTLVertexFormatInt;
|
||||
case nxt::VertexFormat::UshortR16G16B16A16:
|
||||
return MTLVertexFormatUShort4;
|
||||
case nxt::VertexFormat::UshortR16G16:
|
||||
|
||||
@@ -49,6 +49,11 @@ namespace backend { namespace opengl {
|
||||
case nxt::VertexFormat::FloatR32G32:
|
||||
case nxt::VertexFormat::FloatR32:
|
||||
return GL_FLOAT;
|
||||
case nxt::VertexFormat::IntR32G32B32A32:
|
||||
case nxt::VertexFormat::IntR32G32B32:
|
||||
case nxt::VertexFormat::IntR32G32:
|
||||
case nxt::VertexFormat::IntR32:
|
||||
return GL_INT;
|
||||
case nxt::VertexFormat::UshortR16G16B16A16:
|
||||
case nxt::VertexFormat::UshortR16G16:
|
||||
return GL_UNSIGNED_SHORT;
|
||||
|
||||
@@ -41,6 +41,14 @@ namespace backend { namespace vulkan {
|
||||
return VK_FORMAT_R32G32_SFLOAT;
|
||||
case nxt::VertexFormat::FloatR32:
|
||||
return VK_FORMAT_R32_SFLOAT;
|
||||
case nxt::VertexFormat::IntR32G32B32A32:
|
||||
return VK_FORMAT_R32G32B32A32_SINT;
|
||||
case nxt::VertexFormat::IntR32G32B32:
|
||||
return VK_FORMAT_R32G32B32_SINT;
|
||||
case nxt::VertexFormat::IntR32G32:
|
||||
return VK_FORMAT_R32G32_SINT;
|
||||
case nxt::VertexFormat::IntR32:
|
||||
return VK_FORMAT_R32_SINT;
|
||||
case nxt::VertexFormat::UshortR16G16B16A16:
|
||||
return VK_FORMAT_R16G16B16A16_UINT;
|
||||
case nxt::VertexFormat::UshortR16G16:
|
||||
|
||||
Reference in New Issue
Block a user