mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 13:48:30 +09:00
[Feat] (MG_Impl, MG_State): implement the direct state access transform feedback API
glCreateTransformFeedbacks, glTransformFeedbackBufferBase, glTransformFeedbackBufferRange and the three glGetTransformFeedback* queries were all stubs, so a transform feedback object could only be configured and inspected by binding it first - the exact thing direct state access exists to avoid. The queries were the worse half: they returned nothing and raised no error, so an application could not tell that it had learned nothing. glCreateTransformFeedbacks creates the objects outright. glGenTransformFeedbacks only reserves names, and a reserved name becomes an object when it is first bound (GL 4.6 core 13.2.1); the DSA form has no bind step to create them from. The queries and the buffer bindings read and write a named object's state. That state lives in two places: the context keeps one live copy of the capture bindings and the active/paused flags for whichever object is bound, and every other object's copy sits in its saved state until a bind swaps it in. The by-name accessors added to the context resolve that, so a query for the bound object reads the live copy rather than a stale save. GL_TRANSFORM_FEEDBACK_BUFFER_START and _SIZE are answered as zero unless the binding was made by the range form, matching what the buffer object binding points already do. Takes direct_state_access.xfb_* from 0 to 4 of 5 on both backends; xfb_functional still fails on the capture itself, which is a separate defect.
This commit is contained in:
@@ -45,6 +45,14 @@ namespace MobileGL {
|
||||
// translates the result into its own API call.
|
||||
VertexAttribTypeInfo ClassifyVertexAttribType(GLenum glType);
|
||||
|
||||
// One indexed capture binding of a transform feedback object, as the by-name queries
|
||||
// report it. An empty Buffer means the binding point is unbound.
|
||||
struct NamedTransformFeedbackBinding {
|
||||
SharedPtr<BufferObject> Buffer;
|
||||
Range1D Range{};
|
||||
Bool HasExplicitRange = false;
|
||||
};
|
||||
|
||||
class GLContext {
|
||||
public:
|
||||
GLContext() = default;
|
||||
@@ -299,6 +307,17 @@ namespace MobileGL {
|
||||
// cannot express: an empty completed span is legal and draws nothing.
|
||||
Bool HasTransformFeedbackCompletedSpan(Uint index) const;
|
||||
|
||||
// The by-name (direct state access) view. A named object that happens to be the
|
||||
// bound one is answered from the live copy, since that is where its state actually
|
||||
// is until a bind swaps it out.
|
||||
void CreateTransformFeedbackObject(Uint index);
|
||||
Bool IsNamedTransformFeedbackActive(Uint index) const;
|
||||
Bool IsNamedTransformFeedbackPaused(Uint index) const;
|
||||
NamedTransformFeedbackBinding GetNamedTransformFeedbackBinding(Uint index, Uint bufferIndex) const;
|
||||
void SetNamedTransformFeedbackBinding(Uint index, Uint bufferIndex,
|
||||
const SharedPtr<BufferObject>& buffer, Range1D range,
|
||||
Bool hasExplicitRange);
|
||||
|
||||
// Framebuffer
|
||||
void GenFramebufferNames(Uint number, Vector<Uint>& framebuffers);
|
||||
const SharedPtr<FramebufferObject>& GetFramebufferObject(Uint index);
|
||||
|
||||
Reference in New Issue
Block a user