Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

124 Neutral

About tobr

  • Rank

Personal Information

  • Interests
  1. Ok it works now. I rewrote the whole test program. Thanks guys!
  2. I have now tried to set the the UnordererdAccessViews like so:   UINT counters[2] = {mNumElements,0}; ID3D11UnorderedAccessView* uavs[2] = { mInputUAV, mOutputUAV }; md3dImmediateContext->CSSetUnorderedAccessViews(0, 2, uavs, counters); I still get the result 0 back. I cant find any error.
  3. Ok thanks, i understand. The problem is to set the initial counter for the buffer. I use the Effect11 Framework to set the UnordereredAccessViews (http://msdn.microsoft.com/en-us/library/windows/desktop/ff476783(v=vs.85).aspx). The methods seem to have no parameters to set the counter. That means i cant use the Effect11 Framwork to set an UnorderedAccessView to a ConsumeBuffer? I have to use the CSSetUnorderedAccessViews method..?
  4. The Count is specified in the UAV Description. (uavDesc.Buffer.NumElements = mNumElements;)   I checked both buffers in the shader with the getGimensions() function (http://msdn.microsoft.com/de-de/library/windows/desktop/ff471461%28v=vs.85%29.aspx) and they have both the right dimensions(numStructs and stride). But it seem they are empty...   Maybe there is an error on how i bind them. Do i have to bind both - the consume buffer and the append buffer with a UnorderedAccessVIew?    
  5. The Task is to compute the lengths of 64 3D Vectors in ComputeShader using a ConsumeStructuredBuffer as Input and AppendStructuredBuffer as Output. I always get the result 0 for the length. Even if i try to get the content of the ConsumeStructuredBuffer in the shader i always get 0.  I checked the Dimensions of the ConsumeBuffer and the AppendBuffer in Shader and it gets me the correct results.   Here is the code:   struct InputData { float3 data; }; struct OutputData { float data; }; ConsumeStructuredBuffer<InputData> gInput : register(u0); AppendStructuredBuffer<OutputData> gOutput : register(u1); [numthreads(64, 1, 1)] void CS(int3 dtid : SV_DispatchThreadID) { OutputData output; InputData input = gInput.Consume(); float len = length(input.data); output.data = len; gOutput.Append(output); } technique11 VecAdd { pass P0 { SetVertexShader( NULL ); SetPixelShader( NULL ); SetComputeShader( CompileShader(cs_5_0, CS() ) ); } }  And here ist the Code which created and sets the Buffers in C++:   struct InputData { //XMFLOAT3 data; float data[3]; }; struct OutputData { float data; }; std::vector<InputData> vecbuffer(64); // Initialize the vecbuffer with values [1,10] for(UINT i = 0; i < vecbuffer.size(); ++i) { vecbuffer.data[0] = MathHelper::RandF(1,10); vecbuffer.data[1] = MathHelper::RandF(1,10); vecbuffer.data[2] = MathHelper::RandF(1,10); } mNumElements = vecbuffer.size(); // Create a buffer to be bound as a shader input D3D11_BUFFER_DESC inputDesc; inputDesc.Usage = D3D11_USAGE_DEFAULT; inputDesc.ByteWidth = sizeof(InputData) * mNumElements; inputDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS; inputDesc.CPUAccessFlags = 0; inputDesc.StructureByteStride = sizeof(InputData); inputDesc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED; D3D11_SUBRESOURCE_DATA vinitInputData; vinitInputData.pSysMem = &vecbuffer[0]; ID3D11Buffer* inputBuffer = 0; HR(md3dDevice->CreateBuffer(&inputDesc, &vinitInputData, &inputBuffer)); // Create a buffer the compute shader can write to D3D11_BUFFER_DESC outputDesc; outputDesc.Usage = D3D11_USAGE_DEFAULT; outputDesc.ByteWidth = sizeof(OutputData) * mNumElements; outputDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS; outputDesc.CPUAccessFlags = 0; outputDesc.StructureByteStride = sizeof(OutputData); outputDesc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED; HR(md3dDevice->CreateBuffer(&outputDesc, 0, &mOutputBuffer)); D3D11_UNORDERED_ACCESS_VIEW_DESC uavDesc; uavDesc.Format = DXGI_FORMAT_UNKNOWN; uavDesc.ViewDimension = D3D11_UAV_DIMENSION_BUFFER; uavDesc.Buffer.FirstElement = 0; uavDesc.Buffer.Flags = D3D11_BUFFER_UAV_FLAG_APPEND; uavDesc.Buffer.NumElements = mNumElements; HR(md3dDevice->CreateUnorderedAccessView(inputBuffer, &uavDesc, &mInputUAV)); HR(md3dDevice->CreateUnorderedAccessView(mOutputBuffer, &uavDesc, &mOutputUAV));   Has someone a solution or sees and error? I already tried the BindFlags with only D3D11_BIND_UNORDERED_ACCESS but its the same result.  
  • 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!