Fix validation issue with clears, remove redundant code

This commit is contained in:
Henrik Rydgård 2022-10-26 20:26:30 +02:00
parent e0bbebc65e
commit 6d9008dab5
5 changed files with 2 additions and 22 deletions

View File

@ -1583,17 +1583,13 @@ void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer c
vkCmdDraw(cmd, c.draw.count, 1, c.draw.offset, 0);
break;
case VKRRenderCommand::BIND_DESCRIPTOR_SET:
vkCmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout, c.bindDescSet.setIndex, 1, &c.bindDescSet.descSet, 0, nullptr);
break;
case VKRRenderCommand::CLEAR:
{
// If we get here, we failed to merge a clear into a render pass load op. This is bad for perf.
int numAttachments = 0;
VkClearRect rc{};
rc.baseArrayLayer = 0;
rc.layerCount = c.clear.numLayers;
rc.layerCount = 1; // In multiview mode, 1 means to replicate to all the active layers.
rc.rect.extent.width = (uint32_t)curWidth;
rc.rect.extent.height = (uint32_t)curHeight;
VkClearAttachment attachments[2]{};

View File

@ -37,7 +37,6 @@ enum class VKRRenderCommand : uint8_t {
DRAW,
DRAW_INDEXED,
PUSH_CONSTANTS,
BIND_DESCRIPTOR_SET,
SELF_DEPENDENCY_BARRIER,
DEBUG_ANNOTATION,
NUM_RENDER_COMMANDS,
@ -129,7 +128,6 @@ struct VkRenderData {
float clearZ;
int clearStencil;
int clearMask; // VK_IMAGE_ASPECT_COLOR_BIT etc
int numLayers;
} clear;
struct {
VkViewport vp;
@ -154,10 +152,6 @@ struct VkRenderData {
struct {
const char *annotation;
} debugAnnotation;
struct {
uint32_t setIndex;
VkDescriptorSet descSet;
} bindDescSet;
};
};

View File

@ -833,7 +833,6 @@ void VulkanRenderManager::BindFramebufferAsRenderTarget(VKRFramebuffer *fb, VKRR
data.clear.clearZ = clearDepth;
data.clear.clearStencil = clearStencil;
data.clear.clearMask = clearMask;
data.clear.numLayers = curRenderStep_->render.framebuffer ? curRenderStep_->render.framebuffer->numLayers : 1;
curRenderStep_->commands.push_back(data);
curRenderArea_.SetRect(0, 0, curWidth_, curHeight_);
}

View File

@ -270,15 +270,6 @@ public:
compileMutex_.unlock();
}
// We always pass in desc set 0 directly in draw commands. This is used only to bind higher descriptor sets.
void BindDescriptorSet(int index, const VkDescriptorSet descSet) {
_dbg_assert_(curRenderStep_ && curRenderStep_->stepType == VKRStepType::RENDER);
VkRenderData data{ VKRRenderCommand::BIND_DESCRIPTOR_SET };
data.bindDescSet.setIndex = index;
data.bindDescSet.descSet = descSet;
curRenderStep_->commands.push_back(data);
}
void BindPipeline(VKRGraphicsPipeline *pipeline, PipelineFlags flags, VkPipelineLayout pipelineLayout) {
_dbg_assert_(curRenderStep_ && curRenderStep_->stepType == VKRStepType::RENDER);
_dbg_assert_(pipeline != nullptr);

View File

@ -1351,7 +1351,7 @@ bool GenerateVertexShader(const VShaderID &id, char *buffer, const ShaderLanguag
WRITE(p, " }\n");
}
if (useSimpleStereo) {
if (useSimpleStereo && useHWTransform) {
p.C(" float zFactor = 0.2 * float(gl_ViewIndex * 2 - 1);\n");
p.C(" float zFocus = 0.0;\n");
p.C(" gl_Position.x += (-gl_Position.z - zFocus) * zFactor;\n");