mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-22 10:51:50 -05:00
gl_rasterizer: Use ARB_texture_storage.
It allows us to use texture views and it reduces the overhead within the GPU driver. But it disallows us to reallocate the texture, but we don't do so anyways. In the end, it is the new way to allocate textures, so there is no need to use the old way.
This commit is contained in:
parent
1470b85af9
commit
3e973bc4c6
3 changed files with 12 additions and 11 deletions
|
@ -477,30 +477,27 @@ CachedSurface::CachedSurface(const SurfaceParams& params)
|
||||||
// Only pre-create the texture for non-compressed textures.
|
// Only pre-create the texture for non-compressed textures.
|
||||||
switch (params.target) {
|
switch (params.target) {
|
||||||
case SurfaceParams::SurfaceTarget::Texture1D:
|
case SurfaceParams::SurfaceTarget::Texture1D:
|
||||||
glTexImage1D(SurfaceTargetToGL(params.target), 0, format_tuple.internal_format,
|
glTexStorage1D(SurfaceTargetToGL(params.target), 1, format_tuple.internal_format,
|
||||||
rect.GetWidth(), 0, format_tuple.format, format_tuple.type, nullptr);
|
rect.GetWidth());
|
||||||
break;
|
break;
|
||||||
case SurfaceParams::SurfaceTarget::Texture2D:
|
case SurfaceParams::SurfaceTarget::Texture2D:
|
||||||
glTexImage2D(SurfaceTargetToGL(params.target), 0, format_tuple.internal_format,
|
glTexStorage2D(SurfaceTargetToGL(params.target), 1, format_tuple.internal_format,
|
||||||
rect.GetWidth(), rect.GetHeight(), 0, format_tuple.format,
|
rect.GetWidth(), rect.GetHeight());
|
||||||
format_tuple.type, nullptr);
|
|
||||||
break;
|
break;
|
||||||
case SurfaceParams::SurfaceTarget::Texture3D:
|
case SurfaceParams::SurfaceTarget::Texture3D:
|
||||||
case SurfaceParams::SurfaceTarget::Texture2DArray:
|
case SurfaceParams::SurfaceTarget::Texture2DArray:
|
||||||
glTexImage3D(SurfaceTargetToGL(params.target), 0, format_tuple.internal_format,
|
glTexStorage3D(SurfaceTargetToGL(params.target), 1, format_tuple.internal_format,
|
||||||
rect.GetWidth(), rect.GetHeight(), params.depth, 0, format_tuple.format,
|
rect.GetWidth(), rect.GetHeight(), params.depth);
|
||||||
format_tuple.type, nullptr);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG_CRITICAL(Render_OpenGL, "Unimplemented surface target={}",
|
LOG_CRITICAL(Render_OpenGL, "Unimplemented surface target={}",
|
||||||
static_cast<u32>(params.target));
|
static_cast<u32>(params.target));
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, format_tuple.internal_format, rect.GetWidth(),
|
glTexStorage2D(GL_TEXTURE_2D, 1, format_tuple.internal_format, rect.GetWidth(),
|
||||||
rect.GetHeight(), 0, format_tuple.format, format_tuple.type, nullptr);
|
rect.GetHeight());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glTexParameteri(SurfaceTargetToGL(params.target), GL_TEXTURE_MAX_LEVEL, 0);
|
|
||||||
glTexParameteri(SurfaceTargetToGL(params.target), GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri(SurfaceTargetToGL(params.target), GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
glTexParameteri(SurfaceTargetToGL(params.target), GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
glTexParameteri(SurfaceTargetToGL(params.target), GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(SurfaceTargetToGL(params.target), GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
glTexParameteri(SurfaceTargetToGL(params.target), GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
|
|
|
@ -447,6 +447,8 @@ QStringList GMainWindow::GetUnsupportedGLExtensions() {
|
||||||
unsupported_ext.append("ARB_texture_mirror_clamp_to_edge");
|
unsupported_ext.append("ARB_texture_mirror_clamp_to_edge");
|
||||||
if (!GLAD_GL_ARB_base_instance)
|
if (!GLAD_GL_ARB_base_instance)
|
||||||
unsupported_ext.append("ARB_base_instance");
|
unsupported_ext.append("ARB_base_instance");
|
||||||
|
if (!GLAD_GL_ARB_texture_storage)
|
||||||
|
unsupported_ext.append("ARB_texture_storage");
|
||||||
|
|
||||||
// Extensions required to support some texture formats.
|
// Extensions required to support some texture formats.
|
||||||
if (!GLAD_GL_EXT_texture_compression_s3tc)
|
if (!GLAD_GL_EXT_texture_compression_s3tc)
|
||||||
|
|
|
@ -94,6 +94,8 @@ bool EmuWindow_SDL2::SupportsRequiredGLExtensions() {
|
||||||
unsupported_ext.push_back("ARB_texture_mirror_clamp_to_edge");
|
unsupported_ext.push_back("ARB_texture_mirror_clamp_to_edge");
|
||||||
if (!GLAD_GL_ARB_base_instance)
|
if (!GLAD_GL_ARB_base_instance)
|
||||||
unsupported_ext.push_back("ARB_base_instance");
|
unsupported_ext.push_back("ARB_base_instance");
|
||||||
|
if (!GLAD_GL_ARB_texture_storage)
|
||||||
|
unsupported_ext.push_back("ARB_texture_storage");
|
||||||
|
|
||||||
// Extensions required to support some texture formats.
|
// Extensions required to support some texture formats.
|
||||||
if (!GLAD_GL_EXT_texture_compression_s3tc)
|
if (!GLAD_GL_EXT_texture_compression_s3tc)
|
||||||
|
|
Loading…
Reference in a new issue