Permalink
Browse files

Vulkan: Assert on some creates failing.

Before was only checking in debug builds.
  • Loading branch information...
unknownbrackets committed Jun 24, 2018
1 parent 5028486 commit 81f74e4287c3e7e05f2c549509207e28ce0028e2
@@ -578,7 +578,7 @@ void GLRenderManager::WaitUntilQueueIdle() {
GLPushBuffer::GLPushBuffer(GLRenderManager *render, GLuint target, size_t size) : render_(render), target_(target), size_(size) {
bool res = AddBuffer();
assert(res);
_assert_(res);
}
GLPushBuffer::~GLPushBuffer() {
@@ -720,7 +720,7 @@ void GLPushBuffer::Defragment() {
size_ = newSize;
bool res = AddBuffer();
assert(res);
_assert_(res);
}
size_t GLPushBuffer::GetTotalSize() const {
@@ -55,7 +55,7 @@ void VulkanQueueRunner::ResizeReadbackBuffer(VkDeviceSize requiredSize) {
VkFlags typeReqs = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
bool success = vulkan_->MemoryTypeFromProperties(reqs.memoryTypeBits, typeReqs, &alloc.memoryTypeIndex);
assert(success);
_assert_(success);
vkAllocateMemory(device, &alloc, nullptr, &readbackMemory_);
uint32_t offset = 0;
@@ -149,7 +149,7 @@ void VulkanQueueRunner::InitBackbufferRenderPass() {
rp_info.pDependencies = &dep;
VkResult res = vkCreateRenderPass(vulkan_->GetDevice(), &rp_info, nullptr, &backbufferRenderPass_);
assert(res == VK_SUCCESS);
_assert_(res == VK_SUCCESS);
}
VkRenderPass VulkanQueueRunner::GetRenderPass(const RPKey &key) {
@@ -317,6 +317,9 @@ VkRenderPass VulkanQueueRunner::GetRenderPass(const RPKey &key) {
case VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL:
// Nothing to do.
break;
default:
_dbg_assert_msg_(G3D, false, "GetRenderPass: Unexpected final color layout %d", (int)key.finalColorLayout);
break;
}
if (deps[numDeps].dstAccessMask) {
@@ -462,6 +465,8 @@ void VulkanQueueRunner::ApplyMGSHack(std::vector<VKRStep *> &steps) {
if (steps[j]->copy.dst != steps[i]->copy.dst)
last = j - 1;
break;
default:
break;
}
if (last != -1)
break;
@@ -534,6 +539,9 @@ void VulkanQueueRunner::ApplySonicHack(std::vector<VKRStep *> &steps) {
if (steps[j]->render.numDraws != 3 && steps[j]->render.numDraws != 6)
last = j - 1;
}
break;
default:
break;
}
if (last != -1)
break;
@@ -643,6 +651,9 @@ void VulkanQueueRunner::LogRenderPass(const VKRStep &pass) {
case VKRRenderCommand::PUSH_CONSTANTS:
ILOG(" PushConstants(%d)", cmd.push.size);
break;
case VKRRenderCommand::NUM_RENDER_COMMANDS:
break;
}
}
ILOG("RenderPass End(%x)", fb);
@@ -690,7 +701,7 @@ void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer c
srcStage = VK_PIPELINE_STAGE_TRANSFER_BIT;
break;
default:
Crash();
_assert_msg_(G3D, false, "PerformRenderPass: Unexpected oldLayout: %d", (int)barrier.oldLayout);
break;
}
barrier.newLayout = iter.targetLayout;
@@ -700,7 +711,7 @@ void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer c
dstStage = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT;
break;
default:
Crash();
_assert_msg_(G3D, false, "PerformRenderPass: Unexpected newLayout: %d", (int)barrier.newLayout);
break;
}
barrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
@@ -384,7 +384,7 @@ VkCommandBuffer VulkanRenderManager::GetInitCmd() {
VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT
};
VkResult res = vkBeginCommandBuffer(frameData.initCmd, &begin);
assert(res == VK_SUCCESS);
_assert_(res == VK_SUCCESS);
frameData.hasInitCommands = true;
}
return frameData_[curFrame].initCmd;
@@ -1008,7 +1008,7 @@ void VulkanRenderManager::EndSyncFrame(int frame) {
VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT
};
VkResult res = vkBeginCommandBuffer(frameData.mainCmd, &begin);
assert(res == VK_SUCCESS);
_assert_(res == VK_SUCCESS);
if (useThread_) {
std::unique_lock<std::mutex> lock(frameData.push_mutex);
@@ -661,7 +661,7 @@ class VKSamplerState : public SamplerState {
s.mipmapMode = desc.mipFilter == TextureFilter::LINEAR ? VK_SAMPLER_MIPMAP_MODE_LINEAR : VK_SAMPLER_MIPMAP_MODE_NEAREST;
s.maxLod = desc.maxLod;
VkResult res = vkCreateSampler(vulkan_->GetDevice(), &s, nullptr, &sampler_);
assert(VK_SUCCESS == res);
_assert_(VK_SUCCESS == res);
}
~VKSamplerState() {
vulkan_->Delete().QueueDeleteSampler(sampler_);
@@ -788,7 +788,7 @@ VKContext::VKContext(VulkanContext *vulkan, bool splitSubmit)
for (int i = 0; i < VulkanContext::MAX_INFLIGHT_FRAMES; i++) {
frame_[i].pushBuffer = new VulkanPushBuffer(vulkan_, 1024 * 1024);
VkResult res = vkCreateDescriptorPool(device_, &dp, nullptr, &frame_[i].descriptorPool);
assert(res == VK_SUCCESS);
_assert_(res == VK_SUCCESS);
}
// binding 0 - uniform data
@@ -862,7 +862,7 @@ void VKContext::BeginFrame() {
frame.descSets_.clear();
VkResult result = vkResetDescriptorPool(device_, frame.descriptorPool, 0);
assert(result == VK_SUCCESS);
_assert_(result == VK_SUCCESS);
}
void VKContext::WaitRenderCompletion(Framebuffer *fbo) {
@@ -903,7 +903,7 @@ VkDescriptorSet VKContext::GetOrCreateDescriptorSet(VkBuffer buf) {
alloc.pSetLayouts = &descriptorSetLayout_;
alloc.descriptorSetCount = 1;
VkResult res = vkAllocateDescriptorSets(device_, &alloc, &descSet);
assert(VK_SUCCESS == res);
_assert_(VK_SUCCESS == res);
VkDescriptorBufferInfo bufferDesc;
bufferDesc.buffer = buf;

0 comments on commit 81f74e4

Please sign in to comment.