Jump to content
  • Advertisement

AmrNasser

Member
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

107 Neutral

About AmrNasser

  • Rank
    Newbie
  1. AmrNasser

    writing to UAV buffer

    thank you,It worked changed target to ps_5_0  thank you all 
  2. AmrNasser

    writing to UAV buffer

    i'm new to shader programming, but if you mean shader model, its shader model 4.0.
  3. AmrNasser

    writing to UAV buffer

    changed u0 to u1 and got this error error X4509: maximum UAV register index exceeded, target has 0 slots, manual bind to slot u1 failed
  4. AmrNasser

    writing to UAV buffer

    thanks for reply  the function CompileShaderFromFile() returns E-error when called for pixel shader. the error only occurs when I add the first line in pixel shader function "DynamicBuffer[uint2(input.Pos.xy)] = float(input.id);",when I comment this line out the file compiles normally.
  5. I am trying to make a buffer to store object index then read it from CPU to implement mouse picking algorithm, but I don't know how to write to UAV buffer from a pixel shader. I coped tutorial 4 and modified it,when I add the first line in PS function the code doesn't compile. Can anyone tell me what is the problem. Thank you in advance. //-------------------------------------------------------------------------------------- // Constant Buffer Variables //-------------------------------------------------------------------------------------- cbuffer ConstantBuffer : register( b0 ) { matrix World; matrix View; matrix Projection; } // dynamic RWTexture2D<uint> DynamicBuffer : register(u0); //-------------------------------------------------------------------------------------- struct VS_OUTPUT { float4 Pos : SV_POSITION; float4 Color : COLOR0; uint id : ID; }; //-------------------------------------------------------------------------------------- // Vertex Shader //-------------------------------------------------------------------------------------- VS_OUTPUT VS( float4 Pos : POSITION, float4 Color : COLOR ) { VS_OUTPUT output = (VS_OUTPUT)0; output.Pos = mul( Pos, World ); output.Pos = mul( output.Pos, View ); output.Pos = mul( output.Pos, Projection ); output.Color = Color; return output; } //-------------------------------------------------------------------------------------- // Pixel Shader //-------------------------------------------------------------------------------------- float4 PS( VS_OUTPUT input ) : SV_Target { DynamicBuffer[uint2(input.Pos.xy)] = float(input.id); // error return input.Color; }
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!