public VertexShader(string filePath) { FilePath = filePath; SourceCode = File.ReadAllText(FilePath); VertexShaderObjectHandle = SDL_gpu.GPU_CompileShader(SDL_gpu.GPU_ShaderEnum.GPU_VERTEX_SHADER, SourceCode); if (VertexShaderObjectHandle == 0) { throw new ShaderException("Compilation failed.", SDL_gpu.GPU_GetShaderMessage()); } CompileAndSetDefaultPixelShader(); if (PixelShaderObjectHandle == 0) { throw new ShaderException( "Default Chroma pixel shader compilation failed. " + "Report an issue - be sure to include GLSL errors or I'll f**k you up just like I did with this framework.", SDL_gpu.GPU_GetShaderMessage()); } ProgramHandle = SDL_gpu.GPU_LinkShaders(PixelShaderObjectHandle, VertexShaderObjectHandle); if (ProgramHandle == 0) { throw new ShaderException("Linkage failed.", SDL_gpu.GPU_GetShaderMessage()); } CreateShaderBlock(); }
private void LinkShaders() { ProgramHandle = SDL_gpu.GPU_LinkShaders(PixelShaderObjectHandle, VertexShaderObjectHandle); if (ProgramHandle == 0) { throw new ShaderException("Compound shader linkage failed.", SDL_gpu.GPU_GetShaderMessage()); } }