您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

38 行
1.7 KiB

#include "../ShaderLibrary/BC6H.hlsl"
Texture2D<float4> _Source;
RWTexture2D<uint4> _Target;
#pragma kernel KEncodeFast
[numthreads(4, 4, 1)]
void KEncodeFast(uint2 groupId : SV_GroupID, uint2 groupThreadId : SV_GroupThreadID, uint2 dispatchThreadId : SV_DispatchThreadID)
{
// Load 4x4 pixel block
float3 texels[16];
uint2 topLeftSourceID = dispatchThreadId << 2;
texels[0] = _Source.Load(uint3(topLeftSourceID , 0)).rgb;
texels[1] = _Source.Load(uint3(topLeftSourceID + uint2(1, 0), 0)).rgb;
texels[2] = _Source.Load(uint3(topLeftSourceID + uint2(2, 0), 0)).rgb;
texels[3] = _Source.Load(uint3(topLeftSourceID + uint2(3, 0), 0)).rgb;
texels[4] = _Source.Load(uint3(topLeftSourceID + uint2(0, 1), 0)).rgb;
texels[5] = _Source.Load(uint3(topLeftSourceID + uint2(1, 1), 0)).rgb;
texels[6] = _Source.Load(uint3(topLeftSourceID + uint2(2, 1), 0)).rgb;
texels[7] = _Source.Load(uint3(topLeftSourceID + uint2(3, 1), 0)).rgb;
texels[8] = _Source.Load(uint3(topLeftSourceID + uint2(0, 2), 0)).rgb;
texels[9] = _Source.Load(uint3(topLeftSourceID + uint2(1, 2), 0)).rgb;
texels[10] = _Source.Load(uint3(topLeftSourceID + uint2(2, 2), 0)).rgb;
texels[11] = _Source.Load(uint3(topLeftSourceID + uint2(3, 2), 0)).rgb;
texels[12] = _Source.Load(uint3(topLeftSourceID + uint2(0, 3), 0)).rgb;
texels[13] = _Source.Load(uint3(topLeftSourceID + uint2(1, 3), 0)).rgb;
texels[14] = _Source.Load(uint3(topLeftSourceID + uint2(2, 3), 0)).rgb;
texels[15] = _Source.Load(uint3(topLeftSourceID + uint2(3, 3), 0)).rgb;
uint4 block = uint4(0, 0, 0, 0);
float blockMSLE = 0;
EncodeMode11(block, blockMSLE, texels);
_Target[dispatchThreadId] = block;
}