Sign in to follow this  
sipickles

HLSL - function returning greater of two values?

Recommended Posts

Hello, Can anyone suggest a HLSL function which returns the higher of two values, equivalent to this C function float myFunction( float a, float b ) { return ( ( a > b ) ? a : b ); } or can i just use ?: in HLSL Also is there a way to see the assembler that a HLSL shader generates, so I can see if it is efficient enough? Thanks Simon

Share this post


Link to post
Share on other sites
1) max(x,y)

which will turn into a single instruction in vs1.1 and above; a single instruction in ps2.0 and above; and about 2 instructions for ps1.x (though they're of course co-issuable if the values are only vector or only scalar).


2) Using FXC effect compiler, specify the "/Fc file" switch to generate an assembly listing to 'file'.


[edit: bah, late again![wink]]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this