mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-17 15:03:25 +09:00
[MG_Backend, MG_IntegrationTest, MG_Test] (P7): a multisample depth or stencil buffer resolves on a device with no resolve extension, and the sample-count shapes with no arm decline
CONTRACT-P7 §3.2's `multisample-blit-aspect@P7`, the last `@P7` refusal in the tree.
Two halves again, and neither is the other's fallback.
THE HALF WITH AN ARM. vkCmdResolveImage is COLOUR ONLY. The one way Vulkan
resolves a depth or stencil aspect without a shader is a render pass with a
depth/stencil resolve attachment, which needs VK_KHR_create_renderpass2 and
VK_KHR_depth_stencil_resolve - and a device with neither ended the session at
`Magma:multisample-depth-resolve-capability` on the first
glBlitFramebuffer(GL_DEPTH_BUFFER_BIT) out of a multisampled read framebuffer,
which is what every multisample depth resolve in GL is. §3.2 names the second arm
and this is it: WireMultisampleResolve.inc, three baked modules (one vertex stage,
one fragment stage per aspect), fetching SAMPLE ZERO - the same sample
VK_RESOLVE_MODE_SAMPLE_ZERO_BIT picks, so the two arms answer identically and the
lane can assert that.
The pass carries nothing: the scratch has the source's extent and coordinate
space, so the fragment stage indexes by gl_FragCoord and the rectangle is the
scissor. No push constants, no varyings, no frontend object. The stencil half
needs VK_EXT_shader_stencil_export to exist at all (a fragment shader cannot write
the stencil aspect otherwise); where it is absent the arm declines stencil rather
than leaving the aspect undefined, and the module is not even created, because
handing vkCreateShaderModule SPIR-V with an unsupported capability is undefined
rather than an error.
The two capability tests are deliberately not the same test: the subpass resolves
every aspect the FORMAT has and needs a mode for each, while the pass writes only
the aspect this blit asked for - which is safe because the copy-out reads exactly
that aspect.
THE HALF WITH NO ARM. Sample counts that differ with the DESTINATION multisampled:
one sample fanned out to N, or N reduced to M. vkCmdResolveImage only ever writes
a single-sample destination, vkCmdBlitImage refuses a multisampled side, and
vkCmdCopyImage needs the counts equal. Rule I (a): name both counts, record
INVALID_OPERATION, leave the destination alone.
Lanes. DepthStencilReadbackMatrixScenario.AResolvedMultisampleDepth… is PROMOTED
from the informational tier into the three gated Magma arms - it already owns the
observable (clear a 4x DEPTH24_STENCIL8, resolve with glBlitFramebuffer, read both
aspects back, check that a depth-only resolve left the destination's stencil alone
and vice versa), it just had no gated entry. Two entries over it per arm: plain,
and under MGITEST_MAGMA_FORCE_SHADER_DEPTH_RESOLVE, which is the only way the new
arm is reachable here at all - lavapipe carries BOTH resolve extensions, so the
extension arm answers every resolve on this host. The new F1 case is the decline.
It does NOT skip on this host: the shader arm resolves depth and stencil, because
lavapipe also carries VK_EXT_shader_stencil_export.
Three rows join MOBILEGL_BAKED_INTERNAL_SHADERS (8 -> 11).
Red once (R-16, executed and reverted), three times:
* restore MagmaWireFatal("multisample-depth-resolve-capability") for the
non-extension arm -> DirectVulkan.Split.MsResolve1.… dies by that name while
MsResolve0 stays green, which is also the proof that the knob routes;
* restore MagmaWireFatal("multisample-blit-aspect@P7") ->
DirectVulkan.Split.MsBlit.…FromASingleSampleSourceDeclines… dies by that name;
* fetch sample 1 instead of 0 in WireMultisampleStencilResolve.frag (no rebuild -
the gate reads the source at run time) -> WireMultisampleStencilResolveFragment
reds at word 158, naming the symbol, the header and the regeneration command.
Reverted, 15/15 green on the three arms and 11/11 on the freshness gate.
`grep -rn "@P7" MobileGL/ --include=*.cpp --include=*.inc --include=*.h` now
returns COMMENTS ONLY - 19 lines, every one of them prose about a retirement or a
red-once. No refusal in the tree carries the mark any more.
Gates: integration-magma-split 93 (+3), -spawn 72 (+3), -tcp 74 (+3),
integration-magma-full-split 524 (+1), ctest -L unit 2423 (+3), all green;
bake_internal_shaders.py --check reports all five headers fresh; fatal_census 79
abort sites / 44 family words / 0 unmarked; link_ratchet --assert-monotone
unchanged at 186; G1 pull .text 0xa52203, nm --defined-only identical to
p7-before/pull-syms.txt (30570 lines, 0 diffs) - every line lives under
`#if MOBILEGL_BUILD_DISAGGREGATED` or in the test tree.
Device debt: the shader arm is the arm the PHONE takes wherever
VK_KHR_depth_stencil_resolve is missing, and this host can only reach it through
the knob. Its geometry needs one look on the Redmi.
This commit is contained in:
@@ -3091,7 +3091,8 @@ if (MOBILEGL_BUILD_DISAGGREGATED)
|
||||
# NO KNOB: every driver that can host a 4x multisample RGBA8 renderbuffer reaches both
|
||||
# entries with the plain Fm environment, and one that cannot says so as a SKIP.
|
||||
foreach(multisampleBlitCase MultisampleColorBlitScalesAndFlipsThroughTheResolveScratch
|
||||
MultisampleBlitOntoAMultisampleDestinationDeclinesAndKeepsTheSession)
|
||||
MultisampleBlitOntoAMultisampleDestinationDeclinesAndKeepsTheSession
|
||||
MultisampleBlitFromASingleSampleSourceDeclinesAndKeepsTheSession)
|
||||
gtest_discover_tests(MobileGLIntegrationTest
|
||||
TEST_PREFIX "DirectVulkan.${mglItestArm}.MsBlit."
|
||||
TEST_FILTER "F1WireScenario.${multisampleBlitCase}"
|
||||
@@ -3100,6 +3101,35 @@ if (MOBILEGL_BUILD_DISAGGREGATED)
|
||||
${mglItestArmProperties}
|
||||
ENVIRONMENT "${mglItestMagmaWireEnvironment}\;MOBILEGL_LOG_FILE_PATH=${CMAKE_CURRENT_BINARY_DIR}/p7-msblit${mglItestArmLogTag}-${multisampleBlitCase}.log")
|
||||
endforeach()
|
||||
# ---- P7 wave 2-B2: `multisample-blit-aspect@P7`'s retirement, BOTH ARMS ---------------
|
||||
#
|
||||
# THE CASE IS PROMOTED, NOT WRITTEN. DepthStencilReadbackMatrixScenario already owns the
|
||||
# observable - clear a 4x multisample DEPTH24_STENCIL8 renderbuffer, resolve it into a
|
||||
# single-sampled framebuffer with glBlitFramebuffer, read both aspects back, and check
|
||||
# that a depth-only resolve left the destination's stencil alone and vice versa - and it
|
||||
# already ran on these three arms in the INFORMATIONAL tier (`…Full.`). What it did not
|
||||
# have was a gated entry, which is what CONTRACT-P7 §3.2's aspect row needs.
|
||||
#
|
||||
# TWO ENTRIES OVER ONE CASE, and the second is the only way its arm is reachable here:
|
||||
# lavapipe carries VK_KHR_create_renderpass2 AND VK_KHR_depth_stencil_resolve, so the
|
||||
# extension arm answers every resolve on this host and the shader pass - which exists FOR
|
||||
# the device that has neither, where the session used to end at
|
||||
# `Magma:multisample-depth-resolve-capability` - would never execute.
|
||||
# MGITEST_MAGMA_FORCE_SHADER_DEPTH_RESOLVE drops the extension arm, and the two entries
|
||||
# then assert the same depth values and the same stencil indices, which is the whole
|
||||
# claim: sample zero either way.
|
||||
#
|
||||
# ITS OWN ENTRIES RATHER THAN A LANE-WIDE FLIP, the shader-mip block's reason: the knob
|
||||
# changes how EVERY depth/stencil resolve in the process is performed.
|
||||
foreach(shaderDepthResolve 0 1)
|
||||
gtest_discover_tests(MobileGLIntegrationTest
|
||||
TEST_PREFIX "DirectVulkan.${mglItestArm}.MsResolve${shaderDepthResolve}."
|
||||
TEST_FILTER "DepthStencilReadbackMatrixScenario.AResolvedMultisampleDepthReadsBackFromTheDestination"
|
||||
DISCOVERY_TIMEOUT 30
|
||||
PROPERTIES LABELS "${mglItestMagmaLabels}" TIMEOUT ${MGL_ITEST_TIMEOUT}
|
||||
${mglItestArmProperties}
|
||||
ENVIRONMENT "${mglItestMagmaWireEnvironment}\;MGITEST_MAGMA_FORCE_SHADER_DEPTH_RESOLVE=${shaderDepthResolve}\;MOBILEGL_LOG_FILE_PATH=${CMAKE_CURRENT_BINARY_DIR}/p7-msresolve${mglItestArmLogTag}-shader${shaderDepthResolve}.log")
|
||||
endforeach()
|
||||
foreach(inPlaceCase CopyImageInPlaceAcrossLevelsAndLayers
|
||||
CopyImageInPlaceOverlapDeclinesAndLeavesTheLevelAlone)
|
||||
gtest_discover_tests(MobileGLIntegrationTest
|
||||
|
||||
@@ -1837,6 +1837,84 @@ TEST_F(F1WireScenario, MultisampleBlitOntoAMultisampleDestinationDeclinesAndKeep
|
||||
Gl().EndFrame();
|
||||
}
|
||||
|
||||
// P7 wave 2-B2, CONTRACT-P7 §3.2: the surviving half of `multisample-blit-aspect@P7`.
|
||||
//
|
||||
// The half WITH an arm is ResolveWireDepthStencil's: a multisample depth or stencil source now
|
||||
// reaches a single-sample destination on every device - through VK_KHR_depth_stencil_resolve
|
||||
// where it exists, through WireMultisampleResolve.inc's baked pass where it does not - and the
|
||||
// two MsResolve entries on each arm are its reading. This is the half with none.
|
||||
//
|
||||
// ONE SAMPLE INTO FOUR, with rectangles that MATCH so the shape decline next door is not what
|
||||
// fires. Vulkan has no command for it: vkCmdResolveImage only ever writes a single-sample
|
||||
// destination, vkCmdBlitImage refuses a multisampled side outright, and vkCmdCopyImage needs
|
||||
// the two counts to be equal. GL 4.6 core 18.3.1 calls this sample replication and the wire arm
|
||||
// declines it by name rather than ending the session over it.
|
||||
//
|
||||
// Red once (executed, reverted): restore MagmaWireFatal("multisample-blit-aspect@P7") and this
|
||||
// case dies as Fatal{UnmigratedVerb, "Magma:multisample-blit-aspect@P7"}.
|
||||
TEST_F(F1WireScenario, MultisampleBlitFromASingleSampleSourceDeclinesAndKeepsTheSession) {
|
||||
if (!Ready()) return;
|
||||
GLuint msFbo = 0, msRenderbuffer = 0;
|
||||
glGenFramebuffers(1, &msFbo);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, msFbo);
|
||||
glGenRenderbuffers(1, &msRenderbuffer);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, msRenderbuffer);
|
||||
glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_RGBA8, 4, 2);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, msRenderbuffer);
|
||||
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GLenum(GL_FRAMEBUFFER_COMPLETE)) {
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
||||
glDeleteFramebuffers(1, &msFbo);
|
||||
glDeleteRenderbuffers(1, &msRenderbuffer);
|
||||
GTEST_SKIP() << "this driver cannot host a 4x multisample RGBA8 renderbuffer";
|
||||
}
|
||||
while (glGetError() != GLenum(GL_NO_ERROR)) {}
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
glClearColor(1, 0, 1, 1); // magenta: the colour the declined blit must leave behind
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
ASSERT_EQ(FirstGLError(), GLenum(GL_NO_ERROR)) << "F1.MsAspectDecline.setup";
|
||||
|
||||
constexpr GLfloat kYellow[4]{1, 1, 0, 1};
|
||||
GLuint srcFbo = 0, srcTexture = 0;
|
||||
MakeSingleSampleTarget(4, 2, kYellow, srcFbo, srcTexture);
|
||||
ASSERT_EQ(glCheckFramebufferStatus(GL_FRAMEBUFFER), GLenum(GL_FRAMEBUFFER_COMPLETE));
|
||||
ASSERT_EQ(FirstGLError(), GLenum(GL_NO_ERROR)) << "F1.MsAspectDecline.source";
|
||||
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, srcFbo);
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, msFbo);
|
||||
const auto before = PeekSplitRuntime().emitSeq;
|
||||
glBlitFramebuffer(0, 0, 4, 2, 0, 0, 4, 2, GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||
EXPECT_GT(PeekSplitRuntime().emitSeq, before) << "F1.MsAspectDecline.wire";
|
||||
glFinish(); // the decline's error rides a later reply - see the shape case next door
|
||||
EXPECT_EQ(FirstGLError(), GLenum(GL_INVALID_OPERATION))
|
||||
<< "F1.MsAspectDecline: the decline must record the error GL names for the shape";
|
||||
|
||||
constexpr GLfloat kBlue[4]{0, 0, 1, 1};
|
||||
GLuint readFbo = 0, readTexture = 0;
|
||||
MakeSingleSampleTarget(4, 2, kBlue, readFbo, readTexture);
|
||||
ASSERT_EQ(glCheckFramebufferStatus(GL_FRAMEBUFFER), GLenum(GL_FRAMEBUFFER_COMPLETE));
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, msFbo);
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, readFbo);
|
||||
glBlitFramebuffer(0, 0, 4, 2, 0, 0, 4, 2, GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||
EXPECT_EQ(FirstGLError(), GLenum(GL_NO_ERROR)) << "F1.MsAspectDecline.resolve";
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, readFbo);
|
||||
constexpr std::array<GLubyte, 4> kMagenta{255, 0, 255, 255};
|
||||
for (int y = 0; y < 2; ++y)
|
||||
for (int x = 0; x < 4; ++x)
|
||||
EXPECT_EQ(ReadOnePixel(x, y), kMagenta)
|
||||
<< "F1.MsAspectDecline: the declined blit wrote (" << x << "," << y << ")";
|
||||
EXPECT_EQ(FirstGLError(), GLenum(GL_NO_ERROR)) << "F1.MsAspectDecline: the session survived";
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
||||
glDeleteFramebuffers(1, &readFbo);
|
||||
glDeleteTextures(1, &readTexture);
|
||||
glDeleteFramebuffers(1, &srcFbo);
|
||||
glDeleteTextures(1, &srcTexture);
|
||||
glDeleteFramebuffers(1, &msFbo);
|
||||
glDeleteRenderbuffers(1, &msRenderbuffer);
|
||||
glBindTexture(GL_TEXTURE_2D, texture);
|
||||
Gl().EndFrame();
|
||||
}
|
||||
|
||||
namespace {
|
||||
// One 8x8x2 RGBA8 array texture with two levels, filled so that EVERY subresource this pair
|
||||
// of cases touches is distinguishable from every other one. A flat fill would let a copy that
|
||||
|
||||
Reference in New Issue
Block a user