mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
LibWeb/WebGL2: Implement remaining uniformMatrix methods
This commit is contained in:
parent
7db73118e9
commit
59bea36a59
|
|
@ -345,14 +345,14 @@ interface mixin WebGL2RenderingContextBase {
|
|||
[FIXME] undefined uniform2uiv(WebGLUniformLocation? location, Uint32List data, optional unsigned long long srcOffset = 0, optional GLuint srcLength = 0);
|
||||
[FIXME] undefined uniform3uiv(WebGLUniformLocation? location, Uint32List data, optional unsigned long long srcOffset = 0, optional GLuint srcLength = 0);
|
||||
[FIXME] undefined uniform4uiv(WebGLUniformLocation? location, Uint32List data, optional unsigned long long srcOffset = 0, optional GLuint srcLength = 0);
|
||||
[FIXME] undefined uniformMatrix3x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, optional unsigned long long srcOffset = 0, optional GLuint srcLength = 0);
|
||||
[FIXME] undefined uniformMatrix4x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, optional unsigned long long srcOffset = 0, optional GLuint srcLength = 0);
|
||||
undefined uniformMatrix3x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, optional unsigned long long srcOffset = 0, optional GLuint srcLength = 0);
|
||||
undefined uniformMatrix4x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, optional unsigned long long srcOffset = 0, optional GLuint srcLength = 0);
|
||||
|
||||
[FIXME] undefined uniformMatrix2x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, optional unsigned long long srcOffset = 0, optional GLuint srcLength = 0);
|
||||
[FIXME] undefined uniformMatrix4x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, optional unsigned long long srcOffset = 0, optional GLuint srcLength = 0);
|
||||
undefined uniformMatrix2x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, optional unsigned long long srcOffset = 0, optional GLuint srcLength = 0);
|
||||
undefined uniformMatrix4x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, optional unsigned long long srcOffset = 0, optional GLuint srcLength = 0);
|
||||
|
||||
[FIXME] undefined uniformMatrix2x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, optional unsigned long long srcOffset = 0, optional GLuint srcLength = 0);
|
||||
[FIXME] undefined uniformMatrix3x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, optional unsigned long long srcOffset = 0, optional GLuint srcLength = 0);
|
||||
undefined uniformMatrix2x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, optional unsigned long long srcOffset = 0, optional GLuint srcLength = 0);
|
||||
undefined uniformMatrix3x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, optional unsigned long long srcOffset = 0, optional GLuint srcLength = 0);
|
||||
|
||||
// Vertex attributes
|
||||
[FIXME] undefined vertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);
|
||||
|
|
|
|||
|
|
@ -188,6 +188,102 @@ void WebGL2RenderingContextImpl::uniform4ui(GC::Root<WebGLUniformLocation> locat
|
|||
glUniform4ui(location ? location->handle() : 0, v0, v1, v2, v3);
|
||||
}
|
||||
|
||||
void WebGL2RenderingContextImpl::uniform_matrix3x2fv(GC::Root<WebGLUniformLocation> location, bool transpose, Float32List data, WebIDL::UnsignedLongLong src_offset, WebIDL::UnsignedLong src_length)
|
||||
{
|
||||
m_context->make_current();
|
||||
|
||||
if (!location)
|
||||
return;
|
||||
|
||||
constexpr auto matrix_size = 3 * 2;
|
||||
auto span = SET_ERROR_VALUE_IF_ERROR(span_from_float32_list(data, src_offset, src_length), GL_INVALID_VALUE);
|
||||
if (span.size() % matrix_size != 0) [[unlikely]] {
|
||||
set_error(GL_INVALID_VALUE);
|
||||
return;
|
||||
}
|
||||
glUniformMatrix3x2fv(location->handle(), span.size() / matrix_size, transpose, span.data());
|
||||
}
|
||||
|
||||
void WebGL2RenderingContextImpl::uniform_matrix4x2fv(GC::Root<WebGLUniformLocation> location, bool transpose, Float32List data, WebIDL::UnsignedLongLong src_offset, WebIDL::UnsignedLong src_length)
|
||||
{
|
||||
m_context->make_current();
|
||||
|
||||
if (!location)
|
||||
return;
|
||||
|
||||
constexpr auto matrix_size = 4 * 2;
|
||||
auto span = SET_ERROR_VALUE_IF_ERROR(span_from_float32_list(data, src_offset, src_length), GL_INVALID_VALUE);
|
||||
if (span.size() % matrix_size != 0) [[unlikely]] {
|
||||
set_error(GL_INVALID_VALUE);
|
||||
return;
|
||||
}
|
||||
glUniformMatrix4x2fv(location->handle(), span.size() / matrix_size, transpose, span.data());
|
||||
}
|
||||
|
||||
void WebGL2RenderingContextImpl::uniform_matrix2x3fv(GC::Root<WebGLUniformLocation> location, bool transpose, Float32List data, WebIDL::UnsignedLongLong src_offset, WebIDL::UnsignedLong src_length)
|
||||
{
|
||||
m_context->make_current();
|
||||
|
||||
if (!location)
|
||||
return;
|
||||
|
||||
constexpr auto matrix_size = 2 * 3;
|
||||
auto span = SET_ERROR_VALUE_IF_ERROR(span_from_float32_list(data, src_offset, src_length), GL_INVALID_VALUE);
|
||||
if (span.size() % matrix_size != 0) [[unlikely]] {
|
||||
set_error(GL_INVALID_VALUE);
|
||||
return;
|
||||
}
|
||||
glUniformMatrix2x3fv(location->handle(), span.size() / matrix_size, transpose, span.data());
|
||||
}
|
||||
|
||||
void WebGL2RenderingContextImpl::uniform_matrix4x3fv(GC::Root<WebGLUniformLocation> location, bool transpose, Float32List data, WebIDL::UnsignedLongLong src_offset, WebIDL::UnsignedLong src_length)
|
||||
{
|
||||
m_context->make_current();
|
||||
|
||||
if (!location)
|
||||
return;
|
||||
|
||||
constexpr auto matrix_size = 4 * 3;
|
||||
auto span = SET_ERROR_VALUE_IF_ERROR(span_from_float32_list(data, src_offset, src_length), GL_INVALID_VALUE);
|
||||
if (span.size() % matrix_size != 0) [[unlikely]] {
|
||||
set_error(GL_INVALID_VALUE);
|
||||
return;
|
||||
}
|
||||
glUniformMatrix4x3fv(location->handle(), span.size() / matrix_size, transpose, span.data());
|
||||
}
|
||||
|
||||
void WebGL2RenderingContextImpl::uniform_matrix2x4fv(GC::Root<WebGLUniformLocation> location, bool transpose, Float32List data, WebIDL::UnsignedLongLong src_offset, WebIDL::UnsignedLong src_length)
|
||||
{
|
||||
m_context->make_current();
|
||||
|
||||
if (!location)
|
||||
return;
|
||||
|
||||
constexpr auto matrix_size = 2 * 4;
|
||||
auto span = SET_ERROR_VALUE_IF_ERROR(span_from_float32_list(data, src_offset, src_length), GL_INVALID_VALUE);
|
||||
if (span.size() % matrix_size != 0) [[unlikely]] {
|
||||
set_error(GL_INVALID_VALUE);
|
||||
return;
|
||||
}
|
||||
glUniformMatrix2x4fv(location->handle(), span.size() / matrix_size, transpose, span.data());
|
||||
}
|
||||
|
||||
void WebGL2RenderingContextImpl::uniform_matrix3x4fv(GC::Root<WebGLUniformLocation> location, bool transpose, Float32List data, WebIDL::UnsignedLongLong src_offset, WebIDL::UnsignedLong src_length)
|
||||
{
|
||||
m_context->make_current();
|
||||
|
||||
if (!location)
|
||||
return;
|
||||
|
||||
constexpr auto matrix_size = 3 * 4;
|
||||
auto span = SET_ERROR_VALUE_IF_ERROR(span_from_float32_list(data, src_offset, src_length), GL_INVALID_VALUE);
|
||||
if (span.size() % matrix_size != 0) [[unlikely]] {
|
||||
set_error(GL_INVALID_VALUE);
|
||||
return;
|
||||
}
|
||||
glUniformMatrix3x4fv(location->handle(), span.size() / matrix_size, transpose, span.data());
|
||||
}
|
||||
|
||||
void WebGL2RenderingContextImpl::vertex_attrib_i_pointer(WebIDL::UnsignedLong index, WebIDL::Long size, WebIDL::UnsignedLong type, WebIDL::Long stride, WebIDL::LongLong offset)
|
||||
{
|
||||
m_context->make_current();
|
||||
|
|
|
|||
|
|
@ -43,6 +43,12 @@ public:
|
|||
void uniform2ui(GC::Root<WebGLUniformLocation> location, WebIDL::UnsignedLong v0, WebIDL::UnsignedLong v1);
|
||||
void uniform3ui(GC::Root<WebGLUniformLocation> location, WebIDL::UnsignedLong v0, WebIDL::UnsignedLong v1, WebIDL::UnsignedLong v2);
|
||||
void uniform4ui(GC::Root<WebGLUniformLocation> location, WebIDL::UnsignedLong v0, WebIDL::UnsignedLong v1, WebIDL::UnsignedLong v2, WebIDL::UnsignedLong v3);
|
||||
void uniform_matrix3x2fv(GC::Root<WebGLUniformLocation> location, bool transpose, Float32List data, WebIDL::UnsignedLongLong src_offset, WebIDL::UnsignedLong src_length);
|
||||
void uniform_matrix4x2fv(GC::Root<WebGLUniformLocation> location, bool transpose, Float32List data, WebIDL::UnsignedLongLong src_offset, WebIDL::UnsignedLong src_length);
|
||||
void uniform_matrix2x3fv(GC::Root<WebGLUniformLocation> location, bool transpose, Float32List data, WebIDL::UnsignedLongLong src_offset, WebIDL::UnsignedLong src_length);
|
||||
void uniform_matrix4x3fv(GC::Root<WebGLUniformLocation> location, bool transpose, Float32List data, WebIDL::UnsignedLongLong src_offset, WebIDL::UnsignedLong src_length);
|
||||
void uniform_matrix2x4fv(GC::Root<WebGLUniformLocation> location, bool transpose, Float32List data, WebIDL::UnsignedLongLong src_offset, WebIDL::UnsignedLong src_length);
|
||||
void uniform_matrix3x4fv(GC::Root<WebGLUniformLocation> location, bool transpose, Float32List data, WebIDL::UnsignedLongLong src_offset, WebIDL::UnsignedLong src_length);
|
||||
void vertex_attrib_i_pointer(WebIDL::UnsignedLong index, WebIDL::Long size, WebIDL::UnsignedLong type, WebIDL::Long stride, WebIDL::LongLong offset);
|
||||
void vertex_attrib_divisor(WebIDL::UnsignedLong index, WebIDL::UnsignedLong divisor);
|
||||
void draw_arrays_instanced(WebIDL::UnsignedLong mode, WebIDL::Long first, WebIDL::Long count, WebIDL::Long instance_count);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user