Skip to content

Commit

Permalink
Fix #10692 (crash when starting games from command line). Throw in so…
Browse files Browse the repository at this point in the history
…me minor Vulkan fixes as well.
  • Loading branch information
hrydgard committed Mar 8, 2018
1 parent 90dbd9a commit 0ed3dea
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions GPU/Vulkan/DrawEngineVulkan.cpp
Expand Up @@ -809,9 +809,9 @@ void DrawEngineVulkan::DoFlush() {
if (!ibuf)
ibOffset = (uint32_t)frame->pushIndex->Push(decIndex, sizeof(uint16_t) * indexGen.VertexCount(), &ibuf);
int numInstances = tess ? numPatches : 1;
renderManager->DrawIndexed(pipelineLayout_, ds, 3, dynamicUBOOffsets, vbuf, vbOffset, ibuf, ibOffset, vertexCount, numInstances, VK_INDEX_TYPE_UINT16);
renderManager->DrawIndexed(pipelineLayout_, ds, ARRAY_SIZE(dynamicUBOOffsets), dynamicUBOOffsets, vbuf, vbOffset, ibuf, ibOffset, vertexCount, numInstances, VK_INDEX_TYPE_UINT16);
} else {
renderManager->Draw(pipelineLayout_, ds, 3, dynamicUBOOffsets, vbuf, vbOffset, vertexCount);
renderManager->Draw(pipelineLayout_, ds, ARRAY_SIZE(dynamicUBOOffsets), dynamicUBOOffsets, vbuf, vbOffset, vertexCount);
}
}
} else {
Expand Down Expand Up @@ -913,12 +913,12 @@ void DrawEngineVulkan::DoFlush() {
vbOffset = (uint32_t)frame->pushVertex->Push(drawBuffer, maxIndex * sizeof(TransformedVertex), &vbuf);
ibOffset = (uint32_t)frame->pushIndex->Push(inds, sizeof(short) * numTrans, &ibuf);
VkDeviceSize offsets[1] = { vbOffset };
renderManager->DrawIndexed(pipelineLayout_, ds, 3, dynamicUBOOffsets, vbuf, vbOffset, ibuf, ibOffset, numTrans, 1, VK_INDEX_TYPE_UINT16);
renderManager->DrawIndexed(pipelineLayout_, ds, ARRAY_SIZE(dynamicUBOOffsets), dynamicUBOOffsets, vbuf, vbOffset, ibuf, ibOffset, numTrans, 1, VK_INDEX_TYPE_UINT16);
} else {
VkBuffer vbuf;
vbOffset = (uint32_t)frame->pushVertex->Push(drawBuffer, numTrans * sizeof(TransformedVertex), &vbuf);
VkDeviceSize offsets[1] = { vbOffset };
renderManager->Draw(pipelineLayout_, ds, 3, dynamicUBOOffsets, vbuf, vbOffset, numTrans);
renderManager->Draw(pipelineLayout_, ds, ARRAY_SIZE(dynamicUBOOffsets), dynamicUBOOffsets, vbuf, vbOffset, numTrans);
}
} else if (result.action == SW_CLEAR) {
// Note: we won't get here if the clear is alpha but not color, or color but not alpha.
Expand Down
2 changes: 1 addition & 1 deletion UI/EmuScreen.cpp
Expand Up @@ -1189,7 +1189,7 @@ void EmuScreen::renderUI() {

DrawContext *thin3d = screenManager()->getDrawContext();
UIContext *ctx = screenManager()->getUIContext();

ctx->BeginFrame();
// This sets up some important states but not the viewport.
ctx->Begin();

Expand Down
2 changes: 1 addition & 1 deletion ext/native/thin3d/VulkanQueueRunner.h
Expand Up @@ -32,7 +32,7 @@ struct VkRenderData {
VkPipelineLayout pipelineLayout;
VkDescriptorSet ds;
int numUboOffsets;
uint32_t uboOffsets[3];
uint32_t uboOffsets[2];
VkBuffer vbuffer;
VkDeviceSize voffset;
uint32_t count;
Expand Down
2 changes: 2 additions & 0 deletions ext/native/thin3d/VulkanRenderManager.h
Expand Up @@ -167,6 +167,7 @@ class VulkanRenderManager {
data.draw.vbuffer = vbuffer;
data.draw.voffset = voffset;
data.draw.numUboOffsets = numUboOffsets;
assert(numUboOffsets <= ARRAY_SIZE(data.drawIndexed.uboOffsets));
for (int i = 0; i < numUboOffsets; i++)
data.draw.uboOffsets[i] = uboOffsets[i];
curRenderStep_->commands.push_back(data);
Expand All @@ -185,6 +186,7 @@ class VulkanRenderManager {
data.drawIndexed.ibuffer = ibuffer;
data.drawIndexed.ioffset = ioffset;
data.drawIndexed.numUboOffsets = numUboOffsets;
assert(numUboOffsets <= ARRAY_SIZE(data.drawIndexed.uboOffsets));
for (int i = 0; i < numUboOffsets; i++)
data.drawIndexed.uboOffsets[i] = uboOffsets[i];
data.drawIndexed.indexType = indexType;
Expand Down

0 comments on commit 0ed3dea

Please sign in to comment.