In a cs_5_0 profile, the following code fails when I perform a literal multiply. The UAV gets filled with zeroes. I'm on HD5850. I did check the D3D11_FEATURE_DATA_DOUBLES; it's true. Also, it works on REF. I'm on Catalyst 10.1 and the Feb2010 DXSDK.
StructuredBuffer<double> source : register(t0);
RWStructuredBuffer<double> target : register(u0);
cbuffer cb0 {
double multiplier;
double padding;
};
[numthreads(64, 1, 1)]
void DoubleShader(uint tid : SV_GroupIndex, uint3 gid : SV_GroupID) {
double x = source[tid];
// fiddle with x
// when multiplying by a literal, as below, the UAV gets filled with 0s.
// x *= 2.0;
// when multiplying by a cbuffer value, the multiplication works
// x *= multiplier;
// when mulitplying by a variable, the multiplication works
x *= x;
target[tid] = x;
}
Wow so here I got a shader that compiles fine to actually crash the app inside CreateComputeShader. This is on HD5800 Catalyst 10.1.
FXC compiles the hlsl just fine. Program explodes on CreateComputeShader.
crash.h: StructuredBuffer<double> source : register(t0); RWStructuredBuffer<double> target : register(u0); [numthreads(64, 1, 1)] void DoubleShader(uint tid : SV_GroupIndex, uint3 gid : SV_GroupID) { double x = source[tid]; x += 3.0 * x; target[tid] = x; } c++: #pragma comment(lib, "d3d11") #pragma comment(lib, "dxgi") #include <atlcomcli.h> #include <dxgi.h> #include <d3d11.h> #include "crash.h" int main(int argc, char** argv) { CComPtr<IDXGIFactory> factory; HRESULT hr = CreateDXGIFactory(__uuidof(IDXGIFactory), (void**)&factory.p); CComPtr<IDXGIAdapter> adapter; factory->EnumAdapters(0, &adapter); bool useHardware = true; CComPtr<ID3D11Device> device; CComPtr<ID3D11DeviceContext> context; D3D_FEATURE_LEVEL levels[1] = { D3D_FEATURE_LEVEL_11_0 }; hr = D3D11CreateDevice(0, useHardware ? D3D_DRIVER_TYPE_HARDWARE : D3D_DRIVER_TYPE_REFERENCE, 0, #ifdef _DEBUG D3D11_CREATE_DEVICE_DEBUG, #else 0, #endif levels, 1, D3D11_SDK_VERSION, &device, 0, &context); D3D11_FEATURE_DATA_DOUBLES supportsDoubles; hr = device->CheckFeatureSupport(D3D11_FEATURE_DOUBLES, &supportsDoubles, sizeof(supportsDoubles)); CComPtr<ID3D11ComputeShader> cs; device->CreateComputeShader(g_DoubleShader, sizeof(g_DoubleShader), 0, &cs); }