evelyn4you

Members
  • Content count

    5
  • Joined

  • Last visited

Community Reputation

0 Neutral

About evelyn4you

  • Rank
    Newbie

Personal Information

  • Interests
    Art
  1. Hello, until now i am using structured buffers in my vertexShader to calculate the morph offsets of my animated characters. And it works fine. But until now i only read from this kind of buffers. ( i use 4 of them ) Now i had in mind to do other things, where i have to use a readwrite buffer that i can write to. But i cant get in my head how to sync write acceses. when i read a value from the buffer at a adress that coresponds to e.g. a pixel coordinate and want to add a value another thread could have read the same value overrides the value that i had written. How is this done typically ?
  2. Hello, after much, much searching the internet and reading of the Directx 11Documentation on the Microsoft Server i could eventually find the solution. In the following code fragment we read the compiled shaderbytecode of a effect. For easy understanding we get one Technik, then the pass and so on. The iteration of the techniques and passes is no problem. The problem was how to get the shaderbytecode from the EffectPass. This is important because the ShaderReflection is only working per ShaderbyteCode of only one Shader. I really hope that someone finds this code helpful. I had to spend much time to find this solution. Now why this all ? From the given infos i can easily, automatically create all my ConstantBuffer Structures and inputlayouts and many other things. SharpDX.Direct3D11.Effect a_Effect = new SharpDX.Direct3D11.Effect(Gl.Device, File.ReadAllBytes(filename),0); SharpDX.Direct3D11.EffectTechnique a_technique = a_Effect.GetTechniqueByIndex(0); SharpDX.Direct3D11.EffectPass a_pass = a_technique.GetPassByIndex(0); SharpDX.Direct3D11.EffectPassShaderDescription a_pass_shader_desc = a_pass.VertexShaderDescription; SharpDX.Direct3D11.EffectShaderVariable a_Effect_SVar = a_pass_shader_desc.Variable ; SharpDX.Direct3D11.VertexShader a_VertexShader = a_Effect_SVar.GetVertexShader(0); SharpDX.Direct3D11.EffectShaderDescription a_Effect_SDesc = a_Effect_SVar.GetShaderDescription(0); SharpDX.D3DCompiler.ShaderBytecode a_ShaderByteCode = a_Effect_SDesc.Bytecode; // Now we can apply ShaderReflection per ShaderByteCode var SR = new SharpDX.D3DCompiler.ShaderReflection(a_Effect_SDesc.Bytecode); string [] cb_name_array = new string[100]; // for example Loop the Constantbuffer for (int i = 0; i < SR.Description.ConstantBuffers; i++) { SharpDX.D3DCompiler.ConstantBuffer cb = SR.GetConstantBuffer(i); // loop the Variables of the ConstantBuffer for (int j = 0; j < cb.Description.VariableCount; j++) { SharpDX.D3DCompiler.ShaderReflectionVariable variable = cb.GetVariable(j); cb_name_array[j] = variable.Description.Name; } }
  3. Hello, i want to use - fxc Effect compiler to compile my Fx Files with, Techniques, Passes, Shaders to ByteCode => no Problem - SharpDX ShaderReflection to get attributes of every used Shader to generate Constant Buffer Structures an other things - to use ShaderReflection i have to feed the ShaderByteCode of every single Shader i want to operate with. I was succesfull to iterate through the Effect for the Techniques, an iterate through the Techniques for the Passes an the Descriptions I struggled a lot but cannot find out where is the connection to get the ShaderByteCode of the Shaders that are used by a EffectPass ?? Here is the anser of AlexandreMutel And even then, you can still use the FX file format - the difference is you'd have an offline compiler tool that parses the format for techniq ues/passes in order to acquire the necessary shader profiles + entry points. So with the profile/entry point in hand, you can run the FX file through the D3DCompiler to get a ShaderByteCode object for each shader, then use that to create a reflection object to query all your meta data. Then write out the reflected meta data to a file, that gets consumed by your application at runtime - which would be your own implementation of Effects11 (or something completely different, either way...you use the meta data to automatically setup your constant buffers, bind resources, and manage the shader pipeline by directly using the Direct3D11 shader interfaces). How do i get the pofile/entry point at hand ?? Please give me some help
  4. many thanks for the qualified clear answer !!
  5. hi, i have read very much about the binding of a constantbuffer to a shader but something is still unclear to me. e.g. when performing : vertexshader.setConstantbuffer ( buffer, slot ) is the buffer bound a. to the VertexShaderStage or b. to the VertexShader that is currently set as the active VertexShader Is it possible to bind a constantBuffer to a VertexShader e.g. VS_A and keep this binding even after the active VertexShader has changed ? I mean i want to bind constantbuffer_A to VS_A, an Constantbuffer_B to VS_B and only use updateSubresource without using setConstantBuffer command every time. Look at this example: SetVertexShader ( VS_A ) updateSubresource(buffer_A) vertexshader.setConstantbuffer ( buffer_A, slot_A ) perform drawcall ( buffer_A is used ) SetVertexShader ( VS_B ) updateSubresource(buffer_B) vertexshader.setConstantbuffer ( buffer_B, slot_A ) perform drawcall ( buffer_B is used ) SetVertexShader ( VS_A ) perform drawcall (now which buffer is used ??? ) I ask this question because i have made a custom render engine an want to optimize to the minimum updateSubresource, and setConstantbuffer calls