Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gcGLSpanDynamicExtent is defined in incorrect header, GCGLSpan.h included in wrong order #12611

Merged
merged 1 commit into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 8 additions & 8 deletions Source/WebCore/Modules/webxr/WebXROpaqueFramebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ void WebXROpaqueFramebuffer::startFrame(const PlatformXR::Device::FrameData::Lay

GCGLint boundFBO { 0 };
GCGLint boundTexture { 0 };
gl.getIntegerv(GL::FRAMEBUFFER_BINDING, makeGCGLSpan(&boundFBO, 1));
gl.getIntegerv(textureTargetBinding, makeGCGLSpan(&boundTexture, 1));
gl.getIntegerv(GL::FRAMEBUFFER_BINDING, makeSpan(&boundFBO, 1));
gl.getIntegerv(textureTargetBinding, makeSpan(&boundTexture, 1));

auto scopedBindings = makeScopeExit([&gl, boundFBO, boundTexture, textureTarget]() {
gl.bindFramebuffer(GL::FRAMEBUFFER, boundFBO);
Expand Down Expand Up @@ -215,9 +215,9 @@ void WebXROpaqueFramebuffer::endFrame()
GCGLint boundFBO { 0 };
GCGLint boundReadFBO { 0 };
GCGLint boundDrawFBO { 0 };
gl.getIntegerv(GL::FRAMEBUFFER_BINDING, makeGCGLSpan(&boundFBO, 1));
gl.getIntegerv(GL::READ_FRAMEBUFFER_BINDING, makeGCGLSpan(&boundReadFBO, 1));
gl.getIntegerv(GL::DRAW_FRAMEBUFFER_BINDING, makeGCGLSpan(&boundDrawFBO, 1));
gl.getIntegerv(GL::FRAMEBUFFER_BINDING, makeSpan(&boundFBO, 1));
gl.getIntegerv(GL::READ_FRAMEBUFFER_BINDING, makeSpan(&boundReadFBO, 1));
gl.getIntegerv(GL::DRAW_FRAMEBUFFER_BINDING, makeSpan(&boundDrawFBO, 1));

auto scopedBindings = makeScopeExit([&gl, boundFBO, boundReadFBO, boundDrawFBO]() {
gl.bindFramebuffer(GL::FRAMEBUFFER, boundFBO);
Expand Down Expand Up @@ -275,8 +275,8 @@ bool WebXROpaqueFramebuffer::setupFramebuffer()
// Restore bindings when exiting the function.
GCGLint boundFBO { 0 };
GCGLint boundRenderbuffer { 0 };
gl.getIntegerv(GL::FRAMEBUFFER_BINDING, makeGCGLSpan(&boundFBO, 1));
gl.getIntegerv(GL::RENDERBUFFER_BINDING, makeGCGLSpan(&boundRenderbuffer, 1));
gl.getIntegerv(GL::FRAMEBUFFER_BINDING, makeSpan(&boundFBO, 1));
gl.getIntegerv(GL::RENDERBUFFER_BINDING, makeSpan(&boundRenderbuffer, 1));

auto scopedBindings = makeScopeExit([&gl, boundFBO, boundRenderbuffer]() {
gl.bindFramebuffer(GL::FRAMEBUFFER, boundFBO);
Expand All @@ -293,7 +293,7 @@ bool WebXROpaqueFramebuffer::setupFramebuffer()
// FIXME: check if we can get recommended values from each device platform.
if (m_attributes.antialias) {
GCGLint maxSampleCount;
gl.getIntegerv(GL::MAX_SAMPLES, makeGCGLSpan(&maxSampleCount, 1));
gl.getIntegerv(GL::MAX_SAMPLES, makeSpan(&maxSampleCount, 1));
// Cap the maxiumum multisample count at 4. Any more than this is likely overkill and will impact performance.
m_sampleCount = std::min(4, maxSampleCount);
}
Expand Down
23 changes: 10 additions & 13 deletions Source/WebCore/html/canvas/WebGL2RenderingContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ void WebGL2RenderingContext::getBufferSubData(GCGLenum target, long long srcByte
return;

// FIXME: Coalesce multiple getBufferSubData() calls to use a single map() call
m_context->getBufferSubData(target, srcByteOffset, makeGCGLSpan(static_cast<char*>(dstData->baseAddress()) + dstOffset * elementSize, copyLength * elementSize));
m_context->getBufferSubData(target, srcByteOffset, makeSpan(static_cast<uint8_t*>(dstData->baseAddress()) + dstOffset * elementSize, copyLength * elementSize));
}

void WebGL2RenderingContext::bindFramebuffer(GCGLenum target, WebGLFramebuffer* buffer)
Expand Down Expand Up @@ -1219,7 +1219,7 @@ void WebGL2RenderingContext::compressedTexImage2D(GCGLenum target, GCGLint level
auto slice = sliceArrayBufferView("compressedTexImage2D", srcData, srcOffset, srcLengthOverride);
if (!slice)
return;
m_context->compressedTexImage2D(target, level, internalformat, width, height, border, slice->byteLength(), makeGCGLSpan(slice->baseAddress(), slice->byteLength()));
m_context->compressedTexImage2D(target, level, internalformat, width, height, border, slice->byteLength(), makeSpan(static_cast<const uint8_t*>(slice->baseAddress()), slice->byteLength()));
}

void WebGL2RenderingContext::compressedTexImage3D(GCGLenum target, GCGLint level, GCGLenum internalformat, GCGLsizei width, GCGLsizei height, GCGLsizei depth, GCGLint border, GCGLsizei imageSize, GCGLint64 offset)
Expand Down Expand Up @@ -1252,10 +1252,7 @@ void WebGL2RenderingContext::compressedTexImage3D(GCGLenum target, GCGLint level
auto slice = sliceArrayBufferView("compressedTexImage3D", srcData, srcOffset, srcLengthOverride);
if (!slice)
return;
m_context->compressedTexImage3D(
target, level, internalformat, width, height,
depth, border, slice->byteLength(),
makeGCGLSpan(slice->baseAddress(), slice->byteLength()));
m_context->compressedTexImage3D(target, level, internalformat, width, height, depth, border, slice->byteLength(), makeSpan(static_cast<const uint8_t*>(slice->baseAddress()), slice->byteLength()));
}

void WebGL2RenderingContext::compressedTexSubImage2D(GCGLenum target, GCGLint level, GCGLint xoffset, GCGLint yoffset, GCGLsizei width, GCGLsizei height, GCGLenum format, ArrayBufferView& srcData)
Expand Down Expand Up @@ -1301,7 +1298,7 @@ void WebGL2RenderingContext::compressedTexSubImage2D(GCGLenum target, GCGLint le
auto slice = sliceArrayBufferView("compressedTexSubImage2D", srcData, srcOffset, srcLengthOverride);
if (!slice)
return;
m_context->compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, slice->byteLength(), makeGCGLSpan(slice->baseAddress(), slice->byteLength()));
m_context->compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, slice->byteLength(), makeSpan(static_cast<const uint8_t*>(slice->baseAddress()), slice->byteLength()));
}

void WebGL2RenderingContext::compressedTexSubImage3D(GCGLenum target, GCGLint level, GCGLint xoffset, GCGLint yoffset, GCGLint zoffset, GCGLsizei width, GCGLsizei height, GCGLsizei depth, GCGLenum format, GCGLsizei imageSize, GCGLint64 offset)
Expand Down Expand Up @@ -1334,7 +1331,7 @@ void WebGL2RenderingContext::compressedTexSubImage3D(GCGLenum target, GCGLint le
auto slice = sliceArrayBufferView("compressedTexSubImage3D", srcData, srcOffset, srcLengthOverride);
if (!slice)
return;
m_context->compressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, slice->byteLength(), makeGCGLSpan(slice->baseAddress(), slice->byteLength()));
m_context->compressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, slice->byteLength(), makeSpan(static_cast<const uint8_t*>(slice->baseAddress()), slice->byteLength()));
}

GCGLint WebGL2RenderingContext::getFragDataLocation(WebGLProgram& program, const String& name)
Expand Down Expand Up @@ -1505,7 +1502,7 @@ void WebGL2RenderingContext::vertexAttribI4iv(GCGLuint index, Int32List&& list)
synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "vertexAttribI4iv", "index out of range");
return;
}
m_context->vertexAttribI4iv(index, makeGCGLSpan<4>(data));
m_context->vertexAttribI4iv(index, Span<const GCGLint, 4> { data, 4 });
m_vertexAttribValue[index].type = GraphicsContextGL::INT;
memcpy(m_vertexAttribValue[index].iValue, data, sizeof(m_vertexAttribValue[index].iValue));
}
Expand Down Expand Up @@ -1543,7 +1540,7 @@ void WebGL2RenderingContext::vertexAttribI4uiv(GCGLuint index, Uint32List&& list
synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "vertexAttribI4uiv", "index out of range");
return;
}
m_context->vertexAttribI4uiv(index, makeGCGLSpan<4>(data));
m_context->vertexAttribI4uiv(index, Span<const GCGLuint, 4> { data, 4 });
m_vertexAttribValue[index].type = GraphicsContextGL::UNSIGNED_INT;
memcpy(m_vertexAttribValue[index].uiValue, data, sizeof(m_vertexAttribValue[index].uiValue));
}
Expand Down Expand Up @@ -3278,7 +3275,7 @@ bool WebGL2RenderingContext::validateCapability(const char* functionName, GCGLen
}

template<typename T, typename TypedArrayType>
std::optional<GCGLSpan<const T>> WebGL2RenderingContext::validateClearBuffer(const char* functionName, GCGLenum buffer, TypedList<TypedArrayType, T>& values, GCGLuint srcOffset)
std::optional<Span<const T>> WebGL2RenderingContext::validateClearBuffer(const char* functionName, GCGLenum buffer, TypedList<TypedArrayType, T>& values, GCGLuint srcOffset)
{
Checked<GCGLsizei, RecordOverflow> checkedSize(values.length());
checkedSize -= srcOffset;
Expand All @@ -3292,14 +3289,14 @@ std::optional<GCGLSpan<const T>> WebGL2RenderingContext::validateClearBuffer(con
synthesizeGLError(GraphicsContextGL::INVALID_VALUE, functionName, "invalid array size / srcOffset");
return { };
}
return makeGCGLSpan(values.data() + srcOffset, 4);
return Span<const T> { values.data() + srcOffset, 4 };
case GraphicsContextGL::DEPTH:
case GraphicsContextGL::STENCIL:
if (checkedSize < 1) {
synthesizeGLError(GraphicsContextGL::INVALID_VALUE, functionName, "invalid array size / srcOffset");
return { };
}
return makeGCGLSpan(values.data() + srcOffset, 1);
return Span<const T> { values.data() + srcOffset, 1 };

default:
synthesizeGLError(GraphicsContextGL::INVALID_ENUM, functionName, "invalid buffer");
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/html/canvas/WebGL2RenderingContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ class WebGL2RenderingContext final : public WebGLRenderingContextBase {
bool validateBlendEquation(const char* functionName, GCGLenum mode) final;
bool validateCapability(const char* functionName, GCGLenum cap) final;
template<typename T, typename TypedArrayType>
std::optional<GCGLSpan<const T>> validateClearBuffer(const char* functionName, GCGLenum buffer, TypedList<TypedArrayType, T>& values, GCGLuint srcOffset);
std::optional<Span<const T>> validateClearBuffer(const char* functionName, GCGLenum buffer, TypedList<TypedArrayType, T>& values, GCGLuint srcOffset);
bool validateFramebufferTarget(GCGLenum target) final;
WebGLFramebuffer* getFramebufferBinding(GCGLenum target) final;
WebGLFramebuffer* getReadFramebufferBinding() final;
Expand Down