blob: 7c3f5454c70e74d61f0fbb2e803ef2e09c3b47b3 [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::vkEnumeratePhysicalDevices(VkInstance instance, uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices) {
GAPID_DEBUG("vkEnumeratePhysicalDevices(%p, %p, %p)", instance, pPhysicalDeviceCount, pPhysicalDevices);
uint32_t result = 0;
bool called = false;
auto call = [this, &called, &result, instance, pPhysicalDeviceCount, pPhysicalDevices] {
called = true;
observeReads();
result = SpyOverride_vkEnumeratePhysicalDevices(instance, pPhysicalDeviceCount, pPhysicalDevices);
};
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(e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observeWrites();
gapic::coder::vulkan::VkEnumeratePhysicalDevices coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkInstance >(instance, mScratch), toEncoder< gapic::coder::vulkan::U32__P >(pPhysicalDeviceCount, mScratch), toEncoder< gapic::coder::vulkan::VkPhysicalDevice__P >(pPhysicalDevices, mScratch), result);
coder.mextras.append(&mObservations);
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
addExtras(coder);
mEncoder->Variant(&coder);
return result;
}
void VulkanSpy::vkGetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements* pMemoryRequirements) {
GAPID_DEBUG("vkGetImageMemoryRequirements(%p, %" PRIu64 ", %p)", device, image, pMemoryRequirements);
if (mImports.mDeviceFunctions.find(device) == mImports.mDeviceFunctions.end() ||
mImports.mDeviceFunctions[device].vkGetImageMemoryRequirements == nullptr) {
GAPID_WARNING("Application called unsupported function vkGetImageMemoryRequirements");
return;
}
bool called = false;
auto call = [this, &called, device, image, pMemoryRequirements] {
called = true;
observeReads();
mImports.mDeviceFunctions[device].vkGetImageMemoryRequirements(device, image, pMemoryRequirements);
};
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(e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observeWrites();
gapic::coder::vulkan::VkGetImageMemoryRequirements coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkDevice >(device, mScratch), toEncoder< uint64_t >(image, mScratch), toEncoder< gapic::coder::vulkan::VkMemoryRequirements__P >(pMemoryRequirements, mScratch));
coder.mextras.append(&mObservations);
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
addExtras(coder);
mEncoder->Variant(&coder);
}
void VulkanSpy::vkGetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements* pSparseMemoryRequirements) {
GAPID_DEBUG("vkGetImageSparseMemoryRequirements(%p, %" PRIu64 ", %p, %p)", device, image, pSparseMemoryRequirementCount, pSparseMemoryRequirements);
if (mImports.mDeviceFunctions.find(device) == mImports.mDeviceFunctions.end() ||
mImports.mDeviceFunctions[device].vkGetImageSparseMemoryRequirements == nullptr) {
GAPID_WARNING("Application called unsupported function vkGetImageSparseMemoryRequirements");
return;
}
bool called = false;
auto call = [this, &called, device, image, pSparseMemoryRequirementCount, pSparseMemoryRequirements] {
called = true;
observeReads();
mImports.mDeviceFunctions[device].vkGetImageSparseMemoryRequirements(device, image, pSparseMemoryRequirementCount, pSparseMemoryRequirements);
};
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(e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observeWrites();
gapic::coder::vulkan::VkGetImageSparseMemoryRequirements coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkDevice >(device, mScratch), toEncoder< uint64_t >(image, mScratch), toEncoder< gapic::coder::vulkan::U32__P >(pSparseMemoryRequirementCount, mScratch), toEncoder< gapic::coder::vulkan::VkSparseImageMemoryRequirements__P >(pSparseMemoryRequirements, mScratch));
coder.mextras.append(&mObservations);
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
addExtras(coder);
mEncoder->Variant(&coder);
}
void VulkanSpy::vkGetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, uint32_t format, uint32_t type, uint32_t samples, VkImageUsageFlags usage, uint32_t tiling, uint32_t* pPropertyCount, VkSparseImageFormatProperties* pProperties) {
GAPID_DEBUG("vkGetPhysicalDeviceSparseImageFormatProperties(%p, %u, %u, %u, %" PRIu32 ", %u, %p, %p)", physicalDevice, format, type, samples, usage, tiling, pPropertyCount, pProperties);
if (mImports.mPhysicalDevicesToInstances.find(physicalDevice) == mImports.mPhysicalDevicesToInstances.end() ||
mImports.mInstanceFunctions.find(mImports.mPhysicalDevicesToInstances[physicalDevice]) == mImports.mInstanceFunctions.end() ||
mImports.mInstanceFunctions[mImports.mPhysicalDevicesToInstances[physicalDevice]].vkGetPhysicalDeviceSparseImageFormatProperties == nullptr) {
GAPID_WARNING("Application called unsupported function vkGetPhysicalDeviceSparseImageFormatProperties");
return;
}
bool called = false;
auto call = [this, &called, physicalDevice, format, type, samples, usage, tiling, pPropertyCount, pProperties] {
called = true;
observeReads();
mImports.mInstanceFunctions[mImports.mPhysicalDevicesToInstances[physicalDevice]].vkGetPhysicalDeviceSparseImageFormatProperties(physicalDevice, format, type, samples, usage, tiling, pPropertyCount, pProperties);
};
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(e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observeWrites();
gapic::coder::vulkan::VkGetPhysicalDeviceSparseImageFormatProperties coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkPhysicalDevice >(physicalDevice, mScratch), format, type, samples, toEncoder< uint32_t >(usage, mScratch), tiling, toEncoder< gapic::coder::vulkan::U32__P >(pPropertyCount, mScratch), toEncoder< gapic::coder::vulkan::VkSparseImageFormatProperties__P >(pProperties, mScratch));
coder.mextras.append(&mObservations);
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
addExtras(coder);
mEncoder->Variant(&coder);
}
uint32_t VulkanSpy::vkWaitForFences(VkDevice device, uint32_t fenceCount, VkFence* pFences, VkBool32 waitAll, uint64_t timeout) {
GAPID_DEBUG("vkWaitForFences(%p, %" PRIu32 ", %p, %" PRIu32 ", %" PRIu64 ")", device, fenceCount, pFences, waitAll, timeout);
if (mImports.mDeviceFunctions.find(device) == mImports.mDeviceFunctions.end() ||
mImports.mDeviceFunctions[device].vkWaitForFences == nullptr) {
GAPID_WARNING("Application called unsupported function vkWaitForFences");
return 0;
}
uint32_t result = 0;
bool called = false;
auto call = [this, &called, &result, device, fenceCount, pFences, waitAll, timeout] {
called = true;
observeReads();
result = mImports.mDeviceFunctions[device].vkWaitForFences(device, fenceCount, pFences, waitAll, timeout);
};
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(e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observeWrites();
gapic::coder::vulkan::VkWaitForFences coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkDevice >(device, mScratch), fenceCount, toEncoder< gapic::coder::vulkan::VkFence__CP >(pFences, mScratch), toEncoder< uint32_t >(waitAll, mScratch), timeout, result);
coder.mextras.append(&mObservations);
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
addExtras(coder);
mEncoder->Variant(&coder);
return result;
}
void VulkanSpy::vkDestroyImageView(VkDevice device, VkImageView imageView, VkAllocationCallbacks* pAllocator) {
GAPID_DEBUG("vkDestroyImageView(%p, %" PRIu64 ", %p)", device, imageView, pAllocator);
if (mImports.mDeviceFunctions.find(device) == mImports.mDeviceFunctions.end() ||
mImports.mDeviceFunctions[device].vkDestroyImageView == nullptr) {
GAPID_WARNING("Application called unsupported function vkDestroyImageView");
return;
}
bool called = false;
auto call = [this, &called, device, imageView, pAllocator] {
called = true;
observeReads();
mImports.mDeviceFunctions[device].vkDestroyImageView(device, imageView, pAllocator);
};
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(e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observeWrites();
gapic::coder::vulkan::VkDestroyImageView coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkDevice >(device, mScratch), toEncoder< uint64_t >(imageView, mScratch), toEncoder< gapic::coder::vulkan::VkAllocationCallbacks__CP >(pAllocator, mScratch));
coder.mextras.append(&mObservations);
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
addExtras(coder);
mEncoder->Variant(&coder);
}
void VulkanSpy::vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, VkAllocationCallbacks* pAllocator) {
GAPID_DEBUG("vkDestroyPipelineLayout(%p, %" PRIu64 ", %p)", device, pipelineLayout, pAllocator);
if (mImports.mDeviceFunctions.find(device) == mImports.mDeviceFunctions.end() ||
mImports.mDeviceFunctions[device].vkDestroyPipelineLayout == nullptr) {
GAPID_WARNING("Application called unsupported function vkDestroyPipelineLayout");
return;
}
bool called = false;
auto call = [this, &called, device, pipelineLayout, pAllocator] {
called = true;
observeReads();
mImports.mDeviceFunctions[device].vkDestroyPipelineLayout(device, pipelineLayout, pAllocator);
};
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(e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observeWrites();
gapic::coder::vulkan::VkDestroyPipelineLayout coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkDevice >(device, mScratch), toEncoder< uint64_t >(pipelineLayout, mScratch), toEncoder< gapic::coder::vulkan::VkAllocationCallbacks__CP >(pAllocator, mScratch));
coder.mextras.append(&mObservations);
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
addExtras(coder);
mEncoder->Variant(&coder);
}
uint32_t VulkanSpy::vkResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags) {
GAPID_DEBUG("vkResetCommandPool(%p, %" PRIu64 ", %" PRIu32 ")", device, commandPool, flags);
if (mImports.mDeviceFunctions.find(device) == mImports.mDeviceFunctions.end() ||
mImports.mDeviceFunctions[device].vkResetCommandPool == nullptr) {
GAPID_WARNING("Application called unsupported function vkResetCommandPool");
return 0;
}
uint32_t result = 0;
bool called = false;
auto call = [this, &called, &result, device, commandPool, flags] {
called = true;
observeReads();
result = mImports.mDeviceFunctions[device].vkResetCommandPool(device, commandPool, flags);
};
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(e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observeWrites();
gapic::coder::vulkan::VkResetCommandPool coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkDevice >(device, mScratch), toEncoder< uint64_t >(commandPool, mScratch), toEncoder< uint32_t >(flags, mScratch), result);
coder.mextras.append(&mObservations);
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
addExtras(coder);
mEncoder->Variant(&coder);
return result;
}
void VulkanSpy::vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, VkCommandBuffer* pCommandBuffers) {
GAPID_DEBUG("vkFreeCommandBuffers(%p, %" PRIu64 ", %" PRIu32 ", %p)", device, commandPool, commandBufferCount, pCommandBuffers);
if (mImports.mDeviceFunctions.find(device) == mImports.mDeviceFunctions.end() ||
mImports.mDeviceFunctions[device].vkFreeCommandBuffers == nullptr) {
GAPID_WARNING("Application called unsupported function vkFreeCommandBuffers");
return;
}
bool called = false;
auto call = [this, &called, device, commandPool, commandBufferCount, pCommandBuffers] {
called = true;
observeReads();
mImports.mDeviceFunctions[device].vkFreeCommandBuffers(device, commandPool, commandBufferCount, pCommandBuffers);
};
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(e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observeWrites();
gapic::coder::vulkan::VkFreeCommandBuffers coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkDevice >(device, mScratch), toEncoder< uint64_t >(commandPool, mScratch), commandBufferCount, toEncoder< gapic::coder::vulkan::VkCommandBuffer__CP >(pCommandBuffers, mScratch));
coder.mextras.append(&mObservations);
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
addExtras(coder);
mEncoder->Variant(&coder);
}
void VulkanSpy::vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, VkViewport* pViewports) {
GAPID_DEBUG("vkCmdSetViewport(%p, %" PRIu32 ", %" PRIu32 ", %p)", commandBuffer, firstViewport, viewportCount, pViewports);
if (mImports.mCommandBuffersToDevices.find(commandBuffer) == mImports.mCommandBuffersToDevices.end() ||
mImports.mDeviceFunctions.find(mImports.mCommandBuffersToDevices[commandBuffer]) == mImports.mDeviceFunctions.end() ||
mImports.mDeviceFunctions[mImports.mCommandBuffersToDevices[commandBuffer]].vkCmdSetViewport == nullptr) {
GAPID_WARNING("Application called unsupported function vkCmdSetViewport");
return;
}
bool called = false;
auto call = [this, &called, commandBuffer, firstViewport, viewportCount, pViewports] {
called = true;
observeReads();
mImports.mDeviceFunctions[mImports.mCommandBuffersToDevices[commandBuffer]].vkCmdSetViewport(commandBuffer, firstViewport, viewportCount, pViewports);
};
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(e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observeWrites();
gapic::coder::vulkan::VkCmdSetViewport coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkCommandBuffer >(commandBuffer, mScratch), firstViewport, viewportCount, toEncoder< gapic::coder::vulkan::VkViewport__CP >(pViewports, mScratch));
coder.mextras.append(&mObservations);
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
addExtras(coder);
mEncoder->Variant(&coder);
}
void VulkanSpy::vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, VkRect2D* pScissors) {
GAPID_DEBUG("vkCmdSetScissor(%p, %" PRIu32 ", %" PRIu32 ", %p)", commandBuffer, firstScissor, scissorCount, pScissors);
if (mImports.mCommandBuffersToDevices.find(commandBuffer) == mImports.mCommandBuffersToDevices.end() ||
mImports.mDeviceFunctions.find(mImports.mCommandBuffersToDevices[commandBuffer]) == mImports.mDeviceFunctions.end() ||
mImports.mDeviceFunctions[mImports.mCommandBuffersToDevices[commandBuffer]].vkCmdSetScissor == nullptr) {
GAPID_WARNING("Application called unsupported function vkCmdSetScissor");
return;
}
bool called = false;
auto call = [this, &called, commandBuffer, firstScissor, scissorCount, pScissors] {
called = true;
observeReads();
mImports.mDeviceFunctions[mImports.mCommandBuffersToDevices[commandBuffer]].vkCmdSetScissor(commandBuffer, firstScissor, scissorCount, pScissors);
};
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(e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observeWrites();
gapic::coder::vulkan::VkCmdSetScissor coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkCommandBuffer >(commandBuffer, mScratch), firstScissor, scissorCount, toEncoder< gapic::coder::vulkan::VkRect2D__CP >(pScissors, mScratch));
coder.mextras.append(&mObservations);
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
addExtras(coder);
mEncoder->Variant(&coder);
}
void VulkanSpy::vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) {
GAPID_DEBUG("vkCmdDraw(%p, %" PRIu32 ", %" PRIu32 ", %" PRIu32 ", %" PRIu32 ")", commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance);
if (mImports.mCommandBuffersToDevices.find(commandBuffer) == mImports.mCommandBuffersToDevices.end() ||
mImports.mDeviceFunctions.find(mImports.mCommandBuffersToDevices[commandBuffer]) == mImports.mDeviceFunctions.end() ||
mImports.mDeviceFunctions[mImports.mCommandBuffersToDevices[commandBuffer]].vkCmdDraw == nullptr) {
GAPID_WARNING("Application called unsupported function vkCmdDraw");
return;
}
bool called = false;
auto call = [this, &called, commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance] {
called = true;
observeReads();
mImports.mDeviceFunctions[mImports.mCommandBuffersToDevices[commandBuffer]].vkCmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance);
};
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(e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observeWrites();
gapic::coder::vulkan::VkCmdDraw coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkCommandBuffer >(commandBuffer, mScratch), vertexCount, instanceCount, firstVertex, firstInstance);
coder.mextras.append(&mObservations);
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
addExtras(coder);
mEncoder->Variant(&coder);
}
void VulkanSpy::vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y, uint32_t z) {
GAPID_DEBUG("vkCmdDispatch(%p, %" PRIu32 ", %" PRIu32 ", %" PRIu32 ")", commandBuffer, x, y, z);
if (mImports.mCommandBuffersToDevices.find(commandBuffer) == mImports.mCommandBuffersToDevices.end() ||
mImports.mDeviceFunctions.find(mImports.mCommandBuffersToDevices[commandBuffer]) == mImports.mDeviceFunctions.end() ||
mImports.mDeviceFunctions[mImports.mCommandBuffersToDevices[commandBuffer]].vkCmdDispatch == nullptr) {
GAPID_WARNING("Application called unsupported function vkCmdDispatch");
return;
}
bool called = false;
auto call = [this, &called, commandBuffer, x, y, z] {
called = true;
observeReads();
mImports.mDeviceFunctions[mImports.mCommandBuffersToDevices[commandBuffer]].vkCmdDispatch(commandBuffer, x, y, z);
};
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(e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observeWrites();
gapic::coder::vulkan::VkCmdDispatch coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkCommandBuffer >(commandBuffer, mScratch), x, y, z);
coder.mextras.append(&mObservations);
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
addExtras(coder);
mEncoder->Variant(&coder);
}
void VulkanSpy::vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, uint32_t srcImageLayout, VkImage dstImage, uint32_t dstImageLayout, uint32_t regionCount, VkImageCopy* pRegions) {
GAPID_DEBUG("vkCmdCopyImage(%p, %" PRIu64 ", %u, %" PRIu64 ", %u, %" PRIu32 ", %p)", commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
if (mImports.mCommandBuffersToDevices.find(commandBuffer) == mImports.mCommandBuffersToDevices.end() ||
mImports.mDeviceFunctions.find(mImports.mCommandBuffersToDevices[commandBuffer]) == mImports.mDeviceFunctions.end() ||
mImports.mDeviceFunctions[mImports.mCommandBuffersToDevices[commandBuffer]].vkCmdCopyImage == nullptr) {
GAPID_WARNING("Application called unsupported function vkCmdCopyImage");
return;
}
bool called = false;
auto call = [this, &called, commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions] {
called = true;
observeReads();
mImports.mDeviceFunctions[mImports.mCommandBuffersToDevices[commandBuffer]].vkCmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
};
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(e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observeWrites();
gapic::coder::vulkan::VkCmdCopyImage coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkCommandBuffer >(commandBuffer, mScratch), toEncoder< uint64_t >(srcImage, mScratch), srcImageLayout, toEncoder< uint64_t >(dstImage, mScratch), dstImageLayout, regionCount, toEncoder< gapic::coder::vulkan::VkImageCopy__CP >(pRegions, mScratch));
coder.mextras.append(&mObservations);
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
addExtras(coder);
mEncoder->Variant(&coder);
}
uint32_t VulkanSpy::vkCreateDisplayPlaneSurfaceKHR(VkInstance instance, VkDisplaySurfaceCreateInfoKHR* pCreateInfo, VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface) {
GAPID_DEBUG("vkCreateDisplayPlaneSurfaceKHR(%p, %p, %p, %p)", instance, pCreateInfo, pAllocator, pSurface);
if (mImports.mInstanceFunctions.find(instance) == mImports.mInstanceFunctions.end() ||
mImports.mInstanceFunctions[instance].vkCreateDisplayPlaneSurfaceKHR == nullptr) {
GAPID_WARNING("Application called unsupported function vkCreateDisplayPlaneSurfaceKHR");
return 0;
}
uint32_t result = 0;
bool called = false;
auto call = [this, &called, &result, instance, pCreateInfo, pAllocator, pSurface] {
called = true;
observeReads();
result = mImports.mInstanceFunctions[instance].vkCreateDisplayPlaneSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface);
};
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(e);
}
uint64_t counter_at_end = mCommandStartEndCounter++;
gapic::coder::atom::CommandCounter counter_value_encodable(counter_at_begin, counter_at_end);
observeWrites();
gapic::coder::vulkan::VkCreateDisplayPlaneSurfaceKHR coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkInstance >(instance, mScratch), toEncoder< gapic::coder::vulkan::VkDisplaySurfaceCreateInfoKHR__CP >(pCreateInfo, mScratch), toEncoder< gapic::coder::vulkan::VkAllocationCallbacks__CP >(pAllocator, mScratch), toEncoder< gapic::coder::vulkan::VkSurfaceKHR__P >(pSurface, mScratch), result);
coder.mextras.append(&mObservations);
if (counter_at_end > counter_at_begin + 1 ||
counter_at_begin != mExpectedNextCommandStartCounterValue) {
coder.mextras.append(&counter_value_encodable);
}
mExpectedNextCommandStartCounterValue = counter_at_end + 1;
addExtras(coder);
mEncoder->Variant(&coder);
return result;
}
} // namespace gapii