summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2018-07-02 11:48:18 -0400
committerGravatar GitHub2018-07-02 11:48:18 -0400
commit3d41fdfbba48f92e8d433085cc66cd4ef50b03ab (patch)
treea7441d8c1c03d0e1ebe7a81b5e4a01f1de45251c /src
parentMerge pull request #602 from Subv/mufu_subop (diff)
parentGPU: Ignore disabled textures and textures with an invalid address. (diff)
downloadyuzu-3d41fdfbba48f92e8d433085cc66cd4ef50b03ab.tar.gz
yuzu-3d41fdfbba48f92e8d433085cc66cd4ef50b03ab.tar.xz
yuzu-3d41fdfbba48f92e8d433085cc66cd4ef50b03ab.zip
Merge pull request #604 from Subv/invalid_textures
GPU: Ignore invalid and disabled textures when drawing.
Diffstat (limited to '')
-rw-r--r--src/video_core/memory_manager.cpp4
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp6
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp5
3 files changed, 12 insertions, 3 deletions
diff --git a/src/video_core/memory_manager.cpp b/src/video_core/memory_manager.cpp
index 5cefce9fc..2f814a184 100644
--- a/src/video_core/memory_manager.cpp
+++ b/src/video_core/memory_manager.cpp
@@ -100,9 +100,9 @@ boost::optional<GPUVAddr> MemoryManager::FindFreeBlock(u64 size, u64 align) {
100 100
101boost::optional<VAddr> MemoryManager::GpuToCpuAddress(GPUVAddr gpu_addr) { 101boost::optional<VAddr> MemoryManager::GpuToCpuAddress(GPUVAddr gpu_addr) {
102 VAddr base_addr = PageSlot(gpu_addr); 102 VAddr base_addr = PageSlot(gpu_addr);
103 ASSERT(base_addr != static_cast<u64>(PageStatus::Unmapped));
104 103
105 if (base_addr == static_cast<u64>(PageStatus::Allocated)) { 104 if (base_addr == static_cast<u64>(PageStatus::Allocated) ||
105 base_addr == static_cast<u64>(PageStatus::Unmapped)) {
106 return {}; 106 return {};
107 } 107 }
108 108
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 62ee45a36..45560fbee 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -636,7 +636,11 @@ u32 RasterizerOpenGL::SetupTextures(Maxwell::ShaderStage stage, GLuint program,
636 glProgramUniform1i(program, uniform, current_bindpoint); 636 glProgramUniform1i(program, uniform, current_bindpoint);
637 637
638 const auto texture = maxwell3d.GetStageTexture(entry.GetStage(), entry.GetOffset()); 638 const auto texture = maxwell3d.GetStageTexture(entry.GetStage(), entry.GetOffset());
639 ASSERT(texture.enabled); 639
640 if (!texture.enabled) {
641 state.texture_units[current_bindpoint].texture_2d = 0;
642 continue;
643 }
640 644
641 texture_samplers[current_bindpoint].SyncWithConfig(texture.tsc); 645 texture_samplers[current_bindpoint].SyncWithConfig(texture.tsc);
642 Surface surface = res_cache.GetTextureSurface(texture); 646 Surface surface = res_cache.GetTextureSurface(texture);
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index ae48378f3..9410ddb4e 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -461,6 +461,11 @@ Surface RasterizerCacheOpenGL::GetSurface(const SurfaceParams& params) {
461 return {}; 461 return {};
462 } 462 }
463 463
464 const auto& gpu = Core::System::GetInstance().GPU();
465 // Don't try to create any entries in the cache if the address of the texture is invalid.
466 if (gpu.memory_manager->GpuToCpuAddress(params.addr) == boost::none)
467 return {};
468
464 // Check for an exact match in existing surfaces 469 // Check for an exact match in existing surfaces
465 const auto& surface_key{SurfaceKey::Create(params)}; 470 const auto& surface_key{SurfaceKey::Create(params)};
466 const auto& search{surface_cache.find(surface_key)}; 471 const auto& search{surface_cache.find(surface_key)};