Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Enumerations | Functions
GaneshVulkanSurfaceManager.cpp File Reference
#include "include/core/SkColorSpace.h"
#include "include/gpu/GrContextOptions.h"
#include "include/gpu/ganesh/SkSurfaceGanesh.h"
#include "tools/gpu/BackendSurfaceFactory.h"
#include "tools/gpu/GrContextFactory.h"
#include "tools/testrunners/common/surface_manager/SurfaceManager.h"
#include <string>

Go to the source code of this file.

Classes

class  GaneshVulkanSurfaceManager
 

Enumerations

enum class  SurfaceType {
  kDefault , kBackendTexture , kBackendRenderTarget , kDefault ,
  kBackendTexture , kBackendRenderTarget
}
 

Functions

std::unique_ptr< SurfaceManagermakeVulkanSurfaceManager (std::string config, SurfaceOptions surfaceOptions, GrContextOptions grContextOptions, sk_gpu_test::GrContextFactory::ContextOverrides contextOverrides, SkColorInfo colorInfo, SurfaceType surfaceType, uint32_t surfaceFlags, int sampleCount)
 

Enumeration Type Documentation

◆ SurfaceType

enum class SurfaceType
strong
Enumerator
kDefault 
kBackendTexture 
kBackendRenderTarget 
kDefault 
kBackendTexture 
kBackendRenderTarget 

Definition at line 47 of file GaneshVulkanSurfaceManager.cpp.

Function Documentation

◆ makeVulkanSurfaceManager()

std::unique_ptr< SurfaceManager > makeVulkanSurfaceManager ( std::string  config,
SurfaceOptions  surfaceOptions,
GrContextOptions  grContextOptions,
sk_gpu_test::GrContextFactory::ContextOverrides  contextOverrides,
SkColorInfo  colorInfo,
SurfaceType  surfaceType,
uint32_t  surfaceFlags,
int  sampleCount 
)

Definition at line 49 of file GaneshVulkanSurfaceManager.cpp.

57 {
58 if (surfaceOptions.modifyGrContextOptions) {
59 surfaceOptions.modifyGrContextOptions(&grContextOptions);
60 }
61
62 // Based on
63 // https://skia.googlesource.com/skia/+/8da85ea79d1ba2b3f32d25178eb21f2ebda83437/dm/DMSrcSink.cpp#1579.
64 auto contextFactory = std::make_unique<sk_gpu_test::GrContextFactory>(grContextOptions);
65 sk_gpu_test::ContextInfo contextInfo =
66 contextFactory.get()->getContextInfo(skgpu::ContextType::kVulkan, contextOverrides);
67 GrDirectContext* context = contextInfo.directContext();
68 SkASSERT_RELEASE(context);
69
70 // Based on
71 // https://skia.googlesource.com/skia/+/8da85ea79d1ba2b3f32d25178eb21f2ebda83437/dm/DMSrcSink.cpp#1524.
72 SkImageInfo imageInfo =
73 SkImageInfo::Make({surfaceOptions.width, surfaceOptions.height}, colorInfo);
74 SkSurfaceProps surfaceProps(surfaceFlags, kRGB_H_SkPixelGeometry);
76 switch (surfaceType) {
77 default:
80 context, skgpu::Budgeted::kNo, imageInfo, sampleCount, &surfaceProps);
81 break;
82
85 imageInfo,
87 sampleCount,
88 skgpu::Mipmapped::kNo,
89 skgpu::Protected::kNo,
90 &surfaceProps);
91 break;
92
95 imageInfo,
97 sampleCount,
98 skgpu::Protected::kNo,
99 &surfaceProps);
100 break;
101 }
103
104 return std::make_unique<GaneshVulkanSurfaceManager>(
105 std::move(contextFactory), contextInfo, context, surface, config, colorInfo);
106}
@ kBackendRenderTarget
@ kBottomLeft_GrSurfaceOrigin
Definition GrTypes.h:149
@ kTopLeft_GrSurfaceOrigin
Definition GrTypes.h:148
#define SkASSERT_RELEASE(cond)
Definition SkAssert.h:100
@ kRGB_H_SkPixelGeometry
GrDirectContext * directContext() const
VkSurfaceKHR surface
Definition main.cc:49
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)
sk_sp< SkSurface > MakeBackendRenderTargetSurface(GrDirectContext *dContext, const SkImageInfo &ii, GrSurfaceOrigin origin, int sampleCnt, GrProtected isProtected, const SkSurfaceProps *props)
sk_sp< SkSurface > MakeBackendTextureSurface(GrDirectContext *dContext, const SkImageInfo &ii, GrSurfaceOrigin origin, int sampleCnt, skgpu::Mipmapped mipmapped, GrProtected isProtected, const SkSurfaceProps *props)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
std::function< void(GrContextOptions *)> modifyGrContextOptions