mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-20 08:21:56 +09:00
[Merge] (MG_Remote, P5b): combine d1 draw migration with f1 i1 t2 and r2
This commit is contained in:
@@ -1972,6 +1972,102 @@ if (MOBILEGL_BUILD_DISAGGREGATED)
|
||||
)
|
||||
endforeach()
|
||||
|
||||
# ---- P5b package i1 (MG_Remote/CONTRACT-P5B.md §2 i1) --------------------------------
|
||||
#
|
||||
# THE LANE CASE THAT PROVES THE RECORDS CROSSED, and it is a RESULT and not a probe (R-16:
|
||||
# a probe may not arm against a stub). Each of these four scenarios asserts a value that
|
||||
# only exists if the verb ran on the apply thread - the texel a compute shader stored
|
||||
# through an image unit, the word glCopyImageSubData moved, the counter an atomic add left
|
||||
# behind, the block a program pipeline rebound - so a sink that DECLINED, or a client that
|
||||
# fell through to the driver, is red by the number it reads back and not by a tally.
|
||||
#
|
||||
# Before i1 every one of these aborted at the client's Fatal{UnmigratedVerb} on the first
|
||||
# glBindImageTexture / glDispatchCompute / glCopyImageSubData / glShaderStorageBlockBinding;
|
||||
# all four are green under inproc now (the census: 13 + 6 + 11 + 3 DirectGLES entries).
|
||||
# RED ONCE BY DOING X: return false from ServerVerbSink::OnLaunchGrid before the
|
||||
# gl.DispatchCompute call and UnboundImageDescriptor / AtomicCounter / ProgramPipeline all
|
||||
# read back their initial values.
|
||||
#
|
||||
# THE FILTERS ARE NARROWED TO THE CASES THAT ACTUALLY EMIT, and that is ScenarioFixture's
|
||||
# rule rather than a convenience: an armed `DirectGLES.Split.` case must move the client
|
||||
# encoder's record ordinal (ScenarioFixture.h:86), because a lane whose workload produced no
|
||||
# record is the "resolved the transport and then fell through to the driver" shape that
|
||||
# every pixel assertion is blind to. ProgramPipelineScenario's other nine cases are pure
|
||||
# name/state cases that draw nothing, so the whole-scenario filter would arm them and they
|
||||
# would be red for having nothing to say. The two named here are the ones that were
|
||||
# Fatal{UnmigratedVerb, "ShaderStorageBlockBinding"} on the c0b head.
|
||||
#
|
||||
# One block per scenario, following the three above: a `:`-separated multi-pattern
|
||||
# TEST_FILTER is unproven through gtest_discover_tests' flat PROPERTIES forwarding.
|
||||
set(MGL_SPLIT_I1_SCENARIOS
|
||||
UnboundImageDescriptorScenario # bind_shader_image (72) + launch_grid (60), 13 cases
|
||||
CopyImageLayeredScenario # resource_copy_region (53), 6 cases
|
||||
AtomicCounterScenario # launch_grid (60) + memory_barrier (61), 3 cases
|
||||
ProgramPipelineScenario) # set_storage_block_binding (75), the 2 storage-block cases
|
||||
set(MGL_SPLIT_I1_FILTER_UnboundImageDescriptorScenario "UnboundImageDescriptorScenario.*")
|
||||
set(MGL_SPLIT_I1_FILTER_CopyImageLayeredScenario "CopyImageLayeredScenario.*")
|
||||
set(MGL_SPLIT_I1_FILTER_AtomicCounterScenario "AtomicCounterScenario.*")
|
||||
set(MGL_SPLIT_I1_FILTER_ProgramPipelineScenario "ProgramPipelineScenario.*StorageBlock*")
|
||||
foreach(mglItestI1Scenario IN LISTS MGL_SPLIT_I1_SCENARIOS)
|
||||
gtest_discover_tests(MobileGLIntegrationTest
|
||||
TEST_PREFIX "DirectGLES.Split."
|
||||
TEST_LIST "MGL_SPLIT_I1_${mglItestI1Scenario}_TESTS"
|
||||
TEST_FILTER "${MGL_SPLIT_I1_FILTER_${mglItestI1Scenario}}"
|
||||
DISCOVERY_TIMEOUT 30
|
||||
PROPERTIES
|
||||
LABELS "integration-gpu\;integration-split"
|
||||
TIMEOUT ${MGL_ITEST_TIMEOUT}
|
||||
ENVIRONMENT "${MGL_ITEST_GLES_SPLIT_ENVIRONMENT}"
|
||||
)
|
||||
endforeach()
|
||||
|
||||
# ---- P5b t2: the transform-feedback spans, the XFB object bind, the patch parameter -------
|
||||
#
|
||||
# MG_Remote/CONTRACT-P5B.md §2 t2. The three P5 lanes above are the REDUCED PATH's targets
|
||||
# (a clear, a triangle, a persistent map); these two are the first lane entries whose GREEN
|
||||
# DEPENDS ON A t2 RECORD HAVING CROSSED AND BEEN APPLIED BY THE BACKEND, which is the only
|
||||
# statement a package flipping a verb can make that a unit case cannot:
|
||||
#
|
||||
# TessellationXfbCaptureScenario covers BOTH halves of t2 in one workload. Every case
|
||||
# calls glPatchParameteri(GL_PATCH_VERTICES, n) and then draws GL_PATCHES into a
|
||||
# transform-feedback capture, and asserts the CAPTURED BYTES. A patch_parameter (73)
|
||||
# that did not reach the server tessellates at the previous patch size and the capture
|
||||
# is the wrong length; a begin/end_stream_output (62/63) that did not reach it leaves
|
||||
# the buffer holding the scenario's poison value, which is what those cases print.
|
||||
# XfbCaptureBufferReuseScenario is the span family alone, across four buffer lifetimes
|
||||
# (a buffer per span, one immutable-storage buffer, one respecified buffer, a
|
||||
# respecification that changes the capture size). It is the case that would notice a
|
||||
# span whose END crossed but whose BEGIN did not, because the second span's bytes
|
||||
# would be the first span's.
|
||||
#
|
||||
# Both are DirectGLES only, deliberately, and the reason is measured rather than assumed:
|
||||
# under Magma the capture is written into the server's resident slice and there is no route
|
||||
# back, because MG_Backend/Init.cpp's ConsumedSubsystemsFor(DirectVulkan) withholds
|
||||
# kMGPipeSubsystemResources, so BufferObject::SyncGpuWrites() emits no resource_readback.
|
||||
# Every DirectVulkan XFB capture entry in the inproc census fails on exactly that (t2-v1.md
|
||||
# §"the 51"), and it retires with P7 (Magma's resource family) / P9 (the readback carrier) -
|
||||
# not here. A DirectVulkan arm of this lane would be red for a reason t2 cannot fix.
|
||||
gtest_discover_tests(MobileGLIntegrationTest
|
||||
TEST_PREFIX "DirectGLES.Split."
|
||||
TEST_LIST MGL_SPLIT_T2_TESS_TESTS
|
||||
TEST_FILTER "TessellationXfbCaptureScenario.*"
|
||||
DISCOVERY_TIMEOUT 30
|
||||
PROPERTIES
|
||||
LABELS "integration-gpu\;integration-split"
|
||||
TIMEOUT ${MGL_ITEST_TIMEOUT}
|
||||
ENVIRONMENT "${MGL_ITEST_GLES_SPLIT_ENVIRONMENT}"
|
||||
)
|
||||
gtest_discover_tests(MobileGLIntegrationTest
|
||||
TEST_PREFIX "DirectGLES.Split."
|
||||
TEST_LIST MGL_SPLIT_T2_XFB_TESTS
|
||||
TEST_FILTER "XfbCaptureBufferReuseScenario.*"
|
||||
DISCOVERY_TIMEOUT 30
|
||||
PROPERTIES
|
||||
LABELS "integration-gpu\;integration-split"
|
||||
TIMEOUT ${MGL_ITEST_TIMEOUT}
|
||||
ENVIRONMENT "${MGL_ITEST_GLES_SPLIT_ENVIRONMENT}"
|
||||
)
|
||||
|
||||
# The split half of the counting pair. MGITEST_PERSISTENT_MAP_ARM=emulated is R-6: under split
|
||||
# the adopt tier is pinned at T2, the resource owner declines every acquisition and the client
|
||||
# pushes the mapping's dirty blocks - so pmap must be non-zero and mpr must be the monolith
|
||||
@@ -2047,3 +2143,19 @@ if (MOBILEGL_BUILD_DISAGGREGATED)
|
||||
check "${CMAKE_CTEST_COMMAND}" "${CMAKE_BINARY_DIR}")
|
||||
set_tests_properties(SplitLogPaths.PrivateAndDistinct PROPERTIES LABELS "integration-split")
|
||||
endif()
|
||||
|
||||
# f1: split-only source keeps the monolith registry unchanged.
|
||||
if (MOBILEGL_BUILD_DISAGGREGATED)
|
||||
target_sources(MobileGLIntegrationTest PRIVATE Scenarios/F1WireScenario.cpp)
|
||||
foreach(f1Slot ClearBufferfi ClearBufferfv ClearBufferiv ClearBufferuiv ClearNamedFramebufferfi ClearNamedFramebufferfv ClearNamedFramebufferiv ClearNamedFramebufferuiv CopyTexImage2D CopyTexSubImage2D GenerateMipmap)
|
||||
gtest_discover_tests(MobileGLIntegrationTest
|
||||
TEST_PREFIX "DirectGLES.Split.F1."
|
||||
TEST_FILTER "F1WireScenario.${f1Slot}Pixels"
|
||||
DISCOVERY_TIMEOUT 30
|
||||
PROPERTIES
|
||||
LABELS "integration-split"
|
||||
TIMEOUT ${MGL_ITEST_TIMEOUT}
|
||||
ENVIRONMENT "${MGL_ITEST_GLES_SPLIT_ENVIRONMENT}\;MOBILEGL_LOG_FILE_PATH=${CMAKE_CURRENT_BINARY_DIR}/p5b-f1-${f1Slot}.log"
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
# Included by CTest after all GoogleTest discovery files (ID-53).
|
||||
# CTest appends ENVIRONMENT here; keep all previously discovered lane settings.
|
||||
file(MAKE_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/split-logs")
|
||||
foreach(entry IN LISTS MGL_SPLIT_CLEAR_TESTS MGL_SPLIT_TRIANGLE_TESTS MGL_SPLIT_PMAP_TESTS)
|
||||
# P5b t2's two lanes ride the same rule: one private log path per entry, or
|
||||
# SplitLogPaths.PrivateAndDistinct is red for them (ID-53).
|
||||
foreach(entry IN LISTS MGL_SPLIT_CLEAR_TESTS MGL_SPLIT_TRIANGLE_TESTS MGL_SPLIT_PMAP_TESTS
|
||||
MGL_SPLIT_T2_TESS_TESTS MGL_SPLIT_T2_XFB_TESTS)
|
||||
set_tests_properties("${entry}" PROPERTIES ENVIRONMENT
|
||||
"MOBILEGL_LOG_FILE_PATH=@CMAKE_CURRENT_BINARY_DIR@/split-logs/${entry}.log")
|
||||
endforeach()
|
||||
@@ -18,4 +21,14 @@ foreach(scenario @MGL_SPLIT_D1_SCENARIOS@)
|
||||
"MOBILEGL_LOG_FILE_PATH=@CMAKE_CURRENT_BINARY_DIR@/split-logs/${entry}.log")
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
# P5b package i1's four scenarios, the same shape as the small-ring loop above: every
|
||||
# DirectGLES.Split. entry owns exactly one absolute log path and shares it with nobody, which
|
||||
# is what SplitLogPaths.PrivateAndDistinct checks over the discovered set.
|
||||
foreach(scenario @MGL_SPLIT_I1_SCENARIOS@)
|
||||
foreach(entry IN LISTS MGL_SPLIT_I1_${scenario}_TESTS)
|
||||
set_tests_properties("${entry}" PROPERTIES ENVIRONMENT
|
||||
"MOBILEGL_LOG_FILE_PATH=@CMAKE_CURRENT_BINARY_DIR@/split-logs/${entry}.log")
|
||||
endforeach()
|
||||
endforeach()
|
||||
# PersistentMapArm retains its existing private path and RESOURCE_LOCK: b1 reads it.
|
||||
|
||||
@@ -19,10 +19,21 @@
|
||||
|
||||
#include <MG_Remote/Client/ClientSession.h>
|
||||
#include <MG_Remote/Client/EmitTables.h>
|
||||
#include <MG_Remote/Server/ServerLoop.h>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
#define MGITEST_SPLIT_RUNTIME_PEEK_LIVE 1
|
||||
#endif
|
||||
|
||||
namespace MGITest {
|
||||
void DelaySplitRetirementForTesting(bool enabled) {
|
||||
#if defined(MGITEST_SPLIT_RUNTIME_PEEK_LIVE)
|
||||
MobileGL::MG_Remote::Server::ServerLoopInstance().SetBeforeRetireHookForTesting(
|
||||
enabled ? +[] { std::this_thread::sleep_for(std::chrono::milliseconds(30)); } : nullptr);
|
||||
#else
|
||||
(void)enabled;
|
||||
#endif
|
||||
}
|
||||
|
||||
SplitRuntimeState PeekSplitRuntime() {
|
||||
SplitRuntimeState state;
|
||||
|
||||
@@ -91,9 +91,8 @@ namespace MGITest {
|
||||
// than asserted: a uniform record stride over a power-of-two ring lands on the
|
||||
// boundary exactly and never straddles it.
|
||||
//
|
||||
// stageReclaimWaits: SEG_STAGE allocations that only fitted after the encoder reclaimed
|
||||
// what the server had retired - P5's one real producer wait (see PipeWireCodec.h for
|
||||
// why the command ring has none while the verb barrier is armed).
|
||||
// stageReclaimWaits: allocations blocked after immediate reclamation failed;
|
||||
// already-retired bytes reclaimed lazily do not count as a wait.
|
||||
unsigned long long maxRecordBytes = 0;
|
||||
unsigned long long maxRecordBytesCap = 0;
|
||||
unsigned long long cmdWraps = 0;
|
||||
@@ -103,6 +102,8 @@ namespace MGITest {
|
||||
};
|
||||
|
||||
SplitRuntimeState PeekSplitRuntime();
|
||||
// Scheduling-only perturbation; never changes a watermark or counter.
|
||||
void DelaySplitRetirementForTesting(bool enabled);
|
||||
|
||||
// Empty when this process is a real split run that can be asserted about; otherwise the
|
||||
// reason to GTEST_SKIP() with, naming the first fact that is not true and the package that
|
||||
|
||||
@@ -134,6 +134,9 @@ namespace MGITest::WireLedger {
|
||||
"kSmallRingLaneCmdByteTarget, which is sized for the 1 MiB ring this lane "
|
||||
"declares (MGL_ITEST_GLES_SPLIT_SMALL_RING_ENVIRONMENT); a larger ring needs a "
|
||||
"larger workload and is not what this lane is for";
|
||||
EXPECT_GE(state.stageReclaimWaits, 1u)
|
||||
<< where << ": exit gate E3(e) - producer NEVER WAITED for staging retirement; "
|
||||
"lazy reclamation of already-retired bytes is not back-pressure";
|
||||
::testing::Test::RecordProperty("ring_wraps", static_cast<int>(state.cmdWraps));
|
||||
::testing::Test::RecordProperty("ring_wrap_pads", static_cast<int>(state.cmdWrapPads));
|
||||
::testing::Test::RecordProperty("ring_waits", static_cast<int>(state.stageReclaimWaits));
|
||||
|
||||
@@ -68,6 +68,14 @@ def main():
|
||||
for n in selected for c in by_name[n])
|
||||
if not_failed:
|
||||
raise ValueError(f"{label} control: {not_failed} selected entries did not fail")
|
||||
elif mode == "assertion":
|
||||
cases = ET.parse(sys.argv[4]).getroot().findall(".//testcase")
|
||||
by_name = {case.get("name"): case for case in cases}
|
||||
for name in selected:
|
||||
case = by_name.get(name)
|
||||
output = "" if case is None else " ".join(" ".join(case.itertext()).split())
|
||||
if not re.search(sys.argv[5], output):
|
||||
raise ValueError(f"E3(a) FAILED: {name} red lacks its persistent-map push diagnostic")
|
||||
elif mode == "evidence":
|
||||
missing = []
|
||||
label = sys.argv[5] if len(sys.argv) > 5 else ""
|
||||
|
||||
@@ -0,0 +1,222 @@
|
||||
// f1 split-only pixel controls: every result depends on the migrated verb.
|
||||
#include "../Harness/ScenarioFixture.h"
|
||||
#include "../Harness/SplitRuntimePeek.h"
|
||||
#include <array>
|
||||
#ifdef GLAPI
|
||||
#undef GLAPI
|
||||
#endif
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glcorearb.h>
|
||||
#undef GL_GLEXT_PROTOTYPES
|
||||
|
||||
namespace MGITest {
|
||||
namespace {
|
||||
class F1WireScenario : public ScenarioTest {
|
||||
protected:
|
||||
GLuint fbo = 0, texture = 0;
|
||||
void SetUp() override {
|
||||
ScenarioTest::SetUp();
|
||||
if (!Ready()) return;
|
||||
const auto why = SplitRuntimeSkipReason();
|
||||
if (!why.empty()) GTEST_SKIP() << why;
|
||||
glGenFramebuffers(1, &fbo);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
||||
glGenTextures(1, &texture);
|
||||
glBindTexture(GL_TEXTURE_2D, texture);
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
glDepthMask(GL_TRUE);
|
||||
glStencilMask(~0u);
|
||||
}
|
||||
void TearDown() override {
|
||||
if (!Ready()) return;
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
if (fbo) glDeleteFramebuffers(1, &fbo);
|
||||
if (texture) glDeleteTextures(1, &texture);
|
||||
ScenarioTest::TearDown();
|
||||
}
|
||||
void Attach(GLenum format, GLenum attachment = GL_COLOR_ATTACHMENT0, int levels = 1) {
|
||||
glTexStorage2D(GL_TEXTURE_2D, levels, format, 8, 8);
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, attachment, GL_TEXTURE_2D, texture, 0);
|
||||
if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { glDrawBuffer(GL_NONE); glReadBuffer(GL_NONE); }
|
||||
ASSERT_EQ(glCheckFramebufferStatus(GL_FRAMEBUFFER), GLenum(GL_FRAMEBUFFER_COMPLETE)) << "F1.setup.framebuffer";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
TEST_F(F1WireScenario, ClearBufferfvPixels) {
|
||||
// Red once (executed, reverted): zero the clear record values; F1.ClearBufferfv.pixels fails.
|
||||
if (!Ready()) return;
|
||||
Attach(GL_RGBA8);
|
||||
const GLfloat value[4] = {0.25f, 0.5f, 0.75f, 1.0f};
|
||||
const auto before = PeekSplitRuntime().emitSeq;
|
||||
glClearBufferfv(GL_COLOR, 0, value);
|
||||
ASSERT_GT(PeekSplitRuntime().emitSeq, before) << "F1.ClearBufferfv.wire";
|
||||
GLubyte pixel[4]{};
|
||||
glReadPixels(2, 3, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel);
|
||||
ASSERT_EQ(FirstGLError(), GLenum(GL_NO_ERROR)) << "F1.ClearBufferfv.error";
|
||||
const int expected[4] = {64, 128, 191, 255};
|
||||
for (int i = 0; i < 4; ++i) EXPECT_NEAR(pixel[i], expected[i], 1) << "F1.ClearBufferfv.pixels";
|
||||
}
|
||||
|
||||
TEST_F(F1WireScenario, ClearNamedFramebufferfvPixels) {
|
||||
// Red once (executed, reverted): zero the clear record values; F1.ClearNamedFramebufferfv.pixels fails.
|
||||
if (!Ready()) return;
|
||||
Attach(GL_RGBA8);
|
||||
const GLfloat value[4] = {0.25f, 0.5f, 0.75f, 1.0f};
|
||||
const auto before = PeekSplitRuntime().emitSeq;
|
||||
glClearNamedFramebufferfv(fbo, GL_COLOR, 0, value);
|
||||
ASSERT_GT(PeekSplitRuntime().emitSeq, before) << "F1.ClearNamedFramebufferfv.wire";
|
||||
GLubyte pixel[4]{};
|
||||
glReadPixels(2, 3, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel);
|
||||
ASSERT_EQ(FirstGLError(), GLenum(GL_NO_ERROR)) << "F1.ClearNamedFramebufferfv.error";
|
||||
const int expected[4] = {64, 128, 191, 255};
|
||||
for (int i = 0; i < 4; ++i) EXPECT_NEAR(pixel[i], expected[i], 1) << "F1.ClearNamedFramebufferfv.pixels";
|
||||
}
|
||||
|
||||
TEST_F(F1WireScenario, ClearBufferivPixels) {
|
||||
// Red once (executed, reverted): zero the clear record values; F1.ClearBufferiv.pixels fails.
|
||||
if (!Ready()) return;
|
||||
Attach(GL_RGBA32I);
|
||||
const GLint value[4] = {-37, 19, -11, 5};
|
||||
const auto before = PeekSplitRuntime().emitSeq;
|
||||
glClearBufferiv(GL_COLOR, 0, value);
|
||||
ASSERT_GT(PeekSplitRuntime().emitSeq, before) << "F1.ClearBufferiv.wire";
|
||||
GLint pixel[4]{};
|
||||
glReadPixels(2, 3, 1, 1, GL_RGBA_INTEGER, GL_INT, pixel);
|
||||
ASSERT_EQ(FirstGLError(), GLenum(GL_NO_ERROR)) << "F1.ClearBufferiv.error";
|
||||
for (int i = 0; i < 4; ++i) EXPECT_EQ(pixel[i], value[i]) << "F1.ClearBufferiv.pixels";
|
||||
}
|
||||
|
||||
TEST_F(F1WireScenario, ClearNamedFramebufferivPixels) {
|
||||
// Red once (executed, reverted): zero the clear record values; F1.ClearNamedFramebufferiv.pixels fails.
|
||||
if (!Ready()) return;
|
||||
Attach(GL_RGBA32I);
|
||||
const GLint value[4] = {-37, 19, -11, 5};
|
||||
const auto before = PeekSplitRuntime().emitSeq;
|
||||
glClearNamedFramebufferiv(fbo, GL_COLOR, 0, value);
|
||||
ASSERT_GT(PeekSplitRuntime().emitSeq, before) << "F1.ClearNamedFramebufferiv.wire";
|
||||
GLint pixel[4]{};
|
||||
glReadPixels(2, 3, 1, 1, GL_RGBA_INTEGER, GL_INT, pixel);
|
||||
ASSERT_EQ(FirstGLError(), GLenum(GL_NO_ERROR)) << "F1.ClearNamedFramebufferiv.error";
|
||||
for (int i = 0; i < 4; ++i) EXPECT_EQ(pixel[i], value[i]) << "F1.ClearNamedFramebufferiv.pixels";
|
||||
}
|
||||
|
||||
TEST_F(F1WireScenario, ClearBufferuivPixels) {
|
||||
// Red once (executed, reverted): zero the clear record values; F1.ClearBufferuiv.pixels fails.
|
||||
if (!Ready()) return;
|
||||
Attach(GL_RGBA32UI);
|
||||
const GLuint value[4] = {37, 19, 11, 5};
|
||||
const auto before = PeekSplitRuntime().emitSeq;
|
||||
glClearBufferuiv(GL_COLOR, 0, value);
|
||||
ASSERT_GT(PeekSplitRuntime().emitSeq, before) << "F1.ClearBufferuiv.wire";
|
||||
GLuint pixel[4]{};
|
||||
glReadPixels(2, 3, 1, 1, GL_RGBA_INTEGER, GL_UNSIGNED_INT, pixel);
|
||||
ASSERT_EQ(FirstGLError(), GLenum(GL_NO_ERROR)) << "F1.ClearBufferuiv.error";
|
||||
for (int i = 0; i < 4; ++i) EXPECT_EQ(pixel[i], value[i]) << "F1.ClearBufferuiv.pixels";
|
||||
}
|
||||
|
||||
TEST_F(F1WireScenario, ClearNamedFramebufferuivPixels) {
|
||||
// Red once (executed, reverted): zero the clear record values; F1.ClearNamedFramebufferuiv.pixels fails.
|
||||
if (!Ready()) return;
|
||||
Attach(GL_RGBA32UI);
|
||||
const GLuint value[4] = {37, 19, 11, 5};
|
||||
const auto before = PeekSplitRuntime().emitSeq;
|
||||
glClearNamedFramebufferuiv(fbo, GL_COLOR, 0, value);
|
||||
ASSERT_GT(PeekSplitRuntime().emitSeq, before) << "F1.ClearNamedFramebufferuiv.wire";
|
||||
GLuint pixel[4]{};
|
||||
glReadPixels(2, 3, 1, 1, GL_RGBA_INTEGER, GL_UNSIGNED_INT, pixel);
|
||||
ASSERT_EQ(FirstGLError(), GLenum(GL_NO_ERROR)) << "F1.ClearNamedFramebufferuiv.error";
|
||||
for (int i = 0; i < 4; ++i) EXPECT_EQ(pixel[i], value[i]) << "F1.ClearNamedFramebufferuiv.pixels";
|
||||
}
|
||||
|
||||
TEST_F(F1WireScenario, ClearBufferfiPixels) {
|
||||
// Red once (executed, reverted): zero the clear record values; F1.ClearBufferfi.pixels fails.
|
||||
if (!Ready()) return;
|
||||
Attach(GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL_ATTACHMENT);
|
||||
const auto before = PeekSplitRuntime().emitSeq;
|
||||
glClearBufferfi(GL_DEPTH_STENCIL, 0, 0.375f, 91);
|
||||
ASSERT_GT(PeekSplitRuntime().emitSeq, before) << "F1.ClearBufferfi.wire";
|
||||
GLuint pixel = 0;
|
||||
glReadPixels(2, 3, 1, 1, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, &pixel);
|
||||
ASSERT_EQ(FirstGLError(), GLenum(GL_NO_ERROR)) << "F1.ClearBufferfi.error";
|
||||
EXPECT_EQ(pixel & 255u, 91u) << "F1.ClearBufferfi.pixels";
|
||||
EXPECT_NEAR(double(pixel >> 8) / 16777215.0, 0.375, 0.00001) << "F1.ClearBufferfi.pixels";
|
||||
}
|
||||
|
||||
TEST_F(F1WireScenario, ClearNamedFramebufferfiPixels) {
|
||||
// Red once (executed, reverted): zero the clear record values; F1.ClearNamedFramebufferfi.pixels fails.
|
||||
if (!Ready()) return;
|
||||
Attach(GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL_ATTACHMENT);
|
||||
const auto before = PeekSplitRuntime().emitSeq;
|
||||
glClearNamedFramebufferfi(fbo, GL_DEPTH_STENCIL, 0, 0.375f, 91);
|
||||
ASSERT_GT(PeekSplitRuntime().emitSeq, before) << "F1.ClearNamedFramebufferfi.wire";
|
||||
GLuint pixel = 0;
|
||||
glReadPixels(2, 3, 1, 1, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, &pixel);
|
||||
ASSERT_EQ(FirstGLError(), GLenum(GL_NO_ERROR)) << "F1.ClearNamedFramebufferfi.error";
|
||||
EXPECT_EQ(pixel & 255u, 91u) << "F1.ClearNamedFramebufferfi.pixels";
|
||||
EXPECT_NEAR(double(pixel >> 8) / 16777215.0, 0.375, 0.00001) << "F1.ClearNamedFramebufferfi.pixels";
|
||||
}
|
||||
|
||||
TEST_F(F1WireScenario, CopyTexImage2DPixels) {
|
||||
// Red once (executed, reverted): omit the copy sink call; F1.CopyTexImage2D.pixels fails.
|
||||
if (!Ready()) return;
|
||||
Attach(GL_RGBA8);
|
||||
glClearColor(0.25f, 0.5f, 0.75f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
GLuint destination = 0;
|
||||
glGenTextures(1, &destination);
|
||||
glBindTexture(GL_TEXTURE_2D, destination);
|
||||
|
||||
const auto before = PeekSplitRuntime().emitSeq;
|
||||
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 2, 3, 4, 4, 0);
|
||||
ASSERT_GT(PeekSplitRuntime().emitSeq, before) << "F1.CopyTexImage2D.wire";
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, destination, 0);
|
||||
GLubyte pixel[4]{};
|
||||
glReadPixels(1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel);
|
||||
ASSERT_EQ(FirstGLError(), GLenum(GL_NO_ERROR)) << "F1.CopyTexImage2D.error";
|
||||
const int expected[4] = {64, 128, 191, 255};
|
||||
for (int i = 0; i < 4; ++i) EXPECT_NEAR(pixel[i], expected[i], 1) << "F1.CopyTexImage2D.pixels";
|
||||
glDeleteTextures(1, &destination);
|
||||
}
|
||||
|
||||
TEST_F(F1WireScenario, CopyTexSubImage2DPixels) {
|
||||
// Red once (executed, reverted): omit the copy sink call; F1.CopyTexSubImage2D.pixels fails.
|
||||
if (!Ready()) return;
|
||||
Attach(GL_RGBA8);
|
||||
glClearColor(0.25f, 0.5f, 0.75f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
GLuint destination = 0;
|
||||
glGenTextures(1, &destination);
|
||||
glBindTexture(GL_TEXTURE_2D, destination);
|
||||
glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 4, 4);
|
||||
const auto before = PeekSplitRuntime().emitSeq;
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 1, 1, 2, 3, 2, 2);
|
||||
ASSERT_GT(PeekSplitRuntime().emitSeq, before) << "F1.CopyTexSubImage2D.wire";
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, destination, 0);
|
||||
GLubyte pixel[4]{};
|
||||
glReadPixels(1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel);
|
||||
ASSERT_EQ(FirstGLError(), GLenum(GL_NO_ERROR)) << "F1.CopyTexSubImage2D.error";
|
||||
const int expected[4] = {64, 128, 191, 255};
|
||||
for (int i = 0; i < 4; ++i) EXPECT_NEAR(pixel[i], expected[i], 1) << "F1.CopyTexSubImage2D.pixels";
|
||||
glDeleteTextures(1, &destination);
|
||||
}
|
||||
|
||||
TEST_F(F1WireScenario, GenerateMipmapPixels) {
|
||||
// Red once (executed, reverted): omit the mipmap sink call; F1.GenerateMipmap.pixels fails.
|
||||
if (!Ready()) return;
|
||||
Attach(GL_RGBA8, GL_COLOR_ATTACHMENT0, 4);
|
||||
glClearColor(0.25f, 0.5f, 0.75f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
const auto before = PeekSplitRuntime().emitSeq;
|
||||
glGenerateMipmap(GL_TEXTURE_2D);
|
||||
ASSERT_GT(PeekSplitRuntime().emitSeq, before) << "F1.GenerateMipmap.wire";
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 2);
|
||||
GLubyte pixel[4]{};
|
||||
glReadPixels(1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel);
|
||||
ASSERT_EQ(FirstGLError(), GLenum(GL_NO_ERROR)) << "F1.GenerateMipmap.error";
|
||||
const int expected[4] = {64, 128, 191, 255};
|
||||
for (int i = 0; i < 4; ++i) EXPECT_NEAR(pixel[i], expected[i], 1) << "F1.GenerateMipmap.pixels";
|
||||
}
|
||||
} // namespace MGITest
|
||||
@@ -264,6 +264,21 @@ void main() { oColor = vec4(vColor, 1.0); }
|
||||
// the lane is that IT is the arm with a ring the workload can fill.
|
||||
if (SplitLane::IsSmallRingLane()) {
|
||||
const unsigned long long driven = DriveUntilSmallRingOverruns();
|
||||
// Ordinary uploads, each fitting by itself, jointly exceed the lane's 1 MiB
|
||||
// staging segment. Delay only scheduling between applied and retired: the
|
||||
// production allocator, not this test, must observe capacity and wait.
|
||||
GLuint pressureBuffer = 0;
|
||||
glGenBuffers(1, &pressureBuffer);
|
||||
glBindBuffer(GL_COPY_WRITE_BUFFER, pressureBuffer);
|
||||
std::vector<unsigned char> upload(768 * 1024, 0x5a);
|
||||
glBufferData(GL_COPY_WRITE_BUFFER, upload.size(), nullptr, GL_DYNAMIC_DRAW);
|
||||
DelaySplitRetirementForTesting(true);
|
||||
glBufferSubData(GL_COPY_WRITE_BUFFER, 0, upload.size(), upload.data());
|
||||
upload[0] = 0xa5;
|
||||
glBufferSubData(GL_COPY_WRITE_BUFFER, 0, upload.size(), upload.data());
|
||||
DelaySplitRetirementForTesting(false);
|
||||
glBindBuffer(GL_COPY_WRITE_BUFFER, 0);
|
||||
glDeleteBuffers(1, &pressureBuffer);
|
||||
Gl().EndFrame();
|
||||
WireLedger::ExpectSmallRingWrappedAtLeastOnce(
|
||||
"TriangleScenario.TheSameVboAndVaoRedrawAcrossAFrameBoundary", driven);
|
||||
|
||||
Reference in New Issue
Block a user