I'm having some weird issues running a Compute Shader with DirectX 11 on an Intel HD 4000 GPU.

The goal is to write different shapes into a DXGI_FORMAT_R32_FLOAT 3D Texture with a size of 128x128x128 - the example below creates a sphere.

On a NVidia GTX 680 the texture is generated fine, but on an Intel HD 4000 it seems the Z-coordinate/3D texture slice coordinate is multiplied by 4 (see image below).

The drivers for the Intel GPU are up to date (Dec 2015). The compute shader is executed only once, immediately after initializing DirectX swapchain/viewport/... and I disabled all other render code in the application which could influence the compute shader.

I'm running DirectX with D3D11_CREATE_DEVICE_DEBUG enabled which prints no warnings/errors and shader compilation returns no error messages either.

In this picture you can see the 3D Textures generated by the two GPUs in comparison - the slices of the 3D texture are placed besides each other: 3D Texture comparison

DirectX Code:


//loads & compiles shader from file
ID3D10Blob* computeShaderbuffer = m_Context->loadShaderFile(compute_shader, "cs_5_0");

device->CreateComputeShader(computeShaderbuffer->GetBufferPointer(), computeShaderbuffer->GetBufferSize(), NULL, &m_ComputeShader);

D3D11_TEXTURE3D_DESC desc = {};
desc.Width = m_dataSize.x; // 128
desc.Height = m_dataSize.y; // 128
desc.Depth = m_dataSize.z;  //128
desc.MipLevels = 1;
desc.Format = DXGI_FORMAT_R32_FLOAT;
desc.Usage = D3D11_USAGE_DEFAULT;
desc.CPUAccessFlags = 0;
desc.MiscFlags = 0;

device->CreateTexture3D(&desc, nullptr, &m_DensityTexture3d);
device->CreateUnorderedAccessView(m_DensityTexture3d, nullptr, &m_DensityShaderWriteResource);

deviceContext->CSSetShader(m_ComputeShader, nullptr, 0);
deviceContext->CSSetUnorderedAccessViews(0, 1, &m_DensityShaderWriteResource, nullptr); 

deviceContext->Dispatch(m_dataSize.x, m_dataSize.y, m_dataSize.z);

deviceContext->CSSetShader(nullptr, nullptr, 0);
deviceContext->CSSetUnorderedAccessViews(0, 1, &uav_null, nullptr);

Compute Shader:

RWTexture3D<float> output : register (u0);

[numthreads(16, 16, 1)]
void main(uint3 id : SV_DispatchThreadID)
    float3 size;
    output.GetDimensions(size.x, size.y, size.z);
    float3 center = size / 2.0f;

    float max_distance = center.x * 0.7f;
    float3 norm_position = float3(id) / size;

    output[id] = 1.0f - (length(float3(id)-center) / max_distance);

Am I doing something wrong or is it simply an Intel issue?

Thanks for your help!

  • 1
    \$\begingroup\$ What happens if you run with reference rasterizer? msdn.microsoft.com/en-us/library/windows/desktop/… \$\endgroup\$
    – Andreas
    Apr 24 '16 at 19:58
  • \$\begingroup\$ Thanks for this hint. I tried it now with both software render modes (D3D_DRIVER_TYPE_REFERENCE and D3D_DRIVER_TYPE_WARP). Both produce the correct results (same as the NVidia card) - so I guess it's a driver issue and I can't do much about it. \$\endgroup\$
    – Lukas F.
    Apr 26 '16 at 7:34
  • \$\begingroup\$ Maybe it is the dxgi format messing with you. Is there a 16bit format available? What does that look like? What happens if you enter a full rgba format? \$\endgroup\$
    – Andreas
    Apr 26 '16 at 11:44
  • \$\begingroup\$ You might also want to look closer on the runtime using Pix or similar tool. (It is probably a driver issue but you can't just sit around waiting for an update right?) \$\endgroup\$
    – Andreas
    Apr 26 '16 at 17:44
  • \$\begingroup\$ I did some more testing - including using RGBA16/32 - textures but after writing the initial post here I did a driver update which made things worse. Right now the driver keeps crashing when I try to use this compute shader (and once I got a BSOD). I have added a fallback mode which skips the compute sahder and uses pregenerated textures. All other parts of my application wok fine and right now I do not have the time to look into it much further. Thanks for your help Andreas. \$\endgroup\$
    – Lukas F.
    Apr 27 '16 at 11:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.