mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-27 02:10:34 +00:00
Some reorg in preparation for FBO work
This commit is contained in:
parent
14a59fdc75
commit
91e1cce17e
@ -48,4 +48,9 @@ struct CoreParameter
|
||||
bool enableDebugging; // enables breakpoints and other time-consuming debugger features
|
||||
bool printfEmuLog; // writes "emulator:" logging to stdout
|
||||
bool headLess; // Try to avoid messageboxes etc
|
||||
|
||||
int renderWidth;
|
||||
int renderHeight;
|
||||
int outputWidth;
|
||||
int outputHeight;
|
||||
};
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "sceAudio.h"
|
||||
#include "../Host.h"
|
||||
#include "../Config.h"
|
||||
#include "../System.h"
|
||||
#include "../Core/Core.h"
|
||||
#include "sceDisplay.h"
|
||||
#include "sceKernel.h"
|
||||
@ -44,7 +45,6 @@ extern ShaderManager shaderManager;
|
||||
struct FrameBufferState
|
||||
{
|
||||
u32 topaddr;
|
||||
u8 *pspframebuf;
|
||||
PspDisplayPixelFormat pspFramebufFormat;
|
||||
int pspFramebufLinesize;
|
||||
};
|
||||
@ -88,7 +88,6 @@ void __DisplayInit()
|
||||
{
|
||||
framebufIsLatched = false;
|
||||
framebuf.topaddr = 0x04000000;
|
||||
framebuf.pspframebuf = Memory::GetPointer(0x04000000);
|
||||
framebuf.pspFramebufFormat = PSP_DISPLAY_PIXEL_FORMAT_8888;
|
||||
framebuf.pspFramebufLinesize = 480; // ??
|
||||
|
||||
@ -152,11 +151,7 @@ void hleEnterVblank(u64 userdata, int cyclesLate)
|
||||
{
|
||||
host->EndFrame();
|
||||
host->BeginFrame();
|
||||
if (g_Config.bDisplayFramebuffer)
|
||||
{
|
||||
INFO_LOG(HLE, "Drawing the framebuffer");
|
||||
DisplayDrawer_DrawFramebuffer(framebuf.pspframebuf, framebuf.pspFramebufFormat, framebuf.pspFramebufLinesize);
|
||||
}
|
||||
gpu->BeginFrame();
|
||||
|
||||
shaderManager.DirtyShader();
|
||||
shaderManager.DirtyUniform(DIRTY_ALL);
|
||||
@ -190,7 +185,7 @@ u32 sceDisplaySetMode(u32 unknown, u32 xres, u32 yres)
|
||||
DEBUG_LOG(HLE,"sceDisplaySetMode(%d,%d,%d)",unknown,xres,yres);
|
||||
host->BeginFrame();
|
||||
|
||||
gpu->InitClear();
|
||||
gpu->InitClear(PSP_CoreParameter().renderWidth, PSP_CoreParameter().renderHeight);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -203,19 +198,7 @@ void sceDisplaySetFramebuf()
|
||||
int pixelformat = PARAM(2);
|
||||
int sync = PARAM(3);
|
||||
|
||||
FrameBufferState *fbstate = 0;
|
||||
if (sync == PSP_DISPLAY_SETBUF_IMMEDIATE)
|
||||
{
|
||||
// Write immediately to the current framebuffer parameters
|
||||
fbstate = &framebuf;
|
||||
}
|
||||
else if (topaddr != 0)
|
||||
{
|
||||
// Delay the write until vblank
|
||||
fbstate = &latchedFramebuf;
|
||||
framebufIsLatched = true;
|
||||
}
|
||||
|
||||
FrameBufferState fbstate;
|
||||
DEBUG_LOG(HLE,"sceDisplaySetFramebuf(topaddr=%08x,linesize=%d,pixelsize=%d,sync=%d)",topaddr,linesize,pixelformat,sync);
|
||||
if (topaddr == 0)
|
||||
{
|
||||
@ -223,10 +206,21 @@ void sceDisplaySetFramebuf()
|
||||
}
|
||||
else
|
||||
{
|
||||
fbstate->topaddr = topaddr;
|
||||
fbstate->pspframebuf = Memory::GetPointer((0x44000000)|(topaddr & 0x1FFFFF)); // TODO - check
|
||||
fbstate->pspFramebufFormat = (PspDisplayPixelFormat)pixelformat;
|
||||
fbstate->pspFramebufLinesize = linesize;
|
||||
fbstate.topaddr = topaddr;
|
||||
fbstate.pspFramebufFormat = (PspDisplayPixelFormat)pixelformat;
|
||||
fbstate.pspFramebufLinesize = linesize;
|
||||
}
|
||||
|
||||
if (sync == PSP_DISPLAY_SETBUF_IMMEDIATE)
|
||||
{
|
||||
// Write immediately to the current framebuffer parameters
|
||||
framebuf = fbstate;
|
||||
}
|
||||
else if (topaddr != 0)
|
||||
{
|
||||
// Delay the write until vblank
|
||||
latchedFramebuf = fbstate;
|
||||
framebufIsLatched = true;
|
||||
}
|
||||
|
||||
RETURN(0);
|
||||
|
@ -26,7 +26,9 @@
|
||||
|
||||
#include <limits>
|
||||
|
||||
#ifndef _MSC_VER
|
||||
using std::isnan;
|
||||
#endif
|
||||
|
||||
#define R(i) (currentMIPS->r[i])
|
||||
#define RF(i) (*(float*)(&(currentMIPS->r[i])))
|
||||
|
@ -30,12 +30,14 @@
|
||||
|
||||
#include "../../Core/MemMap.h"
|
||||
#include "../../Core/Host.h"
|
||||
#include "../../Core/Config.h"
|
||||
|
||||
#include "../GPUState.h"
|
||||
#include "../ge_constants.h"
|
||||
|
||||
#include "ShaderManager.h"
|
||||
#include "DisplayListInterpreter.h"
|
||||
#include "Framebuffer.h"
|
||||
#include "TransformPipeline.h"
|
||||
|
||||
#include "../../Core/HLE/sceKernelThread.h"
|
||||
@ -46,43 +48,42 @@ inline void glEnDis(GLuint cmd, int value)
|
||||
(value ? glEnable : glDisable)(cmd);
|
||||
}
|
||||
|
||||
struct DisplayState
|
||||
{
|
||||
u32 pc;
|
||||
u32 stallAddr;
|
||||
};
|
||||
|
||||
static DisplayState dcontext;
|
||||
ShaderManager shaderManager;
|
||||
|
||||
extern u32 curTextureWidth;
|
||||
extern u32 curTextureHeight;
|
||||
|
||||
int dlIdGenerator = 1;
|
||||
|
||||
struct DisplayList
|
||||
void GLES_GPU::InitClear(int renderWidth, int renderHeight)
|
||||
{
|
||||
int id;
|
||||
u32 listpc;
|
||||
u32 stall;
|
||||
};
|
||||
renderWidth_ = renderWidth;
|
||||
renderHeight_ = renderHeight;
|
||||
|
||||
std::vector<DisplayList> dlQueue;
|
||||
|
||||
static u32 prev;
|
||||
u32 stack[2];
|
||||
u32 stackptr = 0;
|
||||
bool finished;
|
||||
|
||||
u8 bezierBuf[16000];
|
||||
|
||||
void GLES_GPU::InitClear()
|
||||
{
|
||||
glClearColor(0,0,0,1);
|
||||
// glClearColor(1,0,1,1);
|
||||
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
|
||||
void GLES_GPU::BeginFrame()
|
||||
{
|
||||
if (g_Config.bDisplayFramebuffer && displayFramebufPtr_)
|
||||
{
|
||||
INFO_LOG(HLE, "Drawing the framebuffer");
|
||||
u8 *pspframebuf = Memory::GetPointer((0x44000000)|(displayFramebufPtr_ & 0x1FFFFF)); // TODO - check
|
||||
DisplayDrawer_DrawFramebuffer(pspframebuf, displayFormat_, displayStride_);
|
||||
}
|
||||
}
|
||||
|
||||
void GLES_GPU::SetDisplayFramebuffer(u32 framebuf, u32 stride, int format)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void GLES_GPU::CopyDisplayToOutput()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
|
||||
bool GLES_GPU::ProcessDLQueue()
|
||||
{
|
||||
std::vector<DisplayList>::iterator iter = dlQueue.begin();
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "../GPUInterface.h"
|
||||
|
||||
class ShaderManager;
|
||||
@ -24,8 +26,8 @@ class ShaderManager;
|
||||
class GLES_GPU : public GPUInterface
|
||||
{
|
||||
public:
|
||||
GLES_GPU() : interruptsEnabled_(true) {}
|
||||
virtual void InitClear();
|
||||
GLES_GPU() : interruptsEnabled_(true), dlIdGenerator(1) {}
|
||||
virtual void InitClear(int renderWidth, int renderHeight);
|
||||
virtual u32 EnqueueList(u32 listpc, u32 stall);
|
||||
virtual void UpdateStall(int listid, u32 newstall);
|
||||
virtual void ExecuteOp(u32 op, u32 diff);
|
||||
@ -34,7 +36,46 @@ public:
|
||||
virtual void EnableInterrupts(bool enable) {
|
||||
interruptsEnabled_ = enable;
|
||||
}
|
||||
|
||||
virtual void SetDisplayFramebuffer(u32 framebuf, u32 stride, int format);
|
||||
virtual void CopyDisplayToOutput();
|
||||
virtual void BeginFrame();
|
||||
|
||||
private:
|
||||
bool ProcessDLQueue();
|
||||
bool interruptsEnabled_;
|
||||
|
||||
u32 displayFramebufPtr_;
|
||||
u32 displayStride_;
|
||||
int displayFormat_;
|
||||
|
||||
int renderWidth_;
|
||||
int renderHeight_;
|
||||
|
||||
struct CmdProcessorState
|
||||
{
|
||||
u32 pc;
|
||||
u32 stallAddr;
|
||||
};
|
||||
|
||||
CmdProcessorState dcontext;
|
||||
|
||||
int dlIdGenerator;
|
||||
|
||||
struct DisplayList
|
||||
{
|
||||
int id;
|
||||
u32 listpc;
|
||||
u32 stall;
|
||||
};
|
||||
|
||||
std::vector<DisplayList> dlQueue;
|
||||
|
||||
u32 prev;
|
||||
u32 stack[2];
|
||||
u32 stackptr;
|
||||
bool finished;
|
||||
|
||||
u8 bezierBuf[16000];
|
||||
|
||||
};
|
||||
|
@ -123,7 +123,7 @@ void DisplayDrawer_Shutdown()
|
||||
delete [] realFB;
|
||||
}
|
||||
|
||||
void DisplayDrawer_DrawFramebuffer(u8 *framebuf, PspDisplayPixelFormat pixelFormat, int linesize)
|
||||
void DisplayDrawer_DrawFramebuffer(u8 *framebuf, int pixelFormat, int linesize)
|
||||
{
|
||||
float u1 = 1.0f;
|
||||
float v1 = 1.0f;
|
||||
|
@ -24,11 +24,11 @@
|
||||
|
||||
enum PspDisplayPixelFormat {
|
||||
PSP_DISPLAY_PIXEL_FORMAT_565 = 0,
|
||||
PSP_DISPLAY_PIXEL_FORMAT_8888 = 3,
|
||||
PSP_DISPLAY_PIXEL_FORMAT_5551 = 1,
|
||||
PSP_DISPLAY_PIXEL_FORMAT_4444 = 2,
|
||||
PSP_DISPLAY_PIXEL_FORMAT_8888 = 3,
|
||||
};
|
||||
|
||||
void DisplayDrawer_Init();
|
||||
void DisplayDrawer_DrawFramebuffer(u8 *framebuf, PspDisplayPixelFormat pixelFormat, int linesize);
|
||||
void DisplayDrawer_DrawFramebuffer(u8 *framebuf, int pixelFormat, int linesize);
|
||||
void DisplayDrawer_Shutdown();
|
||||
|
@ -22,13 +22,23 @@
|
||||
class GPUInterface
|
||||
{
|
||||
public:
|
||||
virtual void InitClear() = 0;
|
||||
virtual ~GPUInterface() {}
|
||||
|
||||
// Initialization
|
||||
virtual void InitClear(int renderWidth, int renderHeight) = 0;
|
||||
|
||||
// Draw queue management
|
||||
virtual u32 EnqueueList(u32 listpc, u32 stall) = 0;
|
||||
virtual void UpdateStall(int listid, u32 newstall) = 0;
|
||||
virtual void ExecuteOp(u32 op, u32 diff) = 0;
|
||||
virtual bool InterpretList() = 0;
|
||||
virtual void DrawSync(int mode) = 0;
|
||||
|
||||
// Framebuffer management
|
||||
virtual void SetDisplayFramebuffer(u32 framebuf, u32 stride, int format) = 0;
|
||||
virtual void BeginFrame() = 0; // Can be a good place to draw the "memory" framebuffer for accelerated plugins
|
||||
virtual void CopyDisplayToOutput() = 0;
|
||||
|
||||
// Internal hack to avoid interrupts from "PPGe" drawing (utility UI, etc)
|
||||
virtual void EnableInterrupts(bool enable) = 0;
|
||||
};
|
||||
|
@ -25,7 +25,7 @@ class NullGPU : public GPUInterface
|
||||
{
|
||||
public:
|
||||
NullGPU() : interruptsEnabled_(true) {}
|
||||
virtual void InitClear() {}
|
||||
virtual void InitClear(int renderWidth, int renderHeight) {}
|
||||
virtual u32 EnqueueList(u32 listpc, u32 stall);
|
||||
virtual void UpdateStall(int listid, u32 newstall);
|
||||
virtual void ExecuteOp(u32 op, u32 diff);
|
||||
@ -34,6 +34,11 @@ public:
|
||||
virtual void EnableInterrupts(bool enable) {
|
||||
interruptsEnabled_ = enable;
|
||||
}
|
||||
|
||||
virtual void BeginFrame() {}
|
||||
virtual void SetDisplayFramebuffer(u32 framebuf, u32 stride, int format) {}
|
||||
virtual void CopyDisplayToOutput() {}
|
||||
|
||||
private:
|
||||
bool ProcessDLQueue();
|
||||
bool interruptsEnabled_;
|
||||
|
@ -67,7 +67,11 @@ DWORD TheThread(LPVOID x)
|
||||
coreParameter.cpuCore = g_Config.bJIT ? CPU_JIT : CPU_INTERPRETER;
|
||||
coreParameter.enableDebugging = true;
|
||||
coreParameter.printfEmuLog = false;
|
||||
coreParameter.headLess = false; //true;
|
||||
coreParameter.headLess = false;
|
||||
coreParameter.renderWidth = 480 * g_Config.iWindowZoom;
|
||||
coreParameter.renderHeight = 272 * g_Config.iWindowZoom;
|
||||
coreParameter.outputWidth = 480 * g_Config.iWindowZoom;
|
||||
coreParameter.outputHeight = 272 * g_Config.iWindowZoom;
|
||||
|
||||
std::string error_string;
|
||||
if (!PSP_Init(coreParameter, &error_string))
|
||||
|
@ -60,6 +60,10 @@ EmuScreen::EmuScreen(const std::string &filename) : invalid_(true)
|
||||
coreParam.enableDebugging = false;
|
||||
coreParam.printfEmuLog = false;
|
||||
coreParam.headLess = false;
|
||||
coreParam.renderWidth = 480;
|
||||
coreParam.renderHeight = 272;
|
||||
coreParam.outputWidth = dp_xres;
|
||||
coreParam.outputHeight = dp_yres;
|
||||
|
||||
std::string error_string;
|
||||
if (PSP_Init(coreParam, &error_string)) {
|
||||
|
2
native
2
native
@ -1 +1 @@
|
||||
Subproject commit 8e673a20f70bb636a5cc4ba17cbbe6613869b461
|
||||
Subproject commit 7e36cef3aeac81dd8071422be93b00128a0cb110
|
Loading…
Reference in New Issue
Block a user