Commit 2b770595 by John Kessenich

Revert "Add new SpirvToolsDisassemble API interface + Improve Doc on existing…

Revert "Add new SpirvToolsDisassemble API interface + Improve Doc on existing API interface (#2408)" See issue #2413. This reverts commit d1929f35.
parent d1929f35
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include "SpvTools.h" #include "SpvTools.h"
#include "spirv-tools/optimizer.hpp" #include "spirv-tools/optimizer.hpp"
#include "spirv-tools/libspirv.h"
namespace glslang { namespace glslang {
...@@ -113,18 +114,11 @@ void OptimizerMesssageConsumer(spv_message_level_t level, const char *source, ...@@ -113,18 +114,11 @@ void OptimizerMesssageConsumer(spv_message_level_t level, const char *source,
out << std::endl; out << std::endl;
} }
// Use the SPIRV-Tools disassembler to print SPIR-V using a SPV_ENV_UNIVERSAL_1_3 environment. // Use the SPIRV-Tools disassembler to print SPIR-V.
void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& spirv) void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& spirv)
{ {
SpirvToolsDisassemble(out, spirv, spv_target_env::SPV_ENV_UNIVERSAL_1_3);
}
// Use the SPIRV-Tools disassembler to print SPIR-V with a provided SPIR-V environment.
void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& spirv,
spv_target_env requested_context)
{
// disassemble // disassemble
spv_context context = spvContextCreate(requested_context); spv_context context = spvContextCreate(SPV_ENV_UNIVERSAL_1_3);
spv_text text; spv_text text;
spv_diagnostic diagnostic = nullptr; spv_diagnostic diagnostic = nullptr;
spvBinaryToText(context, spirv.data(), spirv.size(), spvBinaryToText(context, spirv.data(), spirv.size(),
......
...@@ -41,10 +41,9 @@ ...@@ -41,10 +41,9 @@
#ifndef GLSLANG_SPV_TOOLS_H #ifndef GLSLANG_SPV_TOOLS_H
#define GLSLANG_SPV_TOOLS_H #define GLSLANG_SPV_TOOLS_H
#if ENABLE_OPT #ifdef ENABLE_OPT
#include <vector> #include <vector>
#include <ostream> #include <ostream>
#include "spirv-tools/libspirv.h"
#endif #endif
#include "glslang/MachineIndependent/localintermediate.h" #include "glslang/MachineIndependent/localintermediate.h"
...@@ -63,15 +62,11 @@ struct SpvOptions { ...@@ -63,15 +62,11 @@ struct SpvOptions {
bool validate; bool validate;
}; };
#if ENABLE_OPT #ifdef ENABLE_OPT
// Use the SPIRV-Tools disassembler to print SPIR-V using a SPV_ENV_UNIVERSAL_1_3 environment. // Use the SPIRV-Tools disassembler to print SPIR-V.
void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& spirv); void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& spirv);
// Use the SPIRV-Tools disassembler to print SPIR-V with a provided SPIR-V environment.
void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& spirv,
spv_target_env requested_context);
// Apply the SPIRV-Tools validator to generated SPIR-V. // Apply the SPIRV-Tools validator to generated SPIR-V.
void SpirvToolsValidate(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv, void SpirvToolsValidate(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv,
spv::SpvBuildLogger*, bool prelegalization); spv::SpvBuildLogger*, bool prelegalization);
......
...@@ -41,6 +41,7 @@ target_include_directories(glslang-default-resource-limits ...@@ -41,6 +41,7 @@ target_include_directories(glslang-default-resource-limits
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>) PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>)
set(SOURCES StandAlone.cpp DirStackFileIncluder.h) set(SOURCES StandAlone.cpp DirStackFileIncluder.h)
add_executable(glslangValidator ${SOURCES}) add_executable(glslangValidator ${SOURCES})
...@@ -69,12 +70,6 @@ target_include_directories(glslangValidator PUBLIC ...@@ -69,12 +70,6 @@ target_include_directories(glslangValidator PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../External> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../External>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/External>) $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/External>)
if(ENABLE_OPT)
target_include_directories(glslangValidator
PRIVATE ${spirv-tools_SOURCE_DIR}/include
)
endif(ENABLE_OPT)
if(ENABLE_SPVREMAPPER) if(ENABLE_SPVREMAPPER)
set(REMAPPER_SOURCES spirv-remap.cpp) set(REMAPPER_SOURCES spirv-remap.cpp)
add_executable(spirv-remap ${REMAPPER_SOURCES}) add_executable(spirv-remap ${REMAPPER_SOURCES})
......
...@@ -83,12 +83,6 @@ if(BUILD_TESTING) ...@@ -83,12 +83,6 @@ if(BUILD_TESTING)
${gmock_SOURCE_DIR}/include ${gmock_SOURCE_DIR}/include
${gtest_SOURCE_DIR}/include) ${gtest_SOURCE_DIR}/include)
if(ENABLE_OPT)
target_include_directories(glslangtests
PRIVATE ${spirv-tools_SOURCE_DIR}/include
)
endif(ENABLE_OPT)
set(LIBRARIES set(LIBRARIES
glslang OSDependent OGLCompiler glslang glslang OSDependent OGLCompiler glslang
SPIRV glslang-default-resource-limits) SPIRV glslang-default-resource-limits)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment