mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 21:39:52 +00:00
Vulkan: Correct missing offsets in Draw.
Was silently ignoring them. Caused stretch in postshaders.
This commit is contained in:
parent
d4f4e87e66
commit
e309712fed
@ -1091,7 +1091,7 @@ void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer c
|
|||||||
if (c.draw.vbuffer) {
|
if (c.draw.vbuffer) {
|
||||||
vkCmdBindVertexBuffers(cmd, 0, 1, &c.draw.vbuffer, &c.draw.voffset);
|
vkCmdBindVertexBuffers(cmd, 0, 1, &c.draw.vbuffer, &c.draw.voffset);
|
||||||
}
|
}
|
||||||
vkCmdDraw(cmd, c.draw.count, 1, 0, 0);
|
vkCmdDraw(cmd, c.draw.count, 1, c.draw.offset, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VKRRenderCommand::CLEAR:
|
case VKRRenderCommand::CLEAR:
|
||||||
|
@ -109,6 +109,7 @@ struct VkRenderData {
|
|||||||
VkBuffer vbuffer;
|
VkBuffer vbuffer;
|
||||||
VkDeviceSize voffset;
|
VkDeviceSize voffset;
|
||||||
uint32_t count;
|
uint32_t count;
|
||||||
|
uint32_t offset;
|
||||||
} draw;
|
} draw;
|
||||||
struct {
|
struct {
|
||||||
VkPipelineLayout pipelineLayout;
|
VkPipelineLayout pipelineLayout;
|
||||||
|
@ -177,10 +177,11 @@ public:
|
|||||||
|
|
||||||
void Clear(uint32_t clearColor, float clearZ, int clearStencil, int clearMask);
|
void Clear(uint32_t clearColor, float clearZ, int clearStencil, int clearMask);
|
||||||
|
|
||||||
void Draw(VkPipelineLayout layout, VkDescriptorSet descSet, int numUboOffsets, const uint32_t *uboOffsets, VkBuffer vbuffer, int voffset, int count) {
|
void Draw(VkPipelineLayout layout, VkDescriptorSet descSet, int numUboOffsets, const uint32_t *uboOffsets, VkBuffer vbuffer, int voffset, int count, int offset = 0) {
|
||||||
_dbg_assert_(G3D, curRenderStep_ && curRenderStep_->stepType == VKRStepType::RENDER);
|
_dbg_assert_(G3D, curRenderStep_ && curRenderStep_->stepType == VKRStepType::RENDER);
|
||||||
VkRenderData data{ VKRRenderCommand::DRAW };
|
VkRenderData data{ VKRRenderCommand::DRAW };
|
||||||
data.draw.count = count;
|
data.draw.count = count;
|
||||||
|
data.draw.offset = offset;
|
||||||
data.draw.pipelineLayout = layout;
|
data.draw.pipelineLayout = layout;
|
||||||
data.draw.ds = descSet;
|
data.draw.ds = descSet;
|
||||||
data.draw.vbuffer = vbuffer;
|
data.draw.vbuffer = vbuffer;
|
||||||
|
@ -140,7 +140,7 @@ static const std::vector<ShaderSource> fsTexCol = {
|
|||||||
"#extension GL_ARB_shading_language_420pack : enable\n"
|
"#extension GL_ARB_shading_language_420pack : enable\n"
|
||||||
"layout(location = 0) in vec4 oColor0;\n"
|
"layout(location = 0) in vec4 oColor0;\n"
|
||||||
"layout(location = 1) in vec2 oTexCoord0;\n"
|
"layout(location = 1) in vec2 oTexCoord0;\n"
|
||||||
"layout(location = 0) out vec4 fragColor0\n;"
|
"layout(location = 0) out vec4 fragColor0;\n"
|
||||||
"layout(set = 0, binding = 1) uniform sampler2D Sampler0;\n"
|
"layout(set = 0, binding = 1) uniform sampler2D Sampler0;\n"
|
||||||
"void main() { fragColor0 = texture(Sampler0, oTexCoord0) * oColor0; }\n"
|
"void main() { fragColor0 = texture(Sampler0, oTexCoord0) * oColor0; }\n"
|
||||||
}
|
}
|
||||||
@ -220,7 +220,7 @@ static const std::vector<ShaderSource> fsCol = {
|
|||||||
"#extension GL_ARB_separate_shader_objects : enable\n"
|
"#extension GL_ARB_separate_shader_objects : enable\n"
|
||||||
"#extension GL_ARB_shading_language_420pack : enable\n"
|
"#extension GL_ARB_shading_language_420pack : enable\n"
|
||||||
"layout(location = 0) in vec4 oColor0;\n"
|
"layout(location = 0) in vec4 oColor0;\n"
|
||||||
"layout(location = 0) out vec4 fragColor0\n;"
|
"layout(location = 0) out vec4 fragColor0;\n"
|
||||||
"void main() { fragColor0 = oColor0; }\n"
|
"void main() { fragColor0 = oColor0; }\n"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1242,7 +1242,7 @@ void VKContext::Draw(int vertexCount, int offset) {
|
|||||||
|
|
||||||
renderManager_.BindPipeline(curPipeline_->vkpipeline);
|
renderManager_.BindPipeline(curPipeline_->vkpipeline);
|
||||||
ApplyDynamicState();
|
ApplyDynamicState();
|
||||||
renderManager_.Draw(pipelineLayout_, descSet, 1, &ubo_offset, vulkanVbuf, (int)vbBindOffset, vertexCount);
|
renderManager_.Draw(pipelineLayout_, descSet, 1, &ubo_offset, vulkanVbuf, (int)vbBindOffset + curVBufferOffsets_[0], vertexCount, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VKContext::DrawIndexed(int vertexCount, int offset) {
|
void VKContext::DrawIndexed(int vertexCount, int offset) {
|
||||||
@ -1258,7 +1258,7 @@ void VKContext::DrawIndexed(int vertexCount, int offset) {
|
|||||||
|
|
||||||
renderManager_.BindPipeline(curPipeline_->vkpipeline);
|
renderManager_.BindPipeline(curPipeline_->vkpipeline);
|
||||||
ApplyDynamicState();
|
ApplyDynamicState();
|
||||||
renderManager_.DrawIndexed(pipelineLayout_, descSet, 1, &ubo_offset, vulkanVbuf, (int)vbBindOffset, vulkanIbuf, (int)ibBindOffset + offset * sizeof(uint32_t), vertexCount, 1, VK_INDEX_TYPE_UINT32);
|
renderManager_.DrawIndexed(pipelineLayout_, descSet, 1, &ubo_offset, vulkanVbuf, (int)vbBindOffset + curVBufferOffsets_[0], vulkanIbuf, (int)ibBindOffset + offset * sizeof(uint32_t), vertexCount, 1, VK_INDEX_TYPE_UINT32);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VKContext::DrawUP(const void *vdata, int vertexCount) {
|
void VKContext::DrawUP(const void *vdata, int vertexCount) {
|
||||||
@ -1270,7 +1270,7 @@ void VKContext::DrawUP(const void *vdata, int vertexCount) {
|
|||||||
|
|
||||||
renderManager_.BindPipeline(curPipeline_->vkpipeline);
|
renderManager_.BindPipeline(curPipeline_->vkpipeline);
|
||||||
ApplyDynamicState();
|
ApplyDynamicState();
|
||||||
renderManager_.Draw(pipelineLayout_, descSet, 1, &ubo_offset, vulkanVbuf, (int)vbBindOffset, vertexCount);
|
renderManager_.Draw(pipelineLayout_, descSet, 1, &ubo_offset, vulkanVbuf, (int)vbBindOffset + curVBufferOffsets_[0], vertexCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VKContext::Clear(int clearMask, uint32_t colorval, float depthVal, int stencilVal) {
|
void VKContext::Clear(int clearMask, uint32_t colorval, float depthVal, int stencilVal) {
|
||||||
|
Loading…
Reference in New Issue
Block a user