• Advertisement
Sign in to follow this  

Shader/Const buffer problem

This topic is 2042 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've got a const buffer struct defined in my application code, which you can see here:


struct cbDOFProperties
{
float _focalWidth;
float _focalDepth;
float _farClip;
float _padding;

XMFLOAT2 _filterTaps[12];
};


Now the same in my shader:

cbuffer cbDOFProperties : register(b0)
{
float _focalWidth;
float _focalDepth;
float _farClip;
float _padding;


float2 _filterTaps[12];
};


The problem I'm having is that I'm getting a warning telling me:
D3D11: WARNING: ID3D11DeviceContext::DrawIndexed: The size of the Constant Buffer at slot 0 of the Pixel Shader unit is too small (112 bytes provided, 208 bytes, at least, expected).

I don't get it. the size of a float2 would be 2*4 byte = 8 bytes * 12 = 96 bytes + 4x floats = 112 bytes like it tells me I've provided. Then why is it expecting 208 ???

Share this post


Link to post
Share on other sites
Advertisement
Hmm might be a stupid question but how would I give "him" more data in this case ?

edit: [s]nvm got it[/s]
Hmm or not... how do I correctly set an array to a constant buffer ? Edited by lipsryme

Share this post


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

  • Advertisement