mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-02 10:43:44 +01:00
Merge remote-tracking branch 'origin/master' into Universal_Audio_Branch
This commit is contained in:
commit
4eedd7a3cd
14 files changed
+110
-38
No files matched your search
+7
-3
@@ -107,10 +107,16 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
// Set the list as complete once the interrupt starts.
|
||||
// In other words, not before another interrupt finishes.
|
||||
if (dl->signal != PSP_GE_SIGNAL_HANDLER_PAUSE && cmd == GE_CMD_FINISH) {
|
||||
dl->state = PSP_GE_DL_STATE_COMPLETED;
|
||||
}
|
||||
|
||||
SubIntrHandler* handler = get(subintr);
|
||||
if (handler != NULL)
|
||||
{
|
||||
DEBUG_LOG(CPU, "Entering interrupt handler %08x", handler->handlerAddress);
|
||||
DEBUG_LOG(CPU, "Entering GE interrupt handler %08x", handler->handlerAddress);
|
||||
currentMIPS->pc = handler->handlerAddress;
|
||||
u32 data = dl->subIntrToken;
|
||||
currentMIPS->r[MIPS_REG_A0] = data & 0xFFFF;
|
||||
@@ -162,8 +168,6 @@ public:
|
||||
break;
|
||||
}
|
||||
|
||||
dl->signal = PSP_GE_SIGNAL_NONE;
|
||||
|
||||
gpu->InterruptEnd(intrdata.listid);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -933,6 +933,11 @@ u32 sceIoWrite(int id, u32 data_addr, int size) {
|
||||
} else if (result >= 0) {
|
||||
DEBUG_LOG(SCEIO, "%x=sceIoWrite(%d, %08x, %x)", result, id, data_addr, size);
|
||||
if (__KernelIsDispatchEnabled()) {
|
||||
// If we wrote to stdout, return an error (even though we did log it) rather than delaying.
|
||||
// On actual hardware, it would just return this... we just want the log output.
|
||||
if (__IsInInterrupt()) {
|
||||
return SCE_KERNEL_ERROR_ILLEGAL_CONTEXT;
|
||||
}
|
||||
return hleDelayResult(result, "io write", us);
|
||||
} else {
|
||||
return result;
|
||||
|
||||
@@ -212,7 +212,7 @@ enum NativeModuleStatus {
|
||||
|
||||
class Module : public KernelObject {
|
||||
public:
|
||||
Module() : memoryBlockAddr(0), isFake(false) {}
|
||||
Module() : textStart(0), textEnd(0), memoryBlockAddr(0), isFake(false) {}
|
||||
~Module() {
|
||||
if (memoryBlockAddr) {
|
||||
userMemory.Free(memoryBlockAddr);
|
||||
@@ -440,6 +440,10 @@ void __KernelModuleDoState(PointerWrap &p)
|
||||
if (s >= 2) {
|
||||
p.Do(loadedModules);
|
||||
}
|
||||
|
||||
if (g_Config.bFuncHashMap) {
|
||||
MIPSAnalyst::ReplaceFunctions();
|
||||
}
|
||||
}
|
||||
|
||||
void __KernelModuleShutdown()
|
||||
|
||||
+6
-6
@@ -506,13 +506,13 @@ u32 sceMp3ResetPlayPositionByFrame(u32 mp3, int position) {
|
||||
return ctx->AuResetPlayPositionByFrame(position);
|
||||
}
|
||||
|
||||
u32 sceMp3LowLevelInit() {
|
||||
ERROR_LOG_REPORT(ME, "UNIMPL sceMp3LowLevelInit(...)");
|
||||
u32 sceMp3LowLevelInit(u32 mp3, u32 paramsAddr) {
|
||||
ERROR_LOG_REPORT(ME, "UNIMPL sceMp3LowLevelInit(%08x, %08x)", mp3, paramsAddr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 sceMp3LowLevelDecode() {
|
||||
ERROR_LOG_REPORT(ME, "UNIMPL sceMp3LowLevelDecode(...)");
|
||||
u32 sceMp3LowLevelDecode(u32 mp3, u32 sourceAddr, u32 sourceBytesConsumedAddr, u32 samplesAddr, u32 sampleBytesAddr) {
|
||||
ERROR_LOG_REPORT(ME, "UNIMPL sceMp3LowLevelDecode(%08x, %08x, %08x, %08x, %08x)", mp3, sourceAddr, sourceBytesConsumedAddr, samplesAddr, sampleBytesAddr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -539,8 +539,8 @@ const HLEFunction sceMp3[] = {
|
||||
{0xAE6D2027,WrapU_U<sceMp3GetMPEGVersion>,"sceMp3GetMPEGVersion"},
|
||||
{0x3548AEC8,WrapU_U<sceMp3GetFrameNum>,"sceMp3GetFrameNum"},
|
||||
{0x0840e808,WrapU_UI<sceMp3ResetPlayPositionByFrame>,"sceMp3ResetPlayPositionByFrame"},
|
||||
{0x1b839b83,WrapU_V<sceMp3LowLevelInit>,"sceMp3LowLevelInit"},
|
||||
{0xe3ee2c81,WrapU_V<sceMp3LowLevelDecode>,"sceMp3LowLevelDecode"}
|
||||
{0x1b839b83,WrapU_UU<sceMp3LowLevelInit>,"sceMp3LowLevelInit"},
|
||||
{0xe3ee2c81,WrapU_UUUUU<sceMp3LowLevelDecode>,"sceMp3LowLevelDecode"}
|
||||
};
|
||||
|
||||
void Register_sceMp3() {
|
||||
|
||||
@@ -375,8 +375,6 @@ skip:
|
||||
return furthestJumpbackAddr;
|
||||
}
|
||||
|
||||
void ReplaceFunctions();
|
||||
|
||||
void ScanForFunctions(u32 startAddr, u32 endAddr, bool insertSymbols) {
|
||||
AnalyzedFunction currentFunction = {startAddr};
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace MIPSAnalyst
|
||||
void StoreHashMap(std::string filename = "");
|
||||
|
||||
const char *LookupHash(u64 hash, int funcSize);
|
||||
void ReplaceFunctions(const ReplacementTableEntry *e, int numEntries);
|
||||
void ReplaceFunctions();
|
||||
|
||||
void UpdateHashMap();
|
||||
void ApplyHashMap();
|
||||
|
||||
@@ -491,8 +491,8 @@ void Jit::Comp_ReplacementFunc(MIPSOpcode op)
|
||||
// we can emit.
|
||||
|
||||
MOV(32, R(ECX), M(¤tMIPS->r[MIPS_REG_RA]));
|
||||
SUB(32, M(¤tMIPS->downcount - 1), R(EAX));
|
||||
js.downcountAmount = 1; // we just subtracted most of it
|
||||
SUB(32, M(¤tMIPS->downcount), R(EAX));
|
||||
js.downcountAmount = 0; // we just subtracted most of it
|
||||
WriteExitDestInReg(ECX);
|
||||
|
||||
js.compiling = false;
|
||||
|
||||
@@ -292,6 +292,7 @@ void ComputeFragmentShaderID(FragmentShaderID *id) {
|
||||
bool enableAlphaDoubling = !alphaToColorDoubling && CanDoubleSrcBlendMode();
|
||||
bool doTextureProjection = gstate.getUVGenMode() == GE_TEXMAP_TEXTURE_MATRIX;
|
||||
bool doTextureAlpha = gstate.isTextureAlphaUsed();
|
||||
bool computeAbsdiff = gstate.getBlendEq() == GE_BLENDMODE_ABSDIFF;
|
||||
ReplaceAlphaType stencilToAlpha = ReplaceAlphaWithStencil();
|
||||
|
||||
// All texfuncs except replace are the same for RGB as for RGBA with full alpha.
|
||||
@@ -326,11 +327,16 @@ void ComputeFragmentShaderID(FragmentShaderID *id) {
|
||||
// 3 bits
|
||||
id0 |= ReplaceAlphaWithStencilType() << 21;
|
||||
}
|
||||
|
||||
id0 |= (alphaTestAgainstZero & 1) << 24;
|
||||
if (enableAlphaTest)
|
||||
gpuStats.numAlphaTestedDraws++;
|
||||
else
|
||||
gpuStats.numNonAlphaTestedDraws++;
|
||||
|
||||
if (computeAbsdiff) {
|
||||
id0 |= (computeAbsdiff & 1) << 25;
|
||||
}
|
||||
}
|
||||
|
||||
id->d[0] = id0;
|
||||
@@ -407,6 +413,7 @@ void GenerateFragmentShader(char *buffer) {
|
||||
bool enableAlphaDoubling = !alphaToColorDoubling && CanDoubleSrcBlendMode();
|
||||
bool doTextureProjection = gstate.getUVGenMode() == GE_TEXMAP_TEXTURE_MATRIX;
|
||||
bool doTextureAlpha = gstate.isTextureAlphaUsed();
|
||||
bool computeAbsdiff = gstate.getBlendEq() == GE_BLENDMODE_ABSDIFF;
|
||||
ReplaceAlphaType stencilToAlpha = ReplaceAlphaWithStencil();
|
||||
|
||||
if (gstate_c.textureFullAlpha && gstate.getTextureFunction() != GE_TEXFUNC_REPLACE)
|
||||
@@ -592,6 +599,11 @@ void GenerateFragmentShader(char *buffer) {
|
||||
}
|
||||
}
|
||||
|
||||
// Handle ABSDIFF blending mode using GL_EXT_shader_framebuffer_fetch
|
||||
if (computeAbsdiff && gl_extensions.EXT_shader_framebuffer_fetch) {
|
||||
WRITE(p, " gl_FragColor.rgb = abs(v.rgb - gl_LastFragData[0].rgb);\n");
|
||||
}
|
||||
|
||||
switch (stencilToAlpha) {
|
||||
case REPLACE_ALPHA_DUALSOURCE:
|
||||
WRITE(p, " fragColor0 = vec4(v.rgb, 0.0);\n");
|
||||
|
||||
@@ -711,7 +711,8 @@ void FramebufferManager::DoSetRenderFrameBuffer() {
|
||||
|
||||
// Find a matching framebuffer
|
||||
VirtualFramebuffer *vfb = 0;
|
||||
for (size_t i = 0; i < vfbs_.size(); ++i) {
|
||||
size_t i;
|
||||
for (i = 0; i < vfbs_.size(); ++i) {
|
||||
VirtualFramebuffer *v = vfbs_[i];
|
||||
if (MaskedEqual(v->fb_address, fb_address)) {
|
||||
vfb = v;
|
||||
@@ -730,6 +731,20 @@ void FramebufferManager::DoSetRenderFrameBuffer() {
|
||||
}
|
||||
}
|
||||
|
||||
if (vfb && (drawing_width != vfb->bufferWidth || drawing_height != vfb->bufferHeight)) {
|
||||
// If it's newly wrong, or changing every frame, just keep track.
|
||||
if (vfb->newWidth != drawing_width || vfb->newHeight != drawing_height) {
|
||||
vfb->newWidth = drawing_width;
|
||||
vfb->newHeight = drawing_height;
|
||||
vfb->lastFrameNewSize = gpuStats.numFlips;
|
||||
} else if (vfb->lastFrameNewSize + FBO_OLD_AGE <= gpuStats.numFlips) {
|
||||
// Okay, it's changed for a while (and stayed that way.) Let's start over.
|
||||
DestroyFramebuf(vfb);
|
||||
vfbs_.erase(vfbs_.begin() + i);
|
||||
vfb = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
float renderWidthFactor = (float)PSP_CoreParameter().renderWidth / 480.0f;
|
||||
float renderHeightFactor = (float)PSP_CoreParameter().renderHeight / 272.0f;
|
||||
|
||||
@@ -744,6 +759,9 @@ void FramebufferManager::DoSetRenderFrameBuffer() {
|
||||
vfb->z_stride = z_stride;
|
||||
vfb->width = drawing_width;
|
||||
vfb->height = drawing_height;
|
||||
vfb->newWidth = drawing_width;
|
||||
vfb->newHeight = drawing_height;
|
||||
vfb->lastFrameNewSize = gpuStats.numFlips;
|
||||
vfb->renderWidth = (u16)(drawing_width * renderWidthFactor);
|
||||
vfb->renderHeight = (u16)(drawing_height * renderHeightFactor);
|
||||
vfb->bufferWidth = buffer_width;
|
||||
@@ -1664,10 +1682,20 @@ void FramebufferManager::UpdateFromMemory(u32 addr, int size, bool safe) {
|
||||
// However, it doesn't seem to work for Star Ocean, at least
|
||||
if (useBufferedRendering_ && vfb->fbo) {
|
||||
DisableState();
|
||||
glstate.viewport.set(0, 0, vfb->renderWidth, vfb->renderHeight);
|
||||
fbo_bind_as_render_target(vfb->fbo);
|
||||
if (gl_extensions.gpuVendor != GPU_VENDOR_POWERVR)
|
||||
glstate.viewport.restore();
|
||||
|
||||
int w = vfb->bufferWidth;
|
||||
int h = vfb->bufferHeight;
|
||||
// Often, the framebuffer size is incorrect. But here we have the size. Bit of a hack.
|
||||
if (vfb->fb_stride == 512 && (size == 512 * 272 * 4 || size == 512 * 272 * 2)) {
|
||||
// Looks like a standard 480x272 sized framebuffer/video/etc.
|
||||
w = 480;
|
||||
h = 272;
|
||||
}
|
||||
// Scale by the render resolution factor.
|
||||
w = (w * vfb->renderWidth) / vfb->bufferWidth;
|
||||
h = (h * vfb->renderHeight) / vfb->bufferHeight;
|
||||
glstate.viewport.set(0, vfb->renderHeight - h, w, h);
|
||||
needUnbind = true;
|
||||
DrawPixels(Memory::GetPointer(addr | 0x04000000), vfb->format, vfb->fb_stride);
|
||||
} else {
|
||||
|
||||
@@ -79,6 +79,10 @@ struct VirtualFramebuffer {
|
||||
|
||||
u16 usageFlags;
|
||||
|
||||
u16 newWidth;
|
||||
u16 newHeight;
|
||||
int lastFrameNewSize;
|
||||
|
||||
GEBufferFormat format; // virtual, right now they are all RGBA8888
|
||||
FBOColorDepth colorDepth;
|
||||
FBO *fbo;
|
||||
|
||||
@@ -325,7 +325,12 @@ void TransformDrawEngine::ApplyDrawState(int prim) {
|
||||
}
|
||||
|
||||
if (((blendFuncEq >= GE_BLENDMODE_MIN) && gl_extensions.EXT_blend_minmax) || gl_extensions.GLES3) {
|
||||
glstate.blendEquation.set(eqLookup[blendFuncEq]);
|
||||
if (blendFuncEq == GE_BLENDMODE_ABSDIFF && gl_extensions.EXT_shader_framebuffer_fetch) {
|
||||
// Handle GE_BLENDMODE_ABSDIFF in fragment shader and turn off regular alpha blending here.
|
||||
glstate.blend.set(false);
|
||||
} else {
|
||||
glstate.blendEquation.set(eqLookup[blendFuncEq]);
|
||||
}
|
||||
} else {
|
||||
glstate.blendEquation.set(eqLookupNoMinMax[blendFuncEq]);
|
||||
}
|
||||
@@ -536,8 +541,8 @@ void TransformDrawEngine::ApplyDrawState(int prim) {
|
||||
// Sadly, as glViewport takes integers, we will not be able to support sub pixel offsets this way. But meh.
|
||||
// shaderManager_->DirtyUniform(DIRTY_PROJMATRIX);
|
||||
|
||||
float zScale = getFloat24(gstate.viewportz1) / 65536.0f;
|
||||
float zOff = getFloat24(gstate.viewportz2) / 65536.0f;
|
||||
float zScale = getFloat24(gstate.viewportz1) / 65535.0f;
|
||||
float zOff = getFloat24(gstate.viewportz2) / 65535.0f;
|
||||
float depthRangeMin = zOff - zScale;
|
||||
float depthRangeMax = zOff + zScale;
|
||||
glstate.depthRange.set(depthRangeMin, depthRangeMax);
|
||||
|
||||
+21
-15
@@ -330,9 +330,6 @@ u32 GPUCommon::UpdateStall(int listid, u32 newstall) {
|
||||
return SCE_KERNEL_ERROR_ALREADY;
|
||||
|
||||
dl.stall = newstall & 0x0FFFFFFF;
|
||||
|
||||
if (dl.signal == PSP_GE_SIGNAL_HANDLER_PAUSE)
|
||||
dl.signal = PSP_GE_SIGNAL_HANDLER_SUSPEND;
|
||||
|
||||
guard.unlock();
|
||||
ProcessDLQueue();
|
||||
@@ -349,8 +346,8 @@ u32 GPUCommon::Continue() {
|
||||
{
|
||||
if (!isbreak)
|
||||
{
|
||||
if (currentList->signal == PSP_GE_SIGNAL_HANDLER_PAUSE)
|
||||
return 0x80000021;
|
||||
// TODO: Supposedly this returns SCE_KERNEL_ERROR_BUSY in some case, previously it had
|
||||
// currentList->signal == PSP_GE_SIGNAL_HANDLER_PAUSE, but it doesn't reproduce.
|
||||
|
||||
currentList->state = PSP_GE_DL_STATE_RUNNING;
|
||||
currentList->signal = PSP_GE_SIGNAL_NONE;
|
||||
@@ -457,9 +454,8 @@ bool GPUCommon::InterpretList(DisplayList &list) {
|
||||
|
||||
easy_guard guard(listLock);
|
||||
|
||||
// TODO: This has to be right... but it freezes right now?
|
||||
//if (list.state == PSP_GE_DL_STATE_PAUSED)
|
||||
// return false;
|
||||
if (list.state == PSP_GE_DL_STATE_PAUSED)
|
||||
return false;
|
||||
currentList = &list;
|
||||
|
||||
if (!list.started && list.context.IsValid()) {
|
||||
@@ -808,21 +804,33 @@ void GPUCommon::ExecuteOp(u32 op, u32 diff) {
|
||||
|
||||
switch (behaviour) {
|
||||
case PSP_GE_SIGNAL_HANDLER_SUSPEND:
|
||||
// Suspend the list, and call the signal handler. When it's done, resume.
|
||||
// Before sdkver 0x02000010, listsync should return paused.
|
||||
if (sceKernelGetCompiledSdkVersion() <= 0x02000010)
|
||||
currentList->state = PSP_GE_DL_STATE_PAUSED;
|
||||
currentList->signal = behaviour;
|
||||
DEBUG_LOG(G3D, "Signal with Wait UNIMPLEMENTED! signal/end: %04x %04x", signal, enddata);
|
||||
DEBUG_LOG(G3D, "Signal with wait. signal/end: %04x %04x", signal, enddata);
|
||||
break;
|
||||
case PSP_GE_SIGNAL_HANDLER_CONTINUE:
|
||||
// Resume the list right away, then call the handler.
|
||||
currentList->signal = behaviour;
|
||||
DEBUG_LOG(G3D, "Signal without wait. signal/end: %04x %04x", signal, enddata);
|
||||
break;
|
||||
case PSP_GE_SIGNAL_HANDLER_PAUSE:
|
||||
currentList->state = PSP_GE_DL_STATE_PAUSED;
|
||||
// Pause the list instead of ending at the next FINISH.
|
||||
// Call the handler with the PAUSE signal value at that FINISH.
|
||||
// Technically, this ought to trigger an interrupt, but it won't do anything.
|
||||
// But right now, signal is always reset by interrupts, so that causes pause to not work.
|
||||
trigger = false;
|
||||
currentList->signal = behaviour;
|
||||
ERROR_LOG_REPORT(G3D, "Signal with Pause UNIMPLEMENTED! signal/end: %04x %04x", signal, enddata);
|
||||
DEBUG_LOG(G3D, "Signal with Pause. signal/end: %04x %04x", signal, enddata);
|
||||
break;
|
||||
case PSP_GE_SIGNAL_SYNC:
|
||||
// Acts as a memory barrier, never calls any user code.
|
||||
// Technically, this ought to trigger an interrupt, but it won't do anything.
|
||||
// Triggering here can cause incorrect rescheduling, which breaks 3rd Birthday.
|
||||
// However, this is likely a bug in how GE signal interrupts are handled.
|
||||
trigger = false;
|
||||
currentList->signal = behaviour;
|
||||
DEBUG_LOG(G3D, "Signal with Sync. signal/end: %04x %04x", signal, enddata);
|
||||
break;
|
||||
@@ -896,6 +904,7 @@ void GPUCommon::ExecuteOp(u32 op, u32 diff) {
|
||||
case GE_CMD_FINISH:
|
||||
switch (currentList->signal) {
|
||||
case PSP_GE_SIGNAL_HANDLER_PAUSE:
|
||||
currentList->state = PSP_GE_DL_STATE_PAUSED;
|
||||
if (currentList->interruptsEnabled) {
|
||||
if (__GeTriggerInterrupt(currentList->id, currentList->pc, startingTicks + cyclesExecuted)) {
|
||||
currentList->pendingInterrupt = true;
|
||||
@@ -911,11 +920,11 @@ void GPUCommon::ExecuteOp(u32 op, u32 diff) {
|
||||
|
||||
default:
|
||||
currentList->subIntrToken = prev & 0xFFFF;
|
||||
currentList->state = PSP_GE_DL_STATE_COMPLETED;
|
||||
UpdateState(GPUSTATE_DONE);
|
||||
if (currentList->interruptsEnabled && __GeTriggerInterrupt(currentList->id, currentList->pc, startingTicks + cyclesExecuted)) {
|
||||
currentList->pendingInterrupt = true;
|
||||
} else {
|
||||
currentList->state = PSP_GE_DL_STATE_COMPLETED;
|
||||
currentList->waitTicks = startingTicks + cyclesExecuted;
|
||||
busyTicks = std::max(busyTicks, currentList->waitTicks);
|
||||
__GeTriggerSync(GPU_SYNC_LIST, currentList->id, currentList->waitTicks);
|
||||
@@ -1026,9 +1035,6 @@ void GPUCommon::InterruptEnd(int listid) {
|
||||
__GeTriggerWait(GPU_SYNC_LIST, listid);
|
||||
}
|
||||
|
||||
if (dl.signal == PSP_GE_SIGNAL_HANDLER_PAUSE)
|
||||
dl.signal = PSP_GE_SIGNAL_HANDLER_SUSPEND;
|
||||
|
||||
guard.unlock();
|
||||
ProcessDLQueue();
|
||||
}
|
||||
|
||||
@@ -1193,7 +1193,10 @@ void DrawTriangleSlice(
|
||||
for (int i = 0; i <= maxTexLevel; i++) {
|
||||
u32 texaddr = gstate.getTextureAddress(i);
|
||||
texbufwidthbits[i] = GetTextureBufw(i, texaddr, texfmt) * 8;
|
||||
texptr[i] = Memory::GetPointer(texaddr);
|
||||
if (Memory::IsValidAddress(texaddr))
|
||||
texptr[i] = Memory::GetPointer(texaddr);
|
||||
else
|
||||
texptr[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -320,6 +320,9 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
{
|
||||
case IDC_GEDBG_MAINTAB:
|
||||
tabs->HandleNotify(lParam);
|
||||
if (gpuDebug != NULL) {
|
||||
lists->Update();
|
||||
}
|
||||
break;
|
||||
case IDC_GEDBG_FBTABS:
|
||||
fbTabs->HandleNotify(lParam);
|
||||
|
||||
Reference in new issue
Block a user