diff --git a/dom/canvas/ClientWebGLContext.cpp b/dom/canvas/ClientWebGLContext.cpp index 7a8b19ad008fc..1f7a7330508df 100644 --- a/dom/canvas/ClientWebGLContext.cpp +++ b/dom/canvas/ClientWebGLContext.cpp @@ -4856,9 +4856,8 @@ void ClientWebGLContext::UniformData(const GLenum funcElemType, const auto begin = reinterpret_cast(bytes.begin().get()) + elemOffset; - const auto range = Range{begin, availCount}; - RunWithGCData(std::move(nogc), locId, transpose, - RawBuffer{range}); + const auto range = Span{begin, availCount}; + RunWithGCData(std::move(nogc), locId, transpose, range); } // - diff --git a/dom/canvas/HostWebGLContext.h b/dom/canvas/HostWebGLContext.h index a9e43fb60fd2a..cc385bc26a63f 100644 --- a/dom/canvas/HostWebGLContext.h +++ b/dom/canvas/HostWebGLContext.h @@ -603,8 +603,8 @@ class HostWebGLContext final : public SupportsWeakPtr { // ------------------------ Uniforms and attributes ------------------------ void UniformData(uint32_t loc, bool transpose, - const RawBuffer& data) const { - mContext->UniformData(loc, transpose, data.Data()); + const Span& data) const { + mContext->UniformData(loc, transpose, data); } void VertexAttrib4T(GLuint index, const webgl::TypedQuad& data) const { diff --git a/dom/canvas/QueueParamTraits.h b/dom/canvas/QueueParamTraits.h index fbedcdea0bf59..fef59db7970ab 100644 --- a/dom/canvas/QueueParamTraits.h +++ b/dom/canvas/QueueParamTraits.h @@ -98,6 +98,10 @@ template <> struct BytesAlwaysValidT { static constexpr bool value = true; }; +template <> +struct BytesAlwaysValidT { + static constexpr bool value = true; +}; // - diff --git a/dom/canvas/WebGLContext.h b/dom/canvas/WebGLContext.h index cb87c9aed523c..dbaca23a39bb0 100644 --- a/dom/canvas/WebGLContext.h +++ b/dom/canvas/WebGLContext.h @@ -667,7 +667,7 @@ class WebGLContext : public VRefCounted, public SupportsWeakPtr { ////////////////////////// void UniformData(uint32_t loc, bool transpose, - const Range& data) const; + const Span& data) const; //////////////////////////////////// diff --git a/dom/canvas/WebGLContextGL.cpp b/dom/canvas/WebGLContextGL.cpp index 7411cec02fd93..ef068c8999428 100644 --- a/dom/canvas/WebGLContextGL.cpp +++ b/dom/canvas/WebGLContextGL.cpp @@ -1280,7 +1280,7 @@ void WebGLContext::StencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, void WebGLContext::UniformData( const uint32_t loc, const bool transpose, - const Range& data) const { + const Span& data) const { const FuncScope funcScope(*this, "uniform setter"); if (!IsWebGL2() && transpose) { @@ -1306,13 +1306,13 @@ void WebGLContext::UniformData( // - - const auto lengthInType = data.length(); + const auto lengthInType = data.size(); const auto elemCount = lengthInType / channels; if (elemCount > 1 && !validationInfo.isArray) { GenerateError( LOCAL_GL_INVALID_OPERATION, "(uniform %s) `values` length (%u) must exactly match size of %s.", - activeInfo.name.c_str(), lengthInType, + activeInfo.name.c_str(), (uint32_t)lengthInType, EnumString(activeInfo.elemType).c_str()); return; } @@ -1321,9 +1321,9 @@ void WebGLContext::UniformData( const auto& samplerInfo = locInfo->samplerInfo; if (samplerInfo) { - const auto idata = reinterpret_cast(data.begin().get()); + const auto idata = ReinterpretToSpan::From(data); const auto maxTexUnits = GLMaxTextureUnits(); - for (const auto& val : Range(idata, elemCount)) { + for (const auto& val : idata) { if (val >= maxTexUnits) { ErrorInvalidValue( "This uniform location is a sampler, but %d" @@ -1337,7 +1337,7 @@ void WebGLContext::UniformData( // - // This is a little galaxy-brain, sorry! - const auto ptr = static_cast(data.begin().get()); + const auto ptr = static_cast(data.data()); (*pfn)(*gl, static_cast(loc), elemCount, transpose, ptr); // - @@ -1345,12 +1345,12 @@ void WebGLContext::UniformData( if (samplerInfo) { auto& texUnits = samplerInfo->texUnits; - const auto srcBegin = reinterpret_cast(data.begin().get()); + const auto srcBegin = reinterpret_cast(data.data()); auto destIndex = locInfo->indexIntoUniform; if (destIndex < texUnits.length()) { // Only sample as many indexes as available tex units allow. const auto destCount = std::min(elemCount, texUnits.length() - destIndex); - for (const auto& val : Range(srcBegin, destCount)) { + for (const auto& val : Span(srcBegin, destCount)) { texUnits[destIndex] = AssertedCast(val); destIndex += 1; }