Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 51 additions & 51 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/active_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ namespace endor
}

} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/active_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ namespace endor
};

} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/framebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ namespace endor
{
}
} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/framebuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ namespace endor
};

} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ namespace endor
// WebGLObject is a base class, typically not instantiated directly
}
} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ namespace endor
};

} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ namespace endor
}

} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/program.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ namespace endor
WebGLProgram(v8::Isolate *isolate, const v8::FunctionCallbackInfo<v8::Value> &args);
};
} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/renderbuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ namespace endor
// WebGLRenderbuffer objects are created by WebGL context, not by user code
}
} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/renderbuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ namespace endor
};

} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ namespace endor
{
}
} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/texture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ namespace endor
};

} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/uniform_location.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ namespace endor
}

} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/uniform_location.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ namespace endor
};

} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/vertex_array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ namespace endor
{
}
} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/vertex_array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ namespace endor
};

} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
10 changes: 10 additions & 0 deletions src/client/script_bindings/webgl/webgl_rendering_context.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <set>
#include <client/script_bindings/canvas/image_source.hpp>
#include "./webgl_rendering_context.hpp"
#include "./active_info.hpp"
Expand Down Expand Up @@ -2638,6 +2639,15 @@ namespace endor
auto nameUtf8 = String::Utf8Value(isolate, info[1]);
string name = *nameUtf8;

// WebGL 2.0 spec §5.18: Built-in attributes always return -1
static const std::set<string> kBuiltInAttribs = {
"gl_VertexID", "gl_InstanceID", "gl_Position", "gl_PointSize"};
if (kBuiltInAttribs.count(name))
{
info.GetReturnValue().Set(Number::New(isolate, -1));
return;
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot please impl in client/graphics

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! Moved the implementation to client/graphics/webgl_context.cpp in commit c135954. The built-in attribute check now happens at the graphics layer in WebGLContext::getAttribLocation(), which returns nullopt for built-in attributes. The script bindings layer correctly converts this to -1.

auto loc = handle()->getAttribLocation(programBinding->handle(), name);
if (!loc.has_value())
{
Expand Down