TESTGPUMC: only the shader that is really in use must compile

master
Martin Gerhardy 2018-10-06 22:07:29 +02:00
parent f56e4bc7fb
commit b0f25100a4
2 changed files with 8 additions and 3 deletions

View File

@ -60,6 +60,7 @@ void Shader::shutdown() {
bool Shader::load(const std::string& name, const std::string& buffer) {
core_assert(_initialized);
_name = name;
Log::info("Load compute shader %s", name.c_str());
const std::string& source = getSource(buffer);
_program = compute::createProgram(source);
if (_program == InvalidId) {

View File

@ -89,14 +89,18 @@ core::AppState TestGPUMC::onInit() {
}
_computeShader.addDefine("SIZE", std::to_string(SIZE));
_computeShaderBuffer.addDefine("SIZE", std::to_string(SIZE));
if (!_computeShader.setup()) {
Log::error("Failed to init compute shader for using 3d textures");
return core::AppState::InitFailure;
if (_writingTo3DTextures) {
return core::AppState::InitFailure;
}
}
_computeShaderBuffer.addDefine("SIZE", std::to_string(SIZE));
if (!_computeShaderBuffer.setup()) {
Log::error("Failed to init compute shader for using buffer");
return core::AppState::InitFailure;
if (!_writingTo3DTextures) {
return core::AppState::InitFailure;
}
}
if (_writingTo3DTextures) {