Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

Shader Resource Binding

$
0
0
Hello, I am trying to set some shader values in a cbuffer. Im not getting any response or values. My code is: cbuffer MatrixBuffer : register(b0) { float4 test; }; ------------------------------------------------- #pragma pack(push,1) struct CB_GBUFFER_UNPACK { D3DXVECTOR4 test; }; #pragma pack(pop) ------------------------------------------------- D3D11_BUFFER_DESC cbDesc; ZeroMemory( &cbDesc, sizeof(cbDesc) ); cbDesc.Usage = D3D11_USAGE_DYNAMIC; cbDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; cbDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; cbDesc.ByteWidth = sizeof( CB_GBUFFER_UNPACK ); device->CreateBuffer( &cbDesc, NULL, &m_pGBufferUnpackCB ); D3D11_MAPPED_SUBRESOURCE MappedResource; ic->Map( m_pGBufferUnpackCB, 0, D3D11_MAP_WRITE_DISCARD, 0, &MappedResource ); CB_GBUFFER_UNPACK* pGBufferUnpackCB = ( CB_GBUFFER_UNPACK* )MappedResource.pData; pGBufferUnpackCB->test.x = 10.0f; pGBufferUnpackCB->test.y = 10.0f; pGBufferUnpackCB->test.z = 10.0f; pGBufferUnpackCB->test.w = 0.0f; ic->Unmap( m_pGBufferUnpackCB, 0 ); ic->PSSetConstantBuffers( 0, 1, &m_pGBufferUnpackCB ); What is wrong?

Viewing all articles
Browse latest Browse all 17825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>