diff options
| author | 2020-03-14 20:21:26 -0300 | |
|---|---|---|
| committer | 2020-04-01 01:14:04 -0300 | |
| commit | 16270dcfe4f1435f660beffe5d72d026af354d56 (patch) | |
| tree | 34c3247a6508417f0bfe582ccddfc56c69afa9c3 /src | |
| parent | Merge pull request #3591 from ReinUsesLisp/vk-wrapper-part2 (diff) | |
| download | yuzu-16270dcfe4f1435f660beffe5d72d026af354d56.tar.gz yuzu-16270dcfe4f1435f660beffe5d72d026af354d56.tar.xz yuzu-16270dcfe4f1435f660beffe5d72d026af354d56.zip | |
gl_device: Detect if ASTC is reported and expose it
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_device.cpp | 26 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_device.h | 5 |
2 files changed, 31 insertions, 0 deletions
diff --git a/src/video_core/renderer_opengl/gl_device.cpp b/src/video_core/renderer_opengl/gl_device.cpp index 1a2e2a9f7..c286502ba 100644 --- a/src/video_core/renderer_opengl/gl_device.cpp +++ b/src/video_core/renderer_opengl/gl_device.cpp | |||
| @@ -131,6 +131,31 @@ std::array<Device::BaseBindings, Tegra::Engines::MaxShaderTypes> BuildBaseBindin | |||
| 131 | return bindings; | 131 | return bindings; |
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | bool IsASTCSupported() { | ||
| 135 | static constexpr std::array formats = { | ||
| 136 | GL_COMPRESSED_RGBA_ASTC_4x4_KHR, GL_COMPRESSED_RGBA_ASTC_5x4_KHR, | ||
| 137 | GL_COMPRESSED_RGBA_ASTC_5x5_KHR, GL_COMPRESSED_RGBA_ASTC_6x5_KHR, | ||
| 138 | GL_COMPRESSED_RGBA_ASTC_6x6_KHR, GL_COMPRESSED_RGBA_ASTC_8x5_KHR, | ||
| 139 | GL_COMPRESSED_RGBA_ASTC_8x6_KHR, GL_COMPRESSED_RGBA_ASTC_8x8_KHR, | ||
| 140 | GL_COMPRESSED_RGBA_ASTC_10x5_KHR, GL_COMPRESSED_RGBA_ASTC_10x6_KHR, | ||
| 141 | GL_COMPRESSED_RGBA_ASTC_10x8_KHR, GL_COMPRESSED_RGBA_ASTC_10x10_KHR, | ||
| 142 | GL_COMPRESSED_RGBA_ASTC_12x10_KHR, GL_COMPRESSED_RGBA_ASTC_12x12_KHR, | ||
| 143 | GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, | ||
| 144 | GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, | ||
| 145 | GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, | ||
| 146 | GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, | ||
| 147 | GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, | ||
| 148 | GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, | ||
| 149 | GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, | ||
| 150 | }; | ||
| 151 | return std::find_if_not(formats.begin(), formats.end(), [](GLenum format) { | ||
| 152 | GLint supported; | ||
| 153 | glGetInternalformativ(GL_TEXTURE_2D, format, GL_INTERNALFORMAT_SUPPORTED, 1, | ||
| 154 | &supported); | ||
| 155 | return supported == GL_TRUE; | ||
| 156 | }) == formats.end(); | ||
| 157 | } | ||
| 158 | |||
| 134 | } // Anonymous namespace | 159 | } // Anonymous namespace |
| 135 | 160 | ||
| 136 | Device::Device() : base_bindings{BuildBaseBindings()} { | 161 | Device::Device() : base_bindings{BuildBaseBindings()} { |
| @@ -152,6 +177,7 @@ Device::Device() : base_bindings{BuildBaseBindings()} { | |||
| 152 | has_shader_ballot = GLAD_GL_ARB_shader_ballot; | 177 | has_shader_ballot = GLAD_GL_ARB_shader_ballot; |
| 153 | has_vertex_viewport_layer = GLAD_GL_ARB_shader_viewport_layer_array; | 178 | has_vertex_viewport_layer = GLAD_GL_ARB_shader_viewport_layer_array; |
| 154 | has_image_load_formatted = HasExtension(extensions, "GL_EXT_shader_image_load_formatted"); | 179 | has_image_load_formatted = HasExtension(extensions, "GL_EXT_shader_image_load_formatted"); |
| 180 | has_astc = IsASTCSupported(); | ||
| 155 | has_variable_aoffi = TestVariableAoffi(); | 181 | has_variable_aoffi = TestVariableAoffi(); |
| 156 | has_component_indexing_bug = is_amd; | 182 | has_component_indexing_bug = is_amd; |
| 157 | has_precise_bug = TestPreciseBug(); | 183 | has_precise_bug = TestPreciseBug(); |
diff --git a/src/video_core/renderer_opengl/gl_device.h b/src/video_core/renderer_opengl/gl_device.h index d73b099d0..a55050cb5 100644 --- a/src/video_core/renderer_opengl/gl_device.h +++ b/src/video_core/renderer_opengl/gl_device.h | |||
| @@ -64,6 +64,10 @@ public: | |||
| 64 | return has_image_load_formatted; | 64 | return has_image_load_formatted; |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | bool HasASTC() const { | ||
| 68 | return has_astc; | ||
| 69 | } | ||
| 70 | |||
| 67 | bool HasVariableAoffi() const { | 71 | bool HasVariableAoffi() const { |
| 68 | return has_variable_aoffi; | 72 | return has_variable_aoffi; |
| 69 | } | 73 | } |
| @@ -97,6 +101,7 @@ private: | |||
| 97 | bool has_shader_ballot{}; | 101 | bool has_shader_ballot{}; |
| 98 | bool has_vertex_viewport_layer{}; | 102 | bool has_vertex_viewport_layer{}; |
| 99 | bool has_image_load_formatted{}; | 103 | bool has_image_load_formatted{}; |
| 104 | bool has_astc{}; | ||
| 100 | bool has_variable_aoffi{}; | 105 | bool has_variable_aoffi{}; |
| 101 | bool has_component_indexing_bug{}; | 106 | bool has_component_indexing_bug{}; |
| 102 | bool has_precise_bug{}; | 107 | bool has_precise_bug{}; |