Vulkan: Rename PipelineDesc/Cache to Graphics&
PipelineDesc describes a Vertex-Fragment pipeline and PipelineCache (not
to be confused with vk::PipelineCache) implements a cache of such
pipeline objects.
In preparation for Compute support, these data structures are prefixed
with Graphics.
Bug: angleproject:2959
Change-Id: I9181586fb946b787216ca0b2ad6340f90c3ab55f
Reviewed-on: https://chromium-review.googlesource.com/c/1333971
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/ContextVk.cpp b/src/libANGLE/renderer/vulkan/ContextVk.cpp
index 6bcb740..6669ece 100644
--- a/src/libANGLE/renderer/vulkan/ContextVk.cpp
+++ b/src/libANGLE/renderer/vulkan/ContextVk.cpp
@@ -210,8 +210,8 @@
mRenderer->getPhysicalDeviceProperties().limits.minUniformBufferOffsetAlignment);
mDriverUniformsBuffer.init(minAlignment, mRenderer);
- mPipelineDesc.reset(new vk::PipelineDesc());
- mPipelineDesc->initDefaults();
+ mGraphicsPipelineDesc.reset(new vk::GraphicsPipelineDesc());
+ mGraphicsPipelineDesc->initDefaults();
// Initialize current value/default attribute buffers.
for (vk::DynamicBuffer &buffer : mDefaultAttribBuffers)
@@ -240,13 +240,13 @@
mProgram->getState().getActiveAttribLocationsMask();
// Ensure the topology of the pipeline description is updated.
- mPipelineDesc->updateTopology(mCurrentDrawMode);
+ mGraphicsPipelineDesc->updateTopology(mCurrentDrawMode);
// Copy over the latest attrib and binding descriptions.
- mVertexArray->getPackedInputDescriptions(mPipelineDesc.get());
+ mVertexArray->getPackedInputDescriptions(mGraphicsPipelineDesc.get());
// Ensure that the RenderPass description is updated.
- mPipelineDesc->updateRenderPassDesc(mDrawFramebuffer->getRenderPassDesc());
+ mGraphicsPipelineDesc->updateRenderPassDesc(mDrawFramebuffer->getRenderPassDesc());
// Trigger draw call shader patching and fill out the pipeline desc.
const vk::ShaderAndSerial *vertexShaderAndSerial = nullptr;
@@ -255,12 +255,12 @@
ANGLE_TRY(mProgram->initShaders(this, mCurrentDrawMode, &vertexShaderAndSerial,
&fragmentShaderAndSerial, &pipelineLayout));
- mPipelineDesc->updateShaders(vertexShaderAndSerial->getSerial(),
- fragmentShaderAndSerial->getSerial());
+ mGraphicsPipelineDesc->updateShaders(vertexShaderAndSerial->getSerial(),
+ fragmentShaderAndSerial->getSerial());
ANGLE_TRY(mRenderer->getPipeline(this, *vertexShaderAndSerial, *fragmentShaderAndSerial,
- *pipelineLayout, *mPipelineDesc, activeAttribLocationsMask,
- &mCurrentPipeline));
+ *pipelineLayout, *mGraphicsPipelineDesc,
+ activeAttribLocationsMask, &mCurrentPipeline));
return angle::Result::Continue();
}
@@ -651,8 +651,8 @@
blendState.colorMaskBlue, blendState.colorMaskAlpha);
FramebufferVk *framebufferVk = vk::GetImpl(mState.getState().getDrawFramebuffer());
- mPipelineDesc->updateColorWriteMask(mClearColorMask,
- framebufferVk->getEmulatedAlphaAttachmentMask());
+ mGraphicsPipelineDesc->updateColorWriteMask(mClearColorMask,
+ framebufferVk->getEmulatedAlphaAttachmentMask());
}
void ContextVk::updateViewport(FramebufferVk *framebufferVk,
@@ -717,16 +717,16 @@
updateDepthRange(glState.getNearPlane(), glState.getFarPlane());
break;
case gl::State::DIRTY_BIT_BLEND_ENABLED:
- mPipelineDesc->updateBlendEnabled(glState.isBlendEnabled());
+ mGraphicsPipelineDesc->updateBlendEnabled(glState.isBlendEnabled());
break;
case gl::State::DIRTY_BIT_BLEND_COLOR:
- mPipelineDesc->updateBlendColor(glState.getBlendColor());
+ mGraphicsPipelineDesc->updateBlendColor(glState.getBlendColor());
break;
case gl::State::DIRTY_BIT_BLEND_FUNCS:
- mPipelineDesc->updateBlendFuncs(glState.getBlendState());
+ mGraphicsPipelineDesc->updateBlendFuncs(glState.getBlendState());
break;
case gl::State::DIRTY_BIT_BLEND_EQUATIONS:
- mPipelineDesc->updateBlendEquations(glState.getBlendState());
+ mGraphicsPipelineDesc->updateBlendEquations(glState.getBlendState());
break;
case gl::State::DIRTY_BIT_COLOR_MASK:
updateColorMask(glState.getBlendState());
@@ -742,60 +742,61 @@
case gl::State::DIRTY_BIT_SAMPLE_MASK:
break;
case gl::State::DIRTY_BIT_DEPTH_TEST_ENABLED:
- mPipelineDesc->updateDepthTestEnabled(glState.getDepthStencilState(),
- glState.getDrawFramebuffer());
+ mGraphicsPipelineDesc->updateDepthTestEnabled(glState.getDepthStencilState(),
+ glState.getDrawFramebuffer());
break;
case gl::State::DIRTY_BIT_DEPTH_FUNC:
- mPipelineDesc->updateDepthFunc(glState.getDepthStencilState());
+ mGraphicsPipelineDesc->updateDepthFunc(glState.getDepthStencilState());
break;
case gl::State::DIRTY_BIT_DEPTH_MASK:
- mPipelineDesc->updateDepthWriteEnabled(glState.getDepthStencilState(),
- glState.getDrawFramebuffer());
+ mGraphicsPipelineDesc->updateDepthWriteEnabled(glState.getDepthStencilState(),
+ glState.getDrawFramebuffer());
break;
case gl::State::DIRTY_BIT_STENCIL_TEST_ENABLED:
- mPipelineDesc->updateStencilTestEnabled(glState.getDepthStencilState(),
- glState.getDrawFramebuffer());
+ mGraphicsPipelineDesc->updateStencilTestEnabled(glState.getDepthStencilState(),
+ glState.getDrawFramebuffer());
break;
case gl::State::DIRTY_BIT_STENCIL_FUNCS_FRONT:
- mPipelineDesc->updateStencilFrontFuncs(glState.getStencilRef(),
- glState.getDepthStencilState());
+ mGraphicsPipelineDesc->updateStencilFrontFuncs(glState.getStencilRef(),
+ glState.getDepthStencilState());
break;
case gl::State::DIRTY_BIT_STENCIL_FUNCS_BACK:
- mPipelineDesc->updateStencilBackFuncs(glState.getStencilBackRef(),
- glState.getDepthStencilState());
+ mGraphicsPipelineDesc->updateStencilBackFuncs(glState.getStencilBackRef(),
+ glState.getDepthStencilState());
break;
case gl::State::DIRTY_BIT_STENCIL_OPS_FRONT:
- mPipelineDesc->updateStencilFrontOps(glState.getDepthStencilState());
+ mGraphicsPipelineDesc->updateStencilFrontOps(glState.getDepthStencilState());
break;
case gl::State::DIRTY_BIT_STENCIL_OPS_BACK:
- mPipelineDesc->updateStencilBackOps(glState.getDepthStencilState());
+ mGraphicsPipelineDesc->updateStencilBackOps(glState.getDepthStencilState());
break;
case gl::State::DIRTY_BIT_STENCIL_WRITEMASK_FRONT:
- mPipelineDesc->updateStencilFrontWriteMask(glState.getDepthStencilState(),
- glState.getDrawFramebuffer());
+ mGraphicsPipelineDesc->updateStencilFrontWriteMask(glState.getDepthStencilState(),
+ glState.getDrawFramebuffer());
break;
case gl::State::DIRTY_BIT_STENCIL_WRITEMASK_BACK:
- mPipelineDesc->updateStencilBackWriteMask(glState.getDepthStencilState(),
- glState.getDrawFramebuffer());
+ mGraphicsPipelineDesc->updateStencilBackWriteMask(glState.getDepthStencilState(),
+ glState.getDrawFramebuffer());
break;
case gl::State::DIRTY_BIT_CULL_FACE_ENABLED:
case gl::State::DIRTY_BIT_CULL_FACE:
- mPipelineDesc->updateCullMode(glState.getRasterizerState());
+ mGraphicsPipelineDesc->updateCullMode(glState.getRasterizerState());
break;
case gl::State::DIRTY_BIT_FRONT_FACE:
- mPipelineDesc->updateFrontFace(glState.getRasterizerState(),
- isViewportFlipEnabledForDrawFBO());
+ mGraphicsPipelineDesc->updateFrontFace(glState.getRasterizerState(),
+ isViewportFlipEnabledForDrawFBO());
break;
case gl::State::DIRTY_BIT_POLYGON_OFFSET_FILL_ENABLED:
- mPipelineDesc->updatePolygonOffsetFillEnabled(glState.isPolygonOffsetFillEnabled());
+ mGraphicsPipelineDesc->updatePolygonOffsetFillEnabled(
+ glState.isPolygonOffsetFillEnabled());
break;
case gl::State::DIRTY_BIT_POLYGON_OFFSET:
- mPipelineDesc->updatePolygonOffset(glState.getRasterizerState());
+ mGraphicsPipelineDesc->updatePolygonOffset(glState.getRasterizerState());
break;
case gl::State::DIRTY_BIT_RASTERIZER_DISCARD_ENABLED:
break;
case gl::State::DIRTY_BIT_LINE_WIDTH:
- mPipelineDesc->updateLineWidth(glState.getLineWidth());
+ mGraphicsPipelineDesc->updateLineWidth(glState.getLineWidth());
break;
case gl::State::DIRTY_BIT_PRIMITIVE_RESTART_ENABLED:
break;
@@ -840,18 +841,18 @@
updateViewport(mDrawFramebuffer, glState.getViewport(), glState.getNearPlane(),
glState.getFarPlane(), isViewportFlipEnabledForDrawFBO());
updateColorMask(glState.getBlendState());
- mPipelineDesc->updateCullMode(glState.getRasterizerState());
+ mGraphicsPipelineDesc->updateCullMode(glState.getRasterizerState());
updateScissor(glState);
- mPipelineDesc->updateDepthTestEnabled(glState.getDepthStencilState(),
- glState.getDrawFramebuffer());
- mPipelineDesc->updateDepthWriteEnabled(glState.getDepthStencilState(),
- glState.getDrawFramebuffer());
- mPipelineDesc->updateStencilTestEnabled(glState.getDepthStencilState(),
- glState.getDrawFramebuffer());
- mPipelineDesc->updateStencilFrontWriteMask(glState.getDepthStencilState(),
- glState.getDrawFramebuffer());
- mPipelineDesc->updateStencilBackWriteMask(glState.getDepthStencilState(),
- glState.getDrawFramebuffer());
+ mGraphicsPipelineDesc->updateDepthTestEnabled(glState.getDepthStencilState(),
+ glState.getDrawFramebuffer());
+ mGraphicsPipelineDesc->updateDepthWriteEnabled(glState.getDepthStencilState(),
+ glState.getDrawFramebuffer());
+ mGraphicsPipelineDesc->updateStencilTestEnabled(glState.getDepthStencilState(),
+ glState.getDrawFramebuffer());
+ mGraphicsPipelineDesc->updateStencilFrontWriteMask(glState.getDepthStencilState(),
+ glState.getDrawFramebuffer());
+ mGraphicsPipelineDesc->updateStencilBackWriteMask(glState.getDepthStencilState(),
+ glState.getDrawFramebuffer());
break;
}
case gl::State::DIRTY_BIT_RENDERBUFFER_BINDING:
diff --git a/src/libANGLE/renderer/vulkan/ContextVk.h b/src/libANGLE/renderer/vulkan/ContextVk.h
index 45f3854..e6eba1c 100644
--- a/src/libANGLE/renderer/vulkan/ContextVk.h
+++ b/src/libANGLE/renderer/vulkan/ContextVk.h
@@ -267,7 +267,7 @@
// Keep a cached pipeline description structure that can be used to query the pipeline cache.
// Kept in a pointer so allocations can be aligned, and structs can be portably packed.
- std::unique_ptr<vk::PipelineDesc> mPipelineDesc;
+ std::unique_ptr<vk::GraphicsPipelineDesc> mGraphicsPipelineDesc;
// The descriptor pools are externally sychronized, so cannot be accessed from different
// threads simultaneously. Hence, we keep them in the ContextVk instead of the RendererVk.
diff --git a/src/libANGLE/renderer/vulkan/FramebufferVk.cpp b/src/libANGLE/renderer/vulkan/FramebufferVk.cpp
index e230ad2..771bd7e 100644
--- a/src/libANGLE/renderer/vulkan/FramebufferVk.cpp
+++ b/src/libANGLE/renderer/vulkan/FramebufferVk.cpp
@@ -1043,7 +1043,7 @@
bool invertViewport = contextVk->isViewportFlipEnabledForDrawFBO();
// This pipeline desc could be cached.
- vk::PipelineDesc pipelineDesc;
+ vk::GraphicsPipelineDesc pipelineDesc;
pipelineDesc.initDefaults();
pipelineDesc.updateColorWriteMask(colorMaskFlags, getEmulatedAlphaAttachmentMask());
pipelineDesc.updateRenderPassDesc(getRenderPassDesc());
diff --git a/src/libANGLE/renderer/vulkan/RendererVk.cpp b/src/libANGLE/renderer/vulkan/RendererVk.cpp
index dba99da..6f17445 100644
--- a/src/libANGLE/renderer/vulkan/RendererVk.cpp
+++ b/src/libANGLE/renderer/vulkan/RendererVk.cpp
@@ -330,7 +330,7 @@
mDescriptorSetLayoutCache.destroy(mDevice);
mRenderPassCache.destroy(mDevice);
- mPipelineCache.destroy(mDevice);
+ mGraphicsPipelineCache.destroy(mDevice);
mPipelineCacheVk.destroy(mDevice);
mSubmitSemaphorePool.destroy(mDevice);
mShaderLibrary.destroy(mDevice);
@@ -1143,7 +1143,7 @@
const vk::ShaderAndSerial &vertexShader,
const vk::ShaderAndSerial &fragmentShader,
const vk::PipelineLayout &pipelineLayout,
- const vk::PipelineDesc &pipelineDesc,
+ const vk::GraphicsPipelineDesc &pipelineDesc,
const gl::AttributesMask &activeAttribLocationsMask,
vk::PipelineAndSerial **pipelineOut)
{
@@ -1157,9 +1157,9 @@
ANGLE_TRY(
getCompatibleRenderPass(context, pipelineDesc.getRenderPassDesc(), &compatibleRenderPass));
- return mPipelineCache.getPipeline(context, mPipelineCacheVk, *compatibleRenderPass,
- pipelineLayout, activeAttribLocationsMask, vertexShader.get(),
- fragmentShader.get(), pipelineDesc, pipelineOut);
+ return mGraphicsPipelineCache.getPipeline(
+ context, mPipelineCacheVk, *compatibleRenderPass, pipelineLayout, activeAttribLocationsMask,
+ vertexShader.get(), fragmentShader.get(), pipelineDesc, pipelineOut);
}
angle::Result RendererVk::getDescriptorSetLayout(
diff --git a/src/libANGLE/renderer/vulkan/RendererVk.h b/src/libANGLE/renderer/vulkan/RendererVk.h
index df9b95e..99f163e 100644
--- a/src/libANGLE/renderer/vulkan/RendererVk.h
+++ b/src/libANGLE/renderer/vulkan/RendererVk.h
@@ -136,7 +136,7 @@
const vk::ShaderAndSerial &vertexShader,
const vk::ShaderAndSerial &fragmentShader,
const vk::PipelineLayout &pipelineLayout,
- const vk::PipelineDesc &pipelineDesc,
+ const vk::GraphicsPipelineDesc &pipelineDesc,
const gl::AttributesMask &activeAttribLocationsMask,
vk::PipelineAndSerial **pipelineOut);
@@ -269,7 +269,7 @@
vk::FormatTable mFormatTable;
RenderPassCache mRenderPassCache;
- PipelineCache mPipelineCache;
+ GraphicsPipelineCache mGraphicsPipelineCache;
vk::PipelineCache mPipelineCacheVk;
egl::BlobCache::Key mPipelineCacheVkBlobKey;
diff --git a/src/libANGLE/renderer/vulkan/VertexArrayVk.cpp b/src/libANGLE/renderer/vulkan/VertexArrayVk.cpp
index 3748816..bb13ae8 100644
--- a/src/libANGLE/renderer/vulkan/VertexArrayVk.cpp
+++ b/src/libANGLE/renderer/vulkan/VertexArrayVk.cpp
@@ -367,7 +367,7 @@
return angle::Result::Continue();
}
-void VertexArrayVk::getPackedInputDescriptions(vk::PipelineDesc *pipelineDesc)
+void VertexArrayVk::getPackedInputDescriptions(vk::GraphicsPipelineDesc *pipelineDesc)
{
updatePackedInputDescriptions();
pipelineDesc->updateVertexInputInfo(mPackedInputBindings, mPackedInputAttributes);
diff --git a/src/libANGLE/renderer/vulkan/VertexArrayVk.h b/src/libANGLE/renderer/vulkan/VertexArrayVk.h
index 1fbd7f4..8cc606e 100644
--- a/src/libANGLE/renderer/vulkan/VertexArrayVk.h
+++ b/src/libANGLE/renderer/vulkan/VertexArrayVk.h
@@ -36,7 +36,7 @@
const gl::VertexArray::DirtyAttribBitsArray &attribBits,
const gl::VertexArray::DirtyBindingBitsArray &bindingBits) override;
- void getPackedInputDescriptions(vk::PipelineDesc *pipelineDesc);
+ void getPackedInputDescriptions(vk::GraphicsPipelineDesc *pipelineDesc);
void updateDefaultAttrib(RendererVk *renderer,
size_t attribIndex,
diff --git a/src/libANGLE/renderer/vulkan/vk_cache_utils.cpp b/src/libANGLE/renderer/vulkan/vk_cache_utils.cpp
index 75f6b8e..8821b30 100644
--- a/src/libANGLE/renderer/vulkan/vk_cache_utils.cpp
+++ b/src/libANGLE/renderer/vulkan/vk_cache_utils.cpp
@@ -347,49 +347,49 @@
return (memcmp(&lhs, &rhs, sizeof(RenderPassDesc)) == 0);
}
-// PipelineDesc implementation.
+// GraphicsPipelineDesc implementation.
// Use aligned allocation and free so we can use the alignas keyword.
-void *PipelineDesc::operator new(std::size_t size)
+void *GraphicsPipelineDesc::operator new(std::size_t size)
{
return angle::AlignedAlloc(size, 32);
}
-void PipelineDesc::operator delete(void *ptr)
+void GraphicsPipelineDesc::operator delete(void *ptr)
{
return angle::AlignedFree(ptr);
}
-PipelineDesc::PipelineDesc()
+GraphicsPipelineDesc::GraphicsPipelineDesc()
{
- memset(this, 0, sizeof(PipelineDesc));
+ memset(this, 0, sizeof(GraphicsPipelineDesc));
}
-PipelineDesc::~PipelineDesc() = default;
+GraphicsPipelineDesc::~GraphicsPipelineDesc() = default;
-PipelineDesc::PipelineDesc(const PipelineDesc &other)
+GraphicsPipelineDesc::GraphicsPipelineDesc(const GraphicsPipelineDesc &other)
{
- memcpy(this, &other, sizeof(PipelineDesc));
+ memcpy(this, &other, sizeof(GraphicsPipelineDesc));
}
-PipelineDesc &PipelineDesc::operator=(const PipelineDesc &other)
+GraphicsPipelineDesc &GraphicsPipelineDesc::operator=(const GraphicsPipelineDesc &other)
{
- memcpy(this, &other, sizeof(PipelineDesc));
+ memcpy(this, &other, sizeof(GraphicsPipelineDesc));
return *this;
}
-size_t PipelineDesc::hash() const
+size_t GraphicsPipelineDesc::hash() const
{
return angle::ComputeGenericHash(*this);
}
-bool PipelineDesc::operator==(const PipelineDesc &other) const
+bool GraphicsPipelineDesc::operator==(const GraphicsPipelineDesc &other) const
{
- return (memcmp(this, &other, sizeof(PipelineDesc)) == 0);
+ return (memcmp(this, &other, sizeof(GraphicsPipelineDesc)) == 0);
}
// TODO(jmadill): We should prefer using Packed GLenums. http://anglebug.com/2169
-void PipelineDesc::initDefaults()
+void GraphicsPipelineDesc::initDefaults()
{
mRasterizationAndMultisampleStateInfo.depthClampEnable = 0;
mRasterizationAndMultisampleStateInfo.rasterizationDiscardEnable = 0;
@@ -468,14 +468,15 @@
inputAndBlend.primitiveRestartEnable = 0;
}
-angle::Result PipelineDesc::initializePipeline(vk::Context *context,
- const vk::PipelineCache &pipelineCacheVk,
- const RenderPass &compatibleRenderPass,
- const PipelineLayout &pipelineLayout,
- const gl::AttributesMask &activeAttribLocationsMask,
- const ShaderModule &vertexModule,
- const ShaderModule &fragmentModule,
- Pipeline *pipelineOut) const
+angle::Result GraphicsPipelineDesc::initializePipeline(
+ vk::Context *context,
+ const vk::PipelineCache &pipelineCacheVk,
+ const RenderPass &compatibleRenderPass,
+ const PipelineLayout &pipelineLayout,
+ const gl::AttributesMask &activeAttribLocationsMask,
+ const ShaderModule &vertexModule,
+ const ShaderModule &fragmentModule,
+ Pipeline *pipelineOut) const
{
VkPipelineShaderStageCreateInfo shaderStages[2] = {};
VkPipelineVertexInputStateCreateInfo vertexInputState = {};
@@ -671,12 +672,12 @@
return angle::Result::Continue();
}
-const ShaderStageInfo &PipelineDesc::getShaderStageInfo() const
+const ShaderStageInfo &GraphicsPipelineDesc::getShaderStageInfo() const
{
return mShaderStageInfo;
}
-void PipelineDesc::updateShaders(Serial vertexSerial, Serial fragmentSerial)
+void GraphicsPipelineDesc::updateShaders(Serial vertexSerial, Serial fragmentSerial)
{
ASSERT(vertexSerial < std::numeric_limits<uint32_t>::max());
mShaderStageInfo[ShaderType::VertexShader].moduleSerial =
@@ -686,42 +687,43 @@
static_cast<uint32_t>(fragmentSerial.getValue());
}
-void PipelineDesc::updateVertexInputInfo(const VertexInputBindings &bindings,
- const VertexInputAttributes &attribs)
+void GraphicsPipelineDesc::updateVertexInputInfo(const VertexInputBindings &bindings,
+ const VertexInputAttributes &attribs)
{
mVertexInputBindings = bindings;
mVertexInputAttribs = attribs;
}
-void PipelineDesc::updateTopology(gl::PrimitiveMode drawMode)
+void GraphicsPipelineDesc::updateTopology(gl::PrimitiveMode drawMode)
{
mInputAssembltyAndColorBlendStateInfo.topology =
static_cast<uint32_t>(gl_vk::GetPrimitiveTopology(drawMode));
}
-void PipelineDesc::updateCullMode(const gl::RasterizerState &rasterState)
+void GraphicsPipelineDesc::updateCullMode(const gl::RasterizerState &rasterState)
{
mRasterizationAndMultisampleStateInfo.cullMode =
static_cast<uint16_t>(gl_vk::GetCullMode(rasterState));
}
-void PipelineDesc::updateFrontFace(const gl::RasterizerState &rasterState, bool invertFrontFace)
+void GraphicsPipelineDesc::updateFrontFace(const gl::RasterizerState &rasterState,
+ bool invertFrontFace)
{
mRasterizationAndMultisampleStateInfo.frontFace =
static_cast<uint16_t>(gl_vk::GetFrontFace(rasterState.frontFace, invertFrontFace));
}
-void PipelineDesc::updateLineWidth(float lineWidth)
+void GraphicsPipelineDesc::updateLineWidth(float lineWidth)
{
mRasterizationAndMultisampleStateInfo.lineWidth = lineWidth;
}
-const RenderPassDesc &PipelineDesc::getRenderPassDesc() const
+const RenderPassDesc &GraphicsPipelineDesc::getRenderPassDesc() const
{
return mRenderPassDesc;
}
-void PipelineDesc::updateBlendColor(const gl::ColorF &color)
+void GraphicsPipelineDesc::updateBlendColor(const gl::ColorF &color)
{
mInputAssembltyAndColorBlendStateInfo.blendConstants[0] = color.red;
mInputAssembltyAndColorBlendStateInfo.blendConstants[1] = color.green;
@@ -729,7 +731,7 @@
mInputAssembltyAndColorBlendStateInfo.blendConstants[3] = color.alpha;
}
-void PipelineDesc::updateBlendEnabled(bool isBlendEnabled)
+void GraphicsPipelineDesc::updateBlendEnabled(bool isBlendEnabled)
{
gl::DrawBufferMask blendEnabled;
if (isBlendEnabled)
@@ -738,7 +740,7 @@
static_cast<uint8_t>(blendEnabled.bits());
}
-void PipelineDesc::updateBlendEquations(const gl::BlendState &blendState)
+void GraphicsPipelineDesc::updateBlendEquations(const gl::BlendState &blendState)
{
for (PackedColorBlendAttachmentState &blendAttachmentState :
mInputAssembltyAndColorBlendStateInfo.attachments)
@@ -748,7 +750,7 @@
}
}
-void PipelineDesc::updateBlendFuncs(const gl::BlendState &blendState)
+void GraphicsPipelineDesc::updateBlendFuncs(const gl::BlendState &blendState)
{
for (PackedColorBlendAttachmentState &blendAttachmentState :
mInputAssembltyAndColorBlendStateInfo.attachments)
@@ -760,8 +762,8 @@
}
}
-void PipelineDesc::updateColorWriteMask(VkColorComponentFlags colorComponentFlags,
- const gl::DrawBufferMask &alphaMask)
+void GraphicsPipelineDesc::updateColorWriteMask(VkColorComponentFlags colorComponentFlags,
+ const gl::DrawBufferMask &alphaMask)
{
PackedInputAssemblyAndColorBlendStateInfo &inputAndBlend =
mInputAssembltyAndColorBlendStateInfo;
@@ -774,8 +776,8 @@
}
}
-void PipelineDesc::updateDepthTestEnabled(const gl::DepthStencilState &depthStencilState,
- const gl::Framebuffer *drawFramebuffer)
+void GraphicsPipelineDesc::updateDepthTestEnabled(const gl::DepthStencilState &depthStencilState,
+ const gl::Framebuffer *drawFramebuffer)
{
// Only enable the depth test if the draw framebuffer has a depth buffer. It's possible that
// we're emulating a stencil-only buffer with a depth-stencil buffer
@@ -783,21 +785,21 @@
static_cast<uint8_t>(depthStencilState.depthTest && drawFramebuffer->hasDepth());
}
-void PipelineDesc::updateDepthFunc(const gl::DepthStencilState &depthStencilState)
+void GraphicsPipelineDesc::updateDepthFunc(const gl::DepthStencilState &depthStencilState)
{
mDepthStencilStateInfo.depthCompareOp = PackGLCompareFunc(depthStencilState.depthFunc);
}
-void PipelineDesc::updateDepthWriteEnabled(const gl::DepthStencilState &depthStencilState,
- const gl::Framebuffer *drawFramebuffer)
+void GraphicsPipelineDesc::updateDepthWriteEnabled(const gl::DepthStencilState &depthStencilState,
+ const gl::Framebuffer *drawFramebuffer)
{
// Don't write to depth buffers that should not exist
mDepthStencilStateInfo.depthWriteEnable =
static_cast<uint8_t>(drawFramebuffer->hasDepth() ? depthStencilState.depthMask : 0);
}
-void PipelineDesc::updateStencilTestEnabled(const gl::DepthStencilState &depthStencilState,
- const gl::Framebuffer *drawFramebuffer)
+void GraphicsPipelineDesc::updateStencilTestEnabled(const gl::DepthStencilState &depthStencilState,
+ const gl::Framebuffer *drawFramebuffer)
{
// Only enable the stencil test if the draw framebuffer has a stencil buffer. It's possible
// that we're emulating a depth-only buffer with a depth-stencil buffer
@@ -805,15 +807,16 @@
static_cast<uint8_t>(depthStencilState.stencilTest && drawFramebuffer->hasStencil());
}
-void PipelineDesc::updateStencilFrontFuncs(GLint ref,
- const gl::DepthStencilState &depthStencilState)
+void GraphicsPipelineDesc::updateStencilFrontFuncs(GLint ref,
+ const gl::DepthStencilState &depthStencilState)
{
mDepthStencilStateInfo.frontStencilReference = static_cast<uint8_t>(ref);
mDepthStencilStateInfo.front.compareOp = PackGLCompareFunc(depthStencilState.stencilFunc);
mDepthStencilStateInfo.front.compareMask = static_cast<uint8_t>(depthStencilState.stencilMask);
}
-void PipelineDesc::updateStencilBackFuncs(GLint ref, const gl::DepthStencilState &depthStencilState)
+void GraphicsPipelineDesc::updateStencilBackFuncs(GLint ref,
+ const gl::DepthStencilState &depthStencilState)
{
mDepthStencilStateInfo.backStencilReference = static_cast<uint8_t>(ref);
mDepthStencilStateInfo.back.compareOp = PackGLCompareFunc(depthStencilState.stencilBackFunc);
@@ -821,7 +824,7 @@
static_cast<uint8_t>(depthStencilState.stencilBackMask);
}
-void PipelineDesc::updateStencilFrontOps(const gl::DepthStencilState &depthStencilState)
+void GraphicsPipelineDesc::updateStencilFrontOps(const gl::DepthStencilState &depthStencilState)
{
mDepthStencilStateInfo.front.passOp = PackGLStencilOp(depthStencilState.stencilPassDepthPass);
mDepthStencilStateInfo.front.failOp = PackGLStencilOp(depthStencilState.stencilFail);
@@ -829,7 +832,7 @@
PackGLStencilOp(depthStencilState.stencilPassDepthFail);
}
-void PipelineDesc::updateStencilBackOps(const gl::DepthStencilState &depthStencilState)
+void GraphicsPipelineDesc::updateStencilBackOps(const gl::DepthStencilState &depthStencilState)
{
mDepthStencilStateInfo.back.passOp =
PackGLStencilOp(depthStencilState.stencilBackPassDepthPass);
@@ -838,34 +841,36 @@
PackGLStencilOp(depthStencilState.stencilBackPassDepthFail);
}
-void PipelineDesc::updateStencilFrontWriteMask(const gl::DepthStencilState &depthStencilState,
- const gl::Framebuffer *drawFramebuffer)
+void GraphicsPipelineDesc::updateStencilFrontWriteMask(
+ const gl::DepthStencilState &depthStencilState,
+ const gl::Framebuffer *drawFramebuffer)
{
// Don't write to stencil buffers that should not exist
mDepthStencilStateInfo.front.writeMask = static_cast<uint8_t>(
drawFramebuffer->hasStencil() ? depthStencilState.stencilWritemask : 0);
}
-void PipelineDesc::updateStencilBackWriteMask(const gl::DepthStencilState &depthStencilState,
- const gl::Framebuffer *drawFramebuffer)
+void GraphicsPipelineDesc::updateStencilBackWriteMask(
+ const gl::DepthStencilState &depthStencilState,
+ const gl::Framebuffer *drawFramebuffer)
{
// Don't write to stencil buffers that should not exist
mDepthStencilStateInfo.back.writeMask = static_cast<uint8_t>(
drawFramebuffer->hasStencil() ? depthStencilState.stencilBackWritemask : 0);
}
-void PipelineDesc::updatePolygonOffsetFillEnabled(bool enabled)
+void GraphicsPipelineDesc::updatePolygonOffsetFillEnabled(bool enabled)
{
mRasterizationAndMultisampleStateInfo.depthBiasEnable = enabled;
}
-void PipelineDesc::updatePolygonOffset(const gl::RasterizerState &rasterState)
+void GraphicsPipelineDesc::updatePolygonOffset(const gl::RasterizerState &rasterState)
{
mRasterizationAndMultisampleStateInfo.depthBiasSlopeFactor = rasterState.polygonOffsetFactor;
mRasterizationAndMultisampleStateInfo.depthBiasConstantFactor = rasterState.polygonOffsetUnits;
}
-void PipelineDesc::updateRenderPassDesc(const RenderPassDesc &renderPassDesc)
+void GraphicsPipelineDesc::updateRenderPassDesc(const RenderPassDesc &renderPassDesc)
{
mRenderPassDesc = renderPassDesc;
}
@@ -1127,15 +1132,15 @@
return angle::Result::Continue();
}
-// PipelineCache implementation.
-PipelineCache::PipelineCache() = default;
+// GraphicsPipelineCache implementation.
+GraphicsPipelineCache::GraphicsPipelineCache() = default;
-PipelineCache::~PipelineCache()
+GraphicsPipelineCache::~GraphicsPipelineCache()
{
ASSERT(mPayload.empty());
}
-void PipelineCache::destroy(VkDevice device)
+void GraphicsPipelineCache::destroy(VkDevice device)
{
for (auto &item : mPayload)
{
@@ -1145,15 +1150,16 @@
mPayload.clear();
}
-angle::Result PipelineCache::getPipeline(vk::Context *context,
- const vk::PipelineCache &pipelineCacheVk,
- const vk::RenderPass &compatibleRenderPass,
- const vk::PipelineLayout &pipelineLayout,
- const gl::AttributesMask &activeAttribLocationsMask,
- const vk::ShaderModule &vertexModule,
- const vk::ShaderModule &fragmentModule,
- const vk::PipelineDesc &desc,
- vk::PipelineAndSerial **pipelineOut)
+angle::Result GraphicsPipelineCache::getPipeline(
+ vk::Context *context,
+ const vk::PipelineCache &pipelineCacheVk,
+ const vk::RenderPass &compatibleRenderPass,
+ const vk::PipelineLayout &pipelineLayout,
+ const gl::AttributesMask &activeAttribLocationsMask,
+ const vk::ShaderModule &vertexModule,
+ const vk::ShaderModule &fragmentModule,
+ const vk::GraphicsPipelineDesc &desc,
+ vk::PipelineAndSerial **pipelineOut)
{
auto item = mPayload.find(desc);
if (item != mPayload.end())
@@ -1180,7 +1186,7 @@
return angle::Result::Continue();
}
-void PipelineCache::populate(const vk::PipelineDesc &desc, vk::Pipeline &&pipeline)
+void GraphicsPipelineCache::populate(const vk::GraphicsPipelineDesc &desc, vk::Pipeline &&pipeline)
{
auto item = mPayload.find(desc);
if (item != mPayload.end())
diff --git a/src/libANGLE/renderer/vulkan/vk_cache_utils.h b/src/libANGLE/renderer/vulkan/vk_cache_utils.h
index 5d0193a..c5047d9 100644
--- a/src/libANGLE/renderer/vulkan/vk_cache_utils.h
+++ b/src/libANGLE/renderer/vulkan/vk_cache_utils.h
@@ -243,20 +243,20 @@
constexpr size_t kVertexInputBindingsSize = sizeof(VertexInputBindings);
constexpr size_t kVertexInputAttributesSize = sizeof(VertexInputAttributes);
-class PipelineDesc final
+class GraphicsPipelineDesc final
{
public:
// Use aligned allocation and free so we can use the alignas keyword.
void *operator new(std::size_t size);
void operator delete(void *ptr);
- PipelineDesc();
- ~PipelineDesc();
- PipelineDesc(const PipelineDesc &other);
- PipelineDesc &operator=(const PipelineDesc &other);
+ GraphicsPipelineDesc();
+ ~GraphicsPipelineDesc();
+ GraphicsPipelineDesc(const GraphicsPipelineDesc &other);
+ GraphicsPipelineDesc &operator=(const GraphicsPipelineDesc &other);
size_t hash() const;
- bool operator==(const PipelineDesc &other) const;
+ bool operator==(const GraphicsPipelineDesc &other) const;
void initDefaults();
@@ -334,13 +334,13 @@
// This is not guaranteed by the spec, but is validated by a compile-time check.
// No gaps or padding at the end ensures that hashing and memcmp checks will not run
// into uninitialized memory regions.
-constexpr size_t kPipelineDescSumOfSizes =
+constexpr size_t kGraphicsPipelineDescSumOfSizes =
kShaderStageInfoSize + kVertexInputBindingsSize + kVertexInputAttributesSize +
kPackedInputAssemblyAndColorBlendStateSize + kPackedRasterizationAndMultisampleStateSize +
kPackedDepthStencilStateSize + kRenderPassDescSize;
-static constexpr size_t kPipelineDescSize = sizeof(PipelineDesc);
-static_assert(kPipelineDescSize == kPipelineDescSumOfSizes, "Size mismatch");
+static constexpr size_t kGraphicsPipelineDescSize = sizeof(GraphicsPipelineDesc);
+static_assert(kGraphicsPipelineDescSize == kGraphicsPipelineDescSumOfSizes, "Size mismatch");
constexpr uint32_t kMaxDescriptorSetLayoutBindings = gl::IMPLEMENTATION_MAX_ACTIVE_TEXTURES;
@@ -348,8 +348,8 @@
angle::FixedVector<VkDescriptorSetLayoutBinding, kMaxDescriptorSetLayoutBindings>;
// A packed description of a descriptor set layout. Use similarly to RenderPassDesc and
-// PipelineDesc. Currently we only need to differentiate layouts based on sampler usage. In the
-// future we could generalize this.
+// GraphicsPipelineDesc. Currently we only need to differentiate layouts based on sampler usage. In
+// the future we could generalize this.
class DescriptorSetLayoutDesc final
{
public:
@@ -454,9 +454,9 @@
};
template <>
-struct hash<rx::vk::PipelineDesc>
+struct hash<rx::vk::GraphicsPipelineDesc>
{
- size_t operator()(const rx::vk::PipelineDesc &key) const { return key.hash(); }
+ size_t operator()(const rx::vk::GraphicsPipelineDesc &key) const { return key.hash(); }
};
template <>
@@ -503,15 +503,15 @@
};
// TODO(jmadill): Add cache trimming/eviction.
-class PipelineCache final : angle::NonCopyable
+class GraphicsPipelineCache final : angle::NonCopyable
{
public:
- PipelineCache();
- ~PipelineCache();
+ GraphicsPipelineCache();
+ ~GraphicsPipelineCache();
void destroy(VkDevice device);
- void populate(const vk::PipelineDesc &desc, vk::Pipeline &&pipeline);
+ void populate(const vk::GraphicsPipelineDesc &desc, vk::Pipeline &&pipeline);
angle::Result getPipeline(vk::Context *context,
const vk::PipelineCache &pipelineCacheVk,
const vk::RenderPass &compatibleRenderPass,
@@ -519,11 +519,11 @@
const gl::AttributesMask &activeAttribLocationsMask,
const vk::ShaderModule &vertexModule,
const vk::ShaderModule &fragmentModule,
- const vk::PipelineDesc &desc,
+ const vk::GraphicsPipelineDesc &desc,
vk::PipelineAndSerial **pipelineOut);
private:
- std::unordered_map<vk::PipelineDesc, vk::PipelineAndSerial> mPayload;
+ std::unordered_map<vk::GraphicsPipelineDesc, vk::PipelineAndSerial> mPayload;
};
class DescriptorSetLayoutCache final : angle::NonCopyable