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.

Dark GDK / Shaders Revisited

Author
Message
drnelson
19
Years of Service
User Offline
Joined: 26th Feb 2005
Location:
Posted: 27th Feb 2005 08:25
Sorry about an earlier post.. but it seems my posts take a long time to show up.. thanks!

I'm trying to run this simple shader code:


And here is my Dark Games App code:


The shader DOES work with DX9 and runs flawless. It just does a simple ambient lighting system. I ported this over to the Dark SDK and now I get an error if I create a world, view, projection matrix, multiply them together and set the constant. It crashes in the setmatrix function. So I learned about the semantic for the DG's worldviewproj and tried that. That's what I'm doing in the code above and I get a stack overflow error. What is going on? I don't understand why it isn't working.

Thanks,
David
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 27th Feb 2005 22:33
The only strange thing for me is that the PS does not receive any parameters...
And VS is putting out the structure VS_OUTPUT, uh, shouldn't this arrive to the PS?
If I'm right, try something like this:

instead of



Quote: "It crashes in the setmatrix function"


Well, you did not post that code, although I don't think that the problem is over there.

Also, maybe you should close or delete the duplicated post. (Just post a message saying that to the forum moderators).
Required
19
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Server Down
Posted: 28th Feb 2005 00:54
The problem with the shader is that your not actually passing anything through. You have to make sure you declare both the output and input of the vertex shader, then need to pass this on to the pixel shader.



I do not own the Dark Game SDK, however this code works fine in Dark BASIC Professional 1.05.7, hope that it helps.
drnelson
19
Years of Service
User Offline
Joined: 26th Feb 2005
Location:
Posted: 28th Feb 2005 10:16
Ok, sorry but that is not the reason I'm getting the stack overflow. I know this because of two reasons. First a pixel shader on needs to return position and color values and does not require input passed to it. This .fx shader is the perfect example of this because it generates the ambient lighting and color within the function. Also input for the function could be from the constants. The second reason I know this isn't the issue is because I changed it to have input:
float4 PS( float4 Pos: POSITION ) : COLOR

And also added my own struct for input as well to make sure that wasn't the issue.

The last reason I know the shader code is fine is because it works flawlessly in DirectX 9.0c Feb code. I have written my own DX code as well as used the example base code from the samples in DX9 and just loaded my .fx file.

So first of all, WHY doesn't a standard .fx file that works in dx9 not work with the DG's SDK? In my opinion the standard HLSL shader and .fx file used in DX9 should be easily added to the SDK instead of having to add seperate semantics etc.. however, what needs to be changed. I will try anything and everything. Is there a problem with the DGSDK loading code?

Thanks for the help so far though! I really appreciate it.

David
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 28th Feb 2005 20:12 Edited at: 28th Feb 2005 20:14
Yep, I've tried the code/shader with DBPro and it runs with no problem at all.

I own DBSDK, but havenĀ“t installed it yet, so if someone else check this and also fails, maybe you should post this at the bug thread above in this forum.

(PS: A constant color Pixel Shader Output? why don't you just put out the constant value? No need for operations... Uh)
drnelson
19
Years of Service
User Offline
Joined: 26th Feb 2005
Location:
Posted: 1st Mar 2005 02:25
True, you can just skip the operations.. I could just multiply the values out myself and return those.. but this is just for the sake of testing a simple .fx file on DG's SDK. I wanted to throw in a little multi, globals, and other little things to see if I have any problems.. that's all.. so I could have just left that out..


Thanks,
David

Login to post a reply

Server time is: 2024-11-18 23:48:34
Your offset time is: 2024-11-18 23:48:34