All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-oe][PATCH] vk-gl-cts: Fix build with GCC 11
@ 2021-04-29 23:42 Khem Raj
  0 siblings, 0 replies; only message in thread
From: Khem Raj @ 2021-04-29 23:42 UTC (permalink / raw)
  To: openembedded-devel; +Cc: Khem Raj

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...ude-limits-header-for-numeric_limits.patch | 56 ++++++++++++++
 ...-GCC-11-uninit-variable-warnings-946.patch | 73 +++++++++++++++++++
 .../vk-gl-cts/khronos-cts.inc                 |  4 +
 3 files changed, 133 insertions(+)
 create mode 100644 meta-oe/recipes-graphics/vk-gl-cts/files/0001-Include-limits-header-for-numeric_limits.patch
 create mode 100644 meta-oe/recipes-graphics/vk-gl-cts/files/0001-Workaround-for-GCC-11-uninit-variable-warnings-946.patch

diff --git a/meta-oe/recipes-graphics/vk-gl-cts/files/0001-Include-limits-header-for-numeric_limits.patch b/meta-oe/recipes-graphics/vk-gl-cts/files/0001-Include-limits-header-for-numeric_limits.patch
new file mode 100644
index 0000000000..26575fe4fb
--- /dev/null
+++ b/meta-oe/recipes-graphics/vk-gl-cts/files/0001-Include-limits-header-for-numeric_limits.patch
@@ -0,0 +1,56 @@
+From aec0be857ed3faef8802c7fd61f3d7798a565108 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 29 Apr 2021 16:03:42 -0700
+Subject: [PATCH] Include <limits> header for numeric_limits
+
+Fixes
+vulkancts/framework/vulkan/vkRayTracingUtil.hpp:116:32: error: 'numeric_limits' is not a member of 'std'
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ framework/vulkan/vkRayTracingUtil.hpp                           | 1 +
+ modules/vulkan/api/vktApiBufferTests.cpp                        | 1 +
+ modules/vulkan/spirv_assembly/vktSpvAsmNonSemanticInfoTests.cpp | 2 ++
+ 3 files changed, 4 insertions(+)
+
+diff --git a/framework/vulkan/vkRayTracingUtil.hpp b/framework/vulkan/vkRayTracingUtil.hpp
+index 8446d74..7711af0 100644
+--- a/framework/vulkan/vkRayTracingUtil.hpp
++++ b/framework/vulkan/vkRayTracingUtil.hpp
+@@ -33,6 +33,7 @@
+ #include "tcuVector.hpp"
+ #include "tcuVectorType.hpp"
+ 
++#include <limits>
+ #include <vector>
+ 
+ namespace vk
+diff --git a/modules/vulkan/api/vktApiBufferTests.cpp b/modules/vulkan/api/vktApiBufferTests.cpp
+index a64577c..97cf062 100644
+--- a/modules/vulkan/api/vktApiBufferTests.cpp
++++ b/modules/vulkan/api/vktApiBufferTests.cpp
+@@ -35,6 +35,7 @@
+ #include "tcuPlatform.hpp"
+ 
+ #include <algorithm>
++#include <limits>
+ 
+ namespace vkt
+ {
+diff --git a/modules/vulkan/spirv_assembly/vktSpvAsmNonSemanticInfoTests.cpp b/modules/vulkan/spirv_assembly/vktSpvAsmNonSemanticInfoTests.cpp
+index bd6089d..0b59f4c 100644
+--- a/modules/vulkan/spirv_assembly/vktSpvAsmNonSemanticInfoTests.cpp
++++ b/modules/vulkan/spirv_assembly/vktSpvAsmNonSemanticInfoTests.cpp
+@@ -28,6 +28,8 @@
+ #include "vktSpvAsmComputeShaderCase.hpp"
+ #include "vktSpvAsmGraphicsShaderTestUtil.hpp"
+ 
++#include <limits>
++
+ namespace vkt
+ {
+ namespace SpirVAssembly
+-- 
+2.31.1
+
diff --git a/meta-oe/recipes-graphics/vk-gl-cts/files/0001-Workaround-for-GCC-11-uninit-variable-warnings-946.patch b/meta-oe/recipes-graphics/vk-gl-cts/files/0001-Workaround-for-GCC-11-uninit-variable-warnings-946.patch
new file mode 100644
index 0000000000..6c87cad0a6
--- /dev/null
+++ b/meta-oe/recipes-graphics/vk-gl-cts/files/0001-Workaround-for-GCC-11-uninit-variable-warnings-946.patch
@@ -0,0 +1,73 @@
+From 9cd614dd5481a4fdf552effac4820f51a10092c7 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Mika=20V=C3=A4in=C3=B6l=C3=A4?=
+ <33728696+mvainola@users.noreply.github.com>
+Date: Wed, 7 Apr 2021 13:12:17 +0300
+Subject: [PATCH] Workaround for GCC 11 uninit variable warnings (#946)
+
+Building Amber with GCC 11.0.1 produces some uninitialized variable
+warnings. This commit works around them by replacing
+reinterpret_cast with memcpy when type punning unsigned integers to
+floats.
+
+Upstream-Status: Backport [https://github.com/google/amber/commit/aa69a0ac23ea7f68dd32bbef210546a5d84c1734]
+---
+ src/float16_helper.cc | 22 ++++++++++++++++------
+ 1 file changed, 16 insertions(+), 6 deletions(-)
+
+diff --git a/src/float16_helper.cc b/src/float16_helper.cc
+index 617bd72..5cb35e7 100644
+--- a/src/float16_helper.cc
++++ b/src/float16_helper.cc
+@@ -15,6 +15,7 @@
+ #include "src/float16_helper.h"
+ 
+ #include <cassert>
++#include <cstring>
+ 
+ // Float10
+ // | 9 8 7 6 5 | 4 3 2 1 0 |
+@@ -75,8 +76,11 @@ float HexFloat16ToFloat(const uint8_t* value) {
+   }
+ 
+   uint32_t hex = sign | exponent | mantissa;
+-  float* hex_float = reinterpret_cast<float*>(&hex);
+-  return *hex_float;
++  float hex_float;
++  static_assert((sizeof(uint32_t) == sizeof(float)),
++                "sizeof(uint32_t) != sizeof(float)");
++  memcpy(&hex_float, &hex, sizeof(float));
++  return hex_float;
+ }
+ 
+ // Convert float |value| whose size is 11 bits to 32 bits float
+@@ -89,8 +93,11 @@ float HexFloat11ToFloat(const uint8_t* value) {
+   uint32_t mantissa = (static_cast<uint32_t>(value[0]) & 0x3f) << 17U;
+ 
+   uint32_t hex = exponent | mantissa;
+-  float* hex_float = reinterpret_cast<float*>(&hex);
+-  return *hex_float;
++  float hex_float;
++  static_assert((sizeof(uint32_t) == sizeof(float)),
++                "sizeof(uint32_t) != sizeof(float)");
++  memcpy(&hex_float, &hex, sizeof(float));
++  return hex_float;
+ }
+ 
+ // Convert float |value| whose size is 10 bits to 32 bits float
+@@ -103,8 +110,11 @@ float HexFloat10ToFloat(const uint8_t* value) {
+   uint32_t mantissa = (static_cast<uint32_t>(value[0]) & 0x1f) << 18U;
+ 
+   uint32_t hex = exponent | mantissa;
+-  float* hex_float = reinterpret_cast<float*>(&hex);
+-  return *hex_float;
++  float hex_float;
++  static_assert((sizeof(uint32_t) == sizeof(float)),
++                "sizeof(uint32_t) != sizeof(float)");
++  memcpy(&hex_float, &hex, sizeof(float));
++  return hex_float;
+ }
+ 
+ }  // namespace
+-- 
+2.31.1
+
diff --git a/meta-oe/recipes-graphics/vk-gl-cts/khronos-cts.inc b/meta-oe/recipes-graphics/vk-gl-cts/khronos-cts.inc
index e64a935dda..d0f0e23429 100644
--- a/meta-oe/recipes-graphics/vk-gl-cts/khronos-cts.inc
+++ b/meta-oe/recipes-graphics/vk-gl-cts/khronos-cts.inc
@@ -22,6 +22,10 @@ REQUIRED_DISTRO_FEATURES += "opengl"
 
 DEPENDS += "libpng zlib virtual/libgles2 virtual/egl"
 
+SRC_URI += "file://0001-Workaround-for-GCC-11-uninit-variable-warnings-946.patch;patchdir=external/amber/src \
+            file://0001-Include-limits-header-for-numeric_limits.patch;patchdir=external/vulkancts \
+"
+
 SRC_URI_append_libc-musl = "\
 	file://fix-musl.patch \
 "
-- 
2.31.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-29 23:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-29 23:42 [meta-oe][PATCH] vk-gl-cts: Fix build with GCC 11 Khem Raj

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.