Enable creating protected vulkan backend
This CL allows user to indicate that they have a protected content in
GrVkBackendContext creation which results in protected CommandPool and Queue
usage.
Bug: skia:9016
Change-Id: I6a478d688b6988c2c5e5e98f18f58fb21f9d26ae
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/210067
Commit-Queue: Greg Daniel <egdaniel@google.com>
Auto-Submit: Emircan Uysaler <emircan@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrRecordingContext.cpp b/src/gpu/GrRecordingContext.cpp
index bdf5edf..405ec01 100644
--- a/src/gpu/GrRecordingContext.cpp
+++ b/src/gpu/GrRecordingContext.cpp
@@ -190,16 +190,10 @@
}
sk_sp<GrRenderTargetContext> GrRecordingContext::makeDeferredRenderTargetContext(
- const GrBackendFormat& format,
- SkBackingFit fit,
- int width, int height,
- GrPixelConfig config,
- sk_sp<SkColorSpace> colorSpace,
- int sampleCnt,
- GrMipMapped mipMapped,
- GrSurfaceOrigin origin,
- const SkSurfaceProps* surfaceProps,
- SkBudgeted budgeted) {
+ const GrBackendFormat& format, SkBackingFit fit, int width, int height,
+ GrPixelConfig config, sk_sp<SkColorSpace> colorSpace, int sampleCnt, GrMipMapped mipMapped,
+ GrSurfaceOrigin origin, const SkSurfaceProps* surfaceProps, SkBudgeted budgeted,
+ GrProtected isProtected) {
SkASSERT(sampleCnt > 0);
if (this->abandoned()) {
return nullptr;
@@ -209,6 +203,7 @@
desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fWidth = width;
desc.fHeight = height;
+ desc.fIsProtected = isProtected;
desc.fConfig = config;
desc.fSampleCnt = sampleCnt;
@@ -263,16 +258,10 @@
}
sk_sp<GrRenderTargetContext> GrRecordingContext::makeDeferredRenderTargetContextWithFallback(
- const GrBackendFormat& format,
- SkBackingFit fit,
- int width, int height,
- GrPixelConfig config,
- sk_sp<SkColorSpace> colorSpace,
- int sampleCnt,
- GrMipMapped mipMapped,
- GrSurfaceOrigin origin,
- const SkSurfaceProps* surfaceProps,
- SkBudgeted budgeted) {
+ const GrBackendFormat& format, SkBackingFit fit, int width, int height,
+ GrPixelConfig config, sk_sp<SkColorSpace> colorSpace, int sampleCnt, GrMipMapped mipMapped,
+ GrSurfaceOrigin origin, const SkSurfaceProps* surfaceProps, SkBudgeted budgeted,
+ GrProtected isProtected) {
GrBackendFormat localFormat = format;
SkASSERT(sampleCnt > 0);
if (0 == this->caps()->getRenderTargetSampleCount(sampleCnt, config)) {
@@ -331,36 +320,24 @@
}
sk_sp<GrRenderTargetContext> GrRecordingContextPriv::makeDeferredRenderTargetContext(
- const GrBackendFormat& format,
- SkBackingFit fit,
- int width, int height,
- GrPixelConfig config,
- sk_sp<SkColorSpace> colorSpace,
- int sampleCnt,
- GrMipMapped mipMapped,
- GrSurfaceOrigin origin,
- const SkSurfaceProps* surfaceProps,
- SkBudgeted budgeted) {
+ const GrBackendFormat& format, SkBackingFit fit, int width, int height,
+ GrPixelConfig config, sk_sp<SkColorSpace> colorSpace, int sampleCnt, GrMipMapped mipMapped,
+ GrSurfaceOrigin origin, const SkSurfaceProps* surfaceProps, SkBudgeted budgeted,
+ GrProtected isProtected) {
return fContext->makeDeferredRenderTargetContext(format, fit, width, height, config,
std::move(colorSpace), sampleCnt, mipMapped,
- origin, surfaceProps, budgeted);
+ origin, surfaceProps, budgeted, isProtected);
}
sk_sp<GrRenderTargetContext> GrRecordingContextPriv::makeDeferredRenderTargetContextWithFallback(
- const GrBackendFormat& format,
- SkBackingFit fit,
- int width, int height,
- GrPixelConfig config,
- sk_sp<SkColorSpace> colorSpace,
- int sampleCnt,
- GrMipMapped mipMapped,
- GrSurfaceOrigin origin,
- const SkSurfaceProps* surfaceProps,
- SkBudgeted budgeted) {
+ const GrBackendFormat& format, SkBackingFit fit, int width, int height,
+ GrPixelConfig config, sk_sp<SkColorSpace> colorSpace, int sampleCnt, GrMipMapped mipMapped,
+ GrSurfaceOrigin origin, const SkSurfaceProps* surfaceProps, SkBudgeted budgeted,
+ GrProtected isProtected) {
return fContext->makeDeferredRenderTargetContextWithFallback(format, fit, width, height, config,
std::move(colorSpace), sampleCnt,
mipMapped, origin, surfaceProps,
- budgeted);
+ budgeted, isProtected);
}
GrContext* GrRecordingContextPriv::backdoor() {