Compare commits

..

63 Commits

Author SHA1 Message Date
Dave Airlie
81c7f69499 update to 1.3.239.0 sdk 2023-01-31 11:04:43 +10:00
Fedora Release Engineering
99216b1058 Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-01-19 05:16:54 +00:00
Dave Airlie
46be8c54d1 glslang doesn't seem to use datadir anymore 2022-11-09 15:24:01 +10:00
Dave Airlie
22b5d8f8be add update patch file 2022-11-09 14:48:51 +10:00
Dave Airlie
1df27f4178 update to 1.3.231.1 sdk 2022-11-09 14:37:07 +10:00
Lukáš Zaoral
ff26eb3b8f
spec: do not install files in %check section 2022-08-31 08:57:42 +02:00
Dave Airlie
c5eee2510a Latest snapshot used in 1.3.224 sdk 2022-08-24 11:47:10 +10:00
Dave Airlie
433313f194 Latest snapshot used in 1.3.224 sdk 2022-08-24 11:09:58 +10:00
Fedora Release Engineering
daa5e2737c Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-07-21 06:38:07 +00:00
Dave Airlie
d7aaee6fd2 Latest snapshot used in 1.3.216 sdk 2022-06-17 10:02:14 +10:00
Dave Airlie
409999936b Latest snapshot used in 1.3.211 sdk 2022-04-27 14:11:27 +10:00
Dave Airlie
8a78336bde Latest snapshot used in 1.3.204 sdk 2022-02-16 08:41:05 +10:00
Jan Grulich
924fffb00f Fix encoding/decoding of string literals for bug-endian systems 2022-01-29 15:13:50 +10:00
Fedora Release Engineering
90cf680ceb - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-01-20 06:23:37 +00:00
Dave Airlie
11785a96a4 Fix for spirv-tools ABI 2021-12-06 16:12:34 +10:00
Dave Airlie
a43f827703 update patch 2021-11-23 17:41:25 +10:00
Dave Airlie
bf65ea97ae Latest snapshot used in 1.2.198 sdk 2021-11-23 16:56:26 +10:00
Dave Airlie
46832384c4 Latest snapshot used in 1.2.189 sdk 2021-09-07 17:21:22 +10:00
Fedora Release Engineering
a0ad57fa5a - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-07-22 01:59:47 +00:00
Dave Airlie
6a72843627 Latest snapshot used in 1.2.182 sdk 2021-07-07 09:31:34 +10:00
Dave Airlie
f5609fab48 Latest snapshot used in 1.2.176 sdk 2021-05-18 17:04:59 +10:00
Dave Airlie
14322352aa add sources 2021-01-28 17:35:35 +10:00
Dave Airlie
ae435968b5 Latest snapshot used in 1.2.162 sdk 2021-01-28 14:31:39 +10:00
Fedora Release Engineering
bb09f0adbe - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-01-26 08:26:36 +00:00
Dave Airlie
c3da894170 Latest upstream snapshot 2020-11-04 06:36:35 +10:00
Dave Airlie
5642ca3abe Latest upstream snapshot 2020-11-04 06:35:26 +10:00
Dave Airlie
0f257efa46 glslang: fix build 2020-08-05 11:16:34 +10:00
Dave Airlie
56264af2aa Latest upstream snapshot 2020-08-05 08:09:13 +10:00
Dave Airlie
caa83bcd66 fix cmake_install 2020-08-04 04:41:06 +10:00
Dave Airlie
d5ef5535f8 Use cmake macros. 2020-08-04 04:34:23 +10:00
Fedora Release Engineering
fb14ae128d - Second attempt - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-08-01 02:07:00 +00:00
Fedora Release Engineering
16b5642a76 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-07-27 20:25:23 +00:00
Dave Airlie
330342f355 glslang: fix pkg-config patch more 2020-04-22 12:27:14 +10:00
Dave Airlie
627bf5d6d7 fixup patch 2020-04-22 11:26:18 +10:00
Dave Airlie
743d69628a Update to latest git snapshot 2020-04-22 11:16:14 +10:00
Robert-André Mauchin
bb8c134a85 Revert "Revert "rm unneeded include files""
This reverts commit 436e471e0a.
2020-02-02 21:21:58 +01:00
Robert-André Mauchin
436e471e0a Revert "rm unneeded include files"
This reverts commit e645d15596.

These files are needed to build libshaderc.
2020-02-02 21:20:11 +01:00
Dave Airlie
e645d15596 rm unneeded include files 2020-01-29 10:49:37 +10:00
Dave Airlie
3dc0351c51 update to latest sources 2020-01-29 10:34:36 +10:00
Dave Airlie
7ccc360969 Update to latest git snapshot 2020-01-29 10:32:03 +10:00
Fedora Release Engineering
dc9453ce9c - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-01-28 22:28:22 +00:00
leigh123linux
00e26530c6 Add patch for 'Fix a couple relative header paths in header' 2019-12-19 12:11:03 +00:00
Dave Airlie
41facc4a37 Latest upstream snapshot for validation layers build 2019-11-13 15:19:45 +10:00
Dave Airlie
1145a0aba3 glslang: pkg-config/cmake fixes 2019-11-13 15:19:16 +10:00
Dave Airlie
416b5b44ed Fixup test running 2019-11-13 15:19:13 +10:00
Dave Airlie
95781c4513 rebase to newer master 2019-11-13 15:19:01 +10:00
Dave Airlie
2c9e7cf77d Latest upstream snapshot for validation layers build 2019-08-04 07:20:19 +10:00
Fedora Release Engineering
96e53fc51f - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-07-25 03:56:57 +00:00
Robert-André Mauchin
a86599f119 Release 7.11.3214
Add patch to build against system spirv-tools

Signed-off-by: Robert-André Mauchin <zebob.m@gmail.com>
2019-06-10 17:48:29 +02:00
Dave Airlie
d12e2b6afc update to latest glslang snapshot 2019-03-29 10:41:39 +10:00
Dave Airlie
cf645f45fe Update for vulkan 1.1.92.0 2019-02-12 15:55:07 +10:00
Fedora Release Engineering
f873a6b912 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-01-31 22:55:52 +00:00
leigh123linux
f68a9e96f3 Update for vulkan 1.1.82.0 2018-08-07 12:28:11 +01:00
Fedora Release Engineering
cbc3dc7cb2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-07-13 02:45:02 +00:00
leigh123linux
b41ada54d8 fix build 2018-04-24 01:17:26 +01:00
leigh123linux
703973b687 Update for vulkan 1.1.73.0 2018-04-24 00:53:44 +01:00
Adam Williamson
afc38d09c4 Rebuild to fix GCC 8 mis-compilation
See https://da.gd/YJVwk ("GCC 8 ABI change on x86_64")
2018-03-07 17:16:27 -08:00
leigh123linux
403e39b3d1 Update for vulkan 1.0.68.0 2018-02-09 19:32:10 +00:00
leigh123linux
6dfd4a16e1 Use ninja to build 2018-02-09 12:29:27 +00:00
Fedora Release Engineering
a9c708dcc0 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-02-07 13:07:52 +00:00
leigh123linux
35498d029d Exclude s390x and ppc64 from check section 2018-01-03 12:47:38 +00:00
leigh123linux
c64a2302fe Add check section to run tests 2018-01-03 12:14:28 +00:00
leigh123linux
cb6936631b First build 2018-01-02 17:14:43 +00:00
10 changed files with 667 additions and 1 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/glslang-*.tar.gz

View File

@ -0,0 +1,179 @@
diff -up glslang-sdk-1.3.231.1/CMakeLists.txt.dma glslang-sdk-1.3.231.1/CMakeLists.txt
--- glslang-sdk-1.3.231.1/CMakeLists.txt.dma 2022-10-14 03:29:59.000000000 +1000
+++ glslang-sdk-1.3.231.1/CMakeLists.txt 2022-11-09 14:47:04.538772188 +1000
@@ -129,6 +129,13 @@ if(USE_CCACHE)
endif()
endif()
+# using pkg-config to configure include paths and link libraries
+include(FindPkgConfig)
+pkg_check_modules(SPIRV_TOOLS REQUIRED SPIRV-Tools>=2019.2.1)
+if(BUILD_SHARED_LIBS)
+ pkg_check_modules(SPIRV_TOOLS_SHARED REQUIRED SPIRV-Tools-shared>=2019.2.1)
+endif(BUILD_SHARED_LIBS)
+
if(ENABLE_CTEST)
include(CTest)
endif()
@@ -319,11 +326,7 @@ if(BUILD_EXTERNAL AND IS_DIRECTORY ${CMA
add_subdirectory(External)
endif()
-if(NOT TARGET SPIRV-Tools-opt)
- set(ENABLE_OPT OFF)
-endif()
-
-if(ENABLE_OPT)
+if(${SPIRV_TOOLS_FOUND} EQUAL 1)
message(STATUS "optimizer enabled")
add_definitions(-DENABLE_OPT=1)
else()
diff -up glslang-sdk-1.3.231.1/External/CMakeLists.txt.dma glslang-sdk-1.3.231.1/External/CMakeLists.txt
--- glslang-sdk-1.3.231.1/External/CMakeLists.txt.dma 2022-10-14 03:29:59.000000000 +1000
+++ glslang-sdk-1.3.231.1/External/CMakeLists.txt 2022-11-09 14:47:04.539772205 +1000
@@ -68,10 +68,3 @@ if(BUILD_TESTING)
endif()
endif()
-if(ENABLE_OPT AND NOT TARGET SPIRV-Tools-opt)
- if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/spirv-tools)
- set(SPIRV_SKIP_TESTS ON CACHE BOOL "Skip building SPIRV-Tools tests")
- add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/spirv-tools spirv-tools)
- endif()
-endif()
-
diff -up glslang-sdk-1.3.231.1/glslang/CMakeLists.txt.dma glslang-sdk-1.3.231.1/glslang/CMakeLists.txt
--- glslang-sdk-1.3.231.1/glslang/CMakeLists.txt.dma 2022-11-09 14:47:04.540772224 +1000
+++ glslang-sdk-1.3.231.1/glslang/CMakeLists.txt 2022-11-09 14:48:06.844895906 +1000
@@ -221,6 +221,8 @@ if(ENABLE_GLSLANG_INSTALL)
add_library(GenericCodeGen ALIAS glslang::GenericCodeGen)
endif()
")
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/glslang.pc.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/glslang.pc @ONLY)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/glslang.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/glslangTargets.cmake" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
endif()
diff -up glslang-sdk-1.3.231.1/glslang/glslang.pc.cmake.in.dma glslang-sdk-1.3.231.1/glslang/glslang.pc.cmake.in
--- glslang-sdk-1.3.231.1/glslang/glslang.pc.cmake.in.dma 2022-11-09 14:47:04.541772242 +1000
+++ glslang-sdk-1.3.231.1/glslang/glslang.pc.cmake.in 2022-11-09 14:47:04.541772242 +1000
@@ -0,0 +1,11 @@
+ prefix=@CMAKE_INSTALL_PREFIX@
+ exec_prefix=@CMAKE_INSTALL_PREFIX@
+ libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
+ includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
+
+ Name: @PROJECT_NAME@
+ Description: OpenGL and OpenGL ES shader front end and validator
+ Requires:
+ Version: @VERSION@
+ Libs: -L${libdir} -lglslang -lOSDependent -lHLSL -lOGLCompiler -lSPVRemapper
+ Cflags: -I${includedir}
\ No newline at end of file
diff -up glslang-sdk-1.3.231.1/SPIRV/CMakeLists.txt.dma glslang-sdk-1.3.231.1/SPIRV/CMakeLists.txt
--- glslang-sdk-1.3.231.1/SPIRV/CMakeLists.txt.dma 2022-10-14 03:29:59.000000000 +1000
+++ glslang-sdk-1.3.231.1/SPIRV/CMakeLists.txt 2022-11-09 14:47:04.542772260 +1000
@@ -78,6 +78,10 @@ target_include_directories(SPIRV PUBLIC
glslang_add_build_info_dependency(SPIRV)
+
+set(SPIRV_NAME spirv)
+set(SPIRV_VERSION 1.3)
+
if (ENABLE_SPVREMAPPER)
add_library(SPVRemapper ${LIB_TYPE} ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS})
set_property(TARGET SPVRemapper PROPERTY FOLDER glslang)
@@ -91,15 +95,21 @@ if(WIN32 AND BUILD_SHARED_LIBS)
endif()
endif()
+target_include_directories(SPIRV PUBLIC ${SPIRV_TOOLS_INCLUDE_DIRS})
+target_compile_options(SPIRV PUBLIC ${SPIRV_TOOLS_CFLAGS_OTHER})
+target_link_libraries(SPIRV ${SPIRV_TOOLS_LIBRARIES})
+if(BUILD_SHARED_LIBS)
+ target_include_directories(SPIRV PUBLIC ${SPIRV_TOOLS_SHARED_INCLUDE_DIRS})
+ target_compile_options(SPIRV PUBLIC ${SPIRV_TOOLS_SHARED_CFLAGS_OTHER})
+ target_link_libraries(SPIRV ${SPIRV_TOOLS_SHARED_LIBRARIES})
+endif(BUILD_SHARED_LIBS)
+
if(ENABLE_OPT)
target_include_directories(SPIRV
PRIVATE ${spirv-tools_SOURCE_DIR}/include
PRIVATE ${spirv-tools_SOURCE_DIR}/source
)
- target_link_libraries(SPIRV PRIVATE MachineIndependent SPIRV-Tools-opt)
- target_include_directories(SPIRV PUBLIC
- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../External>
- $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/External>)
+ target_link_libraries(SPIRV glslang)
else()
target_link_libraries(SPIRV PRIVATE MachineIndependent)
endif()
@@ -140,6 +150,9 @@ if(ENABLE_GLSLANG_INSTALL)
add_library(SPIRV ALIAS glslang::SPIRV)
")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/SPIRVTargets.cmake" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
-
+ # spirv.pc Configuration
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/spirv.pc.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/spirv.pc @ONLY)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/spirv.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+
install(FILES ${HEADERS} ${SPVREMAP_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/glslang/SPIRV/)
endif()
diff -up glslang-sdk-1.3.231.1/SPIRV/spirv.pc.cmake.in.dma glslang-sdk-1.3.231.1/SPIRV/spirv.pc.cmake.in
--- glslang-sdk-1.3.231.1/SPIRV/spirv.pc.cmake.in.dma 2022-11-09 14:47:04.543772278 +1000
+++ glslang-sdk-1.3.231.1/SPIRV/spirv.pc.cmake.in 2022-11-09 14:47:04.543772278 +1000
@@ -0,0 +1,11 @@
+ prefix=@CMAKE_INSTALL_PREFIX@
+ exec_prefix=@CMAKE_INSTALL_PREFIX@
+ libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
+ includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
+
+ Name: @SPIRV_NAME@
+ Description: SPIR-V is a binary intermediate language for representing graphical-shader stages and compute kernels for multiple Khronos APIs, including OpenCL, OpenGL, and Vulkan
+ Requires:
+ Version: @SPIRV_VERSION@
+ Libs: -L${libdir} -lSPIRV
+ Cflags: -I${includedir}
\ No newline at end of file
diff -up glslang-sdk-1.3.231.1/SPIRV/SpvTools.cpp.dma glslang-sdk-1.3.231.1/SPIRV/SpvTools.cpp
--- glslang-sdk-1.3.231.1/SPIRV/SpvTools.cpp.dma 2022-10-14 03:29:59.000000000 +1000
+++ glslang-sdk-1.3.231.1/SPIRV/SpvTools.cpp 2022-11-09 14:47:04.544772296 +1000
@@ -43,7 +43,7 @@
#include <iostream>
#include "SpvTools.h"
-#include "spirv-tools/optimizer.hpp"
+#include <spirv-tools/optimizer.hpp>
namespace glslang {
diff -up glslang-sdk-1.3.231.1/StandAlone/CMakeLists.txt.dma glslang-sdk-1.3.231.1/StandAlone/CMakeLists.txt
--- glslang-sdk-1.3.231.1/StandAlone/CMakeLists.txt.dma 2022-11-09 14:46:48.996491875 +1000
+++ glslang-sdk-1.3.231.1/StandAlone/CMakeLists.txt 2022-11-09 14:47:04.545772314 +1000
@@ -72,6 +72,14 @@ if(ENABLE_SPVREMAPPER)
set(LIBRARIES ${LIBRARIES} SPVRemapper)
endif()
+if(BUILD_SHARED_LIBS)
+ set(LIBRARIES ${LIBRARIES} ${SPIRV_TOOLS_SHARED_LIBRARIES})
+ target_include_directories(glslangValidator PUBLIC ${SPIRV_TOOLS_SHARED_INCLUDE_DIRS})
+else()
+ set(LIBRARIES ${LIBRARIES} ${SPIRV_TOOLS_LIBRARIES})
+ target_include_directories(glslangValidator PUBLIC ${SPIRV_TOOLS_INCLUDE_DIRS})
+endif(BUILD_SHARED_LIBS)
+
if(WIN32)
set(LIBRARIES ${LIBRARIES} psapi)
elseif(UNIX)
@@ -81,9 +89,6 @@ elseif(UNIX)
endif()
target_link_libraries(glslangValidator ${LIBRARIES})
-target_include_directories(glslangValidator PUBLIC
- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../External>
- $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/External>)
if(ENABLE_OPT)
target_include_directories(glslangValidator

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# glslang
The glslang package

View File

@ -1 +0,0 @@
epel8-playground decommissioned : https://pagure.io/epel/issue/136

View File

@ -0,0 +1,29 @@
From f1fa8afa25c99a550b3d80c516b7cfa3ac725de5 Mon Sep 17 00:00:00 2001
From: Marius Hillenbrand <mhillen@linux.ibm.com>
Date: Wed, 10 Nov 2021 18:10:58 +0100
Subject: [PATCH] TIntermediate::promoteConstantUnion(): fix conversion to int8
The signedness of type char is implementation-defined in C++. The
conversion to (signed) int8 currently uses a cast to char, which is
undefined for negative values when the type char is implemented as
unsigned. Thus, fix to cast to "signed char", which has the intended
semantic on all implementations.
Fixes #2807
---
glslang/MachineIndependent/Intermediate.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/glslang/MachineIndependent/Intermediate.cpp b/glslang/MachineIndependent/Intermediate.cpp
index 1283f4493..6aea5b3d7 100644
--- a/glslang/MachineIndependent/Intermediate.cpp
+++ b/glslang/MachineIndependent/Intermediate.cpp
@@ -3902,7 +3902,7 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
case EbtFloat16: PROMOTE(setDConst, double, Get); break; \
case EbtFloat: PROMOTE(setDConst, double, Get); break; \
case EbtDouble: PROMOTE(setDConst, double, Get); break; \
- case EbtInt8: PROMOTE(setI8Const, char, Get); break; \
+ case EbtInt8: PROMOTE(setI8Const, signed char, Get); break; \
case EbtInt16: PROMOTE(setI16Const, short, Get); break; \
case EbtInt: PROMOTE(setIConst, int, Get); break; \
case EbtInt64: PROMOTE(setI64Const, long long, Get); break; \

View File

@ -0,0 +1,189 @@
From 78ce7e567fce86d611353c5a9194833a54a6fbe0 Mon Sep 17 00:00:00 2001
From: Marius Hillenbrand <mhillen@linux.ibm.com>
Date: Tue, 19 Oct 2021 18:09:52 +0200
Subject: [PATCH] Fix encoding/decoding of string literals for big-endian
systems
Per SPIR-V spec, a string literal's UTF-8 octets are encoded packed into
words with little-endian convention. Explicitly perform that encoding
instead of assuming that the host system is little-endian.
Note that this change requires corresponding fixes in SPIRV-Tools.
Fixes #202
---
SPIRV/SPVRemapper.cpp | 18 +++++++++++------
SPIRV/disassemble.cpp | 47 ++++++++++++++++++++++++++++---------------
SPIRV/spvIR.h | 22 +++++++++-----------
3 files changed, 52 insertions(+), 35 deletions(-)
diff --git a/SPIRV/SPVRemapper.cpp b/SPIRV/SPVRemapper.cpp
index 56d6d5d4a..fdfbeb90c 100644
--- a/SPIRV/SPVRemapper.cpp
+++ b/SPIRV/SPVRemapper.cpp
@@ -297,15 +297,21 @@ namespace spv {
std::string spirvbin_t::literalString(unsigned word) const
{
std::string literal;
+ const spirword_t * pos = spv.data() + word;
literal.reserve(16);
- const char* bytes = reinterpret_cast<const char*>(spv.data() + word);
-
- while (bytes && *bytes)
- literal += *bytes++;
-
- return literal;
+ do {
+ spirword_t word = *pos;
+ for (int i = 0; i < 4; i++) {
+ char c = word & 0xff;
+ if (c == '\0')
+ return literal;
+ literal += c;
+ word >>= 8;
+ }
+ pos++;
+ } while (true);
}
void spirvbin_t::applyMap()
diff --git a/SPIRV/disassemble.cpp b/SPIRV/disassemble.cpp
index 73c988c5b..74dd60540 100644
--- a/SPIRV/disassemble.cpp
+++ b/SPIRV/disassemble.cpp
@@ -43,6 +43,7 @@
#include <stack>
#include <sstream>
#include <cstring>
+#include <utility>
#include "disassemble.h"
#include "doc.h"
@@ -100,6 +101,7 @@ class SpirvStream {
void outputMask(OperandClass operandClass, unsigned mask);
void disassembleImmediates(int numOperands);
void disassembleIds(int numOperands);
+ std::pair<int, std::string> decodeString();
int disassembleString();
void disassembleInstruction(Id resultId, Id typeId, Op opCode, int numOperands);
@@ -290,31 +292,44 @@ void SpirvStream::disassembleIds(int numOperands)
}
}
-// return the number of operands consumed by the string
-int SpirvStream::disassembleString()
+// decode string from words at current position (non-consuming)
+std::pair<int, std::string> SpirvStream::decodeString()
{
- int startWord = word;
-
- out << " \"";
-
- const char* wordString;
+ std::string res;
+ int wordPos = word;
+ char c;
bool done = false;
+
do {
- unsigned int content = stream[word];
- wordString = (const char*)&content;
+ unsigned int content = stream[wordPos];
for (int charCount = 0; charCount < 4; ++charCount) {
- if (*wordString == 0) {
+ c = content & 0xff;
+ content >>= 8;
+ if (c == '\0') {
done = true;
break;
}
- out << *(wordString++);
+ res += c;
}
- ++word;
- } while (! done);
+ ++wordPos;
+ } while(! done);
+
+ return std::make_pair(wordPos - word, res);
+}
+
+// return the number of operands consumed by the string
+int SpirvStream::disassembleString()
+{
+ out << " \"";
+ std::pair<int, std::string> decoderes = decodeString();
+
+ out << decoderes.second;
out << "\"";
- return word - startWord;
+ word += decoderes.first;
+
+ return decoderes.first;
}
void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode, int numOperands)
@@ -331,7 +346,7 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode,
nextNestedControl = 0;
}
} else if (opCode == OpExtInstImport) {
- idDescriptor[resultId] = (const char*)(&stream[word]);
+ idDescriptor[resultId] = decodeString().second;
}
else {
if (resultId != 0 && idDescriptor[resultId].size() == 0) {
@@ -428,7 +443,7 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode,
--numOperands;
// Get names for printing "(XXX)" for readability, *after* this id
if (opCode == OpName)
- idDescriptor[stream[word - 1]] = (const char*)(&stream[word]);
+ idDescriptor[stream[word - 1]] = decodeString().second;
break;
case OperandVariableIds:
disassembleIds(numOperands);
diff --git a/SPIRV/spvIR.h b/SPIRV/spvIR.h
index 486e80d00..5249a5ba7 100644
--- a/SPIRV/spvIR.h
+++ b/SPIRV/spvIR.h
@@ -111,27 +111,23 @@ class Instruction {
void addStringOperand(const char* str)
{
- unsigned int word;
- char* wordString = (char*)&word;
- char* wordPtr = wordString;
- int charCount = 0;
+ unsigned int word = 0;
+ unsigned int shiftAmount = 0;
char c;
+
do {
c = *(str++);
- *(wordPtr++) = c;
- ++charCount;
- if (charCount == 4) {
+ word |= ((unsigned int)c) << shiftAmount;
+ shiftAmount += 8;
+ if (shiftAmount == 32) {
addImmediateOperand(word);
- wordPtr = wordString;
- charCount = 0;
+ word = 0;
+ shiftAmount = 0;
}
} while (c != 0);
// deal with partial last word
- if (charCount > 0) {
- // pad with 0s
- for (; charCount < 4; ++charCount)
- *(wordPtr++) = 0;
+ if (shiftAmount > 0) {
addImmediateOperand(word);
}
}

View File

@ -0,0 +1,12 @@
diff -up glslang-c9706bdda0ac22b9856f1aa8261e5b9e15cd20c5/StandAlone/CMakeLists.txt.dma glslang-c9706bdda0ac22b9856f1aa8261e5b9e15cd20c5/StandAlone/CMakeLists.txt
--- glslang-c9706bdda0ac22b9856f1aa8261e5b9e15cd20c5/StandAlone/CMakeLists.txt.dma 2021-11-23 17:38:10.022569320 +1000
+++ glslang-c9706bdda0ac22b9856f1aa8261e5b9e15cd20c5/StandAlone/CMakeLists.txt 2021-11-23 17:38:19.087812070 +1000
@@ -47,7 +47,7 @@ add_custom_command(
#add_custom_target(glslangValidator DEPENDS ${GLSLANG_INTRINSIC_H})
-add_library(glslang-default-resource-limits
+add_library(glslang-default-resource-limits STATIC
${CMAKE_CURRENT_SOURCE_DIR}/ResourceLimits.cpp
${CMAKE_CURRENT_SOURCE_DIR}/resource_limits_c.cpp)
set_property(TARGET glslang-default-resource-limits PROPERTY FOLDER glslang)

81
glslang.spec Normal file
View File

@ -0,0 +1,81 @@
%global sdkver 1.3.239.0
Name: glslang
Version: 11.9.0
Release: %autorelease
Summary: OpenGL and OpenGL ES shader front end and validator
License: BSD and GPLv3+ and ASL 2.0
URL: https://github.com/KhronosGroup/%{name}
Source0: %url/archive/sdk-%{sdkver}.tar.gz#/%{name}-sdk-%{sdkver}.tar.gz
Patch1: glslang-default-resource-limits_staticlib.patch
# Patch to build against system spirv-tools (rebased locally)
#Patch3: https://patch-diff.githubusercontent.com/raw/KhronosGroup/glslang/pull/1722.patch#/0001-pkg-config-compatibility.patch
Patch3: 0001-pkg-config-compatibility.patch
BuildRequires: cmake3
BuildRequires: gcc-c++
BuildRequires: ninja-build
BuildRequires: spirv-tools-devel
%description
%{name} is the official reference compiler front end for the OpenGL
ES and OpenGL shading languages. It implements a strict
interpretation of the specifications for these languages.
%package devel
Summary: Development files for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
%{name} is the official reference compiler front end for the OpenGL
ES and OpenGL shading languages. It implements a strict
interpretation of the specifications for these languages.
%prep
%autosetup -p1 -n %{name}-sdk-%{sdkver}
# Fix rpmlint warning on debuginfo
find . -name '*.h' -or -name '*.cpp' -or -name '*.hpp'| xargs chmod a-x
%build
%cmake3 -DBUILD_SHARED_LIBS=OFF
%cmake_build
%install
%{cmake_install}
# Install libglslang-default-resource-limits.a
install -pm 0644 %{_vpath_builddir}/StandAlone/libglslang-default-resource-limits.a %{buildroot}%{_libdir}/
# we don't want them in here
rm -rf %{buildroot}%{_includedir}/SPIRV
%ifnarch s390x ppc64
%check
pushd Test
./runtests localResults ../%{_vpath_builddir}/StandAlone/glslangValidator ../%{_vpath_builddir}/StandAlone/spirv-remap
popd
%endif
%files
%doc README.md README-spirv-remap.txt
%{_bindir}/glslangValidator
%{_bindir}/spirv-remap
%files devel
%{_includedir}/glslang/
%{_libdir}/libHLSL.a
%{_libdir}/libOGLCompiler.a
%{_libdir}/libOSDependent.a
%{_libdir}/libSPIRV.a
%{_libdir}/libSPVRemapper.a
%{_libdir}/libglslang.a
%{_libdir}/libGenericCodeGen.a
%{_libdir}/libMachineIndependent.a
%{_libdir}/libglslang-default-resource-limits.a
%{_libdir}/pkgconfig/glslang.pc
%{_libdir}/pkgconfig/spirv.pc
%{_libdir}/cmake/*
%changelog
%autochangelog

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (glslang-sdk-1.3.239.0.tar.gz) = 2502ddc48aea333d2406f4b225a74f15adb429633b4deb701737440e01e134a5eda98933156b2821ad1fa48d83f259e36061390600d6c5c9bb2edf8c18287d2b

View File

@ -0,0 +1,172 @@
From 0eda343970e04e7c9447d264271b1c4cfdc923f4 Mon Sep 17 00:00:00 2001
From: Marius Hillenbrand <mhillen@linux.ibm.com>
Date: Tue, 9 Nov 2021 16:31:22 +0100
Subject: [PATCH] Use intermOut.cpp's IsNan and IsInfinity for parse-time
constant folding (updated)
There were two implementations of isInf() and isNan(), in Constant.cpp
and in intermOut.cpp. The former only works on little-endian systems,
the latter is a wrapper for library functions and works regardless of
endianness. Move the second version into Common.h and adopt it in both
places. Thereby avoid the duplication and fix for big-endian systems.
A previous commit with the same intent and purpose had missed a required
header for builds on Windows.
On s390x, this fixes the test case
Glsl/CompileToAstTest.FromFile/constFold_frag.
Fixes #2802
---
glslang/Include/Common.h | 33 ++++++++++++++++++++++++
glslang/MachineIndependent/Constant.cpp | 33 ++----------------------
glslang/MachineIndependent/intermOut.cpp | 31 ----------------------
3 files changed, 35 insertions(+), 62 deletions(-)
diff --git a/glslang/Include/Common.h b/glslang/Include/Common.h
index e7b5e072b..9042a1aa2 100644
--- a/glslang/Include/Common.h
+++ b/glslang/Include/Common.h
@@ -39,6 +39,11 @@
#include <algorithm>
#include <cassert>
+#ifdef _MSC_VER
+#include <cfloat>
+#else
+#include <cmath>
+#endif
#include <cstdio>
#include <cstdlib>
#include <list>
@@ -302,6 +307,34 @@ template <class T> int IntLog2(T n)
return result;
}
+inline bool IsInfinity(double x) {
+#ifdef _MSC_VER
+ switch (_fpclass(x)) {
+ case _FPCLASS_NINF:
+ case _FPCLASS_PINF:
+ return true;
+ default:
+ return false;
+ }
+#else
+ return std::isinf(x);
+#endif
+}
+
+inline bool IsNan(double x) {
+#ifdef _MSC_VER
+ switch (_fpclass(x)) {
+ case _FPCLASS_SNAN:
+ case _FPCLASS_QNAN:
+ return true;
+ default:
+ return false;
+ }
+#else
+ return std::isnan(x);
+#endif
+}
+
} // end namespace glslang
#endif // _COMMON_INCLUDED_
diff --git a/glslang/MachineIndependent/Constant.cpp b/glslang/MachineIndependent/Constant.cpp
index 7f5d4c4f2..5fc61dbb7 100644
--- a/glslang/MachineIndependent/Constant.cpp
+++ b/glslang/MachineIndependent/Constant.cpp
@@ -46,35 +46,6 @@ namespace {
using namespace glslang;
-typedef union {
- double d;
- int i[2];
-} DoubleIntUnion;
-
-// Some helper functions
-
-bool isNan(double x)
-{
- DoubleIntUnion u;
- // tough to find a platform independent library function, do it directly
- u.d = x;
- int bitPatternL = u.i[0];
- int bitPatternH = u.i[1];
- return (bitPatternH & 0x7ff80000) == 0x7ff80000 &&
- ((bitPatternH & 0xFFFFF) != 0 || bitPatternL != 0);
-}
-
-bool isInf(double x)
-{
- DoubleIntUnion u;
- // tough to find a platform independent library function, do it directly
- u.d = x;
- int bitPatternL = u.i[0];
- int bitPatternH = u.i[1];
- return (bitPatternH & 0x7ff00000) == 0x7ff00000 &&
- (bitPatternH & 0xFFFFF) == 0 && bitPatternL == 0;
-}
-
const double pi = 3.1415926535897932384626433832795;
} // end anonymous namespace
@@ -663,12 +634,12 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
case EOpIsNan:
{
- newConstArray[i].setBConst(isNan(unionArray[i].getDConst()));
+ newConstArray[i].setBConst(IsNan(unionArray[i].getDConst()));
break;
}
case EOpIsInf:
{
- newConstArray[i].setBConst(isInf(unionArray[i].getDConst()));
+ newConstArray[i].setBConst(IsInfinity(unionArray[i].getDConst()));
break;
}
diff --git a/glslang/MachineIndependent/intermOut.cpp b/glslang/MachineIndependent/intermOut.cpp
index a0fade16c..d8a3aab5d 100644
--- a/glslang/MachineIndependent/intermOut.cpp
+++ b/glslang/MachineIndependent/intermOut.cpp
@@ -48,37 +48,6 @@
#endif
#include <cstdint>
-namespace {
-
-bool IsInfinity(double x) {
-#ifdef _MSC_VER
- switch (_fpclass(x)) {
- case _FPCLASS_NINF:
- case _FPCLASS_PINF:
- return true;
- default:
- return false;
- }
-#else
- return std::isinf(x);
-#endif
-}
-
-bool IsNan(double x) {
-#ifdef _MSC_VER
- switch (_fpclass(x)) {
- case _FPCLASS_SNAN:
- case _FPCLASS_QNAN:
- return true;
- default:
- return false;
- }
-#else
- return std::isnan(x);
-#endif
-}
-
-}
namespace glslang {