[Feat] (MG_Pipe, P5b): append the five P5b verb rows at opcodes 72..76, arm draw_vbo with the kDrawIsIndirect second tail, give resource_copy_region its two GL names and the clear discriminants one spelling, and stamp every P5b verb boundary

This commit is contained in:
2026-09-16 11:15:45 -04:00
parent c9878d69f3
commit 4dd4027e80
9 changed files with 447 additions and 27 deletions
@@ -281,12 +281,18 @@ constexpr MGPipeVerb MGPipeVerbForWireOp(MGPWireOp op) {
case MGPWireOp::ResumeStreamOutput: return MGPipeVerb::ResumeTransformFeedback;
case MGPWireOp::GenerateMipmap: return MGPipeVerb::GenerateMipmap;
case MGPWireOp::GetTextureImage: return MGPipeVerb::GetTextureImage;
case MGPWireOp::ResourceCopyRegion: return MGPipeVerb::CopyImageSubData;
case MGPWireOp::BindShaderImage: return MGPipeVerb::BindImageTexture;
case MGPWireOp::PatchParameter: return MGPipeVerb::PatchParameteri;
case MGPWireOp::BindStreamOutput: return MGPipeVerb::BindTransformFeedback;
case MGPWireOp::SetStorageBlockBinding: return MGPipeVerb::ShaderStorageBlockBinding;
case MGPWireOp::CopyFramebufferToTexture: return MGPipeVerb::CopyTexImage2D;
default:
return MGPipeVerb::kVerbCount;
}
}
inline constexpr SizeT kMGPipeVerbBoundaryOpCount = 12;
inline constexpr SizeT kMGPipeVerbBoundaryOpCount = 18;
inline constexpr SizeT kMGPipeVerbBoundaryExemptCount = 3;
// The class sizes, as constants a test can pin without recounting the table.
+8 -3
View File
@@ -28,7 +28,7 @@ struct MGPipeScreen {
void (*FenceWaitServer)(const MGPFenceWait* payload);
};
// context: 60 calls. A null entry means the backend does not implement this
// context: 65 calls. A null entry means the backend does not implement this
// call and the frontend keeps its own path (plan B section 4.1).
struct MGPipeContext {
void (*QueryCreate)(const MGPQueryDesc* payload);
@@ -91,11 +91,16 @@ struct MGPipeContext {
void (*SetSwapInterval)(const MGPSwapInterval* payload);
void (*QueryTimestamp)(const MGPTimestampRequest* payload, MGPReplySlot* reply);
void (*QueryCounter)(const MGPQueryDesc* payload);
void (*BindShaderImage)(const MGPImageBind* payload);
void (*PatchParameter)(const MGPPatchParameter* payload);
void (*BindStreamOutput)(const MGPStreamOutputBind* payload);
void (*SetStorageBlockBinding)(const MGPStorageBlockBinding* payload, const void* blobBytes, Uint64 blobByteCount);
void (*CopyFramebufferToTexture)(const MGPCopyFromFramebuffer* payload);
};
inline constexpr SizeT kMGPipeScreenCallCount = 11;
inline constexpr SizeT kMGPipeContextCallCount = 60;
inline constexpr SizeT kMGPipeCallCount = 71;
inline constexpr SizeT kMGPipeContextCallCount = 65;
inline constexpr SizeT kMGPipeCallCount = 76;
// A table that is not exactly its call count of function pointers has grown a
// member that no generator knows about.
+20
View File
@@ -300,3 +300,23 @@ inline void MGP_QueryCounter(const MGPQueryDesc* payload) {
inline void MGP_FenceWaitServer(const MGPFenceWait* payload) {
gMGPipeScreen.FenceWaitServer(payload);
}
inline void MGP_BindShaderImage(const MGPImageBind* payload) {
gMGPipeContext.BindShaderImage(payload);
}
inline void MGP_PatchParameter(const MGPPatchParameter* payload) {
gMGPipeContext.PatchParameter(payload);
}
inline void MGP_BindStreamOutput(const MGPStreamOutputBind* payload) {
gMGPipeContext.BindStreamOutput(payload);
}
inline void MGP_SetStorageBlockBinding(const MGPStorageBlockBinding* payload, const void* blobBytes, Uint64 blobByteCount) {
gMGPipeContext.SetStorageBlockBinding(payload, blobBytes, blobByteCount);
}
inline void MGP_CopyFramebufferToTexture(const MGPCopyFromFramebuffer* payload) {
gMGPipeContext.CopyFramebufferToTexture(payload);
}
+41 -1
View File
@@ -107,6 +107,11 @@ inline Bool MGPipeVerify(const MGPFlush& a, const MGPFlush& b, const char** outF
inline Bool MGPipeVerify(const MGPPresent& a, const MGPPresent& b, const char** outField);
inline Bool MGPipeVerify(const MGPSwapInterval& a, const MGPSwapInterval& b, const char** outField);
inline Bool MGPipeVerify(const MGPSurfaceInfo& a, const MGPSurfaceInfo& b, const char** outField);
inline Bool MGPipeVerify(const MGPImageBind& a, const MGPImageBind& b, const char** outField);
inline Bool MGPipeVerify(const MGPPatchParameter& a, const MGPPatchParameter& b, const char** outField);
inline Bool MGPipeVerify(const MGPStreamOutputBind& a, const MGPStreamOutputBind& b, const char** outField);
inline Bool MGPipeVerify(const MGPStorageBlockBinding& a, const MGPStorageBlockBinding& b, const char** outField);
inline Bool MGPipeVerify(const MGPCopyFromFramebuffer& a, const MGPCopyFromFramebuffer& b, const char** outField);
inline Bool MGPipeVerify(const RenderStateParameters& a, const RenderStateParameters& b, const char** outField);
inline Bool MGPipeVerify(const PixelStoreParameters& a, const PixelStoreParameters& b, const char** outField);
inline Bool MGPipeVerify(const SamplerParameters& a, const SamplerParameters& b, const char** outField);
@@ -244,6 +249,16 @@ struct MGPipeHasFieldVerifier<MGPSwapInterval> : std::true_type {};
template <>
struct MGPipeHasFieldVerifier<MGPSurfaceInfo> : std::true_type {};
template <>
struct MGPipeHasFieldVerifier<MGPImageBind> : std::true_type {};
template <>
struct MGPipeHasFieldVerifier<MGPPatchParameter> : std::true_type {};
template <>
struct MGPipeHasFieldVerifier<MGPStreamOutputBind> : std::true_type {};
template <>
struct MGPipeHasFieldVerifier<MGPStorageBlockBinding> : std::true_type {};
template <>
struct MGPipeHasFieldVerifier<MGPCopyFromFramebuffer> : std::true_type {};
template <>
struct MGPipeHasFieldVerifier<RenderStateParameters> : std::true_type {};
template <>
struct MGPipeHasFieldVerifier<PixelStoreParameters> : std::true_type {};
@@ -622,6 +637,31 @@ inline Bool MGPipeVerify(const MGPSurfaceInfo& a, const MGPSurfaceInfo& b, const
return true;
}
inline Bool MGPipeVerify(const MGPImageBind& a, const MGPImageBind& b, const char** outField) {
MGP_FIELDS_MGPImageBind(MGP_VERIFY_FIELD)
return true;
}
inline Bool MGPipeVerify(const MGPPatchParameter& a, const MGPPatchParameter& b, const char** outField) {
MGP_FIELDS_MGPPatchParameter(MGP_VERIFY_FIELD)
return true;
}
inline Bool MGPipeVerify(const MGPStreamOutputBind& a, const MGPStreamOutputBind& b, const char** outField) {
MGP_FIELDS_MGPStreamOutputBind(MGP_VERIFY_FIELD)
return true;
}
inline Bool MGPipeVerify(const MGPStorageBlockBinding& a, const MGPStorageBlockBinding& b, const char** outField) {
MGP_FIELDS_MGPStorageBlockBinding(MGP_VERIFY_FIELD)
return true;
}
inline Bool MGPipeVerify(const MGPCopyFromFramebuffer& a, const MGPCopyFromFramebuffer& b, const char** outField) {
MGP_FIELDS_MGPCopyFromFramebuffer(MGP_VERIFY_FIELD)
return true;
}
inline Bool MGPipeVerify(const RenderStateParameters& a, const RenderStateParameters& b, const char** outField) {
MGP_FIELDS_RenderStateParameters(MGP_VERIFY_FIELD)
return true;
@@ -669,4 +709,4 @@ inline Bool MGPipeVerify(const MGPVertexBindingPointWire& a, const MGPVertexBind
#undef MGP_VERIFY_FIELD
inline constexpr SizeT kMGPipeVerifiedPayloadCount = 72;
inline constexpr SizeT kMGPipeVerifiedPayloadCount = 77;
+66 -1
View File
@@ -141,7 +141,12 @@ enum class MGPWireOp : Uint16 {
QueryTimestamp = 69,
QueryCounter = 70,
FenceWaitServer = 71,
kOpCount = 72,
BindShaderImage = 72,
PatchParameter = 73,
BindStreamOutput = 74,
SetStorageBlockBinding = 75,
CopyFramebufferToTexture = 76,
kOpCount = 77,
};
// THE FLAGS, EXPORTED ONCE, INDEXED BY OPCODE (P5 R-13.4). MGPWireRecHeader::Flags is
@@ -234,6 +239,11 @@ inline constexpr Uint32 kMGPipeCallFlags[static_cast<SizeT>(MGPWireOp::kOpCount)
/* 69 QueryTimestamp */ static_cast<Uint32>(kReplySlot),
/* 70 QueryCounter */ static_cast<Uint32>(kNone),
/* 71 FenceWaitServer */ static_cast<Uint32>(kNone),
/* 72 BindShaderImage */ static_cast<Uint32>(kNone),
/* 73 PatchParameter */ static_cast<Uint32>(kNone),
/* 74 BindStreamOutput */ static_cast<Uint32>(kNone),
/* 75 SetStorageBlockBinding */ static_cast<Uint32>(kHasBlob),
/* 76 CopyFramebufferToTexture*/ static_cast<Uint32>(kNone),
};
static_assert(sizeof(kMGPipeCallFlags) / sizeof(kMGPipeCallFlags[0]) ==
static_cast<SizeT>(MGPWireOp::kOpCount),
@@ -855,6 +865,46 @@ static_assert(sizeof(MGPWireRec_FenceWaitServer) ==
((sizeof(MGPWireRecHeader) + sizeof(MGPFenceWait) + 7u) & ~SizeT(7u)),
"MGPWireRec_FenceWaitServer gained padding; the wire format moved");
struct alignas(8) MGPWireRec_BindShaderImage {
MGPWireRecHeader Header;
MGPImageBind Payload;
};
static_assert(sizeof(MGPWireRec_BindShaderImage) ==
((sizeof(MGPWireRecHeader) + sizeof(MGPImageBind) + 7u) & ~SizeT(7u)),
"MGPWireRec_BindShaderImage gained padding; the wire format moved");
struct alignas(8) MGPWireRec_PatchParameter {
MGPWireRecHeader Header;
MGPPatchParameter Payload;
};
static_assert(sizeof(MGPWireRec_PatchParameter) ==
((sizeof(MGPWireRecHeader) + sizeof(MGPPatchParameter) + 7u) & ~SizeT(7u)),
"MGPWireRec_PatchParameter gained padding; the wire format moved");
struct alignas(8) MGPWireRec_BindStreamOutput {
MGPWireRecHeader Header;
MGPStreamOutputBind Payload;
};
static_assert(sizeof(MGPWireRec_BindStreamOutput) ==
((sizeof(MGPWireRecHeader) + sizeof(MGPStreamOutputBind) + 7u) & ~SizeT(7u)),
"MGPWireRec_BindStreamOutput gained padding; the wire format moved");
struct alignas(8) MGPWireRec_SetStorageBlockBinding {
MGPWireRecHeader Header;
MGPStorageBlockBinding Payload;
};
static_assert(sizeof(MGPWireRec_SetStorageBlockBinding) ==
((sizeof(MGPWireRecHeader) + sizeof(MGPStorageBlockBinding) + 7u) & ~SizeT(7u)),
"MGPWireRec_SetStorageBlockBinding gained padding; the wire format moved");
struct alignas(8) MGPWireRec_CopyFramebufferToTexture {
MGPWireRecHeader Header;
MGPCopyFromFramebuffer Payload;
};
static_assert(sizeof(MGPWireRec_CopyFramebufferToTexture) ==
((sizeof(MGPWireRecHeader) + sizeof(MGPCopyFromFramebuffer) + 7u) & ~SizeT(7u)),
"MGPWireRec_CopyFramebufferToTexture gained padding; the wire format moved");
[[noreturn]] inline void MGPipeWireProtocolFatal(const char* call, Uint64 size, Uint64 remaining) {
MGLOG_F("MGPipe: protocol corruption applying %s: size=%llu remaining=%llu", call,
static_cast<unsigned long long>(size), static_cast<unsigned long long>(remaining));
@@ -1117,6 +1167,21 @@ inline Bool MGPipeApplyWireRecord(MGPWireOp op, const void* record, Uint64 size,
case MGPWireOp::FenceWaitServer:
MGP_WIRE_CHECK_BOUNDS(MGPWireRec_FenceWaitServer, "FenceWaitServer");
break;
case MGPWireOp::BindShaderImage:
MGP_WIRE_CHECK_BOUNDS(MGPWireRec_BindShaderImage, "BindShaderImage");
break;
case MGPWireOp::PatchParameter:
MGP_WIRE_CHECK_BOUNDS(MGPWireRec_PatchParameter, "PatchParameter");
break;
case MGPWireOp::BindStreamOutput:
MGP_WIRE_CHECK_BOUNDS(MGPWireRec_BindStreamOutput, "BindStreamOutput");
break;
case MGPWireOp::SetStorageBlockBinding:
MGP_WIRE_CHECK_BOUNDS(MGPWireRec_SetStorageBlockBinding, "SetStorageBlockBinding");
break;
case MGPWireOp::CopyFramebufferToTexture:
MGP_WIRE_CHECK_BOUNDS(MGPWireRec_CopyFramebufferToTexture, "CopyFramebufferToTexture");
break;
case MGPWireOp::kInvalid:
case MGPWireOp::kOpCount:
default: