mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-19 05:52:11 +01:00
[dxvk] Enable and use dynamic viewport and scissor rect count
This commit is contained in:
parent
b34421b055
commit
4b82a05e05
@ -707,11 +707,10 @@ namespace dxvk {
|
||||
|
||||
|
||||
void cmdSetScissor(
|
||||
uint32_t firstScissor,
|
||||
uint32_t scissorCount,
|
||||
const VkRect2D* scissors) {
|
||||
m_vkd->vkCmdSetScissor(m_execBuffer,
|
||||
firstScissor, scissorCount, scissors);
|
||||
m_vkd->vkCmdSetScissorWithCountEXT(
|
||||
m_execBuffer, scissorCount, scissors);
|
||||
}
|
||||
|
||||
|
||||
@ -724,11 +723,10 @@ namespace dxvk {
|
||||
|
||||
|
||||
void cmdSetViewport(
|
||||
uint32_t firstViewport,
|
||||
uint32_t viewportCount,
|
||||
const VkViewport* viewports) {
|
||||
m_vkd->vkCmdSetViewport(m_execBuffer,
|
||||
firstViewport, viewportCount, viewports);
|
||||
m_vkd->vkCmdSetViewportWithCountEXT(
|
||||
m_execBuffer, viewportCount, viewports);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1661,8 +1661,8 @@ namespace dxvk {
|
||||
m_cmd->cmdBindDescriptorSet(VK_PIPELINE_BIND_POINT_GRAPHICS,
|
||||
pipeInfo.pipeLayout, descriptorWrite.dstSet, 0, nullptr);
|
||||
|
||||
m_cmd->cmdSetViewport(0, 1, &viewport);
|
||||
m_cmd->cmdSetScissor (0, 1, &scissor);
|
||||
m_cmd->cmdSetViewport(1, &viewport);
|
||||
m_cmd->cmdSetScissor(1, &scissor);
|
||||
|
||||
m_cmd->cmdPushConstants(
|
||||
pipeInfo.pipeLayout,
|
||||
@ -2290,11 +2290,6 @@ namespace dxvk {
|
||||
uint32_t viewportCount,
|
||||
const VkViewport* viewports,
|
||||
const VkRect2D* scissorRects) {
|
||||
if (m_state.gp.state.rs.viewportCount() != viewportCount) {
|
||||
m_state.gp.state.rs.setViewportCount(viewportCount);
|
||||
m_flags.set(DxvkContextFlag::GpDirtyPipelineState);
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < viewportCount; i++) {
|
||||
m_state.vp.viewports[i] = viewports[i];
|
||||
m_state.vp.scissorRects[i] = scissorRects[i];
|
||||
@ -2311,6 +2306,7 @@ namespace dxvk {
|
||||
}
|
||||
}
|
||||
|
||||
m_state.vp.viewportCount = viewportCount;
|
||||
m_flags.set(DxvkContextFlag::GpDirtyViewport);
|
||||
}
|
||||
|
||||
@ -2711,8 +2707,8 @@ namespace dxvk {
|
||||
scissor.offset = { dstOffsets[0].x, dstOffsets[0].y };
|
||||
scissor.extent = { dstExtent.width, dstExtent.height };
|
||||
|
||||
m_cmd->cmdSetViewport(0, 1, &viewport);
|
||||
m_cmd->cmdSetScissor (0, 1, &scissor);
|
||||
m_cmd->cmdSetViewport(1, &viewport);
|
||||
m_cmd->cmdSetScissor(1, &scissor);
|
||||
|
||||
// Bind source image view
|
||||
VkDescriptorImageInfo descriptorImage;
|
||||
@ -3508,8 +3504,8 @@ namespace dxvk {
|
||||
m_cmd->cmdBindDescriptorSet(VK_PIPELINE_BIND_POINT_GRAPHICS,
|
||||
pipeInfo.pipeLayout, descriptorSet, 0, nullptr);
|
||||
|
||||
m_cmd->cmdSetViewport(0, 1, &viewport);
|
||||
m_cmd->cmdSetScissor (0, 1, &scissor);
|
||||
m_cmd->cmdSetViewport(1, &viewport);
|
||||
m_cmd->cmdSetScissor(1, &scissor);
|
||||
|
||||
VkOffset2D srcCoordOffset = {
|
||||
srcOffset.x - dstOffset.x,
|
||||
@ -3941,8 +3937,8 @@ namespace dxvk {
|
||||
m_cmd->cmdBindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, pipeInfo.pipeHandle);
|
||||
m_cmd->cmdBindDescriptorSet(VK_PIPELINE_BIND_POINT_GRAPHICS,
|
||||
pipeInfo.pipeLayout, descriptorSet, 0, nullptr);
|
||||
m_cmd->cmdSetViewport(0, 1, &viewport);
|
||||
m_cmd->cmdSetScissor (0, 1, &scissor);
|
||||
m_cmd->cmdSetViewport(1, &viewport);
|
||||
m_cmd->cmdSetScissor(1, &scissor);
|
||||
m_cmd->cmdPushConstants(pipeInfo.pipeLayout,
|
||||
VK_SHADER_STAGE_FRAGMENT_BIT,
|
||||
0, sizeof(srcOffset), &srcOffset);
|
||||
@ -5037,9 +5033,8 @@ namespace dxvk {
|
||||
if (m_flags.test(DxvkContextFlag::GpDirtyViewport)) {
|
||||
m_flags.clr(DxvkContextFlag::GpDirtyViewport);
|
||||
|
||||
uint32_t viewportCount = m_state.gp.state.rs.viewportCount();
|
||||
m_cmd->cmdSetViewport(0, viewportCount, m_state.vp.viewports.data());
|
||||
m_cmd->cmdSetScissor (0, viewportCount, m_state.vp.scissorRects.data());
|
||||
m_cmd->cmdSetViewport(m_state.vp.viewportCount, m_state.vp.viewports.data());
|
||||
m_cmd->cmdSetScissor(m_state.vp.viewportCount, m_state.vp.scissorRects.data());
|
||||
}
|
||||
|
||||
if (m_flags.all(DxvkContextFlag::GpDirtyBlendConstants,
|
||||
|
@ -90,6 +90,7 @@ namespace dxvk {
|
||||
|
||||
|
||||
struct DxvkViewportState {
|
||||
uint32_t viewportCount = 0;
|
||||
std::array<VkViewport, DxvkLimits::MaxNumViewports> viewports = { };
|
||||
std::array<VkRect2D, DxvkLimits::MaxNumViewports> scissorRects = { };
|
||||
};
|
||||
|
@ -119,8 +119,8 @@ namespace dxvk {
|
||||
std::array<VkDynamicState, 6> dynamicStates;
|
||||
uint32_t dynamicStateCount = 0;
|
||||
|
||||
dynamicStates[dynamicStateCount++] = VK_DYNAMIC_STATE_VIEWPORT;
|
||||
dynamicStates[dynamicStateCount++] = VK_DYNAMIC_STATE_SCISSOR;
|
||||
dynamicStates[dynamicStateCount++] = VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT;
|
||||
dynamicStates[dynamicStateCount++] = VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT;
|
||||
|
||||
if (state.useDynamicDepthBias())
|
||||
dynamicStates[dynamicStateCount++] = VK_DYNAMIC_STATE_DEPTH_BIAS;
|
||||
@ -270,8 +270,6 @@ namespace dxvk {
|
||||
tsInfo.patchControlPoints = state.ia.patchVertexCount();
|
||||
|
||||
VkPipelineViewportStateCreateInfo vpInfo = { VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO };
|
||||
vpInfo.viewportCount = state.rs.viewportCount();
|
||||
vpInfo.scissorCount = state.rs.viewportCount();
|
||||
|
||||
VkPipelineRasterizationConservativeStateCreateInfoEXT conservativeInfo = { VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_CONSERVATIVE_STATE_CREATE_INFO_EXT };
|
||||
conservativeInfo.conservativeRasterizationMode = state.rs.conservativeMode();
|
||||
|
@ -307,8 +307,8 @@ namespace dxvk {
|
||||
VK_SHADER_STAGE_FRAGMENT_BIT, psModule, "main" };
|
||||
|
||||
std::array<VkDynamicState, 2> dynStates = {{
|
||||
VK_DYNAMIC_STATE_VIEWPORT,
|
||||
VK_DYNAMIC_STATE_SCISSOR,
|
||||
VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT,
|
||||
VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT,
|
||||
}};
|
||||
|
||||
VkPipelineDynamicStateCreateInfo dynState = { VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO };
|
||||
|
@ -344,8 +344,8 @@ namespace dxvk {
|
||||
VK_SHADER_STAGE_FRAGMENT_BIT, psModule, "main" };
|
||||
|
||||
std::array<VkDynamicState, 2> dynStates = {{
|
||||
VK_DYNAMIC_STATE_VIEWPORT,
|
||||
VK_DYNAMIC_STATE_SCISSOR,
|
||||
VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT,
|
||||
VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT,
|
||||
}};
|
||||
|
||||
VkPipelineDynamicStateCreateInfo dynState = { VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO };
|
||||
|
@ -257,8 +257,8 @@ namespace dxvk {
|
||||
VK_SHADER_STAGE_FRAGMENT_BIT, psModule, "main", &specInfo };
|
||||
|
||||
std::array<VkDynamicState, 2> dynStates = {{
|
||||
VK_DYNAMIC_STATE_VIEWPORT,
|
||||
VK_DYNAMIC_STATE_SCISSOR,
|
||||
VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT,
|
||||
VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT,
|
||||
}};
|
||||
|
||||
VkPipelineDynamicStateCreateInfo dynState = { VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO };
|
||||
|
Loading…
x
Reference in New Issue
Block a user