Add RGBA8Uint texture format

This commit is contained in:
Austin Eng 2017-08-14 12:49:41 -04:00 committed by Austin Eng
parent d474c2597a
commit fb19c3606b
4 changed files with 9 additions and 1 deletions

View File

@ -1183,7 +1183,8 @@
"category": "enum", "category": "enum",
"values": [ "values": [
{"value": 0, "name": "r8 g8 b8 a8 unorm"}, {"value": 0, "name": "r8 g8 b8 a8 unorm"},
{"value": 1, "name": "d32 float s8 uint"} {"value": 1, "name": "r8 g8 b8 a8 uint"},
{"value": 2, "name": "d32 float s8 uint"}
] ]
}, },
"vertex format": { "vertex format": {

View File

@ -22,6 +22,7 @@ namespace backend {
uint32_t TextureFormatPixelSize(nxt::TextureFormat format) { uint32_t TextureFormatPixelSize(nxt::TextureFormat format) {
switch (format) { switch (format) {
case nxt::TextureFormat::R8G8B8A8Unorm: case nxt::TextureFormat::R8G8B8A8Unorm:
case nxt::TextureFormat::R8G8B8A8Uint:
return 4; return 4;
case nxt::TextureFormat::D32FloatS8Uint: case nxt::TextureFormat::D32FloatS8Uint:
return 8; return 8;
@ -33,6 +34,7 @@ namespace backend {
bool TextureFormatHasDepth(nxt::TextureFormat format) { bool TextureFormatHasDepth(nxt::TextureFormat format) {
switch (format) { switch (format) {
case nxt::TextureFormat::R8G8B8A8Unorm: case nxt::TextureFormat::R8G8B8A8Unorm:
case nxt::TextureFormat::R8G8B8A8Uint:
return false; return false;
case nxt::TextureFormat::D32FloatS8Uint: case nxt::TextureFormat::D32FloatS8Uint:
return true; return true;
@ -44,6 +46,7 @@ namespace backend {
bool TextureFormatHasStencil(nxt::TextureFormat format) { bool TextureFormatHasStencil(nxt::TextureFormat format) {
switch (format) { switch (format) {
case nxt::TextureFormat::R8G8B8A8Unorm: case nxt::TextureFormat::R8G8B8A8Unorm:
case nxt::TextureFormat::R8G8B8A8Uint:
return false; return false;
case nxt::TextureFormat::D32FloatS8Uint: case nxt::TextureFormat::D32FloatS8Uint:
return true; return true;

View File

@ -81,6 +81,8 @@ namespace d3d12 {
switch (format) { switch (format) {
case nxt::TextureFormat::R8G8B8A8Unorm: case nxt::TextureFormat::R8G8B8A8Unorm:
return DXGI_FORMAT_R8G8B8A8_UNORM; return DXGI_FORMAT_R8G8B8A8_UNORM;
case nxt::TextureFormat::R8G8B8A8Uint:
return DXGI_FORMAT_R8G8B8A8_UINT;
case nxt::TextureFormat::D32FloatS8Uint: case nxt::TextureFormat::D32FloatS8Uint:
return DXGI_FORMAT_D32_FLOAT_S8X24_UINT; return DXGI_FORMAT_D32_FLOAT_S8X24_UINT;
default: default:

View File

@ -23,6 +23,8 @@ namespace metal {
switch (format) { switch (format) {
case nxt::TextureFormat::R8G8B8A8Unorm: case nxt::TextureFormat::R8G8B8A8Unorm:
return MTLPixelFormatRGBA8Unorm; return MTLPixelFormatRGBA8Unorm;
case nxt::TextureFormat::R8G8B8A8Uint:
return MTLPixelFormatRGBA8Uint;
case nxt::TextureFormat::D32FloatS8Uint: case nxt::TextureFormat::D32FloatS8Uint:
return MTLPixelFormatDepth32Float_Stencil8; return MTLPixelFormatDepth32Float_Stencil8;
} }