Stub out depth16unorm texture format

Allows us to match the upstream header's format list more closely.

Bug: dawn:570
Change-Id: Iee5c6c0e45ab81fa335c3d8e63d8b2c5c455d26c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64522
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
Kai Ninomiya 2021-09-17 18:25:53 +00:00 committed by Dawn LUCI CQ
parent 2e48f011b0
commit fa9ca4482a
8 changed files with 58 additions and 32 deletions

View File

@ -2025,26 +2025,26 @@
{"value": 35, "name": "RGBA32 uint"}, {"value": 35, "name": "RGBA32 uint"},
{"value": 36, "name": "RGBA32 sint"}, {"value": 36, "name": "RGBA32 sint"},
{"value": 37, "name": "depth32 float"}, {"value": 37, "name": "stencil8"},
{"value": 38, "name": "depth24 plus"}, {"value": 38, "name": "depth16 unorm"},
{"value": 39, "name": "stencil8"}, {"value": 39, "name": "depth24 plus"},
{"value": 40, "name": "depth24 plus stencil8"}, {"value": 40, "name": "depth24 plus stencil8"},
{"value": 41, "name": "depth32 float"},
{"value": 41, "name": "BC1 RGBA unorm"}, {"value": 42, "name": "BC1 RGBA unorm"},
{"value": 42, "name": "BC1 RGBA unorm srgb"}, {"value": 43, "name": "BC1 RGBA unorm srgb"},
{"value": 43, "name": "BC2 RGBA unorm"}, {"value": 44, "name": "BC2 RGBA unorm"},
{"value": 44, "name": "BC2 RGBA unorm srgb"}, {"value": 45, "name": "BC2 RGBA unorm srgb"},
{"value": 45, "name": "BC3 RGBA unorm"}, {"value": 46, "name": "BC3 RGBA unorm"},
{"value": 46, "name": "BC3 RGBA unorm srgb"}, {"value": 47, "name": "BC3 RGBA unorm srgb"},
{"value": 47, "name": "BC4 R unorm"}, {"value": 48, "name": "BC4 R unorm"},
{"value": 48, "name": "BC4 R snorm"}, {"value": 49, "name": "BC4 R snorm"},
{"value": 49, "name": "BC5 RG unorm"}, {"value": 50, "name": "BC5 RG unorm"},
{"value": 50, "name": "BC5 RG snorm"}, {"value": 51, "name": "BC5 RG snorm"},
{"value": 51, "name": "BC6H RGB ufloat"}, {"value": 52, "name": "BC6H RGB ufloat"},
{"value": 52, "name": "BC6H RGB float"}, {"value": 53, "name": "BC6H RGB float"},
{"value": 53, "name": "BC7 RGBA unorm"}, {"value": 54, "name": "BC7 RGBA unorm"},
{"value": 54, "name": "BC7 RGBA unorm srgb"}, {"value": 55, "name": "BC7 RGBA unorm srgb"},
{"value": 55, "name": "R8 BG8 Biplanar 420 unorm"},
{"value": 56, "name": "ETC2 RGB8 unorm"}, {"value": 56, "name": "ETC2 RGB8 unorm"},
{"value": 57, "name": "ETC2 RGB8 unorm srgb"}, {"value": 57, "name": "ETC2 RGB8 unorm srgb"},
@ -2084,7 +2084,9 @@
{"value": 90, "name": "ASTC 12x10 unorm"}, {"value": 90, "name": "ASTC 12x10 unorm"},
{"value": 91, "name": "ASTC 12x10 unorm srgb"}, {"value": 91, "name": "ASTC 12x10 unorm srgb"},
{"value": 92, "name": "ASTC 12x12 unorm"}, {"value": 92, "name": "ASTC 12x12 unorm"},
{"value": 93, "name": "ASTC 12x12 unorm srgb"} {"value": 93, "name": "ASTC 12x12 unorm srgb"},
{"value": 94, "name": "R8 BG8 Biplanar 420 unorm"}
] ]
}, },
"texture usage": { "texture usage": {

View File

@ -195,12 +195,13 @@ namespace dawn_native {
AddFormat(internalFormat); AddFormat(internalFormat);
}; };
auto AddDepthFormat = [&AddFormat](wgpu::TextureFormat format, uint32_t byteSize) { auto AddDepthFormat = [&AddFormat](wgpu::TextureFormat format, uint32_t byteSize,
bool isSupported) {
Format internalFormat; Format internalFormat;
internalFormat.format = format; internalFormat.format = format;
internalFormat.isRenderable = true; internalFormat.isRenderable = true;
internalFormat.isCompressed = false; internalFormat.isCompressed = false;
internalFormat.isSupported = true; internalFormat.isSupported = isSupported;
internalFormat.supportsStorageUsage = false; internalFormat.supportsStorageUsage = false;
internalFormat.aspects = Aspect::Depth; internalFormat.aspects = Aspect::Depth;
internalFormat.componentCount = 1; internalFormat.componentCount = 1;
@ -214,12 +215,12 @@ namespace dawn_native {
AddFormat(internalFormat); AddFormat(internalFormat);
}; };
auto AddStencilFormat = [&AddFormat](wgpu::TextureFormat format) { auto AddStencilFormat = [&AddFormat](wgpu::TextureFormat format, bool isSupported) {
Format internalFormat; Format internalFormat;
internalFormat.format = format; internalFormat.format = format;
internalFormat.isRenderable = true; internalFormat.isRenderable = true;
internalFormat.isCompressed = false; internalFormat.isCompressed = false;
internalFormat.isSupported = false; internalFormat.isSupported = isSupported;
internalFormat.supportsStorageUsage = false; internalFormat.supportsStorageUsage = false;
internalFormat.aspects = Aspect::Stencil; internalFormat.aspects = Aspect::Stencil;
internalFormat.componentCount = 1; internalFormat.componentCount = 1;
@ -324,16 +325,18 @@ namespace dawn_native {
AddColorFormat(wgpu::TextureFormat::RGBA32Float, true, true, 16, SampleTypeBit::UnfilterableFloat, 4); AddColorFormat(wgpu::TextureFormat::RGBA32Float, true, true, 16, SampleTypeBit::UnfilterableFloat, 4);
// Depth-stencil formats // Depth-stencil formats
AddDepthFormat(wgpu::TextureFormat::Depth32Float, 4); // TODO(dawn:666): Implement the stencil8 format
AddStencilFormat(wgpu::TextureFormat::Stencil8, false);
// TODO(dawn:570): Implement the depth16unorm format
AddDepthFormat(wgpu::TextureFormat::Depth16Unorm, 2, false);
// TODO(crbug.com/dawn/843): This is 4 because we read this to perform zero initialization, // TODO(crbug.com/dawn/843): This is 4 because we read this to perform zero initialization,
// and textures are always use depth32float. We should improve this to be more robust. Perhaps, // and textures are always use depth32float. We should improve this to be more robust. Perhaps,
// using 0 here to mean "unsized" and adding a backend-specific query for the block size. // using 0 here to mean "unsized" and adding a backend-specific query for the block size.
AddDepthFormat(wgpu::TextureFormat::Depth24Plus, 4); AddDepthFormat(wgpu::TextureFormat::Depth24Plus, 4, true);
// TODO(dawn:666): Implement the stencil8 format
AddStencilFormat(wgpu::TextureFormat::Stencil8);
AddMultiAspectFormat(wgpu::TextureFormat::Depth24PlusStencil8, AddMultiAspectFormat(wgpu::TextureFormat::Depth24PlusStencil8,
Aspect::Depth | Aspect::Stencil, wgpu::TextureFormat::Depth24Plus, wgpu::TextureFormat::Stencil8, true, true, 2); Aspect::Depth | Aspect::Stencil, wgpu::TextureFormat::Depth24Plus, wgpu::TextureFormat::Stencil8, true, true, 2);
// TODO(dawn:690): Implement Depth16Unorm, Depth24UnormStencil8, Depth32FloatStencil8. AddDepthFormat(wgpu::TextureFormat::Depth32Float, 4, true);
// TODO(dawn:690): Implement Depth24UnormStencil8, Depth32FloatStencil8.
// BC compressed formats // BC compressed formats
bool isBCFormatSupported = device->IsExtensionEnabled(Extension::TextureCompressionBC); bool isBCFormatSupported = device->IsExtensionEnabled(Extension::TextureCompressionBC);

View File

@ -77,7 +77,7 @@ namespace dawn_native {
// The number of formats Dawn knows about. Asserts in BuildFormatTable ensure that this is the // The number of formats Dawn knows about. Asserts in BuildFormatTable ensure that this is the
// exact number of known format. // exact number of known format.
static constexpr size_t kKnownFormatCount = 93; static constexpr size_t kKnownFormatCount = 94;
struct Format; struct Format;
using FormatTable = std::array<Format, kKnownFormatCount>; using FormatTable = std::array<Format, kKnownFormatCount>;

View File

@ -244,7 +244,10 @@ namespace dawn_native { namespace d3d12 {
case wgpu::TextureFormat::ASTC12x12UnormSrgb: case wgpu::TextureFormat::ASTC12x12UnormSrgb:
case wgpu::TextureFormat::R8BG8Biplanar420Unorm: case wgpu::TextureFormat::R8BG8Biplanar420Unorm:
// TODO(dawn:666): implement stencil8
case wgpu::TextureFormat::Stencil8: case wgpu::TextureFormat::Stencil8:
// TODO(dawn:570): implement depth16unorm
case wgpu::TextureFormat::Depth16Unorm:
case wgpu::TextureFormat::Undefined: case wgpu::TextureFormat::Undefined:
UNREACHABLE(); UNREACHABLE();
} }
@ -410,7 +413,10 @@ namespace dawn_native { namespace d3d12 {
case wgpu::TextureFormat::ASTC12x12Unorm: case wgpu::TextureFormat::ASTC12x12Unorm:
case wgpu::TextureFormat::ASTC12x12UnormSrgb: case wgpu::TextureFormat::ASTC12x12UnormSrgb:
// TODO(dawn:666): implement stencil8
case wgpu::TextureFormat::Stencil8: case wgpu::TextureFormat::Stencil8:
// TODO(dawn:570): implement depth16unorm
case wgpu::TextureFormat::Depth16Unorm:
case wgpu::TextureFormat::Undefined: case wgpu::TextureFormat::Undefined:
UNREACHABLE(); UNREACHABLE();
} }

View File

@ -311,7 +311,10 @@ namespace dawn_native { namespace metal {
case wgpu::TextureFormat::ASTC12x12Unorm: case wgpu::TextureFormat::ASTC12x12Unorm:
case wgpu::TextureFormat::ASTC12x12UnormSrgb: case wgpu::TextureFormat::ASTC12x12UnormSrgb:
// TODO(dawn:666): implement stencil8
case wgpu::TextureFormat::Stencil8: case wgpu::TextureFormat::Stencil8:
// TODO(dawn:570): implement depth16unorm
case wgpu::TextureFormat::Depth16Unorm:
case wgpu::TextureFormat::Undefined: case wgpu::TextureFormat::Undefined:
UNREACHABLE(); UNREACHABLE();
} }

View File

@ -414,7 +414,10 @@ namespace dawn_native { namespace vulkan {
return VK_FORMAT_ASTC_12x12_SRGB_BLOCK; return VK_FORMAT_ASTC_12x12_SRGB_BLOCK;
case wgpu::TextureFormat::R8BG8Biplanar420Unorm: case wgpu::TextureFormat::R8BG8Biplanar420Unorm:
// TODO(dawn:666): implement stencil8
case wgpu::TextureFormat::Stencil8: case wgpu::TextureFormat::Stencil8:
// TODO(dawn:570): implement depth16unorm
case wgpu::TextureFormat::Depth16Unorm:
case wgpu::TextureFormat::Undefined: case wgpu::TextureFormat::Undefined:
UNREACHABLE(); UNREACHABLE();
} }

View File

@ -415,9 +415,9 @@ namespace {
// TODO(dawn:690): Uncomment these depth/stencil formats after we implement them in Dawn. // TODO(dawn:690): Uncomment these depth/stencil formats after we implement them in Dawn.
wgpu::TextureFormat depthStencilFormats[] = { wgpu::TextureFormat depthStencilFormats[] = {
wgpu::TextureFormat::Depth32Float, wgpu::TextureFormat::Depth24Plus, wgpu::TextureFormat::Stencil8, wgpu::TextureFormat::Depth16Unorm,
wgpu::TextureFormat::Stencil8, wgpu::TextureFormat::Depth24PlusStencil8, wgpu::TextureFormat::Depth24Plus, wgpu::TextureFormat::Depth24PlusStencil8,
// wgpu::TextureFormat::Depth16Unorm, wgpu::TextureFormat::Depth32Float,
// wgpu::TextureFormat::Depth24UnormStencil8, // wgpu::TextureFormat::Depth24UnormStencil8,
// wgpu::TextureFormat::Depth32FloatStencil8, // wgpu::TextureFormat::Depth32FloatStencil8,
}; };

View File

@ -236,7 +236,10 @@ namespace utils {
// Block size of a multi-planar format depends on aspect. // Block size of a multi-planar format depends on aspect.
case wgpu::TextureFormat::R8BG8Biplanar420Unorm: case wgpu::TextureFormat::R8BG8Biplanar420Unorm:
// TODO(dawn:666): implement stencil8
case wgpu::TextureFormat::Stencil8: case wgpu::TextureFormat::Stencil8:
// TODO(dawn:570): implement depth16unorm
case wgpu::TextureFormat::Depth16Unorm:
case wgpu::TextureFormat::Undefined: case wgpu::TextureFormat::Undefined:
UNREACHABLE(); UNREACHABLE();
} }
@ -349,7 +352,10 @@ namespace utils {
// Block size of a multi-planar format depends on aspect. // Block size of a multi-planar format depends on aspect.
case wgpu::TextureFormat::R8BG8Biplanar420Unorm: case wgpu::TextureFormat::R8BG8Biplanar420Unorm:
// TODO(dawn:666): implement stencil8
case wgpu::TextureFormat::Stencil8: case wgpu::TextureFormat::Stencil8:
// TODO(dawn:570): implement depth16unorm
case wgpu::TextureFormat::Depth16Unorm:
case wgpu::TextureFormat::Undefined: case wgpu::TextureFormat::Undefined:
UNREACHABLE(); UNREACHABLE();
} }
@ -462,7 +468,10 @@ namespace utils {
// Block size of a multi-planar format depends on aspect. // Block size of a multi-planar format depends on aspect.
case wgpu::TextureFormat::R8BG8Biplanar420Unorm: case wgpu::TextureFormat::R8BG8Biplanar420Unorm:
// TODO(dawn:666): implement stencil8
case wgpu::TextureFormat::Stencil8: case wgpu::TextureFormat::Stencil8:
// TODO(dawn:570): implement depth16unorm
case wgpu::TextureFormat::Depth16Unorm:
case wgpu::TextureFormat::Undefined: case wgpu::TextureFormat::Undefined:
UNREACHABLE(); UNREACHABLE();
} }