Skip to content

Commit

Permalink
Kill off more unused duplicate code
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Nov 13, 2017
1 parent 230f72a commit 35437e6
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 42 deletions.
18 changes: 1 addition & 17 deletions GPU/D3D11/DrawEngineD3D11.cpp
Expand Up @@ -249,22 +249,6 @@ ID3D11InputLayout *DrawEngineD3D11::SetupDecFmtForDraw(D3D11VertexShader *vshade
} }
} }


void DrawEngineD3D11::SetupVertexDecoder(u32 vertType) {
SetupVertexDecoderInternal(vertType);
}

inline void DrawEngineD3D11::SetupVertexDecoderInternal(u32 vertType) {
// As the decoder depends on the UVGenMode when we use UV prescale, we simply mash it
// into the top of the verttype where there are unused bits.
const u32 vertTypeID = (vertType & 0xFFFFFF) | (gstate.getUVGenMode() << 24);

// If vtype has changed, setup the vertex decoder.
if (vertTypeID != lastVType_) {
dec_ = GetVertexDecoder(vertTypeID);
lastVType_ = vertTypeID;
}
}

void DrawEngineD3D11::SubmitPrim(void *verts, void *inds, GEPrimitiveType prim, int vertexCount, u32 vertType, int *bytesRead) { void DrawEngineD3D11::SubmitPrim(void *verts, void *inds, GEPrimitiveType prim, int vertexCount, u32 vertType, int *bytesRead) {
if (!indexGen.PrimCompatible(prevPrim_, prim) || numDrawCalls >= MAX_DEFERRED_DRAW_CALLS || vertexCountInDrawCalls_ + vertexCount > VERTEX_BUFFER_MAX) if (!indexGen.PrimCompatible(prevPrim_, prim) || numDrawCalls >= MAX_DEFERRED_DRAW_CALLS || vertexCountInDrawCalls_ + vertexCount > VERTEX_BUFFER_MAX)
Flush(); Flush();
Expand All @@ -276,7 +260,7 @@ void DrawEngineD3D11::SubmitPrim(void *verts, void *inds, GEPrimitiveType prim,
prevPrim_ = prim; prevPrim_ = prim;
} }


SetupVertexDecoderInternal(vertType); SetupVertexDecoder(vertType);


*bytesRead = vertexCount * dec_->VertexSize(); *bytesRead = vertexCount * dec_->VertexSize();


Expand Down
3 changes: 0 additions & 3 deletions GPU/D3D11/DrawEngineD3D11.h
Expand Up @@ -121,9 +121,6 @@ class DrawEngineD3D11 : public DrawEngineCommon {


void BeginFrame(); void BeginFrame();


void SetupVertexDecoder(u32 vertType);
void SetupVertexDecoderInternal(u32 vertType);

// So that this can be inlined // So that this can be inlined
void Flush() { void Flush() {
if (!numDrawCalls) if (!numDrawCalls)
Expand Down
20 changes: 1 addition & 19 deletions GPU/Vulkan/DrawEngineVulkan.cpp
Expand Up @@ -361,24 +361,6 @@ void DrawEngineVulkan::EndFrame() {
vertexCache_->End(); vertexCache_->End();
} }


void DrawEngineVulkan::SetupVertexDecoder(u32 vertType) {
SetupVertexDecoderInternal(vertType);
}

inline void DrawEngineVulkan::SetupVertexDecoderInternal(u32 vertType) {
// As the decoder depends on the UVGenMode when we use UV prescale, we simply mash it
// into the top of the verttype where there are unused bits.
const u32 vertTypeID = (vertType & 0xFFFFFF) | (gstate.getUVGenMode() << 24);

// If vtype has changed, setup the vertex decoder.
if (vertTypeID != lastVType_) {
dec_ = GetVertexDecoder(vertTypeID);
lastVType_ = vertTypeID;
}
if (!dec_)
Crash();
}

void DrawEngineVulkan::SubmitPrim(void *verts, void *inds, GEPrimitiveType prim, int vertexCount, u32 vertType, int *bytesRead) { void DrawEngineVulkan::SubmitPrim(void *verts, void *inds, GEPrimitiveType prim, int vertexCount, u32 vertType, int *bytesRead) {
if (!indexGen.PrimCompatible(prevPrim_, prim) || numDrawCalls >= MAX_DEFERRED_DRAW_CALLS || vertexCountInDrawCalls_ + vertexCount > VERTEX_BUFFER_MAX) if (!indexGen.PrimCompatible(prevPrim_, prim) || numDrawCalls >= MAX_DEFERRED_DRAW_CALLS || vertexCountInDrawCalls_ + vertexCount > VERTEX_BUFFER_MAX)
Flush(); Flush();
Expand All @@ -390,7 +372,7 @@ void DrawEngineVulkan::SubmitPrim(void *verts, void *inds, GEPrimitiveType prim,
prevPrim_ = prim; prevPrim_ = prim;
} }


SetupVertexDecoderInternal(vertType); SetupVertexDecoder(vertType);


*bytesRead = vertexCount * dec_->VertexSize(); *bytesRead = vertexCount * dec_->VertexSize();
if ((vertexCount < 2 && prim > 0) || (vertexCount < 3 && prim > 2 && prim != GE_PRIM_RECTANGLES)) if ((vertexCount < 2 && prim > 0) || (vertexCount < 3 && prim > 2 && prim != GE_PRIM_RECTANGLES))
Expand Down
3 changes: 0 additions & 3 deletions GPU/Vulkan/DrawEngineVulkan.h
Expand Up @@ -140,9 +140,6 @@ class DrawEngineVulkan : public DrawEngineCommon {
void DeviceLost(); void DeviceLost();
void DeviceRestore(VulkanContext *vulkan, Draw::DrawContext *draw); void DeviceRestore(VulkanContext *vulkan, Draw::DrawContext *draw);


void SetupVertexDecoder(u32 vertType);
void SetupVertexDecoderInternal(u32 vertType);

// So that this can be inlined // So that this can be inlined
void Flush() { void Flush() {
if (!numDrawCalls) if (!numDrawCalls)
Expand Down

0 comments on commit 35437e6

Please sign in to comment.