Commit c4c48b65 by Shahbaz Youssefi Committed by Commit Bot

Vulkan: Prefix context pipeline and dirty bits with Graphics

In preparation for compute pipeline and dirty bits. Bug: angleproject:3562 Change-Id: I611b97fee1e500fdad32355d096254fd787c4ddd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1703525Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
parent 998a37c9
...@@ -170,7 +170,7 @@ void ContextVk::CommandBatch::destroy(VkDevice device) ...@@ -170,7 +170,7 @@ void ContextVk::CommandBatch::destroy(VkDevice device)
ContextVk::ContextVk(const gl::State &state, gl::ErrorSet *errorSet, RendererVk *renderer) ContextVk::ContextVk(const gl::State &state, gl::ErrorSet *errorSet, RendererVk *renderer)
: ContextImpl(state, errorSet), : ContextImpl(state, errorSet),
vk::Context(renderer), vk::Context(renderer),
mCurrentPipeline(nullptr), mCurrentGraphicsPipeline(nullptr),
mCurrentDrawMode(gl::PrimitiveMode::InvalidEnum), mCurrentDrawMode(gl::PrimitiveMode::InvalidEnum),
mCurrentWindowSurface(nullptr), mCurrentWindowSurface(nullptr),
mVertexArray(nullptr), mVertexArray(nullptr),
...@@ -201,27 +201,32 @@ ContextVk::ContextVk(const gl::State &state, gl::ErrorSet *errorSet, RendererVk ...@@ -201,27 +201,32 @@ ContextVk::ContextVk(const gl::State &state, gl::ErrorSet *errorSet, RendererVk
mIndexedDirtyBitsMask.set(); mIndexedDirtyBitsMask.set();
mNewCommandBufferDirtyBits.set(DIRTY_BIT_PIPELINE); mNewGraphicsCommandBufferDirtyBits.set(DIRTY_BIT_PIPELINE);
mNewCommandBufferDirtyBits.set(DIRTY_BIT_TEXTURES); mNewGraphicsCommandBufferDirtyBits.set(DIRTY_BIT_TEXTURES);
mNewCommandBufferDirtyBits.set(DIRTY_BIT_VERTEX_BUFFERS); mNewGraphicsCommandBufferDirtyBits.set(DIRTY_BIT_VERTEX_BUFFERS);
mNewCommandBufferDirtyBits.set(DIRTY_BIT_INDEX_BUFFER); mNewGraphicsCommandBufferDirtyBits.set(DIRTY_BIT_INDEX_BUFFER);
mNewCommandBufferDirtyBits.set(DIRTY_BIT_UNIFORM_AND_STORAGE_BUFFERS); mNewGraphicsCommandBufferDirtyBits.set(DIRTY_BIT_UNIFORM_AND_STORAGE_BUFFERS);
mNewCommandBufferDirtyBits.set(DIRTY_BIT_TRANSFORM_FEEDBACK_BUFFERS); mNewGraphicsCommandBufferDirtyBits.set(DIRTY_BIT_TRANSFORM_FEEDBACK_BUFFERS);
mNewCommandBufferDirtyBits.set(DIRTY_BIT_DESCRIPTOR_SETS); mNewGraphicsCommandBufferDirtyBits.set(DIRTY_BIT_DESCRIPTOR_SETS);
mDirtyBitHandlers[DIRTY_BIT_DEFAULT_ATTRIBS] = &ContextVk::handleDirtyDefaultAttribs; mGraphicsDirtyBitHandlers[DIRTY_BIT_DEFAULT_ATTRIBS] =
mDirtyBitHandlers[DIRTY_BIT_PIPELINE] = &ContextVk::handleDirtyPipeline; &ContextVk::handleDirtyGraphicsDefaultAttribs;
mDirtyBitHandlers[DIRTY_BIT_TEXTURES] = &ContextVk::handleDirtyTextures; mGraphicsDirtyBitHandlers[DIRTY_BIT_PIPELINE] = &ContextVk::handleDirtyGraphicsPipeline;
mDirtyBitHandlers[DIRTY_BIT_VERTEX_BUFFERS] = &ContextVk::handleDirtyVertexBuffers; mGraphicsDirtyBitHandlers[DIRTY_BIT_TEXTURES] = &ContextVk::handleDirtyGraphicsTextures;
mDirtyBitHandlers[DIRTY_BIT_INDEX_BUFFER] = &ContextVk::handleDirtyIndexBuffer; mGraphicsDirtyBitHandlers[DIRTY_BIT_VERTEX_BUFFERS] =
mDirtyBitHandlers[DIRTY_BIT_DRIVER_UNIFORMS] = &ContextVk::handleDirtyDriverUniforms; &ContextVk::handleDirtyGraphicsVertexBuffers;
mDirtyBitHandlers[DIRTY_BIT_UNIFORM_AND_STORAGE_BUFFERS] = mGraphicsDirtyBitHandlers[DIRTY_BIT_INDEX_BUFFER] = &ContextVk::handleDirtyGraphicsIndexBuffer;
&ContextVk::handleDirtyUniformAndStorageBuffers; mGraphicsDirtyBitHandlers[DIRTY_BIT_DRIVER_UNIFORMS] =
mDirtyBitHandlers[DIRTY_BIT_TRANSFORM_FEEDBACK_BUFFERS] = &ContextVk::handleDirtyGraphicsDriverUniforms;
&ContextVk::handleDirtyTransformFeedbackBuffers; mGraphicsDirtyBitHandlers[DIRTY_BIT_UNIFORM_AND_STORAGE_BUFFERS] =
mDirtyBitHandlers[DIRTY_BIT_DESCRIPTOR_SETS] = &ContextVk::handleDirtyDescriptorSets; &ContextVk::handleDirtyGraphicsUniformAndStorageBuffers;
mGraphicsDirtyBitHandlers[DIRTY_BIT_TRANSFORM_FEEDBACK_BUFFERS] =
mDirtyBits = mNewCommandBufferDirtyBits; &ContextVk::handleDirtyGraphicsTransformFeedbackBuffers;
mGraphicsDirtyBitHandlers[DIRTY_BIT_DESCRIPTOR_SETS] =
&ContextVk::handleDirtyGraphicsDescriptorSets;
mGraphicsDirtyBits = mNewGraphicsCommandBufferDirtyBits;
mActiveTextures.fill(nullptr); mActiveTextures.fill(nullptr);
mPipelineDirtyBitsMask.set(); mPipelineDirtyBitsMask.set();
...@@ -369,7 +374,7 @@ angle::Result ContextVk::setupDraw(const gl::Context *context, ...@@ -369,7 +374,7 @@ angle::Result ContextVk::setupDraw(const gl::Context *context,
// Set any dirty bits that depend on draw call parameters or other objects. // Set any dirty bits that depend on draw call parameters or other objects.
if (mode != mCurrentDrawMode) if (mode != mCurrentDrawMode)
{ {
invalidateCurrentPipeline(); invalidateCurrentGraphicsPipeline();
mCurrentDrawMode = mode; mCurrentDrawMode = mode;
mGraphicsPipelineDesc->updateTopology(&mGraphicsPipelineTransition, mCurrentDrawMode); mGraphicsPipelineDesc->updateTopology(&mGraphicsPipelineTransition, mCurrentDrawMode);
} }
...@@ -379,7 +384,7 @@ angle::Result ContextVk::setupDraw(const gl::Context *context, ...@@ -379,7 +384,7 @@ angle::Result ContextVk::setupDraw(const gl::Context *context,
{ {
ANGLE_TRY(mVertexArray->updateClientAttribs(context, firstVertex, vertexOrIndexCount, ANGLE_TRY(mVertexArray->updateClientAttribs(context, firstVertex, vertexOrIndexCount,
instanceCount, indexTypeOrNone, indices)); instanceCount, indexTypeOrNone, indices));
mDirtyBits.set(DIRTY_BIT_VERTEX_BUFFERS); mGraphicsDirtyBits.set(DIRTY_BIT_VERTEX_BUFFERS);
} }
// This could be improved using a dirty bit. But currently it's slower to use a handler // This could be improved using a dirty bit. But currently it's slower to use a handler
...@@ -388,7 +393,7 @@ angle::Result ContextVk::setupDraw(const gl::Context *context, ...@@ -388,7 +393,7 @@ angle::Result ContextVk::setupDraw(const gl::Context *context,
// TODO(jmadill): Use dirty bit. http://anglebug.com/3014 // TODO(jmadill): Use dirty bit. http://anglebug.com/3014
if (!mRenderPassCommandBuffer) if (!mRenderPassCommandBuffer)
{ {
mDirtyBits |= mNewCommandBufferDirtyBits; mGraphicsDirtyBits |= mNewGraphicsCommandBufferDirtyBits;
gl::Rectangle scissoredRenderArea = mDrawFramebuffer->getScissoredRenderArea(this); gl::Rectangle scissoredRenderArea = mDrawFramebuffer->getScissoredRenderArea(this);
if (!mDrawFramebuffer->appendToStartedRenderPass( if (!mDrawFramebuffer->appendToStartedRenderPass(
...@@ -409,7 +414,7 @@ angle::Result ContextVk::setupDraw(const gl::Context *context, ...@@ -409,7 +414,7 @@ angle::Result ContextVk::setupDraw(const gl::Context *context,
if (mProgram->dirtyUniforms()) if (mProgram->dirtyUniforms())
{ {
ANGLE_TRY(mProgram->updateUniforms(this)); ANGLE_TRY(mProgram->updateUniforms(this));
mDirtyBits.set(DIRTY_BIT_DESCRIPTOR_SETS); mGraphicsDirtyBits.set(DIRTY_BIT_DESCRIPTOR_SETS);
} }
// Update transform feedback offsets on every draw call. // Update transform feedback offsets on every draw call.
...@@ -419,7 +424,7 @@ angle::Result ContextVk::setupDraw(const gl::Context *context, ...@@ -419,7 +424,7 @@ angle::Result ContextVk::setupDraw(const gl::Context *context,
invalidateDriverUniforms(); invalidateDriverUniforms();
} }
DirtyBits dirtyBits = mDirtyBits & dirtyBitMask; DirtyBits dirtyBits = mGraphicsDirtyBits & dirtyBitMask;
if (dirtyBits.none()) if (dirtyBits.none())
return angle::Result::Continue; return angle::Result::Continue;
...@@ -427,10 +432,10 @@ angle::Result ContextVk::setupDraw(const gl::Context *context, ...@@ -427,10 +432,10 @@ angle::Result ContextVk::setupDraw(const gl::Context *context,
// Flush any relevant dirty bits. // Flush any relevant dirty bits.
for (size_t dirtyBit : dirtyBits) for (size_t dirtyBit : dirtyBits)
{ {
ANGLE_TRY((this->*mDirtyBitHandlers[dirtyBit])(context, *commandBufferOut)); ANGLE_TRY((this->*mGraphicsDirtyBitHandlers[dirtyBit])(context, *commandBufferOut));
} }
mDirtyBits &= ~dirtyBitMask; mGraphicsDirtyBits &= ~dirtyBitMask;
return angle::Result::Continue; return angle::Result::Continue;
} }
...@@ -454,19 +459,20 @@ angle::Result ContextVk::setupIndexedDraw(const gl::Context *context, ...@@ -454,19 +459,20 @@ angle::Result ContextVk::setupIndexedDraw(const gl::Context *context,
const gl::Buffer *elementArrayBuffer = mVertexArray->getState().getElementArrayBuffer(); const gl::Buffer *elementArrayBuffer = mVertexArray->getState().getElementArrayBuffer();
if (!elementArrayBuffer) if (!elementArrayBuffer)
{ {
mDirtyBits.set(DIRTY_BIT_INDEX_BUFFER); mGraphicsDirtyBits.set(DIRTY_BIT_INDEX_BUFFER);
ANGLE_TRY(mVertexArray->convertIndexBufferCPU(this, indexType, indexCount, indices)); ANGLE_TRY(mVertexArray->convertIndexBufferCPU(this, indexType, indexCount, indices));
} }
else else
{ {
if (indices != mLastIndexBufferOffset) if (indices != mLastIndexBufferOffset)
{ {
mDirtyBits.set(DIRTY_BIT_INDEX_BUFFER); mGraphicsDirtyBits.set(DIRTY_BIT_INDEX_BUFFER);
mLastIndexBufferOffset = indices; mLastIndexBufferOffset = indices;
mVertexArray->updateCurrentElementArrayBufferOffset(mLastIndexBufferOffset); mVertexArray->updateCurrentElementArrayBufferOffset(mLastIndexBufferOffset);
} }
if (indexType == gl::DrawElementsType::UnsignedByte && mDirtyBits[DIRTY_BIT_INDEX_BUFFER]) if (indexType == gl::DrawElementsType::UnsignedByte &&
mGraphicsDirtyBits[DIRTY_BIT_INDEX_BUFFER])
{ {
BufferVk *bufferVk = vk::GetImpl(elementArrayBuffer); BufferVk *bufferVk = vk::GetImpl(elementArrayBuffer);
ANGLE_TRY(mVertexArray->convertIndexBufferGPU(this, bufferVk, indices)); ANGLE_TRY(mVertexArray->convertIndexBufferGPU(this, bufferVk, indices));
...@@ -496,7 +502,7 @@ angle::Result ContextVk::setupLineLoopDraw(const gl::Context *context, ...@@ -496,7 +502,7 @@ angle::Result ContextVk::setupLineLoopDraw(const gl::Context *context,
mIndexedDirtyBitsMask, commandBufferOut); mIndexedDirtyBitsMask, commandBufferOut);
} }
angle::Result ContextVk::handleDirtyDefaultAttribs(const gl::Context *context, angle::Result ContextVk::handleDirtyGraphicsDefaultAttribs(const gl::Context *context,
vk::CommandBuffer *commandBuffer) vk::CommandBuffer *commandBuffer)
{ {
ASSERT(mDirtyDefaultAttribsMask.any()); ASSERT(mDirtyDefaultAttribsMask.any());
...@@ -510,46 +516,48 @@ angle::Result ContextVk::handleDirtyDefaultAttribs(const gl::Context *context, ...@@ -510,46 +516,48 @@ angle::Result ContextVk::handleDirtyDefaultAttribs(const gl::Context *context,
return angle::Result::Continue; return angle::Result::Continue;
} }
angle::Result ContextVk::handleDirtyPipeline(const gl::Context *context, angle::Result ContextVk::handleDirtyGraphicsPipeline(const gl::Context *context,
vk::CommandBuffer *commandBuffer) vk::CommandBuffer *commandBuffer)
{ {
if (!mCurrentPipeline) if (!mCurrentGraphicsPipeline)
{ {
const vk::GraphicsPipelineDesc *descPtr; const vk::GraphicsPipelineDesc *descPtr;
// Draw call shader patching, shader compilation, and pipeline cache query. // Draw call shader patching, shader compilation, and pipeline cache query.
ANGLE_TRY(mProgram->getGraphicsPipeline( ANGLE_TRY(
this, mCurrentDrawMode, *mGraphicsPipelineDesc, mProgram->getGraphicsPipeline(this, mCurrentDrawMode, *mGraphicsPipelineDesc,
mProgram->getState().getNonBuiltinAttribLocationsMask(), &descPtr, &mCurrentPipeline)); mProgram->getState().getNonBuiltinAttribLocationsMask(),
&descPtr, &mCurrentGraphicsPipeline));
mGraphicsPipelineTransition.reset(); mGraphicsPipelineTransition.reset();
} }
else if (mGraphicsPipelineTransition.any()) else if (mGraphicsPipelineTransition.any())
{ {
if (!mCurrentPipeline->findTransition(mGraphicsPipelineTransition, *mGraphicsPipelineDesc, if (!mCurrentGraphicsPipeline->findTransition(
&mCurrentPipeline)) mGraphicsPipelineTransition, *mGraphicsPipelineDesc, &mCurrentGraphicsPipeline))
{ {
vk::PipelineHelper *oldPipeline = mCurrentPipeline; vk::PipelineHelper *oldPipeline = mCurrentGraphicsPipeline;
const vk::GraphicsPipelineDesc *descPtr; const vk::GraphicsPipelineDesc *descPtr;
ANGLE_TRY(mProgram->getGraphicsPipeline( ANGLE_TRY(mProgram->getGraphicsPipeline(
this, mCurrentDrawMode, *mGraphicsPipelineDesc, this, mCurrentDrawMode, *mGraphicsPipelineDesc,
mProgram->getState().getNonBuiltinAttribLocationsMask(), &descPtr, mProgram->getState().getNonBuiltinAttribLocationsMask(), &descPtr,
&mCurrentPipeline)); &mCurrentGraphicsPipeline));
oldPipeline->addTransition(mGraphicsPipelineTransition, descPtr, mCurrentPipeline); oldPipeline->addTransition(mGraphicsPipelineTransition, descPtr,
mCurrentGraphicsPipeline);
} }
mGraphicsPipelineTransition.reset(); mGraphicsPipelineTransition.reset();
} }
commandBuffer->bindGraphicsPipeline(mCurrentPipeline->getPipeline()); commandBuffer->bindGraphicsPipeline(mCurrentGraphicsPipeline->getPipeline());
// Update the queue serial for the pipeline object. // Update the queue serial for the pipeline object.
ASSERT(mCurrentPipeline && mCurrentPipeline->valid()); ASSERT(mCurrentGraphicsPipeline && mCurrentGraphicsPipeline->valid());
mCurrentPipeline->updateSerial(getCurrentQueueSerial()); mCurrentGraphicsPipeline->updateSerial(getCurrentQueueSerial());
return angle::Result::Continue; return angle::Result::Continue;
} }
angle::Result ContextVk::handleDirtyTextures(const gl::Context *context, angle::Result ContextVk::handleDirtyGraphicsTextures(const gl::Context *context,
vk::CommandBuffer *commandBuffer) vk::CommandBuffer *commandBuffer)
{ {
ANGLE_TRY(updateActiveTextures(context)); ANGLE_TRY(updateActiveTextures(context));
...@@ -561,7 +569,7 @@ angle::Result ContextVk::handleDirtyTextures(const gl::Context *context, ...@@ -561,7 +569,7 @@ angle::Result ContextVk::handleDirtyTextures(const gl::Context *context,
return angle::Result::Continue; return angle::Result::Continue;
} }
angle::Result ContextVk::handleDirtyVertexBuffers(const gl::Context *context, angle::Result ContextVk::handleDirtyGraphicsVertexBuffers(const gl::Context *context,
vk::CommandBuffer *commandBuffer) vk::CommandBuffer *commandBuffer)
{ {
uint32_t maxAttrib = mProgram->getState().getMaxActiveAttribLocation(); uint32_t maxAttrib = mProgram->getState().getMaxActiveAttribLocation();
...@@ -587,7 +595,7 @@ angle::Result ContextVk::handleDirtyVertexBuffers(const gl::Context *context, ...@@ -587,7 +595,7 @@ angle::Result ContextVk::handleDirtyVertexBuffers(const gl::Context *context,
return angle::Result::Continue; return angle::Result::Continue;
} }
angle::Result ContextVk::handleDirtyIndexBuffer(const gl::Context *context, angle::Result ContextVk::handleDirtyGraphicsIndexBuffer(const gl::Context *context,
vk::CommandBuffer *commandBuffer) vk::CommandBuffer *commandBuffer)
{ {
vk::BufferHelper *elementArrayBuffer = mVertexArray->getCurrentElementArrayBuffer(); vk::BufferHelper *elementArrayBuffer = mVertexArray->getCurrentElementArrayBuffer();
...@@ -603,7 +611,8 @@ angle::Result ContextVk::handleDirtyIndexBuffer(const gl::Context *context, ...@@ -603,7 +611,8 @@ angle::Result ContextVk::handleDirtyIndexBuffer(const gl::Context *context,
return angle::Result::Continue; return angle::Result::Continue;
} }
angle::Result ContextVk::handleDirtyUniformAndStorageBuffers(const gl::Context *context, angle::Result ContextVk::handleDirtyGraphicsUniformAndStorageBuffers(
const gl::Context *context,
vk::CommandBuffer *commandBuffer) vk::CommandBuffer *commandBuffer)
{ {
if (mProgram->hasUniformBuffers() || mProgram->hasStorageBuffers()) if (mProgram->hasUniformBuffers() || mProgram->hasStorageBuffers())
...@@ -614,7 +623,8 @@ angle::Result ContextVk::handleDirtyUniformAndStorageBuffers(const gl::Context * ...@@ -614,7 +623,8 @@ angle::Result ContextVk::handleDirtyUniformAndStorageBuffers(const gl::Context *
return angle::Result::Continue; return angle::Result::Continue;
} }
angle::Result ContextVk::handleDirtyTransformFeedbackBuffers(const gl::Context *context, angle::Result ContextVk::handleDirtyGraphicsTransformFeedbackBuffers(
const gl::Context *context,
vk::CommandBuffer *commandBuffer) vk::CommandBuffer *commandBuffer)
{ {
if (mProgram->hasTransformFeedbackOutput() && mState.isTransformFeedbackActive()) if (mProgram->hasTransformFeedbackOutput() && mState.isTransformFeedbackActive())
...@@ -625,7 +635,7 @@ angle::Result ContextVk::handleDirtyTransformFeedbackBuffers(const gl::Context * ...@@ -625,7 +635,7 @@ angle::Result ContextVk::handleDirtyTransformFeedbackBuffers(const gl::Context *
return angle::Result::Continue; return angle::Result::Continue;
} }
angle::Result ContextVk::handleDirtyDescriptorSets(const gl::Context *context, angle::Result ContextVk::handleDirtyGraphicsDescriptorSets(const gl::Context *context,
vk::CommandBuffer *commandBuffer) vk::CommandBuffer *commandBuffer)
{ {
ANGLE_TRY(mProgram->updateDescriptorSets(this, commandBuffer)); ANGLE_TRY(mProgram->updateDescriptorSets(this, commandBuffer));
...@@ -1604,7 +1614,7 @@ angle::Result ContextVk::syncState(const gl::Context *context, ...@@ -1604,7 +1614,7 @@ angle::Result ContextVk::syncState(const gl::Context *context,
bool useVertexBuffer = (mProgram->getState().getMaxActiveAttribLocation()); bool useVertexBuffer = (mProgram->getState().getMaxActiveAttribLocation());
mNonIndexedDirtyBitsMask.set(DIRTY_BIT_VERTEX_BUFFERS, useVertexBuffer); mNonIndexedDirtyBitsMask.set(DIRTY_BIT_VERTEX_BUFFERS, useVertexBuffer);
mIndexedDirtyBitsMask.set(DIRTY_BIT_VERTEX_BUFFERS, useVertexBuffer); mIndexedDirtyBitsMask.set(DIRTY_BIT_VERTEX_BUFFERS, useVertexBuffer);
mCurrentPipeline = nullptr; mCurrentGraphicsPipeline = nullptr;
mGraphicsPipelineTransition.reset(); mGraphicsPipelineTransition.reset();
break; break;
} }
...@@ -1836,8 +1846,8 @@ void ContextVk::invalidateCurrentTextures() ...@@ -1836,8 +1846,8 @@ void ContextVk::invalidateCurrentTextures()
ASSERT(mProgram); ASSERT(mProgram);
if (mProgram->hasTextures()) if (mProgram->hasTextures())
{ {
mDirtyBits.set(DIRTY_BIT_TEXTURES); mGraphicsDirtyBits.set(DIRTY_BIT_TEXTURES);
mDirtyBits.set(DIRTY_BIT_DESCRIPTOR_SETS); mGraphicsDirtyBits.set(DIRTY_BIT_DESCRIPTOR_SETS);
} }
} }
...@@ -1846,15 +1856,15 @@ void ContextVk::invalidateCurrentUniformAndStorageBuffers() ...@@ -1846,15 +1856,15 @@ void ContextVk::invalidateCurrentUniformAndStorageBuffers()
ASSERT(mProgram); ASSERT(mProgram);
if (mProgram->hasUniformBuffers() || mProgram->hasStorageBuffers()) if (mProgram->hasUniformBuffers() || mProgram->hasStorageBuffers())
{ {
mDirtyBits.set(DIRTY_BIT_UNIFORM_AND_STORAGE_BUFFERS); mGraphicsDirtyBits.set(DIRTY_BIT_UNIFORM_AND_STORAGE_BUFFERS);
mDirtyBits.set(DIRTY_BIT_DESCRIPTOR_SETS); mGraphicsDirtyBits.set(DIRTY_BIT_DESCRIPTOR_SETS);
} }
} }
void ContextVk::invalidateDriverUniforms() void ContextVk::invalidateDriverUniforms()
{ {
mDirtyBits.set(DIRTY_BIT_DRIVER_UNIFORMS); mGraphicsDirtyBits.set(DIRTY_BIT_DRIVER_UNIFORMS);
mDirtyBits.set(DIRTY_BIT_DESCRIPTOR_SETS); mGraphicsDirtyBits.set(DIRTY_BIT_DESCRIPTOR_SETS);
} }
void ContextVk::onDrawFramebufferChange(FramebufferVk *framebufferVk) void ContextVk::onDrawFramebufferChange(FramebufferVk *framebufferVk)
...@@ -1862,14 +1872,14 @@ void ContextVk::onDrawFramebufferChange(FramebufferVk *framebufferVk) ...@@ -1862,14 +1872,14 @@ void ContextVk::onDrawFramebufferChange(FramebufferVk *framebufferVk)
const vk::RenderPassDesc &renderPassDesc = framebufferVk->getRenderPassDesc(); const vk::RenderPassDesc &renderPassDesc = framebufferVk->getRenderPassDesc();
// Ensure that the RenderPass description is updated. // Ensure that the RenderPass description is updated.
invalidateCurrentPipeline(); invalidateCurrentGraphicsPipeline();
mGraphicsPipelineDesc->updateRenderPassDesc(&mGraphicsPipelineTransition, renderPassDesc); mGraphicsPipelineDesc->updateRenderPassDesc(&mGraphicsPipelineTransition, renderPassDesc);
} }
void ContextVk::invalidateCurrentTransformFeedbackBuffers() void ContextVk::invalidateCurrentTransformFeedbackBuffers()
{ {
mDirtyBits.set(DIRTY_BIT_TRANSFORM_FEEDBACK_BUFFERS); mGraphicsDirtyBits.set(DIRTY_BIT_TRANSFORM_FEEDBACK_BUFFERS);
mDirtyBits.set(DIRTY_BIT_DESCRIPTOR_SETS); mGraphicsDirtyBits.set(DIRTY_BIT_DESCRIPTOR_SETS);
} }
void ContextVk::onTransformFeedbackPauseResume() void ContextVk::onTransformFeedbackPauseResume()
...@@ -1928,7 +1938,7 @@ VkColorComponentFlags ContextVk::getClearColorMask() const ...@@ -1928,7 +1938,7 @@ VkColorComponentFlags ContextVk::getClearColorMask() const
return mClearColorMask; return mClearColorMask;
} }
angle::Result ContextVk::handleDirtyDriverUniforms(const gl::Context *context, angle::Result ContextVk::handleDirtyGraphicsDriverUniforms(const gl::Context *context,
vk::CommandBuffer *commandBuffer) vk::CommandBuffer *commandBuffer)
{ {
// Release any previously retained buffers. // Release any previously retained buffers.
...@@ -2401,7 +2411,7 @@ angle::Result ContextVk::getTimestamp(uint64_t *timestampOut) ...@@ -2401,7 +2411,7 @@ angle::Result ContextVk::getTimestamp(uint64_t *timestampOut)
void ContextVk::invalidateDefaultAttribute(size_t attribIndex) void ContextVk::invalidateDefaultAttribute(size_t attribIndex)
{ {
mDirtyDefaultAttribsMask.set(attribIndex); mDirtyDefaultAttribsMask.set(attribIndex);
mDirtyBits.set(DIRTY_BIT_DEFAULT_ATTRIBS); mGraphicsDirtyBits.set(DIRTY_BIT_DEFAULT_ATTRIBS);
} }
void ContextVk::invalidateDefaultAttributes(const gl::AttributesMask &dirtyMask) void ContextVk::invalidateDefaultAttributes(const gl::AttributesMask &dirtyMask)
...@@ -2409,7 +2419,7 @@ void ContextVk::invalidateDefaultAttributes(const gl::AttributesMask &dirtyMask) ...@@ -2409,7 +2419,7 @@ void ContextVk::invalidateDefaultAttributes(const gl::AttributesMask &dirtyMask)
if (dirtyMask.any()) if (dirtyMask.any())
{ {
mDirtyDefaultAttribsMask |= dirtyMask; mDirtyDefaultAttribsMask |= dirtyMask;
mDirtyBits.set(DIRTY_BIT_DEFAULT_ATTRIBS); mGraphicsDirtyBits.set(DIRTY_BIT_DEFAULT_ATTRIBS);
} }
} }
......
...@@ -177,12 +177,15 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::RenderPassO ...@@ -177,12 +177,15 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::RenderPassO
{ {
// TODO: Make the pipeline invalidate more fine-grained. Only need to dirty here if PSO // TODO: Make the pipeline invalidate more fine-grained. Only need to dirty here if PSO
// VtxInput state (stride, fmt, inputRate...) has changed. http://anglebug.com/3256 // VtxInput state (stride, fmt, inputRate...) has changed. http://anglebug.com/3256
invalidateCurrentPipeline(); invalidateCurrentGraphicsPipeline();
mDirtyBits.set(DIRTY_BIT_VERTEX_BUFFERS); mGraphicsDirtyBits.set(DIRTY_BIT_VERTEX_BUFFERS);
mDirtyBits.set(DIRTY_BIT_INDEX_BUFFER); mGraphicsDirtyBits.set(DIRTY_BIT_INDEX_BUFFER);
} }
ANGLE_INLINE void invalidateVertexBuffers() { mDirtyBits.set(DIRTY_BIT_VERTEX_BUFFERS); } ANGLE_INLINE void invalidateVertexBuffers()
{
mGraphicsDirtyBits.set(DIRTY_BIT_VERTEX_BUFFERS);
}
ANGLE_INLINE void onVertexAttributeChange(size_t attribIndex, ANGLE_INLINE void onVertexAttributeChange(size_t attribIndex,
GLuint stride, GLuint stride,
...@@ -223,7 +226,7 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::RenderPassO ...@@ -223,7 +226,7 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::RenderPassO
void setIndexBufferDirty() void setIndexBufferDirty()
{ {
mDirtyBits.set(DIRTY_BIT_INDEX_BUFFER); mGraphicsDirtyBits.set(DIRTY_BIT_INDEX_BUFFER);
mLastIndexBufferOffset = reinterpret_cast<const void *>(angle::DirtyPointer); mLastIndexBufferOffset = reinterpret_cast<const void *>(angle::DirtyPointer);
} }
...@@ -327,7 +330,7 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::RenderPassO ...@@ -327,7 +330,7 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::RenderPassO
using DirtyBitHandler = angle::Result (ContextVk::*)(const gl::Context *, using DirtyBitHandler = angle::Result (ContextVk::*)(const gl::Context *,
vk::CommandBuffer *commandBuffer); vk::CommandBuffer *commandBuffer);
std::array<DirtyBitHandler, DIRTY_BIT_MAX> mDirtyBitHandlers; std::array<DirtyBitHandler, DIRTY_BIT_MAX> mGraphicsDirtyBitHandlers;
angle::Result setupDraw(const gl::Context *context, angle::Result setupDraw(const gl::Context *context,
gl::PrimitiveMode mode, gl::PrimitiveMode mode,
...@@ -367,27 +370,33 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::RenderPassO ...@@ -367,27 +370,33 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::RenderPassO
angle::Result updateActiveTextures(const gl::Context *context); angle::Result updateActiveTextures(const gl::Context *context);
angle::Result updateDefaultAttribute(size_t attribIndex); angle::Result updateDefaultAttribute(size_t attribIndex);
ANGLE_INLINE void invalidateCurrentPipeline() { mDirtyBits.set(DIRTY_BIT_PIPELINE); } ANGLE_INLINE void invalidateCurrentGraphicsPipeline()
{
mGraphicsDirtyBits.set(DIRTY_BIT_PIPELINE);
}
void invalidateCurrentTextures(); void invalidateCurrentTextures();
void invalidateCurrentUniformAndStorageBuffers(); void invalidateCurrentUniformAndStorageBuffers();
void invalidateDriverUniforms(); void invalidateDriverUniforms();
angle::Result handleDirtyDefaultAttribs(const gl::Context *context, // Handlers for graphics pipeline dirty bits.
angle::Result handleDirtyGraphicsDefaultAttribs(const gl::Context *context,
vk::CommandBuffer *commandBuffer);
angle::Result handleDirtyGraphicsPipeline(const gl::Context *context,
vk::CommandBuffer *commandBuffer);
angle::Result handleDirtyGraphicsTextures(const gl::Context *context,
vk::CommandBuffer *commandBuffer); vk::CommandBuffer *commandBuffer);
angle::Result handleDirtyPipeline(const gl::Context *context, vk::CommandBuffer *commandBuffer); angle::Result handleDirtyGraphicsVertexBuffers(const gl::Context *context,
angle::Result handleDirtyTextures(const gl::Context *context, vk::CommandBuffer *commandBuffer);
angle::Result handleDirtyVertexBuffers(const gl::Context *context,
vk::CommandBuffer *commandBuffer); vk::CommandBuffer *commandBuffer);
angle::Result handleDirtyIndexBuffer(const gl::Context *context, angle::Result handleDirtyGraphicsIndexBuffer(const gl::Context *context,
vk::CommandBuffer *commandBuffer); vk::CommandBuffer *commandBuffer);
angle::Result handleDirtyDriverUniforms(const gl::Context *context, angle::Result handleDirtyGraphicsDriverUniforms(const gl::Context *context,
vk::CommandBuffer *commandBuffer); vk::CommandBuffer *commandBuffer);
angle::Result handleDirtyUniformAndStorageBuffers(const gl::Context *context, angle::Result handleDirtyGraphicsUniformAndStorageBuffers(const gl::Context *context,
vk::CommandBuffer *commandBuffer); vk::CommandBuffer *commandBuffer);
angle::Result handleDirtyTransformFeedbackBuffers(const gl::Context *context, angle::Result handleDirtyGraphicsTransformFeedbackBuffers(const gl::Context *context,
vk::CommandBuffer *commandBuffer); vk::CommandBuffer *commandBuffer);
angle::Result handleDirtyDescriptorSets(const gl::Context *context, angle::Result handleDirtyGraphicsDescriptorSets(const gl::Context *context,
vk::CommandBuffer *commandBuffer); vk::CommandBuffer *commandBuffer);
angle::Result submitFrame(const VkSubmitInfo &submitInfo, angle::Result submitFrame(const VkSubmitInfo &submitInfo,
...@@ -406,7 +415,7 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::RenderPassO ...@@ -406,7 +415,7 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::RenderPassO
void waitForSwapchainImageIfNecessary(); void waitForSwapchainImageIfNecessary();
vk::PipelineHelper *mCurrentPipeline; vk::PipelineHelper *mCurrentGraphicsPipeline;
gl::PrimitiveMode mCurrentDrawMode; gl::PrimitiveMode mCurrentDrawMode;
WindowSurfaceVk *mCurrentWindowSurface; WindowSurfaceVk *mCurrentWindowSurface;
...@@ -424,10 +433,10 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::RenderPassO ...@@ -424,10 +433,10 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::RenderPassO
angle::PackedEnumMap<gl::QueryType, vk::DynamicQueryPool> mQueryPools; angle::PackedEnumMap<gl::QueryType, vk::DynamicQueryPool> mQueryPools;
// Dirty bits. // Dirty bits.
DirtyBits mDirtyBits; DirtyBits mGraphicsDirtyBits;
DirtyBits mNonIndexedDirtyBitsMask; DirtyBits mNonIndexedDirtyBitsMask;
DirtyBits mIndexedDirtyBitsMask; DirtyBits mIndexedDirtyBitsMask;
DirtyBits mNewCommandBufferDirtyBits; DirtyBits mNewGraphicsCommandBufferDirtyBits;
// Cached back-end objects. // Cached back-end objects.
VertexArrayVk *mVertexArray; VertexArrayVk *mVertexArray;
......
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