terrain: added faster block compressor

This commit is contained in:
Turánszki János
2023-05-24 08:10:29 +02:00
parent 4588f45271
commit 50389bf753
9 changed files with 615 additions and 6693 deletions
File diff suppressed because it is too large Load Diff
@@ -15,6 +15,7 @@
</ItemGroup>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)bitonicSortHF.hlsli" />
<None Include="$(MSBuildThisFileDirectory)BlockCompress.hlsli" />
<None Include="$(MSBuildThisFileDirectory)brdf.hlsli" />
<None Include="$(MSBuildThisFileDirectory)circle.hlsli" />
<None Include="$(MSBuildThisFileDirectory)ColorSpaceUtility.hlsli" />
@@ -153,6 +153,9 @@
<None Include="$(MSBuildThisFileDirectory)shadingHF.hlsli">
<Filter>HF</Filter>
</None>
<None Include="$(MSBuildThisFileDirectory)BlockCompress.hlsli">
<Filter>HF</Filter>
</None>
</ItemGroup>
<ItemGroup>
<FxCompile Include="$(MSBuildThisFileDirectory)hairparticle_simulateCS.hlsl">
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,11 +1,6 @@
#include "globals.hlsli"
#pragma dxc diagnostic push
#pragma dxc diagnostic ignored "-Wambig-lit-shift"
#pragma dxc diagnostic ignored "-Wunused-value"
#define ASPM_HLSL
#include "compressonator/bcn_common_kernel.h"
#include "BlockCompress.hlsli"
#include "ColorSpaceUtility.hlsli"
static const uint region_count = 4;
@@ -24,7 +19,7 @@ RWTexture2D<uint2> output : register(u0);
RWTexture2D<uint4> output : register(u0);
#endif // UPDATE_NORMALMAP
static const uint2 block_offsets[BLOCK_SIZE_4X4] = {
static const uint2 block_offsets[16] = {
uint2(0, 0), uint2(1, 0), uint2(2, 0), uint2(3, 0),
uint2(0, 1), uint2(1, 1), uint2(2, 1), uint2(3, 1),
uint2(0, 2), uint2(1, 2), uint2(2, 2), uint2(3, 2),
@@ -40,20 +35,20 @@ void main(uint3 DTid : SV_DispatchThreadID)
Texture2D<float4> region_weights_texture = bindless_textures[push.region_weights_textureRO];
#ifdef UPDATE_BASECOLORMAP
float3 block_rgb[BLOCK_SIZE_4X4];
float3 block_rgb[16];
#endif // UPDATE_BASECOLORMAP
#ifdef UPDATE_NORMALMAP
float block_x[BLOCK_SIZE_4X4];
float block_y[BLOCK_SIZE_4X4];
float block_x[16];
float block_y[16];
#endif // UPDATE_NORMALMAP
#ifdef UPDATE_SURFACEMAP
float3 block_rgb[BLOCK_SIZE_4X4];
float block_a[BLOCK_SIZE_4X4];
float3 block_rgb[16];
float block_a[16];
#endif // UPDATE_SURFACEMAP
for(uint idx = 0; idx < BLOCK_SIZE_4X4; ++idx)
for(uint idx = 0; idx < 16; ++idx)
{
const uint2 block_offset = block_offsets[idx];
const int2 pixel = push.offset + DTid.xy * 4 + block_offset;
@@ -127,7 +122,7 @@ void main(uint3 DTid : SV_DispatchThreadID)
total_color /= weight_sum;
#ifdef UPDATE_BASECOLORMAP
block_rgb[idx] = total_color.rgb;
block_rgb[idx] = ApplySRGBCurve_Fast(total_color.rgb);
#endif // UPDATE_BASECOLORMAP
#ifdef UPDATE_NORMALMAP
@@ -144,16 +139,15 @@ void main(uint3 DTid : SV_DispatchThreadID)
const uint2 write_coord = push.write_offset + DTid.xy;
#ifdef UPDATE_BASECOLORMAP
output[write_coord] = CompressBlockBC1_UNORM(block_rgb, CMP_QUALITY0, /*isSRGB =*/ true);
output[write_coord] = CompressBC1Block(block_rgb);
#endif // UPDATE_BASECOLORMAP
#ifdef UPDATE_NORMALMAP
output[write_coord] = CompressBlockBC5_UNORM(block_x, block_y, CMP_QUALITY0);
output[write_coord] = CompressBC5Block(block_x, block_y);
#endif // UPDATE_NORMALMAP
#ifdef UPDATE_SURFACEMAP
output[write_coord] = CompressBlockBC3_UNORM(block_rgb, block_a, CMP_QUALITY2, /*isSRGB =*/ false);
output[write_coord] = CompressBC3Block(block_rgb, block_a);
#endif // UPDATE_SURFACEMAP
}
#pragma dxc diagnostic pop
+1 -1
View File
@@ -9,7 +9,7 @@ namespace wi::version
// minor features, major updates, breaking compatibility changes
const int minor = 71;
// minor bug fixes, alterations, refactors, updates
const int revision = 211;
const int revision = 212;
const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);
-27
View File
@@ -510,33 +510,6 @@ OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR
SOFTWARE.
###############################################################################################################################
Compressonator: https://github.com/GPUOpen-Tools/compressonator
//===============================================================================
// Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files(the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and / or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions :
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
//===============================================================================
###############################################################################################################################
pugixml: https://github.com/zeux/pugixml