mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
softgpu: Fix display framebuffer read.
This commit is contained in:
parent
7483923d07
commit
78a3925198
2 changed files with 13 additions and 10 deletions
|
@ -490,14 +490,16 @@ void SoftGPU::SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat for
|
|||
|
||||
DSStretch g_DarkStalkerStretch;
|
||||
|
||||
void SoftGPU::ConvertTextureDescFrom16(Draw::TextureDesc &desc, int srcwidth, int srcheight, u8 *overrideData) {
|
||||
void SoftGPU::ConvertTextureDescFrom16(Draw::TextureDesc &desc, int srcwidth, int srcheight, const uint16_t *overrideData) {
|
||||
// TODO: This should probably be converted in a shader instead..
|
||||
fbTexBuffer_.resize(srcwidth * srcheight);
|
||||
FormatBuffer displayBuffer;
|
||||
displayBuffer.data = overrideData ? overrideData : Memory::GetPointerWrite(displayFramebuf_);
|
||||
const uint16_t *displayBuffer = overrideData;
|
||||
if (!displayBuffer)
|
||||
displayBuffer = (const uint16_t *)Memory::GetPointer(displayFramebuf_);
|
||||
|
||||
for (int y = 0; y < srcheight; ++y) {
|
||||
u32 *buf_line = &fbTexBuffer_[y * srcwidth];
|
||||
const u16 *fb_line = &displayBuffer.as16[y * displayStride_];
|
||||
const u16 *fb_line = &displayBuffer[y * displayStride_];
|
||||
|
||||
switch (displayFormat_) {
|
||||
case GE_FORMAT_565:
|
||||
|
@ -557,7 +559,7 @@ void SoftGPU::CopyToCurrentFboFromDisplayRam(int srcwidth, int srcheight) {
|
|||
bool hasPostShader = presentation_ && presentation_->HasPostShader();
|
||||
|
||||
if (PSP_CoreParameter().compat.flags().DarkStalkersPresentHack && displayFormat_ == GE_FORMAT_5551 && g_DarkStalkerStretch != DSStretch::Off) {
|
||||
u8 *data = Memory::GetPointerWrite(0x04088000);
|
||||
const u8 *data = Memory::GetPointerWrite(0x04088000);
|
||||
bool fillDesc = true;
|
||||
if (draw_->GetDataFormatSupport(Draw::DataFormat::A1B5G5R5_UNORM_PACK16) & Draw::FMT_TEXTURE) {
|
||||
// The perfect one.
|
||||
|
@ -567,7 +569,7 @@ void SoftGPU::CopyToCurrentFboFromDisplayRam(int srcwidth, int srcheight) {
|
|||
desc.format = Draw::DataFormat::A1R5G5B5_UNORM_PACK16;
|
||||
outputFlags |= OutputFlags::RB_SWIZZLE;
|
||||
} else {
|
||||
ConvertTextureDescFrom16(desc, srcwidth, srcheight, data);
|
||||
ConvertTextureDescFrom16(desc, srcwidth, srcheight, (const uint16_t *)data);
|
||||
fillDesc = false;
|
||||
}
|
||||
if (fillDesc) {
|
||||
|
@ -586,13 +588,13 @@ void SoftGPU::CopyToCurrentFboFromDisplayRam(int srcwidth, int srcheight) {
|
|||
hasImage = false;
|
||||
u1 = 1.0f;
|
||||
} else if (displayFormat_ == GE_FORMAT_8888) {
|
||||
u8 *data = Memory::GetPointerWrite(displayFramebuf_);
|
||||
const u8 *data = Memory::GetPointer(displayFramebuf_);
|
||||
desc.width = displayStride_ == 0 ? srcwidth : displayStride_;
|
||||
desc.height = srcheight;
|
||||
desc.initData.push_back(data);
|
||||
desc.format = Draw::DataFormat::R8G8B8A8_UNORM;
|
||||
} else if (displayFormat_ == GE_FORMAT_5551) {
|
||||
const u8 *data = Memory::GetPointerWrite(displayFramebuf_);
|
||||
const u8 *data = Memory::GetPointer(displayFramebuf_);
|
||||
bool fillDesc = true;
|
||||
if (draw_->GetDataFormatSupport(Draw::DataFormat::A1B5G5R5_UNORM_PACK16) & Draw::FMT_TEXTURE) {
|
||||
// The perfect one.
|
||||
|
@ -1247,18 +1249,19 @@ bool SoftGPU::GetCurrentFramebuffer(GPUDebugBuffer &buffer, GPUDebugFramebufferT
|
|||
int stride = gstate.FrameBufStride();
|
||||
DrawingCoords size = GetTargetSize(stride);
|
||||
GEBufferFormat fmt = gstate.FrameBufFormat();
|
||||
const u8 *src = fb.data;
|
||||
|
||||
if (type == GPU_DBG_FRAMEBUF_DISPLAY) {
|
||||
size.x = 480;
|
||||
size.y = 272;
|
||||
stride = displayStride_;
|
||||
fmt = displayFormat_;
|
||||
src = Memory::GetPointer(displayFramebuf_);
|
||||
}
|
||||
|
||||
buffer.Allocate(size.x, size.y, fmt);
|
||||
|
||||
const int depth = fmt == GE_FORMAT_8888 ? 4 : 2;
|
||||
const u8 *src = fb.data;
|
||||
u8 *dst = buffer.GetData();
|
||||
const int byteWidth = size.x * depth;
|
||||
for (int16_t y = 0; y < size.y; ++y) {
|
||||
|
|
|
@ -194,7 +194,7 @@ public:
|
|||
protected:
|
||||
void FastRunLoop(DisplayList &list) override;
|
||||
void CopyToCurrentFboFromDisplayRam(int srcwidth, int srcheight);
|
||||
void ConvertTextureDescFrom16(Draw::TextureDesc &desc, int srcwidth, int srcheight, u8 *overrideData = nullptr);
|
||||
void ConvertTextureDescFrom16(Draw::TextureDesc &desc, int srcwidth, int srcheight, const uint16_t *overrideData = nullptr);
|
||||
|
||||
private:
|
||||
void MarkDirty(uint32_t addr, uint32_t stride, uint32_t height, GEBufferFormat fmt, SoftGPUVRAMDirty value);
|
||||
|
|
Loading…
Add table
Reference in a new issue