mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-20 08:21:56 +09:00
Merge commit '552ade5b' into codex/p5f-wave2
# Conflicts: # MobileGL/MG_IntegrationTest/Harness/dualblock-expected-fatals.txt # MobileGL/MG_IntegrationTest/Harness/strict-expected-markers.txt
This commit is contained in:
@@ -95,21 +95,28 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
if (handle.Slot >= state.TextureResources.size()) WireDescriptorFatal("image-record");
|
||||
const auto& record = state.TextureResources[handle.Slot];
|
||||
if (!record.Live || record.Gen != handle.Gen) WireDescriptorFatal("image-record-generation");
|
||||
auto* resource = m_textureManager->SyncTextureResourceByHandle(handle);
|
||||
auto* resource = m_textureManager->SyncTextureResourceByHandle(handle, false, storage);
|
||||
if (!resource) WireDescriptorFatal("image-resource");
|
||||
m_textureManager->FlushPendingUploads();
|
||||
|
||||
const auto target = static_cast<MG_Pipe::MGPipeResourceTarget>(record.Desc.Target);
|
||||
using Target = MG_Pipe::MGPipeResourceTarget;
|
||||
const Bool layerable = target == Target::Tex1DArray || target == Target::Tex2DArray ||
|
||||
target == Target::Tex2DMSArray || target == Target::Tex3D ||
|
||||
target == Target::TexCube || target == Target::TexCubeArray;
|
||||
Uint32 level = storage ? state.BoundShaderImages[unit].Level : record.Params.BaseLevel;
|
||||
Uint32 layer = storage && !state.BoundShaderImages[unit].Layered ? state.BoundShaderImages[unit].Layer : 0;
|
||||
// GL ignores Layer/Layered for non-layerable targets. In particular image1D
|
||||
// stays a 1D view, and an ignored nonzero Layer must not address another slice.
|
||||
Uint32 layer = storage && layerable && !state.BoundShaderImages[unit].Layered
|
||||
? state.BoundShaderImages[unit].Layer : 0;
|
||||
const Uint32 localLevel = level;
|
||||
const Uint32 localLayer = layer;
|
||||
Uint32 layers = 0;
|
||||
VkFormat aliasFormat = VK_FORMAT_UNDEFINED;
|
||||
const auto root = m_textureManager->ResolveWireTextureStorage(handle, level, layer, &aliasFormat, &layers);
|
||||
if (MG_Pipe::MGPipeHandleIsNull(root)) WireDescriptorFatal("image-view-window");
|
||||
const auto target = static_cast<MG_Pipe::MGPipeResourceTarget>(record.Desc.Target);
|
||||
VkImageViewType type = WireViewType(target);
|
||||
if (storage && !state.BoundShaderImages[unit].Layered) {
|
||||
if (storage && layerable && !state.BoundShaderImages[unit].Layered) {
|
||||
layers = 1;
|
||||
type = target == MG_Pipe::MGPipeResourceTarget::Tex1DArray ? VK_IMAGE_VIEW_TYPE_1D : VK_IMAGE_VIEW_TYPE_2D;
|
||||
}
|
||||
@@ -122,9 +129,16 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
const auto viewHandle = state.BoundSamplerViews[unit].View;
|
||||
if (!MG_Pipe::MGPipeHandleIsNull(viewHandle) && viewHandle.Slot < state.SamplerViewCsos.size()) {
|
||||
const auto& view = state.SamplerViewCsos[viewHandle.Slot];
|
||||
if (!view.Live || view.Gen != viewHandle.Gen || view.View.NumLevels <= localLevel)
|
||||
if (!view.Live || view.Gen != viewHandle.Gen || view.View.Texture != handle)
|
||||
WireDescriptorFatal("sampler-view-record");
|
||||
levels = std::min<Uint32>(levels, view.View.NumLevels - localLevel);
|
||||
// Ordinary texture views can encode an unrestricted window with zero
|
||||
// counts; only an actual restriction narrows the resource/parameter range.
|
||||
if (view.View.NumLevels != 0) {
|
||||
if (view.View.NumLevels <= localLevel) WireDescriptorFatal("sampler-view-level");
|
||||
levels = std::min<Uint32>(levels, view.View.NumLevels - localLevel);
|
||||
}
|
||||
} else if (!MG_Pipe::MGPipeHandleIsNull(viewHandle)) {
|
||||
WireDescriptorFatal("sampler-view-record");
|
||||
}
|
||||
levels = std::min(levels, resource->mipLevels - level);
|
||||
}
|
||||
|
||||
@@ -2008,7 +2008,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
}
|
||||
|
||||
Bool VkTextureManager::SyncWireTextureShape(const MG_Pipe::MGPipeResourceRecord& record,
|
||||
TextureResource& resource) {
|
||||
TextureResource& resource, Bool requireStorage) {
|
||||
const MG_Pipe::MGPResourceDesc& desc = record.Desc;
|
||||
if (desc.StorageKind != static_cast<Uint8>(TextureStorageType::Mipmap)) {
|
||||
MGLOG_W_ONCE("Magma wire texture {slot=%u, gen=%u}: buffer-backed textures are not migrated; declined",
|
||||
@@ -2072,7 +2072,8 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
vkGetPhysicalDeviceFormatProperties(m_physicalDevice, format, &formatProperties);
|
||||
// The descriptor's sticky bind mask carries the image-unit hint, so the image is born
|
||||
// with STORAGE usage and no re-mint ever pulls texels back (TextureEmit.h D-A3).
|
||||
const Bool markedAsStorageImage = (desc.BindMask & MG_Pipe::kMGPipeBindShaderImage) != 0;
|
||||
const Bool markedAsStorageImage = requireStorage || resource.storageUsageResolved ||
|
||||
(desc.BindMask & MG_Pipe::kMGPipeBindShaderImage) != 0;
|
||||
const Bool storageImageCapable =
|
||||
!isMultisample && (aspect & VK_IMAGE_ASPECT_COLOR_BIT) != 0 &&
|
||||
(formatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT) != 0;
|
||||
@@ -2570,7 +2571,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
}
|
||||
|
||||
VkTextureManager::TextureResource* VkTextureManager::SyncTextureResourceByHandle(
|
||||
MG_Pipe::MGPipeHandle handle, Bool renderbuffer) {
|
||||
MG_Pipe::MGPipeHandle handle, Bool renderbuffer, Bool requireStorage) {
|
||||
MOBILEGL_ASSERT(m_device != VK_NULL_HANDLE, "SyncTextureResourceByHandle: m_device == VK_NULL_HANDLE");
|
||||
if (MG_Pipe::MGPipeHandleIsNull(handle)) {
|
||||
return nullptr;
|
||||
@@ -2582,7 +2583,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
const auto storage = ResolveWireTextureStorage(handle, level, layer, &viewFormat);
|
||||
if (MG_Pipe::MGPipeHandleIsNull(storage)) return nullptr;
|
||||
if (storage != handle) {
|
||||
auto* resource = SyncTextureResourceByHandle(storage);
|
||||
auto* resource = SyncTextureResourceByHandle(storage, false, requireStorage);
|
||||
if (!resource) return nullptr;
|
||||
if (viewFormat != resource->format &&
|
||||
((resource->imageCreateFlags & VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT) == 0 ||
|
||||
@@ -2615,15 +2616,16 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
(void)inserted;
|
||||
TextureResource& resource = it->second;
|
||||
if (resource.image != VK_NULL_HANDLE && resource.syncedWireSerial == record.Serial &&
|
||||
record.PendingUploads.empty()) {
|
||||
record.PendingUploads.empty() && (!requireStorage || (resource.usageFlags & VK_IMAGE_USAGE_STORAGE_BIT) != 0)) {
|
||||
return &resource;
|
||||
}
|
||||
if (!SyncWireTextureShape(record, resource)) {
|
||||
if (!SyncWireTextureShape(record, resource, requireStorage)) {
|
||||
return nullptr;
|
||||
}
|
||||
if (!renderbuffer && !UploadPendingWireLevels(handle, record, resource)) {
|
||||
return nullptr;
|
||||
}
|
||||
if (requireStorage && (resource.usageFlags & VK_IMAGE_USAGE_STORAGE_BIT) == 0) return nullptr;
|
||||
resource.syncedWireSerial = record.Serial;
|
||||
return &resource;
|
||||
}
|
||||
|
||||
@@ -553,7 +553,8 @@ public:
|
||||
// a NAMESPACE THE FRONTEND-KEYED m_textureResources NEVER MEETS, so a recycled {slot, gen}
|
||||
// can never inherit its predecessor's image. Texture views resolve the storage owner from
|
||||
// Desc.ViewOf and the window from ViewCso; buffer-backed textures remain P7's buffer arm.
|
||||
TextureResource* SyncTextureResourceByHandle(MG_Pipe::MGPipeHandle handle, Bool renderbuffer = false);
|
||||
TextureResource* SyncTextureResourceByHandle(MG_Pipe::MGPipeHandle handle, Bool renderbuffer = false,
|
||||
Bool requireStorage = false);
|
||||
// Map a texture/view-relative subresource to its live storage owner. layerCount, when
|
||||
// supplied, receives the number of accessible layers starting at the input layer.
|
||||
// viewFormat is UNDEFINED for an ordinary texture, or the outer view's format.
|
||||
@@ -733,7 +734,8 @@ private:
|
||||
// descriptor (create / recreate / compatibility), then the pending-upload walk against the
|
||||
// server's staged store. UploadPendingWireLevels mutates the applier's record (consumed
|
||||
// entries are dropped), which is why the record is a non-const reference.
|
||||
Bool SyncWireTextureShape(const MG_Pipe::MGPipeResourceRecord& record, TextureResource& resource);
|
||||
Bool SyncWireTextureShape(const MG_Pipe::MGPipeResourceRecord& record, TextureResource& resource,
|
||||
Bool requireStorage);
|
||||
Bool UploadPendingWireLevels(MG_Pipe::MGPipeHandle handle, MG_Pipe::MGPipeResourceRecord& record,
|
||||
TextureResource& resource);
|
||||
// The handle-keyed twin of m_textureResources, keyed by StagedTextureStore::KeyForHandle.
|
||||
|
||||
@@ -57,6 +57,13 @@
|
||||
WireBufferLegacyFatal();
|
||||
}
|
||||
|
||||
if (!frame.isCommandRecording) m_frameContext.BeginCommandRecording();
|
||||
// Descriptor resolution can upgrade a view's root image to STORAGE usage.
|
||||
// Resolve it before constructing framebuffer views so both roles of that image
|
||||
// name the same allocation even on its first storage-image use.
|
||||
if (!m_uniformManager->BindProgramUniformBuffers(frame.commandBuffer, program, programObj,
|
||||
m_frameContext.GetCurrentFrameIndex(), VK_PIPELINE_BIND_POINT_GRAPHICS)) return false;
|
||||
|
||||
Vector<VkAttachmentDescription> attachments;
|
||||
Vector<VkImageView> views;
|
||||
Vector<VkAttachmentReference> colors;
|
||||
@@ -146,9 +153,6 @@
|
||||
VertexInputStateFactory::BackendVertexInputState input{};
|
||||
const auto pipeline = GetOrCreatePipelineWithInput(mode, program, programObj, flags, input, pass, false);
|
||||
if (pipeline == VK_NULL_HANDLE) return false;
|
||||
if (!frame.isCommandRecording) m_frameContext.BeginCommandRecording();
|
||||
if (!m_uniformManager->BindProgramUniformBuffers(frame.commandBuffer, program, programObj,
|
||||
m_frameContext.GetCurrentFrameIndex(), VK_PIPELINE_BIND_POINT_GRAPHICS)) return false;
|
||||
Uint32 binding = 0;
|
||||
for (Uint32 location = 0; location < kMaxVertexAttribs; ++location) {
|
||||
if (!(programObj.activeVertexInputLocationMask & (1u << location))) continue;
|
||||
|
||||
@@ -2383,7 +2383,7 @@ if (MOBILEGL_BUILD_DISAGGREGATED)
|
||||
"MOBILEGL_BACKEND_TYPE=DirectVulkan" "MOBILEGL_TRANSPORT=inproc"
|
||||
"MOBILEGL_ITEST_REQUIRE_GPU=1" "MGITEST_SPLIT_LANE=1"
|
||||
${MGL_ITEST_CAPABILITY_ENV} ${MGL_ITEST_COMMON_ENV})
|
||||
foreach(fmSlot VertexIdSamplerAndScalarUniformPixels ComputeImageStoreFramebufferPixels PartialTextureUploadPreservesGpuClearPixels TextureViewClearTargetsItsRootMipAndLayer ClearBufferfiPixels ClearBufferfvPixels ClearBufferivPixels ClearBufferuivPixels ClearNamedFramebufferfiPixels ClearNamedFramebufferfvPixels ClearNamedFramebufferivPixels ClearNamedFramebufferuivPixels CopyTexImage2DPixels CopyTexSubImage2DPixels GenerateMipmapPixels GenerateMipmapPackedFloatPixels GenerateMipmapDepthPixels)
|
||||
foreach(fmSlot ComputeImageStoreThroughViewPreservesOtherRootLayer EnabledVertexBufferDrawKeepsNamedP7Fatal SrgbDrawTracksFramebufferConversion Texture1DFramebufferClearPixels VertexIdSamplerAndScalarUniformPixels ComputeImageStoreFramebufferPixels PartialTextureUploadPreservesGpuClearPixels TextureViewClearTargetsItsRootMipAndLayer ClearBufferfiPixels ClearBufferfvPixels ClearBufferivPixels ClearBufferuivPixels ClearNamedFramebufferfiPixels ClearNamedFramebufferfvPixels ClearNamedFramebufferivPixels ClearNamedFramebufferuivPixels CopyTexImage2DPixels CopyTexSubImage2DPixels GenerateMipmapPixels GenerateMipmapPackedFloatPixels GenerateMipmapDepthPixels)
|
||||
set(MGL_ITEST_FM_LABEL "integration-magma-split")
|
||||
if (fmSlot STREQUAL "GenerateMipmapPackedFloatPixels")
|
||||
# R11F_G11F_B10F mip blits already fail on the baseline Magma lane.
|
||||
|
||||
@@ -34,10 +34,12 @@
|
||||
# a row advances those entries to their next one. See docs/Disaggregated/notes/p5f/f1-report.md.
|
||||
# ---------------------------------------------------------------------------------------------
|
||||
#
|
||||
# P5f fe measured at 881e050e: 181 entries, 175 green, 4 skipped, 2 red.
|
||||
# Espryt retired all five previous first-blocker pairs, and their downstream reads:
|
||||
# READ FBO surface classification + reply-only PixelPack; copy destination arm ordering;
|
||||
# copy-image endpoint handles; capture archive/ranges; storage-block program handle.
|
||||
# The complete lane reached no new first-blocker pair (see fe-report.md).
|
||||
# Magma's Clear path remains fm's independently owned pair (two NamedBlit entries).
|
||||
GetFramebufferBindingSlot@Clear
|
||||
# P5f wave 2: the expected set is empty after fc -> fe -> fm integration.
|
||||
# fe retired five original first-blockers: ReadPixels framebuffer/pack readers,
|
||||
# capture program/ranges, copy-image texture handles, copy destination unit,
|
||||
# and storage-block program-name validation. fm retired Clear on Magma through
|
||||
# server framebuffer/resource records. The shared copy-image seam also retires
|
||||
# GetTextureObject in either package in isolation; it is one removal at integration.
|
||||
# The expanded Magma lane includes real bufferless shader/image pixel scenarios.
|
||||
# Its named P7 native-format probe has a separate, enforced known-red CI lane.
|
||||
# Every new Fatal or Admitted in this census remains a regression.
|
||||
|
||||
@@ -2,9 +2,15 @@
|
||||
#include "../Harness/ScenarioFixture.h"
|
||||
#include "../Harness/SplitRuntimePeek.h"
|
||||
#include <array>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <fstream>
|
||||
#include <initializer_list>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#if !defined(_WIN32) && GTEST_HAS_DEATH_TEST
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef GLAPI
|
||||
#undef GLAPI
|
||||
#endif
|
||||
@@ -375,7 +381,7 @@ void main() {
|
||||
)";
|
||||
const GLuint program = BuildWireProgram({{GL_COMPUTE_SHADER, compute}});
|
||||
ASSERT_NE(program, 0u);
|
||||
glBindImageTexture(2, texture, 0, GL_FALSE, 0, GL_WRITE_ONLY, GL_RGBA8);
|
||||
glBindImageTexture(2, texture, 0, GL_FALSE, 7, GL_WRITE_ONLY, GL_RGBA8); // 2D ignores the layer.
|
||||
glUseProgram(program);
|
||||
glDispatchCompute(8, 8, 1);
|
||||
glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT | GL_FRAMEBUFFER_BARRIER_BIT);
|
||||
@@ -397,6 +403,186 @@ void main() {
|
||||
glDeleteProgram(program);
|
||||
}
|
||||
|
||||
TEST_F(F1WireScenario, ComputeImageStoreThroughViewPreservesOtherRootLayer) {
|
||||
if (!Ready()) return;
|
||||
GLuint root = 0, view = 0;
|
||||
glGenTextures(1, &root);
|
||||
glBindTexture(GL_TEXTURE_2D_ARRAY, root);
|
||||
glTexStorage3D(GL_TEXTURE_2D_ARRAY, 1, GL_RGBA8, 8, 8, 2);
|
||||
std::array<GLubyte, 8 * 8 * 2 * 4> red{};
|
||||
for (size_t i = 0; i < red.size(); i += 4) {
|
||||
red[i] = 255;
|
||||
red[i + 3] = 255;
|
||||
}
|
||||
glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 8, 8, 2,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, red.data());
|
||||
glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, root, 0, 0);
|
||||
ASSERT_EQ(glCheckFramebufferStatus(GL_FRAMEBUFFER), GLenum(GL_FRAMEBUFFER_COMPLETE));
|
||||
// Materialize the root's Vulkan image before any storage-image binding. The
|
||||
// subsequent view-only bind must upgrade the root and preserve its other layer.
|
||||
std::array<GLubyte, 4> initial{};
|
||||
glReadPixels(2, 3, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, initial.data());
|
||||
ASSERT_EQ(initial, (std::array<GLubyte, 4>{255, 0, 0, 255}));
|
||||
glGenTextures(1, &view);
|
||||
glTextureView(view, GL_TEXTURE_2D, root, GL_RGBA8, 0, 1, 1, 1);
|
||||
ASSERT_EQ(FirstGLError(), GLenum(GL_NO_ERROR));
|
||||
const char* compute = R"(#version 430 core
|
||||
layout(local_size_x=1, local_size_y=1, local_size_z=1) in;
|
||||
layout(rgba8, binding=2) writeonly uniform image2D destination;
|
||||
void main() { imageStore(destination, ivec2(gl_GlobalInvocationID.xy), vec4(0.0, 1.0, 0.0, 1.0)); }
|
||||
)";
|
||||
const GLuint program = BuildWireProgram({{GL_COMPUTE_SHADER, compute}});
|
||||
ASSERT_NE(program, 0u);
|
||||
glBindImageTexture(2, view, 0, GL_FALSE, 0, GL_WRITE_ONLY, GL_RGBA8);
|
||||
glUseProgram(program);
|
||||
glDispatchCompute(8, 8, 1);
|
||||
glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT | GL_FRAMEBUFFER_BARRIER_BIT);
|
||||
for (const int layer : {0, 1}) {
|
||||
glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, root, 0, layer);
|
||||
std::array<GLubyte, 8 * 8 * 4> pixels{};
|
||||
glReadPixels(0, 0, 8, 8, GL_RGBA, GL_UNSIGNED_BYTE, pixels.data());
|
||||
ASSERT_EQ(FirstGLError(), GLenum(GL_NO_ERROR));
|
||||
const std::array<GLubyte, 4> expected = layer == 1
|
||||
? std::array<GLubyte, 4>{0, 255, 0, 255} : std::array<GLubyte, 4>{255, 0, 0, 255};
|
||||
for (size_t at = 0; at < pixels.size(); at += 4) {
|
||||
const std::array<GLubyte, 4> actual{pixels[at], pixels[at + 1], pixels[at + 2], pixels[at + 3]};
|
||||
EXPECT_EQ(actual, expected) << "root layer " << layer << ", texel " << at / 4;
|
||||
}
|
||||
}
|
||||
glBindImageTexture(2, 0, 0, GL_FALSE, 0, GL_WRITE_ONLY, GL_RGBA8);
|
||||
glUseProgram(0);
|
||||
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, 0, 0);
|
||||
glBindTexture(GL_TEXTURE_2D_ARRAY, 0);
|
||||
glDeleteProgram(program);
|
||||
glDeleteTextures(1, &view);
|
||||
glDeleteTextures(1, &root);
|
||||
}
|
||||
|
||||
TEST_F(F1WireScenario, EnabledVertexBufferDrawKeepsNamedP7Fatal) {
|
||||
if (!Ready()) return;
|
||||
#if !defined(_WIN32) && GTEST_HAS_DEATH_TEST
|
||||
Attach(GL_RGBA8);
|
||||
const char* vertex = R"(#version 430 core
|
||||
layout(location=0) in vec2 position;
|
||||
void main() { gl_Position = vec4(position, 0.0, 1.0); }
|
||||
)";
|
||||
const char* fragment = R"(#version 430 core
|
||||
layout(location=0) out vec4 color;
|
||||
void main() { color = vec4(0.0, 1.0, 0.0, 1.0); }
|
||||
)";
|
||||
const GLuint program = BuildWireProgram({{GL_VERTEX_SHADER, vertex}, {GL_FRAGMENT_SHADER, fragment}});
|
||||
ASSERT_NE(program, 0u);
|
||||
GLuint vao = 0, vbo = 0;
|
||||
glGenVertexArrays(1, &vao);
|
||||
glBindVertexArray(vao);
|
||||
glGenBuffers(1, &vbo);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
||||
const GLfloat positions[] = {-1, -1, 3, -1, -1, 3};
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(positions), positions, GL_STATIC_DRAW);
|
||||
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, nullptr);
|
||||
glEnableVertexAttribArray(0);
|
||||
glUseProgram(program);
|
||||
ASSERT_EQ(FirstGLError(), GLenum(GL_NO_ERROR));
|
||||
|
||||
// A fresh exec reconstructs the fixture and apply thread; no child executes GL
|
||||
// against a forked mutex/thread state. Capture the named log because shipped
|
||||
// builds may disable console logging, which makes a stderr regex insufficient.
|
||||
const char* oldLogEnv = std::getenv("MOBILEGL_LOG_FILE_PATH");
|
||||
const bool hadLogEnv = oldLogEnv != nullptr;
|
||||
const std::string oldLogPath = hadLogEnv ? oldLogEnv : "";
|
||||
const std::string childLog = oldLogPath.empty()
|
||||
? "/tmp/mobilegl-vbo-death-" + std::to_string(static_cast<long long>(::getpid())) + ".log"
|
||||
: oldLogPath + ".vbo-death";
|
||||
std::remove(childLog.c_str());
|
||||
ASSERT_EQ(::setenv("MOBILEGL_LOG_FILE_PATH", childLog.c_str(), 1), 0);
|
||||
const std::string oldStyle = ::testing::FLAGS_gtest_death_test_style;
|
||||
::testing::FLAGS_gtest_death_test_style = "threadsafe";
|
||||
EXPECT_DEATH({
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
glFinish();
|
||||
}, "");
|
||||
::testing::FLAGS_gtest_death_test_style = oldStyle;
|
||||
if (hadLogEnv) ::setenv("MOBILEGL_LOG_FILE_PATH", oldLogPath.c_str(), 1);
|
||||
else ::unsetenv("MOBILEGL_LOG_FILE_PATH");
|
||||
std::ifstream log(childLog, std::ios::binary);
|
||||
std::ostringstream contents;
|
||||
contents << log.rdbuf();
|
||||
log.close();
|
||||
EXPECT_NE(contents.str().find("buffer-legacy-arm"), std::string::npos)
|
||||
<< "draw must keep the existing named P7 refusal, not die at a new object/field access\n"
|
||||
<< contents.str();
|
||||
std::remove(childLog.c_str());
|
||||
glUseProgram(0);
|
||||
glBindVertexArray(0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glDeleteBuffers(1, &vbo);
|
||||
glDeleteVertexArrays(1, &vao);
|
||||
glDeleteProgram(program);
|
||||
#else
|
||||
GTEST_SKIP() << "requires gtest thread-safe exec death tests and POSIX environment handling";
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST_F(F1WireScenario, SrgbDrawTracksFramebufferConversion) {
|
||||
if (!Ready()) return;
|
||||
Attach(GL_SRGB8_ALPHA8);
|
||||
const char* fragment = R"(#version 430 core
|
||||
layout(location=0) out vec4 color;
|
||||
void main() { color = vec4(0.5, 0.5, 0.5, 1.0); }
|
||||
)";
|
||||
const GLuint program = BuildWireProgram({{GL_VERTEX_SHADER, kWireVertexIdTriangle},
|
||||
{GL_FRAGMENT_SHADER, fragment}});
|
||||
ASSERT_NE(program, 0u);
|
||||
GLuint vao = 0;
|
||||
glGenVertexArrays(1, &vao);
|
||||
glBindVertexArray(vao);
|
||||
glUseProgram(program);
|
||||
glViewport(0, 0, 8, 8);
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
glDisable(GL_CULL_FACE);
|
||||
glDisable(GL_RASTERIZER_DISCARD);
|
||||
for (const bool conversion : {false, true}) {
|
||||
if (conversion) glEnable(GL_FRAMEBUFFER_SRGB);
|
||||
else glDisable(GL_FRAMEBUFFER_SRGB);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
std::array<GLubyte, 4> pixel{};
|
||||
glReadPixels(3, 2, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel.data());
|
||||
ASSERT_EQ(FirstGLError(), GLenum(GL_NO_ERROR));
|
||||
for (int channel = 0; channel < 3; ++channel)
|
||||
EXPECT_NEAR(pixel[channel], conversion ? 188 : 128, 1) << "FRAMEBUFFER_SRGB=" << conversion;
|
||||
EXPECT_EQ(pixel[3], 255);
|
||||
}
|
||||
glDisable(GL_FRAMEBUFFER_SRGB);
|
||||
glUseProgram(0);
|
||||
glBindVertexArray(0);
|
||||
glDeleteVertexArrays(1, &vao);
|
||||
glDeleteProgram(program);
|
||||
}
|
||||
|
||||
TEST_F(F1WireScenario, Texture1DFramebufferClearPixels) {
|
||||
if (!Ready()) return;
|
||||
GLuint line = 0;
|
||||
glGenTextures(1, &line);
|
||||
glBindTexture(GL_TEXTURE_1D, line);
|
||||
glTexStorage1D(GL_TEXTURE_1D, 1, GL_RGBA8, 8);
|
||||
glFramebufferTexture1D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_1D, line, 0);
|
||||
ASSERT_EQ(glCheckFramebufferStatus(GL_FRAMEBUFFER), GLenum(GL_FRAMEBUFFER_COMPLETE));
|
||||
glClearColor(0.25f, 0.5f, 0.75f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
std::array<GLubyte, 8 * 4> pixels{};
|
||||
glReadPixels(0, 0, 8, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixels.data());
|
||||
ASSERT_EQ(FirstGLError(), GLenum(GL_NO_ERROR));
|
||||
const int expected[] = {64, 128, 191, 255};
|
||||
for (int x = 0; x < 8; ++x)
|
||||
for (int channel = 0; channel < 4; ++channel)
|
||||
EXPECT_NEAR(pixels[x * 4 + channel], expected[channel], 1) << "1D texel " << x;
|
||||
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, 0, 0);
|
||||
glBindTexture(GL_TEXTURE_1D, 0);
|
||||
glDeleteTextures(1, &line);
|
||||
}
|
||||
|
||||
TEST_F(F1WireScenario, PartialTextureUploadPreservesGpuClearPixels) {
|
||||
if (!Ready()) return;
|
||||
Attach(GL_RGBA8);
|
||||
|
||||
@@ -50,6 +50,17 @@
|
||||
// RetiringPhase is `-` for every class but BARRIER_PULLED, where it is the ROADMAP phase
|
||||
// whose row stops the pull. It is a string, not an enum, because two of them name two
|
||||
// phases for the two backends and flattening that would lose the half that matters.
|
||||
//
|
||||
// P5f fm: the Magma transport consumers of the nine object rows below have retired.
|
||||
// WireDraw/WireFramebuffer and MagmaProgramSource/UniformManager read server records;
|
||||
// enabled vertex arrays, EBO/indirect/named UBO/SSBO/texel-buffer uses meet the existing
|
||||
// named P7 buffer refusal before any frontend read. Texture sync uses handle-keyed images
|
||||
// and staged bytes, never GetTextureObject. The old getters remain reachable only through
|
||||
// the monolith implementation (or behind the named P7/class-C boundary). Keep these global
|
||||
// classifications until fe + fm are integrated and the residual-fill/generator invariants
|
||||
// are retired together; a missing wire branch must still poison, never read a default.
|
||||
// RecordError belongs to fv. Details and the no-buffer draw counterexample are in
|
||||
// docs/Disaggregated/notes/p5f/fm-report.md.
|
||||
#define MGP_FIELD_OWNERSHIP_LIST(X) \
|
||||
/* ---- BARRIER_PULLED: the 9 non-sticky rows the reduced path actually reads ---- */ \
|
||||
/* scout-unmigrated-census section 3 intersects each verb class's may-read mask with "no */ \
|
||||
|
||||
Reference in New Issue
Block a user