blob: 921ac81e5e9333504cbc3ff8f11457bf7dbcc986 [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 {
PFN_vkVoidFunction VulkanSpy::vkGetDeviceProcAddr(VkDevice device, const char* pName) {
GAPID_DEBUG("vkGetDeviceProcAddr(%p, %s)", device, pName);
PFN_vkVoidFunction result = nullptr;
bool called = false;
auto call = [this, &called, &result, device, pName] {
called = true;
observeReads();
result = SpyOverride_vkGetDeviceProcAddr(device, pName);
};
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::VkGetDeviceProcAddr coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkDevice >(device, mScratch), toEncoder< const char* >(pName, mScratch), toEncoder< gapic::coder::vulkan::PFN_vkVoidFunction >(result, 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);
return result;
}
void VulkanSpy::vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue* pQueue) {
GAPID_DEBUG("vkGetDeviceQueue(%p, %" PRIu32 ", %" PRIu32 ", %p)", device, queueFamilyIndex, queueIndex, pQueue);
bool called = false;
auto call = [this, &called, device, queueFamilyIndex, queueIndex, pQueue] {
called = true;
observeReads();
SpyOverride_vkGetDeviceQueue(device, queueFamilyIndex, queueIndex, pQueue);
};
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::VkGetDeviceQueue coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkDevice >(device, mScratch), queueFamilyIndex, queueIndex, toEncoder< gapic::coder::vulkan::VkQueue__P >(pQueue, 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::vkFreeMemory(VkDevice device, VkDeviceMemory memory, VkAllocationCallbacks* pAllocator) {
GAPID_DEBUG("vkFreeMemory(%p, %" PRIu64 ", %p)", device, memory, pAllocator);
if (mImports.mDeviceFunctions.find(device) == mImports.mDeviceFunctions.end() ||
mImports.mDeviceFunctions[device].vkFreeMemory == nullptr) {
GAPID_WARNING("Application called unsupported function vkFreeMemory");
return;
}
bool called = false;
auto call = [this, &called, device, memory, pAllocator] {
called = true;
observeReads();
mImports.mDeviceFunctions[device].vkFreeMemory(device, memory, 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::VkFreeMemory coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkDevice >(device, mScratch), toEncoder< uint64_t >(memory, 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::vkMapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void** ppData) {
GAPID_DEBUG("vkMapMemory(%p, %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu32 ", %p)", device, memory, offset, size, flags, ppData);
if (mImports.mDeviceFunctions.find(device) == mImports.mDeviceFunctions.end() ||
mImports.mDeviceFunctions[device].vkMapMemory == nullptr) {
GAPID_WARNING("Application called unsupported function vkMapMemory");
return 0;
}
uint32_t result = 0;
bool called = false;
auto call = [this, &called, &result, device, memory, offset, size, flags, ppData] {
called = true;
observeReads();
result = mImports.mDeviceFunctions[device].vkMapMemory(device, memory, offset, size, flags, ppData);
};
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::VkMapMemory coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkDevice >(device, mScratch), toEncoder< uint64_t >(memory, mScratch), toEncoder< uint64_t >(offset, mScratch), toEncoder< uint64_t >(size, mScratch), toEncoder< uint32_t >(flags, mScratch), toEncoder< gapic::coder::vulkan::Void__P__P >(ppData, 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;
}
uint32_t VulkanSpy::vkResetFences(VkDevice device, uint32_t fenceCount, VkFence* pFences) {
GAPID_DEBUG("vkResetFences(%p, %" PRIu32 ", %p)", device, fenceCount, pFences);
if (mImports.mDeviceFunctions.find(device) == mImports.mDeviceFunctions.end() ||
mImports.mDeviceFunctions[device].vkResetFences == nullptr) {
GAPID_WARNING("Application called unsupported function vkResetFences");
return 0;
}
uint32_t result = 0;
bool called = false;
auto call = [this, &called, &result, device, fenceCount, pFences] {
called = true;
observeReads();
result = mImports.mDeviceFunctions[device].vkResetFences(device, fenceCount, pFences);
};
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::VkResetFences coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkDevice >(device, mScratch), fenceCount, toEncoder< gapic::coder::vulkan::VkFence__CP >(pFences, 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;
}
uint32_t VulkanSpy::vkCreateImage(VkDevice device, VkImageCreateInfo* pCreateInfo, VkAllocationCallbacks* pAllocator, VkImage* pImage) {
GAPID_DEBUG("vkCreateImage(%p, %p, %p, %p)", device, pCreateInfo, pAllocator, pImage);
if (mImports.mDeviceFunctions.find(device) == mImports.mDeviceFunctions.end() ||
mImports.mDeviceFunctions[device].vkCreateImage == nullptr) {
GAPID_WARNING("Application called unsupported function vkCreateImage");
return 0;
}
uint32_t result = 0;
bool called = false;
auto call = [this, &called, &result, device, pCreateInfo, pAllocator, pImage] {
called = true;
observeReads();
result = mImports.mDeviceFunctions[device].vkCreateImage(device, pCreateInfo, pAllocator, pImage);
};
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::VkCreateImage coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkDevice >(device, mScratch), toEncoder< gapic::coder::vulkan::VkImageCreateInfo__CP >(pCreateInfo, mScratch), toEncoder< gapic::coder::vulkan::VkAllocationCallbacks__CP >(pAllocator, mScratch), toEncoder< gapic::coder::vulkan::VkImage__P >(pImage, 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;
}
uint32_t VulkanSpy::vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, VkPipelineCache* pSrcCaches) {
GAPID_DEBUG("vkMergePipelineCaches(%p, %" PRIu64 ", %" PRIu32 ", %p)", device, dstCache, srcCacheCount, pSrcCaches);
if (mImports.mDeviceFunctions.find(device) == mImports.mDeviceFunctions.end() ||
mImports.mDeviceFunctions[device].vkMergePipelineCaches == nullptr) {
GAPID_WARNING("Application called unsupported function vkMergePipelineCaches");
return 0;
}
uint32_t result = 0;
bool called = false;
auto call = [this, &called, &result, device, dstCache, srcCacheCount, pSrcCaches] {
called = true;
observeReads();
result = mImports.mDeviceFunctions[device].vkMergePipelineCaches(device, dstCache, srcCacheCount, pSrcCaches);
};
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::VkMergePipelineCaches coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkDevice >(device, mScratch), toEncoder< uint64_t >(dstCache, mScratch), srcCacheCount, toEncoder< gapic::coder::vulkan::VkPipelineCache__CP >(pSrcCaches, 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;
}
uint32_t VulkanSpy::vkCreateDescriptorSetLayout(VkDevice device, VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkAllocationCallbacks* pAllocator, VkDescriptorSetLayout* pSetLayout) {
GAPID_DEBUG("vkCreateDescriptorSetLayout(%p, %p, %p, %p)", device, pCreateInfo, pAllocator, pSetLayout);
if (mImports.mDeviceFunctions.find(device) == mImports.mDeviceFunctions.end() ||
mImports.mDeviceFunctions[device].vkCreateDescriptorSetLayout == nullptr) {
GAPID_WARNING("Application called unsupported function vkCreateDescriptorSetLayout");
return 0;
}
uint32_t result = 0;
bool called = false;
auto call = [this, &called, &result, device, pCreateInfo, pAllocator, pSetLayout] {
called = true;
observeReads();
result = mImports.mDeviceFunctions[device].vkCreateDescriptorSetLayout(device, pCreateInfo, pAllocator, pSetLayout);
};
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::VkCreateDescriptorSetLayout coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkDevice >(device, mScratch), toEncoder< gapic::coder::vulkan::VkDescriptorSetLayoutCreateInfo__CP >(pCreateInfo, mScratch), toEncoder< gapic::coder::vulkan::VkAllocationCallbacks__CP >(pAllocator, mScratch), toEncoder< gapic::coder::vulkan::VkDescriptorSetLayout__P >(pSetLayout, 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::vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, VkAllocationCallbacks* pAllocator) {
GAPID_DEBUG("vkDestroyFramebuffer(%p, %" PRIu64 ", %p)", device, framebuffer, pAllocator);
if (mImports.mDeviceFunctions.find(device) == mImports.mDeviceFunctions.end() ||
mImports.mDeviceFunctions[device].vkDestroyFramebuffer == nullptr) {
GAPID_WARNING("Application called unsupported function vkDestroyFramebuffer");
return;
}
bool called = false;
auto call = [this, &called, device, framebuffer, pAllocator] {
called = true;
observeReads();
mImports.mDeviceFunctions[device].vkDestroyFramebuffer(device, framebuffer, 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::VkDestroyFramebuffer coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkDevice >(device, mScratch), toEncoder< uint64_t >(framebuffer, 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::vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, VkAllocationCallbacks* pAllocator) {
GAPID_DEBUG("vkDestroyCommandPool(%p, %" PRIu64 ", %p)", device, commandPool, pAllocator);
if (mImports.mDeviceFunctions.find(device) == mImports.mDeviceFunctions.end() ||
mImports.mDeviceFunctions[device].vkDestroyCommandPool == nullptr) {
GAPID_WARNING("Application called unsupported function vkDestroyCommandPool");
return;
}
bool called = false;
auto call = [this, &called, device, commandPool, pAllocator] {
called = true;
observeReads();
mImports.mDeviceFunctions[device].vkDestroyCommandPool(device, commandPool, 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::VkDestroyCommandPool coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkDevice >(device, mScratch), toEncoder< uint64_t >(commandPool, 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::vkCmdBindPipeline(VkCommandBuffer commandBuffer, uint32_t pipelineBindPoint, VkPipeline pipeline) {
GAPID_DEBUG("vkCmdBindPipeline(%p, %u, %" PRIu64 ")", commandBuffer, pipelineBindPoint, pipeline);
if (mImports.mCommandBuffersToDevices.find(commandBuffer) == mImports.mCommandBuffersToDevices.end() ||
mImports.mDeviceFunctions.find(mImports.mCommandBuffersToDevices[commandBuffer]) == mImports.mDeviceFunctions.end() ||
mImports.mDeviceFunctions[mImports.mCommandBuffersToDevices[commandBuffer]].vkCmdBindPipeline == nullptr) {
GAPID_WARNING("Application called unsupported function vkCmdBindPipeline");
return;
}
bool called = false;
auto call = [this, &called, commandBuffer, pipelineBindPoint, pipeline] {
called = true;
observeReads();
mImports.mDeviceFunctions[mImports.mCommandBuffersToDevices[commandBuffer]].vkCmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline);
};
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::VkCmdBindPipeline coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkCommandBuffer >(commandBuffer, mScratch), pipelineBindPoint, toEncoder< uint64_t >(pipeline, 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::vkCmdSetStencilReference(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference) {
GAPID_DEBUG("vkCmdSetStencilReference(%p, %" PRIu32 ", %" PRIu32 ")", commandBuffer, faceMask, reference);
if (mImports.mCommandBuffersToDevices.find(commandBuffer) == mImports.mCommandBuffersToDevices.end() ||
mImports.mDeviceFunctions.find(mImports.mCommandBuffersToDevices[commandBuffer]) == mImports.mDeviceFunctions.end() ||
mImports.mDeviceFunctions[mImports.mCommandBuffersToDevices[commandBuffer]].vkCmdSetStencilReference == nullptr) {
GAPID_WARNING("Application called unsupported function vkCmdSetStencilReference");
return;
}
bool called = false;
auto call = [this, &called, commandBuffer, faceMask, reference] {
called = true;
observeReads();
mImports.mDeviceFunctions[mImports.mCommandBuffersToDevices[commandBuffer]].vkCmdSetStencilReference(commandBuffer, faceMask, reference);
};
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::VkCmdSetStencilReference coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkCommandBuffer >(commandBuffer, mScratch), toEncoder< uint32_t >(faceMask, mScratch), reference);
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::vkCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, VkClearAttachment* pAttachments, uint32_t rectCount, VkClearRect* pRects) {
GAPID_DEBUG("vkCmdClearAttachments(%p, %" PRIu32 ", %p, %" PRIu32 ", %p)", commandBuffer, attachmentCount, pAttachments, rectCount, pRects);
if (mImports.mCommandBuffersToDevices.find(commandBuffer) == mImports.mCommandBuffersToDevices.end() ||
mImports.mDeviceFunctions.find(mImports.mCommandBuffersToDevices[commandBuffer]) == mImports.mDeviceFunctions.end() ||
mImports.mDeviceFunctions[mImports.mCommandBuffersToDevices[commandBuffer]].vkCmdClearAttachments == nullptr) {
GAPID_WARNING("Application called unsupported function vkCmdClearAttachments");
return;
}
bool called = false;
auto call = [this, &called, commandBuffer, attachmentCount, pAttachments, rectCount, pRects] {
called = true;
observeReads();
mImports.mDeviceFunctions[mImports.mCommandBuffersToDevices[commandBuffer]].vkCmdClearAttachments(commandBuffer, attachmentCount, pAttachments, rectCount, pRects);
};
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::VkCmdClearAttachments coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkCommandBuffer >(commandBuffer, mScratch), attachmentCount, toEncoder< gapic::coder::vulkan::VkClearAttachment__CP >(pAttachments, mScratch), rectCount, toEncoder< gapic::coder::vulkan::VkClearRect__CP >(pRects, 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::vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, uint32_t srcImageLayout, VkImage dstImage, uint32_t dstImageLayout, uint32_t regionCount, VkImageResolve* pRegions) {
GAPID_DEBUG("vkCmdResolveImage(%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]].vkCmdResolveImage == nullptr) {
GAPID_WARNING("Application called unsupported function vkCmdResolveImage");
return;
}
bool called = false;
auto call = [this, &called, commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions] {
called = true;
observeReads();
mImports.mDeviceFunctions[mImports.mCommandBuffersToDevices[commandBuffer]].vkCmdResolveImage(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::VkCmdResolveImage 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::VkImageResolve__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);
}
void VulkanSpy::vkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags) {
GAPID_DEBUG("vkCmdCopyQueryPoolResults(%p, %" PRIu64 ", %" PRIu32 ", %" PRIu32 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu32 ")", commandBuffer, queryPool, firstQuery, queryCount, dstBuffer, dstOffset, stride, flags);
if (mImports.mCommandBuffersToDevices.find(commandBuffer) == mImports.mCommandBuffersToDevices.end() ||
mImports.mDeviceFunctions.find(mImports.mCommandBuffersToDevices[commandBuffer]) == mImports.mDeviceFunctions.end() ||
mImports.mDeviceFunctions[mImports.mCommandBuffersToDevices[commandBuffer]].vkCmdCopyQueryPoolResults == nullptr) {
GAPID_WARNING("Application called unsupported function vkCmdCopyQueryPoolResults");
return;
}
bool called = false;
auto call = [this, &called, commandBuffer, queryPool, firstQuery, queryCount, dstBuffer, dstOffset, stride, flags] {
called = true;
observeReads();
mImports.mDeviceFunctions[mImports.mCommandBuffersToDevices[commandBuffer]].vkCmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery, queryCount, dstBuffer, dstOffset, stride, flags);
};
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::VkCmdCopyQueryPoolResults coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkCommandBuffer >(commandBuffer, mScratch), toEncoder< uint64_t >(queryPool, mScratch), firstQuery, queryCount, toEncoder< uint64_t >(dstBuffer, mScratch), toEncoder< uint64_t >(dstOffset, mScratch), toEncoder< uint64_t >(stride, mScratch), toEncoder< uint32_t >(flags, 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::vkCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, void* pValues) {
GAPID_DEBUG("vkCmdPushConstants(%p, %" PRIu64 ", %" PRIu32 ", %" PRIu32 ", %" PRIu32 ", %p)", commandBuffer, layout, stageFlags, offset, size, pValues);
if (mImports.mCommandBuffersToDevices.find(commandBuffer) == mImports.mCommandBuffersToDevices.end() ||
mImports.mDeviceFunctions.find(mImports.mCommandBuffersToDevices[commandBuffer]) == mImports.mDeviceFunctions.end() ||
mImports.mDeviceFunctions[mImports.mCommandBuffersToDevices[commandBuffer]].vkCmdPushConstants == nullptr) {
GAPID_WARNING("Application called unsupported function vkCmdPushConstants");
return;
}
bool called = false;
auto call = [this, &called, commandBuffer, layout, stageFlags, offset, size, pValues] {
called = true;
observeReads();
mImports.mDeviceFunctions[mImports.mCommandBuffersToDevices[commandBuffer]].vkCmdPushConstants(commandBuffer, layout, stageFlags, offset, size, pValues);
};
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::VkCmdPushConstants coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkCommandBuffer >(commandBuffer, mScratch), toEncoder< uint64_t >(layout, mScratch), toEncoder< uint32_t >(stageFlags, mScratch), offset, size, toEncoder< gapic::coder::vulkan::Void__CP >(pValues, 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::vkAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t* pImageIndex) {
GAPID_DEBUG("vkAcquireNextImageKHR(%p, %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %p)", device, swapchain, timeout, semaphore, fence, pImageIndex);
if (mImports.mDeviceFunctions.find(device) == mImports.mDeviceFunctions.end() ||
mImports.mDeviceFunctions[device].vkAcquireNextImageKHR == nullptr) {
GAPID_WARNING("Application called unsupported function vkAcquireNextImageKHR");
return 0;
}
uint32_t result = 0;
bool called = false;
auto call = [this, &called, &result, device, swapchain, timeout, semaphore, fence, pImageIndex] {
called = true;
observeReads();
result = mImports.mDeviceFunctions[device].vkAcquireNextImageKHR(device, swapchain, timeout, semaphore, fence, pImageIndex);
};
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::VkAcquireNextImageKHR coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkDevice >(device, mScratch), toEncoder< uint64_t >(swapchain, mScratch), timeout, toEncoder< uint64_t >(semaphore, mScratch), toEncoder< uint64_t >(fence, mScratch), toEncoder< gapic::coder::vulkan::U32__P >(pImageIndex, 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;
}
uint32_t VulkanSpy::vkGetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode, uint32_t planeIndex, VkDisplayPlaneCapabilitiesKHR* pCapabilities) {
GAPID_DEBUG("vkGetDisplayPlaneCapabilitiesKHR(%p, %" PRIu64 ", %" PRIu32 ", %p)", physicalDevice, mode, planeIndex, pCapabilities);
if (mImports.mPhysicalDevicesToInstances.find(physicalDevice) == mImports.mPhysicalDevicesToInstances.end() ||
mImports.mInstanceFunctions.find(mImports.mPhysicalDevicesToInstances[physicalDevice]) == mImports.mInstanceFunctions.end() ||
mImports.mInstanceFunctions[mImports.mPhysicalDevicesToInstances[physicalDevice]].vkGetDisplayPlaneCapabilitiesKHR == nullptr) {
GAPID_WARNING("Application called unsupported function vkGetDisplayPlaneCapabilitiesKHR");
return 0;
}
uint32_t result = 0;
bool called = false;
auto call = [this, &called, &result, physicalDevice, mode, planeIndex, pCapabilities] {
called = true;
observeReads();
result = mImports.mInstanceFunctions[mImports.mPhysicalDevicesToInstances[physicalDevice]].vkGetDisplayPlaneCapabilitiesKHR(physicalDevice, mode, planeIndex, pCapabilities);
};
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::VkGetDisplayPlaneCapabilitiesKHR coder(mScratch.vector<gapic::Encodable*>(kMaxExtras), toEncoder< gapic::coder::vulkan::VkPhysicalDevice >(physicalDevice, mScratch), toEncoder< uint64_t >(mode, mScratch), planeIndex, toEncoder< gapic::coder::vulkan::VkDisplayPlaneCapabilitiesKHR__P >(pCapabilities, 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