summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2020-04-08 19:34:59 +0200
committerFernando Sahmkow <fsahmkow27@gmail.com>2020-04-08 19:40:46 +0200
commit913f42a3a70d716fa65d639dc4a6dfc9687eec61 (patch)
tree9f95aba901fa11f748f54bcaa39e6c87ff08c802 /src/video_core
parentGPUMemoryManager: Improve safety of memory reads. (diff)
downloadyuzu-913f42a3a70d716fa65d639dc4a6dfc9687eec61.tar
yuzu-913f42a3a70d716fa65d639dc4a6dfc9687eec61.tar.gz
yuzu-913f42a3a70d716fa65d639dc4a6dfc9687eec61.tar.bz2
yuzu-913f42a3a70d716fa65d639dc4a6dfc9687eec61.tar.lz
yuzu-913f42a3a70d716fa65d639dc4a6dfc9687eec61.tar.xz
yuzu-913f42a3a70d716fa65d639dc4a6dfc9687eec61.tar.zst
yuzu-913f42a3a70d716fa65d639dc4a6dfc9687eec61.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/memory_manager.h3
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp4
-rw-r--r--src/video_core/renderer_vulkan/vk_rasterizer.cpp4
3 files changed, 7 insertions, 4 deletions
diff --git a/src/video_core/memory_manager.h b/src/video_core/memory_manager.h
index 987400fdd..0d9468535 100644
--- a/src/video_core/memory_manager.h
+++ b/src/video_core/memory_manager.h
@@ -97,6 +97,9 @@ public:
void WriteBlockUnsafe(GPUVAddr dest_addr, const void* src_buffer, std::size_t size);
void CopyBlockUnsafe(GPUVAddr dest_addr, GPUVAddr src_addr, std::size_t size);
+ /**
+ * IsGranularRange checks if a gpu region can be simply read with a pointer
+ */
bool IsGranularRange(GPUVAddr gpu_addr, std::size_t size);
private:
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 93a6c72f8..368f399df 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -658,7 +658,7 @@ void RasterizerOpenGL::FlushAll() {}
void RasterizerOpenGL::FlushRegion(VAddr addr, u64 size) {
MICROPROFILE_SCOPE(OpenGL_CacheManagement);
- if (!addr || !size) {
+ if (addr == 0 || size == 0) {
return;
}
texture_cache.FlushRegion(addr, size);
@@ -668,7 +668,7 @@ void RasterizerOpenGL::FlushRegion(VAddr addr, u64 size) {
void RasterizerOpenGL::InvalidateRegion(VAddr addr, u64 size) {
MICROPROFILE_SCOPE(OpenGL_CacheManagement);
- if (!addr || !size) {
+ if (addr == 0 || size == 0) {
return;
}
texture_cache.InvalidateRegion(addr, size);
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
index 1466018fa..30eaeba6c 100644
--- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp
+++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
@@ -496,7 +496,7 @@ void RasterizerVulkan::Query(GPUVAddr gpu_addr, VideoCore::QueryType type,
void RasterizerVulkan::FlushAll() {}
void RasterizerVulkan::FlushRegion(VAddr addr, u64 size) {
- if (!addr || !size) {
+ if (addr == 0 || size == 0) {
return;
}
CacheAddr cache_addr = ToCacheAddr(system.Memory().GetPointer(addr));
@@ -506,7 +506,7 @@ void RasterizerVulkan::FlushRegion(VAddr addr, u64 size) {
}
void RasterizerVulkan::InvalidateRegion(VAddr addr, u64 size) {
- if (!addr || !size) {
+ if (addr == 0 || size == 0) {
return;
}
texture_cache.InvalidateRegion(addr, size);