Hi all,
How can I declare global temporaries (i.e. variables accessible to all functions within a shader) in HLSL?
Trying to do this the straightforward way gives a compiler error. The manual also mentions that global variables are considered uniforms (i.e. shader constants). Is there any way to declare them to be temporaries? Is there some convenient alternative approach? I'm trying to translate some C/C++ to HLSL...
Thanks,
Nicolas
HLSL global variables
Started by Nick, Jan 07 2010 02:47 PM
2 replies to this topic
#1
Posted 07 January 2010 - 02:47 PM
#2
Posted 07 January 2010 - 04:21 PM
Shouldn't the static modifier on a global be enough?
.edit: just tried, static indeed seems to work
Quote
static - Mark a local variable so that it is initialized one time and persists between function calls. If the declaration does not include an initializer, the value is set to zero. A global variable marked static is not visible to an application.
.edit: just tried, static indeed seems to work
C++ addict
-
Currently working on: the 3D engine for Tomb Raider.
-
Currently working on: the 3D engine for Tomb Raider.
#3
Posted 08 January 2010 - 01:00 PM
Excellent, thanks!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












