Commit 197005d8 by Tobin Ehlis Committed by Commit Bot

Vulkan: Pass ContextVk to various helpers

This is groundwork for some upcoming changes where data from ContextVk is needed in GraphicsPipelineDesc::initializePipeline(). Passing ContextVk ptr all the way down instead of the reduced vk::Context ptr. Bug: angleproject:2672 Change-Id: I29f580c3503777085355f1b79f4ae4552a394557 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1811433Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCourtney Goeltzenleuchter <courtneygo@google.com> Commit-Queue: Tobin Ehlis <tobine@google.com>
parent db09eb68
......@@ -593,7 +593,7 @@ void GraphicsPipelineDesc::initDefaults()
}
angle::Result GraphicsPipelineDesc::initializePipeline(
vk::Context *context,
ContextVk *contextVk,
const vk::PipelineCache &pipelineCacheVk,
const RenderPass &compatibleRenderPass,
const PipelineLayout &pipelineLayout,
......@@ -682,7 +682,7 @@ angle::Result GraphicsPipelineDesc::initializePipeline(
// Get the corresponding VkFormat for the attrib's format.
angle::FormatID formatID = static_cast<angle::FormatID>(packedAttrib.format);
const vk::Format &format = context->getRenderer()->getFormat(formatID);
const vk::Format &format = contextVk->getRenderer()->getFormat(formatID);
const angle::Format &angleFormat = format.angleFormat();
VkFormat vkFormat = format.vkBufferFormat;
......@@ -855,8 +855,8 @@ angle::Result GraphicsPipelineDesc::initializePipeline(
createInfo.basePipelineHandle = VK_NULL_HANDLE;
createInfo.basePipelineIndex = 0;
ANGLE_VK_TRY(context,
pipelineOut->initGraphics(context->getDevice(), createInfo, pipelineCacheVk));
ANGLE_VK_TRY(contextVk,
pipelineOut->initGraphics(contextVk->getDevice(), createInfo, pipelineCacheVk));
return angle::Result::Continue;
}
......@@ -1592,7 +1592,7 @@ void RenderPassCache::destroy(VkDevice device)
mPayload.clear();
}
angle::Result RenderPassCache::addRenderPass(vk::Context *context,
angle::Result RenderPassCache::addRenderPass(ContextVk *contextVk,
Serial serial,
const vk::RenderPassDesc &desc,
vk::RenderPass **renderPassOut)
......@@ -1623,7 +1623,7 @@ angle::Result RenderPassCache::addRenderPass(vk::Context *context,
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL);
}
return getRenderPassWithOps(context, serial, desc, ops, renderPassOut);
return getRenderPassWithOps(contextVk, serial, desc, ops, renderPassOut);
}
angle::Result RenderPassCache::getRenderPassWithOps(vk::Context *context,
......@@ -1697,7 +1697,7 @@ void GraphicsPipelineCache::release(ContextVk *context)
}
angle::Result GraphicsPipelineCache::insertPipeline(
vk::Context *context,
ContextVk *contextVk,
const vk::PipelineCache &pipelineCacheVk,
const vk::RenderPass &compatibleRenderPass,
const vk::PipelineLayout &pipelineLayout,
......@@ -1712,10 +1712,10 @@ angle::Result GraphicsPipelineCache::insertPipeline(
vk::Pipeline newPipeline;
// This "if" is left here for the benefit of VulkanPipelineCachePerfTest.
if (context != nullptr)
if (contextVk != nullptr)
{
context->getRenderer()->onNewGraphicsPipeline();
ANGLE_TRY(desc.initializePipeline(context, pipelineCacheVk, compatibleRenderPass,
contextVk->getRenderer()->onNewGraphicsPipeline();
ANGLE_TRY(desc.initializePipeline(contextVk, pipelineCacheVk, compatibleRenderPass,
pipelineLayout, activeAttribLocationsMask,
programAttribsTypeMask, vertexModule, fragmentModule,
&newPipeline));
......
......@@ -356,7 +356,7 @@ class GraphicsPipelineDesc final
return reinterpret_cast<const T *>(this);
}
angle::Result initializePipeline(vk::Context *context,
angle::Result initializePipeline(ContextVk *contextVk,
const vk::PipelineCache &pipelineCacheVk,
const RenderPass &compatibleRenderPass,
const PipelineLayout &pipelineLayout,
......@@ -768,7 +768,7 @@ class RenderPassCache final : angle::NonCopyable
void destroy(VkDevice device);
ANGLE_INLINE angle::Result getCompatibleRenderPass(vk::Context *context,
ANGLE_INLINE angle::Result getCompatibleRenderPass(ContextVk *contextVk,
Serial serial,
const vk::RenderPassDesc &desc,
vk::RenderPass **renderPassOut)
......@@ -785,7 +785,7 @@ class RenderPassCache final : angle::NonCopyable
return angle::Result::Continue;
}
return addRenderPass(context, serial, desc, renderPassOut);
return addRenderPass(contextVk, serial, desc, renderPassOut);
}
angle::Result getRenderPassWithOps(vk::Context *context,
......@@ -795,7 +795,7 @@ class RenderPassCache final : angle::NonCopyable
vk::RenderPass **renderPassOut);
private:
angle::Result addRenderPass(vk::Context *context,
angle::Result addRenderPass(ContextVk *contextVk,
Serial serial,
const vk::RenderPassDesc &desc,
vk::RenderPass **renderPassOut);
......@@ -820,7 +820,7 @@ class GraphicsPipelineCache final : angle::NonCopyable
void populate(const vk::GraphicsPipelineDesc &desc, vk::Pipeline &&pipeline);
ANGLE_INLINE angle::Result getPipeline(vk::Context *context,
ANGLE_INLINE angle::Result getPipeline(ContextVk *contextVk,
const vk::PipelineCache &pipelineCacheVk,
const vk::RenderPass &compatibleRenderPass,
const vk::PipelineLayout &pipelineLayout,
......@@ -840,13 +840,13 @@ class GraphicsPipelineCache final : angle::NonCopyable
return angle::Result::Continue;
}
return insertPipeline(context, pipelineCacheVk, compatibleRenderPass, pipelineLayout,
return insertPipeline(contextVk, pipelineCacheVk, compatibleRenderPass, pipelineLayout,
activeAttribLocationsMask, programAttribsTypeMask, vertexModule,
fragmentModule, desc, descPtrOut, pipelineOut);
}
private:
angle::Result insertPipeline(vk::Context *context,
angle::Result insertPipeline(ContextVk *contextVk,
const vk::PipelineCache &pipelineCacheVk,
const vk::RenderPass &compatibleRenderPass,
const vk::PipelineLayout &pipelineLayout,
......
......@@ -1010,7 +1010,7 @@ class ShaderProgramHelper : angle::NonCopyable
// For getting a vk::Pipeline and from the pipeline cache.
ANGLE_INLINE angle::Result getGraphicsPipeline(
Context *context,
ContextVk *contextVk,
RenderPassCache *renderPassCache,
const PipelineCache &pipelineCache,
Serial currentQueueSerial,
......@@ -1023,15 +1023,16 @@ class ShaderProgramHelper : angle::NonCopyable
{
// Pull in a compatible RenderPass.
vk::RenderPass *compatibleRenderPass = nullptr;
ANGLE_TRY(renderPassCache->getCompatibleRenderPass(
context, currentQueueSerial, pipelineDesc.getRenderPassDesc(), &compatibleRenderPass));
ANGLE_TRY(renderPassCache->getCompatibleRenderPass(contextVk, currentQueueSerial,
pipelineDesc.getRenderPassDesc(),
&compatibleRenderPass));
ShaderModule *vertexShader = &mShaders[gl::ShaderType::Vertex].get().get();
ShaderModule *fragmentShader = mShaders[gl::ShaderType::Fragment].valid()
? &mShaders[gl::ShaderType::Fragment].get().get()
: nullptr;
return mGraphicsPipelines.getPipeline(context, pipelineCache, *compatibleRenderPass,
return mGraphicsPipelines.getPipeline(contextVk, pipelineCache, *compatibleRenderPass,
pipelineLayout, activeAttribLocationsMask,
programAttribsTypeMask, vertexShader, fragmentShader,
pipelineDesc, descPtrOut, pipelineOut);
......
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