mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-11-03 23:28:48 +00:00 
			
		
		
		
	Memory: move GetPhysicalPointer and IsValidPhysicalAddress into class
This commit is contained in:
		
							parent
							
								
									cfee59c6db
								
							
						
					
					
						commit
						296c458e0e
					
				
					 18 changed files with 76 additions and 65 deletions
				
			
		| 
						 | 
				
			
			@ -24,6 +24,7 @@
 | 
			
		|||
#include "video_core/renderer_opengl/gl_shader_gen.h"
 | 
			
		||||
#include "video_core/renderer_opengl/pica_to_gl.h"
 | 
			
		||||
#include "video_core/renderer_opengl/renderer_opengl.h"
 | 
			
		||||
#include "video_core/video_core.h"
 | 
			
		||||
 | 
			
		||||
namespace OpenGL {
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -259,7 +260,7 @@ RasterizerOpenGL::VertexArrayInfo RasterizerOpenGL::AnalyzeVertexArray(bool is_i
 | 
			
		|||
    if (is_indexed) {
 | 
			
		||||
        const auto& index_info = regs.pipeline.index_array;
 | 
			
		||||
        PAddr address = vertex_attributes.GetPhysicalBaseAddress() + index_info.offset;
 | 
			
		||||
        const u8* index_address_8 = Memory::GetPhysicalPointer(address);
 | 
			
		||||
        const u8* index_address_8 = VideoCore::g_memory->GetPhysicalPointer(address);
 | 
			
		||||
        const u16* index_address_16 = reinterpret_cast<const u16*>(index_address_8);
 | 
			
		||||
        bool index_u16 = index_info.format != 0;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -340,7 +341,7 @@ void RasterizerOpenGL::SetupVertexArray(u8* array_ptr, GLintptr buffer_offset,
 | 
			
		|||
        u32 data_size = loader.byte_count * vertex_num;
 | 
			
		||||
 | 
			
		||||
        res_cache.FlushRegion(data_addr, data_size, nullptr);
 | 
			
		||||
        std::memcpy(array_ptr, Memory::GetPhysicalPointer(data_addr), data_size);
 | 
			
		||||
        std::memcpy(array_ptr, VideoCore::g_memory->GetPhysicalPointer(data_addr), data_size);
 | 
			
		||||
 | 
			
		||||
        array_ptr += data_size;
 | 
			
		||||
        buffer_offset += data_size;
 | 
			
		||||
| 
						 | 
				
			
			@ -471,9 +472,9 @@ bool RasterizerOpenGL::AccelerateDrawBatchInternal(bool is_indexed, bool use_gs)
 | 
			
		|||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        const u8* index_data =
 | 
			
		||||
            Memory::GetPhysicalPointer(regs.pipeline.vertex_attributes.GetPhysicalBaseAddress() +
 | 
			
		||||
                                       regs.pipeline.index_array.offset);
 | 
			
		||||
        const u8* index_data = VideoCore::g_memory->GetPhysicalPointer(
 | 
			
		||||
            regs.pipeline.vertex_attributes.GetPhysicalBaseAddress() +
 | 
			
		||||
            regs.pipeline.index_array.offset);
 | 
			
		||||
        std::tie(buffer_ptr, buffer_offset, std::ignore) = index_buffer.Map(index_buffer_size, 4);
 | 
			
		||||
        std::memcpy(buffer_ptr, index_data, index_buffer_size);
 | 
			
		||||
        index_buffer.Unmap(index_buffer_size);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -134,7 +134,7 @@ static void MortonCopy(u32 stride, u32 height, u8* gl_buffer, PAddr base, PAddr
 | 
			
		|||
        }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    u8* tile_buffer = Memory::GetPhysicalPointer(start);
 | 
			
		||||
    u8* tile_buffer = VideoCore::g_memory->GetPhysicalPointer(start);
 | 
			
		||||
 | 
			
		||||
    if (start < aligned_start && !morton_to_gl) {
 | 
			
		||||
        std::array<u8, tile_size> tmp_buf;
 | 
			
		||||
| 
						 | 
				
			
			@ -625,7 +625,7 @@ MICROPROFILE_DEFINE(OpenGL_SurfaceLoad, "OpenGL", "Surface Load", MP_RGB(128, 19
 | 
			
		|||
void CachedSurface::LoadGLBuffer(PAddr load_start, PAddr load_end) {
 | 
			
		||||
    ASSERT(type != SurfaceType::Fill);
 | 
			
		||||
 | 
			
		||||
    const u8* const texture_src_data = Memory::GetPhysicalPointer(addr);
 | 
			
		||||
    const u8* const texture_src_data = VideoCore::g_memory->GetPhysicalPointer(addr);
 | 
			
		||||
    if (texture_src_data == nullptr)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -680,7 +680,7 @@ void CachedSurface::LoadGLBuffer(PAddr load_start, PAddr load_end) {
 | 
			
		|||
 | 
			
		||||
MICROPROFILE_DEFINE(OpenGL_SurfaceFlush, "OpenGL", "Surface Flush", MP_RGB(128, 192, 64));
 | 
			
		||||
void CachedSurface::FlushGLBuffer(PAddr flush_start, PAddr flush_end) {
 | 
			
		||||
    u8* const dst_buffer = Memory::GetPhysicalPointer(addr);
 | 
			
		||||
    u8* const dst_buffer = VideoCore::g_memory->GetPhysicalPointer(addr);
 | 
			
		||||
    if (dst_buffer == nullptr)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -228,7 +228,7 @@ void RendererOpenGL::LoadFBToScreenInfo(const GPU::Regs::FramebufferConfig& fram
 | 
			
		|||
 | 
			
		||||
        Memory::RasterizerFlushRegion(framebuffer_addr, framebuffer.stride * framebuffer.height);
 | 
			
		||||
 | 
			
		||||
        const u8* framebuffer_data = Memory::GetPhysicalPointer(framebuffer_addr);
 | 
			
		||||
        const u8* framebuffer_data = VideoCore::g_memory->GetPhysicalPointer(framebuffer_addr);
 | 
			
		||||
 | 
			
		||||
        state.texture_units[0].texture_2d = screen_info.texture.resource.handle;
 | 
			
		||||
        state.Apply();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue