Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool NXDeviceShader::Set(int cb, string constantName, void* value)
- {
- NXShaderVariable* variable = GetVariableByName(constantName);
- if (variable == nullptr)
- return false;
- D3D11_MAPPED_SUBRESOURCE resource;
- resource.pData = nullptr; resource.DepthPitch = 0; resource.RowPitch = 0;
- if (FAILED(Core::NXGPU::Map(ConstantBuffers[cb].Data, 0, D3D11_MAP_WRITE_DISCARD, 0, &resource)))
- return false;
- memcpy((unsigned char*) resource.pData + variable->Description.StartOffset, value, variable->Description.Size);
- Core::NXGPU::Unmap(ConstantBuffers[cb].Data, 0);
- variable = nullptr;
- SetConstantBuffer(cb, ConstantBuffers[cb].Data);
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement