Use statically typed compilation results in C++ API
Class shaderc::CompilationResult is a template over the element type for the compilation output. It has three specializations: for a SPIR-V binary module (with uint32_t element type), SPIR-V assembly text (char element type), and preprocessed source (char element type). The compilation output is accessed via cbegin(), cend() and begin() end() iterators. Test code updates: - Add 'using' declarations for all three compilation result classes. - Add const to compilation result variables, where possible. - IsValidSpv should take an SpvCompilationResult, and should not be parameterized over compilation result types. - IsValidSpv should take an SpvCompilationResult - Test PreprocessingOnlyOption should use a PreprocessedSourceCompilationResult variable instead of an AssemblyCompilationResult variable. Remove SetDisassemblyMode and SetPreprocessOnlyMode methods on the CompileOptions object so we can't get the wrong output by mixing up options with compilation methods. Removed FileCompiler members disassemble_ and preprocess_only_ Remove Disassembly and PreprocessOnly options on shaderc_util::Compiler C API changes: - Use different compile functions in the C API for different output types. - Remove disassembly mode and preprocess-only mode calls.
Showing
- glslc/src/file_compiler.cc 48 additions, 18 deletionsglslc/src/file_compiler.cc
- glslc/src/file_compiler.h 37 additions, 15 deletionsglslc/src/file_compiler.h
- glslc/src/main.cc 0 additions, 3 deletionsglslc/src/main.cc
- libshaderc/CMakeLists.txt 4 additions, 0 deletionslibshaderc/CMakeLists.txt
- libshaderc/include/shaderc/shaderc.h 31 additions, 32 deletionslibshaderc/include/shaderc/shaderc.h
- libshaderc/include/shaderc/shaderc.hpp 134 additions, 83 deletionslibshaderc/include/shaderc/shaderc.hpp
- libshaderc/src/shaderc.cc 42 additions, 15 deletionslibshaderc/src/shaderc.cc
- libshaderc/src/shaderc_cpp_test.cc 117 additions, 95 deletionslibshaderc/src/shaderc_cpp_test.cc
- libshaderc/src/shaderc_test.cc 86 additions, 52 deletionslibshaderc/src/shaderc_test.cc
- libshaderc_util/include/libshaderc_util/compiler.h 18 additions, 24 deletionslibshaderc_util/include/libshaderc_util/compiler.h
- libshaderc_util/src/compiler.cc 9 additions, 13 deletionslibshaderc_util/src/compiler.cc
- libshaderc_util/src/compiler_test.cc 23 additions, 5 deletionslibshaderc_util/src/compiler_test.cc
Loading
Please register or sign in to comment