# How to properly use DoubleFloats in a compute shader?

**URL:** <https://forums.unrealengine.com/t/how-to-properly-use-doublefloats-in-a-compute-shader/2747453>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, Shaders, hlsl, question\
**Created:** [August 31, 2026, 12:53am UTC](https://forums.unrealengine.com/t/how-to-properly-use-doublefloats-in-a-compute-shader/2747453 "2026-08-31T00:53:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aejjee](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/aejjee/32/1204088_2.png) [@Aejjee](https://forums.unrealengine.com/u/Aejjee)\
**Post date:** [August 31, 2026, 12:53am UTC](https://forums.unrealengine.com/t/how-to-properly-use-doublefloats-in-a-compute-shader/2747453/1 "2026-08-31T00:53:42Z")

</div>

I have the following compute shader code that _ **works** _ where I use `double3`s:

```auto
RWStructuredBuffer<double3> Positions;

uint NSoldiers;

[numthreads(GROUP_SIZE, 1, 1)]

void main(uint3 DispatchThreadID : SV_DispatchThreadID, uint3 GroupThreadID : SV_GroupThreadID){

    if (DispatchThreadID.x >= NSoldiers) { return; }

    double3 loc = Positions[DispatchThreadID.x];

    loc.x += 1.0f;

    Positions[DispatchThreadID.x] = loc;

}

```

But I cannot use this code because UE5 refuses to package a project that has `double`s in HLSL code. So I have to use the provided `DoubleFloat`library. The problem is that when using `FDFVector3`s instead of `double3`s the code doesn’t work at all:

```auto
RWStructuredBuffer<FDFVector3> Positions;

uint NSoldiers;

[numthreads(GROUP_SIZE, 1, 1)]

void main(uint3 DispatchThreadID : SV_DispatchThreadID, uint3 GroupThreadID : SV_GroupThreadID)

{

   if (DispatchThreadID.x >= NSoldiers)

   {

       return;

   }

   //float3 loc = DFDemote(Positions[DispatchThreadID.x]);

   FDFVector3 pos = Positions[DispatchThreadID.x];

   FDFVector3 delta = DFPromote(float3(1.0f, 0.0f, 0.0f));

    Positions[DispatchThreadID.x] = DFAdd(pos, delta);

}

```

The data on the CPU that is passed to the RWStructruedBuffer is a `TArray<FVector>`. I have verified that `FVector`s, `FDFVector3`s and `double3`s are the same size (24 bytes). Also the shader does not output random data when using `DoubleFloat`s, rather it appears to leave the data unchanged.
