mipMapped -> mipmapped
Change-Id: Ib9d4e23159724825dacb7d37ceabfd2aff68f58a Reviewed-on: https://skia-review.googlesource.com/c/skia/+/530681 Auto-Submit: Brian Salomon <bsalomon@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
parent
bdf5ce7369
commit
2386d3e7d6
@ -16,8 +16,8 @@ private:
|
||||
GrMipmapped fMipmapped;
|
||||
|
||||
public:
|
||||
CreateBackendTextureBench(GrMipmapped mipMapped) : fMipmapped(mipMapped) {
|
||||
fName.printf("create_backend_texture%s", mipMapped == GrMipmapped::kYes ? "_mipped" : "");
|
||||
CreateBackendTextureBench(GrMipmapped mipmapped) : fMipmapped(mipmapped) {
|
||||
fName.printf("create_backend_texture%s", mipmapped == GrMipmapped::kYes ? "_mipped" : "");
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -181,7 +181,7 @@ protected:
|
||||
GrSurfaceProxyView onGenerateTexture(GrRecordingContext* rContext,
|
||||
const SkImageInfo& info,
|
||||
const SkIPoint& origin,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrImageTexGenPolicy policy) override {
|
||||
SkASSERT(rContext);
|
||||
SkASSERT(rContext->priv().matches(fRContext.get()));
|
||||
@ -197,7 +197,7 @@ protected:
|
||||
auto budgeted = policy == GrImageTexGenPolicy::kNew_Uncached_Unbudgeted ? SkBudgeted::kNo
|
||||
: SkBudgeted::kYes;
|
||||
return GrSurfaceProxyView::Copy(
|
||||
fRContext.get(), fView, mipMapped,
|
||||
fRContext.get(), fView, mipmapped,
|
||||
SkIRect::MakeXYWH(origin.x(), origin.y(), info.width(), info.height()),
|
||||
SkBackingFit::kExact, budgeted);
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
sk_sp<SkImage> makePromiseTexture(const GrBackendFormat& backendFormat,
|
||||
int width,
|
||||
int height,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrSurfaceOrigin origin,
|
||||
SkColorType colorType,
|
||||
SkAlphaType alphaType,
|
||||
|
@ -275,7 +275,7 @@ public:
|
||||
@param width width of full SkImage
|
||||
@param height height of full SkImage
|
||||
@param type type of compression used
|
||||
@param mipMapped does 'data' contain data for all the mipmap levels?
|
||||
@param mipmapped does 'data' contain data for all the mipmap levels?
|
||||
@param isProtected do the contents of 'data' require DRM protection (on Vulkan)?
|
||||
@return created SkImage, or nullptr
|
||||
*/
|
||||
@ -283,7 +283,7 @@ public:
|
||||
sk_sp<SkData> data,
|
||||
int width, int height,
|
||||
CompressionType type,
|
||||
GrMipmapped mipMapped = GrMipmapped::kNo,
|
||||
GrMipmapped mipmapped = GrMipmapped::kNo,
|
||||
GrProtected isProtected = GrProtected::kNo);
|
||||
|
||||
/** User function called when supplied texture may be deleted.
|
||||
@ -492,7 +492,7 @@ public:
|
||||
@param gpuContextProxy the thread-safe proxy of the gpu context. required.
|
||||
@param backendFormat format of promised gpu texture
|
||||
@param dimensions width & height of promised gpu texture
|
||||
@param mipMapped mip mapped state of promised gpu texture
|
||||
@param mipmapped mip mapped state of promised gpu texture
|
||||
@param origin surface origin of promised gpu texture
|
||||
@param colorType color type of promised gpu texture
|
||||
@param alphaType alpha type of promised gpu texture
|
||||
@ -505,7 +505,7 @@ public:
|
||||
static sk_sp<SkImage> MakePromiseTexture(sk_sp<GrContextThreadSafeProxy> gpuContextProxy,
|
||||
const GrBackendFormat& backendFormat,
|
||||
SkISize dimensions,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrSurfaceOrigin origin,
|
||||
SkColorType colorType,
|
||||
SkAlphaType alphaType,
|
||||
@ -1121,14 +1121,14 @@ public:
|
||||
#if SK_SUPPORT_GPU
|
||||
/** Returns SkImage backed by GPU texture associated with context. Returned SkImage is
|
||||
compatible with SkSurface created with dstColorSpace. The returned SkImage respects
|
||||
mipMapped setting; if mipMapped equals GrMipmapped::kYes, the backing texture
|
||||
mipmapped setting; if mipmapped equals GrMipmapped::kYes, the backing texture
|
||||
allocates mip map levels.
|
||||
|
||||
The mipMapped parameter is effectively treated as kNo if MIP maps are not supported by the
|
||||
The mipmapped parameter is effectively treated as kNo if MIP maps are not supported by the
|
||||
GPU.
|
||||
|
||||
Returns original SkImage if the image is already texture-backed, the context matches, and
|
||||
mipMapped is compatible with the backing GPU texture. SkBudgeted is ignored in this case.
|
||||
mipmapped is compatible with the backing GPU texture. SkBudgeted is ignored in this case.
|
||||
|
||||
Returns nullptr if context is nullptr, or if SkImage was created with another
|
||||
GrDirectContext.
|
||||
@ -1147,13 +1147,13 @@ public:
|
||||
/** Graphite version of makeTextureImage.
|
||||
|
||||
Returns SkImage backed by GPU texture, using Recorder for creation and uploads if necessary.
|
||||
The returned SkImage respects mipMapped setting for non-GPU SkImages; if mipMapped
|
||||
The returned SkImage respects mipmapped setting for non-GPU SkImages; if mipmapped
|
||||
equals GrMipmapped::kYes, the backing texture allocates mip map levels.
|
||||
|
||||
It is assumed that MIP maps are always supported by the GPU.
|
||||
|
||||
Returns original SkImage if the image is already texture-backed, the recorder matches, and
|
||||
mipMapped is compatible with the backing GPU texture. If mipmapped is not compatible,
|
||||
mipmapped is compatible with the backing GPU texture. If mipmapped is not compatible,
|
||||
it will return nullptr.
|
||||
|
||||
Returns nullptr if recorder is nullptr, or if SkImage was created with another
|
||||
|
@ -510,7 +510,7 @@ public:
|
||||
* pixmap(s). Compatible, in this case, means that the backend format will be the result
|
||||
* of calling defaultBackendFormat on the base pixmap's colortype. The src data can be deleted
|
||||
* when this call returns.
|
||||
* If numLevels is 1 a non-mipMapped texture will result. If a mipMapped texture is desired
|
||||
* If numLevels is 1 a non-mipmapped texture will result. If a mipmapped texture is desired
|
||||
* the data for all the mipmap levels must be provided. In the mipmapped case all the
|
||||
* colortypes of the provided pixmaps must be the same. Additionally, all the miplevels
|
||||
* must be sized correctly (please see SkMipmap::ComputeLevelSize and ComputeLevelCount). The
|
||||
@ -694,7 +694,7 @@ public:
|
||||
* finishedProc to be notified when the data has been uploaded by the gpu and the texture can be
|
||||
* deleted. The client is required to call `submit` to send the upload work to the gpu.
|
||||
* The finishedProc will always get called even if we failed to create the GrBackendTexture
|
||||
* If numLevels is 1 a non-mipMapped texture will result. If a mipMapped texture is desired
|
||||
* If numLevels is 1 a non-mipmapped texture will result. If a mipmapped texture is desired
|
||||
* the data for all the mipmap levels must be provided. Additionally, all the miplevels
|
||||
* must be sized correctly (please see SkMipmap::ComputeLevelSize and ComputeLevelCount).
|
||||
* For the Vulkan backend the layout of the created VkImage will be:
|
||||
@ -737,7 +737,7 @@ public:
|
||||
* finishedProc to be notified when the data has been uploaded by the gpu and the texture can be
|
||||
* deleted. The client is required to call `submit` to send the upload work to the gpu.
|
||||
* The finishedProc will always get called even if we failed to create the GrBackendTexture.
|
||||
* If a mipMapped texture is passed in, the data for all the mipmap levels must be provided.
|
||||
* If a mipmapped texture is passed in, the data for all the mipmap levels must be provided.
|
||||
* Additionally, all the miplevels must be sized correctly (please see
|
||||
* SkMipMap::ComputeLevelSize and ComputeLevelCount).
|
||||
* For the Vulkan backend after a successful update the layout of the created VkImage will be:
|
||||
|
@ -754,7 +754,7 @@ protected:
|
||||
GrSurfaceProxyView onGenerateTexture(GrRecordingContext* ctx,
|
||||
const SkImageInfo& info,
|
||||
const SkIPoint& origin,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrImageTexGenPolicy texGenPolicy) {
|
||||
if (ctx->backend() != GrBackendApi::kOpenGL) {
|
||||
return {};
|
||||
|
@ -244,11 +244,11 @@ bool SkDecompress(sk_sp<SkData> data,
|
||||
}
|
||||
|
||||
size_t SkCompressedDataSize(SkImage::CompressionType type, SkISize dimensions,
|
||||
SkTArray<size_t>* individualMipOffsets, bool mipMapped) {
|
||||
SkTArray<size_t>* individualMipOffsets, bool mipmapped) {
|
||||
SkASSERT(!individualMipOffsets || !individualMipOffsets->count());
|
||||
|
||||
int numMipLevels = 1;
|
||||
if (mipMapped) {
|
||||
if (mipmapped) {
|
||||
numMipLevels = SkMipmap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1;
|
||||
}
|
||||
|
||||
@ -293,6 +293,6 @@ size_t SkCompressedBlockSize(SkImage::CompressionType type) {
|
||||
}
|
||||
|
||||
size_t SkCompressedFormatDataSize(SkImage::CompressionType compressionType,
|
||||
SkISize dimensions, bool mipMapped) {
|
||||
return SkCompressedDataSize(compressionType, dimensions, nullptr, mipMapped);
|
||||
SkISize dimensions, bool mipmapped) {
|
||||
return SkCompressedDataSize(compressionType, dimensions, nullptr, mipmapped);
|
||||
}
|
||||
|
@ -28,14 +28,14 @@ static constexpr bool SkCompressionTypeIsOpaque(SkImage::CompressionType compres
|
||||
}
|
||||
|
||||
size_t SkCompressedDataSize(SkImage::CompressionType, SkISize baseDimensions,
|
||||
SkTArray<size_t>* individualMipOffsets, bool mipMapped);
|
||||
SkTArray<size_t>* individualMipOffsets, bool mipmapped);
|
||||
size_t SkCompressedBlockSize(SkImage::CompressionType type);
|
||||
|
||||
/**
|
||||
* Returns the data size for the given SkImage::CompressionType
|
||||
*/
|
||||
size_t SkCompressedFormatDataSize(SkImage::CompressionType compressionType,
|
||||
SkISize dimensions, bool mipMapped);
|
||||
SkISize dimensions, bool mipmapped);
|
||||
|
||||
/*
|
||||
* This method will decompress the bottommost level in 'data' into 'dst'.
|
||||
|
@ -212,7 +212,7 @@ sk_sp<SkImage> SkDeferredDisplayListRecorder::makePromiseTexture(
|
||||
const GrBackendFormat& backendFormat,
|
||||
int width,
|
||||
int height,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrSurfaceOrigin origin,
|
||||
SkColorType colorType,
|
||||
SkAlphaType alphaType,
|
||||
@ -226,7 +226,7 @@ sk_sp<SkImage> SkDeferredDisplayListRecorder::makePromiseTexture(
|
||||
return SkImage::MakePromiseTexture(fContext->threadSafeProxy(),
|
||||
backendFormat,
|
||||
{width, height},
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
origin,
|
||||
colorType,
|
||||
alphaType,
|
||||
|
@ -48,13 +48,13 @@ bool SkImageGenerator::getYUVAPlanes(const SkYUVAPixmaps& yuvaPixmaps) {
|
||||
GrSurfaceProxyView SkImageGenerator::generateTexture(GrRecordingContext* ctx,
|
||||
const SkImageInfo& info,
|
||||
const SkIPoint& origin,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrImageTexGenPolicy texGenPolicy) {
|
||||
SkIRect srcRect = SkIRect::MakeXYWH(origin.x(), origin.y(), info.width(), info.height());
|
||||
if (!SkIRect::MakeWH(fInfo.width(), fInfo.height()).contains(srcRect)) {
|
||||
return {};
|
||||
}
|
||||
return this->onGenerateTexture(ctx, info, origin, mipMapped, texGenPolicy);
|
||||
return this->onGenerateTexture(ctx, info, origin, mipmapped, texGenPolicy);
|
||||
}
|
||||
|
||||
GrSurfaceProxyView SkImageGenerator::onGenerateTexture(GrRecordingContext*,
|
||||
|
@ -186,7 +186,7 @@ GrSurfaceProxyView GrAHardwareBufferImageGenerator::onGenerateTexture(
|
||||
GrRecordingContext* context,
|
||||
const SkImageInfo& info,
|
||||
const SkIPoint& origin,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrImageTexGenPolicy texGenPolicy) {
|
||||
GrSurfaceProxyView texProxyView = this->makeView(context);
|
||||
if (!texProxyView.proxy()) {
|
||||
@ -195,7 +195,7 @@ GrSurfaceProxyView GrAHardwareBufferImageGenerator::onGenerateTexture(
|
||||
SkASSERT(texProxyView.asTextureProxy());
|
||||
|
||||
if (texGenPolicy == GrImageTexGenPolicy::kDraw && origin.isZero() &&
|
||||
info.dimensions() == this->getInfo().dimensions() && mipMapped == GrMipmapped::kNo) {
|
||||
info.dimensions() == this->getInfo().dimensions() && mipmapped == GrMipmapped::kNo) {
|
||||
// If the caller wants the full non-MIP mapped texture we're done.
|
||||
return texProxyView;
|
||||
}
|
||||
@ -206,7 +206,7 @@ GrSurfaceProxyView GrAHardwareBufferImageGenerator::onGenerateTexture(
|
||||
? SkBudgeted::kNo
|
||||
: SkBudgeted::kYes;
|
||||
|
||||
return GrSurfaceProxyView::Copy(context, std::move(texProxyView), mipMapped, subset,
|
||||
return GrSurfaceProxyView::Copy(context, std::move(texProxyView), mipmapped, subset,
|
||||
SkBackingFit::kExact, budgeted);
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ GrSurfaceProxyView GrBackendTextureImageGenerator::onGenerateTexture(
|
||||
GrRecordingContext* rContext,
|
||||
const SkImageInfo& info,
|
||||
const SkIPoint& origin,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrImageTexGenPolicy texGenPolicy) {
|
||||
SkASSERT(rContext);
|
||||
|
||||
@ -220,7 +220,7 @@ GrSurfaceProxyView GrBackendTextureImageGenerator::onGenerateTexture(
|
||||
|
||||
if (texGenPolicy == GrImageTexGenPolicy::kDraw && origin.isZero() &&
|
||||
info.dimensions() == fBackendTexture.dimensions() &&
|
||||
(mipMapped == GrMipmapped::kNo || proxy->mipmapped() == GrMipmapped::kYes)) {
|
||||
(mipmapped == GrMipmapped::kNo || proxy->mipmapped() == GrMipmapped::kYes)) {
|
||||
// If the caller wants the entire texture and we have the correct mip support, we're done
|
||||
return GrSurfaceProxyView(std::move(proxy), fSurfaceOrigin, readSwizzle);
|
||||
} else {
|
||||
@ -233,7 +233,7 @@ GrSurfaceProxyView GrBackendTextureImageGenerator::onGenerateTexture(
|
||||
auto copy = GrSurfaceProxy::Copy(dContext,
|
||||
std::move(proxy),
|
||||
fSurfaceOrigin,
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
subset,
|
||||
SkBackingFit::kExact,
|
||||
budgeted);
|
||||
|
@ -45,7 +45,7 @@ protected:
|
||||
}
|
||||
|
||||
GrSurfaceProxyView onGenerateTexture(GrRecordingContext*, const SkImageInfo&, const SkIPoint&,
|
||||
GrMipmapped mipMapped, GrImageTexGenPolicy) override;
|
||||
GrMipmapped mipmapped, GrImageTexGenPolicy) override;
|
||||
|
||||
private:
|
||||
GrBackendTextureImageGenerator(const SkImageInfo& info,
|
||||
|
@ -319,11 +319,11 @@ size_t GrComputeTightCombinedBufferSize(size_t bytesPerPixel, SkISize baseDimens
|
||||
}
|
||||
|
||||
void GrFillInCompressedData(SkImage::CompressionType type, SkISize dimensions,
|
||||
GrMipmapped mipMapped, char* dstPixels, const SkColor4f& colorf) {
|
||||
GrMipmapped mipmapped, char* dstPixels, const SkColor4f& colorf) {
|
||||
TRACE_EVENT0("skia.gpu", TRACE_FUNC);
|
||||
|
||||
int numMipLevels = 1;
|
||||
if (mipMapped == GrMipmapped::kYes) {
|
||||
if (mipmapped == GrMipmapped::kYes) {
|
||||
numMipLevels = SkMipmap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1;
|
||||
}
|
||||
|
||||
|
@ -468,7 +468,7 @@ void GrDirectContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) c
|
||||
|
||||
GrBackendTexture GrDirectContext::createBackendTexture(int width, int height,
|
||||
const GrBackendFormat& backendFormat,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrRenderable renderable,
|
||||
GrProtected isProtected) {
|
||||
TRACE_EVENT0("skia.gpu", TRACE_FUNC);
|
||||
@ -477,12 +477,12 @@ GrBackendTexture GrDirectContext::createBackendTexture(int width, int height,
|
||||
}
|
||||
|
||||
return fGpu->createBackendTexture({width, height}, backendFormat, renderable,
|
||||
mipMapped, isProtected);
|
||||
mipmapped, isProtected);
|
||||
}
|
||||
|
||||
GrBackendTexture GrDirectContext::createBackendTexture(int width, int height,
|
||||
SkColorType skColorType,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrRenderable renderable,
|
||||
GrProtected isProtected) {
|
||||
if (this->abandoned()) {
|
||||
@ -491,21 +491,21 @@ GrBackendTexture GrDirectContext::createBackendTexture(int width, int height,
|
||||
|
||||
const GrBackendFormat format = this->defaultBackendFormat(skColorType, renderable);
|
||||
|
||||
return this->createBackendTexture(width, height, format, mipMapped, renderable, isProtected);
|
||||
return this->createBackendTexture(width, height, format, mipmapped, renderable, isProtected);
|
||||
}
|
||||
|
||||
static GrBackendTexture create_and_clear_backend_texture(
|
||||
GrDirectContext* dContext,
|
||||
SkISize dimensions,
|
||||
const GrBackendFormat& backendFormat,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrRenderable renderable,
|
||||
GrProtected isProtected,
|
||||
sk_sp<skgpu::RefCntedCallback> finishedCallback,
|
||||
std::array<float, 4> color) {
|
||||
GrGpu* gpu = dContext->priv().getGpu();
|
||||
GrBackendTexture beTex = gpu->createBackendTexture(dimensions, backendFormat, renderable,
|
||||
mipMapped, isProtected);
|
||||
mipmapped, isProtected);
|
||||
if (!beTex.isValid()) {
|
||||
return {};
|
||||
}
|
||||
@ -564,7 +564,7 @@ static bool update_texture_with_pixmaps(GrDirectContext* context,
|
||||
GrBackendTexture GrDirectContext::createBackendTexture(int width, int height,
|
||||
const GrBackendFormat& backendFormat,
|
||||
const SkColor4f& color,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrRenderable renderable,
|
||||
GrProtected isProtected,
|
||||
GrGpuFinishedProc finishedProc,
|
||||
@ -579,7 +579,7 @@ GrBackendTexture GrDirectContext::createBackendTexture(int width, int height,
|
||||
return create_and_clear_backend_texture(this,
|
||||
{width, height},
|
||||
backendFormat,
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
renderable,
|
||||
isProtected,
|
||||
std::move(finishedCallback),
|
||||
@ -589,7 +589,7 @@ GrBackendTexture GrDirectContext::createBackendTexture(int width, int height,
|
||||
GrBackendTexture GrDirectContext::createBackendTexture(int width, int height,
|
||||
SkColorType skColorType,
|
||||
const SkColor4f& color,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrRenderable renderable,
|
||||
GrProtected isProtected,
|
||||
GrGpuFinishedProc finishedProc,
|
||||
@ -611,7 +611,7 @@ GrBackendTexture GrDirectContext::createBackendTexture(int width, int height,
|
||||
return create_and_clear_backend_texture(this,
|
||||
{width, height},
|
||||
format,
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
renderable,
|
||||
isProtected,
|
||||
std::move(finishedCallback),
|
||||
@ -639,16 +639,16 @@ GrBackendTexture GrDirectContext::createBackendTexture(const SkPixmap srcData[],
|
||||
|
||||
SkColorType colorType = srcData[0].colorType();
|
||||
|
||||
GrMipmapped mipMapped = GrMipmapped::kNo;
|
||||
GrMipmapped mipmapped = GrMipmapped::kNo;
|
||||
if (numProvidedLevels > 1) {
|
||||
mipMapped = GrMipmapped::kYes;
|
||||
mipmapped = GrMipmapped::kYes;
|
||||
}
|
||||
|
||||
GrBackendFormat backendFormat = this->defaultBackendFormat(colorType, renderable);
|
||||
GrBackendTexture beTex = this->createBackendTexture(srcData[0].width(),
|
||||
srcData[0].height(),
|
||||
backendFormat,
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
renderable,
|
||||
isProtected);
|
||||
if (!beTex.isValid()) {
|
||||
@ -744,7 +744,7 @@ static GrBackendTexture create_and_update_compressed_backend_texture(
|
||||
GrDirectContext* dContext,
|
||||
SkISize dimensions,
|
||||
const GrBackendFormat& backendFormat,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrProtected isProtected,
|
||||
sk_sp<skgpu::RefCntedCallback> finishedCallback,
|
||||
const void* data,
|
||||
@ -752,7 +752,7 @@ static GrBackendTexture create_and_update_compressed_backend_texture(
|
||||
GrGpu* gpu = dContext->priv().getGpu();
|
||||
|
||||
GrBackendTexture beTex = gpu->createCompressedBackendTexture(dimensions, backendFormat,
|
||||
mipMapped, isProtected);
|
||||
mipmapped, isProtected);
|
||||
if (!beTex.isValid()) {
|
||||
return {};
|
||||
}
|
||||
@ -805,14 +805,14 @@ GrBackendTexture GrDirectContext::createCompressedBackendTexture(
|
||||
int width, int height,
|
||||
SkImage::CompressionType compression,
|
||||
const SkColor4f& color,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrProtected isProtected,
|
||||
GrGpuFinishedProc finishedProc,
|
||||
GrGpuFinishedContext finishedContext) {
|
||||
TRACE_EVENT0("skia.gpu", TRACE_FUNC);
|
||||
GrBackendFormat format = this->compressedBackendFormat(compression);
|
||||
return this->createCompressedBackendTexture(width, height, format, color,
|
||||
mipMapped, isProtected, finishedProc,
|
||||
mipmapped, isProtected, finishedProc,
|
||||
finishedContext);
|
||||
}
|
||||
|
||||
@ -821,7 +821,7 @@ GrBackendTexture GrDirectContext::createCompressedBackendTexture(
|
||||
const GrBackendFormat& backendFormat,
|
||||
const void* compressedData,
|
||||
size_t dataSize,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrProtected isProtected,
|
||||
GrGpuFinishedProc finishedProc,
|
||||
GrGpuFinishedContext finishedContext) {
|
||||
@ -835,7 +835,7 @@ GrBackendTexture GrDirectContext::createCompressedBackendTexture(
|
||||
return create_and_update_compressed_backend_texture(this,
|
||||
{width, height},
|
||||
backendFormat,
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
isProtected,
|
||||
std::move(finishedCallback),
|
||||
compressedData,
|
||||
@ -846,13 +846,13 @@ GrBackendTexture GrDirectContext::createCompressedBackendTexture(
|
||||
int width, int height,
|
||||
SkImage::CompressionType compression,
|
||||
const void* data, size_t dataSize,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrProtected isProtected,
|
||||
GrGpuFinishedProc finishedProc,
|
||||
GrGpuFinishedContext finishedContext) {
|
||||
TRACE_EVENT0("skia.gpu", TRACE_FUNC);
|
||||
GrBackendFormat format = this->compressedBackendFormat(compression);
|
||||
return this->createCompressedBackendTexture(width, height, format, data, dataSize, mipMapped,
|
||||
return this->createCompressedBackendTexture(width, height, format, data, dataSize, mipmapped,
|
||||
isProtected, finishedProc, finishedContext);
|
||||
}
|
||||
|
||||
|
@ -182,14 +182,14 @@ bool GrDrawingManager::flush(
|
||||
// OnFlush callbacks are invoked during flush, and are therefore expected to handle
|
||||
// resource allocation & usage on their own. (No deferred or lazy proxies!)
|
||||
onFlushRenderTask->visitTargetAndSrcProxies_debugOnly(
|
||||
[](GrSurfaceProxy* p, GrMipmapped mipMapped) {
|
||||
[](GrSurfaceProxy* p, GrMipmapped mipmapped) {
|
||||
SkASSERT(!p->asTextureProxy() || !p->asTextureProxy()->texPriv().isDeferred());
|
||||
SkASSERT(!p->isLazy());
|
||||
if (p->requiresManualMSAAResolve()) {
|
||||
// The onFlush callback is responsible for ensuring MSAA gets resolved.
|
||||
SkASSERT(p->asRenderTargetProxy() && !p->asRenderTargetProxy()->isMSAADirty());
|
||||
}
|
||||
if (GrMipmapped::kYes == mipMapped) {
|
||||
if (GrMipmapped::kYes == mipmapped) {
|
||||
// The onFlush callback is responsible for regenerating mips if needed.
|
||||
SkASSERT(p->asTextureProxy() && !p->asTextureProxy()->mipmapsAreDirty());
|
||||
}
|
||||
|
@ -109,12 +109,12 @@ sk_sp<GrTexture> GrGpu::createTextureCommon(SkISize dimensions,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GrMipmapped mipMapped = mipLevelCount > 1 ? GrMipmapped::kYes : GrMipmapped::kNo;
|
||||
GrMipmapped mipmapped = mipLevelCount > 1 ? GrMipmapped::kYes : GrMipmapped::kNo;
|
||||
if (!this->caps()->validateSurfaceParams(dimensions,
|
||||
format,
|
||||
renderable,
|
||||
renderTargetSampleCnt,
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
textureType)) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -154,11 +154,11 @@ sk_sp<GrTexture> GrGpu::createTexture(SkISize dimensions,
|
||||
GrTextureType textureType,
|
||||
GrRenderable renderable,
|
||||
int renderTargetSampleCnt,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
SkBudgeted budgeted,
|
||||
GrProtected isProtected) {
|
||||
int mipLevelCount = 1;
|
||||
if (mipMapped == GrMipmapped::kYes) {
|
||||
if (mipmapped == GrMipmapped::kYes) {
|
||||
mipLevelCount =
|
||||
32 - SkCLZ(static_cast<uint32_t>(std::max(dimensions.fWidth, dimensions.fHeight)));
|
||||
}
|
||||
@ -173,7 +173,7 @@ sk_sp<GrTexture> GrGpu::createTexture(SkISize dimensions,
|
||||
isProtected,
|
||||
mipLevelCount,
|
||||
levelClearMask);
|
||||
if (tex && mipMapped == GrMipmapped::kYes && levelClearMask) {
|
||||
if (tex && mipmapped == GrMipmapped::kYes && levelClearMask) {
|
||||
tex->markMipmapsClean();
|
||||
}
|
||||
return tex;
|
||||
@ -251,7 +251,7 @@ sk_sp<GrTexture> GrGpu::createTexture(SkISize dimensions,
|
||||
sk_sp<GrTexture> GrGpu::createCompressedTexture(SkISize dimensions,
|
||||
const GrBackendFormat& format,
|
||||
SkBudgeted budgeted,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrProtected isProtected,
|
||||
const void* data,
|
||||
size_t dataSize) {
|
||||
@ -277,10 +277,10 @@ sk_sp<GrTexture> GrGpu::createCompressedTexture(SkISize dimensions,
|
||||
}
|
||||
|
||||
if (dataSize < SkCompressedDataSize(compressionType, dimensions, nullptr,
|
||||
mipMapped == GrMipmapped::kYes)) {
|
||||
mipmapped == GrMipmapped::kYes)) {
|
||||
return nullptr;
|
||||
}
|
||||
return this->onCreateCompressedTexture(dimensions, format, budgeted, mipMapped, isProtected,
|
||||
return this->onCreateCompressedTexture(dimensions, format, budgeted, mipmapped, isProtected,
|
||||
data, dataSize);
|
||||
}
|
||||
|
||||
@ -804,20 +804,20 @@ void GrGpu::Stats::dumpKeyValuePairs(SkTArray<SkString>* keys, SkTArray<double>*
|
||||
|
||||
bool GrGpu::CompressedDataIsCorrect(SkISize dimensions,
|
||||
SkImage::CompressionType compressionType,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
const void* data,
|
||||
size_t length) {
|
||||
size_t computedSize = SkCompressedDataSize(compressionType,
|
||||
dimensions,
|
||||
nullptr,
|
||||
mipMapped == GrMipmapped::kYes);
|
||||
mipmapped == GrMipmapped::kYes);
|
||||
return computedSize == length;
|
||||
}
|
||||
|
||||
GrBackendTexture GrGpu::createBackendTexture(SkISize dimensions,
|
||||
const GrBackendFormat& format,
|
||||
GrRenderable renderable,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrProtected isProtected) {
|
||||
const GrCaps* caps = this->caps();
|
||||
|
||||
@ -835,11 +835,11 @@ GrBackendTexture GrGpu::createBackendTexture(SkISize dimensions,
|
||||
return {};
|
||||
}
|
||||
|
||||
if (mipMapped == GrMipmapped::kYes && !this->caps()->mipmapSupport()) {
|
||||
if (mipmapped == GrMipmapped::kYes && !this->caps()->mipmapSupport()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return this->onCreateBackendTexture(dimensions, format, renderable, mipMapped, isProtected);
|
||||
return this->onCreateBackendTexture(dimensions, format, renderable, mipmapped, isProtected);
|
||||
}
|
||||
|
||||
bool GrGpu::clearBackendTexture(const GrBackendTexture& backendTexture,
|
||||
@ -858,7 +858,7 @@ bool GrGpu::clearBackendTexture(const GrBackendTexture& backendTexture,
|
||||
|
||||
GrBackendTexture GrGpu::createCompressedBackendTexture(SkISize dimensions,
|
||||
const GrBackendFormat& format,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrProtected isProtected) {
|
||||
const GrCaps* caps = this->caps();
|
||||
|
||||
@ -878,11 +878,11 @@ GrBackendTexture GrGpu::createCompressedBackendTexture(SkISize dimensions,
|
||||
return {};
|
||||
}
|
||||
|
||||
if (mipMapped == GrMipmapped::kYes && !this->caps()->mipmapSupport()) {
|
||||
if (mipmapped == GrMipmapped::kYes && !this->caps()->mipmapSupport()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return this->onCreateCompressedBackendTexture(dimensions, format, mipMapped, isProtected);
|
||||
return this->onCreateCompressedBackendTexture(dimensions, format, mipmapped, isProtected);
|
||||
}
|
||||
|
||||
bool GrGpu::updateCompressedBackendTexture(const GrBackendTexture& backendTexture,
|
||||
@ -907,11 +907,11 @@ bool GrGpu::updateCompressedBackendTexture(const GrBackendTexture& backendTextur
|
||||
return false;
|
||||
}
|
||||
|
||||
GrMipmapped mipMapped = backendTexture.hasMipmaps() ? GrMipmapped::kYes : GrMipmapped::kNo;
|
||||
GrMipmapped mipmapped = backendTexture.hasMipmaps() ? GrMipmapped::kYes : GrMipmapped::kNo;
|
||||
|
||||
if (!CompressedDataIsCorrect(backendTexture.dimensions(),
|
||||
compressionType,
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
data,
|
||||
length)) {
|
||||
return false;
|
||||
|
@ -150,14 +150,14 @@ public:
|
||||
GrTextureType textureType,
|
||||
GrRenderable renderable,
|
||||
int renderTargetSampleCnt,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
SkBudgeted budgeted,
|
||||
GrProtected isProtected);
|
||||
|
||||
sk_sp<GrTexture> createCompressedTexture(SkISize dimensions,
|
||||
const GrBackendFormat& format,
|
||||
SkBudgeted budgeted,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrProtected isProtected,
|
||||
const void* data, size_t dataSize);
|
||||
|
||||
|
@ -437,7 +437,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::createProxy(const GrBackendFormat& format
|
||||
SkISize dimensions,
|
||||
GrRenderable renderable,
|
||||
int renderTargetSampleCnt,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
SkBackingFit fit,
|
||||
SkBudgeted budgeted,
|
||||
GrProtected isProtected,
|
||||
@ -455,11 +455,11 @@ sk_sp<GrTextureProxy> GrProxyProvider::createProxy(const GrBackendFormat& format
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (GrMipmapped::kYes == mipMapped) {
|
||||
if (GrMipmapped::kYes == mipmapped) {
|
||||
// SkMipmap doesn't include the base level in the level count so we have to add 1
|
||||
int mipCount = SkMipmap::ComputeLevelCount(dimensions.fWidth, dimensions.fHeight) + 1;
|
||||
if (1 == mipCount) {
|
||||
mipMapped = GrMipmapped::kNo;
|
||||
mipmapped = GrMipmapped::kNo;
|
||||
}
|
||||
}
|
||||
|
||||
@ -467,11 +467,11 @@ sk_sp<GrTextureProxy> GrProxyProvider::createProxy(const GrBackendFormat& format
|
||||
format,
|
||||
renderable,
|
||||
renderTargetSampleCnt,
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
GrTextureType::k2D)) {
|
||||
return nullptr;
|
||||
}
|
||||
GrMipmapStatus mipmapStatus = (GrMipmapped::kYes == mipMapped)
|
||||
GrMipmapStatus mipmapStatus = (GrMipmapped::kYes == mipmapped)
|
||||
? GrMipmapStatus::kDirty
|
||||
: GrMipmapStatus::kNotAllocated;
|
||||
if (renderable == GrRenderable::kYes) {
|
||||
@ -484,7 +484,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::createProxy(const GrBackendFormat& format
|
||||
format,
|
||||
dimensions,
|
||||
renderTargetSampleCnt,
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
mipmapStatus,
|
||||
fit,
|
||||
budgeted,
|
||||
@ -497,7 +497,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::createProxy(const GrBackendFormat& format
|
||||
|
||||
return sk_sp<GrTextureProxy>(new GrTextureProxy(format,
|
||||
dimensions,
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
mipmapStatus,
|
||||
fit,
|
||||
budgeted,
|
||||
@ -509,7 +509,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::createProxy(const GrBackendFormat& format
|
||||
}
|
||||
|
||||
sk_sp<GrTextureProxy> GrProxyProvider::createCompressedTextureProxy(
|
||||
SkISize dimensions, SkBudgeted budgeted, GrMipmapped mipMapped, GrProtected isProtected,
|
||||
SkISize dimensions, SkBudgeted budgeted, GrMipmapped mipmapped, GrProtected isProtected,
|
||||
SkImage::CompressionType compressionType, sk_sp<SkData> data) {
|
||||
ASSERT_SINGLE_OWNER
|
||||
if (this->isAbandoned()) {
|
||||
@ -522,7 +522,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::createCompressedTextureProxy(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GrMipmapStatus mipmapStatus = (GrMipmapped::kYes == mipMapped) ? GrMipmapStatus::kValid
|
||||
GrMipmapStatus mipmapStatus = (GrMipmapped::kYes == mipmapped) ? GrMipmapStatus::kValid
|
||||
: GrMipmapStatus::kNotAllocated;
|
||||
|
||||
sk_sp<GrTextureProxy> proxy = this->createLazyProxy(
|
||||
@ -531,7 +531,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::createCompressedTextureProxy(
|
||||
desc.fDimensions, desc.fFormat, desc.fBudgeted, desc.fMipmapped,
|
||||
desc.fProtected, data.get()));
|
||||
},
|
||||
format, dimensions, mipMapped, mipmapStatus,GrInternalSurfaceFlags::kReadOnly,
|
||||
format, dimensions, mipmapped, mipmapStatus,GrInternalSurfaceFlags::kReadOnly,
|
||||
SkBackingFit::kExact, SkBudgeted::kYes, GrProtected::kNo, UseAllocator::kYes);
|
||||
|
||||
if (!proxy) {
|
||||
@ -746,7 +746,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::CreatePromiseProxy(GrContextThreadSafePro
|
||||
LazyInstantiateCallback&& callback,
|
||||
const GrBackendFormat& format,
|
||||
SkISize dimensions,
|
||||
GrMipmapped mipMapped) {
|
||||
GrMipmapped mipmapped) {
|
||||
if (threadSafeProxy->priv().abandoned()) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -759,7 +759,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::CreatePromiseProxy(GrContextThreadSafePro
|
||||
}
|
||||
// Ganesh assumes that, when wrapping a mipmapped backend texture from a client, that its
|
||||
// mipmaps are fully fleshed out.
|
||||
GrMipmapStatus mipmapStatus = (GrMipmapped::kYes == mipMapped) ? GrMipmapStatus::kValid
|
||||
GrMipmapStatus mipmapStatus = (GrMipmapped::kYes == mipmapped) ? GrMipmapStatus::kValid
|
||||
: GrMipmapStatus::kNotAllocated;
|
||||
|
||||
// We pass kReadOnly here since we should treat content of the client's texture as immutable.
|
||||
@ -767,7 +767,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::CreatePromiseProxy(GrContextThreadSafePro
|
||||
auto proxy = sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(callback),
|
||||
format,
|
||||
dimensions,
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
mipmapStatus,
|
||||
SkBackingFit::kExact,
|
||||
SkBudgeted::kNo,
|
||||
@ -783,7 +783,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::CreatePromiseProxy(GrContextThreadSafePro
|
||||
sk_sp<GrTextureProxy> GrProxyProvider::createLazyProxy(LazyInstantiateCallback&& callback,
|
||||
const GrBackendFormat& format,
|
||||
SkISize dimensions,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrMipmapStatus mipmapStatus,
|
||||
GrInternalSurfaceFlags surfaceFlags,
|
||||
SkBackingFit fit,
|
||||
@ -809,7 +809,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::createLazyProxy(LazyInstantiateCallback&&
|
||||
return sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(callback),
|
||||
format,
|
||||
dimensions,
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
mipmapStatus,
|
||||
fit,
|
||||
budgeted,
|
||||
|
@ -125,7 +125,7 @@ void GrRenderTask::addDependenciesFromOtherTask(GrRenderTask* otherTask) {
|
||||
|
||||
// Convert from a GrSurface-based dependency to a GrRenderTask one
|
||||
void GrRenderTask::addDependency(GrDrawingManager* drawingMgr, GrSurfaceProxy* dependedOn,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrTextureResolveManager textureResolveManager,
|
||||
const GrCaps& caps) {
|
||||
// If it is still receiving dependencies, this GrRenderTask shouldn't be closed
|
||||
@ -136,7 +136,7 @@ void GrRenderTask::addDependency(GrDrawingManager* drawingMgr, GrSurfaceProxy* d
|
||||
if (dependedOnTask == this) {
|
||||
// self-read - presumably for dst reads. We don't need to do anything in this case. The
|
||||
// XferProcessor will detect what is happening and insert a texture barrier.
|
||||
SkASSERT(GrMipmapped::kNo == mipMapped);
|
||||
SkASSERT(GrMipmapped::kNo == mipmapped);
|
||||
// We should never attempt a self-read on a surface that has a separate MSAA renderbuffer.
|
||||
SkASSERT(!dependedOn->requiresManualMSAAResolve());
|
||||
SkASSERT(!dependedOn->asTextureProxy() ||
|
||||
@ -168,12 +168,12 @@ void GrRenderTask::addDependency(GrDrawingManager* drawingMgr, GrSurfaceProxy* d
|
||||
}
|
||||
|
||||
GrTextureProxy* textureProxy = dependedOn->asTextureProxy();
|
||||
if (GrMipmapped::kYes == mipMapped) {
|
||||
if (GrMipmapped::kYes == mipmapped) {
|
||||
SkASSERT(textureProxy);
|
||||
if (GrMipmapped::kYes != textureProxy->mipmapped()) {
|
||||
// There are some cases where we might be given a non-mipmapped texture with a mipmap
|
||||
// filter. See skbug.com/7094.
|
||||
mipMapped = GrMipmapped::kNo;
|
||||
mipmapped = GrMipmapped::kNo;
|
||||
} else if (textureProxy->mipmapsAreDirty()) {
|
||||
resolveFlags |= GrSurfaceProxy::ResolveFlags::kMipMaps;
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ public:
|
||||
GrTextureType textureType,
|
||||
GrRenderable renderable,
|
||||
int renderTargetSampleCnt,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
SkBudgeted budgeted,
|
||||
GrProtected isProtected);
|
||||
|
||||
@ -92,7 +92,7 @@ public:
|
||||
GrRenderable renderable,
|
||||
int renderTargetSampleCnt,
|
||||
SkBudgeted budgeted,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrProtected isProtected,
|
||||
const GrMipLevel texels[]);
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
size_t GrSurface::ComputeSize(const GrBackendFormat& format,
|
||||
SkISize dimensions,
|
||||
int colorSamplesPerPixel,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
bool binSize) {
|
||||
// For external formats we do not actually know the real size of the resource so we just return
|
||||
// 0 here to indicate this.
|
||||
@ -35,7 +35,7 @@ size_t GrSurface::ComputeSize(const GrBackendFormat& format,
|
||||
SkImage::CompressionType compressionType = GrBackendFormatToCompressionType(format);
|
||||
if (compressionType != SkImage::CompressionType::kNone) {
|
||||
colorSize = SkCompressedFormatDataSize(compressionType, dimensions,
|
||||
mipMapped == GrMipmapped::kYes);
|
||||
mipmapped == GrMipmapped::kYes);
|
||||
} else {
|
||||
colorSize = (size_t)dimensions.width() * dimensions.height() *
|
||||
GrBackendFormatBytesPerPixel(format);
|
||||
@ -44,7 +44,7 @@ size_t GrSurface::ComputeSize(const GrBackendFormat& format,
|
||||
|
||||
size_t finalSize = colorSamplesPerPixel * colorSize;
|
||||
|
||||
if (GrMipmapped::kYes == mipMapped) {
|
||||
if (GrMipmapped::kYes == mipmapped) {
|
||||
// We don't have to worry about the mipmaps being a different dimensions than
|
||||
// we'd expect because we never change fDesc.fWidth/fHeight.
|
||||
finalSize += colorSize/3;
|
||||
|
@ -111,8 +111,8 @@ GrSurfaceProxy::~GrSurfaceProxy() {
|
||||
sk_sp<GrSurface> GrSurfaceProxy::createSurfaceImpl(GrResourceProvider* resourceProvider,
|
||||
int sampleCnt,
|
||||
GrRenderable renderable,
|
||||
GrMipmapped mipMapped) const {
|
||||
SkASSERT(mipMapped == GrMipmapped::kNo || fFit == SkBackingFit::kExact);
|
||||
GrMipmapped mipmapped) const {
|
||||
SkASSERT(mipmapped == GrMipmapped::kNo || fFit == SkBackingFit::kExact);
|
||||
SkASSERT(!this->isLazy());
|
||||
SkASSERT(!fTarget);
|
||||
|
||||
@ -130,7 +130,7 @@ sk_sp<GrSurface> GrSurfaceProxy::createSurfaceImpl(GrResourceProvider* resourceP
|
||||
fFormat.textureType(),
|
||||
renderable,
|
||||
sampleCnt,
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
fBudgeted,
|
||||
fIsProtected);
|
||||
}
|
||||
@ -179,7 +179,7 @@ void GrSurfaceProxy::assign(sk_sp<GrSurface> surface) {
|
||||
}
|
||||
|
||||
bool GrSurfaceProxy::instantiateImpl(GrResourceProvider* resourceProvider, int sampleCnt,
|
||||
GrRenderable renderable, GrMipmapped mipMapped,
|
||||
GrRenderable renderable, GrMipmapped mipmapped,
|
||||
const skgpu::UniqueKey* uniqueKey) {
|
||||
SkASSERT(!this->isLazy());
|
||||
if (fTarget) {
|
||||
@ -190,7 +190,7 @@ bool GrSurfaceProxy::instantiateImpl(GrResourceProvider* resourceProvider, int s
|
||||
}
|
||||
|
||||
sk_sp<GrSurface> surface = this->createSurfaceImpl(resourceProvider, sampleCnt, renderable,
|
||||
mipMapped);
|
||||
mipmapped);
|
||||
if (!surface) {
|
||||
return false;
|
||||
}
|
||||
@ -221,13 +221,13 @@ void GrSurfaceProxy::computeScratchKey(const GrCaps& caps, skgpu::ScratchKey* ke
|
||||
}
|
||||
|
||||
const GrTextureProxy* tp = this->asTextureProxy();
|
||||
GrMipmapped mipMapped = GrMipmapped::kNo;
|
||||
GrMipmapped mipmapped = GrMipmapped::kNo;
|
||||
if (tp) {
|
||||
mipMapped = tp->mipmapped();
|
||||
mipmapped = tp->mipmapped();
|
||||
}
|
||||
|
||||
GrTexture::ComputeScratchKey(caps, this->backendFormat(), this->backingStoreDimensions(),
|
||||
renderable, sampleCount, mipMapped, fIsProtected, key);
|
||||
renderable, sampleCount, mipmapped, fIsProtected, key);
|
||||
}
|
||||
|
||||
SkISize GrSurfaceProxy::backingStoreDimensions() const {
|
||||
@ -263,7 +263,7 @@ void GrSurfaceProxy::validate(GrContext_Base* context) const {
|
||||
sk_sp<GrSurfaceProxy> GrSurfaceProxy::Copy(GrRecordingContext* rContext,
|
||||
sk_sp<GrSurfaceProxy> src,
|
||||
GrSurfaceOrigin origin,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
SkIRect srcRect,
|
||||
SkBackingFit fit,
|
||||
SkBudgeted budgeted,
|
||||
@ -298,7 +298,7 @@ sk_sp<GrSurfaceProxy> GrSurfaceProxy::Copy(GrRecordingContext* rContext,
|
||||
origin,
|
||||
GrRenderable::kNo,
|
||||
1,
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
src->isProtected(),
|
||||
budgeted);
|
||||
sk_sp<GrRenderTask> copyTask;
|
||||
@ -316,7 +316,7 @@ sk_sp<GrSurfaceProxy> GrSurfaceProxy::Copy(GrRecordingContext* rContext,
|
||||
fit,
|
||||
format,
|
||||
1,
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
src->isProtected(),
|
||||
skgpu::Swizzle::RGBA(),
|
||||
skgpu::Swizzle::RGBA(),
|
||||
@ -337,7 +337,7 @@ sk_sp<GrSurfaceProxy> GrSurfaceProxy::Copy(GrRecordingContext* rContext,
|
||||
sk_sp<GrSurfaceProxy> GrSurfaceProxy::Copy(GrRecordingContext* context,
|
||||
sk_sp<GrSurfaceProxy> src,
|
||||
GrSurfaceOrigin origin,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
SkBackingFit fit,
|
||||
SkBudgeted budgeted,
|
||||
sk_sp<GrRenderTask>* outTask) {
|
||||
@ -346,7 +346,7 @@ sk_sp<GrSurfaceProxy> GrSurfaceProxy::Copy(GrRecordingContext* context,
|
||||
return Copy(context,
|
||||
std::move(src),
|
||||
origin,
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
rect,
|
||||
fit,
|
||||
budgeted,
|
||||
|
@ -99,14 +99,14 @@ public:
|
||||
// the same origin and swizzle as the src view.
|
||||
static GrSurfaceProxyView Copy(GrRecordingContext* context,
|
||||
GrSurfaceProxyView src,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
SkIRect srcRect,
|
||||
SkBackingFit fit,
|
||||
SkBudgeted budgeted) {
|
||||
auto copy = GrSurfaceProxy::Copy(context,
|
||||
src.refProxy(),
|
||||
src.origin(),
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
srcRect,
|
||||
fit,
|
||||
budgeted);
|
||||
@ -115,13 +115,13 @@ public:
|
||||
|
||||
static GrSurfaceProxyView Copy(GrRecordingContext* rContext,
|
||||
GrSurfaceProxyView src,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
SkBackingFit fit,
|
||||
SkBudgeted budgeted) {
|
||||
auto copy = GrSurfaceProxy::Copy(rContext,
|
||||
src.refProxy(),
|
||||
src.origin(),
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
fit,
|
||||
budgeted);
|
||||
return {std::move(copy), src.origin(), src.swizzle()};
|
||||
|
@ -105,7 +105,7 @@ void GrTexture::ComputeScratchKey(const GrCaps& caps,
|
||||
SkISize dimensions,
|
||||
GrRenderable renderable,
|
||||
int sampleCnt,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrProtected isProtected,
|
||||
skgpu::ScratchKey* key) {
|
||||
static const skgpu::ScratchKey::ResourceType kType = skgpu::ScratchKey::GenerateResourceType();
|
||||
@ -113,7 +113,7 @@ void GrTexture::ComputeScratchKey(const GrCaps& caps,
|
||||
SkASSERT(sampleCnt > 0);
|
||||
SkASSERT(1 == sampleCnt || renderable == GrRenderable::kYes);
|
||||
|
||||
SkASSERT(static_cast<uint32_t>(mipMapped) <= 1);
|
||||
SkASSERT(static_cast<uint32_t>(mipmapped) <= 1);
|
||||
SkASSERT(static_cast<uint32_t>(isProtected) <= 1);
|
||||
SkASSERT(static_cast<uint32_t>(renderable) <= 1);
|
||||
SkASSERT(static_cast<uint32_t>(sampleCnt) < (1 << (32 - 3)));
|
||||
@ -125,7 +125,7 @@ void GrTexture::ComputeScratchKey(const GrCaps& caps,
|
||||
builder[1] = dimensions.height();
|
||||
builder[2] = formatKey & 0xFFFFFFFF;
|
||||
builder[3] = (formatKey >> 32) & 0xFFFFFFFF;
|
||||
builder[4] = (static_cast<uint32_t>(mipMapped) << 0)
|
||||
builder[4] = (static_cast<uint32_t>(mipmapped) << 0)
|
||||
| (static_cast<uint32_t>(isProtected) << 1)
|
||||
| (static_cast<uint32_t>(renderable) << 2)
|
||||
| (static_cast<uint32_t>(sampleCnt) << 3);
|
||||
|
@ -19,7 +19,7 @@
|
||||
// Deferred version - no data
|
||||
GrTextureProxy::GrTextureProxy(const GrBackendFormat& format,
|
||||
SkISize dimensions,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrMipmapStatus mipmapStatus,
|
||||
SkBackingFit fit,
|
||||
SkBudgeted budgeted,
|
||||
@ -29,7 +29,7 @@ GrTextureProxy::GrTextureProxy(const GrBackendFormat& format,
|
||||
GrDDLProvider creatingProvider,
|
||||
std::string_view label)
|
||||
: INHERITED(format, dimensions, fit, budgeted, isProtected, surfaceFlags, useAllocator, label)
|
||||
, fMipmapped(mipMapped)
|
||||
, fMipmapped(mipmapped)
|
||||
, fMipmapStatus(mipmapStatus)
|
||||
SkDEBUGCODE(, fInitialMipmapStatus(fMipmapStatus))
|
||||
, fCreatingProvider(creatingProvider)
|
||||
@ -45,7 +45,7 @@ GrTextureProxy::GrTextureProxy(const GrBackendFormat& format,
|
||||
GrTextureProxy::GrTextureProxy(LazyInstantiateCallback&& callback,
|
||||
const GrBackendFormat& format,
|
||||
SkISize dimensions,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrMipmapStatus mipmapStatus,
|
||||
SkBackingFit fit,
|
||||
SkBudgeted budgeted,
|
||||
@ -56,7 +56,7 @@ GrTextureProxy::GrTextureProxy(LazyInstantiateCallback&& callback,
|
||||
std::string_view label)
|
||||
: INHERITED(std::move(callback), format, dimensions, fit, budgeted, isProtected,
|
||||
surfaceFlags, useAllocator, label)
|
||||
, fMipmapped(mipMapped)
|
||||
, fMipmapped(mipmapped)
|
||||
, fMipmapStatus(mipmapStatus)
|
||||
SkDEBUGCODE(, fInitialMipmapStatus(fMipmapStatus))
|
||||
, fCreatingProvider(creatingProvider)
|
||||
|
@ -26,7 +26,7 @@ GrTextureRenderTargetProxy::GrTextureRenderTargetProxy(const GrCaps& caps,
|
||||
const GrBackendFormat& format,
|
||||
SkISize dimensions,
|
||||
int sampleCnt,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrMipmapStatus mipmapStatus,
|
||||
SkBackingFit fit,
|
||||
SkBudgeted budgeted,
|
||||
@ -40,7 +40,7 @@ GrTextureRenderTargetProxy::GrTextureRenderTargetProxy(const GrCaps& caps,
|
||||
// for now textures w/ data are always wrapped
|
||||
, GrRenderTargetProxy(caps, format, dimensions, sampleCnt, fit, budgeted, isProtected,
|
||||
surfaceFlags, useAllocator, label)
|
||||
, GrTextureProxy(format, dimensions, mipMapped, mipmapStatus, fit, budgeted, isProtected,
|
||||
, GrTextureProxy(format, dimensions, mipmapped, mipmapStatus, fit, budgeted, isProtected,
|
||||
surfaceFlags, useAllocator, creatingProvider, label) {
|
||||
this->initSurfaceFlags(caps);
|
||||
}
|
||||
@ -51,7 +51,7 @@ GrTextureRenderTargetProxy::GrTextureRenderTargetProxy(const GrCaps& caps,
|
||||
const GrBackendFormat& format,
|
||||
SkISize dimensions,
|
||||
int sampleCnt,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrMipmapStatus mipmapStatus,
|
||||
SkBackingFit fit,
|
||||
SkBudgeted budgeted,
|
||||
@ -85,7 +85,7 @@ GrTextureRenderTargetProxy::GrTextureRenderTargetProxy(const GrCaps& caps,
|
||||
, GrTextureProxy(LazyInstantiateCallback(),
|
||||
format,
|
||||
dimensions,
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
mipmapStatus,
|
||||
fit,
|
||||
budgeted,
|
||||
|
@ -344,7 +344,7 @@ static void copy_compressed_data(char* mapPtr, DXGI_FORMAT dxgiFormat,
|
||||
sk_sp<GrTexture> GrD3DGpu::onCreateCompressedTexture(SkISize dimensions,
|
||||
const GrBackendFormat& format,
|
||||
SkBudgeted budgeted,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrProtected isProtected,
|
||||
const void* data, size_t dataSize) {
|
||||
DXGI_FORMAT dxgiFormat;
|
||||
@ -353,10 +353,10 @@ sk_sp<GrTexture> GrD3DGpu::onCreateCompressedTexture(SkISize dimensions,
|
||||
|
||||
SkDEBUGCODE(SkImage::CompressionType compression = GrBackendFormatToCompressionType(format));
|
||||
SkASSERT(dataSize == SkCompressedFormatDataSize(compression, dimensions,
|
||||
mipMapped == GrMipmapped::kYes));
|
||||
mipmapped == GrMipmapped::kYes));
|
||||
|
||||
int mipLevelCount = 1;
|
||||
if (mipMapped == GrMipmapped::kYes) {
|
||||
if (mipmapped == GrMipmapped::kYes) {
|
||||
mipLevelCount = SkMipmap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1;
|
||||
}
|
||||
GrMipmapStatus mipmapStatus = mipLevelCount > 1 ? GrMipmapStatus::kValid
|
||||
@ -1271,7 +1271,7 @@ bool GrD3DGpu::createTextureResourceForBackendSurface(DXGI_FORMAT dxgiFormat,
|
||||
SkISize dimensions,
|
||||
GrTexturable texturable,
|
||||
GrRenderable renderable,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
int sampleCnt,
|
||||
GrD3DTextureResourceInfo* info,
|
||||
GrProtected isProtected) {
|
||||
@ -1290,7 +1290,7 @@ bool GrD3DGpu::createTextureResourceForBackendSurface(DXGI_FORMAT dxgiFormat,
|
||||
}
|
||||
|
||||
int numMipLevels = 1;
|
||||
if (mipMapped == GrMipmapped::kYes) {
|
||||
if (mipmapped == GrMipmapped::kYes) {
|
||||
numMipLevels = SkMipmap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1;
|
||||
}
|
||||
|
||||
@ -1340,7 +1340,7 @@ bool GrD3DGpu::createTextureResourceForBackendSurface(DXGI_FORMAT dxgiFormat,
|
||||
GrBackendTexture GrD3DGpu::onCreateBackendTexture(SkISize dimensions,
|
||||
const GrBackendFormat& format,
|
||||
GrRenderable renderable,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrProtected isProtected) {
|
||||
const GrD3DCaps& caps = this->d3dCaps();
|
||||
|
||||
@ -1360,7 +1360,7 @@ GrBackendTexture GrD3DGpu::onCreateBackendTexture(SkISize dimensions,
|
||||
|
||||
GrD3DTextureResourceInfo info;
|
||||
if (!this->createTextureResourceForBackendSurface(dxgiFormat, dimensions, GrTexturable::kYes,
|
||||
renderable, mipMapped, 1, &info,
|
||||
renderable, mipmapped, 1, &info,
|
||||
isProtected)) {
|
||||
return {};
|
||||
}
|
||||
@ -1481,9 +1481,9 @@ bool GrD3DGpu::onClearBackendTexture(const GrBackendTexture& backendTexture,
|
||||
}
|
||||
|
||||
GrBackendTexture GrD3DGpu::onCreateCompressedBackendTexture(
|
||||
SkISize dimensions, const GrBackendFormat& format, GrMipmapped mipMapped,
|
||||
SkISize dimensions, const GrBackendFormat& format, GrMipmapped mipmapped,
|
||||
GrProtected isProtected) {
|
||||
return this->onCreateBackendTexture(dimensions, format, GrRenderable::kNo, mipMapped,
|
||||
return this->onCreateBackendTexture(dimensions, format, GrRenderable::kNo, mipmapped,
|
||||
isProtected);
|
||||
}
|
||||
|
||||
|
@ -281,7 +281,7 @@ private:
|
||||
SkISize dimensions,
|
||||
GrTexturable texturable,
|
||||
GrRenderable renderable,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
int sampleCnt,
|
||||
GrD3DTextureResourceInfo* info,
|
||||
GrProtected isProtected);
|
||||
|
@ -310,7 +310,7 @@ sk_sp<GrAttachment> GrDawnGpu::makeStencilAttachment(const GrBackendFormat& /*co
|
||||
GrBackendTexture GrDawnGpu::onCreateBackendTexture(SkISize dimensions,
|
||||
const GrBackendFormat& backendFormat,
|
||||
GrRenderable renderable,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrProtected isProtected) {
|
||||
wgpu::TextureFormat format;
|
||||
if (!backendFormat.asDawnFormat(&format)) {
|
||||
@ -326,7 +326,7 @@ GrBackendTexture GrDawnGpu::onCreateBackendTexture(SkISize dimensions,
|
||||
}
|
||||
|
||||
int numMipLevels = 1;
|
||||
if (mipMapped == GrMipmapped::kYes) {
|
||||
if (mipmapped == GrMipmapped::kYes) {
|
||||
numMipLevels = SkMipmap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1;
|
||||
}
|
||||
|
||||
|
@ -1112,7 +1112,7 @@ void GrGLGpu::uploadTexData(SkISize texDims,
|
||||
bool GrGLGpu::uploadCompressedTexData(SkImage::CompressionType compressionType,
|
||||
GrGLFormat format,
|
||||
SkISize dimensions,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrGLenum target,
|
||||
const void* data, size_t dataSize) {
|
||||
SkASSERT(format != GrGLFormat::kUnknown);
|
||||
@ -1129,7 +1129,7 @@ bool GrGLGpu::uploadCompressedTexData(SkImage::CompressionType compressionType,
|
||||
bool useTexStorage = caps.formatSupportsTexStorage(format);
|
||||
|
||||
int numMipLevels = 1;
|
||||
if (mipMapped == GrMipmapped::kYes) {
|
||||
if (mipmapped == GrMipmapped::kYes) {
|
||||
numMipLevels = SkMipmap::ComputeLevelCount(dimensions.width(), dimensions.height())+1;
|
||||
}
|
||||
|
||||
@ -1494,7 +1494,7 @@ sk_sp<GrTexture> GrGLGpu::onCreateTexture(SkISize dimensions,
|
||||
sk_sp<GrTexture> GrGLGpu::onCreateCompressedTexture(SkISize dimensions,
|
||||
const GrBackendFormat& format,
|
||||
SkBudgeted budgeted,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrProtected isProtected,
|
||||
const void* data, size_t dataSize) {
|
||||
// We don't support protected textures in GL.
|
||||
@ -1510,13 +1510,13 @@ sk_sp<GrTexture> GrGLGpu::onCreateCompressedTexture(SkISize dimensions,
|
||||
desc.fOwnership = GrBackendObjectOwnership::kOwned;
|
||||
desc.fFormat = format.asGLFormat();
|
||||
desc.fID = this->createCompressedTexture2D(desc.fSize, compression, desc.fFormat,
|
||||
mipMapped, &initialState);
|
||||
mipmapped, &initialState);
|
||||
if (!desc.fID) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (data) {
|
||||
if (!this->uploadCompressedTexData(compression, desc.fFormat, dimensions, mipMapped,
|
||||
if (!this->uploadCompressedTexData(compression, desc.fFormat, dimensions, mipmapped,
|
||||
GR_GL_TEXTURE_2D, data, dataSize)) {
|
||||
GL_CALL(DeleteTextures(1, &desc.fID));
|
||||
return nullptr;
|
||||
@ -1526,7 +1526,7 @@ sk_sp<GrTexture> GrGLGpu::onCreateCompressedTexture(SkISize dimensions,
|
||||
// Unbind this texture from the scratch texture unit.
|
||||
this->bindTextureToScratchUnit(GR_GL_TEXTURE_2D, 0);
|
||||
|
||||
GrMipmapStatus mipmapStatus = mipMapped == GrMipmapped::kYes
|
||||
GrMipmapStatus mipmapStatus = mipmapped == GrMipmapped::kYes
|
||||
? GrMipmapStatus::kValid
|
||||
: GrMipmapStatus::kNotAllocated;
|
||||
|
||||
@ -1538,7 +1538,7 @@ sk_sp<GrTexture> GrGLGpu::onCreateCompressedTexture(SkISize dimensions,
|
||||
}
|
||||
|
||||
GrBackendTexture GrGLGpu::onCreateCompressedBackendTexture(
|
||||
SkISize dimensions, const GrBackendFormat& format, GrMipmapped mipMapped,
|
||||
SkISize dimensions, const GrBackendFormat& format, GrMipmapped mipmapped,
|
||||
GrProtected isProtected) {
|
||||
// We don't support protected textures in GL.
|
||||
if (isProtected == GrProtected::kYes) {
|
||||
@ -1560,7 +1560,7 @@ GrBackendTexture GrGLGpu::onCreateCompressedBackendTexture(
|
||||
info.fTarget = GR_GL_TEXTURE_2D;
|
||||
info.fFormat = GrGLFormatToEnum(glFormat);
|
||||
info.fID = this->createCompressedTexture2D(dimensions, compression, glFormat,
|
||||
mipMapped, &initialState);
|
||||
mipmapped, &initialState);
|
||||
if (!info.fID) {
|
||||
return {};
|
||||
}
|
||||
@ -1573,7 +1573,7 @@ GrBackendTexture GrGLGpu::onCreateCompressedBackendTexture(
|
||||
parameters->set(&initialState, GrGLTextureParameters::NonsamplerState(),
|
||||
fResetTimestampForTextureParameters);
|
||||
|
||||
return GrBackendTexture(dimensions.width(), dimensions.height(), mipMapped, info,
|
||||
return GrBackendTexture(dimensions.width(), dimensions.height(), mipmapped, info,
|
||||
std::move(parameters));
|
||||
}
|
||||
|
||||
@ -1591,7 +1591,7 @@ bool GrGLGpu::onUpdateCompressedBackendTexture(const GrBackendTexture& backendTe
|
||||
}
|
||||
SkImage::CompressionType compression = GrBackendFormatToCompressionType(format);
|
||||
|
||||
GrMipmapped mipMapped = backendTexture.hasMipmaps() ? GrMipmapped::kYes : GrMipmapped::kNo;
|
||||
GrMipmapped mipmapped = backendTexture.hasMipmaps() ? GrMipmapped::kYes : GrMipmapped::kNo;
|
||||
|
||||
this->bindTextureToScratchUnit(info.fTarget, info.fID);
|
||||
|
||||
@ -1616,7 +1616,7 @@ bool GrGLGpu::onUpdateCompressedBackendTexture(const GrBackendTexture& backendTe
|
||||
bool result = this->uploadCompressedTexData(compression,
|
||||
glFormat,
|
||||
backendTexture.dimensions(),
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
GR_GL_TEXTURE_2D,
|
||||
data,
|
||||
length);
|
||||
@ -1714,7 +1714,7 @@ GrGLuint GrGLGpu::createCompressedTexture2D(
|
||||
SkISize dimensions,
|
||||
SkImage::CompressionType compression,
|
||||
GrGLFormat format,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrGLTextureParameters::SamplerOverriddenState* initialState) {
|
||||
if (format == GrGLFormat::kUnknown) {
|
||||
return 0;
|
||||
@ -3672,7 +3672,7 @@ void GrGLGpu::insertManualFramebufferBarrier() {
|
||||
GrBackendTexture GrGLGpu::onCreateBackendTexture(SkISize dimensions,
|
||||
const GrBackendFormat& format,
|
||||
GrRenderable renderable,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrProtected isProtected) {
|
||||
this->handleDirtyContext();
|
||||
|
||||
@ -3682,7 +3682,7 @@ GrBackendTexture GrGLGpu::onCreateBackendTexture(SkISize dimensions,
|
||||
}
|
||||
|
||||
int numMipLevels = 1;
|
||||
if (mipMapped == GrMipmapped::kYes) {
|
||||
if (mipmapped == GrMipmapped::kYes) {
|
||||
numMipLevels = SkMipmap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1;
|
||||
}
|
||||
|
||||
@ -3703,7 +3703,7 @@ GrBackendTexture GrGLGpu::onCreateBackendTexture(SkISize dimensions,
|
||||
info.fTarget = GR_GL_TEXTURE_2D;
|
||||
break;
|
||||
case GrTextureType::kRectangle:
|
||||
if (!this->glCaps().rectangleTextureSupport() || mipMapped == GrMipmapped::kYes) {
|
||||
if (!this->glCaps().rectangleTextureSupport() || mipmapped == GrMipmapped::kYes) {
|
||||
return {};
|
||||
}
|
||||
info.fTarget = GR_GL_TEXTURE_RECTANGLE;
|
||||
@ -3724,7 +3724,7 @@ GrBackendTexture GrGLGpu::onCreateBackendTexture(SkISize dimensions,
|
||||
parameters->set(&initialState, GrGLTextureParameters::NonsamplerState(),
|
||||
fResetTimestampForTextureParameters);
|
||||
|
||||
return GrBackendTexture(dimensions.width(), dimensions.height(), mipMapped, info,
|
||||
return GrBackendTexture(dimensions.width(), dimensions.height(), mipmapped, info,
|
||||
std::move(parameters));
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ sk_sp<GrTexture> GrMockGpu::onCreateTexture(SkISize dimensions,
|
||||
sk_sp<GrTexture> GrMockGpu::onCreateCompressedTexture(SkISize dimensions,
|
||||
const GrBackendFormat& format,
|
||||
SkBudgeted budgeted,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrProtected isProtected,
|
||||
const void* data, size_t dataSize) {
|
||||
if (fMockOptions.fFailTextureAllocations) {
|
||||
@ -142,7 +142,7 @@ sk_sp<GrTexture> GrMockGpu::onCreateCompressedTexture(SkISize dimensions,
|
||||
SkASSERT(compression != SkImage::CompressionType::kNone);
|
||||
#endif
|
||||
|
||||
GrMipmapStatus mipmapStatus = (mipMapped == GrMipmapped::kYes)
|
||||
GrMipmapStatus mipmapStatus = (mipmapped == GrMipmapped::kYes)
|
||||
? GrMipmapStatus::kValid
|
||||
: GrMipmapStatus::kNotAllocated;
|
||||
GrMockTextureInfo texInfo(GrColorType::kUnknown,
|
||||
@ -237,7 +237,7 @@ sk_sp<GrAttachment> GrMockGpu::makeStencilAttachment(const GrBackendFormat& /*co
|
||||
GrBackendTexture GrMockGpu::onCreateBackendTexture(SkISize dimensions,
|
||||
const GrBackendFormat& format,
|
||||
GrRenderable,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrProtected) {
|
||||
SkImage::CompressionType compression = format.asMockCompressionType();
|
||||
if (compression != SkImage::CompressionType::kNone) {
|
||||
@ -252,11 +252,11 @@ GrBackendTexture GrMockGpu::onCreateBackendTexture(SkISize dimensions,
|
||||
GrMockTextureInfo info(colorType, SkImage::CompressionType::kNone, NextExternalTextureID());
|
||||
|
||||
fOutstandingTestingOnlyTextureIDs.add(info.id());
|
||||
return GrBackendTexture(dimensions.width(), dimensions.height(), mipMapped, info);
|
||||
return GrBackendTexture(dimensions.width(), dimensions.height(), mipmapped, info);
|
||||
}
|
||||
|
||||
GrBackendTexture GrMockGpu::onCreateCompressedBackendTexture(
|
||||
SkISize dimensions, const GrBackendFormat& format, GrMipmapped mipMapped,
|
||||
SkISize dimensions, const GrBackendFormat& format, GrMipmapped mipmapped,
|
||||
GrProtected) {
|
||||
SkImage::CompressionType compression = format.asMockCompressionType();
|
||||
if (compression == SkImage::CompressionType::kNone) {
|
||||
@ -270,7 +270,7 @@ GrBackendTexture GrMockGpu::onCreateCompressedBackendTexture(
|
||||
GrMockTextureInfo info(GrColorType::kUnknown, compression, NextExternalTextureID());
|
||||
|
||||
fOutstandingTestingOnlyTextureIDs.add(info.id());
|
||||
return GrBackendTexture(dimensions.width(), dimensions.height(), mipMapped, info);
|
||||
return GrBackendTexture(dimensions.width(), dimensions.height(), mipmapped, info);
|
||||
}
|
||||
|
||||
void GrMockGpu::deleteBackendTexture(const GrBackendTexture& tex) {
|
||||
|
@ -585,7 +585,7 @@ sk_sp<GrTexture> GrMtlGpu::onCreateTexture(SkISize dimensions,
|
||||
sk_sp<GrTexture> GrMtlGpu::onCreateCompressedTexture(SkISize dimensions,
|
||||
const GrBackendFormat& format,
|
||||
SkBudgeted budgeted,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrProtected isProtected,
|
||||
const void* data, size_t dataSize) {
|
||||
// We don't support protected textures in Metal.
|
||||
@ -604,11 +604,11 @@ sk_sp<GrTexture> GrMtlGpu::onCreateCompressedTexture(SkISize dimensions,
|
||||
SkASSERT(this->caps()->isFormatCompressed(format));
|
||||
|
||||
int numMipLevels = 1;
|
||||
if (mipMapped == GrMipmapped::kYes) {
|
||||
if (mipmapped == GrMipmapped::kYes) {
|
||||
numMipLevels = SkMipmap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1;
|
||||
}
|
||||
|
||||
GrMipmapStatus mipmapStatus = (mipMapped == GrMipmapped::kYes)
|
||||
GrMipmapStatus mipmapStatus = (mipmapped == GrMipmapped::kYes)
|
||||
? GrMipmapStatus::kValid
|
||||
: GrMipmapStatus::kNotAllocated;
|
||||
|
||||
@ -628,7 +628,7 @@ sk_sp<GrTexture> GrMtlGpu::onCreateCompressedTexture(SkISize dimensions,
|
||||
SkTArray<size_t> individualMipOffsets(numMipLevels);
|
||||
SkDEBUGCODE(size_t combinedBufferSize =) SkCompressedDataSize(compressionType, dimensions,
|
||||
&individualMipOffsets,
|
||||
mipMapped == GrMipmapped::kYes);
|
||||
mipmapped == GrMipmapped::kYes);
|
||||
SkASSERT(individualMipOffsets.count() == numMipLevels);
|
||||
SkASSERT(dataSize == combinedBufferSize);
|
||||
|
||||
@ -865,7 +865,7 @@ bool GrMtlGpu::createMtlTextureForBackendSurface(MTLPixelFormat mtlFormat,
|
||||
int sampleCnt,
|
||||
GrTexturable texturable,
|
||||
GrRenderable renderable,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrMtlTextureInfo* info) {
|
||||
SkASSERT(texturable == GrTexturable::kYes || renderable == GrRenderable::kYes);
|
||||
|
||||
@ -884,7 +884,7 @@ bool GrMtlGpu::createMtlTextureForBackendSurface(MTLPixelFormat mtlFormat,
|
||||
desc.pixelFormat = mtlFormat;
|
||||
desc.width = dimensions.width();
|
||||
desc.height = dimensions.height();
|
||||
if (mipMapped == GrMipmapped::kYes) {
|
||||
if (mipmapped == GrMipmapped::kYes) {
|
||||
desc.mipmapLevelCount = 1 + SkPrevLog2(std::max(dimensions.width(), dimensions.height()));
|
||||
}
|
||||
if (@available(macOS 10.11, iOS 9.0, *)) {
|
||||
@ -908,17 +908,17 @@ bool GrMtlGpu::createMtlTextureForBackendSurface(MTLPixelFormat mtlFormat,
|
||||
GrBackendTexture GrMtlGpu::onCreateBackendTexture(SkISize dimensions,
|
||||
const GrBackendFormat& format,
|
||||
GrRenderable renderable,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrProtected isProtected) {
|
||||
const MTLPixelFormat mtlFormat = GrBackendFormatAsMTLPixelFormat(format);
|
||||
|
||||
GrMtlTextureInfo info;
|
||||
if (!this->createMtlTextureForBackendSurface(mtlFormat, dimensions, 1, GrTexturable::kYes,
|
||||
renderable, mipMapped, &info)) {
|
||||
renderable, mipmapped, &info)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
GrBackendTexture backendTex(dimensions.width(), dimensions.height(), mipMapped, info);
|
||||
GrBackendTexture backendTex(dimensions.width(), dimensions.height(), mipmapped, info);
|
||||
return backendTex;
|
||||
}
|
||||
|
||||
@ -1011,17 +1011,17 @@ bool GrMtlGpu::onClearBackendTexture(const GrBackendTexture& backendTexture,
|
||||
}
|
||||
|
||||
GrBackendTexture GrMtlGpu::onCreateCompressedBackendTexture(
|
||||
SkISize dimensions, const GrBackendFormat& format, GrMipmapped mipMapped,
|
||||
SkISize dimensions, const GrBackendFormat& format, GrMipmapped mipmapped,
|
||||
GrProtected isProtected) {
|
||||
const MTLPixelFormat mtlFormat = GrBackendFormatAsMTLPixelFormat(format);
|
||||
|
||||
GrMtlTextureInfo info;
|
||||
if (!this->createMtlTextureForBackendSurface(mtlFormat, dimensions, 1, GrTexturable::kYes,
|
||||
GrRenderable::kNo, mipMapped, &info)) {
|
||||
GrRenderable::kNo, mipmapped, &info)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return GrBackendTexture(dimensions.width(), dimensions.height(), mipMapped, info);
|
||||
return GrBackendTexture(dimensions.width(), dimensions.height(), mipmapped, info);
|
||||
}
|
||||
|
||||
bool GrMtlGpu::onUpdateCompressedBackendTexture(const GrBackendTexture& backendTexture,
|
||||
@ -1034,7 +1034,7 @@ bool GrMtlGpu::onUpdateCompressedBackendTexture(const GrBackendTexture& backendT
|
||||
id<MTLTexture> mtlTexture = GrGetMTLTexture(info.fTexture.get());
|
||||
|
||||
int numMipLevels = mtlTexture.mipmapLevelCount;
|
||||
GrMipmapped mipMapped = numMipLevels > 1 ? GrMipmapped::kYes : GrMipmapped::kNo;
|
||||
GrMipmapped mipmapped = numMipLevels > 1 ? GrMipmapped::kYes : GrMipmapped::kNo;
|
||||
|
||||
SkImage::CompressionType compression =
|
||||
GrBackendFormatToCompressionType(backendTexture.getBackendFormat());
|
||||
@ -1046,7 +1046,7 @@ bool GrMtlGpu::onUpdateCompressedBackendTexture(const GrBackendTexture& backendT
|
||||
combinedBufferSize = SkCompressedDataSize(compression,
|
||||
backendTexture.dimensions(),
|
||||
&individualMipOffsets,
|
||||
mipMapped == GrMipmapped::kYes);
|
||||
mipmapped == GrMipmapped::kYes);
|
||||
SkASSERT(individualMipOffsets.count() == numMipLevels);
|
||||
|
||||
size_t alignment = std::max(SkCompressedBlockSize(compression),
|
||||
|
@ -126,11 +126,11 @@ GrMtlGpu* GrMtlTexture::getMtlGpu() const {
|
||||
}
|
||||
|
||||
GrBackendTexture GrMtlTexture::getBackendTexture() const {
|
||||
GrMipmapped mipMapped = fTexture->mtlTexture().mipmapLevelCount > 1 ? GrMipmapped::kYes
|
||||
GrMipmapped mipmapped = fTexture->mtlTexture().mipmapLevelCount > 1 ? GrMipmapped::kYes
|
||||
: GrMipmapped::kNo;
|
||||
GrMtlTextureInfo info;
|
||||
info.fTexture.reset(GrRetainPtrFromId(fTexture->mtlTexture()));
|
||||
return GrBackendTexture(this->width(), this->height(), mipMapped, info);
|
||||
return GrBackendTexture(this->width(), this->height(), mipmapped, info);
|
||||
}
|
||||
|
||||
GrBackendFormat GrMtlTexture::backendFormat() const {
|
||||
|
@ -1393,9 +1393,9 @@ GR_DRAW_OP_TEST_DEFINE(TextureOpImpl) {
|
||||
dims.fHeight = random->nextULessThan(90) + 10;
|
||||
dims.fWidth = random->nextULessThan(90) + 10;
|
||||
auto origin = random->nextBool() ? kTopLeft_GrSurfaceOrigin : kBottomLeft_GrSurfaceOrigin;
|
||||
GrMipmapped mipMapped = random->nextBool() ? GrMipmapped::kYes : GrMipmapped::kNo;
|
||||
GrMipmapped mipmapped = random->nextBool() ? GrMipmapped::kYes : GrMipmapped::kNo;
|
||||
SkBackingFit fit = SkBackingFit::kExact;
|
||||
if (mipMapped == GrMipmapped::kNo) {
|
||||
if (mipmapped == GrMipmapped::kNo) {
|
||||
fit = random->nextBool() ? SkBackingFit::kApprox : SkBackingFit::kExact;
|
||||
}
|
||||
const GrBackendFormat format =
|
||||
@ -1403,7 +1403,7 @@ GR_DRAW_OP_TEST_DEFINE(TextureOpImpl) {
|
||||
GrRenderable::kNo);
|
||||
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
|
||||
sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
|
||||
format, dims, GrRenderable::kNo, 1, mipMapped, fit, SkBudgeted::kNo, GrProtected::kNo,
|
||||
format, dims, GrRenderable::kNo, 1, mipmapped, fit, SkBudgeted::kNo, GrProtected::kNo,
|
||||
GrInternalSurfaceFlags::kNone);
|
||||
|
||||
SkRect rect = GrTest::TestRect(random);
|
||||
@ -1417,7 +1417,7 @@ GR_DRAW_OP_TEST_DEFINE(TextureOpImpl) {
|
||||
GrSamplerState::Filter filter = (GrSamplerState::Filter)random->nextULessThan(
|
||||
static_cast<uint32_t>(GrSamplerState::Filter::kLast) + 1);
|
||||
GrSamplerState::MipmapMode mm = GrSamplerState::MipmapMode::kNone;
|
||||
if (mipMapped == GrMipmapped::kYes) {
|
||||
if (mipmapped == GrMipmapped::kYes) {
|
||||
mm = (GrSamplerState::MipmapMode)random->nextULessThan(
|
||||
static_cast<uint32_t>(GrSamplerState::MipmapMode::kLast) + 1);
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ sk_sp<BaseDevice> Device::Make(GrRecordingContext* rContext,
|
||||
const SkImageInfo& ii,
|
||||
SkBackingFit fit,
|
||||
int sampleCount,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrProtected isProtected,
|
||||
GrSurfaceOrigin origin,
|
||||
const SkSurfaceProps& props,
|
||||
@ -173,7 +173,7 @@ sk_sp<BaseDevice> Device::Make(GrRecordingContext* rContext,
|
||||
ii.dimensions(),
|
||||
props,
|
||||
sampleCount,
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
isProtected,
|
||||
origin,
|
||||
budgeted);
|
||||
|
@ -160,7 +160,7 @@ std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::Make(
|
||||
SkISize dimensions,
|
||||
const GrBackendFormat& format,
|
||||
int sampleCnt,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrProtected isProtected,
|
||||
skgpu::Swizzle readSwizzle,
|
||||
skgpu::Swizzle writeSwizzle,
|
||||
@ -180,7 +180,7 @@ std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::Make(
|
||||
dimensions,
|
||||
GrRenderable::kYes,
|
||||
sampleCnt,
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
fit,
|
||||
budgeted,
|
||||
isProtected);
|
||||
@ -209,7 +209,7 @@ std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::Make(
|
||||
SkISize dimensions,
|
||||
const SkSurfaceProps& surfaceProps,
|
||||
int sampleCnt,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrProtected isProtected,
|
||||
GrSurfaceOrigin origin,
|
||||
SkBudgeted budgeted) {
|
||||
@ -225,7 +225,7 @@ std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::Make(
|
||||
dimensions,
|
||||
GrRenderable::kYes,
|
||||
sampleCnt,
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
fit,
|
||||
budgeted,
|
||||
isProtected);
|
||||
@ -249,7 +249,7 @@ std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::MakeWithFallback(
|
||||
SkISize dimensions,
|
||||
const SkSurfaceProps& surfaceProps,
|
||||
int sampleCnt,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrProtected isProtected,
|
||||
GrSurfaceOrigin origin,
|
||||
SkBudgeted budgeted) {
|
||||
@ -259,7 +259,7 @@ std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::MakeWithFallback(
|
||||
return nullptr;
|
||||
}
|
||||
return SurfaceDrawContext::Make(rContext, ct, colorSpace, fit, dimensions, surfaceProps,
|
||||
sampleCnt, mipMapped, isProtected, origin, budgeted);
|
||||
sampleCnt, mipmapped, isProtected, origin, budgeted);
|
||||
}
|
||||
|
||||
std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::MakeFromBackendTexture(
|
||||
|
@ -969,7 +969,7 @@ bool GrVkGpu::uploadTexDataOptimal(GrVkImage* texImage,
|
||||
// but for now it's easier to maintain as a separate entity.
|
||||
bool GrVkGpu::uploadTexDataCompressed(GrVkImage* uploadTexture,
|
||||
SkImage::CompressionType compression, VkFormat vkFormat,
|
||||
SkISize dimensions, GrMipmapped mipMapped,
|
||||
SkISize dimensions, GrMipmapped mipmapped,
|
||||
const void* data, size_t dataSize) {
|
||||
if (!this->currentCommandBuffer()) {
|
||||
return false;
|
||||
@ -999,7 +999,7 @@ bool GrVkGpu::uploadTexDataCompressed(GrVkImage* uploadTexture,
|
||||
compression,
|
||||
vkFormat,
|
||||
dimensions,
|
||||
mipMapped);
|
||||
mipmapped);
|
||||
if (!slice.fBuffer) {
|
||||
return false;
|
||||
}
|
||||
@ -1102,7 +1102,7 @@ sk_sp<GrTexture> GrVkGpu::onCreateTexture(SkISize dimensions,
|
||||
sk_sp<GrTexture> GrVkGpu::onCreateCompressedTexture(SkISize dimensions,
|
||||
const GrBackendFormat& format,
|
||||
SkBudgeted budgeted,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrProtected isProtected,
|
||||
const void* data, size_t dataSize) {
|
||||
VkFormat pixelFormat;
|
||||
@ -1110,11 +1110,11 @@ sk_sp<GrTexture> GrVkGpu::onCreateCompressedTexture(SkISize dimensions,
|
||||
SkASSERT(GrVkFormatIsCompressed(pixelFormat));
|
||||
|
||||
int numMipLevels = 1;
|
||||
if (mipMapped == GrMipmapped::kYes) {
|
||||
if (mipmapped == GrMipmapped::kYes) {
|
||||
numMipLevels = SkMipmap::ComputeLevelCount(dimensions.width(), dimensions.height())+1;
|
||||
}
|
||||
|
||||
GrMipmapStatus mipmapStatus = (mipMapped == GrMipmapped::kYes) ? GrMipmapStatus::kValid
|
||||
GrMipmapStatus mipmapStatus = (mipmapped == GrMipmapped::kYes) ? GrMipmapStatus::kValid
|
||||
: GrMipmapStatus::kNotAllocated;
|
||||
|
||||
auto tex = GrVkTexture::MakeNewTexture(this, budgeted, dimensions, pixelFormat,
|
||||
@ -1125,7 +1125,7 @@ sk_sp<GrTexture> GrVkGpu::onCreateCompressedTexture(SkISize dimensions,
|
||||
|
||||
SkImage::CompressionType compression = GrBackendFormatToCompressionType(format);
|
||||
if (!this->uploadTexDataCompressed(tex->textureImage(), compression, pixelFormat,
|
||||
dimensions, mipMapped, data, dataSize)) {
|
||||
dimensions, mipmapped, data, dataSize)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -1540,7 +1540,7 @@ bool GrVkGpu::createVkImageForBackendSurface(VkFormat vkFormat,
|
||||
int sampleCnt,
|
||||
GrTexturable texturable,
|
||||
GrRenderable renderable,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrVkImageInfo* info,
|
||||
GrProtected isProtected) {
|
||||
SkASSERT(texturable == GrTexturable::kYes || renderable == GrRenderable::kYes);
|
||||
@ -1567,7 +1567,7 @@ bool GrVkGpu::createVkImageForBackendSurface(VkFormat vkFormat,
|
||||
|
||||
|
||||
int numMipLevels = 1;
|
||||
if (mipMapped == GrMipmapped::kYes) {
|
||||
if (mipmapped == GrMipmapped::kYes) {
|
||||
numMipLevels = SkMipmap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1;
|
||||
}
|
||||
|
||||
@ -1663,7 +1663,7 @@ bool GrVkGpu::onClearBackendTexture(const GrBackendTexture& backendTexture,
|
||||
GrBackendTexture GrVkGpu::onCreateBackendTexture(SkISize dimensions,
|
||||
const GrBackendFormat& format,
|
||||
GrRenderable renderable,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrProtected isProtected) {
|
||||
const GrVkCaps& caps = this->vkCaps();
|
||||
|
||||
@ -1687,7 +1687,7 @@ GrBackendTexture GrVkGpu::onCreateBackendTexture(SkISize dimensions,
|
||||
|
||||
GrVkImageInfo info;
|
||||
if (!this->createVkImageForBackendSurface(vkFormat, dimensions, 1, GrTexturable::kYes,
|
||||
renderable, mipMapped, &info, isProtected)) {
|
||||
renderable, mipmapped, &info, isProtected)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -1695,9 +1695,9 @@ GrBackendTexture GrVkGpu::onCreateBackendTexture(SkISize dimensions,
|
||||
}
|
||||
|
||||
GrBackendTexture GrVkGpu::onCreateCompressedBackendTexture(
|
||||
SkISize dimensions, const GrBackendFormat& format, GrMipmapped mipMapped,
|
||||
SkISize dimensions, const GrBackendFormat& format, GrMipmapped mipmapped,
|
||||
GrProtected isProtected) {
|
||||
return this->onCreateBackendTexture(dimensions, format, GrRenderable::kNo, mipMapped,
|
||||
return this->onCreateBackendTexture(dimensions, format, GrRenderable::kNo, mipmapped,
|
||||
isProtected);
|
||||
}
|
||||
|
||||
|
@ -365,7 +365,7 @@ private:
|
||||
const GrMipLevel texels[],
|
||||
int mipLevelCount);
|
||||
bool uploadTexDataCompressed(GrVkImage* tex, SkImage::CompressionType compression,
|
||||
VkFormat vkFormat, SkISize dimensions, GrMipmapped mipMapped,
|
||||
VkFormat vkFormat, SkISize dimensions, GrMipmapped mipmapped,
|
||||
const void* data, size_t dataSize);
|
||||
void resolveImage(GrSurface* dst, GrVkRenderTarget* src, const SkIRect& srcRect,
|
||||
const SkIPoint& dstPoint);
|
||||
|
@ -79,7 +79,7 @@ public:
|
||||
// the same swizzle as the src view.
|
||||
static TextureProxyView Copy(Recorder* recorder,
|
||||
TextureProxyView src,
|
||||
Mipmapped mipMapped,
|
||||
Mipmapped mipmapped,
|
||||
SkIRect srcRect,
|
||||
SkBackingFit fit,
|
||||
SkBudgeted budgeted) {
|
||||
@ -89,10 +89,10 @@ public:
|
||||
|
||||
static TextureProxyView Copy(Recorder* recorder,
|
||||
TextureProxyView src,
|
||||
Mipmapped mipMapped,
|
||||
Mipmapped mipmapped,
|
||||
SkBackingFit fit,
|
||||
SkBudgeted budgeted) {
|
||||
return TextureProxyView::Copy(recorder, src, mipMapped,
|
||||
return TextureProxyView::Copy(recorder, src, mipmapped,
|
||||
SkIRect::MakeSize(src.proxy()->dimensions()),
|
||||
fit, budgeted);
|
||||
}
|
||||
|
@ -515,7 +515,7 @@ sk_sp<SkImage> SkImage::MakeFromAdoptedTexture(GrRecordingContext* rContext,
|
||||
|
||||
sk_sp<SkImage> SkImage::MakeTextureFromCompressed(GrDirectContext* direct, sk_sp<SkData> data,
|
||||
int width, int height, CompressionType type,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrProtected isProtected) {
|
||||
if (!direct || !data) {
|
||||
return nullptr;
|
||||
@ -527,12 +527,12 @@ sk_sp<SkImage> SkImage::MakeTextureFromCompressed(GrDirectContext* direct, sk_sp
|
||||
if (!tmp) {
|
||||
return nullptr;
|
||||
}
|
||||
return tmp->makeTextureImage(direct, mipMapped);
|
||||
return tmp->makeTextureImage(direct, mipmapped);
|
||||
}
|
||||
|
||||
GrProxyProvider* proxyProvider = direct->priv().proxyProvider();
|
||||
sk_sp<GrTextureProxy> proxy = proxyProvider->createCompressedTextureProxy(
|
||||
{width, height}, SkBudgeted::kYes, mipMapped, isProtected, type, std::move(data));
|
||||
{width, height}, SkBudgeted::kYes, mipmapped, isProtected, type, std::move(data));
|
||||
if (!proxy) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -588,7 +588,7 @@ sk_sp<SkImage> SkImage::makeTextureImage(GrDirectContext* dContext,
|
||||
sk_sp<SkImage> SkImage::MakePromiseTexture(sk_sp<GrContextThreadSafeProxy> threadSafeProxy,
|
||||
const GrBackendFormat& backendFormat,
|
||||
SkISize dimensions,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrSurfaceOrigin origin,
|
||||
SkColorType colorType,
|
||||
SkAlphaType alphaType,
|
||||
@ -626,7 +626,7 @@ sk_sp<SkImage> SkImage::MakePromiseTexture(sk_sp<GrContextThreadSafeProxy> threa
|
||||
auto proxy = SkImage_GpuBase::MakePromiseImageLazyProxy(threadSafeProxy.get(),
|
||||
dimensions,
|
||||
backendFormat,
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
textureFulfillProc,
|
||||
std::move(releaseHelper));
|
||||
if (!proxy) {
|
||||
|
@ -198,7 +198,7 @@ sk_sp<GrTextureProxy> SkImage_GpuBase::MakePromiseImageLazyProxy(
|
||||
GrContextThreadSafeProxy* tsp,
|
||||
SkISize dimensions,
|
||||
GrBackendFormat backendFormat,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
PromiseImageTextureFulfillProc fulfillProc,
|
||||
sk_sp<skgpu::RefCntedCallback> releaseHelper) {
|
||||
SkASSERT(tsp);
|
||||
@ -209,7 +209,7 @@ sk_sp<GrTextureProxy> SkImage_GpuBase::MakePromiseImageLazyProxy(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (mipMapped == GrMipmapped::kYes &&
|
||||
if (mipmapped == GrMipmapped::kYes &&
|
||||
GrTextureTypeHasRestrictedSampling(backendFormat.textureType())) {
|
||||
// It is invalid to have a GL_TEXTURE_EXTERNAL or GL_TEXTURE_RECTANGLE and have mips as
|
||||
// well.
|
||||
@ -325,5 +325,5 @@ sk_sp<GrTextureProxy> SkImage_GpuBase::MakePromiseImageLazyProxy(
|
||||
} callback(fulfillProc, std::move(releaseHelper));
|
||||
|
||||
return GrProxyProvider::CreatePromiseProxy(tsp, std::move(callback), backendFormat, dimensions,
|
||||
mipMapped);
|
||||
mipmapped);
|
||||
}
|
||||
|
@ -462,14 +462,14 @@ sk_sp<SkSurface> SkSurface::MakeRenderTarget(GrRecordingContext* rContext, SkBud
|
||||
return nullptr;
|
||||
}
|
||||
sampleCount = std::max(1, sampleCount);
|
||||
GrMipmapped mipMapped = shouldCreateWithMips ? GrMipmapped::kYes : GrMipmapped::kNo;
|
||||
GrMipmapped mipmapped = shouldCreateWithMips ? GrMipmapped::kYes : GrMipmapped::kNo;
|
||||
|
||||
if (!rContext->priv().caps()->mipmapSupport()) {
|
||||
mipMapped = GrMipmapped::kNo;
|
||||
mipmapped = GrMipmapped::kNo;
|
||||
}
|
||||
|
||||
auto device = rContext->priv().createDevice(budgeted, info, SkBackingFit::kExact,
|
||||
sampleCount, mipMapped, GrProtected::kNo, origin,
|
||||
sampleCount, mipmapped, GrProtected::kNo, origin,
|
||||
SkSurfacePropsCopyOrDefault(props),
|
||||
skgpu::BaseDevice::InitContents::kClear);
|
||||
if (!device) {
|
||||
|
@ -43,13 +43,13 @@ void test_wrapping(GrDirectContext* dContext,
|
||||
GrMipmapped,
|
||||
GrRenderable)> create,
|
||||
GrColorType grColorType,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrRenderable renderable) {
|
||||
GrResourceCache* cache = dContext->priv().getResourceCache();
|
||||
|
||||
const int initialCount = cache->getResourceCount();
|
||||
|
||||
sk_sp<ManagedBackendTexture> mbet = create(dContext, mipMapped, renderable);
|
||||
sk_sp<ManagedBackendTexture> mbet = create(dContext, mipmapped, renderable);
|
||||
if (!mbet) {
|
||||
ERRORF(reporter, "Couldn't create backendTexture for grColorType %d renderable %s\n",
|
||||
(int)grColorType,
|
||||
@ -108,9 +108,9 @@ void test_wrapping(GrDirectContext* dContext,
|
||||
GrTextureProxy* proxy = sk_gpu_test::GetTextureImageProxy(img.get(), dContext);
|
||||
REPORTER_ASSERT(reporter, proxy);
|
||||
|
||||
REPORTER_ASSERT(reporter, mipMapped == proxy->proxyMipmapped());
|
||||
REPORTER_ASSERT(reporter, mipmapped == proxy->proxyMipmapped());
|
||||
REPORTER_ASSERT(reporter, proxy->isInstantiated());
|
||||
REPORTER_ASSERT(reporter, mipMapped == proxy->mipmapped());
|
||||
REPORTER_ASSERT(reporter, mipmapped == proxy->mipmapped());
|
||||
|
||||
REPORTER_ASSERT(reporter,
|
||||
initialCount + cacheEntriesPerProxy == cache->getResourceCount());
|
||||
@ -820,8 +820,8 @@ DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(GLBackendAllocationTest, reporter, ctxInfo) {
|
||||
}
|
||||
}
|
||||
|
||||
for (auto mipMapped : {GrMipmapped::kNo, GrMipmapped::kYes}) {
|
||||
if (GrMipmapped::kYes == mipMapped &&
|
||||
for (auto mipmapped : {GrMipmapped::kNo, GrMipmapped::kYes}) {
|
||||
if (GrMipmapped::kYes == mipmapped &&
|
||||
(!glCaps->mipmapSupport() || target == GR_GL_TEXTURE_RECTANGLE)) {
|
||||
continue;
|
||||
}
|
||||
@ -835,18 +835,18 @@ DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(GLBackendAllocationTest, reporter, ctxInfo) {
|
||||
|
||||
{
|
||||
auto uninitCreateMtd = [format](GrDirectContext* dContext,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrRenderable renderable) {
|
||||
return ManagedBackendTexture::MakeWithoutData(dContext,
|
||||
32, 32,
|
||||
format,
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
renderable,
|
||||
GrProtected::kNo);
|
||||
};
|
||||
|
||||
test_wrapping(context, reporter, uninitCreateMtd, combo.fColorType,
|
||||
mipMapped, renderable);
|
||||
mipmapped, renderable);
|
||||
}
|
||||
|
||||
{
|
||||
@ -886,7 +886,7 @@ DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(GLBackendAllocationTest, reporter, ctxInfo) {
|
||||
GrProtected::kNo);
|
||||
};
|
||||
test_color_init(context, reporter, createWithColorMtd, combo.fColorType,
|
||||
combo.fColor, mipMapped, renderable);
|
||||
combo.fColor, mipmapped, renderable);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -960,8 +960,8 @@ DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkBackendAllocationTest, reporter, ctxInfo) {
|
||||
|
||||
GrBackendFormat format = GrBackendFormat::MakeVk(combo.fFormat);
|
||||
|
||||
for (auto mipMapped : { GrMipmapped::kNo, GrMipmapped::kYes }) {
|
||||
if (GrMipmapped::kYes == mipMapped && !vkCaps->mipmapSupport()) {
|
||||
for (auto mipmapped : { GrMipmapped::kNo, GrMipmapped::kYes }) {
|
||||
if (GrMipmapped::kYes == mipmapped && !vkCaps->mipmapSupport()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -978,19 +978,19 @@ DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkBackendAllocationTest, reporter, ctxInfo) {
|
||||
|
||||
{
|
||||
auto uninitCreateMtd = [format](GrDirectContext* dContext,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrRenderable renderable) {
|
||||
auto mbet = ManagedBackendTexture::MakeWithoutData(dContext,
|
||||
32, 32,
|
||||
format,
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
renderable,
|
||||
GrProtected::kNo);
|
||||
check_vk_tiling(mbet->texture());
|
||||
return mbet;
|
||||
};
|
||||
|
||||
test_wrapping(context, reporter, uninitCreateMtd, combo.fColorType, mipMapped,
|
||||
test_wrapping(context, reporter, uninitCreateMtd, combo.fColorType, mipmapped,
|
||||
renderable);
|
||||
}
|
||||
|
||||
@ -1029,21 +1029,21 @@ DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkBackendAllocationTest, reporter, ctxInfo) {
|
||||
|
||||
auto createWithColorMtd = [format, swizzle](GrDirectContext* dContext,
|
||||
const SkColor4f& color,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrRenderable renderable) {
|
||||
auto swizzledColor = swizzle.applyTo(color);
|
||||
auto mbet = ManagedBackendTexture::MakeWithData(dContext,
|
||||
32, 32,
|
||||
format,
|
||||
swizzledColor,
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
renderable,
|
||||
GrProtected::kNo);
|
||||
check_vk_tiling(mbet->texture());
|
||||
return mbet;
|
||||
};
|
||||
test_color_init(context, reporter, createWithColorMtd, combo.fColorType,
|
||||
combo.fColor, mipMapped, renderable);
|
||||
combo.fColor, mipmapped, renderable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ sk_sp<SkImage> create_image(GrDirectContext* dContext, const GrBackendTexture& b
|
||||
static void check_compressed_mipmaps(GrRecordingContext* rContext, sk_sp<SkImage> img,
|
||||
SkImage::CompressionType compressionType,
|
||||
const SkColor4f expectedColors[6],
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
skiatest::Reporter* reporter, const char* label) {
|
||||
|
||||
SkImageInfo readbackSurfaceII = SkImageInfo::Make(32, 32, kRGBA_8888_SkColorType,
|
||||
@ -82,7 +82,7 @@ static void check_compressed_mipmaps(GrRecordingContext* rContext, sk_sp<SkImage
|
||||
p.setBlendMode(SkBlendMode::kSrc);
|
||||
|
||||
int numMipLevels = 1;
|
||||
if (mipMapped == GrMipmapped::kYes) {
|
||||
if (mipmapped == GrMipmapped::kYes) {
|
||||
numMipLevels = SkMipmap::ComputeLevelCount(32, 32)+1;
|
||||
}
|
||||
|
||||
@ -148,8 +148,8 @@ static void test_compressed_color_init(GrDirectContext* dContext,
|
||||
GrMipmapped)> create,
|
||||
const SkColor4f& color,
|
||||
SkImage::CompressionType compression,
|
||||
GrMipmapped mipMapped) {
|
||||
GrBackendTexture backendTex = create(dContext, color, mipMapped);
|
||||
GrMipmapped mipmapped) {
|
||||
GrBackendTexture backendTex = create(dContext, color, mipmapped);
|
||||
if (!backendTex.isValid()) {
|
||||
return;
|
||||
}
|
||||
@ -161,7 +161,7 @@ static void test_compressed_color_init(GrDirectContext* dContext,
|
||||
|
||||
SkColor4f expectedColors[6] = { color, color, color, color, color, color };
|
||||
|
||||
check_compressed_mipmaps(dContext, img, compression, expectedColors, mipMapped,
|
||||
check_compressed_mipmaps(dContext, img, compression, expectedColors, mipmapped,
|
||||
reporter, "colorinit");
|
||||
check_readback(dContext, img, compression, color, reporter, "solid readback");
|
||||
|
||||
@ -177,7 +177,7 @@ static void test_compressed_color_init(GrDirectContext* dContext,
|
||||
|
||||
SkColor4f expectedNewColors[6] = {newColor, newColor, newColor, newColor, newColor, newColor};
|
||||
|
||||
check_compressed_mipmaps(dContext, img, compression, expectedNewColors, mipMapped, reporter,
|
||||
check_compressed_mipmaps(dContext, img, compression, expectedNewColors, mipmapped, reporter,
|
||||
"colorinit");
|
||||
check_readback(dContext, std::move(img), compression, newColor, reporter, "solid readback");
|
||||
|
||||
@ -187,18 +187,18 @@ static void test_compressed_color_init(GrDirectContext* dContext,
|
||||
// Create compressed data pulling the color for each mipmap level from 'levelColors'.
|
||||
static std::unique_ptr<const char[]> make_compressed_data(SkImage::CompressionType compression,
|
||||
SkColor4f levelColors[6],
|
||||
GrMipmapped mipMapped) {
|
||||
GrMipmapped mipmapped) {
|
||||
SkISize dimensions { 32, 32 };
|
||||
|
||||
int numMipLevels = 1;
|
||||
if (mipMapped == GrMipmapped::kYes) {
|
||||
if (mipmapped == GrMipmapped::kYes) {
|
||||
numMipLevels = SkMipmap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1;
|
||||
}
|
||||
|
||||
SkTArray<size_t> mipMapOffsets(numMipLevels);
|
||||
|
||||
size_t dataSize = SkCompressedDataSize(compression, dimensions, &mipMapOffsets,
|
||||
mipMapped == GrMipmapped::kYes);
|
||||
mipmapped == GrMipmapped::kYes);
|
||||
char* data = new char[dataSize];
|
||||
|
||||
for (int level = 0; level < numMipLevels; ++level) {
|
||||
@ -222,7 +222,7 @@ static void test_compressed_data_init(GrDirectContext* dContext,
|
||||
size_t dataSize,
|
||||
GrMipmapped)> create,
|
||||
SkImage::CompressionType compression,
|
||||
GrMipmapped mipMapped) {
|
||||
GrMipmapped mipmapped) {
|
||||
|
||||
SkColor4f expectedColors[6] = {
|
||||
{ 1.0f, 0.0f, 0.0f, 1.0f }, // R
|
||||
@ -234,11 +234,11 @@ static void test_compressed_data_init(GrDirectContext* dContext,
|
||||
};
|
||||
|
||||
std::unique_ptr<const char[]> data(make_compressed_data(compression, expectedColors,
|
||||
mipMapped));
|
||||
mipmapped));
|
||||
size_t dataSize = SkCompressedDataSize(compression, { 32, 32 }, nullptr,
|
||||
mipMapped == GrMipmapped::kYes);
|
||||
mipmapped == GrMipmapped::kYes);
|
||||
|
||||
GrBackendTexture backendTex = create(dContext, data.get(), dataSize, mipMapped);
|
||||
GrBackendTexture backendTex = create(dContext, data.get(), dataSize, mipmapped);
|
||||
if (!backendTex.isValid()) {
|
||||
return;
|
||||
}
|
||||
@ -249,7 +249,7 @@ static void test_compressed_data_init(GrDirectContext* dContext,
|
||||
}
|
||||
|
||||
check_compressed_mipmaps(dContext, img, compression, expectedColors,
|
||||
mipMapped, reporter, "pixmap");
|
||||
mipmapped, reporter, "pixmap");
|
||||
check_readback(dContext, img, compression, expectedColors[0], reporter, "data readback");
|
||||
|
||||
SkColor4f expectedColorsNew[6] = {
|
||||
@ -262,16 +262,16 @@ static void test_compressed_data_init(GrDirectContext* dContext,
|
||||
};
|
||||
|
||||
std::unique_ptr<const char[]> dataNew(
|
||||
make_compressed_data(compression, expectedColorsNew, mipMapped));
|
||||
make_compressed_data(compression, expectedColorsNew, mipmapped));
|
||||
size_t dataNewSize =
|
||||
SkCompressedDataSize(compression, {32, 32}, nullptr, mipMapped == GrMipmapped::kYes);
|
||||
SkCompressedDataSize(compression, {32, 32}, nullptr, mipmapped == GrMipmapped::kYes);
|
||||
|
||||
bool result = dContext->updateCompressedBackendTexture(backendTex, dataNew.get(), dataNewSize,
|
||||
nullptr, nullptr);
|
||||
// Since we were able to create the compressed texture we should be able to update it.
|
||||
REPORTER_ASSERT(reporter, result);
|
||||
|
||||
check_compressed_mipmaps(dContext, img, compression, expectedColorsNew, mipMapped, reporter,
|
||||
check_compressed_mipmaps(dContext, img, compression, expectedColorsNew, mipmapped, reporter,
|
||||
"pixmap");
|
||||
check_readback(dContext, std::move(img), compression, expectedColorsNew[0], reporter,
|
||||
"data readback");
|
||||
@ -302,8 +302,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(CompressedBackendAllocationTest, reporter, ct
|
||||
continue;
|
||||
}
|
||||
|
||||
for (auto mipMapped : { GrMipmapped::kNo, GrMipmapped::kYes }) {
|
||||
if (GrMipmapped::kYes == mipMapped && !caps->mipmapSupport()) {
|
||||
for (auto mipmapped : { GrMipmapped::kNo, GrMipmapped::kYes }) {
|
||||
if (GrMipmapped::kYes == mipmapped && !caps->mipmapSupport()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -311,26 +311,26 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(CompressedBackendAllocationTest, reporter, ct
|
||||
{
|
||||
auto createWithColorMtd = [format](GrDirectContext* dContext,
|
||||
const SkColor4f& color,
|
||||
GrMipmapped mipMapped) {
|
||||
GrMipmapped mipmapped) {
|
||||
return dContext->createCompressedBackendTexture(32, 32, format, color,
|
||||
mipMapped, GrProtected::kNo);
|
||||
mipmapped, GrProtected::kNo);
|
||||
};
|
||||
|
||||
test_compressed_color_init(dContext, reporter, createWithColorMtd,
|
||||
combo.fColor, combo.fCompression, mipMapped);
|
||||
combo.fColor, combo.fCompression, mipmapped);
|
||||
}
|
||||
|
||||
// data initialized
|
||||
{
|
||||
auto createWithDataMtd = [format](GrDirectContext* dContext,
|
||||
const char* data, size_t dataSize,
|
||||
GrMipmapped mipMapped) {
|
||||
GrMipmapped mipmapped) {
|
||||
return dContext->createCompressedBackendTexture(32, 32, format, data, dataSize,
|
||||
mipMapped, GrProtected::kNo);
|
||||
mipmapped, GrProtected::kNo);
|
||||
};
|
||||
|
||||
test_compressed_data_init(dContext, reporter, createWithDataMtd,
|
||||
combo.fCompression, mipMapped);
|
||||
combo.fCompression, mipmapped);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1185,14 +1185,14 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(DDLTextureFlagsTest, reporter, ctxInfo) {
|
||||
SkDeferredDisplayListRecorder recorder(characterization);
|
||||
|
||||
for (GrGLenum target : { GR_GL_TEXTURE_EXTERNAL, GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_2D } ) {
|
||||
for (auto mipMapped : { GrMipmapped::kNo, GrMipmapped::kYes }) {
|
||||
for (auto mipmapped : { GrMipmapped::kNo, GrMipmapped::kYes }) {
|
||||
GrBackendFormat format = GrBackendFormat::MakeGL(GR_GL_RGBA8, target);
|
||||
|
||||
sk_sp<SkImage> image = SkImage::MakePromiseTexture(
|
||||
recorder.getCanvas()->recordingContext()->threadSafeProxy(),
|
||||
format,
|
||||
SkISize::Make(32, 32),
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
kTopLeft_GrSurfaceOrigin,
|
||||
kRGBA_8888_SkColorType,
|
||||
kPremul_SkAlphaType,
|
||||
@ -1200,7 +1200,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(DDLTextureFlagsTest, reporter, ctxInfo) {
|
||||
noop_fulfill_proc,
|
||||
/*release proc*/ nullptr,
|
||||
/*context*/nullptr);
|
||||
if (GR_GL_TEXTURE_2D != target && mipMapped == GrMipmapped::kYes) {
|
||||
if (GR_GL_TEXTURE_2D != target && mipmapped == GrMipmapped::kYes) {
|
||||
REPORTER_ASSERT(reporter, !image);
|
||||
continue;
|
||||
}
|
||||
@ -1208,7 +1208,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(DDLTextureFlagsTest, reporter, ctxInfo) {
|
||||
|
||||
GrTextureProxy* backingProxy = sk_gpu_test::GetTextureImageProxy(image.get(), context);
|
||||
|
||||
REPORTER_ASSERT(reporter, backingProxy->mipmapped() == mipMapped);
|
||||
REPORTER_ASSERT(reporter, backingProxy->mipmapped() == mipmapped);
|
||||
if (GR_GL_TEXTURE_2D == target) {
|
||||
REPORTER_ASSERT(reporter, !backingProxy->hasRestrictedSampling());
|
||||
} else {
|
||||
|
@ -98,8 +98,8 @@ DEF_GPUTEST_FOR_METAL_CONTEXT(MtlBackendAllocationTest, reporter, ctxInfo) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (auto mipMapped : { GrMipmapped::kNo, GrMipmapped::kYes }) {
|
||||
if (GrMipmapped::kYes == mipMapped && !mtlCaps->mipmapSupport()) {
|
||||
for (auto mipmapped : { GrMipmapped::kNo, GrMipmapped::kYes }) {
|
||||
if (GrMipmapped::kYes == mipmapped && !mtlCaps->mipmapSupport()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -116,17 +116,17 @@ DEF_GPUTEST_FOR_METAL_CONTEXT(MtlBackendAllocationTest, reporter, ctxInfo) {
|
||||
|
||||
{
|
||||
auto uninitCreateMtd = [format](GrDirectContext* dContext,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrRenderable renderable) {
|
||||
return ManagedBackendTexture::MakeWithoutData(dContext,
|
||||
32, 32,
|
||||
format,
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
renderable,
|
||||
GrProtected::kNo);
|
||||
};
|
||||
|
||||
test_wrapping(dContext, reporter, uninitCreateMtd, combo.fColorType, mipMapped,
|
||||
test_wrapping(dContext, reporter, uninitCreateMtd, combo.fColorType, mipmapped,
|
||||
renderable);
|
||||
}
|
||||
|
||||
@ -156,19 +156,19 @@ DEF_GPUTEST_FOR_METAL_CONTEXT(MtlBackendAllocationTest, reporter, ctxInfo) {
|
||||
|
||||
auto createWithColorMtd = [format, swizzle](GrDirectContext* dContext,
|
||||
const SkColor4f& color,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrRenderable renderable) {
|
||||
auto swizzledColor = swizzle.applyTo(color);
|
||||
return ManagedBackendTexture::MakeWithData(dContext,
|
||||
32, 32,
|
||||
format,
|
||||
swizzledColor,
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
renderable,
|
||||
GrProtected::kNo);
|
||||
};
|
||||
test_color_init(dContext, reporter, createWithColorMtd, combo.fColorType,
|
||||
combo.fColor, mipMapped, renderable);
|
||||
combo.fColor, mipmapped, renderable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -247,13 +247,13 @@ bool GrDrawingManager::ProgramUnitTest(GrDirectContext* direct, int maxStages, i
|
||||
GrProcessorTestData::ViewInfo views[2];
|
||||
|
||||
// setup arbitrary textures
|
||||
GrMipmapped mipMapped = GrMipmapped(caps->mipmapSupport());
|
||||
GrMipmapped mipmapped = GrMipmapped(caps->mipmapSupport());
|
||||
{
|
||||
static constexpr SkISize kDims = {34, 18};
|
||||
const GrBackendFormat format = caps->getDefaultBackendFormat(GrColorType::kRGBA_8888,
|
||||
GrRenderable::kYes);
|
||||
auto proxy = proxyProvider->createProxy(format, kDims, GrRenderable::kYes, 1,
|
||||
mipMapped, SkBackingFit::kExact, SkBudgeted::kNo,
|
||||
mipmapped, SkBackingFit::kExact, SkBudgeted::kNo,
|
||||
GrProtected::kNo, GrInternalSurfaceFlags::kNone);
|
||||
skgpu::Swizzle swizzle = caps->getReadSwizzle(format, GrColorType::kRGBA_8888);
|
||||
views[0] = {{std::move(proxy), kBottomLeft_GrSurfaceOrigin, swizzle},
|
||||
@ -263,7 +263,7 @@ bool GrDrawingManager::ProgramUnitTest(GrDirectContext* direct, int maxStages, i
|
||||
static constexpr SkISize kDims = {16, 22};
|
||||
const GrBackendFormat format = caps->getDefaultBackendFormat(GrColorType::kAlpha_8,
|
||||
GrRenderable::kNo);
|
||||
auto proxy = proxyProvider->createProxy(format, kDims, GrRenderable::kNo, 1, mipMapped,
|
||||
auto proxy = proxyProvider->createProxy(format, kDims, GrRenderable::kNo, 1, mipmapped,
|
||||
SkBackingFit::kExact, SkBudgeted::kNo,
|
||||
GrProtected::kNo, GrInternalSurfaceFlags::kNone);
|
||||
skgpu::Swizzle swizzle = caps->getReadSwizzle(format, GrColorType::kAlpha_8);
|
||||
|
@ -357,7 +357,7 @@ sk_sp<SkImage> DDLPromiseImageHelper::CreatePromiseImages(const void* rawData,
|
||||
image = SkImage::MakePromiseTexture(procContext->fThreadSafeProxy,
|
||||
backendFormat,
|
||||
curImage.overallDimensions(),
|
||||
curImage.mipMapped(0),
|
||||
curImage.mipmapped(0),
|
||||
GrSurfaceOrigin::kTopLeft_GrSurfaceOrigin,
|
||||
curImage.overallColorType(),
|
||||
curImage.overallAlphaType(),
|
||||
|
@ -175,7 +175,7 @@ private:
|
||||
return fCallbackContexts[index];
|
||||
}
|
||||
|
||||
GrMipmapped mipMapped(int index) const {
|
||||
GrMipmapped mipmapped(int index) const {
|
||||
if (this->isYUV()) {
|
||||
return GrMipmapped::kNo;
|
||||
}
|
||||
|
@ -1324,7 +1324,7 @@ sk_sp<SkImage> makeSubset(const SkIRect& subset) const;
|
||||
|
||||
[Image_makeTextureImage]
|
||||
SkImage
|
||||
sk_sp<SkImage> makeTextureImage(GrContext* context, SkColorSpace* dstColorSpace, GrMipmapped mipMapped = GrMipmapped::kNo) const;
|
||||
sk_sp<SkImage> makeTextureImage(GrContext* context, SkColorSpace* dstColorSpace, GrMipmapped mipmapped = GrMipmapped::kNo) const;
|
||||
|
||||
[Image_makeWithFilter]
|
||||
SkImage
|
||||
|
@ -19,7 +19,7 @@ sk_sp<SkSurface> MakeBackendTextureSurface(GrDirectContext* dContext,
|
||||
const SkImageInfo& ii,
|
||||
GrSurfaceOrigin origin,
|
||||
int sampleCnt,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrProtected isProtected,
|
||||
const SkSurfaceProps* props) {
|
||||
if (ii.alphaType() == kUnpremul_SkAlphaType) {
|
||||
@ -29,7 +29,7 @@ sk_sp<SkSurface> MakeBackendTextureSurface(GrDirectContext* dContext,
|
||||
ii.width(),
|
||||
ii.height(),
|
||||
ii.colorType(),
|
||||
mipMapped,
|
||||
mipmapped,
|
||||
GrRenderable::kYes,
|
||||
isProtected);
|
||||
if (!mbet) {
|
||||
@ -52,12 +52,12 @@ sk_sp<SkSurface> MakeBackendTextureSurface(GrDirectContext* dContext,
|
||||
int sampleCnt,
|
||||
SkColorType colorType,
|
||||
sk_sp<SkColorSpace> colorSpace,
|
||||
GrMipmapped mipMapped,
|
||||
GrMipmapped mipmapped,
|
||||
GrProtected isProtected,
|
||||
const SkSurfaceProps* props) {
|
||||
auto ii = SkImageInfo::Make(dimensions, colorType, kPremul_SkAlphaType, std::move(colorSpace));
|
||||
return MakeBackendTextureSurface(
|
||||
dContext, ii, origin, sampleCnt, mipMapped, isProtected, props);
|
||||
dContext, ii, origin, sampleCnt, mipmapped, isProtected, props);
|
||||
}
|
||||
sk_sp<SkSurface> MakeBackendRenderTargetSurface(GrDirectContext* dContext,
|
||||
const SkImageInfo& ii,
|
||||
|
Loading…
Reference in New Issue
Block a user