Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / a crash when using dark shader

Author
Message
Lucy
18
Years of Service
User Offline
Joined: 19th Apr 2007
Location: Roanoke, VA USA
Posted: 28th Aug 2007 15:15
I took the code from DarkShader's help file and transcribed it perfectly.

Every single line of code is fine except for "sync camera 1" If that line is called, the program crashes to desktop with a big hairy exception message from Windows...

I'm using DBPro version 6.6

Nothing I say is intended to be rude. My autism means that I do not know what is rude and what isn't rude. I apologize if I seem rude. It is not my intention.
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 28th Aug 2007 15:53
Make sure that there is a copy of the Dark Shader file "ShaderData.dll" in your "C:\Program Files\The Game Creators\Dark Basic Professional\Compiler\plugins-user" folder.

I had to copy it across from one of the DarkShader folders to get the new DBPro commands working.
Lucy
18
Years of Service
User Offline
Joined: 19th Apr 2007
Location: Roanoke, VA USA
Posted: 28th Aug 2007 16:24
Just checked, it's definitely there, yes. Still, wouldn't DBPro not even compile the program if it weren't there?

At any rate, I've narrowed it down to the "sync camera 1" line That's making it crash. Well, maybe it's not that line specifically, but the crash happens if that line executes.

Nothing I say is intended to be rude. My autism means that I do not know what is rude and what isn't rude. I apologize if I seem rude. It is not my intention.
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 28th Aug 2007 16:37
Could you post the code (and media) so I can check it here? I vaguely recall that there is a typo/bug in one of the DarkShader DBP code examples and I got it sorted out somehow.

[Was it the example shown in the attached image? If so, I'll test it again myself. Have you got BOTH shaders in the right place, i.e. quad.fx and Edge....fx?]

Attachments

Login to view attachments
Lucy
18
Years of Service
User Offline
Joined: 19th Apr 2007
Location: Roanoke, VA USA
Posted: 28th Aug 2007 16:57 Edited at: 28th Aug 2007 16:58
Attached is my project. I've cleaned it all up. I'm still working on commenting it though. You should see what it was like before though. Absolute mess.

Anyway, after cleaning it up and moving everything into functions without any code (except for globals) hanging around outside of functions, the program still works exactly the same as it did before, and it still crashes when "sync camera 1" executes. Comment that line out and it no longer crashes, just looks weird. But the looking weird ISN'T the point, the fact is that I've implimented the example for full screen shaders as detailed in the Dark Shader help file as best as I can figure, yet it doesn't work.

Nothing I say is intended to be rude. My autism means that I do not know what is rude and what isn't rude. I apologize if I seem rude. It is not my intention.

Attachments

Login to view attachments
JerBil
21
Years of Service
User Offline
Joined: 8th May 2004
Location: Somewhere along the Z axis...
Posted: 28th Aug 2007 22:13 Edited at: 28th Aug 2007 22:15
There is no sync camera command (unless thats one of the new ones.) There is a sync mask command that
can be set to ignore a camera. Check the help files (core commands.)

Ad Astra Per Asper
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 28th Aug 2007 22:45 Edited at: 28th Aug 2007 22:49
Lucy

I thought you were having problems getting the DarkShader example to work. This is what your original post says:

Quote: "I took the code from DarkShader's help file and transcribed it perfectly."


Well, you haven't done that at all!!!

You've written YOUR OWN code for a quite different example and tried to follow the same steps as indicated in the Dark Shader Help file. That is a different thing entirely. Not only that, you've also used the physics plug-in which I don't have, so your code doesn't compile.

However, you've caught me in a good mood and I am investigating.

I've guessed that the "phy" commands were irrelevant to the problem since I assume they only relate to the car's movement. Hence I've commented them all out. The program now compiles and I get exactly the problem you mention.

[You might like to note, for future reference, that if you want someone to investigate a problem for you it would be courteous, and sensible, (1) not to make misleading claims and (2) to remove ALL irrelevant commands first. This helps US help YOU. I'm not aware that "autism" involves memory loss, so I expect you to REMEMBER that request in future. "I apologize if I seem rude", but sometimes I just have to say what I think and feel.]

Now that I have got that off my chest, I'll return to your problem. I haven't got to the source of the problem yet - but it isn't the set camera effect itself. The problem occurs later in the code - but, as you say, it seems to be a consequence of the set camera effect command. Not sure why. I'll continue to investigate.

By the way - interesting scene and model. Makes me think of the place in the states where they do the land speed records. Can't recall where exactly, Utah?, Salt Lake City?

Will post back when I've done some more tests.
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 28th Aug 2007 22:48
Quote: "There is no sync camera command (unless thats one of the new ones.)"


Yes there is - and it IS one of the new ones that come with Dark Shader. Very useful, those new commands.
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 28th Aug 2007 23:03
Quote: "Will post back when I've done some more tests."


Getting there, I think. The crash occurs in the gameloop() function...
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 28th Aug 2007 23:09 Edited at: 29th Aug 2007 00:29
Lucy

My turn to apologize. You said it was the sync camera command that causes the crash not the set camera effect command (MY memory playing tricks). The sync camera command is, of course, in the gameloop() function.

Still testing ...

Edit

Have just removed ALL the code involving the car object - no crash. Looks like something in the car related code is interfering with the sync camera command. No idea why at the moment. No more time for this now. Perhaps you'd like to find out which bit is causing the problem?

By the way, your code is affected by the Dark Shader "typo" I mentioned earlier. If you look at the quad.fx file you'll see it uses a variable called "InvViewSize" whereas your code passes the variable "ViewSize" to it (as in the Dark Shader Help). I think you need to change the vector assignments to:



You also need to check the variable used in the bloom.fx file and make sure you pass the correct values to it in the same way.

Unfortunately, those corrections don't remove the crash.
Lucy
18
Years of Service
User Offline
Joined: 19th Apr 2007
Location: Roanoke, VA USA
Posted: 29th Aug 2007 06:47 Edited at: 29th Aug 2007 06:55
Sorry, I was getting the crash on both the original darkshader and the vehicle physics test. Didn't think there would be a problem. I did not mean to offend. Profuse apologies Green Gandalf.

I will remember in the future, thank you.

The terrain is actually from the Advanced Terrain demo, just stretched out immensely. I wanted gentle rolling hills with flat planes and large flat paths for testing the vehicle on.

I'm going to try to retranscribe it and use the same shader and everything exactly as in the help file. Why did they have to put it in a raster instead of text? Text would have been so much easier, just copy/paste.

I also noticed that it says .dbs instead of .fx for the effect in the original file. Didn't notice that before... I tried using a dbs instead of a .fx and the crash still happens in the same place.

The DarkShader help files mentions that the code they have in it is the "easy way" and that there is a "hard way". I'm guessing the hard way is to have the effect be on an actual screen aligned quad that you manually put infront of the camera... How might one go about doing that?

I care more about getting the effect to work, I'd hate to think I wasted money on Dark Shader, but if the hard way works better...

Nothing I say is intended to be rude. My autism means that I do not know what is rude and what isn't rude. I apologize if I seem rude. It is not my intention.
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 29th Aug 2007 11:01 Edited at: 29th Aug 2007 12:01
Quote: "Profuse apologies Green Gandalf."


Cheerfully accepted.

Actually, I ought to apologize too - my remarks were rather uncalled for.

Quote: "I'm going to try to retranscribe it and use the same shader and everything exactly as in the help file."


I'll try that too later today.

I've got a blur FX demo somewhere that uses the new Dark Shader commands and extra support for shaders - it's much faster than the "hard way" using standard DBP commands plus shaders so it is worth persisting with Dark Shader.

I haven't got much time just now but I will have a fresh look at your code. Despite my earlier complaints it was quite clear and I might be able to narrow the problem down further. The new commands are relatively untested compared to the usual DBP commands so it's possible there is an obscure bug somewhere. However, we'd need to prune the example right down to the minimum that causes the problem before posting as a bug (assuming we are still convinced everything has been done right - and I can't see any problems so far).

Quote: "I also noticed that it says .dbs instead of .fx for the effect in the original file. Didn't notice that before... I tried using a dbs instead of a .fx and the crash still happens in the same place."


I think there is no important difference between .dbs and .fx files as far as DBPro is concerned - I guess .dbs just means it came with Dark Shader and hence might contain some stuff peculiar to Dark Shader/DBP. Not sure really.

Quote: "Why did they have to put it in a raster instead of text? Text would have been so much easier, just copy/paste."


Indeed - and it is something the merry band of beta testers (myself included) should have picked up.

Quote: "I'm guessing the hard way is to have the effect be on an actual screen aligned quad that you manually put infront of the camera... How might one go about doing that?"


The logic and sequence of commands required is very similar to the Dark Shader approach - but the Dark Shader solution is neater and supports extra features (when we've got the bugs out ). I've got a number of examples that do that - and I think that is the method that EVOLVED uses in all his full-screen bloom/HDR/blur shaders so you could check out his shaders. If I can find a simple demo of the method I'll post it later today.

[Just had a thought - one important command might be missing from your code. Will check now and post back.]

Edit

Bingo! It was as simple as that. To use the new commands you must set up the display as follows:



The question is: how did I know that?

That addition stops the crash but still leaves a problem - I'll post back when I've sorted it out (it could be something I've done). Since I think we are nearly there, I'll try to sort it out now rather than later.

Edit2

All sorted now.

You need to make the following additional changes:

1. In the gameloop() function:



This is a quick and dirty fix to ensure that the screen quad isn't culled when you move the camera. Someone might know a better way.

2. You need to correct the screen quad set up:



Those THREE changes (i.e. including the reload display pointer I mentioned earlier) should be all you need.

Let me know how you get on. I won't bother with posting the other demos - you should have a good working demo of your own now.

As I had to comment out a lot of your code to get the project to compile there may be something I've overlooked - but with luck your original demo will work for you with those three changes. Let me know how you get on.
Lucy
18
Years of Service
User Offline
Joined: 19th Apr 2007
Location: Roanoke, VA USA
Posted: 29th Aug 2007 14:24 Edited at: 29th Aug 2007 15:35
Thanks a bunch! I'll go about making the changes just as soon as I fill the cat's water bowl up

(EDIT)
That's... really... REALLY strange... It's actually losing the quad when run. The screenquad object exists just before the do loop, but once the do loop exists, the screenquad no longer exists, causing the program to exist... what the heck?

(EDIT AGAIN)
It seems to be deleting the screenquad object *after* the first frame runs... or perhaps during it, but after the last line requiring it to be around has been run...

(YET ANOTHER EDIT)
Ok, the screenquad is getting deleted where i've noted here in the game loop


there's only one conclusion... it's getting deleted during the sync command... I'm going to try fastsync since it skips over a bunch of "mandantory" stuff.

(LAST EDIT)
fastsync isn't preventing it from being deleted either... This is definitely a major bug... why would sync delete an object?

Here's my entire gameloop and the other functions i've changed as per your recommendations


Nothing I say is intended to be rude. My autism means that I do not know what is rude and what isn't rude. I apologize if I seem rude. It is not my intention.
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 29th Aug 2007 19:32 Edited at: 29th Aug 2007 19:32
Lucy

I've just copied and pasted your three functions over the ones in my copy and everything works fine. Since I've commented out all the "phy" commands those could be the problem.

I suggest you start with the code I'm using (attached) and first check that it actually works for you. If it works then carefully reinstate the "phy" commands a few at a time and see when things break.

I can't think of anything else to suggest.

Attachments

Login to view attachments
Lucy
18
Years of Service
User Offline
Joined: 19th Apr 2007
Location: Roanoke, VA USA
Posted: 29th Aug 2007 20:27 Edited at: 29th Aug 2007 20:50
Thanks Green Gandalf. You've been a great help!

(EDIT)
I ran just that straight file as you gave it to me... It's still doing it, it's still losing the screenquad... So there's probably either something funky with my installation of DBPro, or my mix of plugins...

(EDIT AGAIN)
I put in some code to cause it to recreate the quad every loop and now it's losing the terrain... What do you want to bet it's losing the car too? Somehow, I think this DarkShader stuff is causing DBPro to lose all of its objects...

(YET ANOTHER EDIT)
It seems that it's the reload display pointer's fault. If that command is not run, the objects aren't deleted after sync.

Nothing I say is intended to be rude. My autism means that I do not know what is rude and what isn't rude. I apologize if I seem rude. It is not my intention.
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 29th Aug 2007 20:52 Edited at: 29th Aug 2007 20:54
Quote: "Somehow, I think this DarkShader stuff is causing DBPro to lose all of its objects..."


Sounds very unlikely.

Quote: "It's still doing it, it's still losing the screenquad"


What error message are you getting?

Edit

Quote: "It seems that it's the reload display pointer's fault."


You should get a crash if that is removed.
Lucy
18
Years of Service
User Offline
Joined: 19th Apr 2007
Location: Roanoke, VA USA
Posted: 29th Aug 2007 21:03 Edited at: 29th Aug 2007 21:07
The error message is "Runtime Error 7008 - Object does not exist at line X" Just pick an object that's being called in the game loop and it'll say the object at that line doesn't exist after the first time "sync" is run (unless the object recreated after sync). Then the program just drops back to the IDE.

Quote: "You should get a crash if that is removed."


Well, what I did was I pulled out all the DarkShader stuff in the game loop like so



Then, I run it with the reload display pointer and it drops the objects. Run it without the reload display pointer and it doesn't drop them.

Nothing I say is intended to be rude. My autism means that I do not know what is rude and what isn't rude. I apologize if I seem rude. It is not my intention.
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 29th Aug 2007 21:06
Quote: "it drops the objects"


Yet again - what error message(s) do you get?
Lucy
18
Years of Service
User Offline
Joined: 19th Apr 2007
Location: Roanoke, VA USA
Posted: 29th Aug 2007 21:08
Quote: "Yet again - what error message(s) do you get?"


Sorry realized yous aid that after i posted and edited it in, didn't expect you to see it so soon (i'm sleepy as hell, sorry)

The error message is "Runtime Error 7008 - Object does not exist at line X" Just pick an object that's being called in the game loop and it'll say the object at that line doesn't exist after the first time "sync" is run (unless the object recreated after sync). Then the program just drops back to the IDE.

Nothing I say is intended to be rude. My autism means that I do not know what is rude and what isn't rude. I apologize if I seem rude. It is not my intention.
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 29th Aug 2007 21:13
Just pasted your last code snippet and got the attached screenshot - and reload display pointer is still being run.

I have no idea why you're having these problems, I'm afraid.

Attachments

Login to view attachments

Login to post a reply

Server time is: 2025-05-23 06:06:23
Your offset time is: 2025-05-23 06:06:23