Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (degenerate_762, Nymphodora), 1,012 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Restarting Post Processing for resolution change #469383
11/14/17 04:08
11/14/17 04:08
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
Hello, im working on a simple post processing shader. I can get the PP to work correctly until the resolution changes. Ive searched on the forum for how to restart the chain, some of which say just to resize the render target bmap. But ive only seen ptr_remove used to destroy the bmap, and bmap_createblack again. But if I do this, the texture memory gets used up, almost as if ptr_remove isnt removing anything. How do I restart this post processing without stacking memory?

the simple chain

Code:
BMAP* g_buffer_scene;

VIEW* camMix = { layer = 2; }


function start_PP ()
{
	
	
g_buffer_scene = bmap_createblack(screen_size.x, screen_size.y, 24);  //screen_size.x, screen_size.y

camera->bmap = g_buffer_scene;

//	VIEW *camMix = view_create ( 2 );

   camMix->material = post_blood_pixel;	//pp_test_mine;	

	camMix->flags |= PROCESS_TARGET | SHOW;
	

camera->stage = camMix;
	
}



The attempt to remove the chain and free memory:
Code:
bmap_purge(g_buffer_scene);
   ptr_remove(g_buffer_scene);
   
   ptr_remove(camMix->material);
	ptr_remove(camMix->bmap);
	ptr_remove(camMix);



But memory isnt freed when I try to remove the chain. I want to remove it first, then i can attempt to restart it.

I just want to reapply the PP after the resolution changes.

Re: Restarting Post Processing for resolution change [Re: jumpman] #469414
11/15/17 11:14
11/15/17 11:14
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Hi,
I can't reproduce this issue in a blank level.

Code:
void resolutionChange () {
	camera->flags &= ~SHOW;
	camPP->flags &= ~SHOW;
	camera->stage = NULL;
	bmap_remove ( camera->bmap );
	camera->bmap = NULL;
	video_mode = video_switch ( video_mode+1, 32, 2 );
	if ( !video_mode )
		video_mode = video_switch ( 1, 32, 2 );
	// wait(1);
	camera->bmap = bmap_createblack ( screen_size.x, screen_size.y, 24 );
	camera->stage = camPP;
	camera->flags |= SHOW;
	camPP->flags |= SHOW;
}


Re: Restarting Post Processing for resolution change [Re: txesmi] #469435
11/15/17 21:24
11/15/17 21:24
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
this works correctly! Thank you friend!

Though if I dont put a wait(-1); before and after the recreation, i get a DirectX error, cannot create texture unnamed. What is that?

Re: Restarting Post Processing for resolution change [Re: jumpman] #469451
11/16/17 18:47
11/16/17 18:47
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
I don't really know. I am sorry. I guess it has something to do with the try of the GPU to access to a deleted buffer but no idea why and when could it happen. A resolution change is conflictive because everything has to be rebuilt from scratch after resizing the device backbuffers. I would try to avoid it as much as possible. Have you got more cameras around? Has any entity or material a rendertarget linked for shading?

You might try to set a larger bmap_zbuffer from the very beginning so the rendering target is not resized, just its viewport... I hope wink



Moderated by  Blink, Hummel, Superku 

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