1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-11 19:24:11 +01:00

[dxvk] Only update index buffer for indexed draws

This is somewhat uncommon, but we sometimes bind an index
buffer in a render pass that doesn't get used at all.
This commit is contained in:
Philip Rebohle 2019-01-17 03:13:14 +01:00
parent 321feed728
commit 8cc4497f11
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 8 additions and 8 deletions

View File

@ -1130,7 +1130,7 @@ namespace dxvk {
uint32_t instanceCount, uint32_t instanceCount,
uint32_t firstVertex, uint32_t firstVertex,
uint32_t firstInstance) { uint32_t firstInstance) {
this->commitGraphicsState(); this->commitGraphicsState(false);
if (this->validateGraphicsState()) { if (this->validateGraphicsState()) {
m_cmd->cmdDraw( m_cmd->cmdDraw(
@ -1148,7 +1148,7 @@ namespace dxvk {
VkDeviceSize offset, VkDeviceSize offset,
uint32_t count, uint32_t count,
uint32_t stride) { uint32_t stride) {
this->commitGraphicsState(); this->commitGraphicsState(false);
if (this->validateGraphicsState()) { if (this->validateGraphicsState()) {
auto descriptor = m_state.id.argBuffer.getDescriptor(); auto descriptor = m_state.id.argBuffer.getDescriptor();
@ -1172,7 +1172,7 @@ namespace dxvk {
uint32_t firstIndex, uint32_t firstIndex,
uint32_t vertexOffset, uint32_t vertexOffset,
uint32_t firstInstance) { uint32_t firstInstance) {
this->commitGraphicsState(); this->commitGraphicsState(true);
if (this->validateGraphicsState()) { if (this->validateGraphicsState()) {
m_cmd->cmdDrawIndexed( m_cmd->cmdDrawIndexed(
@ -1191,7 +1191,7 @@ namespace dxvk {
VkDeviceSize offset, VkDeviceSize offset,
uint32_t count, uint32_t count,
uint32_t stride) { uint32_t stride) {
this->commitGraphicsState(); this->commitGraphicsState(true);
if (this->validateGraphicsState()) { if (this->validateGraphicsState()) {
auto descriptor = m_state.id.argBuffer.getDescriptor(); auto descriptor = m_state.id.argBuffer.getDescriptor();
@ -1213,7 +1213,7 @@ namespace dxvk {
const DxvkBufferSlice& counterBuffer, const DxvkBufferSlice& counterBuffer,
uint32_t counterDivisor, uint32_t counterDivisor,
uint32_t counterBias) { uint32_t counterBias) {
this->commitGraphicsState(); this->commitGraphicsState(false);
if (this->validateGraphicsState()) { if (this->validateGraphicsState()) {
auto physSlice = counterBuffer.getSliceHandle(); auto physSlice = counterBuffer.getSliceHandle();
@ -3100,7 +3100,7 @@ namespace dxvk {
} }
void DxvkContext::commitGraphicsState() { void DxvkContext::commitGraphicsState(bool indexed) {
if (m_flags.test(DxvkContextFlag::GpDirtyFramebuffer)) if (m_flags.test(DxvkContextFlag::GpDirtyFramebuffer))
this->updateFramebuffer(); this->updateFramebuffer();
@ -3110,7 +3110,7 @@ namespace dxvk {
if (m_flags.test(DxvkContextFlag::GpDirtyPipeline)) if (m_flags.test(DxvkContextFlag::GpDirtyPipeline))
this->updateGraphicsPipeline(); this->updateGraphicsPipeline();
if (m_flags.test(DxvkContextFlag::GpDirtyIndexBuffer)) if (m_flags.test(DxvkContextFlag::GpDirtyIndexBuffer) && indexed)
this->updateIndexBufferBinding(); this->updateIndexBufferBinding();
if (m_flags.test(DxvkContextFlag::GpDirtyVertexBuffers)) if (m_flags.test(DxvkContextFlag::GpDirtyVertexBuffers))

View File

@ -892,7 +892,7 @@ namespace dxvk {
bool validateGraphicsState(); bool validateGraphicsState();
void commitComputeState(); void commitComputeState();
void commitGraphicsState(); void commitGraphicsState(bool indexed);
void commitComputeInitBarriers(); void commitComputeInitBarriers();
void commitComputePostBarriers(); void commitComputePostBarriers();