summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2018-03-22 21:13:46 -0400
committerGravatar bunnei2018-03-22 21:13:46 -0400
commit8a250de987404034a4cf1a09f244c40947b4be9b (patch)
treef462c46dc16e229586026501f9c91b223812248b /src
parentvideo_core: Move FramebufferInfo to FramebufferConfig in GPU. (diff)
downloadyuzu-8a250de987404034a4cf1a09f244c40947b4be9b.tar.gz
yuzu-8a250de987404034a4cf1a09f244c40947b4be9b.tar.xz
yuzu-8a250de987404034a4cf1a09f244c40947b4be9b.zip
video_core: Remove usage of PAddr and replace with VAddr.
Diffstat (limited to 'src')
-rw-r--r--src/video_core/rasterizer_interface.h8
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp8
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.h8
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp36
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h18
5 files changed, 39 insertions, 39 deletions
diff --git a/src/video_core/rasterizer_interface.h b/src/video_core/rasterizer_interface.h
index 966e25f34..6514d7ded 100644
--- a/src/video_core/rasterizer_interface.h
+++ b/src/video_core/rasterizer_interface.h
@@ -25,14 +25,14 @@ public:
25 virtual void FlushAll() = 0; 25 virtual void FlushAll() = 0;
26 26
27 /// Notify rasterizer that any caches of the specified region should be flushed to 3DS memory 27 /// Notify rasterizer that any caches of the specified region should be flushed to 3DS memory
28 virtual void FlushRegion(PAddr addr, u32 size) = 0; 28 virtual void FlushRegion(VAddr addr, u32 size) = 0;
29 29
30 /// Notify rasterizer that any caches of the specified region should be invalidated 30 /// Notify rasterizer that any caches of the specified region should be invalidated
31 virtual void InvalidateRegion(PAddr addr, u32 size) = 0; 31 virtual void InvalidateRegion(VAddr addr, u32 size) = 0;
32 32
33 /// Notify rasterizer that any caches of the specified region should be flushed to 3DS memory 33 /// Notify rasterizer that any caches of the specified region should be flushed to 3DS memory
34 /// and invalidated 34 /// and invalidated
35 virtual void FlushAndInvalidateRegion(PAddr addr, u32 size) = 0; 35 virtual void FlushAndInvalidateRegion(VAddr addr, u32 size) = 0;
36 36
37 /// Attempt to use a faster method to perform a display transfer with is_texture_copy = 0 37 /// Attempt to use a faster method to perform a display transfer with is_texture_copy = 0
38 virtual bool AccelerateDisplayTransfer(const void* config) { 38 virtual bool AccelerateDisplayTransfer(const void* config) {
@@ -51,7 +51,7 @@ public:
51 51
52 /// Attempt to use a faster method to display the framebuffer to screen 52 /// Attempt to use a faster method to display the framebuffer to screen
53 virtual bool AccelerateDisplay(const Tegra::FramebufferConfig& framebuffer, 53 virtual bool AccelerateDisplay(const Tegra::FramebufferConfig& framebuffer,
54 PAddr framebuffer_addr, u32 pixel_stride, 54 VAddr framebuffer_addr, u32 pixel_stride,
55 ScreenInfo& screen_info) { 55 ScreenInfo& screen_info) {
56 return false; 56 return false;
57 } 57 }
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index abc6607b0..20e192ec9 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -194,17 +194,17 @@ void RasterizerOpenGL::FlushAll() {
194 res_cache.FlushAll(); 194 res_cache.FlushAll();
195} 195}
196 196
197void RasterizerOpenGL::FlushRegion(PAddr addr, u32 size) { 197void RasterizerOpenGL::FlushRegion(VAddr addr, u32 size) {
198 MICROPROFILE_SCOPE(OpenGL_CacheManagement); 198 MICROPROFILE_SCOPE(OpenGL_CacheManagement);
199 res_cache.FlushRegion(addr, size); 199 res_cache.FlushRegion(addr, size);
200} 200}
201 201
202void RasterizerOpenGL::InvalidateRegion(PAddr addr, u32 size) { 202void RasterizerOpenGL::InvalidateRegion(VAddr addr, u32 size) {
203 MICROPROFILE_SCOPE(OpenGL_CacheManagement); 203 MICROPROFILE_SCOPE(OpenGL_CacheManagement);
204 res_cache.InvalidateRegion(addr, size, nullptr); 204 res_cache.InvalidateRegion(addr, size, nullptr);
205} 205}
206 206
207void RasterizerOpenGL::FlushAndInvalidateRegion(PAddr addr, u32 size) { 207void RasterizerOpenGL::FlushAndInvalidateRegion(VAddr addr, u32 size) {
208 MICROPROFILE_SCOPE(OpenGL_CacheManagement); 208 MICROPROFILE_SCOPE(OpenGL_CacheManagement);
209 res_cache.FlushRegion(addr, size); 209 res_cache.FlushRegion(addr, size);
210 res_cache.InvalidateRegion(addr, size, nullptr); 210 res_cache.InvalidateRegion(addr, size, nullptr);
@@ -227,7 +227,7 @@ bool RasterizerOpenGL::AccelerateFill(const void* config) {
227} 227}
228 228
229bool RasterizerOpenGL::AccelerateDisplay(const Tegra::FramebufferConfig& framebuffer, 229bool RasterizerOpenGL::AccelerateDisplay(const Tegra::FramebufferConfig& framebuffer,
230 PAddr framebuffer_addr, u32 pixel_stride, 230 VAddr framebuffer_addr, u32 pixel_stride,
231 ScreenInfo& screen_info) { 231 ScreenInfo& screen_info) {
232 ASSERT_MSG(false, "Unimplemented"); 232 ASSERT_MSG(false, "Unimplemented");
233 return true; 233 return true;
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h
index 8f213404d..f5c7b1162 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer.h
@@ -32,13 +32,13 @@ public:
32 void DrawTriangles() override; 32 void DrawTriangles() override;
33 void NotifyMaxwellRegisterChanged(u32 id) override; 33 void NotifyMaxwellRegisterChanged(u32 id) override;
34 void FlushAll() override; 34 void FlushAll() override;
35 void FlushRegion(PAddr addr, u32 size) override; 35 void FlushRegion(VAddr addr, u32 size) override;
36 void InvalidateRegion(PAddr addr, u32 size) override; 36 void InvalidateRegion(VAddr addr, u32 size) override;
37 void FlushAndInvalidateRegion(PAddr addr, u32 size) override; 37 void FlushAndInvalidateRegion(VAddr addr, u32 size) override;
38 bool AccelerateDisplayTransfer(const void* config) override; 38 bool AccelerateDisplayTransfer(const void* config) override;
39 bool AccelerateTextureCopy(const void* config) override; 39 bool AccelerateTextureCopy(const void* config) override;
40 bool AccelerateFill(const void* config) override; 40 bool AccelerateFill(const void* config) override;
41 bool AccelerateDisplay(const Tegra::FramebufferConfig& framebuffer, PAddr framebuffer_addr, 41 bool AccelerateDisplay(const Tegra::FramebufferConfig& framebuffer, VAddr framebuffer_addr,
42 u32 pixel_stride, ScreenInfo& screen_info) override; 42 u32 pixel_stride, ScreenInfo& screen_info) override;
43 bool AccelerateDrawBatch(bool is_indexed) override; 43 bool AccelerateDrawBatch(bool is_indexed) override;
44 44
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 939391639..7ef08980f 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -107,7 +107,7 @@ static void MortonCopyTile(u32 stride, u8* tile_buffer, u8* gl_buffer) {
107} 107}
108 108
109template <bool morton_to_gl, PixelFormat format> 109template <bool morton_to_gl, PixelFormat format>
110static void MortonCopy(u32 stride, u32 height, u8* gl_buffer, PAddr base, PAddr start, PAddr end) { 110static void MortonCopy(u32 stride, u32 height, u8* gl_buffer, VAddr base, VAddr start, VAddr end) {
111 constexpr u32 bytes_per_pixel = SurfaceParams::GetFormatBpp(format) / 8; 111 constexpr u32 bytes_per_pixel = SurfaceParams::GetFormatBpp(format) / 8;
112 constexpr u32 tile_size = bytes_per_pixel * 64; 112 constexpr u32 tile_size = bytes_per_pixel * 64;
113 113
@@ -115,9 +115,9 @@ static void MortonCopy(u32 stride, u32 height, u8* gl_buffer, PAddr base, PAddr
115 static_assert(gl_bytes_per_pixel >= bytes_per_pixel, ""); 115 static_assert(gl_bytes_per_pixel >= bytes_per_pixel, "");
116 gl_buffer += gl_bytes_per_pixel - bytes_per_pixel; 116 gl_buffer += gl_bytes_per_pixel - bytes_per_pixel;
117 117
118 const PAddr aligned_down_start = base + Common::AlignDown(start - base, tile_size); 118 const VAddr aligned_down_start = base + Common::AlignDown(start - base, tile_size);
119 const PAddr aligned_start = base + Common::AlignUp(start - base, tile_size); 119 const VAddr aligned_start = base + Common::AlignUp(start - base, tile_size);
120 const PAddr aligned_end = base + Common::AlignDown(end - base, tile_size); 120 const VAddr aligned_end = base + Common::AlignDown(end - base, tile_size);
121 121
122 ASSERT(!morton_to_gl || (aligned_start == start && aligned_end == end)); 122 ASSERT(!morton_to_gl || (aligned_start == start && aligned_end == end));
123 123
@@ -136,7 +136,7 @@ static void MortonCopy(u32 stride, u32 height, u8* gl_buffer, PAddr base, PAddr
136 } 136 }
137 }; 137 };
138 138
139 u8* tile_buffer = Memory::GetPhysicalPointer(start); 139 u8* tile_buffer = Memory::GetPointer(start);
140 140
141 if (start < aligned_start && !morton_to_gl) { 141 if (start < aligned_start && !morton_to_gl) {
142 std::array<u8, tile_size> tmp_buf; 142 std::array<u8, tile_size> tmp_buf;
@@ -162,7 +162,7 @@ static void MortonCopy(u32 stride, u32 height, u8* gl_buffer, PAddr base, PAddr
162 } 162 }
163} 163}
164 164
165static constexpr std::array<void (*)(u32, u32, u8*, PAddr, PAddr, PAddr), 18> morton_to_gl_fns = { 165static constexpr std::array<void (*)(u32, u32, u8*, VAddr, VAddr, VAddr), 18> morton_to_gl_fns = {
166 MortonCopy<true, PixelFormat::RGBA8>, // 0 166 MortonCopy<true, PixelFormat::RGBA8>, // 0
167 MortonCopy<true, PixelFormat::RGB8>, // 1 167 MortonCopy<true, PixelFormat::RGB8>, // 1
168 MortonCopy<true, PixelFormat::RGB5A1>, // 2 168 MortonCopy<true, PixelFormat::RGB5A1>, // 2
@@ -183,7 +183,7 @@ static constexpr std::array<void (*)(u32, u32, u8*, PAddr, PAddr, PAddr), 18> mo
183 MortonCopy<true, PixelFormat::D24S8> // 17 183 MortonCopy<true, PixelFormat::D24S8> // 17
184}; 184};
185 185
186static constexpr std::array<void (*)(u32, u32, u8*, PAddr, PAddr, PAddr), 18> gl_to_morton_fns = { 186static constexpr std::array<void (*)(u32, u32, u8*, VAddr, VAddr, VAddr), 18> gl_to_morton_fns = {
187 MortonCopy<false, PixelFormat::RGBA8>, // 0 187 MortonCopy<false, PixelFormat::RGBA8>, // 0
188 MortonCopy<false, PixelFormat::RGB8>, // 1 188 MortonCopy<false, PixelFormat::RGB8>, // 1
189 MortonCopy<false, PixelFormat::RGB5A1>, // 2 189 MortonCopy<false, PixelFormat::RGB5A1>, // 2
@@ -298,9 +298,9 @@ SurfaceParams SurfaceParams::FromInterval(SurfaceInterval interval) const {
298 SurfaceParams params = *this; 298 SurfaceParams params = *this;
299 const u32 tiled_size = is_tiled ? 8 : 1; 299 const u32 tiled_size = is_tiled ? 8 : 1;
300 const u64 stride_tiled_bytes = BytesInPixels(stride * tiled_size); 300 const u64 stride_tiled_bytes = BytesInPixels(stride * tiled_size);
301 PAddr aligned_start = 301 VAddr aligned_start =
302 addr + Common::AlignDown(boost::icl::first(interval) - addr, stride_tiled_bytes); 302 addr + Common::AlignDown(boost::icl::first(interval) - addr, stride_tiled_bytes);
303 PAddr aligned_end = 303 VAddr aligned_end =
304 addr + Common::AlignUp(boost::icl::last_next(interval) - addr, stride_tiled_bytes); 304 addr + Common::AlignUp(boost::icl::last_next(interval) - addr, stride_tiled_bytes);
305 305
306 if (aligned_end - aligned_start > stride_tiled_bytes) { 306 if (aligned_end - aligned_start > stride_tiled_bytes) {
@@ -527,10 +527,10 @@ void RasterizerCacheOpenGL::CopySurface(const Surface& src_surface, const Surfac
527} 527}
528 528
529MICROPROFILE_DEFINE(OpenGL_SurfaceLoad, "OpenGL", "Surface Load", MP_RGB(128, 64, 192)); 529MICROPROFILE_DEFINE(OpenGL_SurfaceLoad, "OpenGL", "Surface Load", MP_RGB(128, 64, 192));
530void CachedSurface::LoadGLBuffer(PAddr load_start, PAddr load_end) { 530void CachedSurface::LoadGLBuffer(VAddr load_start, VAddr load_end) {
531 ASSERT(type != SurfaceType::Fill); 531 ASSERT(type != SurfaceType::Fill);
532 532
533 const u8* const texture_src_data = Memory::GetPhysicalPointer(addr); 533 const u8* const texture_src_data = Memory::GetPointer(addr);
534 if (texture_src_data == nullptr) 534 if (texture_src_data == nullptr)
535 return; 535 return;
536 536
@@ -549,7 +549,7 @@ void CachedSurface::LoadGLBuffer(PAddr load_start, PAddr load_end) {
549 MICROPROFILE_SCOPE(OpenGL_SurfaceLoad); 549 MICROPROFILE_SCOPE(OpenGL_SurfaceLoad);
550 550
551 ASSERT(load_start >= addr && load_end <= end); 551 ASSERT(load_start >= addr && load_end <= end);
552 const u32 start_offset = load_start - addr; 552 const u64 start_offset = load_start - addr;
553 553
554 if (!is_tiled) { 554 if (!is_tiled) {
555 ASSERT(type == SurfaceType::Color); 555 ASSERT(type == SurfaceType::Color);
@@ -566,8 +566,8 @@ void CachedSurface::LoadGLBuffer(PAddr load_start, PAddr load_end) {
566} 566}
567 567
568MICROPROFILE_DEFINE(OpenGL_SurfaceFlush, "OpenGL", "Surface Flush", MP_RGB(128, 192, 64)); 568MICROPROFILE_DEFINE(OpenGL_SurfaceFlush, "OpenGL", "Surface Flush", MP_RGB(128, 192, 64));
569void CachedSurface::FlushGLBuffer(PAddr flush_start, PAddr flush_end) { 569void CachedSurface::FlushGLBuffer(VAddr flush_start, VAddr flush_end) {
570 u8* const dst_buffer = Memory::GetPhysicalPointer(addr); 570 u8* const dst_buffer = Memory::GetPointer(addr);
571 if (dst_buffer == nullptr) 571 if (dst_buffer == nullptr)
572 return; 572 return;
573 573
@@ -1167,7 +1167,7 @@ void RasterizerCacheOpenGL::DuplicateSurface(const Surface& src_surface,
1167 } 1167 }
1168} 1168}
1169 1169
1170void RasterizerCacheOpenGL::ValidateSurface(const Surface& surface, PAddr addr, u64 size) { 1170void RasterizerCacheOpenGL::ValidateSurface(const Surface& surface, VAddr addr, u64 size) {
1171 if (size == 0) 1171 if (size == 0)
1172 return; 1172 return;
1173 1173
@@ -1227,7 +1227,7 @@ void RasterizerCacheOpenGL::ValidateSurface(const Surface& surface, PAddr addr,
1227 } 1227 }
1228} 1228}
1229 1229
1230void RasterizerCacheOpenGL::FlushRegion(PAddr addr, u64 size, Surface flush_surface) { 1230void RasterizerCacheOpenGL::FlushRegion(VAddr addr, u64 size, Surface flush_surface) {
1231 if (size == 0) 1231 if (size == 0)
1232 return; 1232 return;
1233 1233
@@ -1263,7 +1263,7 @@ void RasterizerCacheOpenGL::FlushAll() {
1263 FlushRegion(0, 0xFFFFFFFF); 1263 FlushRegion(0, 0xFFFFFFFF);
1264} 1264}
1265 1265
1266void RasterizerCacheOpenGL::InvalidateRegion(PAddr addr, u64 size, const Surface& region_owner) { 1266void RasterizerCacheOpenGL::InvalidateRegion(VAddr addr, u64 size, const Surface& region_owner) {
1267 if (size == 0) 1267 if (size == 0)
1268 return; 1268 return;
1269 1269
@@ -1356,6 +1356,6 @@ void RasterizerCacheOpenGL::UnregisterSurface(const Surface& surface) {
1356 surface_cache.subtract({surface->GetInterval(), SurfaceSet{surface}}); 1356 surface_cache.subtract({surface->GetInterval(), SurfaceSet{surface}});
1357} 1357}
1358 1358
1359void RasterizerCacheOpenGL::UpdatePagesCachedCount(PAddr addr, u64 size, int delta) { 1359void RasterizerCacheOpenGL::UpdatePagesCachedCount(VAddr addr, u64 size, int delta) {
1360 // ASSERT_MSG(false, "Unimplemented"); 1360 // ASSERT_MSG(false, "Unimplemented");
1361} 1361}
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
index 828e62852..2172a9d24 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -28,9 +28,9 @@ struct CachedSurface;
28using Surface = std::shared_ptr<CachedSurface>; 28using Surface = std::shared_ptr<CachedSurface>;
29using SurfaceSet = std::set<Surface>; 29using SurfaceSet = std::set<Surface>;
30 30
31using SurfaceRegions = boost::icl::interval_set<PAddr>; 31using SurfaceRegions = boost::icl::interval_set<VAddr>;
32using SurfaceMap = boost::icl::interval_map<PAddr, Surface>; 32using SurfaceMap = boost::icl::interval_map<VAddr, Surface>;
33using SurfaceCache = boost::icl::interval_map<PAddr, SurfaceSet>; 33using SurfaceCache = boost::icl::interval_map<VAddr, SurfaceSet>;
34 34
35using SurfaceInterval = SurfaceCache::interval_type; 35using SurfaceInterval = SurfaceCache::interval_type;
36static_assert(std::is_same<SurfaceRegions::interval_type, SurfaceCache::interval_type>() && 36static_assert(std::is_same<SurfaceRegions::interval_type, SurfaceCache::interval_type>() &&
@@ -258,8 +258,8 @@ struct CachedSurface : SurfaceParams {
258 size_t gl_buffer_size = 0; 258 size_t gl_buffer_size = 0;
259 259
260 // Read/Write data in 3DS memory to/from gl_buffer 260 // Read/Write data in 3DS memory to/from gl_buffer
261 void LoadGLBuffer(PAddr load_start, PAddr load_end); 261 void LoadGLBuffer(VAddr load_start, VAddr load_end);
262 void FlushGLBuffer(PAddr flush_start, PAddr flush_end); 262 void FlushGLBuffer(VAddr flush_start, VAddr flush_end);
263 263
264 // Upload/Download data in gl_buffer in/to this surface's texture 264 // Upload/Download data in gl_buffer in/to this surface's texture
265 void UploadGLTexture(const MathUtil::Rectangle<u32>& rect, GLuint read_fb_handle, 265 void UploadGLTexture(const MathUtil::Rectangle<u32>& rect, GLuint read_fb_handle,
@@ -307,10 +307,10 @@ public:
307 SurfaceRect_Tuple GetTexCopySurface(const SurfaceParams& params); 307 SurfaceRect_Tuple GetTexCopySurface(const SurfaceParams& params);
308 308
309 /// Write any cached resources overlapping the region back to memory (if dirty) 309 /// Write any cached resources overlapping the region back to memory (if dirty)
310 void FlushRegion(PAddr addr, u64 size, Surface flush_surface = nullptr); 310 void FlushRegion(VAddr addr, u64 size, Surface flush_surface = nullptr);
311 311
312 /// Mark region as being invalidated by region_owner (nullptr if 3DS memory) 312 /// Mark region as being invalidated by region_owner (nullptr if 3DS memory)
313 void InvalidateRegion(PAddr addr, u64 size, const Surface& region_owner); 313 void InvalidateRegion(VAddr addr, u64 size, const Surface& region_owner);
314 314
315 /// Flush all cached resources tracked by this cache manager 315 /// Flush all cached resources tracked by this cache manager
316 void FlushAll(); 316 void FlushAll();
@@ -319,7 +319,7 @@ private:
319 void DuplicateSurface(const Surface& src_surface, const Surface& dest_surface); 319 void DuplicateSurface(const Surface& src_surface, const Surface& dest_surface);
320 320
321 /// Update surface's texture for given region when necessary 321 /// Update surface's texture for given region when necessary
322 void ValidateSurface(const Surface& surface, PAddr addr, u64 size); 322 void ValidateSurface(const Surface& surface, VAddr addr, u64 size);
323 323
324 /// Create a new surface 324 /// Create a new surface
325 Surface CreateSurface(const SurfaceParams& params); 325 Surface CreateSurface(const SurfaceParams& params);
@@ -331,7 +331,7 @@ private:
331 void UnregisterSurface(const Surface& surface); 331 void UnregisterSurface(const Surface& surface);
332 332
333 /// Increase/decrease the number of surface in pages touching the specified region 333 /// Increase/decrease the number of surface in pages touching the specified region
334 void UpdatePagesCachedCount(PAddr addr, u64 size, int delta); 334 void UpdatePagesCachedCount(VAddr addr, u64 size, int delta);
335 335
336 SurfaceCache surface_cache; 336 SurfaceCache surface_cache;
337 PageMap cached_pages; 337 PageMap cached_pages;