Browse Source
Merge pull request #2383 from ReinUsesLisp/aoffi-test
Merge pull request #2383 from ReinUsesLisp/aoffi-test
gl_shader_decompiler: Disable variable AOFFI on unsupported devicespull/15/merge
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 163 additions and 75 deletions
-
2src/video_core/CMakeLists.txt
-
45src/video_core/renderer_opengl/gl_device.cpp
-
30src/video_core/renderer_opengl/gl_device.h
-
25src/video_core/renderer_opengl/gl_rasterizer.cpp
-
4src/video_core/renderer_opengl/gl_rasterizer.h
-
54src/video_core/renderer_opengl/gl_shader_cache.cpp
-
8src/video_core/renderer_opengl/gl_shader_cache.h
-
18src/video_core/renderer_opengl/gl_shader_decompiler.cpp
-
8src/video_core/renderer_opengl/gl_shader_decompiler.h
-
15src/video_core/renderer_opengl/gl_shader_gen.cpp
-
29src/video_core/renderer_opengl/gl_shader_gen.h
@ -0,0 +1,45 @@ |
|||||
|
// Copyright 2019 yuzu Emulator Project
|
||||
|
// Licensed under GPLv2 or any later version
|
||||
|
// Refer to the license.txt file included.
|
||||
|
|
||||
|
#include <cstddef>
|
||||
|
#include <glad/glad.h>
|
||||
|
|
||||
|
#include "common/logging/log.h"
|
||||
|
#include "video_core/renderer_opengl/gl_device.h"
|
||||
|
|
||||
|
namespace OpenGL { |
||||
|
|
||||
|
namespace { |
||||
|
template <typename T> |
||||
|
T GetInteger(GLenum pname) { |
||||
|
GLint temporary; |
||||
|
glGetIntegerv(pname, &temporary); |
||||
|
return static_cast<T>(temporary); |
||||
|
} |
||||
|
} // Anonymous namespace
|
||||
|
|
||||
|
Device::Device() { |
||||
|
uniform_buffer_alignment = GetInteger<std::size_t>(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT); |
||||
|
has_variable_aoffi = TestVariableAoffi(); |
||||
|
} |
||||
|
|
||||
|
bool Device::TestVariableAoffi() { |
||||
|
const GLchar* AOFFI_TEST = R"(#version 430 core |
||||
|
uniform sampler2D tex; |
||||
|
uniform ivec2 variable_offset; |
||||
|
void main() { |
||||
|
gl_Position = textureOffset(tex, vec2(0), variable_offset); |
||||
|
} |
||||
|
)"; |
||||
|
const GLuint shader{glCreateShaderProgramv(GL_VERTEX_SHADER, 1, &AOFFI_TEST)}; |
||||
|
GLint link_status{}; |
||||
|
glGetProgramiv(shader, GL_LINK_STATUS, &link_status); |
||||
|
glDeleteProgram(shader); |
||||
|
|
||||
|
const bool supported{link_status == GL_TRUE}; |
||||
|
LOG_INFO(Render_OpenGL, "Renderer_VariableAOFFI: {}", supported); |
||||
|
return supported; |
||||
|
} |
||||
|
|
||||
|
} // namespace OpenGL
|
||||
@ -0,0 +1,30 @@ |
|||||
|
// Copyright 2019 yuzu Emulator Project |
||||
|
// Licensed under GPLv2 or any later version |
||||
|
// Refer to the license.txt file included. |
||||
|
|
||||
|
#pragma once |
||||
|
|
||||
|
#include <cstddef> |
||||
|
|
||||
|
namespace OpenGL { |
||||
|
|
||||
|
class Device { |
||||
|
public: |
||||
|
Device(); |
||||
|
|
||||
|
std::size_t GetUniformBufferAlignment() const { |
||||
|
return uniform_buffer_alignment; |
||||
|
} |
||||
|
|
||||
|
bool HasVariableAoffi() const { |
||||
|
return has_variable_aoffi; |
||||
|
} |
||||
|
|
||||
|
private: |
||||
|
static bool TestVariableAoffi(); |
||||
|
|
||||
|
std::size_t uniform_buffer_alignment{}; |
||||
|
bool has_variable_aoffi{}; |
||||
|
}; |
||||
|
|
||||
|
} // namespace OpenGL |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue