Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (Ayumi), 662 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Two HLSL questions #54255
09/05/05 11:03
09/05/05 11:03
Joined: May 2003
Posts: 609
Rattenfängerstadt
Rigoletto Offline OP
Developer
Rigoletto  Offline OP
Developer

Joined: May 2003
Posts: 609
Rattenfängerstadt
Hi,

yesterday i tried HLSL first time and i´am suprised that it is very easy and not so complicated it looks. Just make a try with "Introduction to HLSL shaders" at the top in "Shaders". However i´am makeing a SimpleHLSLShaderTutorial similar to my others.

But i have two questions i can´t find answer for:

1. How to calculate with two different formats, for example float4 and float2. Casting is not working.

2. Is using functions in HLSL slowing down the shader, or it is compiled inline? I ask why i want to make reusable code?

Re: Two HLSL questions [Re: Rigoletto] #54256
09/05/05 12:29
09/05/05 12:29
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline
Expert
Matt_Aufderheide  Offline
Expert
M

Joined: Oct 2003
Posts: 4,131
No, using functions is not any slower, in fact it is partly why HLSL is so useful..it was designed with code reuse in mind.

You cant convert implicitly to larger variable type.. like float 2 to float 3 etc.
Always start with larger variable types and convert down.. or make a 'dummy' float4 out of a float 2 like .. float4 fake(f2.x,f2.y,0,0)

I'm sure you can get more expert advice on this subject elsewhere.


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