mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-12 22:08:59 +01:00
[dxvk] Handle bound buffers with zero size in the backend
This commit is contained in:
parent
d314bee86d
commit
26d46e7f80
@ -4801,7 +4801,7 @@ namespace dxvk {
|
|||||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER: {
|
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER: {
|
||||||
const auto& res = m_rc[binding.resourceBinding];
|
const auto& res = m_rc[binding.resourceBinding];
|
||||||
|
|
||||||
if (res.bufferSlice.defined()) {
|
if (res.bufferSlice.length()) {
|
||||||
descriptorInfo = res.bufferSlice.getDescriptor();
|
descriptorInfo = res.bufferSlice.getDescriptor();
|
||||||
|
|
||||||
if (m_rcTracked.set(binding.resourceBinding))
|
if (m_rcTracked.set(binding.resourceBinding))
|
||||||
@ -4816,7 +4816,7 @@ namespace dxvk {
|
|||||||
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER: {
|
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER: {
|
||||||
const auto& res = m_rc[binding.resourceBinding];
|
const auto& res = m_rc[binding.resourceBinding];
|
||||||
|
|
||||||
if (res.bufferSlice.defined()) {
|
if (res.bufferSlice.length()) {
|
||||||
descriptorInfo = res.bufferSlice.getDescriptor();
|
descriptorInfo = res.bufferSlice.getDescriptor();
|
||||||
|
|
||||||
if (m_rcTracked.set(binding.resourceBinding))
|
if (m_rcTracked.set(binding.resourceBinding))
|
||||||
@ -5088,7 +5088,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
bool DxvkContext::updateIndexBufferBinding() {
|
bool DxvkContext::updateIndexBufferBinding() {
|
||||||
if (unlikely(!m_state.vi.indexBuffer.defined()))
|
if (unlikely(!m_state.vi.indexBuffer.length()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_flags.clr(DxvkContextFlag::GpDirtyIndexBuffer);
|
m_flags.clr(DxvkContextFlag::GpDirtyIndexBuffer);
|
||||||
@ -5124,7 +5124,7 @@ namespace dxvk {
|
|||||||
for (uint32_t i = 0; i < m_state.gp.state.il.bindingCount(); i++) {
|
for (uint32_t i = 0; i < m_state.gp.state.il.bindingCount(); i++) {
|
||||||
uint32_t binding = m_state.gp.state.ilBindings[i].binding();
|
uint32_t binding = m_state.gp.state.ilBindings[i].binding();
|
||||||
|
|
||||||
if (likely(m_state.vi.vertexBuffers[binding].defined())) {
|
if (likely(m_state.vi.vertexBuffers[binding].length())) {
|
||||||
auto vbo = m_state.vi.vertexBuffers[binding].getDescriptor();
|
auto vbo = m_state.vi.vertexBuffers[binding].getDescriptor();
|
||||||
|
|
||||||
buffers[i] = vbo.buffer.buffer;
|
buffers[i] = vbo.buffer.buffer;
|
||||||
@ -5440,8 +5440,7 @@ namespace dxvk {
|
|||||||
switch (binding.descriptorType) {
|
switch (binding.descriptorType) {
|
||||||
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
|
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
|
||||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
|
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
|
||||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
|
if (likely(slot.bufferSlice.length())) {
|
||||||
if (likely(slot.bufferSlice.defined())) {
|
|
||||||
srcAccess = m_execBarriers.getBufferAccess(
|
srcAccess = m_execBarriers.getBufferAccess(
|
||||||
slot.bufferSlice.getSliceHandle());
|
slot.bufferSlice.getSliceHandle());
|
||||||
}
|
}
|
||||||
@ -5509,8 +5508,7 @@ namespace dxvk {
|
|||||||
switch (binding.descriptorType) {
|
switch (binding.descriptorType) {
|
||||||
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
|
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
|
||||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
|
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
|
||||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
|
if (likely(slot.bufferSlice.length())) {
|
||||||
if (likely(slot.bufferSlice.defined())) {
|
|
||||||
m_execBarriers.accessBuffer(
|
m_execBarriers.accessBuffer(
|
||||||
slot.bufferSlice.getSliceHandle(),
|
slot.bufferSlice.getSliceHandle(),
|
||||||
stages, access,
|
stages, access,
|
||||||
@ -5573,7 +5571,7 @@ namespace dxvk {
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
for (uint32_t i = 0; i < slices.size() && !requiresBarrier; i++) {
|
for (uint32_t i = 0; i < slices.size() && !requiresBarrier; i++) {
|
||||||
if ((slices[i]->defined())
|
if ((slices[i]->length())
|
||||||
&& (slices[i]->bufferInfo().access & storageBufferAccess)) {
|
&& (slices[i]->bufferInfo().access & storageBufferAccess)) {
|
||||||
requiresBarrier = this->checkGfxBufferBarrier<DoEmit>(*slices[i],
|
requiresBarrier = this->checkGfxBufferBarrier<DoEmit>(*slices[i],
|
||||||
VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT,
|
VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT,
|
||||||
@ -5587,7 +5585,7 @@ namespace dxvk {
|
|||||||
if (m_flags.test(DxvkContextFlag::GpDirtyIndexBuffer) && !requiresBarrier && Indexed) {
|
if (m_flags.test(DxvkContextFlag::GpDirtyIndexBuffer) && !requiresBarrier && Indexed) {
|
||||||
const auto& indexBufferSlice = m_state.vi.indexBuffer;
|
const auto& indexBufferSlice = m_state.vi.indexBuffer;
|
||||||
|
|
||||||
if ((indexBufferSlice.defined())
|
if ((indexBufferSlice.length())
|
||||||
&& (indexBufferSlice.bufferInfo().access & storageBufferAccess)) {
|
&& (indexBufferSlice.bufferInfo().access & storageBufferAccess)) {
|
||||||
requiresBarrier = this->checkGfxBufferBarrier<DoEmit>(indexBufferSlice,
|
requiresBarrier = this->checkGfxBufferBarrier<DoEmit>(indexBufferSlice,
|
||||||
VK_PIPELINE_STAGE_VERTEX_INPUT_BIT,
|
VK_PIPELINE_STAGE_VERTEX_INPUT_BIT,
|
||||||
@ -5603,7 +5601,7 @@ namespace dxvk {
|
|||||||
uint32_t binding = m_state.gp.state.ilBindings[i].binding();
|
uint32_t binding = m_state.gp.state.ilBindings[i].binding();
|
||||||
const auto& vertexBufferSlice = m_state.vi.vertexBuffers[binding];
|
const auto& vertexBufferSlice = m_state.vi.vertexBuffers[binding];
|
||||||
|
|
||||||
if ((vertexBufferSlice.defined())
|
if ((vertexBufferSlice.length())
|
||||||
&& (vertexBufferSlice.bufferInfo().access & storageBufferAccess)) {
|
&& (vertexBufferSlice.bufferInfo().access & storageBufferAccess)) {
|
||||||
requiresBarrier = this->checkGfxBufferBarrier<DoEmit>(vertexBufferSlice,
|
requiresBarrier = this->checkGfxBufferBarrier<DoEmit>(vertexBufferSlice,
|
||||||
VK_PIPELINE_STAGE_VERTEX_INPUT_BIT,
|
VK_PIPELINE_STAGE_VERTEX_INPUT_BIT,
|
||||||
@ -5620,12 +5618,12 @@ namespace dxvk {
|
|||||||
const auto& xfbBufferSlice = m_state.xfb.buffers[i];
|
const auto& xfbBufferSlice = m_state.xfb.buffers[i];
|
||||||
const auto& xfbCounterSlice = m_state.xfb.counters[i];
|
const auto& xfbCounterSlice = m_state.xfb.counters[i];
|
||||||
|
|
||||||
if (xfbBufferSlice.defined()) {
|
if (xfbBufferSlice.length()) {
|
||||||
requiresBarrier = this->checkGfxBufferBarrier<DoEmit>(xfbBufferSlice,
|
requiresBarrier = this->checkGfxBufferBarrier<DoEmit>(xfbBufferSlice,
|
||||||
VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT,
|
VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT,
|
||||||
VK_ACCESS_TRANSFORM_FEEDBACK_WRITE_BIT_EXT) != 0;
|
VK_ACCESS_TRANSFORM_FEEDBACK_WRITE_BIT_EXT) != 0;
|
||||||
|
|
||||||
if (xfbCounterSlice.defined()) {
|
if (xfbCounterSlice.length()) {
|
||||||
requiresBarrier |= this->checkGfxBufferBarrier<DoEmit>(xfbCounterSlice,
|
requiresBarrier |= this->checkGfxBufferBarrier<DoEmit>(xfbCounterSlice,
|
||||||
VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT |
|
VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT |
|
||||||
VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT,
|
VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT,
|
||||||
@ -5652,8 +5650,7 @@ namespace dxvk {
|
|||||||
switch (binding.descriptorType) {
|
switch (binding.descriptorType) {
|
||||||
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
|
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
|
||||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
|
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
|
||||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
|
if ((slot.bufferSlice.length())
|
||||||
if ((slot.bufferSlice.defined())
|
|
||||||
&& (slot.bufferSlice.bufferInfo().access & storageBufferAccess)) {
|
&& (slot.bufferSlice.bufferInfo().access & storageBufferAccess)) {
|
||||||
srcAccess = this->checkGfxBufferBarrier<DoEmit>(slot.bufferSlice,
|
srcAccess = this->checkGfxBufferBarrier<DoEmit>(slot.bufferSlice,
|
||||||
util::pipelineStages(binding.stages), binding.access);
|
util::pipelineStages(binding.stages), binding.access);
|
||||||
@ -5768,10 +5765,10 @@ namespace dxvk {
|
|||||||
if (m_flags.test(DxvkContextFlag::DirtyDrawBuffer)) {
|
if (m_flags.test(DxvkContextFlag::DirtyDrawBuffer)) {
|
||||||
m_flags.clr(DxvkContextFlag::DirtyDrawBuffer);
|
m_flags.clr(DxvkContextFlag::DirtyDrawBuffer);
|
||||||
|
|
||||||
if (m_state.id.argBuffer.defined())
|
if (m_state.id.argBuffer.length())
|
||||||
m_cmd->trackResource<DxvkAccess::Read>(m_state.id.argBuffer.buffer());
|
m_cmd->trackResource<DxvkAccess::Read>(m_state.id.argBuffer.buffer());
|
||||||
|
|
||||||
if (m_state.id.cntBuffer.defined())
|
if (m_state.id.cntBuffer.length())
|
||||||
m_cmd->trackResource<DxvkAccess::Read>(m_state.id.cntBuffer.buffer());
|
m_cmd->trackResource<DxvkAccess::Read>(m_state.id.cntBuffer.buffer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -306,7 +306,6 @@ namespace dxvk {
|
|||||||
/**
|
/**
|
||||||
* \brief Binds vertex buffer
|
* \brief Binds vertex buffer
|
||||||
*
|
*
|
||||||
* When binding a null buffer, stride must be 0.
|
|
||||||
* \param [in] binding Vertex buffer binding
|
* \param [in] binding Vertex buffer binding
|
||||||
* \param [in] buffer New vertex buffer
|
* \param [in] buffer New vertex buffer
|
||||||
* \param [in] stride Stride between vertices
|
* \param [in] stride Stride between vertices
|
||||||
|
Loading…
Reference in New Issue
Block a user