mirror of https://git.suyu.dev/suyu/suyu
gl_device: Avoid devices with CAVEAT_SUPPORT on ASTC
This avoids using Nvidia's ASTC decoder on OpenGL. The last time it was profiled, it was slower than yuzu's decoder. While we are at it, fix a bug in the texture cache when native ASTC is not supported.
This commit is contained in:
parent
1bb3122c1f
commit
0ee310ebdc
|
@ -133,6 +133,7 @@ std::array<Device::BaseBindings, Tegra::Engines::MaxShaderTypes> BuildBaseBindin
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsASTCSupported() {
|
bool IsASTCSupported() {
|
||||||
|
static constexpr std::array targets = {GL_TEXTURE_2D, GL_TEXTURE_2D_ARRAY};
|
||||||
static constexpr std::array formats = {
|
static constexpr std::array formats = {
|
||||||
GL_COMPRESSED_RGBA_ASTC_4x4_KHR, GL_COMPRESSED_RGBA_ASTC_5x4_KHR,
|
GL_COMPRESSED_RGBA_ASTC_4x4_KHR, GL_COMPRESSED_RGBA_ASTC_5x4_KHR,
|
||||||
GL_COMPRESSED_RGBA_ASTC_5x5_KHR, GL_COMPRESSED_RGBA_ASTC_6x5_KHR,
|
GL_COMPRESSED_RGBA_ASTC_5x5_KHR, GL_COMPRESSED_RGBA_ASTC_6x5_KHR,
|
||||||
|
@ -149,12 +150,23 @@ bool IsASTCSupported() {
|
||||||
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
|
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,
|
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) {
|
static constexpr std::array required_support = {
|
||||||
GLint supported;
|
GL_VERTEX_TEXTURE, GL_TESS_CONTROL_TEXTURE, GL_TESS_EVALUATION_TEXTURE,
|
||||||
glGetInternalformativ(GL_TEXTURE_2D, format, GL_INTERNALFORMAT_SUPPORTED, 1,
|
GL_GEOMETRY_TEXTURE, GL_FRAGMENT_TEXTURE, GL_COMPUTE_TEXTURE,
|
||||||
&supported);
|
};
|
||||||
return supported == GL_TRUE;
|
|
||||||
}) == formats.end();
|
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
|
} // Anonymous namespace
|
||||||
|
|
|
@ -404,8 +404,7 @@ View CachedSurface::CreateViewInner(const ViewParams& view_key, const bool is_pr
|
||||||
|
|
||||||
CachedSurfaceView::CachedSurfaceView(CachedSurface& surface, const ViewParams& params,
|
CachedSurfaceView::CachedSurfaceView(CachedSurface& surface, const ViewParams& params,
|
||||||
bool is_proxy)
|
bool is_proxy)
|
||||||
: VideoCommon::ViewBase(params), surface{surface},
|
: VideoCommon::ViewBase(params), surface{surface}, format{surface.internal_format},
|
||||||
format{GetFormatTuple(surface.GetSurfaceParams().pixel_format).internal_format},
|
|
||||||
target{GetTextureTarget(params.target)}, is_proxy{is_proxy} {
|
target{GetTextureTarget(params.target)}, is_proxy{is_proxy} {
|
||||||
if (!is_proxy) {
|
if (!is_proxy) {
|
||||||
main_view = CreateTextureView();
|
main_view = CreateTextureView();
|
||||||
|
|
Loading…
Reference in New Issue