Sign in to follow this  
lipsryme

Shader/Const buffer problem

Recommended Posts

I've got a const buffer struct defined in my application code, which you can see here:

[CODE]
struct cbDOFProperties
{
float _focalWidth;
float _focalDepth;
float _farClip;
float _padding;

XMFLOAT2 _filterTaps[12];
};
[/CODE]

Now the same in my shader:
[CODE]
cbuffer cbDOFProperties : register(b0)
{
float _focalWidth;
float _focalDepth;
float _farClip;
float _padding;


float2 _filterTaps[12];
};
[/CODE]

The problem I'm having is that I'm getting a warning telling me:
[b]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).[/b]

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this