mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 21:39:52 +00:00
Cleanup SoftwareTransform a bit more
This commit is contained in:
parent
ca3ed34b44
commit
4212bbb51e
25
GPU/Common/TextureCacheCommon.cpp
Normal file
25
GPU/Common/TextureCacheCommon.cpp
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
// Copyright (c) 2013- PPSSPP Project.
|
||||||
|
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, version 2.0 or later versions.
|
||||||
|
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License 2.0 for more details.
|
||||||
|
|
||||||
|
// A copy of the GPL 2.0 should have been included with the program.
|
||||||
|
// If not, see http://www.gnu.org/licenses/
|
||||||
|
|
||||||
|
// Official git repository and contact information can be found at
|
||||||
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
|
|
||||||
|
#include "GPU/Common/TextureCacheCommon.h"
|
||||||
|
|
||||||
|
TextureCacheCommon::~TextureCacheCommon() {}
|
||||||
|
|
||||||
|
bool TextureCacheCommon::SetOffsetTexture(u32 offset) {
|
||||||
|
return false;
|
||||||
|
}
|
27
GPU/Common/TextureCacheCommon.h
Normal file
27
GPU/Common/TextureCacheCommon.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// Copyright (c) 2013- PPSSPP Project.
|
||||||
|
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, version 2.0 or later versions.
|
||||||
|
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License 2.0 for more details.
|
||||||
|
|
||||||
|
// A copy of the GPL 2.0 should have been included with the program.
|
||||||
|
// If not, see http://www.gnu.org/licenses/
|
||||||
|
|
||||||
|
// Official git repository and contact information can be found at
|
||||||
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Common/CommonTypes.h"
|
||||||
|
|
||||||
|
class TextureCacheCommon {
|
||||||
|
public:
|
||||||
|
virtual ~TextureCacheCommon();
|
||||||
|
|
||||||
|
virtual bool SetOffsetTexture(u32 offset);
|
||||||
|
};
|
@ -16,6 +16,7 @@
|
|||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
#include "math/math_util.h"
|
#include "math/math_util.h"
|
||||||
|
#include "gfx_es2/gpu_features.h"
|
||||||
|
|
||||||
#include "Core/Config.h"
|
#include "Core/Config.h"
|
||||||
#include "GPU/GPUState.h"
|
#include "GPU/GPUState.h"
|
||||||
@ -23,7 +24,7 @@
|
|||||||
#include "GPU/Common/VertexDecoderCommon.h"
|
#include "GPU/Common/VertexDecoderCommon.h"
|
||||||
#include "GPU/Common/TransformCommon.h"
|
#include "GPU/Common/TransformCommon.h"
|
||||||
#include "GPU/Common/FramebufferCommon.h"
|
#include "GPU/Common/FramebufferCommon.h"
|
||||||
#include "GPU/GLES/TextureCache.h"
|
#include "GPU/Common/TextureCacheCommon.h"
|
||||||
#include "GPU/GLES/TransformPipeline.h"
|
#include "GPU/GLES/TransformPipeline.h"
|
||||||
|
|
||||||
// This is the software transform pipeline, which is necessary for supporting RECT
|
// This is the software transform pipeline, which is necessary for supporting RECT
|
||||||
@ -82,7 +83,7 @@ static void RotateUVThrough(TransformedVertex v[4]) {
|
|||||||
|
|
||||||
// Clears on the PSP are best done by drawing a series of vertical strips
|
// Clears on the PSP are best done by drawing a series of vertical strips
|
||||||
// in clear mode. This tries to detect that.
|
// in clear mode. This tries to detect that.
|
||||||
bool TransformDrawEngine::IsReallyAClear(int numVerts) const {
|
static bool IsReallyAClear(const TransformedVertex *transformed, int numVerts) {
|
||||||
if (transformed[0].x != 0.0f || transformed[0].y != 0.0f)
|
if (transformed[0].x != 0.0f || transformed[0].y != 0.0f)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -119,10 +120,9 @@ bool TransformDrawEngine::IsReallyAClear(int numVerts) const {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TransformDrawEngine::SoftwareTransform(
|
void TransformDrawEngine::SoftwareTransform(
|
||||||
int prim, u8 *decoded, LinkedShader *program, int vertexCount, u32 vertType, void *inds, int indexType,
|
int prim, u8 *decoded, LinkedShader *program, int vertexCount, u32 vertType, void *inds, int indexType,
|
||||||
const DecVtxFormat &decVtxFormat, int maxIndex, FramebufferManagerCommon *fbman, TransformedVertex *&drawBuffer, int &numTrans, bool &drawIndexed, SoftwareTransformResult *result) {
|
const DecVtxFormat &decVtxFormat, int maxIndex, FramebufferManagerCommon *fbman, TextureCacheCommon *texCache, TransformedVertex *&drawBuffer, int &numTrans, bool &drawIndexed, SoftwareTransformResult *result) {
|
||||||
bool throughmode = (vertType & GE_VTYPE_THROUGH_MASK) != 0;
|
bool throughmode = (vertType & GE_VTYPE_THROUGH_MASK) != 0;
|
||||||
bool lmode = gstate.isUsingSecondaryColor() && gstate.isLightingEnabled();
|
bool lmode = gstate.isUsingSecondaryColor() && gstate.isLightingEnabled();
|
||||||
|
|
||||||
@ -388,7 +388,7 @@ void TransformDrawEngine::SoftwareTransform(
|
|||||||
// An alternative option is to simply ditch all the verts except the first and last to create a single
|
// An alternative option is to simply ditch all the verts except the first and last to create a single
|
||||||
// rectangle out of many. Quite a small optimization though.
|
// rectangle out of many. Quite a small optimization though.
|
||||||
// Experiment: Disable on PowerVR (see issue #6290)
|
// Experiment: Disable on PowerVR (see issue #6290)
|
||||||
if (maxIndex > 1 && gstate.isModeClear() && prim == GE_PRIM_RECTANGLES && IsReallyAClear(maxIndex) && gl_extensions.gpuVendor != GPU_VENDOR_POWERVR) {
|
if (maxIndex > 1 && gstate.isModeClear() && prim == GE_PRIM_RECTANGLES && IsReallyAClear(transformed, maxIndex) && gl_extensions.gpuVendor != GPU_VENDOR_POWERVR) {
|
||||||
result->color = transformed[0].color0_32;
|
result->color = transformed[0].color0_32;
|
||||||
result->depth = transformed[0].z;
|
result->depth = transformed[0].z;
|
||||||
result->action = SW_CLEAR;
|
result->action = SW_CLEAR;
|
||||||
@ -409,7 +409,7 @@ void TransformDrawEngine::SoftwareTransform(
|
|||||||
const u32 fb_size = bpp * fbman->GetTargetStride() * gstate_c.curTextureHeight;
|
const u32 fb_size = bpp * fbman->GetTargetStride() * gstate_c.curTextureHeight;
|
||||||
const u32 prevH = gstate_c.curTextureHeight;
|
const u32 prevH = gstate_c.curTextureHeight;
|
||||||
const u32 prevYOffset = gstate_c.curTextureYOffset;
|
const u32 prevYOffset = gstate_c.curTextureYOffset;
|
||||||
if (textureCache_->SetOffsetTexture(fb_size)) {
|
if (texCache->SetOffsetTexture(fb_size)) {
|
||||||
const float oldWidthFactor = widthFactor;
|
const float oldWidthFactor = widthFactor;
|
||||||
const float oldHeightFactor = heightFactor;
|
const float oldHeightFactor = heightFactor;
|
||||||
widthFactor = (float) w / (float) gstate_c.curTextureWidth;
|
widthFactor = (float) w / (float) gstate_c.curTextureWidth;
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "GPU/GPUInterface.h"
|
#include "GPU/GPUInterface.h"
|
||||||
#include "GPU/GPUState.h"
|
#include "GPU/GPUState.h"
|
||||||
#include "GPU/GLES/TextureScaler.h"
|
#include "GPU/GLES/TextureScaler.h"
|
||||||
|
#include "GPU/Common/TextureCacheCommon.h"
|
||||||
|
|
||||||
struct VirtualFramebuffer;
|
struct VirtualFramebuffer;
|
||||||
class FramebufferManager;
|
class FramebufferManager;
|
||||||
@ -51,13 +52,13 @@ inline bool UseBGRA8888() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
class TextureCache {
|
class TextureCache : public TextureCacheCommon {
|
||||||
public:
|
public:
|
||||||
TextureCache();
|
TextureCache();
|
||||||
~TextureCache();
|
~TextureCache();
|
||||||
|
|
||||||
void SetTexture(bool force = false);
|
void SetTexture(bool force = false);
|
||||||
bool SetOffsetTexture(u32 offset);
|
bool SetOffsetTexture(u32 offset) override;
|
||||||
|
|
||||||
void Clear(bool delete_them);
|
void Clear(bool delete_them);
|
||||||
void StartFrame();
|
void StartFrame();
|
||||||
|
@ -769,7 +769,7 @@ rotateVBO:
|
|||||||
SoftwareTransform(
|
SoftwareTransform(
|
||||||
prim, decoded, program, indexGen.VertexCount(),
|
prim, decoded, program, indexGen.VertexCount(),
|
||||||
dec_->VertexType(), (void *)inds, GE_VTYPE_IDX_16BIT, dec_->GetDecVtxFmt(),
|
dec_->VertexType(), (void *)inds, GE_VTYPE_IDX_16BIT, dec_->GetDecVtxFmt(),
|
||||||
indexGen.MaxIndex(), framebufferManager_, drawBuffer, numTrans, drawIndexed, &result);
|
indexGen.MaxIndex(), framebufferManager_, textureCache_, drawBuffer, numTrans, drawIndexed, &result);
|
||||||
|
|
||||||
if (result.action == SW_DRAW_PRIMITIVES) {
|
if (result.action == SW_DRAW_PRIMITIVES) {
|
||||||
if (result.setStencil) {
|
if (result.setStencil) {
|
||||||
|
@ -30,6 +30,7 @@ class ShaderManager;
|
|||||||
class TextureCache;
|
class TextureCache;
|
||||||
class FramebufferManager;
|
class FramebufferManager;
|
||||||
class FramebufferManagerCommon;
|
class FramebufferManagerCommon;
|
||||||
|
class TextureCacheCommon;
|
||||||
class FragmentTestCache;
|
class FragmentTestCache;
|
||||||
struct TransformedVertex;
|
struct TransformedVertex;
|
||||||
|
|
||||||
@ -193,14 +194,13 @@ private:
|
|||||||
void DecodeVerts();
|
void DecodeVerts();
|
||||||
void DecodeVertsStep();
|
void DecodeVertsStep();
|
||||||
void DoFlush();
|
void DoFlush();
|
||||||
void SoftwareTransform(int prim, u8 *decoded, LinkedShader *program, int vertexCount, u32 vertexType, void *inds, int indexType, const DecVtxFormat &decVtxFormat, int maxIndex, FramebufferManagerCommon *fbman, TransformedVertex *&drawBuffer, int &numTrans, bool &drawIndexed, SoftwareTransformResult *result);
|
void SoftwareTransform(int prim, u8 *decoded, LinkedShader *program, int vertexCount, u32 vertexType, void *inds, int indexType, const DecVtxFormat &decVtxFormat, int maxIndex, FramebufferManagerCommon *fbman, TextureCacheCommon *texCache, TransformedVertex *&drawBuffer, int &numTrans, bool &drawIndexed, SoftwareTransformResult *result);
|
||||||
void ApplyDrawState(int prim);
|
void ApplyDrawState(int prim);
|
||||||
void ApplyDrawStateLate();
|
void ApplyDrawStateLate();
|
||||||
void ApplyBlendState();
|
void ApplyBlendState();
|
||||||
void ApplyStencilReplaceOnly();
|
void ApplyStencilReplaceOnly();
|
||||||
bool ApplyShaderBlending();
|
bool ApplyShaderBlending();
|
||||||
inline void ResetShaderBlending();
|
inline void ResetShaderBlending();
|
||||||
bool IsReallyAClear(int numVerts) const;
|
|
||||||
GLuint AllocateBuffer();
|
GLuint AllocateBuffer();
|
||||||
void FreeBuffer(GLuint buf);
|
void FreeBuffer(GLuint buf);
|
||||||
|
|
||||||
|
@ -172,6 +172,7 @@
|
|||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="Common\TextureCacheCommon.h" />
|
||||||
<ClInclude Include="Common\TransformCommon.h" />
|
<ClInclude Include="Common\TransformCommon.h" />
|
||||||
<ClInclude Include="Common\VertexDecoderCommon.h" />
|
<ClInclude Include="Common\VertexDecoderCommon.h" />
|
||||||
<ClInclude Include="Debugger\Breakpoints.h" />
|
<ClInclude Include="Debugger\Breakpoints.h" />
|
||||||
@ -225,6 +226,7 @@
|
|||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="Common\TextureCacheCommon.cpp" />
|
||||||
<ClCompile Include="Common\TransformCommon.cpp" />
|
<ClCompile Include="Common\TransformCommon.cpp" />
|
||||||
<ClCompile Include="Common\VertexDecoderArm.cpp">
|
<ClCompile Include="Common\VertexDecoderArm.cpp">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||||
@ -286,4 +288,4 @@
|
|||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -156,6 +156,9 @@
|
|||||||
<ClInclude Include="Common\TextureDecoderNEON.h">
|
<ClInclude Include="Common\TextureDecoderNEON.h">
|
||||||
<Filter>Common</Filter>
|
<Filter>Common</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="Common\TextureCacheCommon.h">
|
||||||
|
<Filter>Common</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="Common\TransformCommon.h">
|
<ClInclude Include="Common\TransformCommon.h">
|
||||||
<Filter>Common</Filter>
|
<Filter>Common</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@ -296,6 +299,9 @@
|
|||||||
<ClCompile Include="Common\TextureDecoderNEON.cpp">
|
<ClCompile Include="Common\TextureDecoderNEON.cpp">
|
||||||
<Filter>Common</Filter>
|
<Filter>Common</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="Common\TextureCacheCommon.cpp">
|
||||||
|
<Filter>Common</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="Common\TransformCommon.cpp">
|
<ClCompile Include="Common\TransformCommon.cpp">
|
||||||
<Filter>Common</Filter>
|
<Filter>Common</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@ -321,4 +327,4 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="CMakeLists.txt" />
|
<None Include="CMakeLists.txt" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
Reference in New Issue
Block a user