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 / Shader - commands not compiling?

Author
Message
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 28th Feb 2013 17:46 Edited at: 28th Feb 2013 17:47
Hi all,

I've been programming a lot of shaders lately and came across a strange disadvantage in DBP shaders that OpenGL doesn't have. Here are two code snippets which won't compile in DBP, but will compile in OpenGL.

This throws a "Loop doesn't appear to terminate" error:


This throws a "syntax error":


Are there any work-arounds?

TheComet

zeroSlave
17
Years of Service
User Offline
Joined: 13th Jun 2009
Location: Springfield
Posted: 1st Mar 2013 04:44 Edited at: 1st Mar 2013 04:47
I'm really a novice with shaders, but...
What PS/VS compiler versions are you using? I know that older versions such as 1.1, etc do not support certain operators and commands.

I saw on here that any version under 3.0 will not allow non-constant variables in a for loop. It's GLSL not HLSL, but I would assume this issue would be the same for both?

I'm lazy and didn't attempt to compile anything, but:


Hope you figure it out! Best of luck!

Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid.
Ortu
DBPro Master
18
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 1st Mar 2013 05:43


is there any code in this loop or is it literally just a commented line?

if its just a comment, try this?



TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 2nd Mar 2013 13:43
@ zeroSlave

I'm using shader model 2.0 for both PS and VS. The (i == 2) thing was just a typo, I did use two equals.

I tried using a higher model, but it didn't have any effect.

Quote: "is there any code in this loop or is it literally just a commented line?"


There's code there, I just didn't post it for the sake of simplicity.

The problem still persists, and I have no idea why. Can someone confirm that the command break doesn't work?

TheComet

zeroSlave
17
Years of Service
User Offline
Joined: 13th Jun 2009
Location: Springfield
Posted: 3rd Mar 2013 19:44
I don't think DBP supports anything over 2.0.
I tried inserting 'break' into some of my own shaders and they didn't work at all. :/

It's not as pretty, but you could do something like:



Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid.
Brendy boy
20
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 3rd Mar 2013 23:21
Quote: "I don't think DBP supports anything over 2.0."

it supports everything that is in dx9 and that are shader versions up to 3.0

zeroSlave
17
Years of Service
User Offline
Joined: 13th Jun 2009
Location: Springfield
Posted: 6th Mar 2013 03:39
Didn't realize that! Thanks for the info, Brendy Boy!

Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid.
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 6th Mar 2013 13:31
Yeah, I guess I'll have to settle for that for the time being... Thanks for the help!

TheComet

Login to post a reply

Server time is: 2026-07-07 02:41:01
Your offset time is: 2026-07-07 02:41:01