What are constant buffers?

Until DirectX 10, inefficient constant updates adversely affected performance. To overcome this, Constant buffers have been introduced. These buffers are logical groupings of constant variables that Direct3D 10 application feeds into shaders. They allow the API and hardware to manipulate constants in an efficient way, minimizing usage of precious CPU to GPU bandwidth.

The syntax for Constant buffers looks like C-style structs. Constants are grouped together in buffers based on their frequency of usage and updating. For example, for a rotating texture mapped cube viewed from a stationary point we can put the entities that change every frame in one buffer (world matrix and mesh color vector here) and those that never change in another buffer (view matrix here). A sample code snippet would be like this

    cbuffer cbNeverChanges
    {
        matrix ViewMatrix;
    };    
    
    cbuffer cbChangesEveryFrame
    {
        matrix WorldMatrix;
        float4 vMeshColorVector;
    };


FAQ menu

 
Printer friendly version of the FAQ-DIRECTX10-What-are-Constant-Buffers page


Sponsored links

Build IT Knowledge with Current & Trusted Content
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.
Check Out IT Certification Preparation Materials
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.
Six Sigma Certification
100% Online-Six Sigma Certificate from Villanova - Find Out More Now.
SFTP components for .NET
Add complete SSH and SFTP support to your .NET framework application
ASP.NET 3.5 Hosting on Windows 2008!
ASP.NET 3.5/2.0 Hosting on Windows 2008 & 2003! AJAX, LINQ, & Silverlight Ready! 3 Mo. Free!!

Advertisement



Free Magazine

Free Magazines
eWeek The essential technology information source for builders of e-business.... subscribe now

Newsletter | Submit Content | About | Advertising | Awards | Contact Us | Link to us |
© 1996-2008 Community Networks Ltd All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Synchron Data - .NET development.