mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-17 15:03:25 +09:00
[MG_Pipe, MG_Impl, MG_State, MG_Remote, MG_Backend, MG_Test] (Disaggregated): P5e sb - set_shader_buffers is emitted, routed and applied
- MGPShaderBuffers::WritableMask is Uint32[3] and the POD grows 32 -> 40 (ID-104). One Uint32 could describe only the first 32 of an 84-point window, so a storage buffer bound at point 32 or above read as unwritable with nothing able to see it; the ruling widens the field rather than narrowing the window, which would change what an application may bind. MGPipeShaderBufferMaskHas / ...Set are the one spelling of the mask, so the emitter, the applier and the four backend sites cannot disagree about which word a point lives in. - MGPipeApplySetShaderBuffers has its body: per-class window, Start/Count validated against the capacity, the mask copied by word, ONE ShaderBuffersSerial advanced on every applied record and ADVANCED - never zeroed - by both resets, which also clear the three windows. - Route rows for opcode 38 on both arms (Mono_ and Wire_) and the server sink in the wire codec's decode switch, which is where a kCtxState row's sink lives - PipeApplier.cpp's ServerVerbSink has no method for it and the brief's "OnSetShaderBuffers" names no code. The codec also bounds Class and Start+Count where Count becomes a byte length. - New MG_Impl/Pipe/ShaderBufferEmit.h: one record per class, window = the touched high-water mark clamped to 84, zero early-out before any hash, a BASE binding travelling as kMGPipeWholeBuffer so the server re-resolves the extent at use, three suppressor slots (ruling 11), and the writable mask that replaces the backend's GPU-write walk. - BufferState gains a per-target bind-point generation (push-only, G1) and dirty bits 15/16/17 shutter on it instead of the buffer CONTENT aggregate. That aggregate answered the wrong question in both directions: any glBufferSubData fired all three, and glBindBufferBase fired none of them, because it mutates a binding point through a returned reference. Same defect class as P4a's glBindSampler hole. - Init.cpp publishes consumer bit 13 for DirectGLES and not for Magma (ID-106), in the same commit as the wired constant, and PipeFill's liveness gate asks R-8 for bit 13 in particular plus bit 13-requires-bit-7. - `Touch` joins the dirty-surface scanner's mutator prefixes; TouchBufferBindingPoint gets its row and SetNamedTransformFeedbackBinding's is rewritten now that bit 17 reads a generation a binding moves. Negative control 6 is re-pointed: the pair it used to refute is a live answer, and a control that has quietly become positive is what the self-test is for.
This commit is contained in:
@@ -71,11 +71,44 @@ namespace MobileGL::MG_State::GLState {
|
||||
// shutter on in P2 - five bits over one aggregate until P3b splits them.
|
||||
void NoteBufferChanged() { ++m_anyBufferChangeGeneration; }
|
||||
Uint64 GetAnyBufferChangeGeneration() const { return m_anyBufferChangeGeneration; }
|
||||
|
||||
// P5e (sb, MG_Remote/CONTRACT-P5E.md §1, §5.6). "DID ANY INDEXED BINDING POINT OF THIS
|
||||
// TARGET MOVE" - one counter per BufferBindPointTargets entry, and it is the P4b hole
|
||||
// closed rather than a new convenience.
|
||||
//
|
||||
// WHAT WAS WRONG. Dirty bits 15/16/17 shuttered on GetAnyBufferChangeGeneration() - the
|
||||
// CONTENT aggregate - while glBindBufferBase / glBindBufferRange mutate a binding point
|
||||
// through a returned reference (BindingSlotRange1D::Bind / SetRange), which moves the
|
||||
// slot's own Uint16 version and nothing the tracker reads. So
|
||||
// `glBindBufferBase(UNIFORM,1,A); draw; glBindBufferBase(UNIFORM,1,B); draw` fired no bit
|
||||
// at all: harmless while nothing was emitted for those bits, and an UNDER-FIRE the moment
|
||||
// set_shader_buffers is, because the server would go on binding A. It is the same defect
|
||||
// class as P4a's glBindSampler hole (c0d) and it is closed the same way - the shutter
|
||||
// reads the generation the mutator moves.
|
||||
//
|
||||
// A COUNTER AND NOT THE SLOT'S OWN VERSION: the slot version is a WRAPPING Uint16 per
|
||||
// point, and a shutter over 84 of them would have to observe all 84 through the widened
|
||||
// counter every draw. One monotone Uint64 per target answers "could this target's window
|
||||
// have moved" in one read, which is what a per-draw shutter can afford.
|
||||
//
|
||||
// #if MOBILEGL_PIPE_PUSH so the pull build's BufferState does not resize (G1) - the same
|
||||
// licence TextureState::NoteImageUnitTouched took at P5d r3.
|
||||
void NoteBindPointChanged(const BufferTarget target) {
|
||||
auto it = std::find(BufferBindPointTargets.begin(), BufferBindPointTargets.end(), target);
|
||||
if (it == BufferBindPointTargets.end()) return;
|
||||
++m_bindPointGeneration[std::distance(BufferBindPointTargets.begin(), it)];
|
||||
}
|
||||
Uint64 GetBindPointGeneration(const BufferTarget target) const {
|
||||
auto it = std::find(BufferBindPointTargets.begin(), BufferBindPointTargets.end(), target);
|
||||
if (it == BufferBindPointTargets.end()) return 0;
|
||||
return m_bindPointGeneration[std::distance(BufferBindPointTargets.begin(), it)];
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
#if MOBILEGL_PIPE_PUSH
|
||||
Uint64 m_anyBufferChangeGeneration = 0;
|
||||
Array<Uint64, BufferBindPointTargets.size()> m_bindPointGeneration{};
|
||||
#endif
|
||||
UnorderedMap<Uint, SharedPtr<BufferObject>> m_bufferObjects;
|
||||
IndexGenerator<Uint> m_indexGenerator;
|
||||
|
||||
@@ -1522,6 +1522,17 @@ namespace MobileGL::MG_State {
|
||||
Bool hasExplicitRange) {
|
||||
if (bufferIndex >= MAX_TRANSFORM_FEEDBACK_BUFFERS) return;
|
||||
if (index == m_boundTransformFeedback) {
|
||||
#if MOBILEGL_PIPE_PUSH
|
||||
// P5e (sb): the THIRD writer of a transform-feedback binding point, and the one
|
||||
// a reader of GL_Buffer.cpp alone would miss - glTransformFeedbackBufferBase /
|
||||
// ...Range on the CURRENTLY BOUND object land here rather than in
|
||||
// BindBufferBase_State. Dirty bit 17 shutters on this generation, so a bump
|
||||
// left out here would make the DSA spelling of a capture-point bind invisible
|
||||
// while the non-DSA one was not. The saved-bindings arm below writes no binding
|
||||
// POINT at all (it writes the named object's own table) and deliberately bumps
|
||||
// nothing.
|
||||
NoteBufferBindPointChanged(BufferTarget::TransformFeedback);
|
||||
#endif
|
||||
auto& point = m_bufferState.GetBindingPoint(BufferTarget::TransformFeedback, bufferIndex);
|
||||
point.Bind(buffer);
|
||||
if (buffer && hasExplicitRange) {
|
||||
|
||||
@@ -251,6 +251,15 @@ namespace MobileGL {
|
||||
Uint64 GetAnyBufferChangeGeneration() const {
|
||||
return m_bufferState.GetAnyBufferChangeGeneration();
|
||||
}
|
||||
// P5e (sb): the per-target INDEXED BINDING POINT generation, which is what dirty
|
||||
// bits 15/16/17 shutter on now. See BufferState::NoteBindPointChanged for why
|
||||
// the content aggregate above could not answer the question.
|
||||
void NoteBufferBindPointChanged(BufferTarget target) {
|
||||
m_bufferState.NoteBindPointChanged(target);
|
||||
}
|
||||
Uint64 GetBufferBindPointGeneration(BufferTarget target) const {
|
||||
return m_bufferState.GetBindPointGeneration(target);
|
||||
}
|
||||
// The sixth aggregate lives here rather than on a state container because
|
||||
// the values it guards do too (m_currentVertexAttributes).
|
||||
void NoteVertexAttribDefaultChanged() { ++m_anyVertexAttribDefaultGeneration; }
|
||||
|
||||
Reference in New Issue
Block a user