- convert triangle fan to triangle list on macOS
This commit is contained in:
parent
4668d0b1de
commit
aa1ff58353
4 changed files with 64 additions and 1 deletions
|
|
@ -614,3 +614,34 @@ void VkRenderState::EndFrame()
|
|||
mStreamDataOffset = 0;
|
||||
mDataIndex = -1;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void VkRenderStateMolten::Draw(int dt, int index, int count, bool apply)
|
||||
{
|
||||
if (dt == DT_TriangleFan)
|
||||
{
|
||||
IIndexBuffer *oldIndexBuffer = mIndexBuffer;
|
||||
mIndexBuffer = GetVulkanFrameBuffer()->FanToTrisIndexBuffer.get();
|
||||
|
||||
if (apply || mNeedApply)
|
||||
Apply(DT_Triangles);
|
||||
else
|
||||
ApplyVertexBuffers();
|
||||
|
||||
drawcalls.Clock();
|
||||
mCommandBuffer->drawIndexed((count - 2) * 3, 1, 0, index, 0);
|
||||
drawcalls.Unclock();
|
||||
|
||||
mIndexBuffer = oldIndexBuffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (apply || mNeedApply)
|
||||
Apply(dt);
|
||||
|
||||
drawcalls.Clock();
|
||||
mCommandBuffer->draw(count, 1, index, 0);
|
||||
drawcalls.Unclock();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ class VkRenderState : public FRenderState
|
|||
{
|
||||
public:
|
||||
VkRenderState();
|
||||
virtual ~VkRenderState() = default;
|
||||
|
||||
// Draw commands
|
||||
void ClearScreen() override;
|
||||
|
|
@ -45,7 +46,7 @@ public:
|
|||
void EndRenderPass();
|
||||
void EndFrame();
|
||||
|
||||
private:
|
||||
protected:
|
||||
void Apply(int dt);
|
||||
void ApplyRenderPass(int dt);
|
||||
void ApplyStencilRef();
|
||||
|
|
@ -106,3 +107,11 @@ private:
|
|||
bool mLastModelMatrixEnabled = true;
|
||||
bool mLastTextureMatrixEnabled = true;
|
||||
};
|
||||
|
||||
class VkRenderStateMolten : public VkRenderState
|
||||
{
|
||||
public:
|
||||
using VkRenderState::VkRenderState;
|
||||
|
||||
void Draw(int dt, int index, int count, bool apply = true) override;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue