From 646e4ce328c8452abbf552b93c7ebc4f548c1a2b Mon Sep 17 00:00:00 2001 From: Eric Griffith Date: Wed, 27 Sep 2023 22:16:00 -0700 Subject: [PATCH] IGL: Linux compile fixes Summary: This diff adds two fixes for linux compilation. Reviewed By: KyleFung Differential Revision: D49716452 fbshipit-source-id: ad51a35789fd9d678ebb762ec3bb52b9ae291a52 --- shell/renderSessions/MRTSession.cpp | 2 +- shell/shared/netservice/apple/StreamApple.mm | 2 +- src/igl/ColorSpace.h | 2 +- src/igl/Common.cpp | 2 +- src/igl/Macros.h | 2 +- src/igl/Texture.cpp | 2 +- src/igl/VertexInputState.cpp | 2 +- src/igl/opengl/DepthStencilState.cpp | 4 ++-- src/igl/opengl/DeviceFeatureSet.cpp | 2 +- src/igl/opengl/RenderCommandEncoder.cpp | 2 +- src/igl/opengl/RenderPipelineState.cpp | 4 ++-- src/igl/vulkan/Common.cpp | 2 +- src/igl/vulkan/VulkanContext.cpp | 2 +- 13 files changed, 15 insertions(+), 15 deletions(-) diff --git a/shell/renderSessions/MRTSession.cpp b/shell/renderSessions/MRTSession.cpp index f4b1606a31..82c1b56957 100644 --- a/shell/renderSessions/MRTSession.cpp +++ b/shell/renderSessions/MRTSession.cpp @@ -272,7 +272,7 @@ static std::unique_ptr createShaderStagesForBackend(const IDevice "", nullptr); } - IGL_UNREACHABLE_RETURN(nullptr); + IGL_UNREACHABLE_RETURN(nullptr) } static bool isDeviceCompatible(IDevice& device) noexcept { diff --git a/shell/shared/netservice/apple/StreamApple.mm b/shell/shared/netservice/apple/StreamApple.mm index 39f4b9a784..61fc746a2b 100644 --- a/shell/shared/netservice/apple/StreamApple.mm +++ b/shell/shared/netservice/apple/StreamApple.mm @@ -113,7 +113,7 @@ - (void)stream:(NSStream*)stream handleEvent:(NSStreamEvent)eventCode { case NSStreamStatusWriting: return Stream::Status::Writing; } - IGL_UNREACHABLE_RETURN(Stream::Status::Error); + IGL_UNREACHABLE_RETURN(Stream::Status::Error) } void StreamAdapterApple::close() noexcept { diff --git a/src/igl/ColorSpace.h b/src/igl/ColorSpace.h index 8016e346f3..6d0d3f7fe2 100644 --- a/src/igl/ColorSpace.h +++ b/src/igl/ColorSpace.h @@ -66,7 +66,7 @@ inline const char* IGL_NONNULL colorSpaceToString(ColorSpace colorSpace) { IGL_ENUM_TO_STRING(ColorSpace, DISPLAY_NATIVE_AMD) } - IGL_UNREACHABLE_RETURN("unknown color space"); + IGL_UNREACHABLE_RETURN("unknown color space") } inline igl::TextureFormat colorSpaceToTextureFormat(igl::ColorSpace colorSpace, diff --git a/src/igl/Common.cpp b/src/igl/Common.cpp index d5ae8ff54e..40ac45d0e9 100644 --- a/src/igl/Common.cpp +++ b/src/igl/Common.cpp @@ -26,7 +26,7 @@ std::string BackendTypeToString(BackendType backendType) { // @fb-only // @fb-only } - IGL_UNREACHABLE_RETURN(std::string()); + IGL_UNREACHABLE_RETURN(std::string()) } } // namespace igl diff --git a/src/igl/Macros.h b/src/igl/Macros.h index 460ebac6b8..ae256e7bd5 100644 --- a/src/igl/Macros.h +++ b/src/igl/Macros.h @@ -337,7 +337,7 @@ /// MARK: Visual Studio compatibility // not all control paths return a value -#if defined(_MSC_VER) +#if defined(_MSC_VER) || defined(__GNUC__) #define IGL_UNREACHABLE_RETURN(value) \ IGL_ASSERT_NOT_REACHED(); \ return value; diff --git a/src/igl/Texture.cpp b/src/igl/Texture.cpp index 55ebc37d64..fdebfc0599 100644 --- a/src/igl/Texture.cpp +++ b/src/igl/Texture.cpp @@ -336,7 +336,7 @@ TextureFormatProperties TextureFormatProperties::fromTextureFormat(TextureFormat #endif STENCIL(S_UInt8, 1, 1) } - IGL_UNREACHABLE_RETURN(TextureFormatProperties{}); + IGL_UNREACHABLE_RETURN(TextureFormatProperties{}) } size_t TextureFormatProperties::getRows(TextureRangeDesc range) const noexcept { diff --git a/src/igl/VertexInputState.cpp b/src/igl/VertexInputState.cpp index 89084ecb8b..764637791b 100644 --- a/src/igl/VertexInputState.cpp +++ b/src/igl/VertexInputState.cpp @@ -105,7 +105,7 @@ size_t VertexInputStateDesc::sizeForVertexAttributeFormat(VertexAttributeFormat case VertexAttributeFormat::Int_2_10_10_10_REV: return sizeof(uint32_t); } - IGL_UNREACHABLE_RETURN(0); + IGL_UNREACHABLE_RETURN(0) } bool VertexInputBinding::operator!=(const VertexInputBinding& other) const { diff --git a/src/igl/opengl/DepthStencilState.cpp b/src/igl/opengl/DepthStencilState.cpp index 86edf6345c..005515eb57 100644 --- a/src/igl/opengl/DepthStencilState.cpp +++ b/src/igl/opengl/DepthStencilState.cpp @@ -41,7 +41,7 @@ GLenum DepthStencilState::convertCompareFunction(igl::CompareFunction value) { case CompareFunction::AlwaysPass: return GL_ALWAYS; } - IGL_UNREACHABLE_RETURN(GL_ALWAYS); + IGL_UNREACHABLE_RETURN(GL_ALWAYS) } void DepthStencilState::setStencilReferenceValue(uint32_t value) { @@ -72,7 +72,7 @@ GLenum DepthStencilState::convertStencilOperation(igl::StencilOperation value) { case StencilOperation::DecrementWrap: return GL_DECR_WRAP; } - IGL_UNREACHABLE_RETURN(GL_ZERO); + IGL_UNREACHABLE_RETURN(GL_ZERO) } void DepthStencilState::bind() { diff --git a/src/igl/opengl/DeviceFeatureSet.cpp b/src/igl/opengl/DeviceFeatureSet.cpp index 57cfd76f1c..96f5ed7cf6 100644 --- a/src/igl/opengl/DeviceFeatureSet.cpp +++ b/src/igl/opengl/DeviceFeatureSet.cpp @@ -202,7 +202,7 @@ bool DeviceFeatureSet::isExtensionSupported(Extensions extension) const { case Extensions::VertexAttribDivisor: return hasESExtension(*this, "GL_NV_instanced_arrays"); } - IGL_UNREACHABLE_RETURN(false); + IGL_UNREACHABLE_RETURN(false) } bool DeviceFeatureSet::isFeatureSupported(DeviceFeatures feature) const { diff --git a/src/igl/opengl/RenderCommandEncoder.cpp b/src/igl/opengl/RenderCommandEncoder.cpp index ec31af9a9a..55471cfabe 100644 --- a/src/igl/opengl/RenderCommandEncoder.cpp +++ b/src/igl/opengl/RenderCommandEncoder.cpp @@ -300,7 +300,7 @@ constexpr int toGlType(IndexFormat format) { case IndexFormat::UInt32: return GL_UNSIGNED_INT; } - IGL_UNREACHABLE_RETURN(GL_UNSIGNED_INT); + IGL_UNREACHABLE_RETURN(GL_UNSIGNED_INT) } } // namespace diff --git a/src/igl/opengl/RenderPipelineState.cpp b/src/igl/opengl/RenderPipelineState.cpp index 9780ad1716..80171ee752 100644 --- a/src/igl/opengl/RenderPipelineState.cpp +++ b/src/igl/opengl/RenderPipelineState.cpp @@ -44,7 +44,7 @@ GLenum RenderPipelineState::convertBlendOp(BlendOp value) { case BlendOp::Max: return GL_MAX; } - IGL_UNREACHABLE_RETURN(GL_FUNC_ADD); + IGL_UNREACHABLE_RETURN(GL_FUNC_ADD) } GLenum RenderPipelineState::convertBlendFactor(BlendFactor value) { @@ -92,7 +92,7 @@ GLenum RenderPipelineState::convertBlendFactor(BlendFactor value) { logBlendFactorError(_IGL_TO_STRING_WRAPPER(GL_ONE_MINUS_SRC1_ALPHA)); return GL_ONE; // default for unsupported values } - IGL_UNREACHABLE_RETURN(GL_ONE); + IGL_UNREACHABLE_RETURN(GL_ONE) } Result RenderPipelineState::create(const RenderPipelineDesc& desc) { diff --git a/src/igl/vulkan/Common.cpp b/src/igl/vulkan/Common.cpp index 4d246e4a41..2f6c1e5ec1 100644 --- a/src/igl/vulkan/Common.cpp +++ b/src/igl/vulkan/Common.cpp @@ -231,7 +231,7 @@ VkFormat textureFormatToVkFormat(igl::TextureFormat format) { case TextureFormat::S_UInt8: return VK_FORMAT_S8_UINT; } - IGL_UNREACHABLE_RETURN(VK_FORMAT_UNDEFINED); + IGL_UNREACHABLE_RETURN(VK_FORMAT_UNDEFINED) } igl::ColorSpace vkColorSpaceToColorSpace(VkColorSpaceKHR colorSpace) { diff --git a/src/igl/vulkan/VulkanContext.cpp b/src/igl/vulkan/VulkanContext.cpp index d3a28a46a0..880e3a972a 100644 --- a/src/igl/vulkan/VulkanContext.cpp +++ b/src/igl/vulkan/VulkanContext.cpp @@ -161,7 +161,7 @@ VkQueueFlagBits getQueueTypeFlag(igl::CommandQueueType type) { case igl::CommandQueueType::MemoryTransfer: return VK_QUEUE_TRANSFER_BIT; } - IGL_UNREACHABLE_RETURN(VK_QUEUE_GRAPHICS_BIT); + IGL_UNREACHABLE_RETURN(VK_QUEUE_GRAPHICS_BIT) } bool validateImageLimits(VkImageType imageType,