return (value + align - T(1)) & ~(align - T(1));
}
+inline bool hasDeviceExtension (Context& context, const string& name)
+{
+ return de::contains(context.getDeviceExtensions().begin(), context.getDeviceExtensions().end(), name);
+}
+
VkDeviceSize getPageTableSize (const PlatformMemoryLimits& limits, VkDeviceSize allocationSize)
{
VkDeviceSize totalSize = 0;
return totalSize;
}
-
-
size_t getCurrentSystemMemoryUsage (const AllocationCallbackRecorder& allocRecoder)
{
const size_t systemAllocationOverhead = sizeof(void*)*2;
for (; numPassingAllocs < maxTries; ++numPassingAllocs)
{
DeterministicFailAllocator objAllocator(getSystemAllocator(),
- numPassingAllocs,
- DeterministicFailAllocator::MODE_COUNT_AND_FAIL);
+ DeterministicFailAllocator::MODE_COUNT_AND_FAIL,
+ numPassingAllocs);
AllocationCallbackRecorder recorder (objAllocator.getCallbacks(), 128);
const Environment objEnv (resEnv.env.vkp,
resEnv.env.vkd,
}
// Determine whether an API call sets the invalid handles to NULL (true) or leaves them undefined or not modified (false)
-template<typename T> inline bool isNullHandleOnAllocationFailure (void) { return false; }
-template<> inline bool isNullHandleOnAllocationFailure<VkPipeline> (void) { return true; }
+template<typename T> inline bool isNullHandleOnAllocationFailure (Context&) { return false; }
+template<> inline bool isNullHandleOnAllocationFailure<VkCommandBuffer> (Context& context) { return hasDeviceExtension(context, "VK_KHR_maintenance1"); }
+template<> inline bool isNullHandleOnAllocationFailure<VkDescriptorSet> (Context& context) { return hasDeviceExtension(context, "VK_KHR_maintenance1"); }
+template<> inline bool isNullHandleOnAllocationFailure<VkPipeline> (Context&) { return true; }
-template<typename T> inline bool isPooledObject (void) { return false; };
-template<> inline bool isPooledObject<VkCommandBuffer> (void) { return true; };
-template<> inline bool isPooledObject<VkDescriptorSet> (void) { return true; };
+template<typename T> inline bool isPooledObject (void) { return false; };
+template<> inline bool isPooledObject<VkCommandBuffer> (void) { return true; };
+template<> inline bool isPooledObject<VkDescriptorSet> (void) { return true; };
template<typename Object>
tcu::TestStatus allocCallbackFailMultipleObjectsTest (Context& context, typename Object::Parameters params)
typedef SharedPtr<Move<typename Object::Type> > ObjectTypeSp;
static const deUint32 numObjects = 4;
- const bool expectNullHandles = isNullHandleOnAllocationFailure<typename Object::Type>();
+ const bool expectNullHandles = isNullHandleOnAllocationFailure<typename Object::Type>(context);
deUint32 numPassingAllocs = 0;
{
// \note We have to use the same allocator for both resource dependencies and the object under test,
// because pooled objects take memory from the pool.
- DeterministicFailAllocator objAllocator(getSystemAllocator(), numPassingAllocs, DeterministicFailAllocator::MODE_DO_NOT_COUNT);
+ DeterministicFailAllocator objAllocator(getSystemAllocator(), DeterministicFailAllocator::MODE_DO_NOT_COUNT, 0);
AllocationCallbackRecorder recorder (objAllocator.getCallbacks(), 128);
const Environment objEnv (context.getPlatformInterface(),
context.getDeviceInterface(),
{
const typename Object::Resources res (objEnv, params);
- objAllocator.setMode(DeterministicFailAllocator::MODE_COUNT_AND_FAIL);
+ objAllocator.reset(DeterministicFailAllocator::MODE_COUNT_AND_FAIL, numPassingAllocs);
const vector<ObjectTypeSp> scopedHandles = Object::createMultiple(objEnv, res, params, &handles, &result);
}