diff options
| author | 2019-11-26 21:53:12 -0500 | |
|---|---|---|
| committer | 2019-11-26 21:53:12 -0500 | |
| commit | 6df6caaf5f3b59a2d1e19a5148a64cc50c61223c (patch) | |
| tree | 0da6714311f68318f7d988246bca3f1096fb4f43 /src | |
| parent | core_timing: Use better reference tracking for EventType. (#3159) (diff) | |
| parent | gl_device: Deduce indexing bug from device instead of heuristic (diff) | |
| download | yuzu-6df6caaf5f3b59a2d1e19a5148a64cc50c61223c.tar.gz yuzu-6df6caaf5f3b59a2d1e19a5148a64cc50c61223c.tar.xz yuzu-6df6caaf5f3b59a2d1e19a5148a64cc50c61223c.zip | |
Merge pull request #3143 from ReinUsesLisp/indexing-bug
gl_device: Deduce indexing bug from device instead of heuristic
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_device.cpp | 49 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_device.h | 1 |
2 files changed, 2 insertions, 48 deletions
diff --git a/src/video_core/renderer_opengl/gl_device.cpp b/src/video_core/renderer_opengl/gl_device.cpp index a95bd4b2c..413d8546b 100644 --- a/src/video_core/renderer_opengl/gl_device.cpp +++ b/src/video_core/renderer_opengl/gl_device.cpp | |||
| @@ -137,6 +137,7 @@ Device::Device() : base_bindings{BuildBaseBindings()} { | |||
| 137 | const std::vector extensions = GetExtensions(); | 137 | const std::vector extensions = GetExtensions(); |
| 138 | 138 | ||
| 139 | const bool is_nvidia = vendor == "NVIDIA Corporation"; | 139 | const bool is_nvidia = vendor == "NVIDIA Corporation"; |
| 140 | const bool is_amd = vendor == "ATI Technologies Inc."; | ||
| 140 | const bool is_intel = vendor == "Intel"; | 141 | const bool is_intel = vendor == "Intel"; |
| 141 | 142 | ||
| 142 | uniform_buffer_alignment = GetInteger<std::size_t>(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT); | 143 | uniform_buffer_alignment = GetInteger<std::size_t>(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT); |
| @@ -149,7 +150,7 @@ Device::Device() : base_bindings{BuildBaseBindings()} { | |||
| 149 | has_vertex_viewport_layer = GLAD_GL_ARB_shader_viewport_layer_array; | 150 | has_vertex_viewport_layer = GLAD_GL_ARB_shader_viewport_layer_array; |
| 150 | has_image_load_formatted = HasExtension(extensions, "GL_EXT_shader_image_load_formatted"); | 151 | has_image_load_formatted = HasExtension(extensions, "GL_EXT_shader_image_load_formatted"); |
| 151 | has_variable_aoffi = TestVariableAoffi(); | 152 | has_variable_aoffi = TestVariableAoffi(); |
| 152 | has_component_indexing_bug = TestComponentIndexingBug(); | 153 | has_component_indexing_bug = is_amd; |
| 153 | has_precise_bug = TestPreciseBug(); | 154 | has_precise_bug = TestPreciseBug(); |
| 154 | has_broken_compute = is_intel; | 155 | has_broken_compute = is_intel; |
| 155 | has_fast_buffer_sub_data = is_nvidia; | 156 | has_fast_buffer_sub_data = is_nvidia; |
| @@ -184,52 +185,6 @@ void main() { | |||
| 184 | })"); | 185 | })"); |
| 185 | } | 186 | } |
| 186 | 187 | ||
| 187 | bool Device::TestComponentIndexingBug() { | ||
| 188 | const GLchar* COMPONENT_TEST = R"(#version 430 core | ||
| 189 | layout (std430, binding = 0) buffer OutputBuffer { | ||
| 190 | uint output_value; | ||
| 191 | }; | ||
| 192 | layout (std140, binding = 0) uniform InputBuffer { | ||
| 193 | uvec4 input_value[4096]; | ||
| 194 | }; | ||
| 195 | layout (location = 0) uniform uint idx; | ||
| 196 | void main() { | ||
| 197 | output_value = input_value[idx >> 2][idx & 3]; | ||
| 198 | })"; | ||
| 199 | const GLuint shader{glCreateShaderProgramv(GL_VERTEX_SHADER, 1, &COMPONENT_TEST)}; | ||
| 200 | SCOPE_EXIT({ glDeleteProgram(shader); }); | ||
| 201 | glUseProgram(shader); | ||
| 202 | |||
| 203 | OGLVertexArray vao; | ||
| 204 | vao.Create(); | ||
| 205 | glBindVertexArray(vao.handle); | ||
| 206 | |||
| 207 | constexpr std::array<GLuint, 8> values{0, 0, 0, 0, 0x1236327, 0x985482, 0x872753, 0x2378432}; | ||
| 208 | OGLBuffer ubo; | ||
| 209 | ubo.Create(); | ||
| 210 | glNamedBufferData(ubo.handle, sizeof(values), values.data(), GL_STATIC_DRAW); | ||
| 211 | glBindBufferBase(GL_UNIFORM_BUFFER, 0, ubo.handle); | ||
| 212 | |||
| 213 | OGLBuffer ssbo; | ||
| 214 | ssbo.Create(); | ||
| 215 | glNamedBufferStorage(ssbo.handle, sizeof(GLuint), nullptr, GL_CLIENT_STORAGE_BIT); | ||
| 216 | |||
| 217 | for (GLuint index = 4; index < 8; ++index) { | ||
| 218 | glInvalidateBufferData(ssbo.handle); | ||
| 219 | glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, ssbo.handle); | ||
| 220 | |||
| 221 | glProgramUniform1ui(shader, 0, index); | ||
| 222 | glDrawArrays(GL_POINTS, 0, 1); | ||
| 223 | |||
| 224 | GLuint result; | ||
| 225 | glGetNamedBufferSubData(ssbo.handle, 0, sizeof(result), &result); | ||
| 226 | if (result != values.at(index)) { | ||
| 227 | return true; | ||
| 228 | } | ||
| 229 | } | ||
| 230 | return false; | ||
| 231 | } | ||
| 232 | |||
| 233 | bool Device::TestPreciseBug() { | 188 | bool Device::TestPreciseBug() { |
| 234 | return !TestProgram(R"(#version 430 core | 189 | return !TestProgram(R"(#version 430 core |
| 235 | in vec3 coords; | 190 | in vec3 coords; |
diff --git a/src/video_core/renderer_opengl/gl_device.h b/src/video_core/renderer_opengl/gl_device.h index 5433815b9..d73b099d0 100644 --- a/src/video_core/renderer_opengl/gl_device.h +++ b/src/video_core/renderer_opengl/gl_device.h | |||
| @@ -86,7 +86,6 @@ public: | |||
| 86 | 86 | ||
| 87 | private: | 87 | private: |
| 88 | static bool TestVariableAoffi(); | 88 | static bool TestVariableAoffi(); |
| 89 | static bool TestComponentIndexingBug(); | ||
| 90 | static bool TestPreciseBug(); | 89 | static bool TestPreciseBug(); |
| 91 | 90 | ||
| 92 | std::array<BaseBindings, Tegra::Engines::MaxShaderTypes> base_bindings; | 91 | std::array<BaseBindings, Tegra::Engines::MaxShaderTypes> base_bindings; |