Gamestudio Links
Zorro Links
Newest Posts
Sierra Chart Plugin
by AndrewAMD. 11/22/19 02:52
Multiple Charts
by felixfx. 11/20/19 14:00
Moving Average crossover
by felixfx. 11/20/19 13:57
Suppressing Messages
by MatPed. 11/19/19 11:05
Indicator and TimeFrame
by aventador. 11/19/19 02:27
Comment Out
by AndrewAMD. 11/18/19 17:55
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
5 registered members (jenGs, Ayumi, MatPed, Quad, phs), 673 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
anonymous87, LaszloK, gra9, Dev_ill, Ryu
18330 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
D3D Device Reset Failure (Caused by UAC and Lock Screen) #478085
09/05/19 13:43
09/05/19 13:43
Joined: Jul 2007
Posts: 539
Turkey, izmir
Emre Offline OP
User
Emre  Offline OP
User

Joined: Jul 2007
Posts: 539
Turkey, izmir
Hi guys,

D3D Device failure during screen lock and also failure during UAC. it's not a big problem for game engine but i made a desktop program with acknex. it's running always. so if i run any setup program, my application crashes by uac. if i locked the windows screen, it's crashes again.

Want to share two videos about problem:
crash after screen lock
crash by uac

it crashes randomly especially if project contain a view.stage. My opinion is the problem is related with render target. Just guessing, still not sure.

i wonder is there anything i can do. i really need to solve this problem. is there any way? Please share your idea and information with me.

Here is the test code which i use in first video:

Code
#include <acknex.h>
#include <default.c>

MATERIAL* test_mat1 = 
{
	effect="Texture TargetMap;
	sampler2D g_samSrcColor = sampler_state { texture = <TargetMap>; MipFilter = Linear;	};
	float4 postprocessing_negative( float2 Tex : TEXCOORD0 ) : COLOR0 
	{
		float3 Color = 1. - tex2D( g_samSrcColor, Tex.xy).xyz;
		return float4(Color,1.);
	}
	technique PostProcess 
	{
		pass p1 
		{
			AlphaBlendEnable = false;
			VertexShader = null;
			PixelShader = compile ps_2_0 postprocessing_negative();
		}
	}";
}

VIEW* post_view1 ={layer = 0; flags = PROCESS_TARGET; material=test_mat1;}
function d3dreset()
{
	diag("\n\nD3D DEVICE RESET!\n");
}
function d3dlost()
{
	diag("\n\nD3D DEVICE LOST!\n");
}
function main()
{
	on_d3d_reset=d3dreset;
	on_d3d_lost=d3dlost;
	wait(3);
	level_load("");
	camera.stage = post_view1;  
}




You can test it. i have A7. if you have A8 you will probably get different message like: "3D Hardware Reset Failure."

Last edited by Emre; 09/09/19 20:42. Reason: videos are no longer available
Re: D3D Device Reset Failure (Caused by UAC and Lock Screen) [Re: Emre] #478095
09/06/19 18:07
09/06/19 18:07
Joined: Oct 2007
Posts: 5,170
─░stanbul, Turkey
Quad Online
Senior Expert
Quad  Online
Senior Expert

Joined: Oct 2007
Posts: 5,170
─░stanbul, Turkey
I tried removing and and recreating materials and stage views manually after reset/load but no dice. (A8)

Someone else correct me if i am wrong but I'd say this is a bug that engine forgets to destroy/recreate some internal stuff when actual d3d lost/restore events occur(when you are using PP views.)

IF that's a bug, don't think it will ever get fixed, considering the state of engine development in the last couple of years.


3333333333
Re: D3D Device Reset Failure (Caused by UAC and Lock Screen) [Re: Quad] #478097
09/06/19 21:29
09/06/19 21:29
Joined: Jul 2007
Posts: 539
Turkey, izmir
Emre Offline OP
User
Emre  Offline OP
User

Joined: Jul 2007
Posts: 539
Turkey, izmir
Originally Posted by Quad
Someone else correct me if i am wrong but I'd say this is a bug that engine forgets to destroy/recreate some internal stuff when actual d3d lost/restore events occur(when you are using PP views.)

IF that's a bug, don't think it will ever get fixed, considering the state of engine development in the last couple of years..


That's what i'm afraid of. Thank you for testing and sharing your knowledge,Quad.

Re: D3D Device Reset Failure (Caused by UAC and Lock Screen) [Re: Emre] #478106
09/07/19 20:40
09/07/19 20:40
Joined: Jul 2007
Posts: 539
Turkey, izmir
Emre Offline OP
User
Emre  Offline OP
User

Joined: Jul 2007
Posts: 539
Turkey, izmir
Okay i found a solution. I'm sharing it in case you need it.

Code
#include <acknex.h>
#include <windows.h>
#include <default.c>

#ifndef material_and_view
	#define material_and_view
	MATERIAL* test_mat1 = 
	{
		effect="Texture TargetMap;
		sampler2D g_samSrcColor = sampler_state { texture = <TargetMap>; MipFilter = Linear;	};
		float4 postprocessing_negative( float2 Tex : TEXCOORD0 ) : COLOR0 
		{
			float3 Color = 1. - tex2D( g_samSrcColor, Tex.xy).xyz;
			return float4(Color,1.);
		}
		technique PostProcess 
		{
			pass p1 
			{
				AlphaBlendEnable = false;
				VertexShader = null;
				PixelShader = compile ps_2_0 postprocessing_negative();
			}
		}";
	}

	VIEW* post_view1 ={layer = 0; flags = PROCESS_TARGET; material=test_mat1;}
#endif

#ifndef fps_counter
	#define fps_counter
	var temp_fps;
	var actual_fps;
	function check_fps()
	{
		while(1)
		{
			temp_fps = 0.9*temp_fps+0.1/time_frame;
			actual_fps=temp_fps*16;
			DEBUG_VAR(actual_fps,10);
			wait(1);
		}
		
	}
#endif

#define DESKTOP_SWITCHDESKTOP 0x0100L
#define DF_ALLOWOTHERACCOUNTHOOK 0x0001

int DesktopResult;
int is_stage_off=0;

HWND* DeskHwnd;

function onexit()
{
	CloseDesktop(DeskHwnd);// i don't know if it's necessary.
}
function main()
{
	video_mode=10;
	video_screen=2;
	wait(3);
	fps_max=500;
	check_fps();
	on_exit=onexit;
	level_load("");
	camera.stage = post_view1;  
	DeskHwnd = OpenDesktop("Default", DF_ALLOWOTHERACCOUNTHOOK, false, DESKTOP_SWITCHDESKTOP);
	while(1)
	{
		if (DeskHwnd != 0)
		{
			DesktopResult = SwitchDesktop(DeskHwnd);
		}
		
		if (DesktopResult == 0)//Desktop is locked via uac or lock screen
		{   
			
			//remove the stage immediatly
			if(is_stage_off==0)
			{
				diag("\n\n!LOCKED!\n");
				camera.stage=NULL;
				is_stage_off=1;
				/*
				"wait(actual_fps);" is important, because desktop is locked and unlocked two time at once. (i don't know why)
				e.g: when you locked your screen and open it again. Diag message must be "!Locked! !Unloked!" But it doesn't.
				instead, it's "!Locked! !Unloked! !Locked! !Unloked!"
				That my cause a crash when we use pp_add and pp_remove repeatedly.
				So wait for it. No problem with this way.
				*/
				wait(actual_fps);
			}
			
			
		}
		else//Desktop is UNlocked
		{
			
			//setup post effect again
			if(is_stage_off==1)
			{
				diag("\n\n!UNLOCKED!\n");
				camera.stage=post_view1;
				is_stage_off=0;
				wait(1);
			}
			
		}	
		wait(1);
	}
}



Cheers! laugh


Moderated by  elsewood, old_bill, Tobias 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1