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() ...@@ -593,7 +593,7 @@ void GraphicsPipelineDesc::initDefaults()
} }
angle::Result GraphicsPipelineDesc::initializePipeline( angle::Result GraphicsPipelineDesc::initializePipeline(
vk::Context *context, ContextVk *contextVk,
const vk::PipelineCache &pipelineCacheVk, const vk::PipelineCache &pipelineCacheVk,
const RenderPass &compatibleRenderPass, const RenderPass &compatibleRenderPass,
const PipelineLayout &pipelineLayout, const PipelineLayout &pipelineLayout,
...@@ -682,7 +682,7 @@ angle::Result GraphicsPipelineDesc::initializePipeline( ...@@ -682,7 +682,7 @@ angle::Result GraphicsPipelineDesc::initializePipeline(
// Get the corresponding VkFormat for the attrib's format. // Get the corresponding VkFormat for the attrib's format.
angle::FormatID formatID = static_cast<angle::FormatID>(packedAttrib.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(); const angle::Format &angleFormat = format.angleFormat();
VkFormat vkFormat = format.vkBufferFormat; VkFormat vkFormat = format.vkBufferFormat;
...@@ -855,8 +855,8 @@ angle::Result GraphicsPipelineDesc::initializePipeline( ...@@ -855,8 +855,8 @@ angle::Result GraphicsPipelineDesc::initializePipeline(
createInfo.basePipelineHandle = VK_NULL_HANDLE; createInfo.basePipelineHandle = VK_NULL_HANDLE;
createInfo.basePipelineIndex = 0; createInfo.basePipelineIndex = 0;
ANGLE_VK_TRY(context, ANGLE_VK_TRY(contextVk,
pipelineOut->initGraphics(context->getDevice(), createInfo, pipelineCacheVk)); pipelineOut->initGraphics(contextVk->getDevice(), createInfo, pipelineCacheVk));
return angle::Result::Continue; return angle::Result::Continue;
} }
...@@ -1592,7 +1592,7 @@ void RenderPassCache::destroy(VkDevice device) ...@@ -1592,7 +1592,7 @@ void RenderPassCache::destroy(VkDevice device)
mPayload.clear(); mPayload.clear();
} }
angle::Result RenderPassCache::addRenderPass(vk::Context *context, angle::Result RenderPassCache::addRenderPass(ContextVk *contextVk,
Serial serial, Serial serial,
const vk::RenderPassDesc &desc, const vk::RenderPassDesc &desc,
vk::RenderPass **renderPassOut) vk::RenderPass **renderPassOut)
...@@ -1623,7 +1623,7 @@ angle::Result RenderPassCache::addRenderPass(vk::Context *context, ...@@ -1623,7 +1623,7 @@ angle::Result RenderPassCache::addRenderPass(vk::Context *context,
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL); 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, angle::Result RenderPassCache::getRenderPassWithOps(vk::Context *context,
...@@ -1697,7 +1697,7 @@ void GraphicsPipelineCache::release(ContextVk *context) ...@@ -1697,7 +1697,7 @@ void GraphicsPipelineCache::release(ContextVk *context)
} }
angle::Result GraphicsPipelineCache::insertPipeline( angle::Result GraphicsPipelineCache::insertPipeline(
vk::Context *context, ContextVk *contextVk,
const vk::PipelineCache &pipelineCacheVk, const vk::PipelineCache &pipelineCacheVk,
const vk::RenderPass &compatibleRenderPass, const vk::RenderPass &compatibleRenderPass,
const vk::PipelineLayout &pipelineLayout, const vk::PipelineLayout &pipelineLayout,
...@@ -1712,10 +1712,10 @@ angle::Result GraphicsPipelineCache::insertPipeline( ...@@ -1712,10 +1712,10 @@ angle::Result GraphicsPipelineCache::insertPipeline(
vk::Pipeline newPipeline; vk::Pipeline newPipeline;
// This "if" is left here for the benefit of VulkanPipelineCachePerfTest. // This "if" is left here for the benefit of VulkanPipelineCachePerfTest.
if (context != nullptr) if (contextVk != nullptr)
{ {
context->getRenderer()->onNewGraphicsPipeline(); contextVk->getRenderer()->onNewGraphicsPipeline();
ANGLE_TRY(desc.initializePipeline(context, pipelineCacheVk, compatibleRenderPass, ANGLE_TRY(desc.initializePipeline(contextVk, pipelineCacheVk, compatibleRenderPass,
pipelineLayout, activeAttribLocationsMask, pipelineLayout, activeAttribLocationsMask,
programAttribsTypeMask, vertexModule, fragmentModule, programAttribsTypeMask, vertexModule, fragmentModule,
&newPipeline)); &newPipeline));
......
...@@ -356,7 +356,7 @@ class GraphicsPipelineDesc final ...@@ -356,7 +356,7 @@ class GraphicsPipelineDesc final
return reinterpret_cast<const T *>(this); return reinterpret_cast<const T *>(this);
} }
angle::Result initializePipeline(vk::Context *context, angle::Result initializePipeline(ContextVk *contextVk,
const vk::PipelineCache &pipelineCacheVk, const vk::PipelineCache &pipelineCacheVk,
const RenderPass &compatibleRenderPass, const RenderPass &compatibleRenderPass,
const PipelineLayout &pipelineLayout, const PipelineLayout &pipelineLayout,
...@@ -768,7 +768,7 @@ class RenderPassCache final : angle::NonCopyable ...@@ -768,7 +768,7 @@ class RenderPassCache final : angle::NonCopyable
void destroy(VkDevice device); void destroy(VkDevice device);
ANGLE_INLINE angle::Result getCompatibleRenderPass(vk::Context *context, ANGLE_INLINE angle::Result getCompatibleRenderPass(ContextVk *contextVk,
Serial serial, Serial serial,
const vk::RenderPassDesc &desc, const vk::RenderPassDesc &desc,
vk::RenderPass **renderPassOut) vk::RenderPass **renderPassOut)
...@@ -785,7 +785,7 @@ class RenderPassCache final : angle::NonCopyable ...@@ -785,7 +785,7 @@ class RenderPassCache final : angle::NonCopyable
return angle::Result::Continue; return angle::Result::Continue;
} }
return addRenderPass(context, serial, desc, renderPassOut); return addRenderPass(contextVk, serial, desc, renderPassOut);
} }
angle::Result getRenderPassWithOps(vk::Context *context, angle::Result getRenderPassWithOps(vk::Context *context,
...@@ -795,7 +795,7 @@ class RenderPassCache final : angle::NonCopyable ...@@ -795,7 +795,7 @@ class RenderPassCache final : angle::NonCopyable
vk::RenderPass **renderPassOut); vk::RenderPass **renderPassOut);
private: private:
angle::Result addRenderPass(vk::Context *context, angle::Result addRenderPass(ContextVk *contextVk,
Serial serial, Serial serial,
const vk::RenderPassDesc &desc, const vk::RenderPassDesc &desc,
vk::RenderPass **renderPassOut); vk::RenderPass **renderPassOut);
...@@ -820,7 +820,7 @@ class GraphicsPipelineCache final : angle::NonCopyable ...@@ -820,7 +820,7 @@ class GraphicsPipelineCache final : angle::NonCopyable
void populate(const vk::GraphicsPipelineDesc &desc, vk::Pipeline &&pipeline); 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::PipelineCache &pipelineCacheVk,
const vk::RenderPass &compatibleRenderPass, const vk::RenderPass &compatibleRenderPass,
const vk::PipelineLayout &pipelineLayout, const vk::PipelineLayout &pipelineLayout,
...@@ -840,13 +840,13 @@ class GraphicsPipelineCache final : angle::NonCopyable ...@@ -840,13 +840,13 @@ class GraphicsPipelineCache final : angle::NonCopyable
return angle::Result::Continue; return angle::Result::Continue;
} }
return insertPipeline(context, pipelineCacheVk, compatibleRenderPass, pipelineLayout, return insertPipeline(contextVk, pipelineCacheVk, compatibleRenderPass, pipelineLayout,
activeAttribLocationsMask, programAttribsTypeMask, vertexModule, activeAttribLocationsMask, programAttribsTypeMask, vertexModule,
fragmentModule, desc, descPtrOut, pipelineOut); fragmentModule, desc, descPtrOut, pipelineOut);
} }
private: private:
angle::Result insertPipeline(vk::Context *context, angle::Result insertPipeline(ContextVk *contextVk,
const vk::PipelineCache &pipelineCacheVk, const vk::PipelineCache &pipelineCacheVk,
const vk::RenderPass &compatibleRenderPass, const vk::RenderPass &compatibleRenderPass,
const vk::PipelineLayout &pipelineLayout, const vk::PipelineLayout &pipelineLayout,
......
...@@ -1010,7 +1010,7 @@ class ShaderProgramHelper : angle::NonCopyable ...@@ -1010,7 +1010,7 @@ class ShaderProgramHelper : angle::NonCopyable
// For getting a vk::Pipeline and from the pipeline cache. // For getting a vk::Pipeline and from the pipeline cache.
ANGLE_INLINE angle::Result getGraphicsPipeline( ANGLE_INLINE angle::Result getGraphicsPipeline(
Context *context, ContextVk *contextVk,
RenderPassCache *renderPassCache, RenderPassCache *renderPassCache,
const PipelineCache &pipelineCache, const PipelineCache &pipelineCache,
Serial currentQueueSerial, Serial currentQueueSerial,
...@@ -1023,15 +1023,16 @@ class ShaderProgramHelper : angle::NonCopyable ...@@ -1023,15 +1023,16 @@ class ShaderProgramHelper : angle::NonCopyable
{ {
// Pull in a compatible RenderPass. // Pull in a compatible RenderPass.
vk::RenderPass *compatibleRenderPass = nullptr; vk::RenderPass *compatibleRenderPass = nullptr;
ANGLE_TRY(renderPassCache->getCompatibleRenderPass( ANGLE_TRY(renderPassCache->getCompatibleRenderPass(contextVk, currentQueueSerial,
context, currentQueueSerial, pipelineDesc.getRenderPassDesc(), &compatibleRenderPass)); pipelineDesc.getRenderPassDesc(),
&compatibleRenderPass));
ShaderModule *vertexShader = &mShaders[gl::ShaderType::Vertex].get().get(); ShaderModule *vertexShader = &mShaders[gl::ShaderType::Vertex].get().get();
ShaderModule *fragmentShader = mShaders[gl::ShaderType::Fragment].valid() ShaderModule *fragmentShader = mShaders[gl::ShaderType::Fragment].valid()
? &mShaders[gl::ShaderType::Fragment].get().get() ? &mShaders[gl::ShaderType::Fragment].get().get()
: nullptr; : nullptr;
return mGraphicsPipelines.getPipeline(context, pipelineCache, *compatibleRenderPass, return mGraphicsPipelines.getPipeline(contextVk, pipelineCache, *compatibleRenderPass,
pipelineLayout, activeAttribLocationsMask, pipelineLayout, activeAttribLocationsMask,
programAttribsTypeMask, vertexShader, fragmentShader, programAttribsTypeMask, vertexShader, fragmentShader,
pipelineDesc, descPtrOut, pipelineOut); 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