diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-04-25 18:41:57 +0200 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-06-21 02:36:11 +0200 |
commit | 6c410104f4f6953ac37095aa5e65804bf115c026 (patch) | |
tree | c508c35c4bc1bf436a22888cd6c150dfbe07edc8 /src/video_core/renderer_opengl | |
parent | gl_texture_cache: Implement fermi copies (diff) | |
download | yuzu-6c410104f4f6953ac37095aa5e65804bf115c026.tar yuzu-6c410104f4f6953ac37095aa5e65804bf115c026.tar.gz yuzu-6c410104f4f6953ac37095aa5e65804bf115c026.tar.bz2 yuzu-6c410104f4f6953ac37095aa5e65804bf115c026.tar.lz yuzu-6c410104f4f6953ac37095aa5e65804bf115c026.tar.xz yuzu-6c410104f4f6953ac37095aa5e65804bf115c026.tar.zst yuzu-6c410104f4f6953ac37095aa5e65804bf115c026.zip |
Diffstat (limited to 'src/video_core/renderer_opengl')
-rw-r--r-- | src/video_core/renderer_opengl/gl_texture_cache.cpp | 16 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_texture_cache.h | 17 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/utils.cpp | 2 |
3 files changed, 18 insertions, 17 deletions
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index ca007b797..f7c2f46aa 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp @@ -9,7 +9,7 @@ #include "video_core/renderer_opengl/gl_resource_manager.h" #include "video_core/renderer_opengl/gl_texture_cache.h" #include "video_core/renderer_opengl/utils.h" -#include "video_core/texture_cache/texture_cache_contextless.h" +#include "video_core/texture_cache/texture_cache.h" #include "video_core/textures/convert.h" #include "video_core/textures/texture.h" @@ -18,6 +18,10 @@ namespace OpenGL { using Tegra::Texture::SwizzleSource; using VideoCore::MortonSwizzleMode; +using VideoCore::Surface::ComponentType; +using VideoCore::Surface::PixelFormat; +using VideoCore::Surface::SurfaceTarget; + namespace { struct FormatTuple { @@ -209,8 +213,7 @@ OGLTexture CreateTexture(const SurfaceParams& params, GLenum target, GLenum inte } // Anonymous namespace CachedSurface::CachedSurface(TextureCacheOpenGL& texture_cache, const SurfaceParams& params) - : VideoCommon::SurfaceBaseContextless<TextureCacheOpenGL, CachedSurfaceView>{texture_cache, - params} { + : VideoCommon::SurfaceBase<TextureCacheOpenGL, CachedSurfaceView>{texture_cache, params} { const auto& tuple{GetFormatTuple(params.GetPixelFormat(), params.GetComponentType())}; internal_format = tuple.internal_format; format = tuple.format; @@ -222,7 +225,7 @@ CachedSurface::CachedSurface(TextureCacheOpenGL& texture_cache, const SurfacePar CachedSurface::~CachedSurface() = default; -void CachedSurface::DownloadTextureImpl() { +void CachedSurface::DownloadTexture() { // TODO(Rodrigo): Optimize alignment glPixelStorei(GL_PACK_ALIGNMENT, 1); SCOPE_EXIT({ glPixelStorei(GL_PACK_ROW_LENGTH, 0); }); @@ -241,7 +244,7 @@ void CachedSurface::DownloadTextureImpl() { } } -void CachedSurface::UploadTextureImpl() { +void CachedSurface::UploadTexture() { SCOPE_EXIT({ glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); }); for (u32 level = 0; level < params.GetNumLevels(); ++level) { UploadTextureMipmap(level); @@ -321,7 +324,8 @@ void CachedSurface::UploadTextureMipmap(u32 level) { } void CachedSurface::DecorateSurfaceName() { - LabelGLObject(GL_TEXTURE, texture.handle, GetGpuAddr()); + LabelGLObject(GL_TEXTURE, texture.handle, GetGpuAddr(), + params.GetTarget() == SurfaceTarget::Texture3D ? "3D" : ""); } std::unique_ptr<CachedSurfaceView> CachedSurface::CreateView(const ViewKey& view_key) { diff --git a/src/video_core/renderer_opengl/gl_texture_cache.h b/src/video_core/renderer_opengl/gl_texture_cache.h index b165187d9..c65e37153 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.h +++ b/src/video_core/renderer_opengl/gl_texture_cache.h @@ -14,32 +14,30 @@ #include "common/common_types.h" #include "video_core/engines/shader_bytecode.h" #include "video_core/renderer_opengl/gl_resource_manager.h" -#include "video_core/texture_cache/texture_cache_contextless.h" +#include "video_core/texture_cache/texture_cache.h" namespace OpenGL { using VideoCommon::SurfaceParams; using VideoCommon::ViewKey; -using VideoCore::Surface::ComponentType; -using VideoCore::Surface::PixelFormat; -using VideoCore::Surface::SurfaceTarget; -using VideoCore::Surface::SurfaceType; class CachedSurfaceView; class CachedSurface; class TextureCacheOpenGL; using Surface = std::shared_ptr<CachedSurface>; -using TextureCacheBase = VideoCommon::TextureCacheContextless<CachedSurface, CachedSurfaceView>; +using TextureCacheBase = VideoCommon::TextureCache<CachedSurface, CachedSurfaceView>; -class CachedSurface final - : public VideoCommon::SurfaceBaseContextless<TextureCacheOpenGL, CachedSurfaceView> { +class CachedSurface final : public VideoCommon::SurfaceBase<TextureCacheOpenGL, CachedSurfaceView> { friend CachedSurfaceView; public: explicit CachedSurface(TextureCacheOpenGL& texture_cache, const SurfaceParams& params); ~CachedSurface(); + void UploadTexture(); + void DownloadTexture(); + GLenum GetTarget() const { return target; } @@ -53,9 +51,6 @@ protected: std::unique_ptr<CachedSurfaceView> CreateView(const ViewKey& view_key); - void UploadTextureImpl(); - void DownloadTextureImpl(); - private: void UploadTextureMipmap(u32 level); diff --git a/src/video_core/renderer_opengl/utils.cpp b/src/video_core/renderer_opengl/utils.cpp index d9be61604..5994c0c61 100644 --- a/src/video_core/renderer_opengl/utils.cpp +++ b/src/video_core/renderer_opengl/utils.cpp @@ -18,7 +18,9 @@ namespace OpenGL { using Tegra::Shader::TextureType; using Tegra::Texture::SwizzleSource; + using VideoCore::Surface::SurfaceTarget; +using VideoCore::Surface::SurfaceType; BindBuffersRangePushBuffer::BindBuffersRangePushBuffer(GLenum target) : target{target} {} |