Fix primitive topology. Crashfix.

This commit is contained in:
Henrik Rydgard 2016-01-09 17:12:37 +01:00
parent 9e34d7d625
commit 7eeba080c7
3 changed files with 17 additions and 12 deletions

View file

@ -52,16 +52,6 @@ enum {
DRAW_BINDING_DYNUBO_BONE = 4,
};
const VkPrimitiveTopology prim[8] = {
VK_PRIMITIVE_TOPOLOGY_POINT_LIST,
VK_PRIMITIVE_TOPOLOGY_LINE_LIST,
VK_PRIMITIVE_TOPOLOGY_LINE_STRIP,
VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST,
VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP,
VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN,
VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, // Vulkan doesn't do quads. We could do strips with restart-index though. We could also do RECT primitives in the geometry shader.
};
enum {
TRANSFORMED_VERTEX_BUFFER_SIZE = VERTEX_BUFFER_MAX * sizeof(TransformedVertex)
};

View file

@ -88,6 +88,17 @@ static const VkStencilOp stencilOps[] = {
VK_STENCIL_OP_KEEP, // reserved
};
const VkPrimitiveTopology primToVulkan[8] = {
VK_PRIMITIVE_TOPOLOGY_POINT_LIST,
VK_PRIMITIVE_TOPOLOGY_LINE_LIST,
VK_PRIMITIVE_TOPOLOGY_LINE_STRIP,
VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST,
VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP,
VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN,
VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, // Vulkan doesn't do quads. We could do strips with restart-index though. We could also do RECT primitives in the geometry shader.
};
bool ApplyShaderBlending() {
return false;
}
@ -249,6 +260,8 @@ void ConvertStateToVulkanKey(FramebufferManagerVulkan &fbManager, int prim, Vulk
}
}
key.topology = primToVulkan[prim];
VkViewport &vp = dynState.viewport;
vp.x = vpAndScissor.viewportX;
vp.y = vpAndScissor.viewportY;

View file

@ -563,8 +563,10 @@ public:
private:
void Destroy() {
ILOG("texture destroyed: %p", this);
vkTex_->Destroy(vulkan_);
delete vkTex_;
if (vkTex_) {
vkTex_->Destroy(vulkan_);
delete vkTex_;
}
}
VulkanContext *vulkan_;