mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-15 22:54:00 +00:00
Merge pull request #604 from Subv/invalid_textures
GPU: Ignore invalid and disabled textures when drawing.
This commit is contained in:
commit
3d41fdfbba
3 changed files with 12 additions and 3 deletions
|
@ -100,9 +100,9 @@ boost::optional<GPUVAddr> MemoryManager::FindFreeBlock(u64 size, u64 align) {
|
||||||
|
|
||||||
boost::optional<VAddr> MemoryManager::GpuToCpuAddress(GPUVAddr gpu_addr) {
|
boost::optional<VAddr> MemoryManager::GpuToCpuAddress(GPUVAddr gpu_addr) {
|
||||||
VAddr base_addr = PageSlot(gpu_addr);
|
VAddr base_addr = PageSlot(gpu_addr);
|
||||||
ASSERT(base_addr != static_cast<u64>(PageStatus::Unmapped));
|
|
||||||
|
|
||||||
if (base_addr == static_cast<u64>(PageStatus::Allocated)) {
|
if (base_addr == static_cast<u64>(PageStatus::Allocated) ||
|
||||||
|
base_addr == static_cast<u64>(PageStatus::Unmapped)) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -636,7 +636,11 @@ u32 RasterizerOpenGL::SetupTextures(Maxwell::ShaderStage stage, GLuint program,
|
||||||
glProgramUniform1i(program, uniform, current_bindpoint);
|
glProgramUniform1i(program, uniform, current_bindpoint);
|
||||||
|
|
||||||
const auto texture = maxwell3d.GetStageTexture(entry.GetStage(), entry.GetOffset());
|
const auto texture = maxwell3d.GetStageTexture(entry.GetStage(), entry.GetOffset());
|
||||||
ASSERT(texture.enabled);
|
|
||||||
|
if (!texture.enabled) {
|
||||||
|
state.texture_units[current_bindpoint].texture_2d = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
texture_samplers[current_bindpoint].SyncWithConfig(texture.tsc);
|
texture_samplers[current_bindpoint].SyncWithConfig(texture.tsc);
|
||||||
Surface surface = res_cache.GetTextureSurface(texture);
|
Surface surface = res_cache.GetTextureSurface(texture);
|
||||||
|
|
|
@ -461,6 +461,11 @@ Surface RasterizerCacheOpenGL::GetSurface(const SurfaceParams& params) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto& gpu = Core::System::GetInstance().GPU();
|
||||||
|
// Don't try to create any entries in the cache if the address of the texture is invalid.
|
||||||
|
if (gpu.memory_manager->GpuToCpuAddress(params.addr) == boost::none)
|
||||||
|
return {};
|
||||||
|
|
||||||
// Check for an exact match in existing surfaces
|
// Check for an exact match in existing surfaces
|
||||||
const auto& surface_key{SurfaceKey::Create(params)};
|
const auto& surface_key{SurfaceKey::Create(params)};
|
||||||
const auto& search{surface_cache.find(surface_key)};
|
const auto& search{surface_cache.find(surface_key)};
|
||||||
|
|
Loading…
Reference in a new issue