Questions tagged [directcompute]

Microsoft DirectCompute is an application programming interface (API) that supports general-purpose computing on graphics processing units on Microsoft's Windows Vista, Windows 7 and Windows 8.

DirectCompute is part of the Microsoft DirectX collection of APIs, and was initially released with the DirectX 11 API but runs on graphics processing units that use either DirectX 10 or DirectX 11.

The DirectCompute architecture shares a range of computational interfaces with its competitors: OpenCL and CUDA.

79 questions
0
votes
1 answer

warning X3557: loop only executes for 0 iteration(s), forcing loop to unroll

The compiler produce a "warning X3557: loop only executes for 0 iteration(s), forcing loop to unroll" and I don't understand why. Here is the source code. It is a revisited itoa() function for HLSL producing resulting ascii codes in an array of…
fpiette
  • 11,983
  • 1
  • 24
  • 46
0
votes
2 answers

Device took an unreasonable amount of time to execute its commands

I'm porting C code to HLSL (compute shader). The compiler is crazy with one of the for loops. At runtime, the display device driver detect an unreasonable amount of time to execute the code. Here is the partial source code with the offending for…
fpiette
  • 11,983
  • 1
  • 24
  • 46
0
votes
1 answer

DirectX compute shader (HLSL): how to access individual characters in a string?

In a DirectCompute shader, having a function taking an string type argument, how to access individual characters ? Example: uint TestFunc(string S, uint I) { return uint(S[I]); } The compiler complain about S[I]: "error X3121: array, matrix,…
fpiette
  • 11,983
  • 1
  • 24
  • 46
0
votes
1 answer

DirectX compute shader: how to write a function with variable array size argument?

I'm trying to write a function within a compute shader (HLSL) that accept an argument being an array on different size. The compiler always reject it. Example (not working!): void TestFunc(in uint SA[]) { int K; for (K = 0; SA[K] != 0; K++) { …
fpiette
  • 11,983
  • 1
  • 24
  • 46
0
votes
1 answer

Drawing lines and characters in a texture2D (DirectCompute HLSL programming)

I searched a lot without finding how to have a compute shader draw lines and characters in a texture2D. My application has to do a lot of processing and generate a bitmap in a texture2D which is then rendered on screen and downloaded back to CPU and…
fpiette
  • 11,983
  • 1
  • 24
  • 46
0
votes
1 answer

Is there support for 8bits per channel and 16bits per channel UAV in a compute shader?

I'm working on a compute shader. It needs to output some textures as UAVs. Some of them have 8bits components and some have 16bits per channel. Consider this line: RWTexture2D _watNormTex; I bind a R8G8B8A8_UNORM texture to it and the…
morteza khosravi
  • 1,599
  • 1
  • 20
  • 36
0
votes
0 answers

ID3D12Device::CreateComputePipelineState fails (E_INVALIDARGS)

I've got an unusaul problem - when I am trying to create Compute PSO, function fails with E_INVALIDARGS. It is probably due to no CachedPso available, though I saw on MSDN that Graphics PSO is created without cached data. So here is the code itself.…
Ilia
  • 331
  • 5
  • 12
0
votes
1 answer

DirectX 11 - Compute Shader, copy data from the GPU to the CPU

I've just started up using Direct compute in an attempt to move a fluid simulation I have been working on, onto the GPU. I have found a very similar (if not identical) question here however seems the resolution to my problem is not the same as…
0
votes
0 answers

Questions about compute shader DispatchThreadID?

Texture2D InputTex : register( t0 ); RWTexture2D OutputTex : register( u0 ); // Group size #define size_x 20 #define size_y 20 // Declare one thread fo r each texel of the input texture. [numthreads(size_x, size_y, 1)] void CSMAIN(…
Gary Grey
  • 145
  • 1
  • 7
0
votes
1 answer

Convolution filter outputs wrong color values

I've just started to learn DirectCompute and for learning purposes, I want to make a simple convolution filter that blurs a texture. I've written the following compute shader to blur the texture: Texture2D inputTex; RWTexture2D
Krienie
  • 611
  • 1
  • 6
  • 14
0
votes
1 answer

Linking error including Random Number Library in C++ AMP

I am using the C++ AMP tinymt library from Codeplex to generate random numbers. The library works fine, except that when I #include in two different files in the same project, linking errors arise mentioning redefintion of certain…
Abhra Basak
  • 382
  • 4
  • 13
0
votes
1 answer

Compute Shader basics in dx11

I am about to add compute shader support to my codebase and having problems finding answers to some pretty basic questions: All documentation out there says that Compute Shader pipeline runs independently from the GPU, however all dx11 sample code…
Rincer
  • 31
  • 4
0
votes
1 answer

How can I bind a buffer resource that resides on the GPU to the input assembler (IA)?

I use compute shaders to compute a triangle list and to store it in a RWStructuredBuffer. For testing I read this buffer and pass it to the IA via context.InputAssembler.SetVertexBuffers (…). This approach works, but is valid only for testing the…
0
votes
1 answer

Why Dispatches started consecutively take different time?

I have this program : for (int i = 0; i < STEPS; ++i) { context->CSSetShader(computeShader, NULL, 0); ID3D11UnorderedAccessView *aUAViews[1] = {bufferOut_UAV}; …
Yola
  • 18,496
  • 11
  • 65
  • 106
0
votes
1 answer

directcompute hlsl numthreads?

Since you already define the thread groups to be executed when dispaching a compute shader, what do the numbers inside the shader file signify? example: [numthreads(1, 1, 1)]
Jake Freelander
  • 1,471
  • 1
  • 19
  • 26