mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 05:38:31 +09:00
423 lines
16 KiB
PHP
423 lines
16 KiB
PHP
// MobileGL - MobileGL/MG_Pipe/generated/PipeFilled.inc
|
|
// Copyright (c) 2025-2026 MobileGL-Dev
|
|
// Licensed under the GNU Lesser General Public License v3.0:
|
|
// https://www.gnu.org/licenses/gpl-3.0.txt
|
|
// https://www.gnu.org/licenses/lgpl-3.0.txt
|
|
// SPDX-License-Identifier: LGPL-3.0-only
|
|
// End of Source File Header
|
|
|
|
// G5: PipeInputs field ids and the per-verb poison generations.
|
|
//
|
|
// GENERATED by scripts/gen_pipe.py from Coverage.def and PipeCalls.def - DO NOT EDIT.
|
|
// Regenerate with `python3 scripts/gen_pipe.py`; CI runs it and diffs the result.
|
|
// This file is included from MG_Pipe/MGPipe.h inside namespace MobileGL::MG_Pipe.
|
|
|
|
// One field id per GLContext accessor the backends actually read (plan B section 6.2:
|
|
// PipeInputs is organized by MEMO KEY, not by read point, which is why the field set is
|
|
// small and stable across the whole migration).
|
|
//
|
|
// The poison is a per-verb GENERATION, not a bit. A bitmap cannot see the dangerous case:
|
|
// a field filled by the previous DRAW and then read by the glTexSubImage that follows is
|
|
// stale, and its bit is already set. So every verb bumps CurrentVerbSerial, filling a
|
|
// field stamps it with that serial, and reading a non-sticky field whose stamp is older is
|
|
// Fatal{UnmigratedPipeInput} (section 6.2.2).
|
|
//
|
|
// PipeInputs itself is MG_Backend/MGPipe/PipeInputs.h (P1); the verb enum and the
|
|
// per-class fill masks are G5b, generated/PipeFillPoints.inc.
|
|
|
|
enum class MGPipeInputField : Uint16 {
|
|
GetActiveTextureUnit,
|
|
GetBlendColor,
|
|
GetBlendEquationIndexed,
|
|
GetBlendFuncIndexed,
|
|
GetBoundTransformFeedbackName,
|
|
GetBoundVertexArray,
|
|
GetBufferBindingSlot,
|
|
GetBufferBindingPoint,
|
|
GetBufferBindingPointCount,
|
|
GetTouchedBufferBindingPointCount,
|
|
GetClampReadColor,
|
|
GetClearColor,
|
|
GetClearDepth,
|
|
GetClearStencil,
|
|
GetColorMaskIndexed,
|
|
GetCullFaceMode,
|
|
GetCurrentVertexAttribute,
|
|
GetDepthFunc,
|
|
GetDepthMask,
|
|
GetDepthRangeIndexed,
|
|
GetFramebufferBindingSlot,
|
|
GetImageTextureBinding,
|
|
GetLineWidth,
|
|
GetLogicOp,
|
|
GetMaxTouchedTextureUnit,
|
|
GetMinSampleShadingValue,
|
|
GetPatchDefaultInnerLevel,
|
|
GetPatchDefaultOuterLevel,
|
|
GetPatchVertices,
|
|
GetPipelineStateVersion,
|
|
GetPixelStoreParameters,
|
|
GetPolygonModeFront,
|
|
GetPolygonOffsetFactor,
|
|
GetPolygonOffsetUnits,
|
|
GetPrimitiveRestartIndex,
|
|
GetProgramForDispatch,
|
|
GetProgramForDraw,
|
|
GetProgramObject,
|
|
GetProvokingVertexMode,
|
|
GetRenderStateParameters,
|
|
GetRenderStateParametersVersion,
|
|
GetSamplingResolutionGeneration,
|
|
GetScissorBox,
|
|
GetStencilState,
|
|
GetTextureBindGeneration,
|
|
GetTextureContextId,
|
|
GetTextureObject,
|
|
GetTextureUnitObject,
|
|
GetTransformFeedbackCapturedVertices,
|
|
GetTransformFeedbackGeneration,
|
|
GetTransformFeedbackPausedPrimitiveCounter,
|
|
GetTransformFeedbackProgram,
|
|
GetViewport,
|
|
GetViewportIndexed,
|
|
IsCapabilityEnabled,
|
|
IsCapabilityEnabledIndexed,
|
|
IsTransformFeedbackActive,
|
|
IsTransformFeedbackPaused,
|
|
InvalidateCompileEnv,
|
|
ValidateProgramName,
|
|
RecordError,
|
|
GetBoundTransformFeedbackLifetimeId,
|
|
HasOpenTransformFeedbackSpan,
|
|
kFieldCount,
|
|
};
|
|
|
|
inline constexpr SizeT kMGPipeInputFieldCount = static_cast<SizeT>(MGPipeInputField::kFieldCount);
|
|
static_assert(kMGPipeInputFieldCount == 63, "the PipeInputs field set moved");
|
|
|
|
inline constexpr const char* kMGPipeInputFieldNames[kMGPipeInputFieldCount] = {
|
|
"GetActiveTextureUnit",
|
|
"GetBlendColor",
|
|
"GetBlendEquationIndexed",
|
|
"GetBlendFuncIndexed",
|
|
"GetBoundTransformFeedbackName",
|
|
"GetBoundVertexArray",
|
|
"GetBufferBindingSlot",
|
|
"GetBufferBindingPoint",
|
|
"GetBufferBindingPointCount",
|
|
"GetTouchedBufferBindingPointCount",
|
|
"GetClampReadColor",
|
|
"GetClearColor",
|
|
"GetClearDepth",
|
|
"GetClearStencil",
|
|
"GetColorMaskIndexed",
|
|
"GetCullFaceMode",
|
|
"GetCurrentVertexAttribute",
|
|
"GetDepthFunc",
|
|
"GetDepthMask",
|
|
"GetDepthRangeIndexed",
|
|
"GetFramebufferBindingSlot",
|
|
"GetImageTextureBinding",
|
|
"GetLineWidth",
|
|
"GetLogicOp",
|
|
"GetMaxTouchedTextureUnit",
|
|
"GetMinSampleShadingValue",
|
|
"GetPatchDefaultInnerLevel",
|
|
"GetPatchDefaultOuterLevel",
|
|
"GetPatchVertices",
|
|
"GetPipelineStateVersion",
|
|
"GetPixelStoreParameters",
|
|
"GetPolygonModeFront",
|
|
"GetPolygonOffsetFactor",
|
|
"GetPolygonOffsetUnits",
|
|
"GetPrimitiveRestartIndex",
|
|
"GetProgramForDispatch",
|
|
"GetProgramForDraw",
|
|
"GetProgramObject",
|
|
"GetProvokingVertexMode",
|
|
"GetRenderStateParameters",
|
|
"GetRenderStateParametersVersion",
|
|
"GetSamplingResolutionGeneration",
|
|
"GetScissorBox",
|
|
"GetStencilState",
|
|
"GetTextureBindGeneration",
|
|
"GetTextureContextId",
|
|
"GetTextureObject",
|
|
"GetTextureUnitObject",
|
|
"GetTransformFeedbackCapturedVertices",
|
|
"GetTransformFeedbackGeneration",
|
|
"GetTransformFeedbackPausedPrimitiveCounter",
|
|
"GetTransformFeedbackProgram",
|
|
"GetViewport",
|
|
"GetViewportIndexed",
|
|
"IsCapabilityEnabled",
|
|
"IsCapabilityEnabledIndexed",
|
|
"IsTransformFeedbackActive",
|
|
"IsTransformFeedbackPaused",
|
|
"InvalidateCompileEnv",
|
|
"ValidateProgramName",
|
|
"RecordError",
|
|
"GetBoundTransformFeedbackLifetimeId",
|
|
"HasOpenTransformFeedbackSpan",
|
|
};
|
|
|
|
// Fields whose value is valid ACROSS verbs: a sticky field is a field the poison
|
|
// cannot protect, so every true is argued for in Coverage.def's
|
|
// MGP_COVERAGE_STICKY_LIST (the seven forwarded, argument-keyed accessors).
|
|
inline constexpr Bool kMGPipeInputFieldSticky[kMGPipeInputFieldCount] = {
|
|
false, // GetActiveTextureUnit
|
|
false, // GetBlendColor
|
|
false, // GetBlendEquationIndexed
|
|
false, // GetBlendFuncIndexed
|
|
false, // GetBoundTransformFeedbackName
|
|
false, // GetBoundVertexArray
|
|
false, // GetBufferBindingSlot
|
|
false, // GetBufferBindingPoint
|
|
true, // GetBufferBindingPointCount: keyed by target: a constexpr capacity table, not verb state
|
|
false, // GetTouchedBufferBindingPointCount
|
|
false, // GetClampReadColor
|
|
false, // GetClearColor
|
|
false, // GetClearDepth
|
|
false, // GetClearStencil
|
|
false, // GetColorMaskIndexed
|
|
false, // GetCullFaceMode
|
|
false, // GetCurrentVertexAttribute
|
|
false, // GetDepthFunc
|
|
false, // GetDepthMask
|
|
false, // GetDepthRangeIndexed
|
|
false, // GetFramebufferBindingSlot
|
|
false, // GetImageTextureBinding
|
|
false, // GetLineWidth
|
|
false, // GetLogicOp
|
|
false, // GetMaxTouchedTextureUnit
|
|
false, // GetMinSampleShadingValue
|
|
false, // GetPatchDefaultInnerLevel
|
|
false, // GetPatchDefaultOuterLevel
|
|
false, // GetPatchVertices
|
|
false, // GetPipelineStateVersion
|
|
false, // GetPixelStoreParameters
|
|
false, // GetPolygonModeFront
|
|
false, // GetPolygonOffsetFactor
|
|
false, // GetPolygonOffsetUnits
|
|
false, // GetPrimitiveRestartIndex
|
|
false, // GetProgramForDispatch
|
|
false, // GetProgramForDraw
|
|
true, // GetProgramObject: keyed by GL name: an object lookup, not verb state
|
|
false, // GetProvokingVertexMode
|
|
false, // GetRenderStateParameters
|
|
false, // GetRenderStateParametersVersion
|
|
false, // GetSamplingResolutionGeneration
|
|
false, // GetScissorBox
|
|
false, // GetStencilState
|
|
false, // GetTextureBindGeneration
|
|
false, // GetTextureContextId
|
|
true, // GetTextureObject: keyed by GL name: an object lookup, not verb state
|
|
false, // GetTextureUnitObject
|
|
false, // GetTransformFeedbackCapturedVertices
|
|
false, // GetTransformFeedbackGeneration
|
|
false, // GetTransformFeedbackPausedPrimitiveCounter
|
|
false, // GetTransformFeedbackProgram
|
|
false, // GetViewport
|
|
false, // GetViewportIndexed
|
|
false, // IsCapabilityEnabled
|
|
false, // IsCapabilityEnabledIndexed
|
|
false, // IsTransformFeedbackActive
|
|
false, // IsTransformFeedbackPaused
|
|
true, // InvalidateCompileEnv: reverse channel: a write into the frontend, not a state read
|
|
true, // ValidateProgramName: keyed by GL name: a name-table lookup, not verb state
|
|
true, // RecordError: reverse channel: a write into the frontend, not a state read
|
|
false, // GetBoundTransformFeedbackLifetimeId
|
|
true, // HasOpenTransformFeedbackSpan: keyed by lifetime id: an object lookup, not verb state
|
|
};
|
|
inline constexpr SizeT kMGPipeInputStickyFieldCount = 7;
|
|
|
|
// Which call is expected to have filled a field by the time a verb reads it. Names
|
|
// come from Coverage.def, so this table and the coverage table cannot disagree.
|
|
inline constexpr const char* kMGPipeInputFieldFilledBy[kMGPipeInputFieldCount] = {
|
|
"SetSamplerViews",
|
|
"SetDynamicState",
|
|
"CreateRenderState",
|
|
"CreateRenderState",
|
|
"SetStreamOutputTargets",
|
|
"BindVertexElements",
|
|
"SetIndirectBuffers",
|
|
"SetShaderBuffers",
|
|
"SetShaderBuffers",
|
|
"SetShaderBuffers",
|
|
"SetDynamicState",
|
|
"SetDynamicState",
|
|
"SetDynamicState",
|
|
"SetDynamicState",
|
|
"CreateRenderState",
|
|
"CreateRenderState",
|
|
"SetVertexAttribDefaults",
|
|
"CreateRenderState",
|
|
"CreateRenderState",
|
|
"SetDynamicState",
|
|
"SetFramebufferState",
|
|
"SetShaderImages",
|
|
"SetDynamicState",
|
|
"CreateRenderState",
|
|
"SetSamplerViews",
|
|
"CreateRenderState",
|
|
"SetPatchState",
|
|
"SetPatchState",
|
|
"SetPatchState",
|
|
"BindRenderState",
|
|
"SetPixelPackState",
|
|
"CreateRenderState",
|
|
"SetDynamicState",
|
|
"SetDynamicState",
|
|
"DrawVbo",
|
|
"SetDispatchProgram",
|
|
"SetDrawProgram",
|
|
"CreateShaderState",
|
|
"CreateRenderState",
|
|
"CreateRenderState",
|
|
"BindRenderState",
|
|
"SetSamplerViews",
|
|
"SetDynamicState",
|
|
"CreateRenderState",
|
|
"SetSamplerViews",
|
|
"SetSamplerViews",
|
|
"SetSamplerViews",
|
|
"SetSamplerViews",
|
|
"DrawVbo",
|
|
"SetStreamOutputTargets",
|
|
"EndStreamOutput",
|
|
"SetStreamOutputTargets",
|
|
"SetDynamicState",
|
|
"SetDynamicState",
|
|
"CreateRenderState",
|
|
"CreateRenderState",
|
|
"BeginStreamOutput",
|
|
"PauseStreamOutput",
|
|
"kClientResolved", // pseudo-call: not filled by a forward record
|
|
"kClientResolved", // pseudo-call: not filled by a forward record
|
|
"kReverseChannel", // pseudo-call: not filled by a forward record
|
|
"SetStreamOutputTargets",
|
|
"SetStreamOutputTargets",
|
|
};
|
|
|
|
// P2 brief D5: the call that now SUPPLIES a field, so the residual fill loop no
|
|
// longer pulls it out of GLContext. kNone means the field is still pulled - which
|
|
// is what makes MOBILEGL_PIPE_PUSH a true per-subsystem A/B instead of a single
|
|
// switch. Rows come from Coverage.def's MGP_COVERAGE_EMITTED_LIST.
|
|
enum class MGPipeFieldEmitter : Uint8 {
|
|
kNone = 0,
|
|
BindRenderState,
|
|
BindVertexElements,
|
|
CreateRenderState,
|
|
SetDispatchProgram,
|
|
SetDrawProgram,
|
|
SetDynamicState,
|
|
SetFramebufferState,
|
|
SetPatchState,
|
|
SetSamplerViews,
|
|
SetShaderImages,
|
|
SetVertexAttribDefaults,
|
|
};
|
|
|
|
inline constexpr const char* kMGPipeFieldEmitterNames[] = {
|
|
"kNone",
|
|
"BindRenderState",
|
|
"BindVertexElements",
|
|
"CreateRenderState",
|
|
"SetDispatchProgram",
|
|
"SetDrawProgram",
|
|
"SetDynamicState",
|
|
"SetFramebufferState",
|
|
"SetPatchState",
|
|
"SetSamplerViews",
|
|
"SetShaderImages",
|
|
"SetVertexAttribDefaults",
|
|
};
|
|
|
|
inline constexpr MGPipeFieldEmitter kMGPipeFieldEmittedBy[kMGPipeInputFieldCount] = {
|
|
MGPipeFieldEmitter::kNone, // GetActiveTextureUnit
|
|
MGPipeFieldEmitter::SetDynamicState, // GetBlendColor
|
|
MGPipeFieldEmitter::CreateRenderState, // GetBlendEquationIndexed
|
|
MGPipeFieldEmitter::CreateRenderState, // GetBlendFuncIndexed
|
|
MGPipeFieldEmitter::kNone, // GetBoundTransformFeedbackName
|
|
MGPipeFieldEmitter::BindVertexElements, // GetBoundVertexArray
|
|
MGPipeFieldEmitter::kNone, // GetBufferBindingSlot
|
|
MGPipeFieldEmitter::kNone, // GetBufferBindingPoint
|
|
MGPipeFieldEmitter::kNone, // GetBufferBindingPointCount
|
|
MGPipeFieldEmitter::kNone, // GetTouchedBufferBindingPointCount
|
|
MGPipeFieldEmitter::SetDynamicState, // GetClampReadColor
|
|
MGPipeFieldEmitter::SetDynamicState, // GetClearColor
|
|
MGPipeFieldEmitter::SetDynamicState, // GetClearDepth
|
|
MGPipeFieldEmitter::SetDynamicState, // GetClearStencil
|
|
MGPipeFieldEmitter::CreateRenderState, // GetColorMaskIndexed
|
|
MGPipeFieldEmitter::CreateRenderState, // GetCullFaceMode
|
|
MGPipeFieldEmitter::SetVertexAttribDefaults, // GetCurrentVertexAttribute
|
|
MGPipeFieldEmitter::CreateRenderState, // GetDepthFunc
|
|
MGPipeFieldEmitter::CreateRenderState, // GetDepthMask
|
|
MGPipeFieldEmitter::SetDynamicState, // GetDepthRangeIndexed
|
|
MGPipeFieldEmitter::SetFramebufferState, // GetFramebufferBindingSlot
|
|
MGPipeFieldEmitter::SetShaderImages, // GetImageTextureBinding
|
|
MGPipeFieldEmitter::SetDynamicState, // GetLineWidth
|
|
MGPipeFieldEmitter::CreateRenderState, // GetLogicOp
|
|
MGPipeFieldEmitter::SetSamplerViews, // GetMaxTouchedTextureUnit
|
|
MGPipeFieldEmitter::CreateRenderState, // GetMinSampleShadingValue
|
|
MGPipeFieldEmitter::SetPatchState, // GetPatchDefaultInnerLevel
|
|
MGPipeFieldEmitter::SetPatchState, // GetPatchDefaultOuterLevel
|
|
MGPipeFieldEmitter::SetPatchState, // GetPatchVertices
|
|
MGPipeFieldEmitter::BindRenderState, // GetPipelineStateVersion
|
|
MGPipeFieldEmitter::kNone, // GetPixelStoreParameters
|
|
MGPipeFieldEmitter::CreateRenderState, // GetPolygonModeFront
|
|
MGPipeFieldEmitter::SetDynamicState, // GetPolygonOffsetFactor
|
|
MGPipeFieldEmitter::SetDynamicState, // GetPolygonOffsetUnits
|
|
MGPipeFieldEmitter::SetDynamicState, // GetPrimitiveRestartIndex
|
|
MGPipeFieldEmitter::SetDispatchProgram, // GetProgramForDispatch
|
|
MGPipeFieldEmitter::SetDrawProgram, // GetProgramForDraw
|
|
MGPipeFieldEmitter::kNone, // GetProgramObject
|
|
MGPipeFieldEmitter::CreateRenderState, // GetProvokingVertexMode
|
|
MGPipeFieldEmitter::CreateRenderState, // GetRenderStateParameters
|
|
MGPipeFieldEmitter::BindRenderState, // GetRenderStateParametersVersion
|
|
MGPipeFieldEmitter::kNone, // GetSamplingResolutionGeneration
|
|
MGPipeFieldEmitter::SetDynamicState, // GetScissorBox
|
|
MGPipeFieldEmitter::CreateRenderState, // GetStencilState
|
|
MGPipeFieldEmitter::kNone, // GetTextureBindGeneration
|
|
MGPipeFieldEmitter::kNone, // GetTextureContextId
|
|
MGPipeFieldEmitter::kNone, // GetTextureObject
|
|
MGPipeFieldEmitter::SetSamplerViews, // GetTextureUnitObject
|
|
MGPipeFieldEmitter::kNone, // GetTransformFeedbackCapturedVertices
|
|
MGPipeFieldEmitter::kNone, // GetTransformFeedbackGeneration
|
|
MGPipeFieldEmitter::kNone, // GetTransformFeedbackPausedPrimitiveCounter
|
|
MGPipeFieldEmitter::kNone, // GetTransformFeedbackProgram
|
|
MGPipeFieldEmitter::SetDynamicState, // GetViewport
|
|
MGPipeFieldEmitter::SetDynamicState, // GetViewportIndexed
|
|
MGPipeFieldEmitter::CreateRenderState, // IsCapabilityEnabled
|
|
MGPipeFieldEmitter::CreateRenderState, // IsCapabilityEnabledIndexed
|
|
MGPipeFieldEmitter::kNone, // IsTransformFeedbackActive
|
|
MGPipeFieldEmitter::kNone, // IsTransformFeedbackPaused
|
|
MGPipeFieldEmitter::kNone, // InvalidateCompileEnv
|
|
MGPipeFieldEmitter::kNone, // ValidateProgramName
|
|
MGPipeFieldEmitter::kNone, // RecordError
|
|
MGPipeFieldEmitter::kNone, // GetBoundTransformFeedbackLifetimeId
|
|
MGPipeFieldEmitter::kNone, // HasOpenTransformFeedbackSpan
|
|
};
|
|
inline constexpr SizeT kMGPipeEmittedFieldCount = 40;
|
|
|
|
struct MGPipeFilledState {
|
|
Uint64 CurrentVerbSerial;
|
|
Uint64 FilledGen[kMGPipeInputFieldCount];
|
|
};
|
|
|
|
[[noreturn]] inline void MGPipeInputPoisonFatal(MGPipeInputField field, const char* verb) {
|
|
MGLOG_F("MGPipe: Fatal{UnmigratedPipeInput, \"%s@%s\"}",
|
|
kMGPipeInputFieldNames[static_cast<SizeT>(field)], verb);
|
|
std::abort();
|
|
}
|
|
|
|
// FilledGen == 0 is "never filled" on BOTH branches: before the first MGPipeFillForVerb the
|
|
// serial is 0 as well, and a read in that window is the poison's "<Field>@<none>" case
|
|
// (P1 brief D6), never a fresh read of default-constructed storage.
|
|
inline Bool MGPipeInputFieldIsFresh(const MGPipeFilledState& state, MGPipeInputField field) {
|
|
const SizeT index = static_cast<SizeT>(field);
|
|
const Uint64 gen = state.FilledGen[index];
|
|
if (gen == 0) return false;
|
|
return kMGPipeInputFieldSticky[index] || gen == state.CurrentVerbSerial;
|
|
}
|