Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 76efc4a3 authored by Noelle Scobie's avatar Noelle Scobie
Browse files

Merge duplicate APIs in VulkanInterface

Now that the Ganesh and Graphite share the same VulkanBackendContext
type, the two `getGaneshBackendContext` and `getGraphiteBackendContext`
functions on RenderEngine's VulanInterface can be merged.

I've tweaked the name to `createSkiaVulkanBackendContext` for clarity.

Bug: b/309785258
Test: compiles (refactor)
Flag: EXEMPT trivial refactor
Change-Id: I84aa3f4f2e06cf660dfc13be68795843596d0809
parent 528f45c5
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -55,7 +55,7 @@ static void unref_semaphore(void* semaphore) {


std::unique_ptr<SkiaGpuContext> GaneshVkRenderEngine::createContext(
std::unique_ptr<SkiaGpuContext> GaneshVkRenderEngine::createContext(
        VulkanInterface& vulkanInterface) {
        VulkanInterface& vulkanInterface) {
    return SkiaGpuContext::MakeVulkan_Ganesh(vulkanInterface.getGaneshBackendContext(),
    return SkiaGpuContext::MakeVulkan_Ganesh(vulkanInterface.createSkiaVulkanBackendContext(),
                                             mSkSLCacheMonitor);
                                             mSkSLCacheMonitor);
}
}


+1 −1
Original line number Original line Diff line number Diff line
@@ -65,7 +65,7 @@ static void unref_semaphore(void* semaphore, skgpu::CallbackResult result) {


std::unique_ptr<SkiaGpuContext> GraphiteVkRenderEngine::createContext(
std::unique_ptr<SkiaGpuContext> GraphiteVkRenderEngine::createContext(
        VulkanInterface& vulkanInterface) {
        VulkanInterface& vulkanInterface) {
    return SkiaGpuContext::MakeVulkan_Graphite(vulkanInterface.getGraphiteBackendContext());
    return SkiaGpuContext::MakeVulkan_Graphite(vulkanInterface.createSkiaVulkanBackendContext());
}
}


void GraphiteVkRenderEngine::waitFence(SkiaGpuContext*, base::borrowed_fd fenceFd) {
void GraphiteVkRenderEngine::waitFence(SkiaGpuContext*, base::borrowed_fd fenceFd) {
+1 −5
Original line number Original line Diff line number Diff line
@@ -32,11 +32,7 @@ namespace android {
namespace renderengine {
namespace renderengine {
namespace skia {
namespace skia {


VulkanBackendContext VulkanInterface::getGaneshBackendContext() {
VulkanBackendContext VulkanInterface::createSkiaVulkanBackendContext() {
    return this->getGraphiteBackendContext();
};

VulkanBackendContext VulkanInterface::getGraphiteBackendContext() {
    VulkanBackendContext backendContext;
    VulkanBackendContext backendContext;
    backendContext.fInstance = mInstance;
    backendContext.fInstance = mInstance;
    backendContext.fPhysicalDevice = mPhysicalDevice;
    backendContext.fPhysicalDevice = mPhysicalDevice;
+1 −3
Original line number Original line Diff line number Diff line
@@ -44,9 +44,7 @@ public:
    bool takeOwnership();
    bool takeOwnership();
    void teardown();
    void teardown();


    // TODO(b/309785258) Combine these into one now that they are the same implementation.
    VulkanBackendContext createSkiaVulkanBackendContext();
    VulkanBackendContext getGaneshBackendContext();
    VulkanBackendContext getGraphiteBackendContext();
    VkSemaphore createExportableSemaphore();
    VkSemaphore createExportableSemaphore();
    VkSemaphore importSemaphoreFromSyncFd(int syncFd);
    VkSemaphore importSemaphoreFromSyncFd(int syncFd);
    int exportSemaphoreSyncFd(VkSemaphore semaphore);
    int exportSemaphoreSyncFd(VkSemaphore semaphore);