Move GLES' SoftwareTransform to Common

This commit is contained in:
Henrik Rydgard 2014-09-13 13:27:42 +02:00
parent 4212bbb51e
commit 19a9c4481f
9 changed files with 48 additions and 29 deletions

View File

@ -1305,6 +1305,8 @@ add_library(GPU OBJECT
GPU/Common/FramebufferCommon.cpp
GPU/Common/FramebufferCommon.h
GPU/Common/GPUDebugInterface.h
GPU/Common/SoftwareTransformCommon.cpp
GPU/Common/SoftwareTransformCommon.h
GPU/Common/VertexDecoderCommon.cpp
GPU/Common/VertexDecoderCommon.h
GPU/Common/TransformCommon.cpp
@ -1313,6 +1315,8 @@ add_library(GPU OBJECT
GPU/Common/IndexGenerator.h
GPU/Common/TextureDecoder.cpp
GPU/Common/TextureDecoder.h
GPU/Common/TextureCacheCommon.cpp
GPU/Common/TextureCacheCommon.h
${GPU_NEON}
GPU/Common/PostShader.cpp
GPU/Common/PostShader.h
@ -1343,7 +1347,6 @@ add_library(GPU OBJECT
GPU/GLES/TextureScaler.h
GPU/GLES/TransformPipeline.cpp
GPU/GLES/TransformPipeline.h
GPU/GLES/SoftwareTransform.cpp
GPU/GLES/VertexShaderGenerator.cpp
GPU/GLES/VertexShaderGenerator.h
GPU/GPUInterface.h

View File

@ -25,7 +25,7 @@
#include "GPU/Common/TransformCommon.h"
#include "GPU/Common/FramebufferCommon.h"
#include "GPU/Common/TextureCacheCommon.h"
#include "GPU/GLES/TransformPipeline.h"
#include "GPU/Common/SoftwareTransformCommon.h"
// This is the software transform pipeline, which is necessary for supporting RECT
// primitives correctly without geometry shaders, and may be easier to use for
@ -120,9 +120,9 @@ static bool IsReallyAClear(const TransformedVertex *transformed, int numVerts) {
return true;
}
void TransformDrawEngine::SoftwareTransform(
int prim, u8 *decoded, LinkedShader *program, int vertexCount, u32 vertType, void *inds, int indexType,
const DecVtxFormat &decVtxFormat, int maxIndex, FramebufferManagerCommon *fbman, TextureCacheCommon *texCache, TransformedVertex *&drawBuffer, int &numTrans, bool &drawIndexed, SoftwareTransformResult *result) {
void SoftwareTransform(
int prim, u8 *decoded, int vertexCount, u32 vertType, void *inds, int indexType,
const DecVtxFormat &decVtxFormat, int maxIndex, FramebufferManagerCommon *fbman, TextureCacheCommon *texCache, TransformedVertex *transformed, TransformedVertex *transformedExpanded, TransformedVertex *&drawBuffer, int &numTrans, bool &drawIndexed, SoftwareTransformResult *result) {
bool throughmode = (vertType & GE_VTYPE_THROUGH_MASK) != 0;
bool lmode = gstate.isUsingSecondaryColor() && gstate.isLightingEnabled();

View File

@ -0,0 +1,25 @@
#pragma once
#include "Common/CommonTypes.h"
#include "VertexDecoderCommon.h"
class FramebufferManagerCommon;
class TextureCacheCommon;
enum SoftwareTransformAction {
SW_DRAW_PRIMITIVES,
SW_CLEAR,
};
struct SoftwareTransformResult {
SoftwareTransformAction action;
u32 color;
float depth;
bool setStencil;
u8 stencilValue;
};
void SoftwareTransform(int prim, u8 *decoded, int vertexCount, u32 vertexType, void *inds, int indexType, const DecVtxFormat &decVtxFormat, int maxIndex, FramebufferManagerCommon *fbman, TextureCacheCommon *texCache, TransformedVertex *transformed, TransformedVertex *transformedExpanded, TransformedVertex *&drawBuffer,
int &numTrans, bool &drawIndexed, SoftwareTransformResult *result);

View File

@ -81,6 +81,7 @@
#include "GPU/Common/TextureDecoder.h"
#include "GPU/Common/SplineCommon.h"
#include "GPU/Common/VertexDecoderCommon.h"
#include "GPU/Common/SoftwareTransformCommon.h"
#include "GPU/GLES/FragmentTestCache.h"
#include "GPU/GLES/StateMapping.h"
#include "GPU/GLES/TextureCache.h"
@ -767,9 +768,9 @@ rotateVBO:
memset(&result, 0, sizeof(result));
SoftwareTransform(
prim, decoded, program, indexGen.VertexCount(),
prim, decoded, indexGen.VertexCount(),
dec_->VertexType(), (void *)inds, GE_VTYPE_IDX_16BIT, dec_->GetDecVtxFmt(),
indexGen.MaxIndex(), framebufferManager_, textureCache_, drawBuffer, numTrans, drawIndexed, &result);
indexGen.MaxIndex(), framebufferManager_, textureCache_, transformed, transformedExpanded, drawBuffer, numTrans, drawIndexed, &result);
if (result.action == SW_DRAW_PRIMITIVES) {
if (result.setStencil) {

View File

@ -97,21 +97,6 @@ public:
u8 flags;
};
enum SoftwareTransformAction {
SW_DRAW_PRIMITIVES,
SW_CLEAR,
};
struct SoftwareTransformResult {
SoftwareTransformAction action;
u32 color;
float depth;
bool setStencil;
u8 stencilValue;
};
// Handles transform, lighting and drawing.
class TransformDrawEngine : public GfxResourceHolder {
public:
@ -194,7 +179,6 @@ private:
void DecodeVerts();
void DecodeVertsStep();
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, TextureCacheCommon *texCache, TransformedVertex *&drawBuffer, int &numTrans, bool &drawIndexed, SoftwareTransformResult *result);
void ApplyDrawState(int prim);
void ApplyDrawStateLate();
void ApplyBlendState();

View File

@ -165,6 +165,7 @@
<ClInclude Include="Common\GPUDebugInterface.h" />
<ClInclude Include="Common\IndexGenerator.h" />
<ClInclude Include="Common\PostShader.h" />
<ClInclude Include="Common\SoftwareTransformCommon.h" />
<ClInclude Include="Common\SplineCommon.h" />
<ClInclude Include="Common\TextureDecoderNEON.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
@ -228,6 +229,7 @@
</ClCompile>
<ClCompile Include="Common\TextureCacheCommon.cpp" />
<ClCompile Include="Common\TransformCommon.cpp" />
<ClCompile Include="Common\SoftwareTransformCommon.cpp" />
<ClCompile Include="Common\VertexDecoderArm.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
@ -263,7 +265,6 @@
<ClCompile Include="GLES\StencilBuffer.cpp" />
<ClCompile Include="GLES\TextureCache.cpp" />
<ClCompile Include="GLES\TextureScaler.cpp" />
<ClCompile Include="GLES\SoftwareTransform.cpp" />
<ClCompile Include="GLES\TransformPipeline.cpp" />
<ClCompile Include="GLES\VertexShaderGenerator.cpp" />
<ClCompile Include="GPUCommon.cpp" />

View File

@ -171,6 +171,9 @@
<ClInclude Include="Common\FramebufferCommon.h">
<Filter>Common</Filter>
</ClInclude>
<ClInclude Include="Common\SoftwareTransformCommon.h">
<Filter>Common</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Math3D.cpp">
@ -209,9 +212,6 @@
<ClCompile Include="GLES\TransformPipeline.cpp">
<Filter>GLES</Filter>
</ClCompile>
<ClCompile Include="GLES\SoftwareTransform.cpp">
<Filter>GLES</Filter>
</ClCompile>
<ClCompile Include="GLES\VertexShaderGenerator.cpp">
<Filter>GLES</Filter>
</ClCompile>
@ -323,6 +323,9 @@
<ClCompile Include="Common\VertexDecoderArm.cpp">
<Filter>Common</Filter>
</ClCompile>
<ClCompile Include="Common\SoftwareTransformCommon.cpp">
<Filter>Common</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="CMakeLists.txt" />

View File

@ -32,7 +32,6 @@ SOURCES += $$P/GPU/GeDisasm.cpp \ # GPU
$$P/GPU/GLES/Framebuffer.cpp \
$$P/GPU/GLES/GLES_GPU.cpp \
$$P/GPU/GLES/ShaderManager.cpp \
$$P/GPU/GLES/SoftwareTransform.cpp \
$$P/GPU/GLES/Spline.cpp \
$$P/GPU/GLES/StateMapping.cpp \
$$P/GPU/GLES/StencilBuffer.cpp \
@ -45,7 +44,9 @@ SOURCES += $$P/GPU/GeDisasm.cpp \ # GPU
$$P/GPU/Common/IndexGenerator.cpp \
$$P/GPU/Common/TextureDecoder.cpp \
$$P/GPU/Common/VertexDecoderCommon.cpp \
$$P/GPU/Common/TextureCacheCommon.cpp \
$$P/GPU/Common/TransformCommon.cpp \
$$P/GPU/Common/SoftwareTransformCommon.cpp \
$$P/GPU/Common/PostShader.cpp \
$$P/GPU/Common/FramebufferCommon.cpp \
$$P/ext/xxhash.c \ # xxHash

View File

@ -138,7 +138,9 @@ EXEC_AND_LIB_FILES := \
$(SRC)/GPU/GeDisasm.cpp \
$(SRC)/GPU/Common/FramebufferCommon.cpp \
$(SRC)/GPU/Common/IndexGenerator.cpp.arm \
$(SRC)/GPU/Common/SoftwareTransformCommon.cpp.arm \
$(SRC)/GPU/Common/VertexDecoderCommon.cpp.arm \
$(SRC)/GPU/Common/TextureCacheCommon.cpp.arm \
$(SRC)/GPU/Common/TransformCommon.cpp.arm \
$(SRC)/GPU/Common/TextureDecoder.cpp \
$(SRC)/GPU/Common/PostShader.cpp \
@ -150,7 +152,6 @@ EXEC_AND_LIB_FILES := \
$(SRC)/GPU/GLES/StencilBuffer.cpp.arm \
$(SRC)/GPU/GLES/TextureCache.cpp.arm \
$(SRC)/GPU/GLES/TransformPipeline.cpp.arm \
$(SRC)/GPU/GLES/SoftwareTransform.cpp.arm \
$(SRC)/GPU/GLES/StateMapping.cpp.arm \
$(SRC)/GPU/GLES/ShaderManager.cpp.arm \
$(SRC)/GPU/GLES/VertexShaderGenerator.cpp.arm \