Reland "Limit ANGLE PBO workaround to blocking use of GL_UNPACK_ROW_LENGTH"
This is a reland of 7788b3a62f
Original change's description:
> Limit ANGLE PBO workaround to blocking use of GL_UNPACK_ROW_LENGTH
>
> Previously we blocked all PBO->texture transfers.
>
> Bug: angleproject:5542
>
> Change-Id: I1decfbc9293c03da125716c73e6d635e2ab9cb1d
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/406997
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
Bug: angleproject:5542
Change-Id: Id2474a47bdab368d36ddfbed335a8c58d5567fad
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/416477
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
f4741026ea
commit
dc03537758
@ -321,9 +321,9 @@ struct SK_API GrContextOptions {
|
||||
bool fRandomGLOOM = false;
|
||||
|
||||
/**
|
||||
* Force off support for write pixels row bytes in caps.
|
||||
* Force off support for write/transfer pixels row bytes in caps.
|
||||
*/
|
||||
bool fDisallowWritePixelRowBytes = false;
|
||||
bool fDisallowWriteAndTransferPixelRowBytes = false;
|
||||
|
||||
/**
|
||||
* Include or exclude specific GPU path renderers.
|
||||
|
@ -52,6 +52,7 @@ GrCaps::GrCaps(const GrContextOptions& options) {
|
||||
fTransferFromBufferToTextureSupport = false;
|
||||
fTransferFromSurfaceToBufferSupport = false;
|
||||
fWritePixelsRowBytesSupport = false;
|
||||
fTransferPixelsToRowBytesSupport = false;
|
||||
fReadPixelsRowBytesSupport = false;
|
||||
fShouldCollapseSrcOverToSrcWhenAble = false;
|
||||
fMustSyncGpuDuringAbandon = true;
|
||||
@ -134,8 +135,9 @@ void GrCaps::applyOptionsOverrides(const GrContextOptions& options) {
|
||||
if (options.fClearAllTextures) {
|
||||
fShouldInitializeTextures = true;
|
||||
}
|
||||
if (options.fDisallowWritePixelRowBytes) {
|
||||
if (options.fDisallowWriteAndTransferPixelRowBytes) {
|
||||
fWritePixelsRowBytesSupport = false;
|
||||
fTransferPixelsToRowBytesSupport = false;
|
||||
}
|
||||
#endif
|
||||
if (options.fSuppressMipmapSupport) {
|
||||
@ -232,6 +234,7 @@ void GrCaps::dumpJSON(SkJSONWriter* writer) const {
|
||||
writer->appendBool("Supports transfers from textures to buffers",
|
||||
fTransferFromSurfaceToBufferSupport);
|
||||
writer->appendBool("Write pixels row bytes support", fWritePixelsRowBytesSupport);
|
||||
writer->appendBool("Transfer pixels to row bytes support", fTransferPixelsToRowBytesSupport);
|
||||
writer->appendBool("Read pixels row bytes support", fReadPixelsRowBytesSupport);
|
||||
writer->appendBool("Disable msaa clip mask atlas on current driver [workaround]",
|
||||
fDriverDisableMSAAClipAtlas);
|
||||
|
@ -314,10 +314,16 @@ public:
|
||||
GrColorType dstColorType) const;
|
||||
|
||||
/**
|
||||
* Do GrGpu::writePixels() and GrGpu::transferPixelsTo() support a src buffer where the row
|
||||
* bytes is not equal to bpp * w?
|
||||
* Does GrGpu::writePixels() support a src buffer where the row bytes is not equal to bpp * w?
|
||||
*/
|
||||
bool writePixelsRowBytesSupport() const { return fWritePixelsRowBytesSupport; }
|
||||
|
||||
/**
|
||||
* Does GrGpu::transferPixelsTo() support a src buffer where the row bytes is not equal to
|
||||
* bpp * w?
|
||||
*/
|
||||
bool transferPixelsToRowBytesSupport() const { return fTransferPixelsToRowBytesSupport; }
|
||||
|
||||
/**
|
||||
* Does GrGpu::readPixels() support a dst buffer where the row bytes is not equal to bpp * w?
|
||||
*/
|
||||
@ -537,6 +543,7 @@ protected:
|
||||
bool fTransferFromBufferToTextureSupport : 1;
|
||||
bool fTransferFromSurfaceToBufferSupport : 1;
|
||||
bool fWritePixelsRowBytesSupport : 1;
|
||||
bool fTransferPixelsToRowBytesSupport : 1;
|
||||
bool fReadPixelsRowBytesSupport : 1;
|
||||
bool fShouldCollapseSrcOverToSrcWhenAble : 1;
|
||||
bool fMustSyncGpuDuringAbandon : 1;
|
||||
|
@ -44,6 +44,7 @@ GrD3DCaps::GrD3DCaps(const GrContextOptions& contextOptions, IDXGIAdapter1* adap
|
||||
// We always copy in/out of a transfer buffer so it's trivial to support row bytes.
|
||||
fReadPixelsRowBytesSupport = true;
|
||||
fWritePixelsRowBytesSupport = true;
|
||||
fTransferPixelsToRowBytesSupport = true;
|
||||
|
||||
fTransferFromBufferToTextureSupport = true;
|
||||
fTransferFromSurfaceToBufferSupport = true;
|
||||
|
@ -129,6 +129,8 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
|
||||
fWritePixelsRowBytesSupport = version >= GR_GL_VER(2, 0);
|
||||
fReadPixelsRowBytesSupport = version >= GR_GL_VER(2, 0);
|
||||
}
|
||||
fTransferPixelsToRowBytesSupport = fWritePixelsRowBytesSupport;
|
||||
|
||||
if (fDriverBugWorkarounds.pack_parameters_workaround_with_pack_buffer) {
|
||||
// In some cases drivers handle copying the last row incorrectly
|
||||
// when using GL_PACK_ROW_LENGTH. Chromium handles this by iterating
|
||||
@ -3518,10 +3520,11 @@ void GrGLCaps::applyDriverCorrectnessWorkarounds(const GrGLContextInfo& ctxInfo,
|
||||
fTransferBufferType = TransferBufferType::kNone;
|
||||
}
|
||||
|
||||
// The TransferPixelsToTexture test fails on ANGLE D3D.
|
||||
// The TransferPixelsToTexture test fails on ANGLE D3D9 and D3D11 if this is enabled.
|
||||
// https://anglebug.com/5542
|
||||
if (ctxInfo.angleBackend() == GrGLANGLEBackend::kD3D9 ||
|
||||
ctxInfo.angleBackend() == GrGLANGLEBackend::kD3D11) {
|
||||
fTransferFromBufferToTextureSupport = false;
|
||||
fTransferPixelsToRowBytesSupport = false;
|
||||
}
|
||||
|
||||
// Using MIPs on this GPU seems to be a source of trouble.
|
||||
@ -3639,7 +3642,7 @@ void GrGLCaps::applyDriverCorrectnessWorkarounds(const GrGLContextInfo& ctxInfo,
|
||||
}
|
||||
|
||||
#ifndef SK_BUILD_FOR_IOS
|
||||
if (GrGLRenderer::kPowerVRRogue == ctxInfo.renderer()) {
|
||||
if (ctxInfo.renderer() == GrGLRenderer::kPowerVRRogue) {
|
||||
// We saw this bug on a TecnoSpark 3 Pro with a PowerVR GE8300.
|
||||
// GL_VERSION: "OpenGL ES 3.2 build 1.10@51309121"
|
||||
// Possibly this could be more limited by driver version or HW generation.
|
||||
@ -3654,6 +3657,10 @@ void GrGLCaps::applyDriverCorrectnessWorkarounds(const GrGLContextInfo& ctxInfo,
|
||||
// only to single channel 8 bit unorm formats but we only have a monolithic query for this
|
||||
// support at present.
|
||||
fWritePixelsRowBytesSupport = false;
|
||||
// TransferPixelsToTextureTest fails for all color types on
|
||||
// TecnoSpark 3 Pro with a PowerVR GE8300, GL_VERSION: "OpenGL ES 3.2 build 1.10@51309121"
|
||||
// if GL_UNPACK_ROW_LENGTH is used.
|
||||
fTransferPixelsToRowBytesSupport = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -3929,6 +3936,9 @@ void GrGLCaps::applyDriverCorrectnessWorkarounds(const GrGLContextInfo& ctxInfo,
|
||||
// https://github.com/flutter/flutter/issues/16718
|
||||
// https://bugreport.apple.com/web/?problemID=39948888
|
||||
fWritePixelsRowBytesSupport = false;
|
||||
// This affects all iOS devices for transfering from a PBO as well (presumably the issue is in
|
||||
// the GL->Metal layer).
|
||||
fTransferPixelsToRowBytesSupport = false;
|
||||
#endif
|
||||
|
||||
if (ctxInfo.vendor() == GrGLVendor::kIntel || // IntelIris640 drops draws completely.
|
||||
|
@ -593,7 +593,8 @@ void GrGLGpu::onResetContext(uint32_t resetBits) {
|
||||
|
||||
// we assume these values
|
||||
if (resetBits & kPixelStore_GrGLBackendState) {
|
||||
if (this->caps()->writePixelsRowBytesSupport()) {
|
||||
if (this->caps()->writePixelsRowBytesSupport() ||
|
||||
this->caps()->transferPixelsToRowBytesSupport()) {
|
||||
GL_CALL(PixelStorei(GR_GL_UNPACK_ROW_LENGTH, 0));
|
||||
}
|
||||
if (this->glCaps().readPixelsRowBytesSupport()) {
|
||||
@ -892,7 +893,7 @@ bool GrGLGpu::onTransferPixelsTo(GrTexture* texture,
|
||||
bool restoreGLRowLength = false;
|
||||
if (trimRowBytes != rowBytes) {
|
||||
// we should have checked for this support already
|
||||
SkASSERT(this->glCaps().writePixelsRowBytesSupport());
|
||||
SkASSERT(this->glCaps().transferPixelsToRowBytesSupport());
|
||||
GL_CALL(PixelStorei(GR_GL_UNPACK_ROW_LENGTH, rowBytes / bpp));
|
||||
restoreGLRowLength = true;
|
||||
}
|
||||
|
@ -275,6 +275,7 @@ void GrMtlCaps::initGrCaps(id<MTLDevice> device) {
|
||||
// We always copy in/out of a transfer buffer so it's trivial to support row bytes.
|
||||
fReadPixelsRowBytesSupport = true;
|
||||
fWritePixelsRowBytesSupport = true;
|
||||
fTransferPixelsToRowBytesSupport = true;
|
||||
|
||||
// RenderTarget and Texture size
|
||||
if (this->isMac()) {
|
||||
|
@ -740,7 +740,7 @@ DEF_GPUTEST(ColorTypeBackendAllocationTest, reporter, options) {
|
||||
if (info.directContext()->priv().caps()->writePixelsRowBytesSupport() &&
|
||||
info.directContext()->backend() == GrBackendApi::kOpenGL) {
|
||||
GrContextOptions overrideOptions = options;
|
||||
overrideOptions.fDisallowWritePixelRowBytes = true;
|
||||
overrideOptions.fDisallowWriteAndTransferPixelRowBytes = true;
|
||||
sk_gpu_test::GrContextFactory overrideFactory(overrideOptions);
|
||||
info = overrideFactory.getContextInfo(type);
|
||||
color_type_backend_allocation_test(info, reporter);
|
||||
|
@ -123,7 +123,7 @@ void basic_transfer_to_test(skiatest::Reporter* reporter,
|
||||
GrGpu* gpu = dContext->priv().getGpu();
|
||||
|
||||
static constexpr SkISize kTexDims = {16, 16};
|
||||
int srcBufferWidth = caps->writePixelsRowBytesSupport() ? 20 : 16;
|
||||
int srcBufferWidth = caps->transferPixelsToRowBytesSupport() ? 20 : 16;
|
||||
const int kBufferHeight = 16;
|
||||
|
||||
sk_sp<GrTexture> tex =
|
||||
@ -217,7 +217,7 @@ void basic_transfer_to_test(skiatest::Reporter* reporter,
|
||||
// transfer partial data
|
||||
|
||||
// We're relying on this cap to write partial texture data
|
||||
if (!caps->writePixelsRowBytesSupport()) {
|
||||
if (!caps->transferPixelsToRowBytesSupport()) {
|
||||
return;
|
||||
}
|
||||
// We keep a 1 to 1 correspondence between pixels in the buffer and the entire texture. We
|
||||
|
Loading…
Reference in New Issue
Block a user