Lambda the Ultimate

inactiveTopic Microsoft DirectX High Level Shading Language
started 5/13/2003; 2:53:46 AM - last post 5/13/2003; 8:49:03 AM
Dan Shappir - Microsoft DirectX High Level Shading Language  blueArrow
5/13/2003; 2:53:46 AM (reads: 1946, responses: 4)
Microsoft DirectX High Level Shading Language
The High Level Shading Language is one of the major new features of Microsoft® DirectX® 9.0 and will change the way we develop shaders forever. With the progression of hardware capabilities, such as additional texture stages and longer instruction counts, real-time shaders are becoming more powerful and complex than ever. This results in algorithms that are difficult to develop using assembler; couple this with the variety of available hardware needing support in your game, and you're in for a shader management nightmare.

This is where the High Level Shader Language helps: Mix with a healthy dose of the Microsoft® Direct3DX (D3DX) Effects framework, and you have a powerful and flexible workspace to create the most awesome shading effects ever seen. Of course you can take advantage of the power of HLSL without even touching D3DX Effects if you wish to.

The DirectX High Level Shading Language is based on a C-style syntax, which eases learning and provides a selection of pre-defined types for scalars, vectors, and matrices. The language also supports a large number of intrinsic functions to help with everyday tasks such as transformation.

Shades (pun intended) of Cg.
Posted to DSL by Dan Shappir on 5/13/03; 2:55:07 AM

Ehud Lamm - Re: Microsoft DirectX High Level Shading Language  blueArrow
5/13/2003; 5:57:56 AM (reads: 778, responses: 0)
How is this supposed to work? Is it compiled (and what does the compilation result in)?

Andrei Formiga - Re: Microsoft DirectX High Level Shading Language  blueArrow
5/13/2003; 6:53:18 AM (reads: 782, responses: 0)
Yes, it's compiled. AFAIK, in the case of DirectX's HLSL, the programs are compiled to Low-Level Shading Language (DirectX pixel shader and vertex shader languages), a kind of assembly language. The "assembly" versions are then compiled to some form which can be executed directly by the graphics chip.

Reading the other topic on Cg (linked above), I'm wondering how could this be implemented with a C++ library (instead of another language/compiler). You'd have to have another compiler anyway, as shader code is executed by the graphics processor (if it supports programmable shaders). Maybe with some preprocessor tricks... Does anyone have other ideas ?

Noel Welsh - Re: Microsoft DirectX High Level Shading Language  blueArrow
5/13/2003; 7:45:02 AM (reads: 761, responses: 1)
Looking at the language definition I think a functional language like SAC would be really good. There are far more optimisation opportunities in SAC than in Fortran and its kindred. SAC already outperforms Fortran code, particularly on parallel processors, which I think is the name of the game in shaders.

Alex Sauer-Budge - Re: Microsoft DirectX High Level Shading Language  blueArrow
5/13/2003; 8:49:03 AM (reads: 777, responses: 0)
For anyone else who was convinced that SAC was not the Scottish Arts Council, but wasn't quite sure what it was, then from the SAC website:

SAC (Single Assignment C) is a strict purely functional programming language whose design is focussed on the needs of numerical applications. Particular emphasis is laid on efficient support for array processing. Efficiency concerns are essentially twofold. On the one hand, efficiency in program development is to be improved by the opportunity to specify array operations on a high level of abstraction. On the other hand, efficiency in program execution, i.e. the runtime performance of programs both in time and memory consumption, is still to be achieved by sophisticated compilation schemes. Only as far as the latter succeeds, the high-level style of specifications can actually be called useful.