Allow changing software skinning at runtime.

This commit is contained in:
Unknown W. Brackets 2014-06-28 21:37:41 -07:00
parent b379109380
commit 1c3b60a8ee
8 changed files with 43 additions and 14 deletions

View File

@ -1862,7 +1862,7 @@ Thread *__KernelNextThread() {
void __KernelReSchedule(const char *reason)
{
// First, let's check if there are any pending callback to trigger.
// First, let's check if there are any pending callbacks to trigger.
// TODO: Could probably take this out of __KernelReSchedule() which is a bit hot.
__KernelCheckCallbacks();

View File

@ -445,6 +445,7 @@ GLES_GPU::GLES_GPU()
if (g_Config.bSoftwareSkinning) {
cmdInfo_[GE_CMD_VERTEXTYPE].flags &= ~FLAG_FLUSHBEFOREONCHANGE;
cmdInfo_[GE_CMD_VERTEXTYPE].func = &GLES_GPU::Execute_VertexTypeSkinning;
}
BuildReportingInfo();
@ -562,6 +563,16 @@ inline void GLES_GPU::UpdateVsyncInterval(bool force) {
}
void GLES_GPU::BeginFrameInternal() {
if (resized_) {
if (g_Config.bSoftwareSkinning) {
cmdInfo_[GE_CMD_VERTEXTYPE].flags &= ~FLAG_FLUSHBEFOREONCHANGE;
cmdInfo_[GE_CMD_VERTEXTYPE].func = &GLES_GPU::Execute_VertexTypeSkinning;
} else {
cmdInfo_[GE_CMD_VERTEXTYPE].flags |= FLAG_FLUSHBEFOREONCHANGE;
cmdInfo_[GE_CMD_VERTEXTYPE].func = &GLES_GPU::Execute_VertexType;
}
transformDraw_.Resized();
}
UpdateVsyncInterval(resized_);
resized_ = false;
@ -817,19 +828,20 @@ void GLES_GPU::Execute_Prim(u32 op, u32 diff) {
}
void GLES_GPU::Execute_VertexType(u32 op, u32 diff) {
if (!g_Config.bSoftwareSkinning) {
if (diff & (GE_VTYPE_TC_MASK | GE_VTYPE_THROUGH_MASK)) {
shaderManager_->DirtyUniform(DIRTY_UVSCALEOFFSET);
}
}
void GLES_GPU::Execute_VertexTypeSkinning(u32 op, u32 diff) {
// Don't flush when weight count changes, unless morph is enabled.
if ((diff & ~GE_VTYPE_WEIGHTCOUNT_MASK) || (op & GE_VTYPE_MORPHCOUNT_MASK) != 0) {
// Restore and flush
gstate.vertType ^= diff;
Flush();
gstate.vertType ^= diff;
if (diff & (GE_VTYPE_TC_MASK | GE_VTYPE_THROUGH_MASK))
shaderManager_->DirtyUniform(DIRTY_UVSCALEOFFSET);
} else {
// Don't flush when weight count changes, unless morph is enabled.
if ((diff & ~GE_VTYPE_WEIGHTCOUNT_MASK) || (op & GE_VTYPE_MORPHCOUNT_MASK) != 0) {
// Restore and flush
gstate.vertType ^= diff;
Flush();
gstate.vertType ^= diff;
if (diff & (GE_VTYPE_TC_MASK | GE_VTYPE_THROUGH_MASK))
shaderManager_->DirtyUniform(DIRTY_UVSCALEOFFSET);
}
}
}

View File

@ -94,6 +94,7 @@ public:
void Execute_Spline(u32 op, u32 diff);
void Execute_BoundingBox(u32 op, u32 diff);
void Execute_VertexType(u32 op, u32 diff);
void Execute_VertexTypeSkinning(u32 op, u32 diff);
void Execute_Region(u32 op, u32 diff);
void Execute_Scissor(u32 op, u32 diff);
void Execute_FramebufType(u32 op, u32 diff);

View File

@ -772,6 +772,16 @@ rotateVBO:
#endif
}
void TransformDrawEngine::Resized() {
decJitCache_->Clear();
lastVType_ = -1;
dec_ = NULL;
for (auto iter = decoderMap_.begin(); iter != decoderMap_.end(); iter++) {
delete iter->second;
}
decoderMap_.clear();
}
struct Plane {
float x, y, z, w;
void Set(float _x, float _y, float _z, float _w) { x = _x; y = _y; z = _z; w = _w; }

View File

@ -119,6 +119,7 @@ public:
void InitDeviceObjects();
void DestroyDeviceObjects();
void GLLost();
void Resized();
void DecimateTrackedVertexArrays();
void ClearTrackedVertexArrays();

View File

@ -905,6 +905,10 @@ VertexDecoderJitCache::VertexDecoderJitCache() {
#endif
}
void VertexDecoderJitCache::Clear() {
ClearCodeSpace();
}
#if defined(PPC)
#error This should not be built for PowerPC, at least not yet.

View File

@ -197,6 +197,7 @@ public:
// Returns a pointer to the code to run.
JittedVertexDecoder Compile(const VertexDecoder &dec);
void Clear();
void Jit_WeightsU8();
void Jit_WeightsU16();

View File

@ -156,7 +156,7 @@ void GameSettingsScreen::CreateViews() {
hwTransform->SetEnabledPtr(&hwTransformEnable);
CheckBox *swSkin = graphicsSettings->Add(new CheckBox(&g_Config.bSoftwareSkinning, gs->T("Software Skinning")));
swSkinningEnable = !PSP_IsInited() && !g_Config.bSoftwareRendering;
swSkinningEnable = !g_Config.bSoftwareRendering;
swSkin->SetEnabledPtr(&swSkinningEnable);
CheckBox *vtxCache = graphicsSettings->Add(new CheckBox(&g_Config.bVertexCache, gs->T("Vertex Cache")));
@ -427,7 +427,7 @@ UI::EventReturn GameSettingsScreen::OnSoftwareRendering(UI::EventParams &e) {
stencilTestEnable = !g_Config.bSoftwareRendering;
beziersEnable = !g_Config.bSoftwareRendering;
texSecondaryEnable = !g_Config.bSoftwareRendering;
swSkinningEnable = !PSP_IsInited() && !g_Config.bSoftwareRendering;
swSkinningEnable = !g_Config.bSoftwareRendering;
hwTransformEnable = !g_Config.bSoftwareRendering;
vtxCacheEnable = hwTransformEnable && g_Config.bHardwareTransform;
texBackoffEnable = !g_Config.bSoftwareRendering;