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
|
@ -14,6 +14,7 @@
|
|||
#include "video_core/regs_framebuffer.h"
|
||||
#include "video_core/swrasterizer/framebuffer.h"
|
||||
#include "video_core/utils.h"
|
||||
#include "video_core/video_core.h"
|
||||
|
||||
namespace Pica {
|
||||
namespace Rasterizer {
|
||||
|
@ -31,7 +32,7 @@ void DrawPixel(int x, int y, const Math::Vec4<u8>& color) {
|
|||
GPU::Regs::BytesPerPixel(GPU::Regs::PixelFormat(framebuffer.color_format.Value()));
|
||||
u32 dst_offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) +
|
||||
coarse_y * framebuffer.width * bytes_per_pixel;
|
||||
u8* dst_pixel = Memory::GetPhysicalPointer(addr) + dst_offset;
|
||||
u8* dst_pixel = VideoCore::g_memory->GetPhysicalPointer(addr) + dst_offset;
|
||||
|
||||
switch (framebuffer.color_format) {
|
||||
case FramebufferRegs::ColorFormat::RGBA8:
|
||||
|
@ -72,7 +73,7 @@ const Math::Vec4<u8> GetPixel(int x, int y) {
|
|||
GPU::Regs::BytesPerPixel(GPU::Regs::PixelFormat(framebuffer.color_format.Value()));
|
||||
u32 src_offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) +
|
||||
coarse_y * framebuffer.width * bytes_per_pixel;
|
||||
u8* src_pixel = Memory::GetPhysicalPointer(addr) + src_offset;
|
||||
u8* src_pixel = VideoCore::g_memory->GetPhysicalPointer(addr) + src_offset;
|
||||
|
||||
switch (framebuffer.color_format) {
|
||||
case FramebufferRegs::ColorFormat::RGBA8:
|
||||
|
@ -102,7 +103,7 @@ const Math::Vec4<u8> GetPixel(int x, int y) {
|
|||
u32 GetDepth(int x, int y) {
|
||||
const auto& framebuffer = g_state.regs.framebuffer.framebuffer;
|
||||
const PAddr addr = framebuffer.GetDepthBufferPhysicalAddress();
|
||||
u8* depth_buffer = Memory::GetPhysicalPointer(addr);
|
||||
u8* depth_buffer = VideoCore::g_memory->GetPhysicalPointer(addr);
|
||||
|
||||
y = framebuffer.height - y;
|
||||
|
||||
|
@ -131,7 +132,7 @@ u32 GetDepth(int x, int y) {
|
|||
u8 GetStencil(int x, int y) {
|
||||
const auto& framebuffer = g_state.regs.framebuffer.framebuffer;
|
||||
const PAddr addr = framebuffer.GetDepthBufferPhysicalAddress();
|
||||
u8* depth_buffer = Memory::GetPhysicalPointer(addr);
|
||||
u8* depth_buffer = VideoCore::g_memory->GetPhysicalPointer(addr);
|
||||
|
||||
y = framebuffer.height - y;
|
||||
|
||||
|
@ -158,7 +159,7 @@ u8 GetStencil(int x, int y) {
|
|||
void SetDepth(int x, int y, u32 value) {
|
||||
const auto& framebuffer = g_state.regs.framebuffer.framebuffer;
|
||||
const PAddr addr = framebuffer.GetDepthBufferPhysicalAddress();
|
||||
u8* depth_buffer = Memory::GetPhysicalPointer(addr);
|
||||
u8* depth_buffer = VideoCore::g_memory->GetPhysicalPointer(addr);
|
||||
|
||||
y = framebuffer.height - y;
|
||||
|
||||
|
@ -193,7 +194,7 @@ void SetDepth(int x, int y, u32 value) {
|
|||
void SetStencil(int x, int y, u8 value) {
|
||||
const auto& framebuffer = g_state.regs.framebuffer.framebuffer;
|
||||
const PAddr addr = framebuffer.GetDepthBufferPhysicalAddress();
|
||||
u8* depth_buffer = Memory::GetPhysicalPointer(addr);
|
||||
u8* depth_buffer = VideoCore::g_memory->GetPhysicalPointer(addr);
|
||||
|
||||
y = framebuffer.height - y;
|
||||
|
||||
|
@ -384,7 +385,7 @@ void DrawShadowMapPixel(int x, int y, u32 depth, u8 stencil) {
|
|||
u32 bytes_per_pixel = 4;
|
||||
u32 dst_offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) +
|
||||
coarse_y * framebuffer.width * bytes_per_pixel;
|
||||
u8* dst_pixel = Memory::GetPhysicalPointer(addr) + dst_offset;
|
||||
u8* dst_pixel = VideoCore::g_memory->GetPhysicalPointer(addr) + dst_offset;
|
||||
|
||||
auto ref = DecodeD24S8Shadow(dst_pixel);
|
||||
u32 ref_z = ref.x;
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "video_core/swrasterizer/texturing.h"
|
||||
#include "video_core/texture/texture_decode.h"
|
||||
#include "video_core/utils.h"
|
||||
#include "video_core/video_core.h"
|
||||
|
||||
namespace Pica {
|
||||
namespace Rasterizer {
|
||||
|
@ -402,7 +403,8 @@ static void ProcessTriangleInternal(const Vertex& v0, const Vertex& v1, const Ve
|
|||
t = texture.config.height - 1 -
|
||||
GetWrappedTexCoord(texture.config.wrap_t, t, texture.config.height);
|
||||
|
||||
const u8* texture_data = Memory::GetPhysicalPointer(texture_address);
|
||||
const u8* texture_data =
|
||||
VideoCore::g_memory->GetPhysicalPointer(texture_address);
|
||||
auto info =
|
||||
Texture::TextureInfo::FromPicaRegister(texture.config, texture.format);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue