Skip to content
Snippets Groups Projects
Commit 29c99d9a authored by Lingfeng Yang's avatar Lingfeng Yang
Browse files

[vulkan] Express validation in terms of VkEventHandler

bug: 111137294

Also takes codegen changes for VkEncoder to call VkEventHandler
for validation.

Change-Id: Iafb78e2cf51ec1932491095c6d8853cd31a3a2b9
parent b1d90108
Branches
No related tags found
No related merge requests found
......@@ -35,7 +35,9 @@ static bool is_range_good(const VkMappedMemoryRange& range) {
return offset + size <= mem->mappedSize;
}
VkResult validate_vkFlushMappedMemoryRanges(
VkResult Validation::on_vkFlushMappedMemoryRanges(
void*,
VkResult,
VkDevice,
uint32_t memoryRangeCount,
const VkMappedMemoryRange* pMemoryRanges) {
......@@ -49,7 +51,9 @@ VkResult validate_vkFlushMappedMemoryRanges(
return VK_SUCCESS;
}
VkResult validate_vkInvalidateMappedMemoryRanges(
VkResult Validation::on_vkInvalidateMappedMemoryRanges(
void*,
VkResult,
VkDevice,
uint32_t memoryRangeCount,
const VkMappedMemoryRange* pMemoryRanges) {
......
......@@ -15,16 +15,24 @@
#include <vulkan/vulkan.h>
#include "VkEventHandler.h"
namespace goldfish_vk {
VkResult validate_vkFlushMappedMemoryRanges(
class Validation : public VkEventHandler {
public:
VkResult on_vkFlushMappedMemoryRanges(
void* context,
VkResult input_result,
VkDevice device,
uint32_t memoryRangeCount,
const VkMappedMemoryRange* pMemoryRanges);
VkResult validate_vkInvalidateMappedMemoryRanges(
const VkMappedMemoryRange* pMemoryRanges) override;
VkResult on_vkInvalidateMappedMemoryRanges(
void* context,
VkResult input_result,
VkDevice device,
uint32_t memoryRangeCount,
const VkMappedMemoryRange* pMemoryRanges);
const VkMappedMemoryRange* pMemoryRanges) override;
};
} // namespace goldfish_vk
\ No newline at end of file
......@@ -57,10 +57,13 @@ public:
VulkanStream* stream() { return &m_stream; }
Pool* pool() { return &m_pool; }
ResourceTracker* resources() { return ResourceTracker::get(); }
Validation* validation() { return &m_validation; }
private:
VulkanCountingStream m_countingStream;
VulkanStream m_stream;
Pool m_pool { 8, 4096, 64 };
Validation m_validation;
};
 
VkEncoder::VkEncoder(IOStream *stream) :
......@@ -1410,7 +1413,7 @@ VkResult VkEncoder::vkFlushMappedMemoryRanges(
uint32_t memoryRangeCount,
const VkMappedMemoryRange* pMemoryRanges)
{
VALIDATE_RET(VkResult, VK_SUCCESS, validate_vkFlushMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges));
VALIDATE_RET(VkResult, VK_SUCCESS, mImpl->validation()->on_vkFlushMappedMemoryRanges(this, VK_SUCCESS, device, memoryRangeCount, pMemoryRanges));
auto stream = mImpl->stream();
auto countingStream = mImpl->countingStream();
auto resources = mImpl->resources();
......@@ -1501,7 +1504,7 @@ VkResult VkEncoder::vkInvalidateMappedMemoryRanges(
uint32_t memoryRangeCount,
const VkMappedMemoryRange* pMemoryRanges)
{
VALIDATE_RET(VkResult, VK_SUCCESS, validate_vkInvalidateMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges));
VALIDATE_RET(VkResult, VK_SUCCESS, mImpl->validation()->on_vkInvalidateMappedMemoryRanges(this, VK_SUCCESS, device, memoryRangeCount, pMemoryRanges));
auto stream = mImpl->stream();
auto countingStream = mImpl->countingStream();
auto resources = mImpl->resources();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment