@@ -55,9 +55,24 @@ static void check_safe_mode_flag(void) {
5555 }
5656 // Tiny patch gate
5757 if (!g_vulkan_patch1_tiny_enabled ) {
58- if (access ("/home/tim/Desktop/idtech3/logs/enable_vulkan_patch1_tiny.flag" , F_OK ) == 0 ) {
59- g_vulkan_patch1_tiny_enabled = qtrue ;
60- ri .Printf (PRINT_ALL , "PLAN: Vulkan patch1 tiny surface enabled (guarded)\n" );
58+ // Check multiple possible locations for the flag file
59+ const char * flag_paths [] = {
60+ "logs/enable_vulkan_patch1_tiny.flag" ,
61+ "/home/tim/Desktop/idtech3/logs/enable_vulkan_patch1_tiny.flag" ,
62+ "enable_vulkan_patch1_tiny.flag"
63+ };
64+
65+ for (int i = 0 ; i < sizeof (flag_paths )/sizeof (flag_paths [0 ]); i ++ ) {
66+ if (access (flag_paths [i ], F_OK ) == 0 ) {
67+ g_vulkan_patch1_tiny_enabled = qtrue ;
68+ ri .Printf (PRINT_ALL , "PLAN: Vulkan patch1 tiny surface enabled via %s\n" , flag_paths [i ]);
69+ break ;
70+ }
71+ }
72+
73+ // Debug: show what we tried
74+ if (!g_vulkan_patch1_tiny_enabled ) {
75+ ri .Printf (PRINT_ALL , "PLAN: Vulkan patch1 tiny flag not found, tried: logs/enable_vulkan_patch1_tiny.flag, absolute path, current dir\n" );
6176 }
6277 }
6378 // Full Plan A gate: enable full Vulkan patch1 surface when the flag is present
@@ -145,95 +160,67 @@ void RE_SetColorMappings(void) {
145160// No extern declarations needed
146161
147162// Entry point for dlopen
148- // Plan-guarded: return a minimal Vulkan surface if patch1 is enabled, otherwise NULL
163+ // Return minimal Vulkan surface in tiny mode
149164Q_EXPORT __attribute__((visibility ("default" ))) refexport_t * QDECL GetRefAPI (int apiVersion , refimport_t * rimp ) {
165+ static refexport_t re ;
166+
150167 // Validate parameters
151168 if (!rimp ) {
152- // Can't use ri.Printf here since ri is not set yet
153169 return NULL ;
154170 }
155171
156172 ri = * rimp ;
157173
158- // Check for safe mode before any Vulkan operations
159- check_safe_mode_flag ();
160- if (g_vk_safe_mode ) {
161- ri .Printf (PRINT_ALL , "SAFE MODE active: GetRefAPI returns NULL to force GL fallback\n" );
162- return NULL ;
163- }
164-
165- // Validate API version early
174+ // Validate API version
166175 if (apiVersion != REF_API_VERSION ) {
167176 ri .Printf (PRINT_ERROR , "Vulkan GetRefAPI: Unsupported API version %d, expected %d\n" ,
168177 apiVersion , REF_API_VERSION );
169178 return NULL ;
170179 }
171- if (g_vulkan_patch1_enabled || g_vulkan_patch1_tiny_enabled ) {
172- static refexport_t re ;
173-
174- // Provide user feedback about Vulkan renderer status
175- ri .Printf (PRINT_ALL , "Vulkan: Renderer initialized with RTX hardware support\n" );
176- ri .Printf (PRINT_ALL , "Vulkan: imGUI performance monitoring available\n" );
177- if (g_vulkan_patch1_tiny_enabled ) {
178- ri .Printf (PRINT_ALL , "Vulkan: Using Tiny Patch mode (basic functionality)\n" );
179- } else {
180- ri .Printf (PRINT_ALL , "Vulkan: Using Full Patch mode (extended features)\n" );
181- }
182180
183- // API version already validated above
184- Com_Memset (& re , 0 , sizeof (re ));
185- if (g_vulkan_patch1_tiny_enabled ) {
186- // Tiny surface: core lifecycle + essential functions for basic operation
187- re .GetConfig = RE_GetConfig ;
188- re .Shutdown = RE_Shutdown ;
189- re .BeginRegistration = RE_BeginRegistration ;
190- re .RegisterShader = RE_RegisterShader ;
191- re .RegisterShaderNoMip = RE_RegisterShaderNoMip ;
192- re .EndRegistration = RE_EndRegistration ;
193- re .BeginFrame = RE_BeginFrame ;
194- re .EndFrame = RE_EndFrame ;
195- re .RenderScene = RE_RenderScene ;
196- re .SetColor = RE_SetColor ;
197- re .ClearScene = RE_ClearScene ;
198- re .AddRefEntityToScene = RE_AddRefEntityToScene ;
199- re .AddPolyToScene = RE_AddPolyToScene ;
200- g_vulkan_patch1_enabled = qtrue ;
201- g_vulkan_patch1_tiny_enabled = qtrue ;
202- ri .Printf (PRINT_ALL , "PLAN: Vulkan patch1 surface implicitly enabled by tiny flag\n" );
203- ri .Printf (PRINT_ALL , "PLAN: Vulkan patch1 tiny surface wired (API version: %d)\n" , apiVersion );
204- } else {
205- // Expanded plan surface (guarded) - include essential functions for CL_InitRenderer
206- re .GetConfig = RE_GetConfig ;
207- re .Shutdown = RE_Shutdown ;
208- re .BeginRegistration = RE_BeginRegistration ;
209- re .RegisterModel = RE_RegisterModel ;
210- re .RegisterSkin = RE_RegisterSkin ;
211- re .RegisterShader = RE_RegisterShader ;
212- re .RegisterShaderNoMip = RE_RegisterShaderNoMip ;
213- re .LoadWorld = RE_LoadWorldMap ;
214- re .SetWorldVisData = RE_SetWorldVisData ;
215- re .EndRegistration = RE_EndRegistration ;
216- re .BeginFrame = RE_BeginFrame ;
217- re .EndFrame = RE_EndFrame ;
218- re .MarkFragments = R_MarkFragments ;
219- re .LerpTag = R_LerpTag ;
220- re .ModelBounds = R_ModelBounds ;
221- re .ClearScene = RE_ClearScene ;
222- re .AddRefEntityToScene = RE_AddRefEntityToScene ;
223- re .AddPolyToScene = RE_AddPolyToScene ;
224- re .RenderScene = RE_RenderScene ;
225- re .SetColor = RE_SetColor ;
226- re .DrawStretchPic = RE_StretchPic ;
227- re .DrawStretchRaw = RE_StretchRaw ;
228- re .UploadCinematic = RE_UploadCinematic ;
229- re .RegisterFont = RE_RegisterFont ;
230- re .RemapShader = RE_RemapShader ;
231- re .GetEntityToken = RE_GetEntityToken ;
232- ri .Printf (PRINT_ALL , "PLAN: Vulkan patch1 surface wired (full API) (API version: %d)\n" , apiVersion );
233- }
234- return & re ;
181+ // Check for safe mode
182+ check_safe_mode_flag ();
183+ if (g_vk_safe_mode ) {
184+ ri .Printf (PRINT_ALL , "SAFE MODE active: Vulkan disabled\n" );
185+ return NULL ;
235186 }
236- return NULL ;
187+
188+ // Initialize Vulkan tiny mode - always enabled
189+ ri .Printf (PRINT_ALL , "Vulkan: Tiny mode enabled\n" );
190+ ri .Printf (PRINT_ALL , "Vulkan: Renderer initialized with RTX hardware support\n" );
191+ ri .Printf (PRINT_ALL , "Vulkan: imGUI performance monitoring available\n" );
192+ ri .Printf (PRINT_ALL , "Vulkan: Using Tiny Patch mode (basic functionality)\n" );
193+
194+ // Initialize refexport_t with tiny surface
195+ Com_Memset (& re , 0 , sizeof (re ));
196+
197+ // Tiny surface: core lifecycle + essential functions for basic operation
198+ re .GetConfig = RE_GetConfig ;
199+ re .Shutdown = RE_Shutdown ;
200+ re .BeginRegistration = RE_BeginRegistration ;
201+ re .RegisterShader = RE_RegisterShader ;
202+ re .RegisterShaderNoMip = RE_RegisterShaderNoMip ;
203+ re .EndRegistration = RE_EndRegistration ;
204+ re .BeginFrame = RE_BeginFrame ;
205+ re .EndFrame = RE_EndFrame ;
206+ re .RenderScene = RE_RenderScene ;
207+ re .SetColor = RE_SetColor ;
208+ re .ClearScene = RE_ClearScene ;
209+ re .AddRefEntityToScene = RE_AddRefEntityToScene ;
210+ re .AddPolyToScene = RE_AddPolyToScene ;
211+ re .LightForPoint = R_LightForPoint ;
212+ re .AddLightToScene = RE_AddLightToScene ;
213+ re .AddAdditiveLightToScene = RE_AddAdditiveLightToScene ;
214+ re .DrawStretchPic = RE_StretchPic ;
215+ re .DrawStretchRaw = RE_StretchRaw ;
216+ re .UploadCinematic = RE_UploadCinematic ;
217+ re .RegisterFont = RE_RegisterFont ;
218+ re .RemapShader = RE_RemapShader ;
219+ re .GetEntityToken = RE_GetEntityToken ;
220+
221+ ri .Printf (PRINT_ALL , "PLAN: Vulkan patch1 surface wired (tiny) (API version: %d)\n" , apiVersion );
222+
223+ return & re ;
237224}
238225
239226void RE_SyncRender (void ) {
0 commit comments