Instantiate a stubbed SPIR-V parser if file ends in .spv

- spv parser just errors out for now
- link against SPIRV-Tools-opt
- Fixe CMake variable TINT_ENABLE_SPV_PARSER --> TINT_BUILD_SPV_PARSER

Bug: tint:3
Change-Id: Ie4ef9b03e001fca3cc11f65a425612755857feac
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16600
Reviewed-by: dan sinclair <dsinclair@google.com>
This commit is contained in:
David Neto
2020-03-10 22:54:12 +00:00
committed by dan sinclair
parent 49faa4c8d7
commit bbd8987e71
5 changed files with 57 additions and 19 deletions

View File

@@ -305,8 +305,9 @@ add_library(libtint ${TINT_LIB_SRCS})
tint_default_compile_options(libtint)
set_target_properties(libtint PROPERTIES OUTPUT_NAME "tint")
if(${TINT_ENABLE_SPV_PARSER})
target_link_libraries(libtint SPIRV-Tools)
if(${TINT_BUILD_SPV_PARSER})
# We'll use the optimizer for its nice SPIR-V in-memory representation
target_link_libraries(libtint SPIRV-Tools-opt SPIRV-Tools)
endif()
add_executable(tint_unittests ${TINT_TEST_SRCS})

View File

@@ -25,6 +25,7 @@ Parser::Parser(const std::vector<uint32_t>&) : Reader() {}
Parser::~Parser() = default;
bool Parser::Parse() {
set_error("SPIR-V parsing is not supported yet");
return false;
}

View File

@@ -31,6 +31,7 @@ class Parser : public Reader {
/// Creates a new parser
/// @param input the input data to parse
explicit Parser(const std::vector<uint32_t>& input);
/// Destructor
~Parser() override;
/// Run the parser