mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-06-23 15:03:43 +00:00
Fix -Wunreachable-code-aggressive.
Bug: chromium:1066980 Change-Id: I9e00d3707972307e1c5395156c39aa153d5e170e Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/56522 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Peter Kasting <pkasting@google.com> Commit-Queue: Peter Kasting <pkasting@google.com> Auto-Submit: Peter Kasting <pkasting@google.com>
This commit is contained in:
parent
0ecfece609
commit
1ce20bf5cf
@ -118,8 +118,6 @@ namespace dawn_wire { namespace server {
|
|||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}} // namespace dawn_wire::server
|
}} // namespace dawn_wire::server
|
||||||
|
@ -119,6 +119,7 @@ config("dawn_internal") {
|
|||||||
"-Wshadow-field",
|
"-Wshadow-field",
|
||||||
"-Wstrict-prototypes",
|
"-Wstrict-prototypes",
|
||||||
"-Wtautological-unsigned-zero-compare",
|
"-Wtautological-unsigned-zero-compare",
|
||||||
|
"-Wunreachable-code-aggressive",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (is_win) {
|
if (is_win) {
|
||||||
|
@ -105,7 +105,6 @@ namespace dawn_native {
|
|||||||
return DAWN_VALIDATION_ERROR(
|
return DAWN_VALIDATION_ERROR(
|
||||||
"The depth aspect of depth24plus texture cannot be selected in a "
|
"The depth aspect of depth24plus texture cannot be selected in a "
|
||||||
"texture to buffer copy");
|
"texture to buffer copy");
|
||||||
break;
|
|
||||||
case wgpu::TextureFormat::Depth32Float:
|
case wgpu::TextureFormat::Depth32Float:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -368,12 +368,10 @@ namespace dawn_native {
|
|||||||
if (HasOneBit(format.aspects)) {
|
if (HasOneBit(format.aspects)) {
|
||||||
Aspect single = format.aspects;
|
Aspect single = format.aspects;
|
||||||
return single;
|
return single;
|
||||||
} else {
|
|
||||||
return DAWN_VALIDATION_ERROR(
|
|
||||||
"A single aspect must be selected for multi-planar formats in "
|
|
||||||
"texture <-> linear data copies");
|
|
||||||
}
|
}
|
||||||
break;
|
return DAWN_VALIDATION_ERROR(
|
||||||
|
"A single aspect must be selected for multi-planar formats in "
|
||||||
|
"texture <-> linear data copies");
|
||||||
case wgpu::TextureAspect::DepthOnly:
|
case wgpu::TextureAspect::DepthOnly:
|
||||||
ASSERT(format.aspects & Aspect::Depth);
|
ASSERT(format.aspects & Aspect::Depth);
|
||||||
return Aspect::Depth;
|
return Aspect::Depth;
|
||||||
|
@ -784,7 +784,6 @@ namespace dawn_native {
|
|||||||
}
|
}
|
||||||
case BindingInfoType::ExternalTexture: {
|
case BindingInfoType::ExternalTexture: {
|
||||||
return DAWN_VALIDATION_ERROR("External textures are not supported.");
|
return DAWN_VALIDATION_ERROR("External textures are not supported.");
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,12 +50,12 @@ namespace dawn_native {
|
|||||||
#if defined(DAWN_ENABLE_BACKEND_METAL)
|
#if defined(DAWN_ENABLE_BACKEND_METAL)
|
||||||
const SurfaceDescriptorFromMetalLayer* metalDesc = nullptr;
|
const SurfaceDescriptorFromMetalLayer* metalDesc = nullptr;
|
||||||
FindInChain(descriptor->nextInChain, &metalDesc);
|
FindInChain(descriptor->nextInChain, &metalDesc);
|
||||||
if (!metalDesc) {
|
if (metalDesc) {
|
||||||
return DAWN_VALIDATION_ERROR("Unsupported sType");
|
// Check that the layer is a CAMetalLayer (or a derived class).
|
||||||
}
|
if (!InheritsFromCAMetalLayer(metalDesc->layer)) {
|
||||||
// Check that the layer is a CAMetalLayer (or a derived class).
|
return DAWN_VALIDATION_ERROR("layer must be a CAMetalLayer");
|
||||||
if (!InheritsFromCAMetalLayer(metalDesc->layer)) {
|
}
|
||||||
return DAWN_VALIDATION_ERROR("layer must be a CAMetalLayer");
|
return {};
|
||||||
}
|
}
|
||||||
#endif // defined(DAWN_ENABLE_BACKEND_METAL)
|
#endif // defined(DAWN_ENABLE_BACKEND_METAL)
|
||||||
|
|
||||||
@ -94,32 +94,31 @@ namespace dawn_native {
|
|||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
return DAWN_VALIDATION_ERROR("Unsupported sType");
|
|
||||||
#endif // defined(DAWN_PLATFORM_WINDOWS)
|
#endif // defined(DAWN_PLATFORM_WINDOWS)
|
||||||
|
|
||||||
#if defined(DAWN_USE_X11)
|
#if defined(DAWN_USE_X11)
|
||||||
const SurfaceDescriptorFromXlib* xDesc = nullptr;
|
const SurfaceDescriptorFromXlib* xDesc = nullptr;
|
||||||
FindInChain(descriptor->nextInChain, &xDesc);
|
FindInChain(descriptor->nextInChain, &xDesc);
|
||||||
if (!xDesc) {
|
if (xDesc) {
|
||||||
return DAWN_VALIDATION_ERROR("Unsupported sType");
|
// Check the validity of the window by calling a getter function on the window that
|
||||||
}
|
// returns a status code. If the window is bad the call return a status of zero. We
|
||||||
// Check the validity of the window by calling a getter function on the window that
|
// need to set a temporary X11 error handler while doing this because the default
|
||||||
// returns a status code. If the window is bad the call return a status of zero. We
|
// X11 error handler exits the program on any error.
|
||||||
// need to set a temporary X11 error handler while doing this because the default
|
XErrorHandler oldErrorHandler =
|
||||||
// X11 error handler exits the program on any error.
|
XSetErrorHandler([](Display*, XErrorEvent*) { return 0; });
|
||||||
XErrorHandler oldErrorHandler =
|
XWindowAttributes attributes;
|
||||||
XSetErrorHandler([](Display*, XErrorEvent*) { return 0; });
|
int status = XGetWindowAttributes(reinterpret_cast<Display*>(xDesc->display),
|
||||||
XWindowAttributes attributes;
|
xDesc->window, &attributes);
|
||||||
int status = XGetWindowAttributes(reinterpret_cast<Display*>(xDesc->display),
|
XSetErrorHandler(oldErrorHandler);
|
||||||
xDesc->window, &attributes);
|
|
||||||
XSetErrorHandler(oldErrorHandler);
|
|
||||||
|
|
||||||
if (status == 0) {
|
if (status == 0) {
|
||||||
return DAWN_VALIDATION_ERROR("Invalid X Window");
|
return DAWN_VALIDATION_ERROR("Invalid X Window");
|
||||||
|
}
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
#endif // defined(DAWN_USE_X11)
|
#endif // defined(DAWN_USE_X11)
|
||||||
|
|
||||||
return {};
|
return DAWN_VALIDATION_ERROR("Unsupported sType");
|
||||||
}
|
}
|
||||||
|
|
||||||
Surface::Surface(InstanceBase* instance, const SurfaceDescriptor* descriptor)
|
Surface::Surface(InstanceBase* instance, const SurfaceDescriptor* descriptor)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user