summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Markus Wick2018-09-11 21:59:40 +0200
committerGravatar Markus Wick2018-09-11 22:18:46 +0200
commit3e973bc4c6c04c61df69518ef428c7cf0d18493d (patch)
tree8b4bbb8b3f9b9d5b00d4eddbfe1aed64652e2e5f /src
parentMerge pull request #1291 from lioncash/default (diff)
downloadyuzu-3e973bc4c6c04c61df69518ef428c7cf0d18493d.tar.gz
yuzu-3e973bc4c6c04c61df69518ef428c7cf0d18493d.tar.xz
yuzu-3e973bc4c6c04c61df69518ef428c7cf0d18493d.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp19
-rw-r--r--src/yuzu/main.cpp2
-rw-r--r--src/yuzu_cmd/emu_window/emu_window_sdl2.cpp2
3 files changed, 12 insertions, 11 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 29d61eccd..ab681f227 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -477,30 +477,27 @@ CachedSurface::CachedSurface(const SurfaceParams& params)
477 // Only pre-create the texture for non-compressed textures. 477 // Only pre-create the texture for non-compressed textures.
478 switch (params.target) { 478 switch (params.target) {
479 case SurfaceParams::SurfaceTarget::Texture1D: 479 case SurfaceParams::SurfaceTarget::Texture1D:
480 glTexImage1D(SurfaceTargetToGL(params.target), 0, format_tuple.internal_format, 480 glTexStorage1D(SurfaceTargetToGL(params.target), 1, format_tuple.internal_format,
481 rect.GetWidth(), 0, format_tuple.format, format_tuple.type, nullptr); 481 rect.GetWidth());
482 break; 482 break;
483 case SurfaceParams::SurfaceTarget::Texture2D: 483 case SurfaceParams::SurfaceTarget::Texture2D:
484 glTexImage2D(SurfaceTargetToGL(params.target), 0, format_tuple.internal_format, 484 glTexStorage2D(SurfaceTargetToGL(params.target), 1, format_tuple.internal_format,
485 rect.GetWidth(), rect.GetHeight(), 0, format_tuple.format, 485 rect.GetWidth(), rect.GetHeight());
486 format_tuple.type, nullptr);
487 break; 486 break;
488 case SurfaceParams::SurfaceTarget::Texture3D: 487 case SurfaceParams::SurfaceTarget::Texture3D:
489 case SurfaceParams::SurfaceTarget::Texture2DArray: 488 case SurfaceParams::SurfaceTarget::Texture2DArray:
490 glTexImage3D(SurfaceTargetToGL(params.target), 0, format_tuple.internal_format, 489 glTexStorage3D(SurfaceTargetToGL(params.target), 1, format_tuple.internal_format,
491 rect.GetWidth(), rect.GetHeight(), params.depth, 0, format_tuple.format, 490 rect.GetWidth(), rect.GetHeight(), params.depth);
492 format_tuple.type, nullptr);
493 break; 491 break;
494 default: 492 default:
495 LOG_CRITICAL(Render_OpenGL, "Unimplemented surface target={}", 493 LOG_CRITICAL(Render_OpenGL, "Unimplemented surface target={}",
496 static_cast<u32>(params.target)); 494 static_cast<u32>(params.target));
497 UNREACHABLE(); 495 UNREACHABLE();
498 glTexImage2D(GL_TEXTURE_2D, 0, format_tuple.internal_format, rect.GetWidth(), 496 glTexStorage2D(GL_TEXTURE_2D, 1, format_tuple.internal_format, rect.GetWidth(),
499 rect.GetHeight(), 0, format_tuple.format, format_tuple.type, nullptr); 497 rect.GetHeight());
500 } 498 }
501 } 499 }
502 500
503 glTexParameteri(SurfaceTargetToGL(params.target), GL_TEXTURE_MAX_LEVEL, 0);
504 glTexParameteri(SurfaceTargetToGL(params.target), GL_TEXTURE_MIN_FILTER, GL_LINEAR); 501 glTexParameteri(SurfaceTargetToGL(params.target), GL_TEXTURE_MIN_FILTER, GL_LINEAR);
505 glTexParameteri(SurfaceTargetToGL(params.target), GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 502 glTexParameteri(SurfaceTargetToGL(params.target), GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
506 glTexParameteri(SurfaceTargetToGL(params.target), GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 503 glTexParameteri(SurfaceTargetToGL(params.target), GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index e36914f14..05a4a55e8 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -447,6 +447,8 @@ QStringList GMainWindow::GetUnsupportedGLExtensions() {
447 unsupported_ext.append("ARB_texture_mirror_clamp_to_edge"); 447 unsupported_ext.append("ARB_texture_mirror_clamp_to_edge");
448 if (!GLAD_GL_ARB_base_instance) 448 if (!GLAD_GL_ARB_base_instance)
449 unsupported_ext.append("ARB_base_instance"); 449 unsupported_ext.append("ARB_base_instance");
450 if (!GLAD_GL_ARB_texture_storage)
451 unsupported_ext.append("ARB_texture_storage");
450 452
451 // Extensions required to support some texture formats. 453 // Extensions required to support some texture formats.
452 if (!GLAD_GL_EXT_texture_compression_s3tc) 454 if (!GLAD_GL_EXT_texture_compression_s3tc)
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
index 1c4717123..d213929bd 100644
--- a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
+++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
@@ -94,6 +94,8 @@ bool EmuWindow_SDL2::SupportsRequiredGLExtensions() {
94 unsupported_ext.push_back("ARB_texture_mirror_clamp_to_edge"); 94 unsupported_ext.push_back("ARB_texture_mirror_clamp_to_edge");
95 if (!GLAD_GL_ARB_base_instance) 95 if (!GLAD_GL_ARB_base_instance)
96 unsupported_ext.push_back("ARB_base_instance"); 96 unsupported_ext.push_back("ARB_base_instance");
97 if (!GLAD_GL_ARB_texture_storage)
98 unsupported_ext.push_back("ARB_texture_storage");
97 99
98 // Extensions required to support some texture formats. 100 // Extensions required to support some texture formats.
99 if (!GLAD_GL_EXT_texture_compression_s3tc) 101 if (!GLAD_GL_EXT_texture_compression_s3tc)