Archived
1
Fork 0

Don't use dynamic viewport for shadows

This commit is contained in:
Joshua Goins 2018-11-11 05:18:59 -05:00
parent 80deaf7142
commit c92a62db3e

View file

@ -29,19 +29,6 @@ ShadowPass::~ShadowPass() {
}
void ShadowPass::render(VkCommandBuffer commandBuffer, World& world) {
VkViewport viewport = {};
viewport.width = renderer_.getConfig().shadowResolution;
viewport.height = renderer_.getConfig().shadowResolution;
viewport.maxDepth = 1.0f;
vkCmdSetViewport(commandBuffer, 0, 1, &viewport);
VkRect2D scissor = {};
scissor.extent.width = renderer_.getConfig().shadowResolution;
scissor.extent.height = renderer_.getConfig().shadowResolution;
vkCmdSetScissor(commandBuffer, 0, 1, &scissor);
VkClearValue clearColor = {};
clearColor.depthStencil.depth = 1.0f;
@ -197,10 +184,21 @@ void ShadowPass::createPipeline() {
inputAssembly.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
inputAssembly.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
VkViewport viewport = {};
viewport.width = renderer_.getConfig().shadowResolution;
viewport.height = renderer_.getConfig().shadowResolution;
viewport.maxDepth = 1.0f;
VkRect2D scissor = {};
scissor.extent.width = renderer_.getConfig().shadowResolution;
scissor.extent.height = renderer_.getConfig().shadowResolution;
VkPipelineViewportStateCreateInfo viewportState = {};
viewportState.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
viewportState.viewportCount = 1;
viewportState.pViewports = &viewport;
viewportState.scissorCount = 1;
viewportState.pScissors = &scissor;
VkPipelineRasterizationStateCreateInfo rasterizer = {};
rasterizer.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;