Jump to content
  • Advertisement
Sign in to follow this  

DX11 Effects11 and constant buffers

This topic is 1510 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a number of constant buffers in an effect file, two of which are:
cbuffer frame_constants {
	float4 frame_rect;
	float4x4 frame_transform;

cbuffer glyph_buffer { uint4 glyph_data[4096]; };
In order to create an effect variable for 'frame_constants' I need to use ID3DX11Effect::GetConstantBufferByName().  Using ID3DX11Effect::GetVariableByName() followed by AsConstantBuffer() doesn't work, despite the fact that ID3DX11EffectConstantBuffer inherits from ID3DX11EffectVariable.

On the other hand to create an effect variable for 'glyph_buffer' I need to use ID3DX11Effect::GetVariableByName() followed by AsVector(). Calling ID3DX11Effect::GetConstantBufferByName() causes an error.

I'm rather confused at this discrepancy. I'm also not entirely sure how I would assign an ID3D11Buffer to the 'glyph_buffer' effect variable (apart from manually binding it to a constant buffer register and just going around the entire effect framework) if I can't treat it as a constant buffer.

Anyone have any ideas?

Share this post

Link to post
Share on other sites


I'm not sure if fx11 is the same as fx10 but in fx10 you need a ID3D10EffectVectorVariable* fxGlyph_buffer;

then you need to assign that varable to the member in the fx cbuffer like

fxGlyph_buffer = Effect->GetVariableByName("glyph_buffer")->AsVector(); at initialization time only

check for NULL return value.



Then before you use the shader fxGlyph_buffer->SetFloatVectorArray( ( float* )&yourdata, 0, howmanytoset);


check the return HRESULT hr if(FAILED(hr) return error;

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!