Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(559)

Unified Diff: gpu/vulkan/vulkan_command_buffer.cc

Issue 1955803002: Added Validation to Vulkan CommandBuffer API's. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/vulkan/vulkan_command_buffer.cc
diff --git a/gpu/vulkan/vulkan_command_buffer.cc b/gpu/vulkan/vulkan_command_buffer.cc
index 5f345256e34b515e7b1692b59ba5dd007a21174c..c3d9979432b5bbd0aa2b83d56a788e756c35214c 100644
--- a/gpu/vulkan/vulkan_command_buffer.cc
+++ b/gpu/vulkan/vulkan_command_buffer.cc
@@ -144,37 +144,57 @@ void VulkanCommandBuffer::PostExecution() {
void VulkanCommandBuffer::ResetIfDirty() {
DCHECK(!recording_);
if (record_type_ == RECORD_TYPE_DIRTY) {
+ VkResult result = VK_SUCCESS;
piman 2016/05/12 23:20:43 nit: move declaration to initialization (l. 153)
ssami 2016/05/13 08:45:46 Done.
// Block if command buffer is still in use. This can be externally avoided
// using the asynchronous SubmissionFinished() function.
VkDevice device = device_queue_->GetVulkanDevice();
vkWaitForFences(device, 1, &submission_fence_, true, UINT64_MAX);
- vkResetCommandBuffer(command_buffer_, 0);
- record_type_ = RECORD_TYPE_EMPTY;
+ result = vkResetCommandBuffer(command_buffer_, 0);
piman 2016/05/12 23:20:43 nit: VkResult result = vkResetCommandBuffer(comman
ssami 2016/05/13 08:45:46 Done.
+ if (VK_SUCCESS != result) {
+ DLOG(ERROR) << "vkResetCommandBuffer() failed: " << result;
+ } else {
+ record_type_ = RECORD_TYPE_EMPTY;
+ }
}
}
CommandBufferRecorderBase::~CommandBufferRecorderBase() {
- vkEndCommandBuffer(handle_);
+ VkResult result = VK_SUCCESS;
+ result = vkEndCommandBuffer(handle_);
piman 2016/05/12 23:20:43 nit: VkResult result = vkEndCommandBuffer(handle_)
ssami 2016/05/13 08:45:46 Done.
+
+ if (VK_SUCCESS != result) {
+ DLOG(ERROR) << "vkEndCommandBuffer() failed: " << result;
+ }
};
ScopedMultiUseCommandBufferRecorder::ScopedMultiUseCommandBufferRecorder(
VulkanCommandBuffer& command_buffer)
: CommandBufferRecorderBase(command_buffer) {
+ VkResult result = VK_SUCCESS;
ValidateMultiUse(command_buffer);
VkCommandBufferBeginInfo begin_info = {};
begin_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
- vkBeginCommandBuffer(handle_, &begin_info);
+ result = vkBeginCommandBuffer(handle_, &begin_info);
piman 2016/05/12 23:20:43 nit: VkResult result = vkBeginCommandBuffer(handle
ssami 2016/05/13 08:45:46 Done.
+
+ if (VK_SUCCESS != result) {
+ DLOG(ERROR) << "vkBeginCommandBuffer() failed: " << result;
+ }
}
ScopedSingleUseCommandBufferRecorder::ScopedSingleUseCommandBufferRecorder(
VulkanCommandBuffer& command_buffer)
: CommandBufferRecorderBase(command_buffer) {
+ VkResult result = VK_SUCCESS;
ValidateSingleUse(command_buffer);
VkCommandBufferBeginInfo begin_info = {};
begin_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
begin_info.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
- vkBeginCommandBuffer(handle_, &begin_info);
+ result = vkBeginCommandBuffer(handle_, &begin_info);
piman 2016/05/12 23:20:43 nit: VkResult result = vkBeginCommandBuffer(handle
ssami 2016/05/13 08:45:46 Done.
+
+ if (VK_SUCCESS != result) {
+ DLOG(ERROR) << "vkBeginCommandBuffer() failed: " << result;
+ }
}
} // namespace gpu
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698