mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-07 01:53:24 +09:00
[MG_Backend, MG_Test] (Disaggregated): P5f fv - keep hidden frontend programs off server initialization
This commit is contained in:
@@ -4482,6 +4482,12 @@ void main() {
|
||||
}
|
||||
|
||||
Bool VulkanRenderer::InitializeBlitResources() {
|
||||
#if MOBILEGL_BUILD_DISAGGREGATED
|
||||
// P5f fv: both window and headless transports use WireFramebuffer's native
|
||||
// operations. These hidden programs are frontend objects, so even creating
|
||||
// them on the server would retain a client compiler/allocator dependency.
|
||||
if (MG_Config::Transport != MG_Config::TransportMode::Monolith) return true;
|
||||
#endif
|
||||
ShutdownBlitResources();
|
||||
|
||||
auto vertexShader = MakeShared<MG_State::GLState::ShaderObject>(ShaderStage::Vertex, kHiddenBlitVertexShaderId);
|
||||
@@ -4574,6 +4580,12 @@ void main() {
|
||||
}
|
||||
|
||||
Bool VulkanRenderer::InitializeDepthMipmapResources() {
|
||||
#if MOBILEGL_BUILD_DISAGGREGATED
|
||||
// P5f fv: both window and headless transports use WireFramebuffer's native
|
||||
// operations. These hidden programs are frontend objects, so even creating
|
||||
// them on the server would retain a client compiler/allocator dependency.
|
||||
if (MG_Config::Transport != MG_Config::TransportMode::Monolith) return true;
|
||||
#endif
|
||||
ShutdownDepthMipmapResources();
|
||||
|
||||
auto vertexShader = MakeShared<MG_State::GLState::ShaderObject>(ShaderStage::Vertex,
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <MG_Backend/DirectGLES/Managers.h>
|
||||
#include <MG_Backend/DirectGLES/Utils.h>
|
||||
#include <MG_Backend/MGPipe/PipeInputs.h>
|
||||
#include <MG_Backend/DirectVulkan/Renderer/VulkanRenderer.h>
|
||||
#include <MG_Impl/Pipe/PipeFill.h>
|
||||
#include <MG_Impl/Pipe/ResourceTracker.h>
|
||||
#include <MG_Pipe/MGPipe.h>
|
||||
@@ -2293,6 +2294,33 @@ namespace {
|
||||
};
|
||||
}
|
||||
|
||||
namespace {
|
||||
// Exercise the real hidden-resource constructors without adding a production test API.
|
||||
// Explicit template instantiation permits naming a private member ([temp.explicit]).
|
||||
using FvRenderer = MG_Backend::DirectVulkan::VulkanRenderer;
|
||||
struct FvBlitInitTag {
|
||||
using type = Bool (FvRenderer::*)();
|
||||
friend type FvPrivateMember(FvBlitInitTag);
|
||||
};
|
||||
struct FvMipmapInitTag {
|
||||
using type = Bool (FvRenderer::*)();
|
||||
friend type FvPrivateMember(FvMipmapInitTag);
|
||||
};
|
||||
template <class Tag, typename Tag::type Member> struct FvMemberAccess {
|
||||
friend typename Tag::type FvPrivateMember(Tag) { return Member; }
|
||||
};
|
||||
template struct FvMemberAccess<FvBlitInitTag, &FvRenderer::InitializeBlitResources>;
|
||||
template struct FvMemberAccess<FvMipmapInitTag, &FvRenderer::InitializeDepthMipmapResources>;
|
||||
}
|
||||
|
||||
TEST(P5fReverseChannel, TransportDoesNotConstructHiddenFrontendPrograms) {
|
||||
// No Vulkan device, program factory or client GLContext is supplied. A transport
|
||||
// initialization must not need any of them merely to skip these monolith resources.
|
||||
FvRenderer renderer({});
|
||||
EXPECT_TRUE((renderer.*FvPrivateMember(FvBlitInitTag{}))());
|
||||
EXPECT_TRUE((renderer.*FvPrivateMember(FvMipmapInitTag{}))());
|
||||
}
|
||||
|
||||
TEST(P5fReverseChannel, GlErrorsUseTheOwnedCallbackWithoutAResidualPull) {
|
||||
FvGlobals restore;
|
||||
MG_Config::Ipc.StrictErrors = true;
|
||||
|
||||
Reference in New Issue
Block a user