Original Post
Hi,
I don't know why but dx10 always give me back a false result when I try to create buffer, in this case a constantbuffer.
[source lang="cpp"]struct SPSSSAOPerFrameBuffer
{
float m_sample_rad;
float m_scale;
float m_intensity;
float m_bias;
float m_screen_size_x;
float m_screen_size_y;
float m_random_size;
};
ID3D10Buffer* g_pPSSSAOPerFrameBuffer = 0;
D3D10_BUFFER_DESC PSSSAOPerFrameBufferDesciptor;
PSPerFrameBufferDesciptor.ByteWidth = sizeof(SPSSSAOPerFrameBuffer);
PSPerFrameBufferDesciptor.Usage = D3D10_USAGE_DYNAMIC;
PSPerFrameBufferDesciptor.BindFlags = D3D10_BIND_CONSTANT_BUFFER;
PSPerFrameBufferDesciptor.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE; PSPerFrameBufferDesciptor.MiscFlags = 0;
Result = g_pDevice->CreateBuffer(&PSSSAOPerFrameBufferDesciptor, 0, &g_pPSSSAOPerFrameBuffer);
if (Result != S_OK)
{
return false;
}[/source]
I'm getting back, in Result, the value E_INVALIDARG.
And thats the constantbuffer in hlsl.
[source lang="cpp"]cbuffer CBPSSSAOPerFrameBuffer
{
float1 m_sample_rad;
float1 m_scale;
float1 m_intensity;
float1 m_bias;
float1 m_screen_size_x;
float1 m_screen_size_y;
float1 m_random_size;
};
[/source]
Before you think I'm just too lazy to find a solution, I've already read the part for constantbuffers in the msdn (http://msdn.microsoft.com/en-us/library/windows/desktop/bb205130(v=vs.85).aspx#Create_a_Constant_Buffer) .
And they are doing exactly the same. I really don't know what I'm doing wrong
I hope somebody can help me, thx so far.
I don't know why but dx10 always give me back a false result when I try to create buffer, in this case a constantbuffer.
[source lang="cpp"]struct SPSSSAOPerFrameBuffer
{
float m_sample_rad;
float m_scale;
float m_intensity;
float m_bias;
float m_screen_size_x;
float m_screen_size_y;
float m_random_size;
};
ID3D10Buffer* g_pPSSSAOPerFrameBuffer = 0;
D3D10_BUFFER_DESC PSSSAOPerFrameBufferDesciptor;
PSPerFrameBufferDesciptor.ByteWidth = sizeof(SPSSSAOPerFrameBuffer);
PSPerFrameBufferDesciptor.Usage = D3D10_USAGE_DYNAMIC;
PSPerFrameBufferDesciptor.BindFlags = D3D10_BIND_CONSTANT_BUFFER;
PSPerFrameBufferDesciptor.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE; PSPerFrameBufferDesciptor.MiscFlags = 0;
Result = g_pDevice->CreateBuffer(&PSSSAOPerFrameBufferDesciptor, 0, &g_pPSSSAOPerFrameBuffer);
if (Result != S_OK)
{
return false;
}[/source]
I'm getting back, in Result, the value E_INVALIDARG.
And thats the constantbuffer in hlsl.
[source lang="cpp"]cbuffer CBPSSSAOPerFrameBuffer
{
float1 m_sample_rad;
float1 m_scale;
float1 m_intensity;
float1 m_bias;
float1 m_screen_size_x;
float1 m_screen_size_y;
float1 m_random_size;
};
[/source]
Before you think I'm just too lazy to find a solution, I've already read the part for constantbuffers in the msdn (http://msdn.microsoft.com/en-us/library/windows/desktop/bb205130(v=vs.85).aspx#Create_a_Constant_Buffer) .
And they are doing exactly the same. I really don't know what I'm doing wrong
I hope somebody can help me, thx so far.