-
Notifications
You must be signed in to change notification settings - Fork 229
/
Copy pathBC3Compress.hlsl
31 lines (25 loc) · 1.12 KB
/
BC3Compress.hlsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//--------------------------------------------------------------------------------------
// BC3Compress.hlsl
//
// Fast block compression ComputeShader for BC3
//
// Advanced Technology Group (ATG)
// Copyright (C) Microsoft Corporation. All rights reserved.
//--------------------------------------------------------------------------------------
#include "BlockCompress.hlsli"
Texture2D g_texIn : register(t0);
RWTexture2D<uint4> g_texMip0Out : register(u0); // Output BC3 texture as R32G32B32A32_UINT
SamplerState g_samp : register(s0);
//--------------------------------------------------------------------------------------
// Compress one mip level
//--------------------------------------------------------------------------------------
[RootSignature(BlockCompressRS)]
[numthreads(COMPRESS_ONE_MIP_THREADGROUP_WIDTH, COMPRESS_ONE_MIP_THREADGROUP_WIDTH, 1)]
void main(
uint2 threadIDWithinDispatch : SV_DispatchThreadID)
{
float3 blockRGB[16];
float blockA[16];
LoadTexelsRGBA(g_texIn, threadIDWithinDispatch, blockRGB, blockA);
g_texMip0Out[threadIDWithinDispatch.xy] = CompressBC3Block(blockRGB, blockA, 1.0f);
}