spir-v

Loading SPIRV binary shader fails

被刻印的时光 ゝ 提交于 2020-01-02 09:20:07
问题 In my program I tried to load precompiled binary shaders with the example code from Sasha Willems (https://github.com/SaschaWillems/openglcpp/blob/master/SPIRVShader/main.cpp): bool loadBinaryShader(const char *fileName, GLuint stage, GLuint binaryFormat, GLuint &shader) { std::ifstream shaderFile; shaderFile.open(fileName, std::ios::binary | std::ios::ate); if (shaderFile.is_open()) { size_t size = shaderFile.tellg(); shaderFile.seekg(0, std::ios::beg); char* bin = new char[size]; shaderFile

Does SPIR-V bytecode provide obfuscation?

耗尽温柔 提交于 2019-12-12 20:27:51
问题 It is straightforward for a reverse engineer to attach a graphics debugger to an OpenGL application to extract the shader source code. It is my understanding that Vulkan, on the other hand, uses SPIR-V bytecode, rather than passing plaintext shaders to the graphics API. Does SPIR-V bytecode obfuscate the shader source, or is it fairly easy to decompile? 回答1: There is an entire specification explaining, in explicit detail, the behavior of each and every SPIR-V opcode. That's kinda the opposite

How to use glslang

穿精又带淫゛_ 提交于 2019-12-10 11:11:58
问题 I am trying to use glslang to compile glsl shader code to SPIR-V binaries. The glslang project can be found here: https://github.com/KhronosGroup/glslang It works well via the glslangValidator.exe manually in the command line. But i would like to use the c++ interface. I have build the project as described on the github page, and now I am struggling with how to actually use the interface. I would rather not actually include any projects in my solution (I am using Visual Studio), but link the

Loading SPIRV binary shader fails

你。 提交于 2019-12-06 06:39:59
In my program I tried to load precompiled binary shaders with the example code from Sasha Willems ( https://github.com/SaschaWillems/openglcpp/blob/master/SPIRVShader/main.cpp ): bool loadBinaryShader(const char *fileName, GLuint stage, GLuint binaryFormat, GLuint &shader) { std::ifstream shaderFile; shaderFile.open(fileName, std::ios::binary | std::ios::ate); if (shaderFile.is_open()) { size_t size = shaderFile.tellg(); shaderFile.seekg(0, std::ios::beg); char* bin = new char[size]; shaderFile.read(bin, size); GLint status; shader = glCreateShader(stage); // Create a new shader glShaderBinary

How to use glslang

我是研究僧i 提交于 2019-12-06 05:15:34
I am trying to use glslang to compile glsl shader code to SPIR-V binaries. The glslang project can be found here: https://github.com/KhronosGroup/glslang It works well via the glslangValidator.exe manually in the command line. But i would like to use the c++ interface. I have build the project as described on the github page, and now I am struggling with how to actually use the interface. I would rather not actually include any projects in my solution (I am using Visual Studio), but link the .lib's and headers needed to use it. I just cannot find out which ones i need to link. The github page