O'Reilly logo

Learning XNA 3.0 by Aaron Reed

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 13. HLSL Basics

Let's take a break from developing the game for a minute and talk about High Level Shader Language (HLSL). Pre-XNA, DirectX allowed developers to send instructions directly to the graphics device through a mechanism called the Fixed Function Pipeline (FFP). This worked fine for a while, until graphics cards and hardware began to become incredibly complex. The more capabilities that were added to the hardware, the more detailed and complex the FFP needed to become to allow developers to take full advantage of that hardware.

Tip

Even on modern cards, the FFP is implemented as a shader—just one that operates behind the scenes. This is very similar to the way that BasicEffect gives developers access to a simple version of the FFP.

Instead of continually adding features to the FFP and extending it, Microsoft decided instead to allow developers to talk directly to the hardware devices in a different language built specifically for those devices.

The first attempt to solve this problem was to allow developers to program directly to the hardware using assembly language. While this approach was functional, developers still needed a higher-level language to develop in. Enter HLSL. HLSL began as a joint project between Microsoft and NVIDIA. At some point, however, the development effort split and NVIDIA's language (called C for Graphics, or Cg) went one route and Microsoft's language (called HLSL) went another.

HLSL allows developers to write in a language that is similar ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required