mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 03:25:13 +00:00
LibWeb/WebGL: Implement texSubImage2D with ArrayBufferView
This commit is contained in:
parent
7a6b6627e9
commit
5392aabded
Notes:
github-actions[bot]
2024-12-05 20:42:11 +00:00
Author: https://github.com/Lubrsi Commit: https://github.com/LadybirdBrowser/ladybird/commit/5392aabdedd Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2791 Reviewed-by: https://github.com/gmta Reviewed-by: https://github.com/shannonbooth
2 changed files with 14 additions and 1 deletions
|
@ -30,7 +30,7 @@ interface mixin WebGLRenderingContextOverloads {
|
|||
undefined texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, [AllowShared] ArrayBufferView? pixels);
|
||||
undefined texImage2D(GLenum target, GLint level, GLint internalformat, GLenum format, GLenum type, TexImageSource source); // May throw DOMException
|
||||
|
||||
[FIXME] undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, [AllowShared] ArrayBufferView? pixels);
|
||||
undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, [AllowShared] ArrayBufferView? pixels);
|
||||
[FIXME] undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, TexImageSource source); // May throw DOMException
|
||||
|
||||
undefined uniform1fv(WebGLUniformLocation? location, Float32List v);
|
||||
|
|
|
@ -555,6 +555,19 @@ public:
|
|||
continue;
|
||||
}
|
||||
|
||||
if (function.name == "texSubImage2D"sv && function.overload_index == 0) {
|
||||
function_impl_generator.append(R"~~~(
|
||||
void const* pixels_ptr = nullptr;
|
||||
if (pixels) {
|
||||
auto const& viewed_array_buffer = pixels->viewed_array_buffer();
|
||||
auto const& byte_buffer = viewed_array_buffer->buffer();
|
||||
pixels_ptr = byte_buffer.data();
|
||||
}
|
||||
glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels_ptr);
|
||||
)~~~");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (function.name == "getShaderParameter"sv) {
|
||||
function_impl_generator.append(R"~~~(
|
||||
GLint result = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue