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

[dxvk] Don't check if bindings have changed in the backend

The state tracker should perform these checks before sending commands
off to the backend anyway, so checking again in the backend is redundant.
This commit is contained in:
Philip Rebohle 2019-07-17 14:26:55 +02:00
parent b6c395c013
commit 63fe899bdc
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -140,41 +140,29 @@ namespace dxvk {
void DxvkContext::bindDrawBuffers(
const DxvkBufferSlice& argBuffer,
const DxvkBufferSlice& cntBuffer) {
if (!m_state.id.argBuffer.matches(argBuffer)
|| !m_state.id.argBuffer.matches(cntBuffer)) {
m_state.id.argBuffer = argBuffer;
m_state.id.cntBuffer = cntBuffer;
m_flags.set(DxvkContextFlag::DirtyDrawBuffer);
}
}
void DxvkContext::bindIndexBuffer(
const DxvkBufferSlice& buffer,
VkIndexType indexType) {
bool needsUpdate = !m_state.vi.indexBuffer.matchesBuffer(buffer);
if (likely(!needsUpdate)) {
needsUpdate = !m_state.vi.indexBuffer.matchesRange(buffer)
|| m_state.vi.indexType != indexType;
} else {
if (!m_state.vi.indexBuffer.matchesBuffer(buffer))
m_vbTracked.clr(MaxNumVertexBindings);
}
if (needsUpdate) {
m_state.vi.indexBuffer = buffer;
m_state.vi.indexType = indexType;
m_flags.set(DxvkContextFlag::GpDirtyIndexBuffer);
}
}
void DxvkContext::bindResourceBuffer(
uint32_t slot,
const DxvkBufferSlice& buffer) {
if (!m_rc[slot].bufferSlice.matches(buffer)) {
m_rc[slot].bufferSlice = buffer;
m_rcTracked.clr(slot);
@ -182,15 +170,12 @@ namespace dxvk {
DxvkContextFlag::CpDirtyResources,
DxvkContextFlag::GpDirtyResources);
}
}
void DxvkContext::bindResourceView(
uint32_t slot,
const Rc<DxvkImageView>& imageView,
const Rc<DxvkBufferView>& bufferView) {
if (m_rc[slot].imageView != imageView
|| m_rc[slot].bufferView != bufferView) {
m_rc[slot].imageView = imageView;
m_rc[slot].bufferView = bufferView;
m_rc[slot].bufferSlice = bufferView != nullptr
@ -202,13 +187,11 @@ namespace dxvk {
DxvkContextFlag::CpDirtyResources,
DxvkContextFlag::GpDirtyResources);
}
}
void DxvkContext::bindResourceSampler(
uint32_t slot,
const Rc<DxvkSampler>& sampler) {
if (m_rc[slot].sampler != sampler) {
m_rc[slot].sampler = sampler;
m_rcTracked.clr(slot);
@ -216,7 +199,6 @@ namespace dxvk {
DxvkContextFlag::CpDirtyResources,
DxvkContextFlag::GpDirtyResources);
}
}
void DxvkContext::bindShader(
@ -234,7 +216,6 @@ namespace dxvk {
default: return;
}
if (shaderStage->shader != shader) {
shaderStage->shader = shader;
if (stage == VK_SHADER_STAGE_COMPUTE_BIT) {
@ -249,29 +230,22 @@ namespace dxvk {
DxvkContextFlag::GpDirtyResources);
}
}
}
void DxvkContext::bindVertexBuffer(
uint32_t binding,
const DxvkBufferSlice& buffer,
uint32_t stride) {
bool needsUpdate = !m_state.vi.vertexBuffers[binding].matchesBuffer(buffer);
if (likely(!needsUpdate))
needsUpdate = !m_state.vi.vertexBuffers[binding].matchesRange(buffer);
else
if (!m_state.vi.vertexBuffers[binding].matchesBuffer(buffer))
m_vbTracked.clr(binding);
if (needsUpdate) {
m_state.vi.vertexBuffers[binding] = buffer;
m_flags.set(DxvkContextFlag::GpDirtyVertexBuffers);
}
if (unlikely(!buffer.defined()))
stride = 0;
if (m_state.vi.vertexStrides[binding] != stride) {
if (unlikely(m_state.vi.vertexStrides[binding] != stride)) {
m_state.vi.vertexStrides[binding] = stride;
m_flags.set(DxvkContextFlag::GpDirtyPipelineState);
}