Revert "Remove simple GrGpu::createTexture helper"
This reverts commit 83cfe4fa24
.
Reason for revert:breaking the bots
Original change's description:
> Remove simple GrGpu::createTexture helper
>
> Change-Id: I8ad3213517594987ac604f4c08086778254b5a7b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/228062
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
TBR=egdaniel@google.com,bsalomon@google.com
Change-Id: Ie1f156ecd6264f41372dd13fae987df8fcafa564
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/228343
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
83cfe4fa24
commit
c7dced5f68
@ -192,6 +192,11 @@ sk_sp<GrTexture> GrGpu::createTexture(const GrSurfaceDesc& origDesc, GrRenderabl
|
||||
return tex;
|
||||
}
|
||||
|
||||
sk_sp<GrTexture> GrGpu::createTexture(const GrSurfaceDesc& desc, GrRenderable renderable,
|
||||
SkBudgeted budgeted) {
|
||||
return this->createTexture(desc, renderable, budgeted, nullptr, 0);
|
||||
}
|
||||
|
||||
sk_sp<GrTexture> GrGpu::createCompressedTexture(int width, int height,
|
||||
SkImage::CompressionType compressionType,
|
||||
SkBudgeted budgeted, const void* data,
|
||||
|
@ -107,6 +107,11 @@ public:
|
||||
sk_sp<GrTexture> createTexture(const GrSurfaceDesc& desc, GrRenderable renderable, SkBudgeted,
|
||||
const GrMipLevel texels[], int mipLevelCount);
|
||||
|
||||
/**
|
||||
* Simplified createTexture() interface for when there is no initial texel data to upload.
|
||||
*/
|
||||
sk_sp<GrTexture> createTexture(const GrSurfaceDesc&, GrRenderable, SkBudgeted);
|
||||
|
||||
sk_sp<GrTexture> createCompressedTexture(int width, int height, SkImage::CompressionType,
|
||||
SkBudgeted, const void* data, size_t dataSize);
|
||||
|
||||
|
@ -215,15 +215,17 @@ sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc,
|
||||
}
|
||||
}
|
||||
|
||||
GrMipLevel level;
|
||||
std::unique_ptr<char[]> zeros;
|
||||
if (fCaps->createTextureMustSpecifyAllLevels()) {
|
||||
level.fRowBytes = GrBytesPerPixel(desc.fConfig) * desc.fWidth;
|
||||
zeros.reset(new char[level.fRowBytes * desc.fHeight]());
|
||||
size_t rowBytes = GrBytesPerPixel(desc.fConfig) * desc.fWidth;
|
||||
size_t size = rowBytes * desc.fHeight;
|
||||
std::unique_ptr<char[]> zeros(new char[size]());
|
||||
GrMipLevel level;
|
||||
level.fRowBytes = rowBytes;
|
||||
level.fPixels = zeros.get();
|
||||
return fGpu->createTexture(desc, renderable, budgeted, &level, 1);
|
||||
}
|
||||
|
||||
return fGpu->createTexture(desc, renderable, budgeted, &level, 1);
|
||||
return fGpu->createTexture(desc, renderable, budgeted);
|
||||
}
|
||||
|
||||
// Map 'value' to a larger multiple of 2. Values <= 'kMagicTol' will pop up to
|
||||
@ -287,14 +289,16 @@ sk_sp<GrTexture> GrResourceProvider::createApproxTexture(const GrSurfaceDesc& de
|
||||
return tex;
|
||||
}
|
||||
|
||||
GrMipLevel level;
|
||||
std::unique_ptr<char[]> zeros;
|
||||
if (this->caps()->createTextureMustSpecifyAllLevels()) {
|
||||
level.fRowBytes = GrBytesPerPixel(desc.fConfig) * desc.fWidth;
|
||||
zeros.reset(new char[level.fRowBytes * desc.fHeight]());
|
||||
size_t rowBytes = GrBytesPerPixel(copyDesc->fConfig) * copyDesc->fWidth;
|
||||
size_t size = rowBytes * copyDesc->fHeight;
|
||||
std::unique_ptr<char[]> zeros(new char[size]());
|
||||
GrMipLevel level;
|
||||
level.fRowBytes = rowBytes;
|
||||
level.fPixels = zeros.get();
|
||||
return fGpu->createTexture(*copyDesc, renderable, SkBudgeted::kYes, &level, 1);
|
||||
}
|
||||
return fGpu->createTexture(*copyDesc, renderable, SkBudgeted::kYes, &level, 1);
|
||||
return fGpu->createTexture(*copyDesc, renderable, SkBudgeted::kYes);
|
||||
}
|
||||
|
||||
sk_sp<GrTexture> GrResourceProvider::refScratchTexture(const GrSurfaceDesc& desc,
|
||||
|
@ -475,7 +475,7 @@ sk_sp<GrTexture> GrMtlGpu::onCreateTexture(const GrSurfaceDesc& desc, GrRenderab
|
||||
}
|
||||
|
||||
if (this->caps()->shouldInitializeTextures()) {
|
||||
uint32_t levelMask = (1 << mipLevels) - 1;
|
||||
uint32_t levelMask = ~0;
|
||||
SkASSERT(mipLevelCount < 32);
|
||||
for (int i = 0; i < mipLevelCount; ++i) {
|
||||
if (!texels[i].fPixels) {
|
||||
|
@ -74,12 +74,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(TextureBindingsResetTest, reporter, ctxInf
|
||||
GrSurfaceDesc desc;
|
||||
desc.fWidth = desc.fHeight = 10;
|
||||
desc.fConfig = kRGBA_8888_GrPixelConfig;
|
||||
// Init with data just in case caps requires initialized textures.
|
||||
GrMipLevel level;
|
||||
level.fRowBytes = GrBytesPerPixel(desc.fConfig) * desc.fWidth;
|
||||
std::unique_ptr<char[]> zeros(new char[level.fRowBytes * desc.fHeight]());
|
||||
level.fPixels = zeros.get();
|
||||
auto tex = gpu->createTexture(desc, GrRenderable::kNo, SkBudgeted::kNo, &level, 1);
|
||||
auto tex = gpu->createTexture(desc, GrRenderable::kNo, SkBudgeted::kNo);
|
||||
REPORTER_ASSERT(reporter, tex);
|
||||
context->resetGLTextureBindings();
|
||||
checkBindings();
|
||||
|
Loading…
Reference in New Issue
Block a user