зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1878930 - s/RawBuffer/Span/: TexImage: Use span, fix dtwebgl callers. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D202027
This commit is contained in:
Родитель
bbfd7b04e2
Коммит
9bfa923970
|
@ -4142,7 +4142,8 @@ void webgl::TexUnpackBlobDesc::Shrink(const webgl::PackingInfo& pi) {
|
|||
CheckedInt<size_t>(unpack.metrics.bytesPerRowStride) *
|
||||
unpack.metrics.totalRows;
|
||||
if (bytesUpperBound.isValid()) {
|
||||
cpuData->Shrink(bytesUpperBound.value());
|
||||
auto& span = *cpuData;
|
||||
span = span.subspan(0, std::min(span.size(), bytesUpperBound.value()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4218,7 +4219,7 @@ void ClientWebGLContext::TexImage(uint8_t funcDims, GLenum imageTarget,
|
|||
return Some(webgl::TexUnpackBlobDesc{imageTarget,
|
||||
size.value(),
|
||||
gfxAlphaType::NonPremult,
|
||||
Some(RawBuffer<>{*range}),
|
||||
Some(*range),
|
||||
{}});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -621,13 +621,13 @@ bool SharedContextWebgl::SetNoClipMask() {
|
|||
}
|
||||
mWebgl->ActiveTexture(1);
|
||||
mWebgl->BindTexture(LOCAL_GL_TEXTURE_2D, mNoClipMask);
|
||||
static const uint8_t solidMask[4] = {0xFF, 0xFF, 0xFF, 0xFF};
|
||||
mWebgl->TexImage(
|
||||
0, LOCAL_GL_RGBA8, {0, 0, 0}, {LOCAL_GL_RGBA, LOCAL_GL_UNSIGNED_BYTE},
|
||||
{LOCAL_GL_TEXTURE_2D,
|
||||
{1, 1, 1},
|
||||
gfxAlphaType::NonPremult,
|
||||
Some(RawBuffer(Range<const uint8_t>(solidMask, sizeof(solidMask))))});
|
||||
static const auto solidMask = std::array<const uint8_t, 4>{0xFF, 0xFF, 0xFF, 0xFF};
|
||||
mWebgl->TexImage(0, LOCAL_GL_RGBA8, {0, 0, 0},
|
||||
{LOCAL_GL_RGBA, LOCAL_GL_UNSIGNED_BYTE},
|
||||
{LOCAL_GL_TEXTURE_2D,
|
||||
{1, 1, 1},
|
||||
gfxAlphaType::NonPremult,
|
||||
Some(Span{solidMask})});
|
||||
InitTexParameters(mNoClipMask, false);
|
||||
mWebgl->ActiveTexture(0);
|
||||
mLastClipMask = mNoClipMask;
|
||||
|
@ -1916,11 +1916,11 @@ bool SharedContextWebgl::UploadSurface(DataSourceSurface* aData,
|
|||
int32_t bpp = BytesPerPixel(aFormat);
|
||||
// Get the data pointer range considering the sampling rect offset and
|
||||
// size.
|
||||
Range<const uint8_t> range(
|
||||
Span<const uint8_t> range(
|
||||
map.GetData() + aSrcRect.y * size_t(stride) + aSrcRect.x * bpp,
|
||||
std::max(aSrcRect.height - 1, 0) * size_t(stride) +
|
||||
aSrcRect.width * bpp);
|
||||
texDesc.cpuData = Some(RawBuffer(range));
|
||||
texDesc.cpuData = Some(range);
|
||||
// If the stride happens to be 4 byte aligned, assume that is the
|
||||
// desired alignment regardless of format (even A8). Otherwise, we
|
||||
// default to byte alignment.
|
||||
|
|
|
@ -476,8 +476,7 @@ bool TexUnpackBytes::Validate(const WebGLContext* const webgl,
|
|||
|
||||
CheckedInt<size_t> availBytes = 0;
|
||||
if (mDesc.cpuData) {
|
||||
const auto& range = mDesc.cpuData->Data();
|
||||
availBytes = range.length();
|
||||
availBytes = mDesc.cpuData->size();
|
||||
} else if (mDesc.pboOffset) {
|
||||
const auto& pboOffset = *mDesc.pboOffset;
|
||||
|
||||
|
@ -514,11 +513,7 @@ bool TexUnpackBytes::TexOrSubImage(bool isSubImage, bool needsRespec,
|
|||
|
||||
const uint8_t* uploadPtr = nullptr;
|
||||
if (mDesc.cpuData) {
|
||||
const auto range = mDesc.cpuData->Data();
|
||||
uploadPtr = range.begin().get();
|
||||
if (!uploadPtr) {
|
||||
MOZ_ASSERT(!range.length());
|
||||
}
|
||||
uploadPtr = mDesc.cpuData->data();
|
||||
} else if (mDesc.pboOffset) {
|
||||
uploadPtr = reinterpret_cast<const uint8_t*>(*mDesc.pboOffset);
|
||||
}
|
||||
|
|
|
@ -1097,7 +1097,7 @@ struct TexUnpackBlobDesc final {
|
|||
uvec3 size;
|
||||
gfxAlphaType srcAlphaType = gfxAlphaType::NonPremult;
|
||||
|
||||
Maybe<RawBuffer<>> cpuData;
|
||||
Maybe<Span<const uint8_t>> cpuData;
|
||||
Maybe<uint64_t> pboOffset;
|
||||
|
||||
Maybe<uvec2> structuredSrcSize;
|
||||
|
|
Загрузка…
Ссылка в новой задаче