mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 05:38:31 +09:00
184 lines
15 KiB
Modula-2
184 lines
15 KiB
Modula-2
// MobileGL - MobileGL/MG_Pipe/PipeCalls.def
|
|
// 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
|
|
|
|
// The single source of truth for the MGPipe call catalogue (plan B section 4.1 / 4.4 /
|
|
// appendix A). One line per call; seven generators consume this file
|
|
// (scripts/gen_pipe.py -> MG_Pipe/generated/*.inc) and one unit test
|
|
// (MG_Test/Pipe/PipeCatalogueTest.cpp) pins the arithmetic.
|
|
//
|
|
// X(Name, PayloadStruct, Class, Flags)
|
|
// Class : kScreen | kCtxCso | kCtxState | kCtxObject | kCtxVerb | kCtxQuery
|
|
// kScreen lands in struct MGPipeScreen, every other class in struct
|
|
// MGPipeContext (plan section 4.3).
|
|
// Flags : kNone | kNeedsAck | kHasBlob | kVarTail | kHostSpan | kReplySlot | kOptional
|
|
// kNeedsAck on a call means records of this call MAY require an ack; a
|
|
// per-record predicate decides. resource_respecify carries it for
|
|
// glBufferStorage - a real synchronous allocation, and the only entry point
|
|
// allowed a synchronous ack - and MGPipeResourceRespecifyNeedsAck(desc)
|
|
// (MGPipeTypes.h) is what says so, which is why the same call still carries
|
|
// every glBufferData without acknowledging one.
|
|
//
|
|
// RECORD NUMBERING NEVER CHURNS. Entries that are not implemented yet still occupy their
|
|
// line (plan section 11, P0: "the complete call catalogue, placeholders included"). A new
|
|
// call is APPENDED to its group; a retired call keeps its slot with a comment. The wire
|
|
// opcode is the 1-based position in this list, so reordering is a protocol break.
|
|
//
|
|
// ---------------------------------------------------------------------------------------
|
|
// COUNTS. MGP_CALL_LIST_DOCUMENTED_COUNT below is the authority; PipeCatalogueTest asserts
|
|
// that the expansion, the two generated tables and this number agree.
|
|
//
|
|
// class entries group (as the plan tabulates it)
|
|
// kScreen 11 screen: caps 1 + resource 3 + persistent map 2 + fence 4, plus the
|
|
// appended server-side fence wait 1
|
|
// kCtxQuery 8 query object namespace 6, plus the appended timestamp pair 2
|
|
// kCtxCso 13 CSO create/bind/delete
|
|
// kCtxState 17 16 of the 17 set_* calls + the temporary set_residual_value_state
|
|
// kCtxObject 9 set_texture_params (the 17th set_*) + 8 object-scoped transfers
|
|
// kCtxVerb 13 3 context-reading transfer calls + the 10 commands
|
|
// total 71
|
|
//
|
|
// Reconciliation with the plan's headline numbers (section 4.4 / appendix A), because they
|
|
// do not add up to a set of UNIQUE records and this file has to hold unique records:
|
|
// - "screen 14" tabulates the fence and query families together with the screen block.
|
|
// Section 4.3 assigns the query NAMESPACE to the context ("VAO / FBO / XFB object /
|
|
// query namespaces, the command stream, present"), so the six query calls carry
|
|
// kCtxQuery and live in MGPipeContext. Screen keeps 10 of the plan's (11 with the appended
|
|
// FenceWaitServer, below). The eight EGL lifecycle entry points stay virtual functions on
|
|
// pActiveBackendObject and are deliberately NOT calls here (section 4.4.1, last row).
|
|
// - "CSO 15" is create/bind/delete x 5 kinds. Two of those binds are ALSO named in the
|
|
// set_* catalogue as their array forms - bind_sampler_states and set_sampler_views
|
|
// (section 4.4.3) - and a call may only exist once, so they are emitted under
|
|
// kCtxState and the CSO group holds 13: create/delete x 5 plus the three remaining
|
|
// binds (render state, vertex elements, shader).
|
|
// - "transfer 12" enumerates 11 calls in section 4.4.4 plus appendix A
|
|
// (resource_subdata, buffer_subdata_resident, resource_flush_range, resource_readback,
|
|
// resource_copy_region, blit, clear, generate_mipmap, read_pixels, get_texture_image,
|
|
// resource_subdata_complete). Eleven is what is emitted; the twelfth is not named
|
|
// anywhere in the plan.
|
|
// - "about 74 items" in section 4.1 is the sum of those headline numbers, so it inherits
|
|
// the same double counting. 68 unique records was the honest total of the plan's own
|
|
// catalogue.
|
|
// - Three LIVE GLFunctionsTable entries had no carrier in it at all: GetGpuTimestampNs
|
|
// (glGetInteger64v(GL_TIMESTAMP), a synchronous server answer), QueryCounterTimestamp
|
|
// (glQueryCounter, a one-shot stamp rather than a begin/end pair) and WaitSync (the
|
|
// GPU-side wait, which FenceWait's client-side wait does not express). They are
|
|
// QueryTimestamp, QueryCounter and FenceWaitServer, APPENDED at the end of the list -
|
|
// not slotted into their groups - because the wire opcode is the position, so a record
|
|
// that arrives late goes last. 71 unique records.
|
|
// ---------------------------------------------------------------------------------------
|
|
|
|
#define MGP_CALL_LIST_DOCUMENTED_COUNT 71
|
|
|
|
// clang-format off
|
|
#define MGP_CALL_LIST(X) \
|
|
/* ---- screen: caps, resources, persistent map, fences (plan 4.4.1) ---- */ \
|
|
X(GetCaps, MGPCaps, kScreen, kReplySlot) \
|
|
X(ResourceCreate, MGPResourceDesc, kScreen, kNone) \
|
|
X(ResourceRespecify, MGPResourceDesc, kScreen, kNeedsAck) \
|
|
X(ResourceDestroy, MGPHandleOnly, kScreen, kNone) \
|
|
X(MapPersistent, MGPHandleOnly, kScreen, kReplySlot|kOptional) \
|
|
X(UnmapPersistent, MGPHandleOnly, kScreen, kOptional) \
|
|
X(FenceCreate, MGPHandleOnly, kScreen, kNone) \
|
|
X(FenceStatus, MGPHandleOnly, kScreen, kReplySlot) \
|
|
X(FenceWait, MGPFenceWait, kScreen, kReplySlot) \
|
|
X(FenceDestroy, MGPHandleOnly, kScreen, kNone) \
|
|
/* ---- context: query objects (plan 4.3 gives the namespace to the context) ---- */ \
|
|
X(QueryCreate, MGPQueryDesc, kCtxQuery, kNone) \
|
|
X(QueryBegin, MGPQueryDesc, kCtxQuery, kNone) \
|
|
X(QueryEnd, MGPQueryDesc, kCtxQuery, kNone) \
|
|
X(QueryAvailable, MGPHandleOnly, kCtxQuery, kReplySlot) \
|
|
X(QueryResult, MGPQueryResultRequest, kCtxQuery, kReplySlot) \
|
|
X(QueryDestroy, MGPHandleOnly, kCtxQuery, kNone) \
|
|
/* ---- context: CSO create/bind/delete (plan 4.4.2, 4.5.2-4.5.5) ---- */ \
|
|
X(CreateRenderState, MGPRenderStateDesc, kCtxCso, kHasBlob) \
|
|
X(BindRenderState, MGPBindRenderState, kCtxCso, kNone) \
|
|
X(DeleteRenderState, MGPHandleOnly, kCtxCso, kNone) \
|
|
X(CreateVertexElements, MGPVertexElements, kCtxCso, kHasBlob) \
|
|
X(BindVertexElements, MGPHandleOnly, kCtxCso, kNone) \
|
|
X(DeleteVertexElements, MGPHandleOnly, kCtxCso, kNone) \
|
|
X(CreateSamplerState, MGPSamplerDesc, kCtxCso, kNone) \
|
|
X(DeleteSamplerState, MGPHandleOnly, kCtxCso, kNone) \
|
|
X(CreateSamplerView, MGPSamplerView, kCtxCso, kNone) \
|
|
X(DeleteSamplerView, MGPHandleOnly, kCtxCso, kNone) \
|
|
X(CreateShaderState, MGPProgramDesc, kCtxCso, kHasBlob) \
|
|
X(BindShaderState, MGPHandleOnly, kCtxCso, kNone) \
|
|
X(DeleteShaderState, MGPHandleOnly, kCtxCso, kNone) \
|
|
/* ---- context: set_* (plan 4.4.3) ---- */ \
|
|
X(SetDynamicState, MGPDynamicState, kCtxState, kHasBlob) \
|
|
X(SetFramebufferState, MGPFramebufferState, kCtxState, kNone) \
|
|
X(SetVertexBuffers, MGPVertexBuffers, kCtxState, kVarTail) \
|
|
X(SetIndexBuffer, MGPIndexBuffer, kCtxState, kNone) \
|
|
X(SetIndirectBuffers, MGPIndirectBuffers, kCtxState, kNone) \
|
|
X(SetSamplerViews, MGPSamplerViews, kCtxState, kVarTail) \
|
|
X(BindSamplerStates, MGPSamplerStates, kCtxState, kVarTail) \
|
|
X(SetShaderImages, MGPShaderImages, kCtxState, kVarTail) \
|
|
X(SetShaderBuffers, MGPShaderBuffers, kCtxState, kVarTail|kHostSpan) \
|
|
X(SetStreamOutputTargets, MGPStreamOutputTargets, kCtxState, kVarTail) \
|
|
X(SetGlobalConstants, MGPGlobalConstants, kCtxState, kHasBlob) \
|
|
X(SetVertexAttribDefaults, MGPVertexAttribDefaults, kCtxState, kVarTail) \
|
|
X(SetPixelPackState, MGPPixelPackState, kCtxState, kNone) \
|
|
X(SetPatchState, MGPPatchState, kCtxState, kNone) \
|
|
X(SetDrawProgram, MGPHandleOnly, kCtxState, kNone) \
|
|
X(SetDispatchProgram, MGPHandleOnly, kCtxState, kNone) \
|
|
/* Migration-only carrier for Track V, retired field by field across P2..P13. Its */ \
|
|
/* retirement is a compile error: MGL_RESIDUAL_BLOCK_SIZE only ever goes DOWN and the */ \
|
|
/* final step asserts sizeof(ResidualValueBlock) == 0 (plan 6.3). */ \
|
|
X(SetResidualValueState, MGPResidualValueState, kCtxState, kHasBlob) \
|
|
/* ---- context: per-object state and transfer (plan 4.4.3 set_texture_params, 4.4.4) ---- */ \
|
|
X(SetTextureParams, MGPTextureParams, kCtxObject, kNone) \
|
|
X(ResourceSubData, MGPSubData, kCtxObject, kHasBlob|kVarTail) \
|
|
X(BufferSubDataResident, MGPSubData, kCtxObject, kHasBlob|kOptional) \
|
|
X(ResourceSubDataComplete, MGPSubDataComplete, kCtxObject, kNone) \
|
|
X(ResourceFlushRange, MGPFlushRange, kCtxObject, kNone) \
|
|
X(ResourceReadback, MGPReadback, kCtxObject, kReplySlot) \
|
|
X(ResourceCopyRegion, MGPCopyRegion, kCtxObject, kNone) \
|
|
X(GenerateMipmap, MGPMipPlan, kCtxObject, kNone) \
|
|
X(GetTextureImage, MGPReadbackInfo, kCtxObject, kReplySlot) \
|
|
/* ---- context: transfer calls that read whole-context state, and the commands ---- */ \
|
|
X(Blit, MGPBlit, kCtxVerb, kNone) \
|
|
X(Clear, MGPClear, kCtxVerb, kNone) \
|
|
X(ReadPixels, MGPReadbackInfo, kCtxVerb, kReplySlot) \
|
|
X(DrawVbo, MGPDrawInfo, kCtxVerb, kHostSpan|kVarTail) \
|
|
X(LaunchGrid, MGPGridInfo, kCtxVerb, kNone) \
|
|
X(MemoryBarrier, MGPMemoryBarrier, kCtxVerb, kNone) \
|
|
X(BeginStreamOutput, MGPStreamOutputBegin, kCtxVerb, kNone) \
|
|
X(EndStreamOutput, MGPXfbAccounting, kCtxVerb, kNone) \
|
|
X(PauseStreamOutput, MGPStreamOutputControl, kCtxVerb, kNone) \
|
|
X(ResumeStreamOutput, MGPStreamOutputControl, kCtxVerb, kNone) \
|
|
X(Flush, MGPFlush, kCtxVerb, kNone) \
|
|
X(Present, MGPPresent, kCtxVerb, kNone) \
|
|
X(SetSwapInterval, MGPSwapInterval, kCtxVerb, kOptional) \
|
|
/* ---- APPENDED. Opcodes are positional, so a late arrival goes at the END, never into ---- */ \
|
|
/* ---- its group: three live GLFunctionsTable entries the catalogue had no carrier for. ---- */ \
|
|
/* glGetInteger64v(GL_TIMESTAMP) - GetGpuTimestampNs, a synchronous server answer, which */ \
|
|
/* the reply slot carries. The query namespace is the context's (plan 4.3). */ \
|
|
X(QueryTimestamp, MGPTimestampRequest, kCtxQuery, kReplySlot) \
|
|
/* glQueryCounter(GL_TIMESTAMP) - QueryCounterTimestamp, a one-shot stamp into a query */ \
|
|
/* object, NOT a begin/end pair. Kind carries GL_TIMESTAMP. */ \
|
|
X(QueryCounter, MGPQueryDesc, kCtxQuery, kNone) \
|
|
/* glWaitSync - WaitSync, the GPU-side wait, distinct from FenceWait's client-side one. */ \
|
|
/* TimeoutNs is GL_TIMEOUT_IGNORED by contract. */ \
|
|
X(FenceWaitServer, MGPFenceWait, kScreen, kNone)
|
|
// clang-format on
|
|
|
|
// Explicitly NOT migrated (plan 4.4.6 / appendix A "explicit deletions"):
|
|
// - GetIntegeri_v / GetInteger64i_v. The six backend-owned answers they carry -
|
|
// GL_MAX_COMPUTE_WORK_GROUP_COUNT and GL_MAX_COMPUTE_WORK_GROUP_SIZE, three axes each,
|
|
// the only indexed pnames the device rather than the frontend answers - live in MGPCaps
|
|
// as DynamicBackendParameters::MaxComputeWorkGroupCount / MaxComputeWorkGroupSize, filled
|
|
// by both backends at capability init (DirectGLES from glGetIntegeri_v, DirectVulkan from
|
|
// VkPhysicalDeviceLimits) and floored by the frontend. Every other indexed pname names
|
|
// frontend state and is answered before any table is consulted.
|
|
// - GetProgramiv. GL_COMPUTE_WORK_GROUP_SIZE is a FRONTEND link artifact
|
|
// (ProgramObject::GetComputeLocalSize, what GL_Program.cpp has always answered from), not
|
|
// a backend answer at all; nothing a backend knows about a program crosses this way.
|
|
// - ShaderStorageBlockBinding (folded into MGPProgramDesc's reflection archive),
|
|
// set_pixel_unpack_state (no such state crosses the line - plan 4.6 D5), a
|
|
// compressed-format concept, pipe_transfer, and the stage dimension of set_sampler_views
|
|
// (MobileGL's texture unit space is merged, not per stage - plan 4.4.3).
|