Commit 06270c9e by Shahbaz Youssefi Committed by Commit Bot

Vulkan: Safer struct initialization

Using x = {}; before filling out each field, we can be sure any missing field is 0 initialized. This in turn helps us not have to specify certain fields that are generally unused (at the moment), such as pNext. Bug: angleproject:2860 Change-Id: Ia1fa2db3ecfb316673a02ac0c5e13e47e055a19f Reviewed-on: https://chromium-review.googlesource.com/c/1259764Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
parent 5476e805
...@@ -58,9 +58,8 @@ gl::Error BufferVk::setData(const gl::Context *context, ...@@ -58,9 +58,8 @@ gl::Error BufferVk::setData(const gl::Context *context,
(VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT | (VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT |
VK_BUFFER_USAGE_INDEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_SRC_BIT); VK_BUFFER_USAGE_INDEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_SRC_BIT);
VkBufferCreateInfo createInfo; VkBufferCreateInfo createInfo = {};
createInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; createInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
createInfo.pNext = nullptr;
createInfo.flags = 0; createInfo.flags = 0;
createInfo.size = size; createInfo.size = size;
createInfo.usage = usageFlags; createInfo.usage = usageFlags;
...@@ -214,9 +213,8 @@ angle::Result BufferVk::setDataImpl(ContextVk *contextVk, ...@@ -214,9 +213,8 @@ angle::Result BufferVk::setDataImpl(ContextVk *contextVk,
// Insert a barrier to ensure reads from the buffer are complete. // Insert a barrier to ensure reads from the buffer are complete.
// TODO(jmadill): Insert minimal barriers. // TODO(jmadill): Insert minimal barriers.
VkBufferMemoryBarrier bufferBarrier; VkBufferMemoryBarrier bufferBarrier = {};
bufferBarrier.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER; bufferBarrier.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER;
bufferBarrier.pNext = nullptr;
bufferBarrier.srcAccessMask = VK_ACCESS_MEMORY_READ_BIT; bufferBarrier.srcAccessMask = VK_ACCESS_MEMORY_READ_BIT;
bufferBarrier.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; bufferBarrier.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
bufferBarrier.srcQueueFamilyIndex = 0; bufferBarrier.srcQueueFamilyIndex = 0;
...@@ -234,8 +232,6 @@ angle::Result BufferVk::setDataImpl(ContextVk *contextVk, ...@@ -234,8 +232,6 @@ angle::Result BufferVk::setDataImpl(ContextVk *contextVk,
// Insert a barrier to ensure copy has done. // Insert a barrier to ensure copy has done.
// TODO(jie.a.chen@intel.com): Insert minimal barriers. // TODO(jie.a.chen@intel.com): Insert minimal barriers.
bufferBarrier.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER;
bufferBarrier.pNext = nullptr;
bufferBarrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; bufferBarrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
bufferBarrier.dstAccessMask = bufferBarrier.dstAccessMask =
VK_ACCESS_INDIRECT_COMMAND_READ_BIT | VK_ACCESS_INDEX_READ_BIT | VK_ACCESS_INDIRECT_COMMAND_READ_BIT | VK_ACCESS_INDEX_READ_BIT |
...@@ -244,12 +240,6 @@ angle::Result BufferVk::setDataImpl(ContextVk *contextVk, ...@@ -244,12 +240,6 @@ angle::Result BufferVk::setDataImpl(ContextVk *contextVk,
VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT | VK_ACCESS_TRANSFER_READ_BIT | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT | VK_ACCESS_TRANSFER_READ_BIT |
VK_ACCESS_TRANSFER_WRITE_BIT | VK_ACCESS_HOST_READ_BIT | VK_ACCESS_HOST_WRITE_BIT; VK_ACCESS_TRANSFER_WRITE_BIT | VK_ACCESS_HOST_READ_BIT | VK_ACCESS_HOST_WRITE_BIT;
bufferBarrier.srcQueueFamilyIndex = 0;
bufferBarrier.dstQueueFamilyIndex = 0;
bufferBarrier.buffer = mBuffer.getBuffer().getHandle();
bufferBarrier.offset = offset;
bufferBarrier.size = static_cast<VkDeviceSize>(size);
commandBuffer->pipelineBarrier(VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, commandBuffer->pipelineBarrier(VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 0, 0, nullptr, 1, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 0, 0, nullptr, 1,
&bufferBarrier, 0, nullptr); &bufferBarrier, 0, nullptr);
......
...@@ -30,18 +30,16 @@ angle::Result InitAndBeginCommandBuffer(vk::Context *context, ...@@ -30,18 +30,16 @@ angle::Result InitAndBeginCommandBuffer(vk::Context *context,
{ {
ASSERT(!commandBuffer->valid()); ASSERT(!commandBuffer->valid());
VkCommandBufferAllocateInfo createInfo; VkCommandBufferAllocateInfo createInfo = {};
createInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO; createInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
createInfo.pNext = nullptr;
createInfo.commandPool = commandPool.getHandle(); createInfo.commandPool = commandPool.getHandle();
createInfo.level = VK_COMMAND_BUFFER_LEVEL_SECONDARY; createInfo.level = VK_COMMAND_BUFFER_LEVEL_SECONDARY;
createInfo.commandBufferCount = 1; createInfo.commandBufferCount = 1;
ANGLE_TRY(commandBuffer->init(context, createInfo)); ANGLE_TRY(commandBuffer->init(context, createInfo));
VkCommandBufferBeginInfo beginInfo; VkCommandBufferBeginInfo beginInfo = {};
beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
beginInfo.pNext = nullptr;
beginInfo.flags = flags | VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT; beginInfo.flags = flags | VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
beginInfo.pInheritanceInfo = &inheritanceInfo; beginInfo.pInheritanceInfo = &inheritanceInfo;
...@@ -235,9 +233,8 @@ angle::Result CommandGraphNode::beginOutsideRenderPassRecording(Context *context ...@@ -235,9 +233,8 @@ angle::Result CommandGraphNode::beginOutsideRenderPassRecording(Context *context
{ {
ASSERT(!mHasChildren); ASSERT(!mHasChildren);
VkCommandBufferInheritanceInfo inheritanceInfo; VkCommandBufferInheritanceInfo inheritanceInfo = {};
inheritanceInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO; inheritanceInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO;
inheritanceInfo.pNext = nullptr;
inheritanceInfo.renderPass = VK_NULL_HANDLE; inheritanceInfo.renderPass = VK_NULL_HANDLE;
inheritanceInfo.subpass = 0; inheritanceInfo.subpass = 0;
inheritanceInfo.framebuffer = VK_NULL_HANDLE; inheritanceInfo.framebuffer = VK_NULL_HANDLE;
...@@ -263,9 +260,8 @@ angle::Result CommandGraphNode::beginInsideRenderPassRecording(Context *context, ...@@ -263,9 +260,8 @@ angle::Result CommandGraphNode::beginInsideRenderPassRecording(Context *context,
ANGLE_TRY(context->getRenderer()->getCompatibleRenderPass(context, mRenderPassDesc, ANGLE_TRY(context->getRenderer()->getCompatibleRenderPass(context, mRenderPassDesc,
&compatibleRenderPass)); &compatibleRenderPass));
VkCommandBufferInheritanceInfo inheritanceInfo; VkCommandBufferInheritanceInfo inheritanceInfo = {};
inheritanceInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO; inheritanceInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO;
inheritanceInfo.pNext = nullptr;
inheritanceInfo.renderPass = compatibleRenderPass->getHandle(); inheritanceInfo.renderPass = compatibleRenderPass->getHandle();
inheritanceInfo.subpass = 0; inheritanceInfo.subpass = 0;
inheritanceInfo.framebuffer = mRenderPassFramebuffer.getHandle(); inheritanceInfo.framebuffer = mRenderPassFramebuffer.getHandle();
...@@ -384,9 +380,8 @@ angle::Result CommandGraphNode::visitAndExecute(vk::Context *context, ...@@ -384,9 +380,8 @@ angle::Result CommandGraphNode::visitAndExecute(vk::Context *context,
ANGLE_TRY(mInsideRenderPassCommands.end(context)); ANGLE_TRY(mInsideRenderPassCommands.end(context));
VkRenderPassBeginInfo beginInfo; VkRenderPassBeginInfo beginInfo = {};
beginInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO; beginInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
beginInfo.pNext = nullptr;
beginInfo.renderPass = renderPass->getHandle(); beginInfo.renderPass = renderPass->getHandle();
beginInfo.framebuffer = mRenderPassFramebuffer.getHandle(); beginInfo.framebuffer = mRenderPassFramebuffer.getHandle();
beginInfo.renderArea.offset.x = static_cast<uint32_t>(mRenderPassRenderArea.x); beginInfo.renderArea.offset.x = static_cast<uint32_t>(mRenderPassRenderArea.x);
...@@ -448,9 +443,8 @@ angle::Result CommandGraph::submitCommands(Context *context, ...@@ -448,9 +443,8 @@ angle::Result CommandGraph::submitCommands(Context *context,
CommandPool *commandPool, CommandPool *commandPool,
CommandBuffer *primaryCommandBufferOut) CommandBuffer *primaryCommandBufferOut)
{ {
VkCommandBufferAllocateInfo primaryInfo; VkCommandBufferAllocateInfo primaryInfo = {};
primaryInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO; primaryInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
primaryInfo.pNext = nullptr;
primaryInfo.commandPool = commandPool->getHandle(); primaryInfo.commandPool = commandPool->getHandle();
primaryInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; primaryInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
primaryInfo.commandBufferCount = 1; primaryInfo.commandBufferCount = 1;
...@@ -469,9 +463,8 @@ angle::Result CommandGraph::submitCommands(Context *context, ...@@ -469,9 +463,8 @@ angle::Result CommandGraph::submitCommands(Context *context,
std::vector<CommandGraphNode *> nodeStack; std::vector<CommandGraphNode *> nodeStack;
VkCommandBufferBeginInfo beginInfo; VkCommandBufferBeginInfo beginInfo = {};
beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
beginInfo.pNext = nullptr;
beginInfo.flags = 0; beginInfo.flags = 0;
beginInfo.pInheritanceInfo = nullptr; beginInfo.pInheritanceInfo = nullptr;
......
...@@ -1152,14 +1152,13 @@ angle::Result ContextVk::handleDirtyDriverUniforms(const gl::Context *context, ...@@ -1152,14 +1152,13 @@ angle::Result ContextVk::handleDirtyDriverUniforms(const gl::Context *context,
this, mDriverUniformsSetLayout.get().ptr(), 1, &mDriverUniformsDescriptorSet)); this, mDriverUniformsSetLayout.get().ptr(), 1, &mDriverUniformsDescriptorSet));
// Update the driver uniform descriptor set. // Update the driver uniform descriptor set.
VkDescriptorBufferInfo bufferInfo; VkDescriptorBufferInfo bufferInfo = {};
bufferInfo.buffer = buffer; bufferInfo.buffer = buffer;
bufferInfo.offset = offset; bufferInfo.offset = offset;
bufferInfo.range = sizeof(DriverUniforms); bufferInfo.range = sizeof(DriverUniforms);
VkWriteDescriptorSet writeInfo; VkWriteDescriptorSet writeInfo = {};
writeInfo.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; writeInfo.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
writeInfo.pNext = nullptr;
writeInfo.dstSet = mDriverUniformsDescriptorSet; writeInfo.dstSet = mDriverUniformsDescriptorSet;
writeInfo.dstBinding = 0; writeInfo.dstBinding = 0;
writeInfo.dstArrayElement = 0; writeInfo.dstArrayElement = 0;
......
...@@ -458,7 +458,7 @@ angle::Result FramebufferVk::blitWithReadback(ContextVk *contextVk, ...@@ -458,7 +458,7 @@ angle::Result FramebufferVk::blitWithReadback(ContextVk *contextVk,
ANGLE_TRY( ANGLE_TRY(
readPixelsImpl(contextVk, copyArea, packPixelsParams, aspect, readRenderTarget, destPtr)); readPixelsImpl(contextVk, copyArea, packPixelsParams, aspect, readRenderTarget, destPtr));
VkBufferImageCopy copyRegion; VkBufferImageCopy copyRegion = {};
copyRegion.bufferOffset = destOffset; copyRegion.bufferOffset = destOffset;
copyRegion.bufferImageHeight = copyArea.height; copyRegion.bufferImageHeight = copyArea.height;
copyRegion.bufferRowLength = copyArea.width; copyRegion.bufferRowLength = copyArea.width;
...@@ -854,10 +854,9 @@ angle::Result FramebufferVk::getFramebuffer(ContextVk *contextVk, vk::Framebuffe ...@@ -854,10 +854,9 @@ angle::Result FramebufferVk::getFramebuffer(ContextVk *contextVk, vk::Framebuffe
ASSERT(!attachments.empty()); ASSERT(!attachments.empty());
VkFramebufferCreateInfo framebufferInfo; VkFramebufferCreateInfo framebufferInfo = {};
framebufferInfo.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO; framebufferInfo.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO;
framebufferInfo.pNext = nullptr;
framebufferInfo.flags = 0; framebufferInfo.flags = 0;
framebufferInfo.renderPass = renderPass->getHandle(); framebufferInfo.renderPass = renderPass->getHandle();
framebufferInfo.attachmentCount = static_cast<uint32_t>(attachments.size()); framebufferInfo.attachmentCount = static_cast<uint32_t>(attachments.size());
...@@ -887,7 +886,7 @@ angle::Result FramebufferVk::clearWithClearAttachments(ContextVk *contextVk, ...@@ -887,7 +886,7 @@ angle::Result FramebufferVk::clearWithClearAttachments(ContextVk *contextVk,
ANGLE_TRY(getCommandBufferForDraw(contextVk, &commandBuffer, &mode)); ANGLE_TRY(getCommandBufferForDraw(contextVk, &commandBuffer, &mode));
// The array layer is offset by the ImageView. So we shouldn't need to set a base array layer. // The array layer is offset by the ImageView. So we shouldn't need to set a base array layer.
VkClearRect clearRect; VkClearRect clearRect = {};
clearRect.baseArrayLayer = 0; clearRect.baseArrayLayer = 0;
clearRect.layerCount = 1; clearRect.layerCount = 1;
...@@ -1175,7 +1174,7 @@ angle::Result FramebufferVk::readPixelsImpl(ContextVk *contextVk, ...@@ -1175,7 +1174,7 @@ angle::Result FramebufferVk::readPixelsImpl(ContextVk *contextVk,
ANGLE_TRY(mReadPixelBuffer.allocate(contextVk, allocationSize, &readPixelBuffer, &bufferHandle, ANGLE_TRY(mReadPixelBuffer.allocate(contextVk, allocationSize, &readPixelBuffer, &bufferHandle,
&stagingOffset, &newBufferAllocated)); &stagingOffset, &newBufferAllocated));
VkBufferImageCopy region; VkBufferImageCopy region = {};
region.bufferImageHeight = area.height; region.bufferImageHeight = area.height;
region.bufferOffset = stagingOffset; region.bufferOffset = stagingOffset;
region.bufferRowLength = area.width; region.bufferRowLength = area.width;
......
...@@ -430,9 +430,8 @@ angle::Result ProgramVk::initDefaultUniformBlocks(const gl::Context *glContext) ...@@ -430,9 +430,8 @@ angle::Result ProgramVk::initDefaultUniformBlocks(const gl::Context *glContext)
// Initialize the "empty" uniform block if necessary. // Initialize the "empty" uniform block if necessary.
if (!mDefaultUniformBlocksDirty.all()) if (!mDefaultUniformBlocksDirty.all())
{ {
VkBufferCreateInfo uniformBufferInfo; VkBufferCreateInfo uniformBufferInfo = {};
uniformBufferInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; uniformBufferInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
uniformBufferInfo.pNext = nullptr;
uniformBufferInfo.flags = 0; uniformBufferInfo.flags = 0;
uniformBufferInfo.size = 1; uniformBufferInfo.size = 1;
uniformBufferInfo.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT; uniformBufferInfo.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT;
......
...@@ -426,18 +426,16 @@ angle::Result RendererVk::initialize(DisplayVk *displayVk, ...@@ -426,18 +426,16 @@ angle::Result RendererVk::initialize(DisplayVk *displayVk,
ANGLE_VK_TRY(displayVk, ANGLE_VK_TRY(displayVk,
VerifyExtensionsPresent(instanceExtensionProps, enabledInstanceExtensions)); VerifyExtensionsPresent(instanceExtensionProps, enabledInstanceExtensions));
VkApplicationInfo applicationInfo; VkApplicationInfo applicationInfo = {};
applicationInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO; applicationInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
applicationInfo.pNext = nullptr;
applicationInfo.pApplicationName = "ANGLE"; applicationInfo.pApplicationName = "ANGLE";
applicationInfo.applicationVersion = 1; applicationInfo.applicationVersion = 1;
applicationInfo.pEngineName = "ANGLE"; applicationInfo.pEngineName = "ANGLE";
applicationInfo.engineVersion = 1; applicationInfo.engineVersion = 1;
applicationInfo.apiVersion = VK_API_VERSION_1_0; applicationInfo.apiVersion = VK_API_VERSION_1_0;
VkInstanceCreateInfo instanceInfo; VkInstanceCreateInfo instanceInfo = {};
instanceInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; instanceInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
instanceInfo.pNext = nullptr;
instanceInfo.flags = 0; instanceInfo.flags = 0;
instanceInfo.pApplicationInfo = &applicationInfo; instanceInfo.pApplicationInfo = &applicationInfo;
...@@ -452,10 +450,9 @@ angle::Result RendererVk::initialize(DisplayVk *displayVk, ...@@ -452,10 +450,9 @@ angle::Result RendererVk::initialize(DisplayVk *displayVk,
if (mEnableValidationLayers) if (mEnableValidationLayers)
{ {
VkDebugReportCallbackCreateInfoEXT debugReportInfo; VkDebugReportCallbackCreateInfoEXT debugReportInfo = {};
debugReportInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT; debugReportInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT;
debugReportInfo.pNext = nullptr;
debugReportInfo.flags = VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_REPORT_WARNING_BIT_EXT | debugReportInfo.flags = VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_REPORT_WARNING_BIT_EXT |
VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT | VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT |
VK_DEBUG_REPORT_INFORMATION_BIT_EXT | VK_DEBUG_REPORT_DEBUG_BIT_EXT; VK_DEBUG_REPORT_INFORMATION_BIT_EXT | VK_DEBUG_REPORT_DEBUG_BIT_EXT;
...@@ -576,22 +573,20 @@ angle::Result RendererVk::initializeDevice(DisplayVk *displayVk, uint32_t queueF ...@@ -576,22 +573,20 @@ angle::Result RendererVk::initializeDevice(DisplayVk *displayVk, uint32_t queueF
ANGLE_VK_TRY(displayVk, VerifyExtensionsPresent(deviceExtensionProps, enabledDeviceExtensions)); ANGLE_VK_TRY(displayVk, VerifyExtensionsPresent(deviceExtensionProps, enabledDeviceExtensions));
VkDeviceQueueCreateInfo queueCreateInfo; VkDeviceQueueCreateInfo queueCreateInfo = {};
float zeroPriority = 0.0f; float zeroPriority = 0.0f;
queueCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO; queueCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
queueCreateInfo.pNext = nullptr;
queueCreateInfo.flags = 0; queueCreateInfo.flags = 0;
queueCreateInfo.queueFamilyIndex = queueFamilyIndex; queueCreateInfo.queueFamilyIndex = queueFamilyIndex;
queueCreateInfo.queueCount = 1; queueCreateInfo.queueCount = 1;
queueCreateInfo.pQueuePriorities = &zeroPriority; queueCreateInfo.pQueuePriorities = &zeroPriority;
// Initialize the device // Initialize the device
VkDeviceCreateInfo createInfo; VkDeviceCreateInfo createInfo = {};
createInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; createInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
createInfo.pNext = nullptr;
createInfo.flags = 0; createInfo.flags = 0;
createInfo.queueCreateInfoCount = 1; createInfo.queueCreateInfoCount = 1;
createInfo.pQueueCreateInfos = &queueCreateInfo; createInfo.pQueueCreateInfos = &queueCreateInfo;
...@@ -609,9 +604,8 @@ angle::Result RendererVk::initializeDevice(DisplayVk *displayVk, uint32_t queueF ...@@ -609,9 +604,8 @@ angle::Result RendererVk::initializeDevice(DisplayVk *displayVk, uint32_t queueF
vkGetDeviceQueue(mDevice, mCurrentQueueFamilyIndex, 0, &mQueue); vkGetDeviceQueue(mDevice, mCurrentQueueFamilyIndex, 0, &mQueue);
// Initialize the command pool now that we know the queue family index. // Initialize the command pool now that we know the queue family index.
VkCommandPoolCreateInfo commandPoolInfo; VkCommandPoolCreateInfo commandPoolInfo = {};
commandPoolInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO; commandPoolInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
commandPoolInfo.pNext = nullptr;
commandPoolInfo.flags = VK_COMMAND_POOL_CREATE_TRANSIENT_BIT; commandPoolInfo.flags = VK_COMMAND_POOL_CREATE_TRANSIENT_BIT;
commandPoolInfo.queueFamilyIndex = mCurrentQueueFamilyIndex; commandPoolInfo.queueFamilyIndex = mCurrentQueueFamilyIndex;
...@@ -752,10 +746,9 @@ angle::Result RendererVk::initPipelineCacheVk(DisplayVk *display) ...@@ -752,10 +746,9 @@ angle::Result RendererVk::initPipelineCacheVk(DisplayVk *display)
bool success = display->getBlobCache()->get(display->getScratchBuffer(), bool success = display->getBlobCache()->get(display->getScratchBuffer(),
mPipelineCacheVkBlobKey, &initialData); mPipelineCacheVkBlobKey, &initialData);
VkPipelineCacheCreateInfo pipelineCacheCreateInfo; VkPipelineCacheCreateInfo pipelineCacheCreateInfo = {};
pipelineCacheCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO; pipelineCacheCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO;
pipelineCacheCreateInfo.pNext = nullptr;
pipelineCacheCreateInfo.flags = 0; pipelineCacheCreateInfo.flags = 0;
pipelineCacheCreateInfo.initialDataSize = success ? initialData.size() : 0; pipelineCacheCreateInfo.initialDataSize = success ? initialData.size() : 0;
pipelineCacheCreateInfo.pInitialData = success ? initialData.data() : nullptr; pipelineCacheCreateInfo.pInitialData = success ? initialData.data() : nullptr;
...@@ -817,9 +810,8 @@ angle::Result RendererVk::finish(vk::Context *context) ...@@ -817,9 +810,8 @@ angle::Result RendererVk::finish(vk::Context *context)
vk::Scoped<vk::CommandBuffer> commandBatch(mDevice); vk::Scoped<vk::CommandBuffer> commandBatch(mDevice);
ANGLE_TRY(flushCommandGraph(context, &commandBatch.get())); ANGLE_TRY(flushCommandGraph(context, &commandBatch.get()));
VkSubmitInfo submitInfo; VkSubmitInfo submitInfo = {};
submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
submitInfo.pNext = nullptr;
submitInfo.waitSemaphoreCount = 0; submitInfo.waitSemaphoreCount = 0;
submitInfo.pWaitSemaphores = nullptr; submitInfo.pWaitSemaphores = nullptr;
submitInfo.pWaitDstStageMask = nullptr; submitInfo.pWaitDstStageMask = nullptr;
...@@ -894,9 +886,8 @@ angle::Result RendererVk::submitFrame(vk::Context *context, ...@@ -894,9 +886,8 @@ angle::Result RendererVk::submitFrame(vk::Context *context,
const VkSubmitInfo &submitInfo, const VkSubmitInfo &submitInfo,
vk::CommandBuffer &&commandBuffer) vk::CommandBuffer &&commandBuffer)
{ {
VkFenceCreateInfo fenceInfo; VkFenceCreateInfo fenceInfo = {};
fenceInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO; fenceInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
fenceInfo.pNext = nullptr;
fenceInfo.flags = 0; fenceInfo.flags = 0;
vk::Scoped<CommandBatch> scopedBatch(mDevice); vk::Scoped<CommandBatch> scopedBatch(mDevice);
...@@ -929,9 +920,8 @@ angle::Result RendererVk::submitFrame(vk::Context *context, ...@@ -929,9 +920,8 @@ angle::Result RendererVk::submitFrame(vk::Context *context,
// Reallocate the command pool for next frame. // Reallocate the command pool for next frame.
// TODO(jmadill): Consider reusing command pools. // TODO(jmadill): Consider reusing command pools.
VkCommandPoolCreateInfo poolInfo; VkCommandPoolCreateInfo poolInfo = {};
poolInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO; poolInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
poolInfo.pNext = nullptr;
poolInfo.flags = 0; poolInfo.flags = 0;
poolInfo.queueFamilyIndex = mCurrentQueueFamilyIndex; poolInfo.queueFamilyIndex = mCurrentQueueFamilyIndex;
...@@ -982,9 +972,8 @@ angle::Result RendererVk::flush(vk::Context *context, ...@@ -982,9 +972,8 @@ angle::Result RendererVk::flush(vk::Context *context,
VkPipelineStageFlags waitStageMask = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT; VkPipelineStageFlags waitStageMask = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT;
VkSubmitInfo submitInfo; VkSubmitInfo submitInfo = {};
submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
submitInfo.pNext = nullptr;
submitInfo.waitSemaphoreCount = 1; submitInfo.waitSemaphoreCount = 1;
submitInfo.pWaitSemaphores = waitSemaphore.ptr(); submitInfo.pWaitSemaphores = waitSemaphore.ptr();
submitInfo.pWaitDstStageMask = &waitStageMask; submitInfo.pWaitDstStageMask = &waitStageMask;
......
...@@ -440,9 +440,8 @@ angle::Result WindowSurfaceVk::initializeImpl(DisplayVk *displayVk) ...@@ -440,9 +440,8 @@ angle::Result WindowSurfaceVk::initializeImpl(DisplayVk *displayVk)
// We need transfer src for reading back from the backbuffer. // We need transfer src for reading back from the backbuffer.
VkImageUsageFlags imageUsageFlags = kSurfaceVKColorImageUsageFlags; VkImageUsageFlags imageUsageFlags = kSurfaceVKColorImageUsageFlags;
VkSwapchainCreateInfoKHR swapchainInfo; VkSwapchainCreateInfoKHR swapchainInfo = {};
swapchainInfo.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR; swapchainInfo.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR;
swapchainInfo.pNext = nullptr;
swapchainInfo.flags = 0; swapchainInfo.flags = 0;
swapchainInfo.surface = mSurface; swapchainInfo.surface = mSurface;
swapchainInfo.minImageCount = minImageCount; swapchainInfo.minImageCount = minImageCount;
...@@ -472,7 +471,7 @@ angle::Result WindowSurfaceVk::initializeImpl(DisplayVk *displayVk) ...@@ -472,7 +471,7 @@ angle::Result WindowSurfaceVk::initializeImpl(DisplayVk *displayVk)
ANGLE_VK_TRY(displayVk, ANGLE_VK_TRY(displayVk,
vkGetSwapchainImagesKHR(device, mSwapchain, &imageCount, swapchainImages.data())); vkGetSwapchainImagesKHR(device, mSwapchain, &imageCount, swapchainImages.data()));
VkClearColorValue transparentBlack; VkClearColorValue transparentBlack = {};
transparentBlack.float32[0] = 0.0f; transparentBlack.float32[0] = 0.0f;
transparentBlack.float32[1] = 0.0f; transparentBlack.float32[1] = 0.0f;
transparentBlack.float32[2] = 0.0f; transparentBlack.float32[2] = 0.0f;
...@@ -573,9 +572,8 @@ angle::Result WindowSurfaceVk::swapImpl(DisplayVk *displayVk) ...@@ -573,9 +572,8 @@ angle::Result WindowSurfaceVk::swapImpl(DisplayVk *displayVk)
ANGLE_TRY( ANGLE_TRY(
renderer->flush(displayVk, image.imageAcquiredSemaphore, image.commandsCompleteSemaphore)); renderer->flush(displayVk, image.imageAcquiredSemaphore, image.commandsCompleteSemaphore));
VkPresentInfoKHR presentInfo; VkPresentInfoKHR presentInfo = {};
presentInfo.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR; presentInfo.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR;
presentInfo.pNext = nullptr;
presentInfo.waitSemaphoreCount = 1; presentInfo.waitSemaphoreCount = 1;
presentInfo.pWaitSemaphores = image.commandsCompleteSemaphore.ptr(); presentInfo.pWaitSemaphores = image.commandsCompleteSemaphore.ptr();
presentInfo.swapchainCount = 1; presentInfo.swapchainCount = 1;
...@@ -705,13 +703,12 @@ angle::Result WindowSurfaceVk::getCurrentFramebuffer(vk::Context *context, ...@@ -705,13 +703,12 @@ angle::Result WindowSurfaceVk::getCurrentFramebuffer(vk::Context *context,
return angle::Result::Continue(); return angle::Result::Continue();
} }
VkFramebufferCreateInfo framebufferInfo; VkFramebufferCreateInfo framebufferInfo = {};
const gl::Extents &extents = mColorRenderTarget.getImageExtents(); const gl::Extents &extents = mColorRenderTarget.getImageExtents();
std::array<VkImageView, 2> imageViews = {{VK_NULL_HANDLE, mDepthStencilImageView.getHandle()}}; std::array<VkImageView, 2> imageViews = {{VK_NULL_HANDLE, mDepthStencilImageView.getHandle()}};
framebufferInfo.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO; framebufferInfo.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO;
framebufferInfo.pNext = nullptr;
framebufferInfo.flags = 0; framebufferInfo.flags = 0;
framebufferInfo.renderPass = compatibleRenderPass.getHandle(); framebufferInfo.renderPass = compatibleRenderPass.getHandle();
framebufferInfo.attachmentCount = (mDepthStencilImage.valid() ? 2u : 1u); framebufferInfo.attachmentCount = (mDepthStencilImage.valid() ? 2u : 1u);
......
...@@ -140,7 +140,7 @@ angle::Result PixelBuffer::stageSubresourceUpdate(ContextVk *contextVk, ...@@ -140,7 +140,7 @@ angle::Result PixelBuffer::stageSubresourceUpdate(ContextVk *contextVk,
loadFunction.loadFunction(extents.width, extents.height, extents.depth, source, inputRowPitch, loadFunction.loadFunction(extents.width, extents.height, extents.depth, source, inputRowPitch,
inputDepthPitch, stagingPointer, outputRowPitch, outputDepthPitch); inputDepthPitch, stagingPointer, outputRowPitch, outputDepthPitch);
VkBufferImageCopy copy; VkBufferImageCopy copy = {};
copy.bufferOffset = stagingOffset; copy.bufferOffset = stagingOffset;
copy.bufferRowLength = extents.width; copy.bufferRowLength = extents.width;
...@@ -240,7 +240,7 @@ angle::Result PixelBuffer::stageSubresourceUpdateFromFramebuffer( ...@@ -240,7 +240,7 @@ angle::Result PixelBuffer::stageSubresourceUpdateFromFramebuffer(
} }
// 3- enqueue the destination image subresource update // 3- enqueue the destination image subresource update
VkBufferImageCopy copyToImage; VkBufferImageCopy copyToImage = {};
copyToImage.bufferOffset = static_cast<VkDeviceSize>(stagingOffset); copyToImage.bufferOffset = static_cast<VkDeviceSize>(stagingOffset);
copyToImage.bufferRowLength = 0; // Tightly packed data can be specified as 0. copyToImage.bufferRowLength = 0; // Tightly packed data can be specified as 0.
copyToImage.bufferImageHeight = clippedRectangle.height; copyToImage.bufferImageHeight = clippedRectangle.height;
...@@ -341,7 +341,7 @@ angle::Result PixelBuffer::stageSubresourceUpdateAndGetData(ContextVk *contextVk ...@@ -341,7 +341,7 @@ angle::Result PixelBuffer::stageSubresourceUpdateAndGetData(ContextVk *contextVk
ANGLE_TRY(mStagingBuffer.allocate(contextVk, allocationSize, destData, &bufferHandle, ANGLE_TRY(mStagingBuffer.allocate(contextVk, allocationSize, destData, &bufferHandle,
&stagingOffset, &newBufferAllocated)); &stagingOffset, &newBufferAllocated));
VkBufferImageCopy copy; VkBufferImageCopy copy = {};
copy.bufferOffset = stagingOffset; copy.bufferOffset = stagingOffset;
copy.bufferRowLength = extents.width; copy.bufferRowLength = extents.width;
copy.bufferImageHeight = extents.height; copy.bufferImageHeight = extents.height;
...@@ -769,7 +769,7 @@ angle::Result TextureVk::copyImageDataToBuffer(ContextVk *contextVk, ...@@ -769,7 +769,7 @@ angle::Result TextureVk::copyImageDataToBuffer(ContextVk *contextVk,
ANGLE_TRY(mPixelBuffer.allocate(contextVk, sourceCopyAllocationSize, outDataPtr, ANGLE_TRY(mPixelBuffer.allocate(contextVk, sourceCopyAllocationSize, outDataPtr,
&copyBufferHandle, &sourceCopyOffset, &newBufferAllocated)); &copyBufferHandle, &sourceCopyOffset, &newBufferAllocated));
VkBufferImageCopy region; VkBufferImageCopy region = {};
region.bufferOffset = sourceCopyOffset; region.bufferOffset = sourceCopyOffset;
region.bufferRowLength = 0; region.bufferRowLength = 0;
region.bufferImageHeight = 0; region.bufferImageHeight = 0;
...@@ -976,9 +976,8 @@ gl::Error TextureVk::syncState(const gl::Context *context, const gl::Texture::Di ...@@ -976,9 +976,8 @@ gl::Error TextureVk::syncState(const gl::Context *context, const gl::Texture::Di
const gl::SamplerState &samplerState = mState.getSamplerState(); const gl::SamplerState &samplerState = mState.getSamplerState();
// Create a simple sampler. Force basic parameter settings. // Create a simple sampler. Force basic parameter settings.
VkSamplerCreateInfo samplerInfo; VkSamplerCreateInfo samplerInfo = {};
samplerInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO; samplerInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
samplerInfo.pNext = nullptr;
samplerInfo.flags = 0; samplerInfo.flags = 0;
samplerInfo.magFilter = gl_vk::GetFilter(samplerState.getMagFilter()); samplerInfo.magFilter = gl_vk::GetFilter(samplerState.getMagFilter());
samplerInfo.minFilter = gl_vk::GetFilter(samplerState.getMinFilter()); samplerInfo.minFilter = gl_vk::GetFilter(samplerState.getMinFilter());
......
...@@ -26,10 +26,9 @@ WindowSurfaceVkAndroid::WindowSurfaceVkAndroid(const egl::SurfaceState &surfaceS ...@@ -26,10 +26,9 @@ WindowSurfaceVkAndroid::WindowSurfaceVkAndroid(const egl::SurfaceState &surfaceS
angle::Result WindowSurfaceVkAndroid::createSurfaceVk(vk::Context *context, gl::Extents *extentsOut) angle::Result WindowSurfaceVkAndroid::createSurfaceVk(vk::Context *context, gl::Extents *extentsOut)
{ {
VkAndroidSurfaceCreateInfoKHR createInfo; VkAndroidSurfaceCreateInfoKHR createInfo = {};
createInfo.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR; createInfo.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR;
createInfo.pNext = nullptr;
createInfo.flags = 0; createInfo.flags = 0;
createInfo.window = mNativeWindowType; createInfo.window = mNativeWindowType;
ANGLE_VK_TRY(context, vkCreateAndroidSurfaceKHR(context->getRenderer()->getInstance(), ANGLE_VK_TRY(context, vkCreateAndroidSurfaceKHR(context->getRenderer()->getInstance(),
......
...@@ -191,7 +191,7 @@ angle::Result InitializeRenderPassFromDesc(vk::Context *context, ...@@ -191,7 +191,7 @@ angle::Result InitializeRenderPassFromDesc(vk::Context *context,
colorRef.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; colorRef.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
} }
VkAttachmentReference depthStencilAttachmentRef; VkAttachmentReference depthStencilAttachmentRef = {};
if (desc.depthStencilAttachmentCount() > 0) if (desc.depthStencilAttachmentCount() > 0)
{ {
ASSERT(desc.depthStencilAttachmentCount() == 1); ASSERT(desc.depthStencilAttachmentCount() == 1);
...@@ -199,7 +199,7 @@ angle::Result InitializeRenderPassFromDesc(vk::Context *context, ...@@ -199,7 +199,7 @@ angle::Result InitializeRenderPassFromDesc(vk::Context *context,
depthStencilAttachmentRef.layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; depthStencilAttachmentRef.layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
} }
VkSubpassDescription subpassDesc; VkSubpassDescription subpassDesc = {};
subpassDesc.flags = 0; subpassDesc.flags = 0;
subpassDesc.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS; subpassDesc.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
...@@ -227,9 +227,8 @@ angle::Result InitializeRenderPassFromDesc(vk::Context *context, ...@@ -227,9 +227,8 @@ angle::Result InitializeRenderPassFromDesc(vk::Context *context,
ops[depthStencilIndex]); ops[depthStencilIndex]);
} }
VkRenderPassCreateInfo createInfo; VkRenderPassCreateInfo createInfo = {};
createInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO; createInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
createInfo.pNext = nullptr;
createInfo.flags = 0; createInfo.flags = 0;
createInfo.attachmentCount = attachmentCount; createInfo.attachmentCount = attachmentCount;
createInfo.pAttachments = attachmentDescs.data(); createInfo.pAttachments = attachmentDescs.data();
...@@ -444,20 +443,19 @@ angle::Result PipelineDesc::initializePipeline(vk::Context *context, ...@@ -444,20 +443,19 @@ angle::Result PipelineDesc::initializePipeline(vk::Context *context,
const ShaderModule &fragmentModule, const ShaderModule &fragmentModule,
Pipeline *pipelineOut) const Pipeline *pipelineOut) const
{ {
VkPipelineShaderStageCreateInfo shaderStages[2]; VkPipelineShaderStageCreateInfo shaderStages[2] = {};
VkPipelineVertexInputStateCreateInfo vertexInputState; VkPipelineVertexInputStateCreateInfo vertexInputState = {};
VkPipelineInputAssemblyStateCreateInfo inputAssemblyState; VkPipelineInputAssemblyStateCreateInfo inputAssemblyState = {};
VkPipelineViewportStateCreateInfo viewportState; VkPipelineViewportStateCreateInfo viewportState = {};
VkPipelineRasterizationStateCreateInfo rasterState; VkPipelineRasterizationStateCreateInfo rasterState = {};
VkPipelineMultisampleStateCreateInfo multisampleState; VkPipelineMultisampleStateCreateInfo multisampleState = {};
VkPipelineDepthStencilStateCreateInfo depthStencilState; VkPipelineDepthStencilStateCreateInfo depthStencilState = {};
std::array<VkPipelineColorBlendAttachmentState, gl::IMPLEMENTATION_MAX_DRAW_BUFFERS> std::array<VkPipelineColorBlendAttachmentState, gl::IMPLEMENTATION_MAX_DRAW_BUFFERS>
blendAttachmentState; blendAttachmentState;
VkPipelineColorBlendStateCreateInfo blendState; VkPipelineColorBlendStateCreateInfo blendState = {};
VkGraphicsPipelineCreateInfo createInfo; VkGraphicsPipelineCreateInfo createInfo = {};
shaderStages[0].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; shaderStages[0].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
shaderStages[0].pNext = nullptr;
shaderStages[0].flags = 0; shaderStages[0].flags = 0;
shaderStages[0].stage = VK_SHADER_STAGE_VERTEX_BIT; shaderStages[0].stage = VK_SHADER_STAGE_VERTEX_BIT;
shaderStages[0].module = vertexModule.getHandle(); shaderStages[0].module = vertexModule.getHandle();
...@@ -465,7 +463,6 @@ angle::Result PipelineDesc::initializePipeline(vk::Context *context, ...@@ -465,7 +463,6 @@ angle::Result PipelineDesc::initializePipeline(vk::Context *context,
shaderStages[0].pSpecializationInfo = nullptr; shaderStages[0].pSpecializationInfo = nullptr;
shaderStages[1].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; shaderStages[1].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
shaderStages[1].pNext = nullptr;
shaderStages[1].flags = 0; shaderStages[1].flags = 0;
shaderStages[1].stage = VK_SHADER_STAGE_FRAGMENT_BIT; shaderStages[1].stage = VK_SHADER_STAGE_FRAGMENT_BIT;
shaderStages[1].module = fragmentModule.getHandle(); shaderStages[1].module = fragmentModule.getHandle();
...@@ -501,7 +498,6 @@ angle::Result PipelineDesc::initializePipeline(vk::Context *context, ...@@ -501,7 +498,6 @@ angle::Result PipelineDesc::initializePipeline(vk::Context *context,
// The binding descriptions are filled in at draw time. // The binding descriptions are filled in at draw time.
vertexInputState.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO; vertexInputState.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
vertexInputState.pNext = nullptr;
vertexInputState.flags = 0; vertexInputState.flags = 0;
vertexInputState.vertexBindingDescriptionCount = vertexAttribCount; vertexInputState.vertexBindingDescriptionCount = vertexAttribCount;
vertexInputState.pVertexBindingDescriptions = bindingDescs.data(); vertexInputState.pVertexBindingDescriptions = bindingDescs.data();
...@@ -510,7 +506,6 @@ angle::Result PipelineDesc::initializePipeline(vk::Context *context, ...@@ -510,7 +506,6 @@ angle::Result PipelineDesc::initializePipeline(vk::Context *context,
// Primitive topology is filled in at draw time. // Primitive topology is filled in at draw time.
inputAssemblyState.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO; inputAssemblyState.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
inputAssemblyState.pNext = nullptr;
inputAssemblyState.flags = 0; inputAssemblyState.flags = 0;
inputAssemblyState.topology = static_cast<VkPrimitiveTopology>(mInputAssemblyInfo.topology); inputAssemblyState.topology = static_cast<VkPrimitiveTopology>(mInputAssemblyInfo.topology);
inputAssemblyState.primitiveRestartEnable = inputAssemblyState.primitiveRestartEnable =
...@@ -519,7 +514,6 @@ angle::Result PipelineDesc::initializePipeline(vk::Context *context, ...@@ -519,7 +514,6 @@ angle::Result PipelineDesc::initializePipeline(vk::Context *context,
// Set initial viewport and scissor state. // Set initial viewport and scissor state.
viewportState.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO; viewportState.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
viewportState.pNext = nullptr;
viewportState.flags = 0; viewportState.flags = 0;
viewportState.viewportCount = 1; viewportState.viewportCount = 1;
viewportState.pViewports = &mViewport; viewportState.pViewports = &mViewport;
...@@ -528,7 +522,6 @@ angle::Result PipelineDesc::initializePipeline(vk::Context *context, ...@@ -528,7 +522,6 @@ angle::Result PipelineDesc::initializePipeline(vk::Context *context,
// Rasterizer state. // Rasterizer state.
rasterState.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO; rasterState.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
rasterState.pNext = nullptr;
rasterState.flags = 0; rasterState.flags = 0;
rasterState.depthClampEnable = static_cast<VkBool32>(mRasterizationStateInfo.depthClampEnable); rasterState.depthClampEnable = static_cast<VkBool32>(mRasterizationStateInfo.depthClampEnable);
rasterState.rasterizerDiscardEnable = rasterState.rasterizerDiscardEnable =
...@@ -544,7 +537,6 @@ angle::Result PipelineDesc::initializePipeline(vk::Context *context, ...@@ -544,7 +537,6 @@ angle::Result PipelineDesc::initializePipeline(vk::Context *context,
// Multisample state. // Multisample state.
multisampleState.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO; multisampleState.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
multisampleState.pNext = nullptr;
multisampleState.flags = 0; multisampleState.flags = 0;
multisampleState.rasterizationSamples = multisampleState.rasterizationSamples =
gl_vk::GetSamples(mMultisampleStateInfo.rasterizationSamples); gl_vk::GetSamples(mMultisampleStateInfo.rasterizationSamples);
...@@ -560,7 +552,6 @@ angle::Result PipelineDesc::initializePipeline(vk::Context *context, ...@@ -560,7 +552,6 @@ angle::Result PipelineDesc::initializePipeline(vk::Context *context,
// Depth/stencil state. // Depth/stencil state.
depthStencilState.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO; depthStencilState.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO;
depthStencilState.pNext = nullptr;
depthStencilState.flags = 0; depthStencilState.flags = 0;
depthStencilState.depthTestEnable = depthStencilState.depthTestEnable =
static_cast<VkBool32>(mDepthStencilStateInfo.depthTestEnable); static_cast<VkBool32>(mDepthStencilStateInfo.depthTestEnable);
...@@ -578,7 +569,6 @@ angle::Result PipelineDesc::initializePipeline(vk::Context *context, ...@@ -578,7 +569,6 @@ angle::Result PipelineDesc::initializePipeline(vk::Context *context,
depthStencilState.maxDepthBounds = mDepthStencilStateInfo.maxDepthBounds; depthStencilState.maxDepthBounds = mDepthStencilStateInfo.maxDepthBounds;
blendState.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO; blendState.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
blendState.pNext = 0;
blendState.flags = 0; blendState.flags = 0;
blendState.logicOpEnable = static_cast<VkBool32>(mColorBlendStateInfo.logicOpEnable); blendState.logicOpEnable = static_cast<VkBool32>(mColorBlendStateInfo.logicOpEnable);
blendState.logicOp = static_cast<VkLogicOp>(mColorBlendStateInfo.logicOp); blendState.logicOp = static_cast<VkLogicOp>(mColorBlendStateInfo.logicOp);
...@@ -599,7 +589,6 @@ angle::Result PipelineDesc::initializePipeline(vk::Context *context, ...@@ -599,7 +589,6 @@ angle::Result PipelineDesc::initializePipeline(vk::Context *context,
// TODO(jmadill): Dynamic state. // TODO(jmadill): Dynamic state.
createInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO; createInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
createInfo.pNext = nullptr;
createInfo.flags = 0; createInfo.flags = 0;
createInfo.stageCount = 2; createInfo.stageCount = 2;
createInfo.pStages = shaderStages; createInfo.pStages = shaderStages;
...@@ -950,7 +939,7 @@ void DescriptorSetLayoutDesc::unpackBindings(DescriptorSetLayoutBindingVector *b ...@@ -950,7 +939,7 @@ void DescriptorSetLayoutDesc::unpackBindings(DescriptorSetLayoutBindingVector *b
if (packedBinding.count == 0) if (packedBinding.count == 0)
continue; continue;
VkDescriptorSetLayoutBinding binding; VkDescriptorSetLayoutBinding binding = {};
binding.binding = bindingIndex; binding.binding = bindingIndex;
binding.descriptorCount = packedBinding.count; binding.descriptorCount = packedBinding.count;
binding.descriptorType = static_cast<VkDescriptorType>(packedBinding.type); binding.descriptorType = static_cast<VkDescriptorType>(packedBinding.type);
...@@ -1208,9 +1197,8 @@ angle::Result DescriptorSetLayoutCache::getDescriptorSetLayout( ...@@ -1208,9 +1197,8 @@ angle::Result DescriptorSetLayoutCache::getDescriptorSetLayout(
vk::DescriptorSetLayoutBindingVector bindings; vk::DescriptorSetLayoutBindingVector bindings;
desc.unpackBindings(&bindings); desc.unpackBindings(&bindings);
VkDescriptorSetLayoutCreateInfo createInfo; VkDescriptorSetLayoutCreateInfo createInfo = {};
createInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO; createInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
createInfo.pNext = nullptr;
createInfo.flags = 0; createInfo.flags = 0;
createInfo.bindingCount = static_cast<uint32_t>(bindings.size()); createInfo.bindingCount = static_cast<uint32_t>(bindings.size());
createInfo.pBindings = bindings.data(); createInfo.pBindings = bindings.data();
...@@ -1280,7 +1268,7 @@ angle::Result PipelineLayoutCache::getPipelineLayout( ...@@ -1280,7 +1268,7 @@ angle::Result PipelineLayoutCache::getPipelineLayout(
const vk::PackedPushConstantRange &pushConstantDesc = descPushConstantRanges[shaderIndex]; const vk::PackedPushConstantRange &pushConstantDesc = descPushConstantRanges[shaderIndex];
if (pushConstantDesc.size > 0) if (pushConstantDesc.size > 0)
{ {
VkPushConstantRange pushConstantRange; VkPushConstantRange pushConstantRange = {};
pushConstantRange.stageFlags = pushConstantRange.stageFlags =
shaderIndex == 0 ? VK_SHADER_STAGE_VERTEX_BIT : VK_SHADER_STAGE_FRAGMENT_BIT; shaderIndex == 0 ? VK_SHADER_STAGE_VERTEX_BIT : VK_SHADER_STAGE_FRAGMENT_BIT;
pushConstantRange.offset = pushConstantDesc.offset; pushConstantRange.offset = pushConstantDesc.offset;
...@@ -1291,9 +1279,8 @@ angle::Result PipelineLayoutCache::getPipelineLayout( ...@@ -1291,9 +1279,8 @@ angle::Result PipelineLayoutCache::getPipelineLayout(
} }
// No pipeline layout found. We must create a new one. // No pipeline layout found. We must create a new one.
VkPipelineLayoutCreateInfo createInfo; VkPipelineLayoutCreateInfo createInfo = {};
createInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO; createInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
createInfo.pNext = nullptr;
createInfo.flags = 0; createInfo.flags = 0;
createInfo.setLayoutCount = static_cast<uint32_t>(setLayoutHandles.size()); createInfo.setLayoutCount = static_cast<uint32_t>(setLayoutHandles.size());
createInfo.pSetLayouts = setLayoutHandles.data(); createInfo.pSetLayouts = setLayoutHandles.data();
......
...@@ -127,9 +127,8 @@ angle::Result DynamicBuffer::allocate(Context *context, ...@@ -127,9 +127,8 @@ angle::Result DynamicBuffer::allocate(Context *context,
mSize = std::max(sizeToAllocate, mMinSize); mSize = std::max(sizeToAllocate, mMinSize);
VkBufferCreateInfo createInfo; VkBufferCreateInfo createInfo = {};
createInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; createInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
createInfo.pNext = nullptr;
createInfo.flags = 0; createInfo.flags = 0;
createInfo.size = mSize; createInfo.size = mSize;
createInfo.usage = mUsage; createInfo.usage = mUsage;
...@@ -176,9 +175,8 @@ angle::Result DynamicBuffer::flush(Context *context) ...@@ -176,9 +175,8 @@ angle::Result DynamicBuffer::flush(Context *context)
{ {
if (!mHostCoherent && (mNextAllocationOffset > mLastFlushOrInvalidateOffset)) if (!mHostCoherent && (mNextAllocationOffset > mLastFlushOrInvalidateOffset))
{ {
VkMappedMemoryRange range; VkMappedMemoryRange range = {};
range.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE; range.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE;
range.pNext = nullptr;
range.memory = mMemory.getHandle(); range.memory = mMemory.getHandle();
range.offset = mLastFlushOrInvalidateOffset; range.offset = mLastFlushOrInvalidateOffset;
range.size = mNextAllocationOffset - mLastFlushOrInvalidateOffset; range.size = mNextAllocationOffset - mLastFlushOrInvalidateOffset;
...@@ -193,9 +191,8 @@ angle::Result DynamicBuffer::invalidate(Context *context) ...@@ -193,9 +191,8 @@ angle::Result DynamicBuffer::invalidate(Context *context)
{ {
if (!mHostCoherent && (mNextAllocationOffset > mLastFlushOrInvalidateOffset)) if (!mHostCoherent && (mNextAllocationOffset > mLastFlushOrInvalidateOffset))
{ {
VkMappedMemoryRange range; VkMappedMemoryRange range = {};
range.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE; range.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE;
range.pNext = nullptr;
range.memory = mMemory.getHandle(); range.memory = mMemory.getHandle();
range.offset = mLastFlushOrInvalidateOffset; range.offset = mLastFlushOrInvalidateOffset;
range.size = mNextAllocationOffset - mLastFlushOrInvalidateOffset; range.size = mNextAllocationOffset - mLastFlushOrInvalidateOffset;
...@@ -317,9 +314,8 @@ angle::Result DynamicDescriptorPool::allocateSets(Context *context, ...@@ -317,9 +314,8 @@ angle::Result DynamicDescriptorPool::allocateSets(Context *context,
ANGLE_TRY(allocateNewPool(context)); ANGLE_TRY(allocateNewPool(context));
} }
VkDescriptorSetAllocateInfo allocInfo; VkDescriptorSetAllocateInfo allocInfo = {};
allocInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO; allocInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
allocInfo.pNext = nullptr;
allocInfo.descriptorPool = mCurrentDescriptorPool.getHandle(); allocInfo.descriptorPool = mCurrentDescriptorPool.getHandle();
allocInfo.descriptorSetCount = descriptorSetCount; allocInfo.descriptorSetCount = descriptorSetCount;
allocInfo.pSetLayouts = descriptorSetLayout; allocInfo.pSetLayouts = descriptorSetLayout;
...@@ -334,9 +330,8 @@ angle::Result DynamicDescriptorPool::allocateSets(Context *context, ...@@ -334,9 +330,8 @@ angle::Result DynamicDescriptorPool::allocateSets(Context *context,
angle::Result DynamicDescriptorPool::allocateNewPool(Context *context) angle::Result DynamicDescriptorPool::allocateNewPool(Context *context)
{ {
VkDescriptorPoolCreateInfo descriptorPoolInfo; VkDescriptorPoolCreateInfo descriptorPoolInfo = {};
descriptorPoolInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO; descriptorPoolInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
descriptorPoolInfo.pNext = nullptr;
descriptorPoolInfo.flags = 0; descriptorPoolInfo.flags = 0;
descriptorPoolInfo.maxSets = mMaxSetsPerPool; descriptorPoolInfo.maxSets = mMaxSetsPerPool;
...@@ -570,9 +565,8 @@ angle::Result ImageHelper::init(Context *context, ...@@ -570,9 +565,8 @@ angle::Result ImageHelper::init(Context *context,
mSamples = samples; mSamples = samples;
mLayerCount = GetImageLayerCount(textureType); mLayerCount = GetImageLayerCount(textureType);
VkImageCreateInfo imageInfo; VkImageCreateInfo imageInfo = {};
imageInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; imageInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
imageInfo.pNext = nullptr;
imageInfo.flags = GetImageCreateFlags(textureType); imageInfo.flags = GetImageCreateFlags(textureType);
imageInfo.imageType = gl_vk::GetImageType(textureType); imageInfo.imageType = gl_vk::GetImageType(textureType);
imageInfo.format = format.vkTextureFormat; imageInfo.format = format.vkTextureFormat;
...@@ -635,9 +629,8 @@ angle::Result ImageHelper::initLayerImageView(Context *context, ...@@ -635,9 +629,8 @@ angle::Result ImageHelper::initLayerImageView(Context *context,
uint32_t baseArrayLayer, uint32_t baseArrayLayer,
uint32_t layerCount) uint32_t layerCount)
{ {
VkImageViewCreateInfo viewInfo; VkImageViewCreateInfo viewInfo = {};
viewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; viewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
viewInfo.pNext = nullptr;
viewInfo.flags = 0; viewInfo.flags = 0;
viewInfo.image = mImage.getHandle(); viewInfo.image = mImage.getHandle();
viewInfo.viewType = gl_vk::GetImageViewType(textureType); viewInfo.viewType = gl_vk::GetImageViewType(textureType);
...@@ -707,9 +700,8 @@ angle::Result ImageHelper::init2DStaging(Context *context, ...@@ -707,9 +700,8 @@ angle::Result ImageHelper::init2DStaging(Context *context,
mCurrentLayout = mCurrentLayout =
usage == StagingUsage::Read ? VK_IMAGE_LAYOUT_UNDEFINED : VK_IMAGE_LAYOUT_PREINITIALIZED; usage == StagingUsage::Read ? VK_IMAGE_LAYOUT_UNDEFINED : VK_IMAGE_LAYOUT_PREINITIALIZED;
VkImageCreateInfo imageInfo; VkImageCreateInfo imageInfo = {};
imageInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; imageInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
imageInfo.pNext = nullptr;
imageInfo.flags = 0; imageInfo.flags = 0;
imageInfo.imageType = VK_IMAGE_TYPE_2D; imageInfo.imageType = VK_IMAGE_TYPE_2D;
imageInfo.format = format.vkTextureFormat; imageInfo.format = format.vkTextureFormat;
...@@ -782,9 +774,8 @@ void ImageHelper::changeLayoutWithStages(VkImageAspectFlags aspectMask, ...@@ -782,9 +774,8 @@ void ImageHelper::changeLayoutWithStages(VkImageAspectFlags aspectMask,
VkPipelineStageFlags dstStageMask, VkPipelineStageFlags dstStageMask,
CommandBuffer *commandBuffer) CommandBuffer *commandBuffer)
{ {
VkImageMemoryBarrier imageMemoryBarrier; VkImageMemoryBarrier imageMemoryBarrier = {};
imageMemoryBarrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; imageMemoryBarrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
imageMemoryBarrier.pNext = nullptr;
imageMemoryBarrier.srcAccessMask = 0; imageMemoryBarrier.srcAccessMask = 0;
imageMemoryBarrier.dstAccessMask = 0; imageMemoryBarrier.dstAccessMask = 0;
imageMemoryBarrier.oldLayout = mCurrentLayout; imageMemoryBarrier.oldLayout = mCurrentLayout;
...@@ -850,7 +841,7 @@ void ImageHelper::clearColorLayer(const VkClearColorValue &color, ...@@ -850,7 +841,7 @@ void ImageHelper::clearColorLayer(const VkClearColorValue &color,
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
commandBuffer); commandBuffer);
VkImageSubresourceRange range; VkImageSubresourceRange range = {};
range.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; range.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
range.baseMipLevel = baseMipLevel; range.baseMipLevel = baseMipLevel;
range.levelCount = levelCount; range.levelCount = levelCount;
...@@ -918,7 +909,7 @@ void ImageHelper::Copy(ImageHelper *srcImage, ...@@ -918,7 +909,7 @@ void ImageHelper::Copy(ImageHelper *srcImage,
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, commandBuffer); VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, commandBuffer);
} }
VkImageCopy region; VkImageCopy region = {};
region.srcSubresource.aspectMask = aspectMask; region.srcSubresource.aspectMask = aspectMask;
region.srcSubresource.mipLevel = 0; region.srcSubresource.mipLevel = 0;
region.srcSubresource.baseArrayLayer = 0; region.srcSubresource.baseArrayLayer = 0;
...@@ -957,12 +948,11 @@ angle::Result ImageHelper::generateMipmapsWithBlit(ContextVk *contextVk, GLuint ...@@ -957,12 +948,11 @@ angle::Result ImageHelper::generateMipmapsWithBlit(ContextVk *contextVk, GLuint
// Manually manage the image memory barrier because it uses a lot more parameters than our // Manually manage the image memory barrier because it uses a lot more parameters than our
// usual one. // usual one.
VkImageMemoryBarrier barrier; VkImageMemoryBarrier barrier = {};
barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
barrier.image = mImage.getHandle(); barrier.image = mImage.getHandle();
barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
barrier.pNext = nullptr;
barrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; barrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
barrier.subresourceRange.baseArrayLayer = 0; barrier.subresourceRange.baseArrayLayer = 0;
barrier.subresourceRange.layerCount = mLayerCount; barrier.subresourceRange.layerCount = mLayerCount;
......
...@@ -104,9 +104,8 @@ angle::Result FindAndAllocateCompatibleMemory(vk::Context *context, ...@@ -104,9 +104,8 @@ angle::Result FindAndAllocateCompatibleMemory(vk::Context *context,
requestedMemoryPropertyFlags, requestedMemoryPropertyFlags,
memoryPropertyFlagsOut, &memoryTypeIndex)); memoryPropertyFlagsOut, &memoryTypeIndex));
VkMemoryAllocateInfo allocInfo; VkMemoryAllocateInfo allocInfo = {};
allocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO; allocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
allocInfo.pNext = nullptr;
allocInfo.memoryTypeIndex = memoryTypeIndex; allocInfo.memoryTypeIndex = memoryTypeIndex;
allocInfo.allocationSize = memoryRequirements.size; allocInfo.allocationSize = memoryRequirements.size;
...@@ -621,7 +620,7 @@ void Image::getSubresourceLayout(VkDevice device, ...@@ -621,7 +620,7 @@ void Image::getSubresourceLayout(VkDevice device,
uint32_t arrayLayer, uint32_t arrayLayer,
VkSubresourceLayout *outSubresourceLayout) const VkSubresourceLayout *outSubresourceLayout) const
{ {
VkImageSubresource subresource; VkImageSubresource subresource = {};
subresource.aspectMask = aspectMask; subresource.aspectMask = aspectMask;
subresource.mipLevel = mipLevel; subresource.mipLevel = mipLevel;
subresource.arrayLayer = arrayLayer; subresource.arrayLayer = arrayLayer;
...@@ -667,9 +666,8 @@ angle::Result Semaphore::init(Context *context) ...@@ -667,9 +666,8 @@ angle::Result Semaphore::init(Context *context)
{ {
ASSERT(!valid()); ASSERT(!valid());
VkSemaphoreCreateInfo semaphoreInfo; VkSemaphoreCreateInfo semaphoreInfo = {};
semaphoreInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO; semaphoreInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
semaphoreInfo.pNext = nullptr;
semaphoreInfo.flags = 0; semaphoreInfo.flags = 0;
ANGLE_VK_TRY(context, ANGLE_VK_TRY(context,
...@@ -1086,9 +1084,8 @@ void StagingBuffer::destroy(VkDevice device) ...@@ -1086,9 +1084,8 @@ void StagingBuffer::destroy(VkDevice device)
angle::Result StagingBuffer::init(Context *context, VkDeviceSize size, StagingUsage usage) angle::Result StagingBuffer::init(Context *context, VkDeviceSize size, StagingUsage usage)
{ {
VkBufferCreateInfo createInfo; VkBufferCreateInfo createInfo = {};
createInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; createInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
createInfo.pNext = nullptr;
createInfo.flags = 0; createInfo.flags = 0;
createInfo.size = size; createInfo.size = size;
createInfo.usage = GetStagingBufferUsageFlags(usage); createInfo.usage = GetStagingBufferUsageFlags(usage);
...@@ -1137,9 +1134,8 @@ angle::Result InitShaderAndSerial(Context *context, ...@@ -1137,9 +1134,8 @@ angle::Result InitShaderAndSerial(Context *context,
const uint32_t *shaderCode, const uint32_t *shaderCode,
size_t shaderCodeSize) size_t shaderCodeSize)
{ {
VkShaderModuleCreateInfo createInfo; VkShaderModuleCreateInfo createInfo = {};
createInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO; createInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
createInfo.pNext = nullptr;
createInfo.flags = 0; createInfo.flags = 0;
createInfo.codeSize = shaderCodeSize; createInfo.codeSize = shaderCodeSize;
createInfo.pCode = shaderCode; createInfo.pCode = shaderCode;
......
...@@ -24,10 +24,9 @@ WindowSurfaceVkWin32::WindowSurfaceVkWin32(const egl::SurfaceState &surfaceState ...@@ -24,10 +24,9 @@ WindowSurfaceVkWin32::WindowSurfaceVkWin32(const egl::SurfaceState &surfaceState
angle::Result WindowSurfaceVkWin32::createSurfaceVk(vk::Context *context, gl::Extents *extentsOut) angle::Result WindowSurfaceVkWin32::createSurfaceVk(vk::Context *context, gl::Extents *extentsOut)
{ {
VkWin32SurfaceCreateInfoKHR createInfo; VkWin32SurfaceCreateInfoKHR createInfo = {};
createInfo.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR; createInfo.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR;
createInfo.pNext = nullptr;
createInfo.flags = 0; createInfo.flags = 0;
createInfo.hinstance = GetModuleHandle(nullptr); createInfo.hinstance = GetModuleHandle(nullptr);
createInfo.hwnd = mNativeWindowType; createInfo.hwnd = mNativeWindowType;
......
...@@ -25,10 +25,9 @@ WindowSurfaceVkXcb::WindowSurfaceVkXcb(const egl::SurfaceState &surfaceState, ...@@ -25,10 +25,9 @@ WindowSurfaceVkXcb::WindowSurfaceVkXcb(const egl::SurfaceState &surfaceState,
angle::Result WindowSurfaceVkXcb::createSurfaceVk(vk::Context *context, gl::Extents *extentsOut) angle::Result WindowSurfaceVkXcb::createSurfaceVk(vk::Context *context, gl::Extents *extentsOut)
{ {
VkXcbSurfaceCreateInfoKHR createInfo; VkXcbSurfaceCreateInfoKHR createInfo = {};
createInfo.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR; createInfo.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR;
createInfo.pNext = nullptr;
createInfo.flags = 0; createInfo.flags = 0;
createInfo.connection = mXcbConnection; createInfo.connection = mXcbConnection;
createInfo.window = mNativeWindowType; createInfo.window = mNativeWindowType;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment