Skip to content

Commit

Permalink
Fix transform feedback for WebGL CTS 2023-11-02
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=264092

Reviewed by Kimmo Kinnunen.

Fixed required buffer count for an empty
varyings array in interleaved mode.

Added validation to reject transform feedback buffer
binding updates when transform feedback is active.

* Source/WebCore/html/canvas/WebGL2RenderingContext.cpp:
(WebCore::WebGL2RenderingContext::transformFeedbackVaryings):
(WebCore::WebGL2RenderingContext::setIndexedBufferBinding):

Canonical link: https://commits.webkit.org/270165@main
  • Loading branch information
lexaknyazev authored and kkinnunen-apple committed Nov 3, 2023
1 parent d62977a commit 7deb80b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Source/WebCore/html/canvas/WebGL2RenderingContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2183,7 +2183,8 @@ void WebGL2RenderingContext::transformFeedbackVaryings(WebGLProgram& program, co
synthesizeGLError(GraphicsContextGL::INVALID_ENUM, "transformFeedbackVaryings", "invalid buffer mode");
return;
}
program.setRequiredTransformFeedbackBufferCount(bufferMode == GraphicsContextGL::INTERLEAVED_ATTRIBS ? 1 : varyings.size());
program.setRequiredTransformFeedbackBufferCount(
bufferMode == GraphicsContextGL::INTERLEAVED_ATTRIBS ? std::min(static_cast<size_t>(1), varyings.size()) : varyings.size());

m_context->transformFeedbackVaryings(program.object(), varyings, bufferMode);
}
Expand Down Expand Up @@ -2259,6 +2260,10 @@ bool WebGL2RenderingContext::setIndexedBufferBinding(const char *functionName, G

switch (target) {
case GraphicsContextGL::TRANSFORM_FEEDBACK_BUFFER:
if (m_boundTransformFeedback->isActive()) {
synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, functionName, "transform feedback is active");
return false;
}
if (index >= m_maxTransformFeedbackSeparateAttribs) {
synthesizeGLError(GraphicsContextGL::INVALID_VALUE, functionName, "index out of range");
return false;
Expand Down

0 comments on commit 7deb80b

Please sign in to comment.