make result not optional

This fixes crash when hardware shader is enabled in the flatpak version
This commit is contained in:
gal20 2020-11-14 19:58:12 +02:00 committed by GitHub
parent bf03fb83ae
commit 03c002ee2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -254,7 +254,7 @@ public:
explicit ShaderDoubleCache(bool separable) : separable(separable) {}
std::tuple<GLuint, std::optional<ShaderDecompiler::ProgramResult>> Get(
const KeyConfigType& key, const Pica::Shader::ShaderSetup& setup) {
std::optional<ShaderDecompiler::ProgramResult> result{};
ShaderDecompiler::ProgramResult result{};
auto map_it = shader_map.find(key);
if (map_it == shader_map.end()) {
auto program_opt = CodeGenerator(setup, key, separable);
@ -267,7 +267,7 @@ public:
auto [iter, new_shader] = shader_cache.emplace(program, OGLShaderStage{separable});
OGLShaderStage& cached_shader = iter->second;
if (new_shader) {
result->code = program;
result.code = program;
cached_shader.Create(program.c_str(), ShaderType);
}
shader_map[key] = &cached_shader;