Revert "Store GrSwizzle on proxies for texturing and swizzling."
This reverts commit 23093135d1
.
Reason for revert: Breaking Google3 :(
Original change's description:
> Store GrSwizzle on proxies for texturing and swizzling.
>
> Bug: skia: 6718
> Change-Id: I023d7507da9334e984ac8209a32323d616b3d79d
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/214305
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>
TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
Change-Id: Ie2303ad090f58de07db7b0ac2d42e06e5e5bbcc1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia: 6718
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/221338
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
23093135d1
commit
3ec1f54750
@ -44,7 +44,6 @@ skia_gpu_sources = [
|
||||
"$_include/private/GrResourceKey.h",
|
||||
"$_include/private/GrSingleOwner.h",
|
||||
"$_include/private/GrSurfaceProxy.h",
|
||||
"$_include/private/GrSwizzle.h",
|
||||
"$_include/private/GrTextureProxy.h",
|
||||
"$_include/private/GrTypesPriv.h",
|
||||
|
||||
@ -195,6 +194,7 @@ skia_gpu_sources = [
|
||||
"$_src/gpu/GrSurfaceContextPriv.h",
|
||||
"$_src/gpu/GrSurfaceProxyPriv.h",
|
||||
"$_src/gpu/GrSwizzle.cpp",
|
||||
"$_src/gpu/GrSwizzle.h",
|
||||
"$_src/gpu/GrTessellator.cpp",
|
||||
"$_src/gpu/GrTessellator.h",
|
||||
"$_src/gpu/GrTextureOpList.cpp",
|
||||
|
@ -9,7 +9,6 @@
|
||||
#define GrRenderTargetProxy_DEFINED
|
||||
|
||||
#include "include/private/GrSurfaceProxy.h"
|
||||
#include "include/private/GrSwizzle.h"
|
||||
#include "include/private/GrTypesPriv.h"
|
||||
|
||||
class GrResourceProvider;
|
||||
@ -55,8 +54,6 @@ public:
|
||||
|
||||
int maxWindowRectangles(const GrCaps& caps) const;
|
||||
|
||||
const GrSwizzle& outputSwizzle() const { return fOutputSwizzle; }
|
||||
|
||||
bool wrapsVkSecondaryCB() const { return fWrapsVkSecondaryCB == WrapsVkSecondaryCB::kYes; }
|
||||
|
||||
// TODO: move this to a priv class!
|
||||
@ -72,9 +69,7 @@ protected:
|
||||
|
||||
// Deferred version
|
||||
GrRenderTargetProxy(const GrCaps&, const GrBackendFormat&, const GrSurfaceDesc&,
|
||||
GrSurfaceOrigin, const GrSwizzle& textureSwizzle,
|
||||
const GrSwizzle& outputSwizzle, SkBackingFit, SkBudgeted,
|
||||
GrInternalSurfaceFlags);
|
||||
GrSurfaceOrigin, SkBackingFit, SkBudgeted, GrInternalSurfaceFlags);
|
||||
|
||||
enum class WrapsVkSecondaryCB : bool { kNo = false, kYes = true };
|
||||
|
||||
@ -90,13 +85,11 @@ protected:
|
||||
// know the final size until flush time.
|
||||
GrRenderTargetProxy(LazyInstantiateCallback&&, LazyInstantiationType lazyType,
|
||||
const GrBackendFormat&, const GrSurfaceDesc&, GrSurfaceOrigin,
|
||||
const GrSwizzle& textureSwizzle, const GrSwizzle& outputSwizzle,
|
||||
SkBackingFit, SkBudgeted, GrInternalSurfaceFlags,
|
||||
WrapsVkSecondaryCB wrapsVkSecondaryCB);
|
||||
|
||||
// Wrapped version
|
||||
GrRenderTargetProxy(sk_sp<GrSurface>, GrSurfaceOrigin, const GrSwizzle& textureSwizzle,
|
||||
const GrSwizzle& outputSwizzle,
|
||||
GrRenderTargetProxy(sk_sp<GrSurface>, GrSurfaceOrigin,
|
||||
WrapsVkSecondaryCB wrapsVkSecondaryCB = WrapsVkSecondaryCB::kNo);
|
||||
|
||||
sk_sp<GrSurface> createSurface(GrResourceProvider*) const override;
|
||||
@ -127,15 +120,8 @@ private:
|
||||
// address of other types, leading to this problem.
|
||||
|
||||
int fSampleCnt;
|
||||
GrSwizzle fOutputSwizzle;
|
||||
bool fNeedsStencil;
|
||||
WrapsVkSecondaryCB fWrapsVkSecondaryCB;
|
||||
// This is to fix issue in large comment above. Without the padding we end 6 bytes into a 16
|
||||
// byte range, so the GrTextureProxy ends up starting 8 byte aligned by not 16. We add the
|
||||
// padding here to get us right up to the 16 byte alignment (technically any padding of 3-10
|
||||
// bytes would work since it always goes up to 8 byte alignment, but we use 10 to more explicit
|
||||
// about what we're doing).
|
||||
char fDummyPadding[10];
|
||||
|
||||
// For wrapped render targets the actual GrRenderTarget is stored in the GrIORefProxy class.
|
||||
// For deferred proxies that pointer is filled in when we need to instantiate the
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "include/gpu/GrGpuResource.h"
|
||||
#include "include/gpu/GrSurface.h"
|
||||
#include "include/gpu/GrTexture.h"
|
||||
#include "include/private/GrSwizzle.h"
|
||||
#include "include/private/SkNoncopyable.h"
|
||||
|
||||
class GrCaps;
|
||||
@ -250,8 +249,6 @@ public:
|
||||
return fOrigin;
|
||||
}
|
||||
|
||||
const GrSwizzle& textureSwizzle() const { return fTextureSwizzle; }
|
||||
|
||||
const GrBackendFormat& backendFormat() const { return fFormat; }
|
||||
|
||||
class UniqueID {
|
||||
@ -417,22 +414,20 @@ public:
|
||||
protected:
|
||||
// Deferred version
|
||||
GrSurfaceProxy(const GrBackendFormat& format, const GrSurfaceDesc& desc,
|
||||
GrSurfaceOrigin origin, const GrSwizzle& textureSwizzle, SkBackingFit fit,
|
||||
GrSurfaceOrigin origin, SkBackingFit fit,
|
||||
SkBudgeted budgeted, GrInternalSurfaceFlags surfaceFlags)
|
||||
: GrSurfaceProxy(nullptr, LazyInstantiationType::kSingleUse, format, desc, origin,
|
||||
textureSwizzle, fit, budgeted, surfaceFlags) {
|
||||
: GrSurfaceProxy(nullptr, LazyInstantiationType::kSingleUse, format, desc, origin, fit,
|
||||
budgeted, surfaceFlags) {
|
||||
// Note: this ctor pulls a new uniqueID from the same pool at the GrGpuResources
|
||||
}
|
||||
|
||||
// Lazy-callback version
|
||||
GrSurfaceProxy(LazyInstantiateCallback&&, LazyInstantiationType,
|
||||
const GrBackendFormat& format, const GrSurfaceDesc&, GrSurfaceOrigin,
|
||||
const GrSwizzle& textureSwizzle, SkBackingFit, SkBudgeted,
|
||||
GrInternalSurfaceFlags);
|
||||
SkBackingFit, SkBudgeted, GrInternalSurfaceFlags);
|
||||
|
||||
// Wrapped version.
|
||||
GrSurfaceProxy(sk_sp<GrSurface>, GrSurfaceOrigin, const GrSwizzle& textureSwizzle,
|
||||
SkBackingFit);
|
||||
GrSurfaceProxy(sk_sp<GrSurface>, GrSurfaceOrigin, SkBackingFit);
|
||||
|
||||
virtual ~GrSurfaceProxy();
|
||||
|
||||
@ -483,8 +478,6 @@ private:
|
||||
int fWidth;
|
||||
int fHeight;
|
||||
GrSurfaceOrigin fOrigin;
|
||||
GrSwizzle fTextureSwizzle;
|
||||
|
||||
SkBackingFit fFit; // always kApprox for lazy-callback resources
|
||||
// always kExact for wrapped resources
|
||||
mutable SkBudgeted fBudgeted; // always kYes for lazy-callback resources
|
||||
|
@ -88,10 +88,13 @@ protected:
|
||||
friend class GrTextureProxyPriv;
|
||||
friend class GrSurfaceProxyPriv; // ability to change key sync state after lazy instantiation.
|
||||
|
||||
// Deferred version - when constructed with data the origin is always kTopLeft.
|
||||
GrTextureProxy(const GrBackendFormat&, const GrSurfaceDesc& srcDesc, GrMipMapped, SkBackingFit,
|
||||
SkBudgeted, const void* srcData, size_t srcRowBytes, GrInternalSurfaceFlags);
|
||||
|
||||
// Deferred version - no data.
|
||||
GrTextureProxy(const GrBackendFormat&, const GrSurfaceDesc& srcDesc, GrSurfaceOrigin,
|
||||
GrMipMapped, const GrSwizzle& textureSwizzle, SkBackingFit, SkBudgeted,
|
||||
GrInternalSurfaceFlags);
|
||||
GrMipMapped, SkBackingFit, SkBudgeted, GrInternalSurfaceFlags);
|
||||
|
||||
// Lazy-callback version
|
||||
// There are two main use cases for lazily-instantiated proxies:
|
||||
@ -104,11 +107,11 @@ protected:
|
||||
// The minimal knowledge version is used for CCPR where we are generating an atlas but we do not
|
||||
// know the final size until flush time.
|
||||
GrTextureProxy(LazyInstantiateCallback&&, LazyInstantiationType, const GrBackendFormat&,
|
||||
const GrSurfaceDesc& desc, GrSurfaceOrigin, GrMipMapped, const GrSwizzle&,
|
||||
SkBackingFit, SkBudgeted, GrInternalSurfaceFlags);
|
||||
const GrSurfaceDesc& desc, GrSurfaceOrigin, GrMipMapped, SkBackingFit,
|
||||
SkBudgeted, GrInternalSurfaceFlags);
|
||||
|
||||
// Wrapped version
|
||||
GrTextureProxy(sk_sp<GrSurface>, GrSurfaceOrigin, const GrSwizzle&);
|
||||
GrTextureProxy(sk_sp<GrSurface>, GrSurfaceOrigin);
|
||||
|
||||
~GrTextureProxy() override;
|
||||
|
||||
|
@ -11,13 +11,13 @@
|
||||
#include "include/core/SkPath.h"
|
||||
#include "include/core/SkSurface.h"
|
||||
#include "include/gpu/GrTypes.h"
|
||||
#include "include/private/GrSwizzle.h"
|
||||
#include "include/private/SkTArray.h"
|
||||
#include "src/gpu/GrAllocator.h"
|
||||
#include "src/gpu/GrCaps.h"
|
||||
#include "src/gpu/GrGpuCommandBuffer.h"
|
||||
#include "src/gpu/GrProgramDesc.h"
|
||||
#include "src/gpu/GrSamplePatternDictionary.h"
|
||||
#include "src/gpu/GrSwizzle.h"
|
||||
#include "src/gpu/GrTextureProducer.h"
|
||||
#include "src/gpu/GrXferProcessor.h"
|
||||
#include <map>
|
||||
|
@ -154,15 +154,11 @@ sk_sp<GrTextureProxy> GrProxyProvider::createWrapped(sk_sp<GrTexture> tex, GrSur
|
||||
SkASSERT(!this->findProxyByUniqueKey(tex->getUniqueKey(), origin));
|
||||
}
|
||||
#endif
|
||||
GrColorType colorType = GrPixelConfigToColorType(tex->config());
|
||||
GrSwizzle texSwizzle = this->caps()->getTextureSwizzle(tex->backendFormat(), colorType);
|
||||
|
||||
if (tex->asRenderTarget()) {
|
||||
GrSwizzle outSwizzle = this->caps()->getOutputSwizzle(tex->backendFormat(), colorType);
|
||||
return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(std::move(tex), origin,
|
||||
texSwizzle, outSwizzle));
|
||||
return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(std::move(tex), origin));
|
||||
} else {
|
||||
return sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(tex), origin, texSwizzle));
|
||||
return sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(tex), origin));
|
||||
}
|
||||
}
|
||||
|
||||
@ -452,20 +448,15 @@ sk_sp<GrTextureProxy> GrProxyProvider::createProxy(const GrBackendFormat& format
|
||||
this->caps()->getRenderTargetSampleCount(desc.fSampleCnt, desc.fConfig);
|
||||
}
|
||||
|
||||
GrColorType colorType = GrPixelConfigToColorType(desc.fConfig);
|
||||
GrSwizzle texSwizzle = this->caps()->getTextureSwizzle(format, colorType);
|
||||
|
||||
if (copyDesc.fFlags & kRenderTarget_GrSurfaceFlag) {
|
||||
// We know anything we instantiate later from this deferred path will be
|
||||
// both texturable and renderable
|
||||
GrSwizzle outSwizzle = this->caps()->getOutputSwizzle(format, colorType);
|
||||
return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(*this->caps(), format, copyDesc,
|
||||
origin, mipMapped, texSwizzle,
|
||||
outSwizzle, fit, budgeted,
|
||||
surfaceFlags));
|
||||
origin, mipMapped,
|
||||
fit, budgeted, surfaceFlags));
|
||||
}
|
||||
|
||||
return sk_sp<GrTextureProxy>(new GrTextureProxy(format, copyDesc, origin, mipMapped, texSwizzle,
|
||||
return sk_sp<GrTextureProxy>(new GrTextureProxy(format, copyDesc, origin, mipMapped,
|
||||
fit, budgeted, surfaceFlags));
|
||||
}
|
||||
|
||||
@ -544,10 +535,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::wrapBackendTexture(const GrBackendTexture
|
||||
// Make sure we match how we created the proxy with SkBudgeted::kNo
|
||||
SkASSERT(GrBudgetedType::kBudgeted != tex->resourcePriv().budgetedType());
|
||||
|
||||
GrColorType colorType = GrPixelConfigToColorType(tex->config());
|
||||
GrSwizzle texSwizzle = this->caps()->getTextureSwizzle(tex->backendFormat(), colorType);
|
||||
|
||||
return sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(tex), origin, texSwizzle));
|
||||
return sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(tex), origin));
|
||||
}
|
||||
|
||||
sk_sp<GrTextureProxy> GrProxyProvider::wrapRenderableBackendTexture(
|
||||
@ -588,12 +576,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::wrapRenderableBackendTexture(
|
||||
// Make sure we match how we created the proxy with SkBudgeted::kNo
|
||||
SkASSERT(GrBudgetedType::kBudgeted != tex->resourcePriv().budgetedType());
|
||||
|
||||
GrColorType colorType = GrPixelConfigToColorType(tex->config());
|
||||
GrSwizzle texSwizzle = this->caps()->getTextureSwizzle(tex->backendFormat(), colorType);
|
||||
GrSwizzle outSwizzle = this->caps()->getOutputSwizzle(tex->backendFormat(), colorType);
|
||||
|
||||
return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(std::move(tex), origin, texSwizzle,
|
||||
outSwizzle));
|
||||
return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(std::move(tex), origin));
|
||||
}
|
||||
|
||||
sk_sp<GrSurfaceProxy> GrProxyProvider::wrapBackendRenderTarget(
|
||||
@ -609,8 +592,8 @@ sk_sp<GrSurfaceProxy> GrProxyProvider::wrapBackendRenderTarget(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GrColorType colorType = GrPixelConfigToColorType(backendRT.config());
|
||||
#ifdef SK_DEBUG
|
||||
GrColorType colorType = GrPixelConfigToColorType(backendRT.config());
|
||||
GrPixelConfig testConfig =
|
||||
this->caps()->validateBackendRenderTarget(backendRT,
|
||||
GrColorTypeToSkColorType(colorType));
|
||||
@ -633,11 +616,7 @@ sk_sp<GrSurfaceProxy> GrProxyProvider::wrapBackendRenderTarget(
|
||||
// Make sure we match how we created the proxy with SkBudgeted::kNo
|
||||
SkASSERT(GrBudgetedType::kBudgeted != rt->resourcePriv().budgetedType());
|
||||
|
||||
GrSwizzle texSwizzle = this->caps()->getTextureSwizzle(rt->backendFormat(), colorType);
|
||||
GrSwizzle outSwizzle = this->caps()->getOutputSwizzle(rt->backendFormat(), colorType);
|
||||
|
||||
return sk_sp<GrRenderTargetProxy>(new GrRenderTargetProxy(std::move(rt), origin, texSwizzle,
|
||||
outSwizzle));
|
||||
return sk_sp<GrRenderTargetProxy>(new GrRenderTargetProxy(std::move(rt), origin));
|
||||
}
|
||||
|
||||
sk_sp<GrSurfaceProxy> GrProxyProvider::wrapBackendTextureAsRenderTarget(
|
||||
@ -667,12 +646,7 @@ sk_sp<GrSurfaceProxy> GrProxyProvider::wrapBackendTextureAsRenderTarget(
|
||||
// This proxy should be unbudgeted because we're just wrapping an external resource
|
||||
SkASSERT(GrBudgetedType::kBudgeted != rt->resourcePriv().budgetedType());
|
||||
|
||||
GrColorType colorType = GrPixelConfigToColorType(rt->config());
|
||||
GrSwizzle texSwizzle = this->caps()->getTextureSwizzle(rt->backendFormat(), colorType);
|
||||
GrSwizzle outSwizzle = this->caps()->getOutputSwizzle(rt->backendFormat(), colorType);
|
||||
|
||||
return sk_sp<GrSurfaceProxy>(new GrRenderTargetProxy(std::move(rt), origin, texSwizzle,
|
||||
outSwizzle));
|
||||
return sk_sp<GrSurfaceProxy>(new GrRenderTargetProxy(std::move(rt), origin));
|
||||
}
|
||||
|
||||
sk_sp<GrRenderTargetProxy> GrProxyProvider::wrapVulkanSecondaryCBAsRenderTarget(
|
||||
@ -700,14 +674,10 @@ sk_sp<GrRenderTargetProxy> GrProxyProvider::wrapVulkanSecondaryCBAsRenderTarget(
|
||||
// This proxy should be unbudgeted because we're just wrapping an external resource
|
||||
SkASSERT(GrBudgetedType::kBudgeted != rt->resourcePriv().budgetedType());
|
||||
|
||||
GrColorType colorType = GrPixelConfigToColorType(rt->config());
|
||||
GrSwizzle texSwizzle = this->caps()->getTextureSwizzle(rt->backendFormat(), colorType);
|
||||
GrSwizzle outSwizzle = this->caps()->getOutputSwizzle(rt->backendFormat(), colorType);
|
||||
|
||||
// All Vulkan surfaces uses top left origins.
|
||||
return sk_sp<GrRenderTargetProxy>(
|
||||
new GrRenderTargetProxy(std::move(rt),
|
||||
kTopLeft_GrSurfaceOrigin, texSwizzle, outSwizzle,
|
||||
kTopLeft_GrSurfaceOrigin,
|
||||
GrRenderTargetProxy::WrapsVkSecondaryCB::kYes));
|
||||
}
|
||||
|
||||
@ -764,17 +734,12 @@ sk_sp<GrTextureProxy> GrProxyProvider::createLazyProxy(LazyInstantiateCallback&&
|
||||
}
|
||||
#endif
|
||||
|
||||
GrColorType colorType = GrPixelConfigToColorType(desc.fConfig);
|
||||
GrSwizzle texSwizzle = this->caps()->getTextureSwizzle(format, colorType);
|
||||
GrSwizzle outSwizzle = this->caps()->getOutputSwizzle(format, colorType);
|
||||
|
||||
return sk_sp<GrTextureProxy>(
|
||||
SkToBool(kRenderTarget_GrSurfaceFlag & desc.fFlags)
|
||||
? new GrTextureRenderTargetProxy(std::move(callback), lazyType, format, desc,
|
||||
origin, mipMapped, texSwizzle, outSwizzle, fit,
|
||||
budgeted, surfaceFlags)
|
||||
origin, mipMapped, fit, budgeted, surfaceFlags)
|
||||
: new GrTextureProxy(std::move(callback), lazyType, format, desc, origin,
|
||||
mipMapped, texSwizzle, fit, budgeted, surfaceFlags));
|
||||
mipMapped, fit, budgeted, surfaceFlags));
|
||||
}
|
||||
|
||||
sk_sp<GrRenderTargetProxy> GrProxyProvider::createLazyRenderTargetProxy(
|
||||
@ -804,17 +769,13 @@ sk_sp<GrRenderTargetProxy> GrProxyProvider::createLazyRenderTargetProxy(
|
||||
LazyInstantiationType lazyType = this->renderingDirectly() ? LazyInstantiationType::kSingleUse
|
||||
: LazyInstantiationType::kMultipleUse;
|
||||
|
||||
GrColorType colorType = GrPixelConfigToColorType(desc.fConfig);
|
||||
GrSwizzle texSwizzle = this->caps()->getTextureSwizzle(format, colorType);
|
||||
GrSwizzle outSwizzle = this->caps()->getOutputSwizzle(format, colorType);
|
||||
|
||||
if (textureInfo) {
|
||||
// Wrapped vulkan secondary command buffers don't support texturing since we won't have an
|
||||
// actual VkImage to texture from.
|
||||
SkASSERT(!wrapsVkSecondaryCB);
|
||||
return sk_sp<GrRenderTargetProxy>(new GrTextureRenderTargetProxy(
|
||||
std::move(callback), lazyType, format, desc, origin, textureInfo->fMipMapped,
|
||||
texSwizzle, outSwizzle, fit, budgeted, surfaceFlags));
|
||||
fit, budgeted, surfaceFlags));
|
||||
}
|
||||
|
||||
GrRenderTargetProxy::WrapsVkSecondaryCB vkSCB =
|
||||
@ -822,8 +783,8 @@ sk_sp<GrRenderTargetProxy> GrProxyProvider::createLazyRenderTargetProxy(
|
||||
: GrRenderTargetProxy::WrapsVkSecondaryCB::kNo;
|
||||
|
||||
return sk_sp<GrRenderTargetProxy>(new GrRenderTargetProxy(
|
||||
std::move(callback), lazyType, format, desc, origin, texSwizzle, outSwizzle, fit,
|
||||
budgeted, surfaceFlags, vkSCB));
|
||||
std::move(callback), lazyType, format, desc, origin, fit, budgeted, surfaceFlags,
|
||||
vkSCB));
|
||||
}
|
||||
|
||||
sk_sp<GrTextureProxy> GrProxyProvider::MakeFullyLazyProxy(
|
||||
@ -843,18 +804,14 @@ sk_sp<GrTextureProxy> GrProxyProvider::MakeFullyLazyProxy(
|
||||
desc.fConfig = config;
|
||||
desc.fSampleCnt = sampleCnt;
|
||||
|
||||
GrColorType colorType = GrPixelConfigToColorType(desc.fConfig);
|
||||
GrSwizzle texSwizzle = caps.getTextureSwizzle(format, colorType);
|
||||
GrSwizzle outSwizzle = caps.getOutputSwizzle(format, colorType);
|
||||
|
||||
return sk_sp<GrTextureProxy>(
|
||||
(Renderable::kYes == renderable)
|
||||
? new GrTextureRenderTargetProxy(
|
||||
std::move(callback), LazyInstantiationType::kSingleUse, format, desc,
|
||||
origin, GrMipMapped::kNo, texSwizzle, outSwizzle,
|
||||
SkBackingFit::kApprox, SkBudgeted::kYes, surfaceFlags)
|
||||
origin, GrMipMapped::kNo, SkBackingFit::kApprox, SkBudgeted::kYes,
|
||||
surfaceFlags)
|
||||
: new GrTextureProxy(std::move(callback), LazyInstantiationType::kSingleUse,
|
||||
format, desc, origin, GrMipMapped::kNo, texSwizzle,
|
||||
format, desc, origin, GrMipMapped::kNo,
|
||||
SkBackingFit::kApprox, SkBudgeted::kYes, surfaceFlags));
|
||||
}
|
||||
|
||||
|
@ -21,12 +21,10 @@
|
||||
// cases to make the sampleConfig/numSamples stuff more rational.
|
||||
GrRenderTargetProxy::GrRenderTargetProxy(const GrCaps& caps, const GrBackendFormat& format,
|
||||
const GrSurfaceDesc& desc, GrSurfaceOrigin origin,
|
||||
const GrSwizzle& textureSwizzle,
|
||||
const GrSwizzle& outputSwizzle, SkBackingFit fit,
|
||||
SkBudgeted budgeted, GrInternalSurfaceFlags surfaceFlags)
|
||||
: INHERITED(format, desc, origin, textureSwizzle, fit, budgeted, surfaceFlags)
|
||||
SkBackingFit fit, SkBudgeted budgeted,
|
||||
GrInternalSurfaceFlags surfaceFlags)
|
||||
: INHERITED(format, desc, origin, fit, budgeted, surfaceFlags)
|
||||
, fSampleCnt(desc.fSampleCnt)
|
||||
, fOutputSwizzle(outputSwizzle)
|
||||
, fNeedsStencil(false)
|
||||
, fWrapsVkSecondaryCB(WrapsVkSecondaryCB::kNo) {
|
||||
// Since we know the newly created render target will be internal, we are able to precompute
|
||||
@ -40,14 +38,12 @@ GrRenderTargetProxy::GrRenderTargetProxy(const GrCaps& caps, const GrBackendForm
|
||||
GrRenderTargetProxy::GrRenderTargetProxy(LazyInstantiateCallback&& callback,
|
||||
LazyInstantiationType lazyType,
|
||||
const GrBackendFormat& format, const GrSurfaceDesc& desc,
|
||||
GrSurfaceOrigin origin, const GrSwizzle& textureSwizzle,
|
||||
const GrSwizzle& outputSwizzle, SkBackingFit fit,
|
||||
GrSurfaceOrigin origin, SkBackingFit fit,
|
||||
SkBudgeted budgeted, GrInternalSurfaceFlags surfaceFlags,
|
||||
WrapsVkSecondaryCB wrapsVkSecondaryCB)
|
||||
: INHERITED(std::move(callback), lazyType, format, desc, origin, textureSwizzle, fit,
|
||||
budgeted, surfaceFlags)
|
||||
: INHERITED(std::move(callback), lazyType, format, desc, origin, fit, budgeted,
|
||||
surfaceFlags)
|
||||
, fSampleCnt(desc.fSampleCnt)
|
||||
, fOutputSwizzle(outputSwizzle)
|
||||
, fNeedsStencil(false)
|
||||
, fWrapsVkSecondaryCB(wrapsVkSecondaryCB) {
|
||||
SkASSERT(SkToBool(kRenderTarget_GrSurfaceFlag & desc.fFlags));
|
||||
@ -55,12 +51,9 @@ GrRenderTargetProxy::GrRenderTargetProxy(LazyInstantiateCallback&& callback,
|
||||
|
||||
// Wrapped version
|
||||
GrRenderTargetProxy::GrRenderTargetProxy(sk_sp<GrSurface> surf, GrSurfaceOrigin origin,
|
||||
const GrSwizzle& textureSwizzle,
|
||||
const GrSwizzle& outputSwizzle,
|
||||
WrapsVkSecondaryCB wrapsVkSecondaryCB)
|
||||
: INHERITED(std::move(surf), origin, textureSwizzle, SkBackingFit::kExact)
|
||||
: INHERITED(std::move(surf), origin, SkBackingFit::kExact)
|
||||
, fSampleCnt(fTarget->asRenderTarget()->numStencilSamples())
|
||||
, fOutputSwizzle(outputSwizzle)
|
||||
, fNeedsStencil(false)
|
||||
, fWrapsVkSecondaryCB(wrapsVkSecondaryCB) {
|
||||
}
|
||||
|
@ -9,8 +9,8 @@
|
||||
#define GrShaderCaps_DEFINED
|
||||
|
||||
#include "include/core/SkRefCnt.h"
|
||||
#include "include/private/GrSwizzle.h"
|
||||
#include "include/private/GrTypesPriv.h"
|
||||
#include "src/gpu/GrSwizzle.h"
|
||||
#include "src/gpu/glsl/GrGLSL.h"
|
||||
|
||||
namespace SkSL {
|
||||
|
@ -54,16 +54,14 @@ static bool is_valid_non_lazy(const GrSurfaceDesc& desc) {
|
||||
// Lazy-callback version
|
||||
GrSurfaceProxy::GrSurfaceProxy(LazyInstantiateCallback&& callback, LazyInstantiationType lazyType,
|
||||
const GrBackendFormat& format, const GrSurfaceDesc& desc,
|
||||
GrSurfaceOrigin origin, const GrSwizzle& textureSwizzle,
|
||||
SkBackingFit fit, SkBudgeted budgeted,
|
||||
GrInternalSurfaceFlags surfaceFlags)
|
||||
GrSurfaceOrigin origin, SkBackingFit fit,
|
||||
SkBudgeted budgeted, GrInternalSurfaceFlags surfaceFlags)
|
||||
: fSurfaceFlags(surfaceFlags)
|
||||
, fFormat(format)
|
||||
, fConfig(desc.fConfig)
|
||||
, fWidth(desc.fWidth)
|
||||
, fHeight(desc.fHeight)
|
||||
, fOrigin(origin)
|
||||
, fTextureSwizzle(textureSwizzle)
|
||||
, fFit(fit)
|
||||
, fBudgeted(budgeted)
|
||||
, fLazyInstantiateCallback(std::move(callback))
|
||||
@ -86,8 +84,7 @@ GrSurfaceProxy::GrSurfaceProxy(LazyInstantiateCallback&& callback, LazyInstantia
|
||||
}
|
||||
|
||||
// Wrapped version
|
||||
GrSurfaceProxy::GrSurfaceProxy(sk_sp<GrSurface> surface, GrSurfaceOrigin origin,
|
||||
const GrSwizzle& textureSwizzle, SkBackingFit fit)
|
||||
GrSurfaceProxy::GrSurfaceProxy(sk_sp<GrSurface> surface, GrSurfaceOrigin origin, SkBackingFit fit)
|
||||
: INHERITED(std::move(surface))
|
||||
, fSurfaceFlags(fTarget->surfacePriv().flags())
|
||||
, fFormat(fTarget->backendFormat())
|
||||
@ -95,7 +92,6 @@ GrSurfaceProxy::GrSurfaceProxy(sk_sp<GrSurface> surface, GrSurfaceOrigin origin,
|
||||
, fWidth(fTarget->width())
|
||||
, fHeight(fTarget->height())
|
||||
, fOrigin(origin)
|
||||
, fTextureSwizzle(textureSwizzle)
|
||||
, fFit(fit)
|
||||
, fBudgeted(fTarget->resourcePriv().budgetedType() == GrBudgetedType::kBudgeted
|
||||
? SkBudgeted::kYes
|
||||
|
@ -5,7 +5,7 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "include/private/GrSwizzle.h"
|
||||
#include "src/gpu/GrSwizzle.h"
|
||||
#include "src/core/SkRasterPipeline.h"
|
||||
|
||||
void GrSwizzle::apply(SkRasterPipeline* pipeline) const {
|
||||
|
@ -15,12 +15,24 @@
|
||||
#include "src/gpu/GrSurfacePriv.h"
|
||||
#include "src/gpu/GrTexturePriv.h"
|
||||
|
||||
// Deferred version - with data
|
||||
GrTextureProxy::GrTextureProxy(const GrBackendFormat& format, const GrSurfaceDesc& srcDesc,
|
||||
GrMipMapped mipMapped, SkBackingFit fit, SkBudgeted budgeted,
|
||||
const void* srcData, size_t /*rowBytes*/,
|
||||
GrInternalSurfaceFlags surfaceFlags)
|
||||
: INHERITED(format, srcDesc, kTopLeft_GrSurfaceOrigin, fit, budgeted, surfaceFlags)
|
||||
, fMipMapped(mipMapped)
|
||||
, fProxyProvider(nullptr)
|
||||
, fDeferredUploader(nullptr) {
|
||||
SkASSERT(!srcData); // currently handled in Make()
|
||||
}
|
||||
|
||||
// Deferred version - no data
|
||||
GrTextureProxy::GrTextureProxy(const GrBackendFormat& format, const GrSurfaceDesc& srcDesc,
|
||||
GrSurfaceOrigin origin, GrMipMapped mipMapped,
|
||||
const GrSwizzle& textureSwizzle, SkBackingFit fit,
|
||||
SkBudgeted budgeted, GrInternalSurfaceFlags surfaceFlags)
|
||||
: INHERITED(format, srcDesc, origin, textureSwizzle, fit, budgeted, surfaceFlags)
|
||||
SkBackingFit fit, SkBudgeted budgeted,
|
||||
GrInternalSurfaceFlags surfaceFlags)
|
||||
: INHERITED(format, srcDesc, origin, fit, budgeted, surfaceFlags)
|
||||
, fMipMapped(mipMapped)
|
||||
, fProxyProvider(nullptr)
|
||||
, fDeferredUploader(nullptr) {}
|
||||
@ -28,19 +40,17 @@ GrTextureProxy::GrTextureProxy(const GrBackendFormat& format, const GrSurfaceDes
|
||||
// Lazy-callback version
|
||||
GrTextureProxy::GrTextureProxy(LazyInstantiateCallback&& callback, LazyInstantiationType lazyType,
|
||||
const GrBackendFormat& format, const GrSurfaceDesc& desc,
|
||||
GrSurfaceOrigin origin, GrMipMapped mipMapped,
|
||||
const GrSwizzle& texSwizzle, SkBackingFit fit, SkBudgeted budgeted,
|
||||
GrInternalSurfaceFlags surfaceFlags)
|
||||
: INHERITED(std::move(callback), lazyType, format, desc, origin, texSwizzle, fit, budgeted,
|
||||
GrSurfaceOrigin origin, GrMipMapped mipMapped, SkBackingFit fit,
|
||||
SkBudgeted budgeted, GrInternalSurfaceFlags surfaceFlags)
|
||||
: INHERITED(std::move(callback), lazyType, format, desc, origin, fit, budgeted,
|
||||
surfaceFlags)
|
||||
, fMipMapped(mipMapped)
|
||||
, fProxyProvider(nullptr)
|
||||
, fDeferredUploader(nullptr) {}
|
||||
|
||||
// Wrapped version
|
||||
GrTextureProxy::GrTextureProxy(sk_sp<GrSurface> surf, GrSurfaceOrigin origin,
|
||||
const GrSwizzle& textureSwizzle)
|
||||
: INHERITED(std::move(surf), origin, textureSwizzle, SkBackingFit::kExact)
|
||||
GrTextureProxy::GrTextureProxy(sk_sp<GrSurface> surf, GrSurfaceOrigin origin)
|
||||
: INHERITED(std::move(surf), origin, SkBackingFit::kExact)
|
||||
, fMipMapped(fTarget->asTexture()->texturePriv().mipMapped())
|
||||
, fProxyProvider(nullptr)
|
||||
, fDeferredUploader(nullptr) {
|
||||
|
@ -23,17 +23,13 @@ GrTextureRenderTargetProxy::GrTextureRenderTargetProxy(const GrCaps& caps,
|
||||
const GrSurfaceDesc& desc,
|
||||
GrSurfaceOrigin origin,
|
||||
GrMipMapped mipMapped,
|
||||
const GrSwizzle& texSwizzle,
|
||||
const GrSwizzle& outSwizzle,
|
||||
SkBackingFit fit,
|
||||
SkBudgeted budgeted,
|
||||
GrInternalSurfaceFlags surfaceFlags)
|
||||
: GrSurfaceProxy(format, desc, origin, texSwizzle, fit, budgeted, surfaceFlags)
|
||||
: GrSurfaceProxy(format, desc, origin, fit, budgeted, surfaceFlags)
|
||||
// for now textures w/ data are always wrapped
|
||||
, GrRenderTargetProxy(caps, format, desc, origin, texSwizzle, outSwizzle, fit, budgeted,
|
||||
surfaceFlags)
|
||||
, GrTextureProxy(format, desc, origin, mipMapped, texSwizzle, fit, budgeted, surfaceFlags) {
|
||||
}
|
||||
, GrRenderTargetProxy(caps, format, desc, origin, fit, budgeted, surfaceFlags)
|
||||
, GrTextureProxy(format, desc, origin, mipMapped, fit, budgeted, surfaceFlags) {}
|
||||
|
||||
// Lazy-callback version
|
||||
GrTextureRenderTargetProxy::GrTextureRenderTargetProxy(LazyInstantiateCallback&& callback,
|
||||
@ -42,30 +38,26 @@ GrTextureRenderTargetProxy::GrTextureRenderTargetProxy(LazyInstantiateCallback&&
|
||||
const GrSurfaceDesc& desc,
|
||||
GrSurfaceOrigin origin,
|
||||
GrMipMapped mipMapped,
|
||||
const GrSwizzle& texSwizzle,
|
||||
const GrSwizzle& outSwizzle,
|
||||
SkBackingFit fit,
|
||||
SkBudgeted budgeted,
|
||||
GrInternalSurfaceFlags surfaceFlags)
|
||||
: GrSurfaceProxy(std::move(callback), lazyType, format, desc, origin, texSwizzle, fit,
|
||||
budgeted, surfaceFlags)
|
||||
: GrSurfaceProxy(std::move(callback), lazyType, format, desc, origin, fit, budgeted,
|
||||
surfaceFlags)
|
||||
// Since we have virtual inheritance, we initialize GrSurfaceProxy directly. Send null
|
||||
// callbacks to the texture and RT proxies simply to route to the appropriate constructors.
|
||||
, GrRenderTargetProxy(LazyInstantiateCallback(), lazyType, format, desc, origin, texSwizzle,
|
||||
outSwizzle, fit, budgeted, surfaceFlags, WrapsVkSecondaryCB::kNo)
|
||||
, GrRenderTargetProxy(LazyInstantiateCallback(), lazyType, format, desc, origin, fit,
|
||||
budgeted, surfaceFlags, WrapsVkSecondaryCB::kNo)
|
||||
, GrTextureProxy(LazyInstantiateCallback(), lazyType, format, desc, origin, mipMapped,
|
||||
texSwizzle, fit, budgeted, surfaceFlags) {}
|
||||
fit, budgeted, surfaceFlags) {}
|
||||
|
||||
// Wrapped version
|
||||
// This class is virtually derived from GrSurfaceProxy (via both GrTextureProxy and
|
||||
// GrRenderTargetProxy) so its constructor must be explicitly called.
|
||||
GrTextureRenderTargetProxy::GrTextureRenderTargetProxy(sk_sp<GrSurface> surf,
|
||||
GrSurfaceOrigin origin,
|
||||
const GrSwizzle& texSwizzle,
|
||||
const GrSwizzle& outSwizzle)
|
||||
: GrSurfaceProxy(surf, origin, texSwizzle, SkBackingFit::kExact)
|
||||
, GrRenderTargetProxy(surf, origin, texSwizzle, outSwizzle)
|
||||
, GrTextureProxy(surf, origin, texSwizzle) {
|
||||
GrSurfaceOrigin origin)
|
||||
: GrSurfaceProxy(surf, origin, SkBackingFit::kExact)
|
||||
, GrRenderTargetProxy(surf, origin)
|
||||
, GrTextureProxy(surf, origin) {
|
||||
SkASSERT(surf->asTexture());
|
||||
SkASSERT(surf->asRenderTarget());
|
||||
}
|
||||
|
@ -29,20 +29,16 @@ private:
|
||||
|
||||
// Deferred version
|
||||
GrTextureRenderTargetProxy(const GrCaps&, const GrBackendFormat&, const GrSurfaceDesc&,
|
||||
GrSurfaceOrigin, GrMipMapped, const GrSwizzle& textureSwizzle,
|
||||
const GrSwizzle& outputSwizzle, SkBackingFit, SkBudgeted,
|
||||
GrSurfaceOrigin, GrMipMapped, SkBackingFit, SkBudgeted,
|
||||
GrInternalSurfaceFlags);
|
||||
|
||||
// Lazy-callback version
|
||||
GrTextureRenderTargetProxy(LazyInstantiateCallback&&, LazyInstantiationType,
|
||||
const GrBackendFormat&, const GrSurfaceDesc& desc, GrSurfaceOrigin,
|
||||
GrMipMapped, const GrSwizzle& textureSwizzle,
|
||||
const GrSwizzle& outputSwizzle, SkBackingFit, SkBudgeted,
|
||||
GrInternalSurfaceFlags);
|
||||
GrMipMapped, SkBackingFit, SkBudgeted, GrInternalSurfaceFlags);
|
||||
|
||||
// Wrapped version
|
||||
GrTextureRenderTargetProxy(sk_sp<GrSurface>, GrSurfaceOrigin, const GrSwizzle& textureSwizzle,
|
||||
const GrSwizzle& outputSwizzle);
|
||||
GrTextureRenderTargetProxy(sk_sp<GrSurface>, GrSurfaceOrigin);
|
||||
|
||||
bool instantiate(GrResourceProvider*) override;
|
||||
sk_sp<GrSurface> createSurface(GrResourceProvider*) const override;
|
||||
|
@ -10,11 +10,11 @@
|
||||
#define GrGLCaps_DEFINED
|
||||
|
||||
#include <functional>
|
||||
#include "include/private/GrSwizzle.h"
|
||||
#include "include/private/SkChecksum.h"
|
||||
#include "include/private/SkTArray.h"
|
||||
#include "include/private/SkTHash.h"
|
||||
#include "src/gpu/GrCaps.h"
|
||||
#include "src/gpu/GrSwizzle.h"
|
||||
#include "src/gpu/gl/GrGLStencilAttachment.h"
|
||||
|
||||
class GrGLContextInfo;
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include "include/core/SkScalar.h"
|
||||
#include "include/private/GrGLTypesPriv.h"
|
||||
#include "include/private/GrSwizzle.h"
|
||||
#include "src/gpu/GrSwizzle.h"
|
||||
#include "src/gpu/gl/GrGLDefines.h"
|
||||
|
||||
GrGLTextureParameters::SamplerOverriddenState::SamplerOverriddenState()
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "src/gpu/gl/builders/GrGLProgramBuilder.h"
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/private/GrSwizzle.h"
|
||||
#include "src/core/SkATrace.h"
|
||||
#include "src/core/SkAutoMalloc.h"
|
||||
#include "src/core/SkReader32.h"
|
||||
@ -21,6 +20,7 @@
|
||||
#include "src/gpu/GrProgramDesc.h"
|
||||
#include "src/gpu/GrShaderCaps.h"
|
||||
#include "src/gpu/GrShaderUtils.h"
|
||||
#include "src/gpu/GrSwizzle.h"
|
||||
#include "src/gpu/gl/GrGLGpu.h"
|
||||
#include "src/gpu/gl/GrGLProgram.h"
|
||||
#include "src/gpu/gl/builders/GrGLProgramBuilder.h"
|
||||
|
@ -5,13 +5,12 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "src/gpu/glsl/GrGLSLShaderBuilder.h"
|
||||
|
||||
#include "include/private/GrSwizzle.h"
|
||||
#include "src/gpu/GrShaderCaps.h"
|
||||
#include "src/gpu/GrShaderVar.h"
|
||||
#include "src/gpu/GrSwizzle.h"
|
||||
#include "src/gpu/glsl/GrGLSLColorSpaceXformHelper.h"
|
||||
#include "src/gpu/glsl/GrGLSLProgramBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLShaderBuilder.h"
|
||||
|
||||
GrGLSLShaderBuilder::GrGLSLShaderBuilder(GrGLSLProgramBuilder* program)
|
||||
: fProgramBuilder(program)
|
||||
|
@ -8,8 +8,8 @@
|
||||
#ifndef GrGLSLUniformHandler_DEFINED
|
||||
#define GrGLSLUniformHandler_DEFINED
|
||||
|
||||
#include "include/private/GrSwizzle.h"
|
||||
#include "src/gpu/GrShaderVar.h"
|
||||
#include "src/gpu/GrSwizzle.h"
|
||||
#include "src/gpu/glsl/GrGLSLProgramDataManager.h"
|
||||
|
||||
// variable names beginning with this prefix will not be mangled
|
||||
|
@ -657,7 +657,7 @@ static bool format_color_type_valid_pair(MTLPixelFormat format, GrColorType colo
|
||||
static GrSwizzle get_swizzle(const GrBackendFormat& format, GrColorType colorType,
|
||||
bool forOutput) {
|
||||
SkASSERT(format.getMtlFormat());
|
||||
MTLPixelFormat mtlFormat = static_cast<MTLPixelFormat>(*format.getMtlFormat());
|
||||
MTLPixelFormat mtlFormat = static_cast<MTLPixelFormat>(*format.getVkFormat());
|
||||
|
||||
SkASSERT(format_color_type_valid_pair(mtlFormat, colorType));
|
||||
|
||||
|
@ -682,7 +682,7 @@ static bool format_is_srgb(VkFormat format) {
|
||||
}
|
||||
}
|
||||
|
||||
// These are all the valid VkFormats that we support in Skia. They are roughly ordered from most
|
||||
// These are all the valid VkFormats that we support in Skia. They are roughly order from most
|
||||
// frequently used to least to improve look up times in arrays.
|
||||
static constexpr VkFormat kVkFormats[] = {
|
||||
VK_FORMAT_R8G8B8A8_UNORM,
|
||||
|
@ -5,10 +5,10 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "include/private/GrSwizzle.h"
|
||||
#include "include/private/SkHalf.h"
|
||||
#include "include/private/SkTo.h"
|
||||
#include "src/core/SkRasterPipeline.h"
|
||||
#include "src/gpu/GrSwizzle.h"
|
||||
#include "tests/Test.h"
|
||||
|
||||
DEF_TEST(SkRasterPipeline, r) {
|
||||
|
Loading…
Reference in New Issue
Block a user