summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2019-06-25 17:40:08 -0400
committerGravatar Fernando Sahmkow2019-06-25 17:40:08 -0400
commit18d24fbdd00ee2d05cd02c2794d56b396118f9d5 (patch)
tree09d8f49d420fc4ef304e833015dd109f92c379f0 /src
parentgl_resource_manager: Correct MakeStreamCopy (diff)
downloadyuzu-18d24fbdd00ee2d05cd02c2794d56b396118f9d5.tar.gz
yuzu-18d24fbdd00ee2d05cd02c2794d56b396118f9d5.tar.xz
yuzu-18d24fbdd00ee2d05cd02c2794d56b396118f9d5.zip
gl_texture_cache: Corrections and fixes
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_texture_cache.cpp16
-rw-r--r--src/video_core/renderer_opengl/gl_texture_cache.h6
2 files changed, 9 insertions, 13 deletions
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp
index c5e3b7a94..d539bf07c 100644
--- a/src/video_core/renderer_opengl/gl_texture_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp
@@ -244,7 +244,6 @@ CachedSurface::~CachedSurface() {
244void CachedSurface::DownloadTexture(std::vector<u8>& staging_buffer) { 244void CachedSurface::DownloadTexture(std::vector<u8>& staging_buffer) {
245 MICROPROFILE_SCOPE(OpenGL_Texture_Download); 245 MICROPROFILE_SCOPE(OpenGL_Texture_Download);
246 246
247 // TODO(Rodrigo): Optimize alignment
248 SCOPE_EXIT({ glPixelStorei(GL_PACK_ROW_LENGTH, 0); }); 247 SCOPE_EXIT({ glPixelStorei(GL_PACK_ROW_LENGTH, 0); });
249 248
250 for (u32 level = 0; level < params.emulated_levels; ++level) { 249 for (u32 level = 0; level < params.emulated_levels; ++level) {
@@ -272,7 +271,6 @@ void CachedSurface::UploadTexture(std::vector<u8>& staging_buffer) {
272} 271}
273 272
274void CachedSurface::UploadTextureMipmap(u32 level, std::vector<u8>& staging_buffer) { 273void CachedSurface::UploadTextureMipmap(u32 level, std::vector<u8>& staging_buffer) {
275 // TODO(Rodrigo): Optimize alignment
276 glPixelStorei(GL_UNPACK_ALIGNMENT, std::min(8U, params.GetRowAlignment(level))); 274 glPixelStorei(GL_UNPACK_ALIGNMENT, std::min(8U, params.GetRowAlignment(level)));
277 glPixelStorei(GL_UNPACK_ROW_LENGTH, static_cast<GLint>(params.GetMipWidth(level))); 275 glPixelStorei(GL_UNPACK_ROW_LENGTH, static_cast<GLint>(params.GetMipWidth(level)));
278 276
@@ -421,10 +419,10 @@ void CachedSurfaceView::ApplySwizzle(SwizzleSource x_source, SwizzleSource y_sou
421 419
422OGLTextureView CachedSurfaceView::CreateTextureView() const { 420OGLTextureView CachedSurfaceView::CreateTextureView() const {
423 const auto& owner_params = surface.GetSurfaceParams(); 421 const auto& owner_params = surface.GetSurfaceParams();
424 OGLTextureView tv; 422 OGLTextureView texture_view;
425 tv.Create(); 423 texture_view.Create();
426 424
427 const GLuint handle{tv.handle}; 425 const GLuint handle{texture_view.handle};
428 const FormatTuple& tuple{ 426 const FormatTuple& tuple{
429 GetFormatTuple(owner_params.pixel_format, owner_params.component_type)}; 427 GetFormatTuple(owner_params.pixel_format, owner_params.component_type)};
430 428
@@ -433,7 +431,7 @@ OGLTextureView CachedSurfaceView::CreateTextureView() const {
433 431
434 ApplyTextureDefaults(owner_params, handle); 432 ApplyTextureDefaults(owner_params, handle);
435 433
436 return tv; 434 return texture_view;
437} 435}
438 436
439TextureCacheOpenGL::TextureCacheOpenGL(Core::System& system, 437TextureCacheOpenGL::TextureCacheOpenGL(Core::System& system,
@@ -529,6 +527,7 @@ void TextureCacheOpenGL::ImageBlit(View& src_view, View& dst_view,
529void TextureCacheOpenGL::BufferCopy(Surface& src_surface, Surface& dst_surface) { 527void TextureCacheOpenGL::BufferCopy(Surface& src_surface, Surface& dst_surface) {
530 const auto& src_params = src_surface->GetSurfaceParams(); 528 const auto& src_params = src_surface->GetSurfaceParams();
531 const auto& dst_params = dst_surface->GetSurfaceParams(); 529 const auto& dst_params = dst_surface->GetSurfaceParams();
530 UNIMPLEMENTED_IF(src_params.num_levels > 1 || dst_params.num_levels > 1);
532 531
533 const auto source_format = GetFormatTuple(src_params.pixel_format, src_params.component_type); 532 const auto source_format = GetFormatTuple(src_params.pixel_format, src_params.component_type);
534 const auto dest_format = GetFormatTuple(dst_params.pixel_format, dst_params.component_type); 533 const auto dest_format = GetFormatTuple(dst_params.pixel_format, dst_params.component_type);
@@ -591,10 +590,7 @@ void TextureCacheOpenGL::BufferCopy(Surface& src_surface, Surface& dst_surface)
591} 590}
592 591
593GLuint TextureCacheOpenGL::FetchPBO(std::size_t buffer_size) { 592GLuint TextureCacheOpenGL::FetchPBO(std::size_t buffer_size) {
594 if (buffer_size < 0) { 593 ASSERT_OR_EXECUTE(buffer_size <= 0, { return 0; });
595 UNREACHABLE();
596 return 0;
597 }
598 const u32 l2 = Common::Log2Ceil64(static_cast<u64>(buffer_size)); 594 const u32 l2 = Common::Log2Ceil64(static_cast<u64>(buffer_size));
599 OGLBuffer& cp = copy_pbo_cache[l2]; 595 OGLBuffer& cp = copy_pbo_cache[l2];
600 if (cp.handle == 0) { 596 if (cp.handle == 0) {
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.h b/src/video_core/renderer_opengl/gl_texture_cache.h
index cdc44a60c..8da81dba3 100644
--- a/src/video_core/renderer_opengl/gl_texture_cache.h
+++ b/src/video_core/renderer_opengl/gl_texture_cache.h
@@ -90,17 +90,17 @@ public:
90 } 90 }
91 91
92 u32 GetWidth() const { 92 u32 GetWidth() const {
93 const auto owner_params = GetSurfaceParams(); 93 const auto& owner_params = GetSurfaceParams();
94 return owner_params.GetMipWidth(params.base_level); 94 return owner_params.GetMipWidth(params.base_level);
95 } 95 }
96 96
97 u32 GetHeight() const { 97 u32 GetHeight() const {
98 const auto owner_params = GetSurfaceParams(); 98 const auto& owner_params = GetSurfaceParams();
99 return owner_params.GetMipHeight(params.base_level); 99 return owner_params.GetMipHeight(params.base_level);
100 } 100 }
101 101
102 u32 GetDepth() const { 102 u32 GetDepth() const {
103 const auto owner_params = GetSurfaceParams(); 103 const auto& owner_params = GetSurfaceParams();
104 return owner_params.GetMipDepth(params.base_level); 104 return owner_params.GetMipDepth(params.base_level);
105 } 105 }
106 106