summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2020-06-02 23:43:33 +0200
committerGitHub <noreply@github.com>2020-06-02 23:43:33 +0200
commit623b93a2b3bb34cf661c5fbb2759fbad485e6223 (patch)
treef00a50dceadb810e99ee5212c1da7919f91588ee
parentMerge pull request #4032 from VolcaEM/xpad (diff)
parentgl_device: Avoid devices with CAVEAT_SUPPORT on ASTC (diff)
downloadyuzu-623b93a2b3bb34cf661c5fbb2759fbad485e6223.tar
yuzu-623b93a2b3bb34cf661c5fbb2759fbad485e6223.tar.gz
yuzu-623b93a2b3bb34cf661c5fbb2759fbad485e6223.tar.bz2
yuzu-623b93a2b3bb34cf661c5fbb2759fbad485e6223.tar.lz
yuzu-623b93a2b3bb34cf661c5fbb2759fbad485e6223.tar.xz
yuzu-623b93a2b3bb34cf661c5fbb2759fbad485e6223.tar.zst
yuzu-623b93a2b3bb34cf661c5fbb2759fbad485e6223.zip
-rw-r--r--src/video_core/renderer_opengl/gl_device.cpp24
-rw-r--r--src/video_core/renderer_opengl/gl_texture_cache.cpp3
2 files changed, 19 insertions, 8 deletions
diff --git a/src/video_core/renderer_opengl/gl_device.cpp b/src/video_core/renderer_opengl/gl_device.cpp
index d20547c04..b772c37d9 100644
--- a/src/video_core/renderer_opengl/gl_device.cpp
+++ b/src/video_core/renderer_opengl/gl_device.cpp
@@ -144,6 +144,7 @@ std::array<Device::BaseBindings, Tegra::Engines::MaxShaderTypes> BuildBaseBindin
}
bool IsASTCSupported() {
+ static constexpr std::array targets = {GL_TEXTURE_2D, GL_TEXTURE_2D_ARRAY};
static constexpr std::array formats = {
GL_COMPRESSED_RGBA_ASTC_4x4_KHR, GL_COMPRESSED_RGBA_ASTC_5x4_KHR,
GL_COMPRESSED_RGBA_ASTC_5x5_KHR, GL_COMPRESSED_RGBA_ASTC_6x5_KHR,
@@ -160,12 +161,23 @@ bool IsASTCSupported() {
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
};
- return std::find_if_not(formats.begin(), formats.end(), [](GLenum format) {
- GLint supported;
- glGetInternalformativ(GL_TEXTURE_2D, format, GL_INTERNALFORMAT_SUPPORTED, 1,
- &supported);
- return supported == GL_TRUE;
- }) == formats.end();
+ static constexpr std::array required_support = {
+ GL_VERTEX_TEXTURE, GL_TESS_CONTROL_TEXTURE, GL_TESS_EVALUATION_TEXTURE,
+ GL_GEOMETRY_TEXTURE, GL_FRAGMENT_TEXTURE, GL_COMPUTE_TEXTURE,
+ };
+
+ for (const GLenum target : targets) {
+ for (const GLenum format : formats) {
+ for (const GLenum support : required_support) {
+ GLint value;
+ glGetInternalformativ(GL_TEXTURE_2D, format, support, 1, &value);
+ if (value != GL_FULL_SUPPORT) {
+ return false;
+ }
+ }
+ }
+ }
+ return true;
}
} // Anonymous namespace
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp
index 4faa8b90c..57db5a08b 100644
--- a/src/video_core/renderer_opengl/gl_texture_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp
@@ -404,8 +404,7 @@ View CachedSurface::CreateViewInner(const ViewParams& view_key, const bool is_pr
CachedSurfaceView::CachedSurfaceView(CachedSurface& surface, const ViewParams& params,
bool is_proxy)
- : VideoCommon::ViewBase(params), surface{surface},
- format{GetFormatTuple(surface.GetSurfaceParams().pixel_format).internal_format},
+ : VideoCommon::ViewBase(params), surface{surface}, format{surface.internal_format},
target{GetTextureTarget(params.target)}, is_proxy{is_proxy} {
if (!is_proxy) {
main_view = CreateTextureView();