Commit 78feddc2 by Jamie Madill Committed by Commit Bot

Vulkan: Take serials in PipelineDesc::updateShaders.

This makes the API easy to use with internal shaders and pipelines. This is useful for the implementation of masked color clear. Also renames the serials as shader serials. This is more precise than program serials. Bug: angleproject:2455 Change-Id: Ie6247d1212ed4df856b561a5e9f16c0378202588 Reviewed-on: https://chromium-review.googlesource.com/1032857 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent ec982e18
......@@ -534,7 +534,8 @@ void ContextVk::syncState(const gl::Context *context, const gl::State::DirtyBits
case gl::State::DIRTY_BIT_PROGRAM_EXECUTABLE:
{
ProgramVk *programVk = vk::GetImpl(glState.getProgram());
mPipelineDesc->updateShaders(programVk);
mPipelineDesc->updateShaders(programVk->getVertexModuleSerial(),
programVk->getFragmentModuleSerial());
dirtyTextures = true;
break;
}
......
......@@ -245,7 +245,7 @@ gl::LinkResult ProgramVk::link(const gl::Context *glContext,
vertexShaderInfo.pCode = vertexCode.data();
ANGLE_TRY(mLinkedVertexModule.init(device, vertexShaderInfo));
mVertexModuleSerial = renderer->issueProgramSerial();
mVertexModuleSerial = renderer->issueShaderSerial();
}
{
......@@ -257,7 +257,7 @@ gl::LinkResult ProgramVk::link(const gl::Context *glContext,
fragmentShaderInfo.pCode = fragmentCode.data();
ANGLE_TRY(mLinkedFragmentModule.init(device, fragmentShaderInfo));
mFragmentModuleSerial = renderer->issueProgramSerial();
mFragmentModuleSerial = renderer->issueShaderSerial();
}
ANGLE_TRY(initDefaultUniformBlocks(glContext));
......
......@@ -951,9 +951,9 @@ vk::Error RendererVk::initGraphicsPipelineLayout()
return vk::NoError();
}
Serial RendererVk::issueProgramSerial()
Serial RendererVk::issueShaderSerial()
{
return mProgramSerialFactory.generate();
return mShaderSerialFactory.generate();
}
vk::Error RendererVk::getPipeline(const ProgramVk *programVk,
......
......@@ -126,7 +126,7 @@ class RendererVk : angle::NonCopyable
const std::vector<vk::DescriptorSetLayout> &getGraphicsDescriptorSetLayouts() const;
// Issues a new serial for linked shader modules. Used in the pipeline cache.
Serial issueProgramSerial();
Serial issueShaderSerial();
vk::ShaderLibrary *getShaderLibrary();
......@@ -157,7 +157,7 @@ class RendererVk : angle::NonCopyable
vk::CommandPool mCommandPool;
GlslangWrapper *mGlslangWrapper;
SerialFactory mQueueSerialFactory;
SerialFactory mProgramSerialFactory;
SerialFactory mShaderSerialFactory;
Serial mLastCompletedQueueSerial;
Serial mCurrentQueueSerial;
......
......@@ -631,14 +631,14 @@ const ShaderStageInfo &PipelineDesc::getShaderStageInfo() const
return mShaderStageInfo;
}
void PipelineDesc::updateShaders(ProgramVk *programVk)
void PipelineDesc::updateShaders(Serial vertexSerial, Serial fragmentSerial)
{
ASSERT(programVk->getVertexModuleSerial() < std::numeric_limits<uint32_t>::max());
ASSERT(vertexSerial < std::numeric_limits<uint32_t>::max());
mShaderStageInfo[ShaderType::VertexShader].moduleSerial =
static_cast<uint32_t>(programVk->getVertexModuleSerial().getValue());
ASSERT(programVk->getFragmentModuleSerial() < std::numeric_limits<uint32_t>::max());
static_cast<uint32_t>(vertexSerial.getValue());
ASSERT(fragmentSerial < std::numeric_limits<uint32_t>::max());
mShaderStageInfo[ShaderType::FragmentShader].moduleSerial =
static_cast<uint32_t>(programVk->getFragmentModuleSerial().getValue());
static_cast<uint32_t>(fragmentSerial.getValue());
}
void PipelineDesc::updateViewport(const gl::Rectangle &viewport, float nearPlane, float farPlane)
......
......@@ -273,7 +273,7 @@ class PipelineDesc final
// Shader stage info
const ShaderStageInfo &getShaderStageInfo() const;
void updateShaders(ProgramVk *programVk);
void updateShaders(Serial vertexSerial, Serial fragmentSerial);
// Vertex input state
void updateVertexInputInfo(const VertexInputBindings &bindings,
......@@ -315,7 +315,7 @@ class PipelineDesc final
void updateStencilBackWriteMask(const gl::DepthStencilState &depthStencilState);
private:
// TODO(jmadill): Handle Geometry/Compute shaders when necessary.
// TODO(jmadill): Use gl::ShaderMap when we can pack into fewer bits. http://anglebug.com/2522
ShaderStageInfo mShaderStageInfo;
VertexInputBindings mVertexInputBindings;
VertexInputAttributes mVertexInputAttribs;
......
......@@ -53,7 +53,7 @@ Error ShaderLibrary::getShader(RendererVk *renderer,
createInfo.pCode = shaderCode.code;
ANGLE_TRY(shader.get().init(renderer->getDevice(), createInfo));
shader.updateSerial(renderer->issueProgramSerial());
shader.updateSerial(renderer->issueShaderSerial());
return NoError();
}
} // namespace vk
......
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