O'Reilly logo

DirectX 11.1 Game Programming by Pooya Eimandar

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

Buffers in Direct3D

In the previous section, we used the shader class in order to load the HLSL file. This section describes what the functionality of each buffer is and how the stored data will be accessed through the rendering pipeline.

Constant buffers

A constant buffer is just a block of data that allows you to store the shader variables. Each element of a constant buffer stores one to four component vectors. In our example, the preceding code of Parameters.hlsli was the following:

cbuffer ObjectInfo : register(b0)
{
min16float4x4 WorldViewProjection;
};

The code defines a constant buffer in the b0 bank. The element of cbuffer is a 4x4 matrix with minimum 16-bit precision. The WorldViewProjection matrix is responsible for transforming each vertex ...

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