0

I'm wondering if there is another way to access uniform Parameters in SharpDx besides the constantbuffer

 cbuffer Variables : register(b0){
 float4 cL;
 } 

I think the register(b0) tells the Datapointer which one to access. Anyways the Question is about another way like is it possible to get and set parameters like these

uniform float4 paraO;
uniform vector3 vecO;
uniform float para2;

I couldn't find a way to get or set their values within SharpDx or DirectX11

Rey
  • 85
  • 1
  • 9

1 Answers1

1

The compiler should create a constant buffer for those parameters.

If you use SharpDX' effect framework, you can use the effect's parameters to get a handle to the variables..

Nico Schertler
  • 32,049
  • 4
  • 39
  • 70
  • I'm looking for a way without using the effect framework. So I tried to use the ShaderReflection. but for (int i = 0; i < sDesc.ConstantBuffers; ++i) { ShaderParameterDescription paramDesc = pRefelector.GetInputParameterDescription(i); MessageBox.Show(paramDesc.SemanticName); I only get the variables within my struct PS_IN { float4 pos : SV_POSITION; float4 col : COLOR; }; but not those in cbuffer Variables : register(b0){ float4 TestFarbe; } – Rey May 30 '13 at 10:29
  • Then you should use http://sharpdx.org/documentation/api/m-sharpdx-d3dcompiler-shaderreflection-getconstantbuffer-1 and not the input parameters. – Nico Schertler May 30 '13 at 11:19
  • yes I know I've forgotten to add the code and did not used the ShaderReflectionVariable :/ Anyways I got now almost all the data I want. The only thing not working is this "shaderRefVar.Description.Name" I only get the first variable. So if cbuffer Variables : register(b0){ float4 cL; float4 uF; float3 ck; } I always get only "cL". – Rey May 30 '13 at 14:06
  • all working I had the ShaderReflectionVariable in the wrong loop – Rey May 30 '13 at 14:23