Skip to content

Commit

Permalink
Revert D49175381: igl | vulkan | Detect inconsistent vertex buffer bi…
Browse files Browse the repository at this point in the history
…ndings

Differential Revision:
D49175381

Original commit changeset: 64788a02c7e7

Original Phabricator Diff: D49175381

fbshipit-source-id: e217bc021475fc99671c8d451006b46663cdc4db
  • Loading branch information
Xiaomeng Zhang authored and facebook-github-bot committed Sep 13, 2023
1 parent 944e21b commit 3eb1f75
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 43 deletions.
39 changes: 0 additions & 39 deletions src/igl/vulkan/RenderCommandEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include <igl/vulkan/RenderPipelineState.h>
#include <igl/vulkan/SamplerState.h>
#include <igl/vulkan/Texture.h>
#include <igl/vulkan/VertexInputState.h>
#include <igl/vulkan/VulkanBuffer.h>
#include <igl/vulkan/VulkanContext.h>
#include <igl/vulkan/VulkanDevice.h>
Expand Down Expand Up @@ -485,9 +484,6 @@ void RenderCommandEncoder::bindBuffer(int index,
if (isVertexBuffer) {
IGL_ASSERT(target == BindTarget::kVertex);
IGL_ASSERT(!isUniformOrStorageBuffer);
if (IGL_VERIFY(index < IGL_VERTEX_BINDINGS_MAX)) {
isVertexBufferBound_[index] = true;
}
const VkDeviceSize offset = bufferOffset;
vkCmdBindVertexBuffers(cmdBuffer_, index, 1, &vkBuf, &offset);
} else if (isUniformOrStorageBuffer) {
Expand Down Expand Up @@ -600,8 +596,6 @@ void RenderCommandEncoder::draw(PrimitiveType primitiveType,
return;
}

ensureVertexBuffers();

binder_.updateBindings();
dynamicState_.setTopology(primitiveTypeToVkPrimitiveTopology(primitiveType));
bindPipeline();
Expand All @@ -626,8 +620,6 @@ void RenderCommandEncoder::drawIndexed(PrimitiveType primitiveType,
return;
}

ensureVertexBuffers();

binder_.updateBindings();
dynamicState_.setTopology(primitiveTypeToVkPrimitiveTopology(primitiveType));
bindPipeline();
Expand Down Expand Up @@ -664,8 +656,6 @@ void RenderCommandEncoder::multiDrawIndirect(PrimitiveType primitiveType,
uint32_t stride) {
IGL_PROFILER_FUNCTION();

ensureVertexBuffers();

binder_.updateBindings();
dynamicState_.setTopology(primitiveTypeToVkPrimitiveTopology(primitiveType));
bindPipeline();
Expand All @@ -690,8 +680,6 @@ void RenderCommandEncoder::multiDrawIndexedIndirect(PrimitiveType primitiveType,
uint32_t stride) {
IGL_PROFILER_FUNCTION();

ensureVertexBuffers();

binder_.updateBindings();
dynamicState_.setTopology(primitiveTypeToVkPrimitiveTopology(primitiveType));
bindPipeline();
Expand Down Expand Up @@ -735,32 +723,5 @@ bool RenderCommandEncoder::setDrawCallCountEnabled(bool value) {
return returnVal;
}

void RenderCommandEncoder::ensureVertexBuffers() {
const igl::vulkan::RenderPipelineState* rps =
static_cast<igl::vulkan::RenderPipelineState*>(currentPipeline_.get());

if (!IGL_VERIFY(rps)) {
return;
}

const igl::vulkan::VertexInputState* vi = static_cast<igl::vulkan::VertexInputState*>(
rps->getRenderPipelineDesc().vertexInputState.get());

if (!vi) {
// no vertex input is perfectly valid
return;
}

const VertexInputStateDesc& desc = vi->desc_;

for (size_t i = 0; i != desc.numInputBindings; i++) {
if (!IGL_VERIFY(isVertexBufferBound_[i])) {
IGL_ASSERT_MSG(false,
"Did you forget to call bindBuffer() for one of your vertex input buffers?");
IGL_LOG_ERROR("Did you forget to call bindBuffer() for one of your vertex input buffers?");
}
}
}

} // namespace vulkan
} // namespace igl
3 changes: 0 additions & 3 deletions src/igl/vulkan/RenderCommandEncoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ class RenderCommandEncoder : public IRenderCommandEncoder {

private:
void bindPipeline();
void ensureVertexBuffers();

private:
VulkanContext& ctx_;
Expand All @@ -117,8 +116,6 @@ class RenderCommandEncoder : public IRenderCommandEncoder {
* 1: All other times */
uint32_t drawCallCountEnabled_ = 1u;

bool isVertexBufferBound_[IGL_VERTEX_BUFFER_MAX] = {};

private:
RenderCommandEncoder(const std::shared_ptr<CommandBuffer>& commandBuffer, VulkanContext& ctx);

Expand Down
1 change: 0 additions & 1 deletion src/igl/vulkan/VertexInputState.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class VertexInputState final : public IVertexInputState {
~VertexInputState() override = default;

friend class Device;
friend class RenderCommandEncoder;
friend class RenderPipelineState;

private:
Expand Down

0 comments on commit 3eb1f75

Please sign in to comment.