-
Notifications
You must be signed in to change notification settings - Fork 3
feat(webgl): implement vertexAttribI4i, vertexAttribI4ui, vertexAttri… #399
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1186,36 +1186,192 @@ namespace endor | |||||||||||||||||||||
| { | ||||||||||||||||||||||
| Isolate *isolate = args.GetIsolate(); | ||||||||||||||||||||||
| HandleScope scope(isolate); | ||||||||||||||||||||||
| Local<Context> context = isolate->GetCurrentContext(); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| isolate->ThrowException(Exception::Error( | ||||||||||||||||||||||
| MakeMethodError(isolate, "vertexAttribI4i", "Not implemented"))); | ||||||||||||||||||||||
| if (args.Length() < 5) | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| isolate->ThrowException(Exception::TypeError( | ||||||||||||||||||||||
| MakeMethodArgCountError(isolate, "vertexAttribI4i", 5, args.Length()))); | ||||||||||||||||||||||
| return; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| for (int i = 0; i < 5; ++i) | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| if (!args[i]->IsNumber()) | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| isolate->ThrowException(Exception::TypeError( | ||||||||||||||||||||||
| MakeMethodArgTypeError(isolate, "vertexAttribI4i", i, "number", args[i]))); | ||||||||||||||||||||||
| return; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| int index = args[0]->Int32Value(context).ToChecked(); | ||||||||||||||||||||||
| int v0 = args[1]->Int32Value(context).ToChecked(); | ||||||||||||||||||||||
| int v1 = args[2]->Int32Value(context).ToChecked(); | ||||||||||||||||||||||
| int v2 = args[3]->Int32Value(context).ToChecked(); | ||||||||||||||||||||||
| int v3 = args[4]->Int32Value(context).ToChecked(); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| handle()->vertexAttribI4i(index, v0, v1, v2, v3); | ||||||||||||||||||||||
| args.GetReturnValue().SetUndefined(); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| void WebGL2RenderingContext::VertexAttribI4ui(const v8::FunctionCallbackInfo<v8::Value> &args) | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| Isolate *isolate = args.GetIsolate(); | ||||||||||||||||||||||
| HandleScope scope(isolate); | ||||||||||||||||||||||
| Local<Context> context = isolate->GetCurrentContext(); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| isolate->ThrowException(Exception::Error( | ||||||||||||||||||||||
| MakeMethodError(isolate, "vertexAttribI4ui", "Not implemented"))); | ||||||||||||||||||||||
| if (args.Length() < 5) | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| isolate->ThrowException(Exception::TypeError( | ||||||||||||||||||||||
| MakeMethodArgCountError(isolate, "vertexAttribI4ui", 5, args.Length()))); | ||||||||||||||||||||||
| return; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| for (int i = 0; i < 5; ++i) | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| if (!args[i]->IsNumber()) | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| isolate->ThrowException(Exception::TypeError( | ||||||||||||||||||||||
| MakeMethodArgTypeError(isolate, "vertexAttribI4ui", i, "number", args[i]))); | ||||||||||||||||||||||
| return; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| int index = args[0]->Int32Value(context).ToChecked(); | ||||||||||||||||||||||
| uint32_t v0 = args[1]->Uint32Value(context).ToChecked(); | ||||||||||||||||||||||
| uint32_t v1 = args[2]->Uint32Value(context).ToChecked(); | ||||||||||||||||||||||
| uint32_t v2 = args[3]->Uint32Value(context).ToChecked(); | ||||||||||||||||||||||
| uint32_t v3 = args[4]->Uint32Value(context).ToChecked(); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
||||||||||||||||||||||
| // Validate index parameter | |
| constexpr int MAX_VERTEX_ATTRIBS = 16; // WebGL2 minimum, replace with actual value if available | |
| if (index < 0 || index >= MAX_VERTEX_ATTRIBS) { | |
| isolate->ThrowException(Exception::RangeError( | |
| String::NewFromUtf8(isolate, "vertexAttribI4ui: index out of range").ToLocalChecked())); | |
| return; | |
| } |
Copilot
AI
Oct 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The index parameter should be validated to ensure it's non-negative and within valid bounds (typically < MAX_VERTEX_ATTRIBS). This validation is missing across all four methods.
| int index = args[0]->Int32Value(context).ToChecked(); | |
| int index = args[0]->Int32Value(context).ToChecked(); | |
| // Validate index is non-negative and within bounds | |
| constexpr int MAX_VERTEX_ATTRIBS = 16; // WebGL spec minimum, adjust if available from implementation | |
| if (index < 0 || index >= MAX_VERTEX_ATTRIBS) | |
| { | |
| isolate->ThrowException(Exception::TypeError( | |
| MakeMethodError(isolate, "vertexAttribI4iv", "index out of range"))); | |
| return; | |
| } |
Copilot
AI
Oct 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The index parameter should be validated to ensure it's non-negative and within valid bounds (typically < MAX_VERTEX_ATTRIBS). This validation is missing across all four methods.
Copilot
AI
Oct 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The index parameter should be validated to ensure it's non-negative and within valid bounds (typically < MAX_VERTEX_ATTRIBS). This validation is missing across all four methods.
Copilot
AI
Oct 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The index parameter should be validated to ensure it's non-negative and within valid bounds (typically < MAX_VERTEX_ATTRIBS). This validation is missing across all four methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The index parameter should be validated to ensure it's non-negative and within valid bounds (typically < MAX_VERTEX_ATTRIBS, usually 16 or 32 depending on implementation). Invalid index values could cause undefined behavior in the underlying OpenGL calls.