diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2019-05-11 06:17:47 +0200 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-06-21 02:36:12 +0200 |
commit | 41b4674458595d3d5cd938c06ce651b6d80d305c (patch) | |
tree | b647258e16830af3a22d6be6e5d4e10d54dae781 /src/video_core/renderer_opengl/gl_texture_cache.cpp | |
parent | texture_cache: Add ASync Protections (diff) | |
download | yuzu-41b4674458595d3d5cd938c06ce651b6d80d305c.tar yuzu-41b4674458595d3d5cd938c06ce651b6d80d305c.tar.gz yuzu-41b4674458595d3d5cd938c06ce651b6d80d305c.tar.bz2 yuzu-41b4674458595d3d5cd938c06ce651b6d80d305c.tar.lz yuzu-41b4674458595d3d5cd938c06ce651b6d80d305c.tar.xz yuzu-41b4674458595d3d5cd938c06ce651b6d80d305c.tar.zst yuzu-41b4674458595d3d5cd938c06ce651b6d80d305c.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_opengl/gl_texture_cache.cpp | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index 32cb08963..a55097e5f 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp @@ -228,10 +228,9 @@ CachedSurface::CachedSurface(const GPUVAddr gpu_addr, const SurfaceParams& param target = GetTextureTarget(params.target); texture = CreateTexture(params, target, internal_format); DecorateSurfaceName(); - main_view = CreateView( - ViewParams(params.target, 0, params.is_layered ? params.depth : 1, 0, params.num_levels)); - main_view->DecorateViewName(gpu_addr, - params.TargetName() + "V:" + std::to_string(view_count++)); + main_view = CreateViewInner( + ViewParams(params.target, 0, params.is_layered ? params.depth : 1, 0, params.num_levels), + true); } CachedSurface::~CachedSurface() { @@ -351,16 +350,24 @@ void CachedSurfaceView::DecorateViewName(GPUVAddr gpu_addr, std::string prefix) } View CachedSurface::CreateView(const ViewParams& view_key) { - auto view = std::make_shared<CachedSurfaceView>(*this, view_key); + return CreateViewInner(view_key, false); +} + +View CachedSurface::CreateViewInner(const ViewParams& view_key, const bool is_proxy) { + auto view = std::make_shared<CachedSurfaceView>(*this, view_key, is_proxy); views[view_key] = view; - view->DecorateViewName(gpu_addr, params.TargetName() + "V:" + std::to_string(view_count++)); + if (!is_proxy) + view->DecorateViewName(gpu_addr, params.TargetName() + "V:" + std::to_string(view_count++)); return view; } -CachedSurfaceView::CachedSurfaceView(CachedSurface& surface, const ViewParams& params) - : VideoCommon::ViewBase(params), surface{surface} { +CachedSurfaceView::CachedSurfaceView(CachedSurface& surface, const ViewParams& params, + const bool is_proxy) + : VideoCommon::ViewBase(params), surface{surface}, is_proxy{is_proxy} { target = GetTextureTarget(params.target); - texture_view = CreateTextureView(); + if (!is_proxy) { + texture_view = CreateTextureView(); + } swizzle = EncodeSwizzle(SwizzleSource::R, SwizzleSource::G, SwizzleSource::B, SwizzleSource::A); } @@ -401,7 +408,8 @@ void CachedSurfaceView::ApplySwizzle(SwizzleSource x_source, SwizzleSource y_sou const std::array<GLint, 4> gl_swizzle = {GetSwizzleSource(x_source), GetSwizzleSource(y_source), GetSwizzleSource(z_source), GetSwizzleSource(w_source)}; - glTextureParameteriv(texture_view.handle, GL_TEXTURE_SWIZZLE_RGBA, gl_swizzle.data()); + const GLuint handle = GetTexture(); + glTextureParameteriv(handle, GL_TEXTURE_SWIZZLE_RGBA, gl_swizzle.data()); } OGLTextureView CachedSurfaceView::CreateTextureView() const { |