Skip to main content
gamedev.net
🔒 Locked

cbuffer

Started by schupf Jan 25, 2008 at 10:55 AM 3 replies 1k views
Original Post
schupf
schupf
Hi, since the DX10 SDK Docu didnt help me I have to ask here: I have grouped all my global constants in my .fx file into 2 constant buffers: cbuffer perFrame { float foo; ... }; and cbuffer onDemand { float3 bar; ... }; In my application I get access to these variables with: fooSC = effect->GetVariableByName("foo")->AsFloat(); and set the values (either per frame or on demand) with: sunDirSC->SetFloatVector( (float*) &sunDir); But my performance didnt improve at all. Is this normal or did I miss something (additional required steps?)?
sirob
sirob
What was it you were trying to improve? And where did the idea that "adding cbuffers means better performance" come from?

Constant buffers were added to improve the performance of one type of bottleneck, and only do that when they're actually used to solve that specific issue. With the very little amount of information you've provided, there's no way for us to know if it was even supposed to improve performance.

Constant buffers will help you out in cases where you need to set the same values for shader constants many times per frame, and need an easy way of swapping out a large number of constants in one go, and replacing them with other values that were set in a previous rendering and saved at that point.

It sounds like you need to figure out what it is that is impacting your performance issues, and attempt to solve that, instead of implementing random features in an attempt to improve performance.

If you've already done that, you'll need to communicate what your exact scenario is, and what it is you were hoping Constant Buffers would solve.
Sirob Yes.» - status: Work-O-Rama.
Zipster
Zipster
It's difficult to measure small differences in performance on the GPU, and considering you only used two constant buffers (one of which is updated every frame anyway), you probably won't see any difference in performance. Where it really helps is when you have a high granularity of frequency, such as per frame, per draw call, per second, per whatever, and you really start splitting them up. Plus, if you don't have that many draw calls or state changes in your application to begin with, any small performance improvement won't scale enough for you to measure it.
schupf
schupf
@sirob: I didnt say anything about having performance issues. I just said my performance did not change.

Sorry if I provided not enough Information - I thought everything should be clear with my info.

I just moved my global constants in my .fx file into cbuffer structs like I showed in my 1. posting. That was all I changed - I didnt change anything in my dx10 application (Im using the effect framework as you can see in my 1. posting)

My main question was: Do I have to take additional steps in my dx10 application? Or is moving the global constants into cbuffer "structs" everything that needs to be done when using cbuffers?
sirob
sirob
Quote:
Original post by schupf
My main question was: Do I have to take additional steps in my dx10 application? Or is moving the global constants into cbuffer "structs" everything that needs to be done when using cbuffers?

There are more or less options for what you need to do depending on how you want to improve performance.

However, it is highly unlikely you'll see a performance increase in your application by using Constant Buffers if you are not having performance issues.
Sirob Yes.» - status: Work-O-Rama.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.