blob: 129f1b951ccef5f253d5e2d2508155a6249fc8c6 [file] [log] [blame]
/*
* Copyright 2015, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* THIS FILE WAS GENERATED BY apic. DO NOT EDIT.
*/
#include "abort_exception.h"
#include "vulkan_imports.h"
#include "vulkan_types.h"
#include "vulkan_spy.h"
#include <gapic/log.h>
#include <gapic/coder/memory.h>
#include <gapic/coder/atom.h>
#include <gapic/coder/vulkan.h>
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include <stdint.h>
#include <memory>
#include <string>
namespace gapii {
uint32_t VulkanSpy::vkCreateXcbSurfaceKHR(CallObserver* observer, VkInstance instance, VkXcbSurfaceCreateInfoKHR* pCreateInfo, VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface) {
GAPID_DEBUG("vkCreateXcbSurfaceKHR(%zu, %p, %p, %p)", instance, pCreateInfo, pAllocator, pSurface);
if (mImports.mVkInstanceFunctions.find(instance) == mImports.mVkInstanceFunctions.end() ||
mImports.mVkInstanceFunctions[instance].vkCreateXcbSurfaceKHR == nullptr) {
GAPID_WARNING("Application called unsupported function vkCreateXcbSurfaceKHR");
return 0;
}
uint32_t result = 0;
bool called = false;
auto call = [this, observer, &called, &result, instance, pCreateInfo, pAllocator, pSurface] {
called = true;
observer->observeReads();
result = mImports.mVkInstanceFunctions[instance].vkCreateXcbSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface);
onPostFence(observer);
};
uint64_t counter_at_begin = mCommandStartEndCounter++;
try {
do {
std::shared_ptr<SurfaceObject> l_surface = subCreateXCBSurfaceObject(observer, call, pCreateInfo);
checkNotNull(l_surface).mInstance = instance;
call();
auto l_handle = slice(pSurface, 0ULL, 1ULL)[0ULL];
observer->write<VkSurfaceKHR>(slice(pSurface, 0ULL, 1ULL), 0ULL, l_handle);
this->State.mSurfaces[l_handle] = l_surface;
break;
} while(false);
} catch (gapii::AbortException& e) {
if (!called) {
call(); // abort() was called before the fence.
}
handleAbort(observer, e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observer->observeWrites();
gapic::coder::vulkan::VkCreateXcbSurfaceKHR coder(observer->getScratch()->vector<gapic::Encodable*>(kMaxExtras), toEncoder< size_val >(instance, *observer->getScratch()), toEncoder< gapic::coder::vulkan::VkXcbSurfaceCreateInfoKHR__CP >(pCreateInfo, *observer->getScratch()), toEncoder< gapic::coder::vulkan::VkAllocationCallbacks__CP >(pAllocator, *observer->getScratch()), toEncoder< gapic::coder::vulkan::VkSurfaceKHR__P >(pSurface, *observer->getScratch()), result);
coder.mextras.append(observer->getExtras());
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
mEncoder->Variant(&coder);
return result;
}
VkBool32 VulkanSpy::vkGetPhysicalDeviceMirPresentationSupportKHR(CallObserver* observer, VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, MirConnection* connection) {
GAPID_DEBUG("vkGetPhysicalDeviceMirPresentationSupportKHR(%zu, %" PRIu32 ", %p)", physicalDevice, queueFamilyIndex, connection);
if (State.mPhysicalDevices.find(physicalDevice) == State.mPhysicalDevices.end() ||
mImports.mVkInstanceFunctions.find(State.mPhysicalDevices[physicalDevice]->mInstance) == mImports.mVkInstanceFunctions.end() ||
mImports.mVkInstanceFunctions[State.mPhysicalDevices[physicalDevice]->mInstance].vkGetPhysicalDeviceMirPresentationSupportKHR == nullptr) {
GAPID_WARNING("Application called unsupported function vkGetPhysicalDeviceMirPresentationSupportKHR");
return 0;
}
VkBool32 result = 0;
bool called = false;
auto call = [this, observer, &called, &result, physicalDevice, queueFamilyIndex, connection] {
called = true;
observer->observeReads();
result = mImports.mVkInstanceFunctions[State.mPhysicalDevices[physicalDevice]->mInstance].vkGetPhysicalDeviceMirPresentationSupportKHR(physicalDevice, queueFamilyIndex, connection);
onPostFence(observer);
};
uint64_t counter_at_begin = mCommandStartEndCounter++;
try {
do {
call();
break;
} while(false);
} catch (gapii::AbortException& e) {
if (!called) {
call(); // abort() was called before the fence.
}
handleAbort(observer, e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observer->observeWrites();
gapic::coder::vulkan::VkGetPhysicalDeviceMirPresentationSupportKHR coder(observer->getScratch()->vector<gapic::Encodable*>(kMaxExtras), toEncoder< size_val >(physicalDevice, *observer->getScratch()), queueFamilyIndex, toEncoder< gapic::coder::vulkan::MirConnection__P >(connection, *observer->getScratch()), toEncoder< uint32_t >(result, *observer->getScratch()));
coder.mextras.append(observer->getExtras());
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
mEncoder->Variant(&coder);
return result;
}
void VulkanSpy::replayUnregisterVkDevice(CallObserver* observer, VkDevice device) {
GAPID_DEBUG("replayUnregisterVkDevice(%zu)", device);
bool called = false;
auto call = [this, observer, &called, device] {
called = true;
observer->observeReads();
onPostFence(observer);
};
uint64_t counter_at_begin = mCommandStartEndCounter++;
try {
do {
call();
} while(false);
} catch (gapii::AbortException& e) {
if (!called) {
call(); // abort() was called before the fence.
}
handleAbort(observer, e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observer->observeWrites();
gapic::coder::vulkan::ReplayUnregisterVkDevice coder(observer->getScratch()->vector<gapic::Encodable*>(kMaxExtras), toEncoder< size_val >(device, *observer->getScratch()));
coder.mextras.append(observer->getExtras());
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
mEncoder->Variant(&coder);
}
uint32_t VulkanSpy::vkCreateInstance(CallObserver* observer, VkInstanceCreateInfo* pCreateInfo, VkAllocationCallbacks* pAllocator, VkInstance* pInstance) {
GAPID_DEBUG("vkCreateInstance(%p, %p, %p)", pCreateInfo, pAllocator, pInstance);
uint32_t result = 0;
bool called = false;
auto call = [this, observer, &called, &result, pCreateInfo, pAllocator, pInstance] {
called = true;
observer->observeReads();
result = SpyOverride_vkCreateInstance(pCreateInfo, pAllocator, pInstance);
onPostFence(observer);
};
uint64_t counter_at_begin = mCommandStartEndCounter++;
try {
do {
std::shared_ptr<InstanceObject> l_instance = subCreateInstanceObject(observer, call, pCreateInfo);
call();
auto l_handle = slice(pInstance, 0ULL, 1ULL)[0ULL];
observer->write<VkInstance>(slice(pInstance, 0ULL, 1ULL), 0ULL, l_handle);
this->State.mInstances[l_handle] = l_instance;
break;
} while(false);
} catch (gapii::AbortException& e) {
if (!called) {
call(); // abort() was called before the fence.
}
handleAbort(observer, e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observer->observeWrites();
gapic::coder::vulkan::VkCreateInstance coder(observer->getScratch()->vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkInstanceCreateInfo__CP >(pCreateInfo, *observer->getScratch()), toEncoder< gapic::coder::vulkan::VkAllocationCallbacks__CP >(pAllocator, *observer->getScratch()), toEncoder< gapic::coder::vulkan::VkInstance__P >(pInstance, *observer->getScratch()), result);
coder.mextras.append(observer->getExtras());
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
mEncoder->Variant(&coder);
return result;
}
void VulkanSpy::vkGetPhysicalDeviceQueueFamilyProperties(CallObserver* observer, VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties* pQueueFamilyProperties) {
GAPID_DEBUG("vkGetPhysicalDeviceQueueFamilyProperties(%zu, %p, %p)", physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties);
if (State.mPhysicalDevices.find(physicalDevice) == State.mPhysicalDevices.end() ||
mImports.mVkInstanceFunctions.find(State.mPhysicalDevices[physicalDevice]->mInstance) == mImports.mVkInstanceFunctions.end() ||
mImports.mVkInstanceFunctions[State.mPhysicalDevices[physicalDevice]->mInstance].vkGetPhysicalDeviceQueueFamilyProperties == nullptr) {
GAPID_WARNING("Application called unsupported function vkGetPhysicalDeviceQueueFamilyProperties");
return;
}
bool called = false;
auto call = [this, observer, &called, physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties] {
called = true;
observer->observeReads();
mImports.mVkInstanceFunctions[State.mPhysicalDevices[physicalDevice]->mInstance].vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties);
onPostFence(observer);
};
uint64_t counter_at_begin = mCommandStartEndCounter++;
try {
do {
(void)observer->read(slice(pQueueFamilyPropertyCount, 0ULL, 1ULL), 0ULL);
call();
if ((pQueueFamilyProperties) == (nullptr)) {
observer->write<uint32_t>(slice(pQueueFamilyPropertyCount, 0ULL, 1ULL), 0ULL, slice(pQueueFamilyPropertyCount, 0ULL, 1ULL)[0ULL]);
} else {
uint32_t l_count = (uint32_t)(slice(pQueueFamilyPropertyCount, 0ULL, 1ULL)[0ULL]);
Slice<VkQueueFamilyProperties> l_properties = slice(pQueueFamilyProperties, (uint64_t)(0UL), (uint64_t)(l_count));
for (uint32_t l_i = 0UL; l_i < l_count; ++l_i) {
observer->write<VkQueueFamilyProperties>(l_properties, (uint64_t)(l_i), slice(pQueueFamilyProperties, (uint64_t)(0UL), (uint64_t)(l_count))[(uint64_t)(l_i)]);
}
observer->write<uint32_t>(slice(pQueueFamilyPropertyCount, 0ULL, 1ULL), 0ULL, l_count);
}
} while(false);
} catch (gapii::AbortException& e) {
if (!called) {
call(); // abort() was called before the fence.
}
handleAbort(observer, e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observer->observeWrites();
gapic::coder::vulkan::VkGetPhysicalDeviceQueueFamilyProperties coder(observer->getScratch()->vector<gapic::Encodable*>(kMaxExtras), toEncoder< size_val >(physicalDevice, *observer->getScratch()), toEncoder< gapic::coder::vulkan::U32__P >(pQueueFamilyPropertyCount, *observer->getScratch()), toEncoder< gapic::coder::vulkan::VkQueueFamilyProperties__P >(pQueueFamilyProperties, *observer->getScratch()));
coder.mextras.append(observer->getExtras());
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
mEncoder->Variant(&coder);
}
uint32_t VulkanSpy::vkEnumerateInstanceExtensionProperties(CallObserver* observer, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties) {
GAPID_DEBUG("vkEnumerateInstanceExtensionProperties(%s, %p, %p)", pLayerName, pPropertyCount, pProperties);
uint32_t result = 0;
bool called = false;
auto call = [this, observer, &called, &result, pLayerName, pPropertyCount, pProperties] {
called = true;
observer->observeReads();
result = SpyOverride_vkEnumerateInstanceExtensionProperties(pLayerName, pPropertyCount, pProperties);
onPostFence(observer);
};
uint64_t counter_at_begin = mCommandStartEndCounter++;
try {
do {
call();
subQueryExtensionProperties(observer, call, pPropertyCount, pProperties);
break;
} while(false);
} catch (gapii::AbortException& e) {
if (!called) {
call(); // abort() was called before the fence.
}
handleAbort(observer, e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observer->observeWrites();
gapic::coder::vulkan::VkEnumerateInstanceExtensionProperties coder(observer->getScratch()->vector<gapic::Encodable*>(kMaxExtras), toEncoder< const char* >(pLayerName, *observer->getScratch()), toEncoder< gapic::coder::vulkan::U32__P >(pPropertyCount, *observer->getScratch()), toEncoder< gapic::coder::vulkan::VkExtensionProperties__P >(pProperties, *observer->getScratch()), result);
coder.mextras.append(observer->getExtras());
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
mEncoder->Variant(&coder);
return result;
}
uint32_t VulkanSpy::vkQueueSubmit(CallObserver* observer, VkQueue queue, uint32_t submitCount, VkSubmitInfo* pSubmits, VkFence fence) {
GAPID_DEBUG("vkQueueSubmit(%zu, %" PRIu32 ", %p, %" PRIu64 ")", queue, submitCount, pSubmits, fence);
if (State.mQueues.find(queue) == State.mQueues.end() ||
mImports.mVkDeviceFunctions.find(State.mQueues[queue]->mDevice) == mImports.mVkDeviceFunctions.end() ||
mImports.mVkDeviceFunctions[State.mQueues[queue]->mDevice].vkQueueSubmit == nullptr) {
GAPID_WARNING("Application called unsupported function vkQueueSubmit");
return 0;
}
uint32_t result = 0;
bool called = false;
auto call = [this, observer, &called, &result, queue, submitCount, pSubmits, fence] {
called = true;
observer->observeReads();
result = mImports.mVkDeviceFunctions[State.mQueues[queue]->mDevice].vkQueueSubmit(queue, submitCount, pSubmits, fence);
onPostFence(observer);
};
uint64_t counter_at_begin = mCommandStartEndCounter++;
try {
do {
Slice<VkSubmitInfo> l_submitInfo = slice(pSubmits, (uint64_t)(0UL), (uint64_t)(submitCount));
this->State.mLastBoundQueue = queue;
for (uint32_t l_i = 0UL; l_i < submitCount; ++l_i) {
VkSubmitInfo l_info = observer->read(l_submitInfo, (uint64_t)(l_i));
observer->read(slice(l_info.mpWaitSemaphores, (uint64_t)(0UL), (uint64_t)(l_info.mwaitSemaphoreCount)));
observer->read(slice(l_info.mpWaitDstStageMask, (uint64_t)(0UL), (uint64_t)(l_info.mwaitSemaphoreCount)));
observer->read(slice(l_info.mpSignalSemaphores, (uint64_t)(0UL), (uint64_t)(l_info.msignalSemaphoreCount)));
Slice<VkCommandBuffer> l_command_buffers = slice(l_info.mpCommandBuffers, (uint64_t)(0UL), (uint64_t)(l_info.mcommandBufferCount));
for (uint32_t l_j = 0UL; l_j < l_info.mcommandBufferCount; ++l_j) {
execCommands(observer, observer->read(l_command_buffers, (uint64_t)(l_j)));
}
}
call();
break;
} while(false);
} catch (gapii::AbortException& e) {
if (!called) {
call(); // abort() was called before the fence.
}
handleAbort(observer, e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observer->observeWrites();
gapic::coder::vulkan::VkQueueSubmit coder(observer->getScratch()->vector<gapic::Encodable*>(kMaxExtras), toEncoder< size_val >(queue, *observer->getScratch()), submitCount, toEncoder< gapic::coder::vulkan::VkSubmitInfo__CP >(pSubmits, *observer->getScratch()), toEncoder< uint64_t >(fence, *observer->getScratch()), result);
coder.mextras.append(observer->getExtras());
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
mEncoder->Variant(&coder);
return result;
}
uint32_t VulkanSpy::vkInvalidateMappedMemoryRanges(CallObserver* observer, VkDevice device, uint32_t memoryRangeCount, VkMappedMemoryRange* pMemoryRanges) {
GAPID_DEBUG("vkInvalidateMappedMemoryRanges(%zu, %" PRIu32 ", %p)", device, memoryRangeCount, pMemoryRanges);
if (mImports.mVkDeviceFunctions.find(device) == mImports.mVkDeviceFunctions.end() ||
mImports.mVkDeviceFunctions[device].vkInvalidateMappedMemoryRanges == nullptr) {
GAPID_WARNING("Application called unsupported function vkInvalidateMappedMemoryRanges");
return 0;
}
uint32_t result = 0;
bool called = false;
auto call = [this, observer, &called, &result, device, memoryRangeCount, pMemoryRanges] {
called = true;
observer->observeReads();
result = mImports.mVkDeviceFunctions[device].vkInvalidateMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges);
onPostFence(observer);
};
uint64_t counter_at_begin = mCommandStartEndCounter++;
try {
do {
std::shared_ptr<MemoryRangeArray> l_ranges = std::shared_ptr<MemoryRangeArray>(new MemoryRangeArray(U32ToVoid__P(), U32ToU64(), U32ToU64()));
Slice<VkMappedMemoryRange> l_memoryRanges = slice(pMemoryRanges, (uint64_t)(0UL), (uint64_t)(memoryRangeCount));
for (uint32_t l_i = 0UL; l_i < memoryRangeCount; ++l_i) {
VkMappedMemoryRange l_invalidateRange = observer->read(l_memoryRanges, (uint64_t)(l_i));
VkDeviceSize l_invalidateOffset = l_invalidateRange.moffset;
void* l_mappedLocation = checkNotNull(findOrZero(this->State.mDeviceMemories, l_invalidateRange.mmemory)).mMappedLocation;
VkDeviceSize l_mappedOffset = checkNotNull(findOrZero(this->State.mDeviceMemories, l_invalidateRange.mmemory)).mMappedOffset;
VkDeviceSize l_mappedSize = checkNotNull(findOrZero(this->State.mDeviceMemories, l_invalidateRange.mmemory)).mMappedSize;
checkNotNull(l_ranges).mPData[l_i] = l_mappedLocation;
checkNotNull(l_ranges).mStart[l_i] = (uint64_t)((l_invalidateOffset) - (l_mappedOffset));
if ((l_invalidateRange.msize) == ((VkDeviceSize)(18446744073709551615ULL))) {
checkNotNull(l_ranges).mEnd[l_i] = (uint64_t)(l_mappedSize);
} else {
checkNotNull(l_ranges).mEnd[l_i] = (findOrZero(checkNotNull(l_ranges).mStart, l_i)) + ((uint64_t)(l_invalidateRange.msize));
}
}
call();
for (uint32_t l_i = 0UL; l_i < memoryRangeCount; ++l_i) {
observer->write(slice(findOrZero(checkNotNull(l_ranges).mPData, l_i), findOrZero(checkNotNull(l_ranges).mStart, l_i), findOrZero(checkNotNull(l_ranges).mEnd, l_i)));
}
break;
} while(false);
} catch (gapii::AbortException& e) {
if (!called) {
call(); // abort() was called before the fence.
}
handleAbort(observer, e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observer->observeWrites();
gapic::coder::vulkan::VkInvalidateMappedMemoryRanges coder(observer->getScratch()->vector<gapic::Encodable*>(kMaxExtras), toEncoder< size_val >(device, *observer->getScratch()), memoryRangeCount, toEncoder< gapic::coder::vulkan::VkMappedMemoryRange__CP >(pMemoryRanges, *observer->getScratch()), result);
coder.mextras.append(observer->getExtras());
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
mEncoder->Variant(&coder);
return result;
}
uint32_t VulkanSpy::vkBindImageMemory(CallObserver* observer, VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset) {
GAPID_DEBUG("vkBindImageMemory(%zu, %" PRIu64 ", %" PRIu64 ", %" PRIu64 ")", device, image, memory, memoryOffset);
if (mImports.mVkDeviceFunctions.find(device) == mImports.mVkDeviceFunctions.end() ||
mImports.mVkDeviceFunctions[device].vkBindImageMemory == nullptr) {
GAPID_WARNING("Application called unsupported function vkBindImageMemory");
return 0;
}
uint32_t result = 0;
bool called = false;
auto call = [this, observer, &called, &result, device, image, memory, memoryOffset] {
called = true;
observer->observeReads();
result = mImports.mVkDeviceFunctions[device].vkBindImageMemory(device, image, memory, memoryOffset);
onPostFence(observer);
};
uint64_t counter_at_begin = mCommandStartEndCounter++;
try {
do {
checkNotNull(findOrZero(this->State.mImages, image)).mBoundMemory = memory;
checkNotNull(findOrZero(this->State.mDeviceMemories, memory)).mBoundObjects[(uint64_t)(image)] = memoryOffset;
call();
break;
} while(false);
} catch (gapii::AbortException& e) {
if (!called) {
call(); // abort() was called before the fence.
}
handleAbort(observer, e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observer->observeWrites();
gapic::coder::vulkan::VkBindImageMemory coder(observer->getScratch()->vector<gapic::Encodable*>(kMaxExtras), toEncoder< size_val >(device, *observer->getScratch()), toEncoder< uint64_t >(image, *observer->getScratch()), toEncoder< uint64_t >(memory, *observer->getScratch()), toEncoder< uint64_t >(memoryOffset, *observer->getScratch()), result);
coder.mextras.append(observer->getExtras());
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
mEncoder->Variant(&coder);
return result;
}
uint32_t VulkanSpy::vkGetFenceStatus(CallObserver* observer, VkDevice device, VkFence fence) {
GAPID_DEBUG("vkGetFenceStatus(%zu, %" PRIu64 ")", device, fence);
if (mImports.mVkDeviceFunctions.find(device) == mImports.mVkDeviceFunctions.end() ||
mImports.mVkDeviceFunctions[device].vkGetFenceStatus == nullptr) {
GAPID_WARNING("Application called unsupported function vkGetFenceStatus");
return 0;
}
uint32_t result = 0;
bool called = false;
auto call = [this, observer, &called, &result, device, fence] {
called = true;
observer->observeReads();
result = mImports.mVkDeviceFunctions[device].vkGetFenceStatus(device, fence);
onPostFence(observer);
};
uint64_t counter_at_begin = mCommandStartEndCounter++;
try {
do {
call();
break;
} while(false);
} catch (gapii::AbortException& e) {
if (!called) {
call(); // abort() was called before the fence.
}
handleAbort(observer, e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observer->observeWrites();
gapic::coder::vulkan::VkGetFenceStatus coder(observer->getScratch()->vector<gapic::Encodable*>(kMaxExtras), toEncoder< size_val >(device, *observer->getScratch()), toEncoder< uint64_t >(fence, *observer->getScratch()), result);
coder.mextras.append(observer->getExtras());
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
mEncoder->Variant(&coder);
return result;
}
uint32_t VulkanSpy::vkCreateBufferView(CallObserver* observer, VkDevice device, VkBufferViewCreateInfo* pCreateInfo, VkAllocationCallbacks* pAllocator, VkBufferView* pView) {
GAPID_DEBUG("vkCreateBufferView(%zu, %p, %p, %p)", device, pCreateInfo, pAllocator, pView);
if (mImports.mVkDeviceFunctions.find(device) == mImports.mVkDeviceFunctions.end() ||
mImports.mVkDeviceFunctions[device].vkCreateBufferView == nullptr) {
GAPID_WARNING("Application called unsupported function vkCreateBufferView");
return 0;
}
uint32_t result = 0;
bool called = false;
auto call = [this, observer, &called, &result, device, pCreateInfo, pAllocator, pView] {
called = true;
observer->observeReads();
result = mImports.mVkDeviceFunctions[device].vkCreateBufferView(device, pCreateInfo, pAllocator, pView);
onPostFence(observer);
};
uint64_t counter_at_begin = mCommandStartEndCounter++;
try {
do {
call();
break;
} while(false);
} catch (gapii::AbortException& e) {
if (!called) {
call(); // abort() was called before the fence.
}
handleAbort(observer, e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observer->observeWrites();
gapic::coder::vulkan::VkCreateBufferView coder(observer->getScratch()->vector<gapic::Encodable*>(kMaxExtras), toEncoder< size_val >(device, *observer->getScratch()), toEncoder< gapic::coder::vulkan::VkBufferViewCreateInfo__CP >(pCreateInfo, *observer->getScratch()), toEncoder< gapic::coder::vulkan::VkAllocationCallbacks__CP >(pAllocator, *observer->getScratch()), toEncoder< gapic::coder::vulkan::VkBufferView__P >(pView, *observer->getScratch()), result);
coder.mextras.append(observer->getExtras());
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
mEncoder->Variant(&coder);
return result;
}
void VulkanSpy::vkDestroyImage(CallObserver* observer, VkDevice device, VkImage image, VkAllocationCallbacks* pAllocator) {
GAPID_DEBUG("vkDestroyImage(%zu, %" PRIu64 ", %p)", device, image, pAllocator);
if (mImports.mVkDeviceFunctions.find(device) == mImports.mVkDeviceFunctions.end() ||
mImports.mVkDeviceFunctions[device].vkDestroyImage == nullptr) {
GAPID_WARNING("Application called unsupported function vkDestroyImage");
return;
}
bool called = false;
auto call = [this, observer, &called, device, image, pAllocator] {
called = true;
observer->observeReads();
mImports.mVkDeviceFunctions[device].vkDestroyImage(device, image, pAllocator);
onPostFence(observer);
};
uint64_t counter_at_begin = mCommandStartEndCounter++;
try {
do {
std::shared_ptr<ImageObject> l_imageObject = findOrZero(this->State.mImages, image);
if (((uint64_t)(checkNotNull(l_imageObject).mBoundMemory)) != (0ULL)) {
if ((findOrZero(this->State.mDeviceMemories, checkNotNull(l_imageObject).mBoundMemory)) != (std::shared_ptr<DeviceMemoryObject>())) {
checkNotNull(findOrZero(this->State.mDeviceMemories, checkNotNull(l_imageObject).mBoundMemory)).mBoundObjects.erase((uint64_t)(image));
}
}
this->State.mImages.erase(image);
call();
} while(false);
} catch (gapii::AbortException& e) {
if (!called) {
call(); // abort() was called before the fence.
}
handleAbort(observer, e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observer->observeWrites();
gapic::coder::vulkan::VkDestroyImage coder(observer->getScratch()->vector<gapic::Encodable*>(kMaxExtras), toEncoder< size_val >(device, *observer->getScratch()), toEncoder< uint64_t >(image, *observer->getScratch()), toEncoder< gapic::coder::vulkan::VkAllocationCallbacks__CP >(pAllocator, *observer->getScratch()));
coder.mextras.append(observer->getExtras());
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
mEncoder->Variant(&coder);
}
void VulkanSpy::vkDestroyShaderModule(CallObserver* observer, VkDevice device, VkShaderModule shaderModule, VkAllocationCallbacks* pAllocator) {
GAPID_DEBUG("vkDestroyShaderModule(%zu, %" PRIu64 ", %p)", device, shaderModule, pAllocator);
if (mImports.mVkDeviceFunctions.find(device) == mImports.mVkDeviceFunctions.end() ||
mImports.mVkDeviceFunctions[device].vkDestroyShaderModule == nullptr) {
GAPID_WARNING("Application called unsupported function vkDestroyShaderModule");
return;
}
bool called = false;
auto call = [this, observer, &called, device, shaderModule, pAllocator] {
called = true;
observer->observeReads();
mImports.mVkDeviceFunctions[device].vkDestroyShaderModule(device, shaderModule, pAllocator);
onPostFence(observer);
};
uint64_t counter_at_begin = mCommandStartEndCounter++;
try {
do {
this->State.mShaderModules.erase(shaderModule);
call();
} while(false);
} catch (gapii::AbortException& e) {
if (!called) {
call(); // abort() was called before the fence.
}
handleAbort(observer, e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observer->observeWrites();
gapic::coder::vulkan::VkDestroyShaderModule coder(observer->getScratch()->vector<gapic::Encodable*>(kMaxExtras), toEncoder< size_val >(device, *observer->getScratch()), toEncoder< uint64_t >(shaderModule, *observer->getScratch()), toEncoder< gapic::coder::vulkan::VkAllocationCallbacks__CP >(pAllocator, *observer->getScratch()));
coder.mextras.append(observer->getExtras());
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
mEncoder->Variant(&coder);
}
void VulkanSpy::vkDestroyDescriptorSetLayout(CallObserver* observer, VkDevice device, VkDescriptorSetLayout descriptorSetLayout, VkAllocationCallbacks* pAllocator) {
GAPID_DEBUG("vkDestroyDescriptorSetLayout(%zu, %" PRIu64 ", %p)", device, descriptorSetLayout, pAllocator);
if (mImports.mVkDeviceFunctions.find(device) == mImports.mVkDeviceFunctions.end() ||
mImports.mVkDeviceFunctions[device].vkDestroyDescriptorSetLayout == nullptr) {
GAPID_WARNING("Application called unsupported function vkDestroyDescriptorSetLayout");
return;
}
bool called = false;
auto call = [this, observer, &called, device, descriptorSetLayout, pAllocator] {
called = true;
observer->observeReads();
mImports.mVkDeviceFunctions[device].vkDestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator);
onPostFence(observer);
};
uint64_t counter_at_begin = mCommandStartEndCounter++;
try {
do {
this->State.mDescriptorSetLayouts.erase(descriptorSetLayout);
call();
} while(false);
} catch (gapii::AbortException& e) {
if (!called) {
call(); // abort() was called before the fence.
}
handleAbort(observer, e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observer->observeWrites();
gapic::coder::vulkan::VkDestroyDescriptorSetLayout coder(observer->getScratch()->vector<gapic::Encodable*>(kMaxExtras), toEncoder< size_val >(device, *observer->getScratch()), toEncoder< uint64_t >(descriptorSetLayout, *observer->getScratch()), toEncoder< gapic::coder::vulkan::VkAllocationCallbacks__CP >(pAllocator, *observer->getScratch()));
coder.mextras.append(observer->getExtras());
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
mEncoder->Variant(&coder);
}
uint32_t VulkanSpy::vkAllocateDescriptorSets(CallObserver* observer, VkDevice device, VkDescriptorSetAllocateInfo* pAllocateInfo, VkDescriptorSet* pDescriptorSets) {
GAPID_DEBUG("vkAllocateDescriptorSets(%zu, %p, %p)", device, pAllocateInfo, pDescriptorSets);
if (mImports.mVkDeviceFunctions.find(device) == mImports.mVkDeviceFunctions.end() ||
mImports.mVkDeviceFunctions[device].vkAllocateDescriptorSets == nullptr) {
GAPID_WARNING("Application called unsupported function vkAllocateDescriptorSets");
return 0;
}
uint32_t result = 0;
bool called = false;
auto call = [this, observer, &called, &result, device, pAllocateInfo, pDescriptorSets] {
called = true;
observer->observeReads();
result = mImports.mVkDeviceFunctions[device].vkAllocateDescriptorSets(device, pAllocateInfo, pDescriptorSets);
onPostFence(observer);
};
uint64_t counter_at_begin = mCommandStartEndCounter++;
try {
do {
VkDescriptorSetAllocateInfo l_info = observer->read(slice(pAllocateInfo, 0ULL, 1ULL), 0ULL);
uint32_t l_count = l_info.mdescriptorSetCount;
observer->read(slice(l_info.mpSetLayouts, (uint64_t)(0UL), (uint64_t)(l_count)));
Slice<VkDescriptorSet> l_sets = slice(pDescriptorSets, (uint64_t)(0UL), (uint64_t)(l_count));
call();
for (uint32_t l_i = 0UL; l_i < l_count; ++l_i) {
auto l_handle = slice(pDescriptorSets, (uint64_t)(0UL), (uint64_t)(l_count))[(uint64_t)(l_i)];
observer->write<VkDescriptorSet>(l_sets, (uint64_t)(l_i), l_handle);
this->State.mDescriptorSets[l_handle] = std::shared_ptr<DescriptorSetObject>(new DescriptorSetObject(device, U32ToU32ToVkDescriptorBufferInfo()));
}
break;
} while(false);
} catch (gapii::AbortException& e) {
if (!called) {
call(); // abort() was called before the fence.
}
handleAbort(observer, e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observer->observeWrites();
gapic::coder::vulkan::VkAllocateDescriptorSets coder(observer->getScratch()->vector<gapic::Encodable*>(kMaxExtras), toEncoder< size_val >(device, *observer->getScratch()), toEncoder< gapic::coder::vulkan::VkDescriptorSetAllocateInfo__CP >(pAllocateInfo, *observer->getScratch()), toEncoder< gapic::coder::vulkan::VkDescriptorSet__P >(pDescriptorSets, *observer->getScratch()), result);
coder.mextras.append(observer->getExtras());
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
mEncoder->Variant(&coder);
return result;
}
uint32_t VulkanSpy::vkCreateFramebuffer(CallObserver* observer, VkDevice device, VkFramebufferCreateInfo* pCreateInfo, VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer) {
GAPID_DEBUG("vkCreateFramebuffer(%zu, %p, %p, %p)", device, pCreateInfo, pAllocator, pFramebuffer);
if (mImports.mVkDeviceFunctions.find(device) == mImports.mVkDeviceFunctions.end() ||
mImports.mVkDeviceFunctions[device].vkCreateFramebuffer == nullptr) {
GAPID_WARNING("Application called unsupported function vkCreateFramebuffer");
return 0;
}
uint32_t result = 0;
bool called = false;
auto call = [this, observer, &called, &result, device, pCreateInfo, pAllocator, pFramebuffer] {
called = true;
observer->observeReads();
result = mImports.mVkDeviceFunctions[device].vkCreateFramebuffer(device, pCreateInfo, pAllocator, pFramebuffer);
onPostFence(observer);
};
uint64_t counter_at_begin = mCommandStartEndCounter++;
try {
do {
std::shared_ptr<FramebufferObject> l_framebuffer = std::shared_ptr<FramebufferObject>(new FramebufferObject(0, U32ToVkImageView(), 0, 0));
checkNotNull(l_framebuffer).mDevice = device;
VkFramebufferCreateInfo l_create_info = observer->read(slice(pCreateInfo, 0ULL, 1ULL), 0ULL);
checkNotNull(l_framebuffer).mWidth = l_create_info.mwidth;
checkNotNull(l_framebuffer).mHeight = l_create_info.mheight;
Slice<VkImageView> l_attachments = slice(l_create_info.mpAttachments, (uint64_t)(0UL), (uint64_t)(l_create_info.mattachmentCount));
for (uint32_t l_i = 0UL; l_i < l_create_info.mattachmentCount; ++l_i) {
checkNotNull(l_framebuffer).mImageAttachments[l_i] = observer->read(l_attachments, (uint64_t)(l_i));
}
call();
auto l_handle = slice(pFramebuffer, 0ULL, 1ULL)[0ULL];
observer->write<VkFramebuffer>(slice(pFramebuffer, 0ULL, 1ULL), 0ULL, l_handle);
this->State.mFramebuffers[l_handle] = l_framebuffer;
break;
} while(false);
} catch (gapii::AbortException& e) {
if (!called) {
call(); // abort() was called before the fence.
}
handleAbort(observer, e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observer->observeWrites();
gapic::coder::vulkan::VkCreateFramebuffer coder(observer->getScratch()->vector<gapic::Encodable*>(kMaxExtras), toEncoder< size_val >(device, *observer->getScratch()), toEncoder< gapic::coder::vulkan::VkFramebufferCreateInfo__CP >(pCreateInfo, *observer->getScratch()), toEncoder< gapic::coder::vulkan::VkAllocationCallbacks__CP >(pAllocator, *observer->getScratch()), toEncoder< gapic::coder::vulkan::VkFramebuffer__P >(pFramebuffer, *observer->getScratch()), result);
coder.mextras.append(observer->getExtras());
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
mEncoder->Variant(&coder);
return result;
}
void VulkanSpy::vkDestroyRenderPass(CallObserver* observer, VkDevice device, VkRenderPass renderPass, VkAllocationCallbacks* pAllocator) {
GAPID_DEBUG("vkDestroyRenderPass(%zu, %" PRIu64 ", %p)", device, renderPass, pAllocator);
if (mImports.mVkDeviceFunctions.find(device) == mImports.mVkDeviceFunctions.end() ||
mImports.mVkDeviceFunctions[device].vkDestroyRenderPass == nullptr) {
GAPID_WARNING("Application called unsupported function vkDestroyRenderPass");
return;
}
bool called = false;
auto call = [this, observer, &called, device, renderPass, pAllocator] {
called = true;
observer->observeReads();
mImports.mVkDeviceFunctions[device].vkDestroyRenderPass(device, renderPass, pAllocator);
onPostFence(observer);
};
uint64_t counter_at_begin = mCommandStartEndCounter++;
try {
do {
call();
} while(false);
} catch (gapii::AbortException& e) {
if (!called) {
call(); // abort() was called before the fence.
}
handleAbort(observer, e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observer->observeWrites();
gapic::coder::vulkan::VkDestroyRenderPass coder(observer->getScratch()->vector<gapic::Encodable*>(kMaxExtras), toEncoder< size_val >(device, *observer->getScratch()), toEncoder< uint64_t >(renderPass, *observer->getScratch()), toEncoder< gapic::coder::vulkan::VkAllocationCallbacks__CP >(pAllocator, *observer->getScratch()));
coder.mextras.append(observer->getExtras());
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
mEncoder->Variant(&coder);
}
void VulkanSpy::vkGetRenderAreaGranularity(CallObserver* observer, VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity) {
GAPID_DEBUG("vkGetRenderAreaGranularity(%zu, %" PRIu64 ", %p)", device, renderPass, pGranularity);
if (mImports.mVkDeviceFunctions.find(device) == mImports.mVkDeviceFunctions.end() ||
mImports.mVkDeviceFunctions[device].vkGetRenderAreaGranularity == nullptr) {
GAPID_WARNING("Application called unsupported function vkGetRenderAreaGranularity");
return;
}
bool called = false;
auto call = [this, observer, &called, device, renderPass, pGranularity] {
called = true;
observer->observeReads();
mImports.mVkDeviceFunctions[device].vkGetRenderAreaGranularity(device, renderPass, pGranularity);
onPostFence(observer);
};
uint64_t counter_at_begin = mCommandStartEndCounter++;
try {
do {
call();
} while(false);
} catch (gapii::AbortException& e) {
if (!called) {
call(); // abort() was called before the fence.
}
handleAbort(observer, e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observer->observeWrites();
gapic::coder::vulkan::VkGetRenderAreaGranularity coder(observer->getScratch()->vector<gapic::Encodable*>(kMaxExtras), toEncoder< size_val >(device, *observer->getScratch()), toEncoder< uint64_t >(renderPass, *observer->getScratch()), toEncoder< gapic::coder::vulkan::VkExtent2D__P >(pGranularity, *observer->getScratch()));
coder.mextras.append(observer->getExtras());
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
mEncoder->Variant(&coder);
}
uint32_t VulkanSpy::vkAllocateCommandBuffers(CallObserver* observer, VkDevice device, VkCommandBufferAllocateInfo* pAllocateInfo, VkCommandBuffer* pCommandBuffers) {
GAPID_DEBUG("vkAllocateCommandBuffers(%zu, %p, %p)", device, pAllocateInfo, pCommandBuffers);
if (mImports.mVkDeviceFunctions.find(device) == mImports.mVkDeviceFunctions.end() ||
mImports.mVkDeviceFunctions[device].vkAllocateCommandBuffers == nullptr) {
GAPID_WARNING("Application called unsupported function vkAllocateCommandBuffers");
return 0;
}
uint32_t result = 0;
bool called = false;
auto call = [this, observer, &called, &result, device, pAllocateInfo, pCommandBuffers] {
called = true;
observer->observeReads();
result = mImports.mVkDeviceFunctions[device].vkAllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers);
onPostFence(observer);
};
uint64_t counter_at_begin = mCommandStartEndCounter++;
try {
do {
uint32_t l_count = observer->read(slice(pAllocateInfo, 0ULL, 1ULL), 0ULL).mcommandBufferCount;
Slice<VkCommandBuffer> l_cb = slice(pCommandBuffers, (uint64_t)(0UL), (uint64_t)(l_count));
call();
for (uint32_t l_i = 0UL; l_i < l_count; ++l_i) {
auto l_command_buffer = slice(pCommandBuffers, (uint64_t)(0UL), (uint64_t)(l_count))[(uint64_t)(l_i)];
this->State.mCommandBuffers[l_command_buffer] = std::shared_ptr<CommandBufferObject>(new CommandBufferObject(device, U64ToVkDeviceMemory()));
observer->write<VkCommandBuffer>(l_cb, (uint64_t)(l_i), l_command_buffer);
}
break;
} while(false);
} catch (gapii::AbortException& e) {
if (!called) {
call(); // abort() was called before the fence.
}
handleAbort(observer, e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observer->observeWrites();
gapic::coder::vulkan::VkAllocateCommandBuffers coder(observer->getScratch()->vector<gapic::Encodable*>(kMaxExtras), toEncoder< size_val >(device, *observer->getScratch()), toEncoder< gapic::coder::vulkan::VkCommandBufferAllocateInfo__CP >(pAllocateInfo, *observer->getScratch()), toEncoder< gapic::coder::vulkan::VkCommandBuffer__P >(pCommandBuffers, *observer->getScratch()), result);
coder.mextras.append(observer->getExtras());
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
mEncoder->Variant(&coder);
return result;
}
void VulkanSpy::vkCmdSetStencilCompareMask(CallObserver* observer, VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask) {
GAPID_DEBUG("vkCmdSetStencilCompareMask(%zu, %" PRIu32 ", %" PRIu32 ")", commandBuffer, faceMask, compareMask);
if (State.mCommandBuffers.find(commandBuffer) == State.mCommandBuffers.end() ||
mImports.mVkDeviceFunctions.find(State.mCommandBuffers[commandBuffer]->mDevice) == mImports.mVkDeviceFunctions.end() ||
mImports.mVkDeviceFunctions[State.mCommandBuffers[commandBuffer]->mDevice].vkCmdSetStencilCompareMask == nullptr) {
GAPID_WARNING("Application called unsupported function vkCmdSetStencilCompareMask");
return;
}
bool called = false;
auto call = [this, observer, &called, commandBuffer, faceMask, compareMask] {
called = true;
observer->observeReads();
mImports.mVkDeviceFunctions[State.mCommandBuffers[commandBuffer]->mDevice].vkCmdSetStencilCompareMask(commandBuffer, faceMask, compareMask);
onPostFence(observer);
};
uint64_t counter_at_begin = mCommandStartEndCounter++;
try {
do {
call();
} while(false);
} catch (gapii::AbortException& e) {
if (!called) {
call(); // abort() was called before the fence.
}
handleAbort(observer, e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observer->observeWrites();
gapic::coder::vulkan::VkCmdSetStencilCompareMask coder(observer->getScratch()->vector<gapic::Encodable*>(kMaxExtras), toEncoder< size_val >(commandBuffer, *observer->getScratch()), toEncoder< uint32_t >(faceMask, *observer->getScratch()), compareMask);
coder.mextras.append(observer->getExtras());
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
mEncoder->Variant(&coder);
}
void VulkanSpy::vkCmdSetStencilWriteMask(CallObserver* observer, VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask) {
GAPID_DEBUG("vkCmdSetStencilWriteMask(%zu, %" PRIu32 ", %" PRIu32 ")", commandBuffer, faceMask, writeMask);
if (State.mCommandBuffers.find(commandBuffer) == State.mCommandBuffers.end() ||
mImports.mVkDeviceFunctions.find(State.mCommandBuffers[commandBuffer]->mDevice) == mImports.mVkDeviceFunctions.end() ||
mImports.mVkDeviceFunctions[State.mCommandBuffers[commandBuffer]->mDevice].vkCmdSetStencilWriteMask == nullptr) {
GAPID_WARNING("Application called unsupported function vkCmdSetStencilWriteMask");
return;
}
bool called = false;
auto call = [this, observer, &called, commandBuffer, faceMask, writeMask] {
called = true;
observer->observeReads();
mImports.mVkDeviceFunctions[State.mCommandBuffers[commandBuffer]->mDevice].vkCmdSetStencilWriteMask(commandBuffer, faceMask, writeMask);
onPostFence(observer);
};
uint64_t counter_at_begin = mCommandStartEndCounter++;
try {
do {
call();
} while(false);
} catch (gapii::AbortException& e) {
if (!called) {
call(); // abort() was called before the fence.
}
handleAbort(observer, e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observer->observeWrites();
gapic::coder::vulkan::VkCmdSetStencilWriteMask coder(observer->getScratch()->vector<gapic::Encodable*>(kMaxExtras), toEncoder< size_val >(commandBuffer, *observer->getScratch()), toEncoder< uint32_t >(faceMask, *observer->getScratch()), writeMask);
coder.mextras.append(observer->getExtras());
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
mEncoder->Variant(&coder);
}
void VulkanSpy::vkCmdBindDescriptorSets(CallObserver* observer, VkCommandBuffer commandBuffer, uint32_t pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, uint32_t* pDynamicOffsets) {
GAPID_DEBUG("vkCmdBindDescriptorSets(%zu, %u, %" PRIu64 ", %" PRIu32 ", %" PRIu32 ", %p, %" PRIu32 ", %p)", commandBuffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets);
if (State.mCommandBuffers.find(commandBuffer) == State.mCommandBuffers.end() ||
mImports.mVkDeviceFunctions.find(State.mCommandBuffers[commandBuffer]->mDevice) == mImports.mVkDeviceFunctions.end() ||
mImports.mVkDeviceFunctions[State.mCommandBuffers[commandBuffer]->mDevice].vkCmdBindDescriptorSets == nullptr) {
GAPID_WARNING("Application called unsupported function vkCmdBindDescriptorSets");
return;
}
bool called = false;
auto call = [this, observer, &called, commandBuffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets] {
called = true;
observer->observeReads();
mImports.mVkDeviceFunctions[State.mCommandBuffers[commandBuffer]->mDevice].vkCmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets);
onPostFence(observer);
};
uint64_t counter_at_begin = mCommandStartEndCounter++;
try {
do {
Slice<VkDescriptorSet> l_sets = slice(pDescriptorSets, (uint64_t)(0UL), (uint64_t)(descriptorSetCount));
observer->read(slice(pDynamicOffsets, (uint64_t)(0UL), (uint64_t)(dynamicOffsetCount)));
CmdBindBuffer l_bindBuffer = CmdBindBuffer(U32ToBoundBuffer());
for (uint32_t l_i = 0UL; l_i < descriptorSetCount; ++l_i) {
if (this->State.mDescriptorSets.count(observer->read(l_sets, (uint64_t)(l_i))) > 0) {
std::shared_ptr<DescriptorSetObject> l_set = findOrZero(this->State.mDescriptorSets, observer->read(l_sets, (uint64_t)(l_i)));
{
int32_t l__ = 0;
for (U32ToU32ToVkDescriptorBufferInfo::iterator it = checkNotNull(l_set).mBufferInfo.begin(); it != checkNotNull(l_set).mBufferInfo.end(); ++it, ++l__) {
uint32_t l__ = it->first;
U32ToVkDescriptorBufferInfo l_buffers = it->second;
int32_t l_length = int32_t((l_bindBuffer.mBuffers.size()));
{
int32_t l_j = 0;
for (U32ToVkDescriptorBufferInfo::iterator it = l_buffers.begin(); it != l_buffers.end(); ++it, ++l_j) {
uint32_t l__ = it->first;
VkDescriptorBufferInfo l_v = it->second;
l_bindBuffer.mBuffers[(uint32_t)((l_length) + (l_j))] = BoundBuffer(l_v.mbuffer, l_v.moffset);
}
}
}
}
}
}
addCmd(observer, commandBuffer, l_bindBuffer, &VulkanSpy::subDoCmdBindBuffers);
call();
} while(false);
} catch (gapii::AbortException& e) {
if (!called) {
call(); // abort() was called before the fence.
}
handleAbort(observer, e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observer->observeWrites();
gapic::coder::vulkan::VkCmdBindDescriptorSets coder(observer->getScratch()->vector<gapic::Encodable*>(kMaxExtras), toEncoder< size_val >(commandBuffer, *observer->getScratch()), pipelineBindPoint, toEncoder< uint64_t >(layout, *observer->getScratch()), firstSet, descriptorSetCount, toEncoder< gapic::coder::vulkan::VkDescriptorSet__CP >(pDescriptorSets, *observer->getScratch()), dynamicOffsetCount, toEncoder< gapic::coder::vulkan::U32__CP >(pDynamicOffsets, *observer->getScratch()));
coder.mextras.append(observer->getExtras());
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
mEncoder->Variant(&coder);
}
void VulkanSpy::vkCmdDrawIndexed(CallObserver* observer, VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance) {
GAPID_DEBUG("vkCmdDrawIndexed(%zu, %" PRIu32 ", %" PRIu32 ", %" PRIu32 ", %" PRId32 ", %" PRIu32 ")", commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance);
if (State.mCommandBuffers.find(commandBuffer) == State.mCommandBuffers.end() ||
mImports.mVkDeviceFunctions.find(State.mCommandBuffers[commandBuffer]->mDevice) == mImports.mVkDeviceFunctions.end() ||
mImports.mVkDeviceFunctions[State.mCommandBuffers[commandBuffer]->mDevice].vkCmdDrawIndexed == nullptr) {
GAPID_WARNING("Application called unsupported function vkCmdDrawIndexed");
return;
}
bool called = false;
auto call = [this, observer, &called, commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance] {
called = true;
observer->observeReads();
mImports.mVkDeviceFunctions[State.mCommandBuffers[commandBuffer]->mDevice].vkCmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance);
onPostFence(observer);
};
uint64_t counter_at_begin = mCommandStartEndCounter++;
try {
do {
call();
} while(false);
} catch (gapii::AbortException& e) {
if (!called) {
call(); // abort() was called before the fence.
}
handleAbort(observer, e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observer->observeWrites();
gapic::coder::vulkan::VkCmdDrawIndexed coder(observer->getScratch()->vector<gapic::Encodable*>(kMaxExtras), toEncoder< size_val >(commandBuffer, *observer->getScratch()), indexCount, instanceCount, firstIndex, vertexOffset, firstInstance);
coder.mextras.append(observer->getExtras());
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
mEncoder->Variant(&coder);
}
void VulkanSpy::vkCmdUpdateBuffer(CallObserver* observer, VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, uint32_t* pData) {
GAPID_DEBUG("vkCmdUpdateBuffer(%zu, %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %p)", commandBuffer, dstBuffer, dstOffset, dataSize, pData);
if (State.mCommandBuffers.find(commandBuffer) == State.mCommandBuffers.end() ||
mImports.mVkDeviceFunctions.find(State.mCommandBuffers[commandBuffer]->mDevice) == mImports.mVkDeviceFunctions.end() ||
mImports.mVkDeviceFunctions[State.mCommandBuffers[commandBuffer]->mDevice].vkCmdUpdateBuffer == nullptr) {
GAPID_WARNING("Application called unsupported function vkCmdUpdateBuffer");
return;
}
bool called = false;
auto call = [this, observer, &called, commandBuffer, dstBuffer, dstOffset, dataSize, pData] {
called = true;
observer->observeReads();
mImports.mVkDeviceFunctions[State.mCommandBuffers[commandBuffer]->mDevice].vkCmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData);
onPostFence(observer);
};
uint64_t counter_at_begin = mCommandStartEndCounter++;
try {
do {
call();
} while(false);
} catch (gapii::AbortException& e) {
if (!called) {
call(); // abort() was called before the fence.
}
handleAbort(observer, e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observer->observeWrites();
gapic::coder::vulkan::VkCmdUpdateBuffer coder(observer->getScratch()->vector<gapic::Encodable*>(kMaxExtras), toEncoder< size_val >(commandBuffer, *observer->getScratch()), toEncoder< uint64_t >(dstBuffer, *observer->getScratch()), toEncoder< uint64_t >(dstOffset, *observer->getScratch()), toEncoder< uint64_t >(dataSize, *observer->getScratch()), toEncoder< gapic::coder::vulkan::U32__CP >(pData, *observer->getScratch()));
coder.mextras.append(observer->getExtras());
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
mEncoder->Variant(&coder);
}
void VulkanSpy::vkCmdFillBuffer(CallObserver* observer, VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data) {
GAPID_DEBUG("vkCmdFillBuffer(%zu, %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu32 ")", commandBuffer, dstBuffer, dstOffset, size, data);
if (State.mCommandBuffers.find(commandBuffer) == State.mCommandBuffers.end() ||
mImports.mVkDeviceFunctions.find(State.mCommandBuffers[commandBuffer]->mDevice) == mImports.mVkDeviceFunctions.end() ||
mImports.mVkDeviceFunctions[State.mCommandBuffers[commandBuffer]->mDevice].vkCmdFillBuffer == nullptr) {
GAPID_WARNING("Application called unsupported function vkCmdFillBuffer");
return;
}
bool called = false;
auto call = [this, observer, &called, commandBuffer, dstBuffer, dstOffset, size, data] {
called = true;
observer->observeReads();
mImports.mVkDeviceFunctions[State.mCommandBuffers[commandBuffer]->mDevice].vkCmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data);
onPostFence(observer);
};
uint64_t counter_at_begin = mCommandStartEndCounter++;
try {
do {
call();
} while(false);
} catch (gapii::AbortException& e) {
if (!called) {
call(); // abort() was called before the fence.
}
handleAbort(observer, e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observer->observeWrites();
gapic::coder::vulkan::VkCmdFillBuffer coder(observer->getScratch()->vector<gapic::Encodable*>(kMaxExtras), toEncoder< size_val >(commandBuffer, *observer->getScratch()), toEncoder< uint64_t >(dstBuffer, *observer->getScratch()), toEncoder< uint64_t >(dstOffset, *observer->getScratch()), toEncoder< uint64_t >(size, *observer->getScratch()), data);
coder.mextras.append(observer->getExtras());
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
mEncoder->Variant(&coder);
}
uint32_t VulkanSpy::vkGetPhysicalDeviceSurfaceCapabilitiesKHR(CallObserver* observer, VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR* pSurfaceCapabilities) {
GAPID_DEBUG("vkGetPhysicalDeviceSurfaceCapabilitiesKHR(%zu, %" PRIu64 ", %p)", physicalDevice, surface, pSurfaceCapabilities);
if (State.mPhysicalDevices.find(physicalDevice) == State.mPhysicalDevices.end() ||
mImports.mVkInstanceFunctions.find(State.mPhysicalDevices[physicalDevice]->mInstance) == mImports.mVkInstanceFunctions.end() ||
mImports.mVkInstanceFunctions[State.mPhysicalDevices[physicalDevice]->mInstance].vkGetPhysicalDeviceSurfaceCapabilitiesKHR == nullptr) {
GAPID_WARNING("Application called unsupported function vkGetPhysicalDeviceSurfaceCapabilitiesKHR");
return 0;
}
uint32_t result = 0;
bool called = false;
auto call = [this, observer, &called, &result, physicalDevice, surface, pSurfaceCapabilities] {
called = true;
observer->observeReads();
result = mImports.mVkInstanceFunctions[State.mPhysicalDevices[physicalDevice]->mInstance].vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, surface, pSurfaceCapabilities);
onPostFence(observer);
};
uint64_t counter_at_begin = mCommandStartEndCounter++;
try {
do {
call();
observer->write<VkSurfaceCapabilitiesKHR>(slice(pSurfaceCapabilities, 0ULL, 1ULL), 0ULL, slice(pSurfaceCapabilities, 0ULL, 1ULL)[0ULL]);
break;
} while(false);
} catch (gapii::AbortException& e) {
if (!called) {
call(); // abort() was called before the fence.
}
handleAbort(observer, e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observer->observeWrites();
gapic::coder::vulkan::VkGetPhysicalDeviceSurfaceCapabilitiesKHR coder(observer->getScratch()->vector<gapic::Encodable*>(kMaxExtras), toEncoder< size_val >(physicalDevice, *observer->getScratch()), toEncoder< uint64_t >(surface, *observer->getScratch()), toEncoder< gapic::coder::vulkan::VkSurfaceCapabilitiesKHR__P >(pSurfaceCapabilities, *observer->getScratch()), result);
coder.mextras.append(observer->getExtras());
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
mEncoder->Variant(&coder);
return result;
}
uint32_t VulkanSpy::vkCreateSwapchainKHR(CallObserver* observer, VkDevice device, VkSwapchainCreateInfoKHR* pCreateInfo, VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchain) {
GAPID_DEBUG("vkCreateSwapchainKHR(%zu, %p, %p, %p)", device, pCreateInfo, pAllocator, pSwapchain);
if (mImports.mVkDeviceFunctions.find(device) == mImports.mVkDeviceFunctions.end() ||
mImports.mVkDeviceFunctions[device].vkCreateSwapchainKHR == nullptr) {
GAPID_WARNING("Application called unsupported function vkCreateSwapchainKHR");
return 0;
}
uint32_t result = 0;
bool called = false;
auto call = [this, observer, &called, &result, device, pCreateInfo, pAllocator, pSwapchain] {
called = true;
observer->observeReads();
result = mImports.mVkDeviceFunctions[device].vkCreateSwapchainKHR(device, pCreateInfo, pAllocator, pSwapchain);
onPostFence(observer);
};
uint64_t counter_at_begin = mCommandStartEndCounter++;
try {
do {
std::shared_ptr<SwapchainObject> l_swapchain = subCreateSwapchainObject(observer, call, pCreateInfo);
checkNotNull(l_swapchain).mDevice = device;
call();
auto l_handle = slice(pSwapchain, 0ULL, 1ULL)[0ULL];
observer->write<VkSwapchainKHR>(slice(pSwapchain, 0ULL, 1ULL), 0ULL, l_handle);
this->State.mSwapchains[l_handle] = l_swapchain;
break;
} while(false);
} catch (gapii::AbortException& e) {
if (!called) {
call(); // abort() was called before the fence.
}
handleAbort(observer, e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observer->observeWrites();
gapic::coder::vulkan::VkCreateSwapchainKHR coder(observer->getScratch()->vector<gapic::Encodable*>(kMaxExtras), toEncoder< size_val >(device, *observer->getScratch()), toEncoder< gapic::coder::vulkan::VkSwapchainCreateInfoKHR__CP >(pCreateInfo, *observer->getScratch()), toEncoder< gapic::coder::vulkan::VkAllocationCallbacks__CP >(pAllocator, *observer->getScratch()), toEncoder< gapic::coder::vulkan::VkSwapchainKHR__P >(pSwapchain, *observer->getScratch()), result);
coder.mextras.append(observer->getExtras());
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
mEncoder->Variant(&coder);
return result;
}
uint32_t VulkanSpy::vkCreateSharedSwapchainsKHR(CallObserver* observer, VkDevice device, uint32_t swapchainCount, VkSwapchainCreateInfoKHR* pCreateInfos, VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchains) {
GAPID_DEBUG("vkCreateSharedSwapchainsKHR(%zu, %" PRIu32 ", %p, %p, %p)", device, swapchainCount, pCreateInfos, pAllocator, pSwapchains);
if (mImports.mVkDeviceFunctions.find(device) == mImports.mVkDeviceFunctions.end() ||
mImports.mVkDeviceFunctions[device].vkCreateSharedSwapchainsKHR == nullptr) {
GAPID_WARNING("Application called unsupported function vkCreateSharedSwapchainsKHR");
return 0;
}
uint32_t result = 0;
bool called = false;
auto call = [this, observer, &called, &result, device, swapchainCount, pCreateInfos, pAllocator, pSwapchains] {
called = true;
observer->observeReads();
result = mImports.mVkDeviceFunctions[device].vkCreateSharedSwapchainsKHR(device, swapchainCount, pCreateInfos, pAllocator, pSwapchains);
onPostFence(observer);
};
uint64_t counter_at_begin = mCommandStartEndCounter++;
try {
do {
call();
break;
} while(false);
} catch (gapii::AbortException& e) {
if (!called) {
call(); // abort() was called before the fence.
}
handleAbort(observer, e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observer->observeWrites();
gapic::coder::vulkan::VkCreateSharedSwapchainsKHR coder(observer->getScratch()->vector<gapic::Encodable*>(kMaxExtras), toEncoder< size_val >(device, *observer->getScratch()), swapchainCount, toEncoder< gapic::coder::vulkan::VkSwapchainCreateInfoKHR__CP >(pCreateInfos, *observer->getScratch()), toEncoder< gapic::coder::vulkan::VkAllocationCallbacks__CP >(pAllocator, *observer->getScratch()), toEncoder< gapic::coder::vulkan::VkSwapchainKHR__P >(pSwapchains, *observer->getScratch()), result);
coder.mextras.append(observer->getExtras());
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
mEncoder->Variant(&coder);
return result;
}
void VulkanSpy::vkDestroyDebugReportCallbackEXT(CallObserver* observer, VkInstance instance, VkDebugReportCallbackEXT callback, VkAllocationCallbacks* pAllocator) {
GAPID_DEBUG("vkDestroyDebugReportCallbackEXT(%zu, %" PRIu64 ", %p)", instance, callback, pAllocator);
if (mImports.mVkInstanceFunctions.find(instance) == mImports.mVkInstanceFunctions.end() ||
mImports.mVkInstanceFunctions[instance].vkDestroyDebugReportCallbackEXT == nullptr) {
GAPID_WARNING("Application called unsupported function vkDestroyDebugReportCallbackEXT");
return;
}
bool called = false;
auto call = [this, observer, &called, instance, callback, pAllocator] {
called = true;
observer->observeReads();
mImports.mVkInstanceFunctions[instance].vkDestroyDebugReportCallbackEXT(instance, callback, pAllocator);
onPostFence(observer);
};
uint64_t counter_at_begin = mCommandStartEndCounter++;
try {
do {
call();
} while(false);
} catch (gapii::AbortException& e) {
if (!called) {
call(); // abort() was called before the fence.
}
handleAbort(observer, e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observer->observeWrites();
gapic::coder::vulkan::VkDestroyDebugReportCallbackEXT coder(observer->getScratch()->vector<gapic::Encodable*>(kMaxExtras), toEncoder< size_val >(instance, *observer->getScratch()), toEncoder< uint64_t >(callback, *observer->getScratch()), toEncoder< gapic::coder::vulkan::VkAllocationCallbacks__CP >(pAllocator, *observer->getScratch()));
coder.mextras.append(observer->getExtras());
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
mEncoder->Variant(&coder);
}
} // namespace gapii