tests: Don't call unbind if we haven't called bind
diff --git a/tests/vktestbinding.cpp b/tests/vktestbinding.cpp
index 2f525dc..6c23941 100644
--- a/tests/vktestbinding.cpp
+++ b/tests/vktestbinding.cpp
@@ -221,7 +221,9 @@
if (!initialized())
return;
- unbind_memory();
+ if(bound) {
+ unbind_memory();
+ }
if (internal_mems_) {
delete[] internal_mems_;
@@ -237,12 +239,14 @@
void Object::bind_memory(uint32_t alloc_idx, const GpuMemory &mem, VK_GPU_SIZE mem_offset)
{
+ bound = true;
EXPECT(vkBindObjectMemory(obj(), alloc_idx, mem.obj(), mem_offset) == VK_SUCCESS);
}
void Object::bind_memory(uint32_t alloc_idx, VK_GPU_SIZE offset, VK_GPU_SIZE size,
const GpuMemory &mem, VK_GPU_SIZE mem_offset)
{
+ bound = true;
EXPECT(!alloc_idx && vkBindObjectMemoryRange(obj(), 0, offset, size, mem.obj(), mem_offset) == VK_SUCCESS);
}
diff --git a/tests/vktestbinding.h b/tests/vktestbinding.h
index 39159eb..3fcb088 100644
--- a/tests/vktestbinding.h
+++ b/tests/vktestbinding.h
@@ -149,7 +149,7 @@
void unmap() const;
protected:
- explicit Object() : mem_alloc_count_(0), internal_mems_(NULL), primary_mem_(NULL) {}
+ explicit Object() : mem_alloc_count_(0), internal_mems_(NULL), primary_mem_(NULL), bound(false) {}
explicit Object(VK_OBJECT obj) : mem_alloc_count_(0), internal_mems_(NULL), primary_mem_(NULL) { init(obj); }
~Object() { cleanup(); }
@@ -170,6 +170,7 @@
uint32_t mem_alloc_count_;
GpuMemory *internal_mems_;
GpuMemory *primary_mem_;
+ bool bound;
};
class DynamicStateObject : public Object {