Skip to content

Commit

Permalink
Vulkan: Rename Context to ErrorContext
Browse files Browse the repository at this point in the history
In preparation for adding another Context (derived by GL and CL
contexts), which includes logic that pertains to command recording (such
as barrier tracking).

Bug: angleproject:390443243
Change-Id: Idf495b62e63fb9aa901a2f16447fdaf3c2acd90b
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6191248
Auto-Submit: Shahbaz Youssefi <[email protected]>
Commit-Queue: Charlie Lao <[email protected]>
Reviewed-by: Charlie Lao <[email protected]>
Commit-Queue: Shahbaz Youssefi <[email protected]>
  • Loading branch information
ShabbyX authored and Angle LUCI CQ committed Jan 23, 2025
1 parent 92cc4e0 commit c1214ec
Show file tree
Hide file tree
Showing 71 changed files with 825 additions and 783 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"src/libANGLE/renderer/vulkan/gen_vk_internal_shaders.py":
"533126aa7c34c64e7ea8c635db4c45fa",
"62278fc740a3deaf2bd07ef77422b1c4",
"src/libANGLE/renderer/vulkan/shaders/gen/Blit3DSrc.frag.00000000.inc":
"dcc2e34fb04417a2f4dc26ebab803380",
"src/libANGLE/renderer/vulkan/shaders/gen/Blit3DSrc.frag.00000001.inc":
Expand Down Expand Up @@ -358,9 +358,9 @@
"src/libANGLE/renderer/vulkan/shaders/src/OverlayDraw.vert":
"5aa33152fce5b9261c4d427ad2babdd7",
"src/libANGLE/renderer/vulkan/vk_internal_shaders_autogen.cpp":
"75829eadf0c0b4bce5834a851f4c4034",
"e9f13dec1bd2b0171deaa1de3516a626",
"src/libANGLE/renderer/vulkan/vk_internal_shaders_autogen.h":
"f355d503dcd38440bde220bb57d8dc49",
"b5fd3e48b63232c8faab1342701b257a",
"tools/glslang/glslang_validator.exe.sha1":
"17e862cc6f462fecbf50b24ed6544a27",
"tools/glslang/glslang_validator.sha1":
Expand Down
2 changes: 1 addition & 1 deletion src/libANGLE/renderer/vulkan/BufferVk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ void BufferVk::destroy(const gl::Context *context)
(void)release(contextVk);
}

void BufferVk::releaseConversionBuffers(vk::Context *context)
void BufferVk::releaseConversionBuffers(vk::ErrorContext *context)
{
for (ConversionBuffer &buffer : mVertexConversionBuffers)
{
Expand Down
4 changes: 2 additions & 2 deletions src/libANGLE/renderer/vulkan/BufferVk.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ConversionBuffer

bool valid() const { return mData && mData->valid(); }
vk::BufferHelper *getBuffer() const { return mData.get(); }
void release(vk::Context *context) { mData->release(context); }
void release(vk::ErrorContext *context) { mData->release(context); }
void destroy(vk::Renderer *renderer) { mData->destroy(renderer); }

private:
Expand Down Expand Up @@ -293,7 +293,7 @@ class BufferVk : public BufferImpl
VkMemoryPropertyFlags memoryPropertyFlags,
size_t size) const;

void releaseConversionBuffers(vk::Context *context);
void releaseConversionBuffers(vk::ErrorContext *context);

vk::BufferHelper mBuffer;

Expand Down
2 changes: 1 addition & 1 deletion src/libANGLE/renderer/vulkan/CLContextVk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace rx

CLContextVk::CLContextVk(const cl::Context &context, const cl::DevicePtrs devicePtrs)
: CLContextImpl(context),
vk::Context(getPlatform()->getRenderer()),
vk::ErrorContext(getPlatform()->getRenderer()),
mAssociatedDevices(devicePtrs)
{
mDeviceQueueIndex = mRenderer->getDefaultDeviceQueueIndex();
Expand Down
2 changes: 1 addition & 1 deletion src/libANGLE/renderer/vulkan/CLContextVk.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace rx

class CLKernelVk;

class CLContextVk : public CLContextImpl, public vk::Context
class CLContextVk : public CLContextImpl, public vk::ErrorContext
{
public:
CLContextVk(const cl::Context &context, const cl::DevicePtrs devicePtrs);
Expand Down
2 changes: 1 addition & 1 deletion src/libANGLE/renderer/vulkan/CLPlatformVk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ const std::string &CLPlatformVk::GetVersionString()
}

CLPlatformVk::CLPlatformVk(const cl::Platform &platform)
: CLPlatformImpl(platform), vk::Context(new vk::Renderer()), mBlobCache(1024 * 1024)
: CLPlatformImpl(platform), vk::ErrorContext(new vk::Renderer()), mBlobCache(1024 * 1024)
{}

void CLPlatformVk::handleError(VkResult result,
Expand Down
4 changes: 2 additions & 2 deletions src/libANGLE/renderer/vulkan/CLPlatformVk.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
namespace rx
{

class CLPlatformVk : public CLPlatformImpl, public vk::Context, public vk::GlobalOps
class CLPlatformVk : public CLPlatformImpl, public vk::ErrorContext, public vk::GlobalOps
{
public:
using Ptr = std::unique_ptr<CLPlatformVk>;
Expand Down Expand Up @@ -50,7 +50,7 @@ class CLPlatformVk : public CLPlatformImpl, public vk::Context, public vk::Globa

angle::Result initBackendRenderer();

// vk::Context
// vk::ErrorContext
void handleError(VkResult result,
const char *file,
const char *function,
Expand Down
52 changes: 26 additions & 26 deletions src/libANGLE/renderer/vulkan/CommandQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ void RecyclableFence::destroy(VkDevice device)
}

// FenceRecycler implementation
void FenceRecycler::destroy(Context *context)
void FenceRecycler::destroy(ErrorContext *context)
{
std::lock_guard<angle::SimpleMutex> lock(mMutex);
mRecycler.destroy(context->getDevice());
Expand Down Expand Up @@ -185,7 +185,7 @@ void CommandBatch::destroy(VkDevice device)
// Do not clean other members to catch invalid reuse attempt with ASSERTs.
}

angle::Result CommandBatch::release(Context *context)
angle::Result CommandBatch::release(ErrorContext *context)
{
if (mPrimaryCommands.valid())
{
Expand Down Expand Up @@ -341,15 +341,15 @@ void CleanUpThread::handleError(VkResult errorCode,
}

CleanUpThread::CleanUpThread(Renderer *renderer, CommandQueue *commandQueue)
: Context(renderer),
: ErrorContext(renderer),
mCommandQueue(commandQueue),
mTaskThreadShouldExit(false),
mNeedCleanUp(false)
{}

CleanUpThread::~CleanUpThread() = default;

angle::Result CleanUpThread::checkAndPopPendingError(Context *errorHandlingContext)
angle::Result CleanUpThread::checkAndPopPendingError(ErrorContext *errorHandlingContext)
{
std::lock_guard<angle::SimpleMutex> queueLock(mErrorMutex);
if (mErrors.empty())
Expand Down Expand Up @@ -431,7 +431,7 @@ angle::Result CleanUpThread::init()
return angle::Result::Continue;
}

void CleanUpThread::destroy(Context *context)
void CleanUpThread::destroy(ErrorContext *context)
{
{
// Request to terminate the worker thread
Expand Down Expand Up @@ -459,7 +459,7 @@ CommandPoolAccess::~CommandPoolAccess() = default;

// CommandPoolAccess public API implementation. These must be thread safe and never called from
// CommandPoolAccess class itself.
angle::Result CommandPoolAccess::initCommandPool(Context *context,
angle::Result CommandPoolAccess::initCommandPool(ErrorContext *context,
ProtectionType protectionType,
const uint32_t queueFamilyIndex)
{
Expand Down Expand Up @@ -497,7 +497,7 @@ void CommandPoolAccess::destroyPrimaryCommandBuffer(VkDevice device,
primaryCommands->destroy(device);
}

angle::Result CommandPoolAccess::collectPrimaryCommandBuffer(Context *context,
angle::Result CommandPoolAccess::collectPrimaryCommandBuffer(ErrorContext *context,
const ProtectionType protectionType,
PrimaryCommandBuffer *primaryCommands)
{
Expand All @@ -511,7 +511,7 @@ angle::Result CommandPoolAccess::collectPrimaryCommandBuffer(Context *context,
}

angle::Result CommandPoolAccess::flushOutsideRPCommands(
Context *context,
ErrorContext *context,
ProtectionType protectionType,
egl::ContextPriority priority,
OutsideRenderPassCommandBufferHelper **outsideRPCommands)
Expand All @@ -523,7 +523,7 @@ angle::Result CommandPoolAccess::flushOutsideRPCommands(
}

angle::Result CommandPoolAccess::flushRenderPassCommands(
Context *context,
ErrorContext *context,
const ProtectionType &protectionType,
const egl::ContextPriority &priority,
const RenderPass &renderPass,
Expand Down Expand Up @@ -559,7 +559,7 @@ void CommandPoolAccess::flushWaitSemaphores(
}

angle::Result CommandPoolAccess::getCommandsAndWaitSemaphores(
Context *context,
ErrorContext *context,
ProtectionType protectionType,
egl::ContextPriority priority,
CommandBatch *batchOut,
Expand Down Expand Up @@ -599,7 +599,7 @@ CommandQueue::CommandQueue()

CommandQueue::~CommandQueue() = default;

void CommandQueue::destroy(Context *context)
void CommandQueue::destroy(ErrorContext *context)
{
std::lock_guard<angle::SimpleMutex> queueSubmitLock(mQueueSubmitMutex);
std::lock_guard<angle::SimpleMutex> cmdCompleteLock(mCmdCompleteMutex);
Expand All @@ -619,7 +619,7 @@ void CommandQueue::destroy(Context *context)
ASSERT(mNumAllCommands == 0);
}

angle::Result CommandQueue::init(Context *context,
angle::Result CommandQueue::init(ErrorContext *context,
const QueueFamily &queueFamily,
bool enableProtectedContent,
uint32_t queueCount)
Expand Down Expand Up @@ -670,7 +670,7 @@ void CommandQueue::handleDeviceLost(Renderer *renderer)
}
}

angle::Result CommandQueue::postSubmitCheck(Context *context)
angle::Result CommandQueue::postSubmitCheck(ErrorContext *context)
{
Renderer *renderer = context->getRenderer();

Expand Down Expand Up @@ -702,7 +702,7 @@ angle::Result CommandQueue::postSubmitCheck(Context *context)
return angle::Result::Continue;
}

angle::Result CommandQueue::finishResourceUse(Context *context,
angle::Result CommandQueue::finishResourceUse(ErrorContext *context,
const ResourceUse &use,
uint64_t timeout)
{
Expand Down Expand Up @@ -732,15 +732,15 @@ angle::Result CommandQueue::finishResourceUse(Context *context,
return angle::Result::Continue;
}

angle::Result CommandQueue::finishQueueSerial(Context *context,
angle::Result CommandQueue::finishQueueSerial(ErrorContext *context,
const QueueSerial &queueSerial,
uint64_t timeout)
{
ResourceUse use(queueSerial);
return finishResourceUse(context, use, timeout);
}

angle::Result CommandQueue::waitIdle(Context *context, uint64_t timeout)
angle::Result CommandQueue::waitIdle(ErrorContext *context, uint64_t timeout)
{
// Fill the local variable with lock
ResourceUse use;
Expand All @@ -756,7 +756,7 @@ angle::Result CommandQueue::waitIdle(Context *context, uint64_t timeout)
return finishResourceUse(context, use, timeout);
}

angle::Result CommandQueue::waitForResourceUseToFinishWithUserTimeout(Context *context,
angle::Result CommandQueue::waitForResourceUseToFinishWithUserTimeout(ErrorContext *context,
const ResourceUse &use,
uint64_t timeout,
VkResult *result)
Expand Down Expand Up @@ -823,7 +823,7 @@ bool CommandQueue::isBusy(Renderer *renderer) const
return false;
}

angle::Result CommandQueue::submitCommands(Context *context,
angle::Result CommandQueue::submitCommands(ErrorContext *context,
ProtectionType protectionType,
egl::ContextPriority priority,
VkSemaphore signalSemaphore,
Expand Down Expand Up @@ -889,7 +889,7 @@ angle::Result CommandQueue::submitCommands(Context *context,
return queueSubmitLocked(context, priority, submitInfo, scopedBatch, submitQueueSerial);
}

angle::Result CommandQueue::queueSubmitOneOff(Context *context,
angle::Result CommandQueue::queueSubmitOneOff(ErrorContext *context,
ProtectionType protectionType,
egl::ContextPriority contextPriority,
VkCommandBuffer commandBufferHandle,
Expand Down Expand Up @@ -938,7 +938,7 @@ angle::Result CommandQueue::queueSubmitOneOff(Context *context,
return queueSubmitLocked(context, contextPriority, submitInfo, scopedBatch, submitQueueSerial);
}

angle::Result CommandQueue::queueSubmitLocked(Context *context,
angle::Result CommandQueue::queueSubmitLocked(ErrorContext *context,
egl::ContextPriority contextPriority,
const VkSubmitInfo &submitInfo,
DeviceScoped<CommandBatch> &commandBatch,
Expand Down Expand Up @@ -1025,7 +1025,7 @@ void CommandQueue::resetPerFramePerfCounters()
mPerfCounters.vkQueueSubmitCallsPerFrame = 0;
}

angle::Result CommandQueue::releaseFinishedCommandsAndCleanupGarbage(Context *context)
angle::Result CommandQueue::releaseFinishedCommandsAndCleanupGarbage(ErrorContext *context)
{
Renderer *renderer = context->getRenderer();
if (renderer->isAsyncCommandBufferResetAndGarbageCleanupEnabled())
Expand All @@ -1042,7 +1042,7 @@ angle::Result CommandQueue::releaseFinishedCommandsAndCleanupGarbage(Context *co
return angle::Result::Continue;
}

angle::Result CommandQueue::cleanupSomeGarbage(Context *context,
angle::Result CommandQueue::cleanupSomeGarbage(ErrorContext *context,
size_t minInFlightBatchesToKeep,
bool *anyGarbageCleanedOut)
{
Expand Down Expand Up @@ -1074,7 +1074,7 @@ angle::Result CommandQueue::cleanupSomeGarbage(Context *context,
}

// CommandQueue private API implementation. These are called by public API, so lock already held.
angle::Result CommandQueue::checkOneCommandBatchLocked(Context *context, bool *finished)
angle::Result CommandQueue::checkOneCommandBatchLocked(ErrorContext *context, bool *finished)
{
ASSERT(!mInFlightCommands.empty());

Expand All @@ -1096,7 +1096,7 @@ angle::Result CommandQueue::checkOneCommandBatchLocked(Context *context, bool *f
return angle::Result::Continue;
}

angle::Result CommandQueue::finishOneCommandBatch(Context *context,
angle::Result CommandQueue::finishOneCommandBatch(ErrorContext *context,
uint64_t timeout,
std::unique_lock<angle::SimpleMutex> *lock)
{
Expand Down Expand Up @@ -1130,7 +1130,7 @@ void CommandQueue::onCommandBatchFinishedLocked(CommandBatch &&batch)
moveInFlightBatchToFinishedQueueLocked(std::move(batch));
}

angle::Result CommandQueue::releaseFinishedCommandsLocked(Context *context)
angle::Result CommandQueue::releaseFinishedCommandsLocked(ErrorContext *context)
{
ANGLE_TRACE_EVENT0("gpu.angle", "releaseFinishedCommandsLocked");

Expand All @@ -1145,7 +1145,7 @@ angle::Result CommandQueue::releaseFinishedCommandsLocked(Context *context)
return angle::Result::Continue;
}

angle::Result CommandQueue::checkCompletedCommandsLocked(Context *context)
angle::Result CommandQueue::checkCompletedCommandsLocked(ErrorContext *context)
{
while (!mInFlightCommands.empty())
{
Expand Down
Loading

0 comments on commit c1214ec

Please sign in to comment.