Make Texture format names match WebGPU

BUG=dawn:128

Change-Id: I73cc77082d02941d91fab8ee578e529db979fed1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8164
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez
2019-06-19 09:26:07 +00:00
committed by Commit Bot service account
parent 92cdeaaf81
commit 77fa31c5c6
44 changed files with 216 additions and 217 deletions

View File

@@ -131,7 +131,7 @@ namespace dawn_native { namespace opengl {
GLint GetStencilMaskFromStencilFormat(dawn::TextureFormat depthStencilFormat) {
switch (depthStencilFormat) {
case dawn::TextureFormat::D32FloatS8Uint:
case dawn::TextureFormat::Depth24PlusStencil8:
return 0xFF;
default:
UNREACHABLE();
@@ -583,10 +583,10 @@ namespace dawn_native { namespace opengl {
// TODO(kainino@chromium.org): the color clears (later in
// this function) may be undefined for non-normalized integer formats.
dawn::TextureFormat format = textureView->GetTexture()->GetFormat();
ASSERT(format == dawn::TextureFormat::R8G8B8A8Unorm ||
format == dawn::TextureFormat::R8G8Unorm ||
ASSERT(format == dawn::TextureFormat::RGBA8Unorm ||
format == dawn::TextureFormat::RG8Unorm ||
format == dawn::TextureFormat::R8Unorm ||
format == dawn::TextureFormat::B8G8R8A8Unorm);
format == dawn::TextureFormat::BGRA8Unorm);
}
gl.DrawBuffers(attachmentCount, drawBuffers.data());
@@ -614,7 +614,7 @@ namespace dawn_native { namespace opengl {
// TODO(kainino@chromium.org): the depth/stencil clears (later in
// this function) may be undefined for other texture formats.
ASSERT(format == dawn::TextureFormat::D32FloatS8Uint);
ASSERT(format == dawn::TextureFormat::Depth24PlusStencil8);
}
}

View File

@@ -46,7 +46,7 @@ namespace dawn_native { namespace opengl {
DawnTextureUsageBit usage,
uint32_t width,
uint32_t height) {
if (format != DAWN_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM) {
if (format != DAWN_TEXTURE_FORMAT_RGBA8_UNORM) {
return "unsupported format";
}
ASSERT(width > 0);
@@ -81,7 +81,7 @@ namespace dawn_native { namespace opengl {
}
dawn::TextureFormat NativeSwapChainImpl::GetPreferredFormat() const {
return dawn::TextureFormat::R8G8B8A8Unorm;
return dawn::TextureFormat::RGBA8Unorm;
}
}} // namespace dawn_native::opengl

View File

@@ -64,22 +64,22 @@ namespace dawn_native { namespace opengl {
TextureFormatInfo GetGLFormatInfo(dawn::TextureFormat format) {
switch (format) {
case dawn::TextureFormat::R8G8B8A8Unorm:
case dawn::TextureFormat::RGBA8Unorm:
return {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE};
case dawn::TextureFormat::R8G8Unorm:
case dawn::TextureFormat::RG8Unorm:
return {GL_RG8, GL_RG, GL_UNSIGNED_BYTE};
case dawn::TextureFormat::R8Unorm:
return {GL_R8, GL_RED, GL_UNSIGNED_BYTE};
case dawn::TextureFormat::R8G8B8A8Uint:
case dawn::TextureFormat::RGBA8Uint:
return {GL_RGBA8UI, GL_RGBA, GL_UNSIGNED_INT};
case dawn::TextureFormat::R8G8Uint:
case dawn::TextureFormat::RG8Uint:
return {GL_RG8UI, GL_RG, GL_UNSIGNED_INT};
case dawn::TextureFormat::R8Uint:
return {GL_R8UI, GL_RED, GL_UNSIGNED_INT};
case dawn::TextureFormat::B8G8R8A8Unorm:
case dawn::TextureFormat::BGRA8Unorm:
// This doesn't have an enum for the internal format in OpenGL, so use RGBA8.
return {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE};
case dawn::TextureFormat::D32FloatS8Uint:
case dawn::TextureFormat::Depth24PlusStencil8:
return {GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL,
GL_FLOAT_32_UNSIGNED_INT_24_8_REV};
default: