Effects11 and constant buffers

Started by
0 comments, last by ankhd 9 years, 7 months ago
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?
Advertisement

Hi.

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;

This topic is closed to new replies.

Advertisement