├── .gitignore ├── Assets ├── BlitCopyShowAlpha.mat ├── BlitCopyShowAlpha.mat.meta ├── BlitShowAlpha.shader ├── BlitShowAlpha.shader.meta ├── GPUTexCompression.meta ├── GPUTexCompression │ ├── CalculateRMSE.compute │ ├── CalculateRMSE.compute.meta │ ├── EncodeBCn.compute │ ├── EncodeBCn.compute.meta │ ├── EncodeBCn.cs │ ├── EncodeBCn.cs.meta │ ├── External.meta │ └── External │ │ ├── AMD_Compressonator.meta │ │ ├── AMD_Compressonator │ │ ├── bcn_common_api.h │ │ ├── bcn_common_api.h.meta │ │ ├── bcn_common_kernel.h │ │ ├── bcn_common_kernel.h.meta │ │ ├── common_def.h │ │ └── common_def.h.meta │ │ ├── FastBlockCompress.meta │ │ └── FastBlockCompress │ │ ├── BlockCompress.hlsli │ │ └── BlockCompress.hlsli.meta ├── Materials.meta ├── Materials │ ├── TexGradient1.mat │ ├── TexGradient1.mat.meta │ ├── TexGradient2.mat │ ├── TexGradient2.mat.meta │ ├── TexNoise.mat │ └── TexNoise.mat.meta ├── RenderTarget.renderTexture ├── RenderTarget.renderTexture.meta ├── Scenes.meta ├── SkyMaterial.mat ├── SkyMaterial.mat.meta ├── SkyShader.shader ├── SkyShader.shader.meta ├── TestGPUTexCompression.cs ├── TestGPUTexCompression.cs.meta ├── TestGPUTexCompressionScene.unity ├── TestGPUTexCompressionScene.unity.meta ├── TexGradient1.png ├── TexGradient1.png.meta ├── TexGradient2.png ├── TexGradient2.png.meta ├── TexNoise.tga ├── TexNoise.tga.meta ├── UnlitTexture.shader └── UnlitTexture.shader.meta ├── Packages ├── manifest.json └── packages-lock.json ├── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── MemorySettings.asset ├── NavMeshAreas.asset ├── PackageManagerSettings.asset ├── Packages │ └── com.unity.testtools.codecoverage │ │ └── Settings.json ├── Physics2DSettings.asset ├── PresetManager.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── SceneTemplateSettings.json ├── TagManager.asset ├── TimeManager.asset ├── UnityConnectSettings.asset ├── VFXManager.asset ├── VersionControlSettings.asset └── XRSettings.asset ├── readme.md └── screenshot.png /.gitignore: -------------------------------------------------------------------------------- 1 | /.idea/* 2 | /Library/* 3 | /Temp/* 4 | /UserSettings/* 5 | /*.sln 6 | /*.csproj 7 | /Logs/* 8 | /obj/* 9 | .DS_Store 10 | -------------------------------------------------------------------------------- /Assets/BlitCopyShowAlpha.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 8 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: BlitCopyShowAlpha 11 | m_Shader: {fileID: 4800000, guid: 0718209eb2f78414087a10d65b2e7bc6, type: 3} 12 | m_Parent: {fileID: 0} 13 | m_ModifiedSerializedProperties: 0 14 | m_ValidKeywords: [] 15 | m_InvalidKeywords: [] 16 | m_LightmapFlags: 4 17 | m_EnableInstancingVariants: 0 18 | m_DoubleSidedGI: 0 19 | m_CustomRenderQueue: -1 20 | stringTagMap: {} 21 | disabledShaderPasses: [] 22 | m_LockedProperties: 23 | m_SavedProperties: 24 | serializedVersion: 3 25 | m_TexEnvs: 26 | - _MainTex: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _SourceTex: 31 | m_Texture: {fileID: 8400000, guid: 17741c07cfd6f4c29860a6143c77cae1, type: 2} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | m_Ints: [] 35 | m_Floats: [] 36 | m_Colors: [] 37 | m_BuildTextureStacks: [] 38 | -------------------------------------------------------------------------------- /Assets/BlitCopyShowAlpha.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3823dc36f697a4f80b14a7c19cb29647 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/BlitShowAlpha.shader: -------------------------------------------------------------------------------- 1 | Shader "Unlit/Blit Copy Show Alpha" 2 | { 3 | Properties 4 | { 5 | _SourceTex ("Source", 2D) = "" {} 6 | _MainTex ("Texture", 2D) = "" {} 7 | } 8 | SubShader { 9 | Pass { 10 | ZTest Always Cull Off ZWrite Off 11 | 12 | CGPROGRAM 13 | #pragma vertex vert 14 | #pragma fragment frag 15 | #include "UnityCG.cginc" 16 | 17 | Texture2D _SourceTex; 18 | Texture2D _MainTex; 19 | SamplerState my_point_clamp_sampler; 20 | float4 _MainTex_ST; 21 | 22 | struct appdata_t { 23 | float4 vertex : POSITION; 24 | float2 uv : TEXCOORD0; 25 | }; 26 | 27 | struct v2f { 28 | float4 vertex : SV_POSITION; 29 | float2 uv : TEXCOORD0; 30 | }; 31 | 32 | v2f vert (appdata_t v) 33 | { 34 | v2f o; 35 | o.vertex = UnityObjectToClipPos(v.vertex); 36 | o.uv = TRANSFORM_TEX(v.uv.xy, _MainTex); 37 | return o; 38 | } 39 | 40 | half4 frag (v2f i) : SV_Target 41 | { 42 | half4 col = _MainTex.Sample(my_point_clamp_sampler, i.uv); 43 | half4 src = _SourceTex.Sample(my_point_clamp_sampler, i.uv); 44 | 45 | float diag = i.uv.x * 2; 46 | if (diag >= 0.8 && diag < 1.0) 47 | col.rgb = abs(col.rgb - src.rgb) * 2; 48 | if (diag >= 1.0 && diag < 1.2) 49 | col.rgb = col.a; 50 | if (diag >= 1.2 && diag < 1.4) 51 | col.rgb = abs(col.a - src.a) * 2; 52 | return col; 53 | } 54 | ENDCG 55 | 56 | } 57 | } 58 | Fallback Off 59 | } 60 | -------------------------------------------------------------------------------- /Assets/BlitShowAlpha.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0718209eb2f78414087a10d65b2e7bc6 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/GPUTexCompression.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d7bce9a1ca06b4166ad8b1079e7ed01e 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/GPUTexCompression/CalculateRMSE.compute: -------------------------------------------------------------------------------- 1 | #pragma kernel RMSCalculate 2 | #pragma kernel RMSReduce 3 | #pragma use_dxc metal vulkan 4 | 5 | #define kRMSGroupSize 64 6 | 7 | #define kTexelsPerGroup (kRMSGroupSize * 2) 8 | 9 | uint _TextureWidth; 10 | Texture2D _TextureA; 11 | Texture2D _TextureB; 12 | RWStructuredBuffer _BufferInput; 13 | RWStructuredBuffer _BufferOutput; 14 | 15 | groupshared float2 gs_RMSE[kRMSGroupSize]; // squared errors for RGB & A 16 | 17 | // Input: _TextureWidth, _TextureA, _TextureB. 18 | // Output: _BufferOutput. 19 | // Each thread reads two texels; one group processes 128 texels. 20 | [numthreads(kRMSGroupSize, 1, 1)] 21 | void RMSCalculate( 22 | uint2 threadID : SV_DispatchThreadID, 23 | uint2 groupID : SV_GroupID, 24 | uint threadIndexInGroup : SV_GroupIndex) 25 | { 26 | // Load two neighboring texels and compute error 27 | uint3 pos = uint3(threadID.x * 2, threadID.y, 0); 28 | float4 colA = _TextureA.Load(pos); 29 | float4 colB = _TextureB.Load(pos); 30 | float4 err0 = (colA - colB) * 255.0; 31 | colA = _TextureA.Load(pos, int2(1, 0)); 32 | colB = _TextureB.Load(pos, int2(1, 0)); 33 | float4 err1 = (colA - colB) * 255.0; 34 | 35 | // Compute squared (RGB, A) error sum for this pair of texels 36 | float errRGB = dot(err0.rgb, err0.rgb) + dot(err1.rgb, err1.rgb); 37 | float errA = err0.a*err0.a + err1.a*err1.a; 38 | float2 err = float2(errRGB, errA); 39 | gs_RMSE[threadIndexInGroup] = err; 40 | 41 | GroupMemoryBarrierWithGroupSync(); 42 | 43 | // Make the first thread sum up all the error values and output 44 | if (threadIndexInGroup == 0) 45 | { 46 | for (uint i = 1; i < kRMSGroupSize; ++i) 47 | err += gs_RMSE[threadIndexInGroup + i]; 48 | uint idx = groupID.y * (_TextureWidth / kTexelsPerGroup) + groupID.x; 49 | _BufferOutput[idx] = err; 50 | } 51 | } 52 | 53 | [numthreads(kRMSGroupSize, 1, 1)] 54 | void RMSReduce( 55 | uint threadID : SV_DispatchThreadID, 56 | uint groupID : SV_GroupID, 57 | uint threadIndexInGroup : SV_GroupIndex) 58 | { 59 | // Load error values into local store (sum up two elements 60 | // for each thread) 61 | uint pos = threadID * 2; 62 | float2 err = _BufferInput[pos] + _BufferInput[pos+1]; 63 | gs_RMSE[threadIndexInGroup] = err; 64 | 65 | GroupMemoryBarrierWithGroupSync(); 66 | 67 | // Make first thread sum up all the error values and output 68 | if (threadIndexInGroup == 0) 69 | { 70 | for (uint i = 1; i < kRMSGroupSize; ++i) 71 | err += gs_RMSE[threadIndexInGroup + i]; 72 | _BufferOutput[groupID] = err; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /Assets/GPUTexCompression/CalculateRMSE.compute.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 32471e8bf4ae541af82c44f322796de2 3 | ComputeShaderImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/GPUTexCompression/EncodeBCn.compute: -------------------------------------------------------------------------------- 1 | #pragma kernel EncodeBC1_AMD USE_AMD_CODE TARGET_UINT2 2 | #pragma kernel EncodeBC1_XDK USE_XDK_CODE TARGET_UINT2 3 | #pragma kernel EncodeBC3_AMD USE_AMD_CODE TARGET_UINT4 4 | #pragma kernel EncodeBC3_XDK USE_XDK_CODE TARGET_UINT4 5 | 6 | Texture2D _Source; 7 | #ifdef TARGET_UINT2 8 | RWTexture2D _Target; 9 | #else 10 | RWTexture2D _Target; 11 | #endif 12 | float _Quality; 13 | 14 | void LoadTexelBlockRGB(Texture2D tex, uint2 tid, out float3 rgb[16]) 15 | { 16 | uint2 coord = tid.xy << 2; 17 | for (uint i = 0; i < 16; ++i) 18 | { 19 | uint2 offs = uint2(i & 3, i >> 2); 20 | float4 pix = tex.Load(uint3(coord + offs, 0)); 21 | rgb[i] = pix.rgb; 22 | } 23 | } 24 | 25 | void LoadTexelBlockRGBA(Texture2D tex, uint2 tid, out float3 rgb[16], out float alpha[16]) 26 | { 27 | uint2 coord = tid.xy << 2; 28 | for (uint i = 0; i < 16; ++i) 29 | { 30 | uint2 offs = uint2(i & 3, i >> 2); 31 | float4 pix = tex.Load(uint3(coord + offs, 0)); 32 | rgb[i] = pix.rgb; 33 | alpha[i] = pix.a; 34 | } 35 | } 36 | 37 | 38 | #if defined(USE_AMD_CODE) 39 | 40 | #define ASPM_GPU 41 | #define ASPM_HLSL 42 | #include "External/AMD_Compressonator/bcn_common_kernel.h" 43 | 44 | #if defined(TARGET_UINT2) 45 | [numthreads(8, 8, 1)] 46 | void EncodeBC1_AMD(uint2 dtid : SV_DispatchThreadID) 47 | { 48 | float3 colors[16]; 49 | LoadTexelBlockRGB(_Source, dtid, colors); 50 | uint2 block = CompressBlockBC1_UNORM(colors, _Quality, true); 51 | _Target[dtid] = block; 52 | } 53 | #endif 54 | 55 | #if defined(TARGET_UINT4) 56 | [numthreads(8, 8, 1)] 57 | void EncodeBC3_AMD(uint2 dtid : SV_DispatchThreadID) 58 | { 59 | float3 colors[16]; 60 | float alphas[16]; 61 | LoadTexelBlockRGBA(_Source, dtid, colors, alphas); 62 | uint4 block = CompressBlockBC3_UNORM(colors, alphas, _Quality, true); 63 | _Target[dtid] = block; 64 | } 65 | #endif 66 | 67 | #endif 68 | 69 | 70 | #if defined(USE_XDK_CODE) 71 | 72 | half3 LinearToSRGB(half3 linRGB) 73 | { 74 | // from https://chilliant.blogspot.com/2012/08/srgb-approximations-for-hlsl.html 75 | return max(1.055h * pow(linRGB, 0.416666667h) - 0.055h, 0.h); 76 | } 77 | 78 | void LinearToSRGB(inout float3 rgb[16]) 79 | { 80 | for (int i = 0; i < 16; ++i) 81 | rgb[i] = LinearToSRGB(rgb[i]); 82 | } 83 | 84 | #include "External/FastBlockCompress/BlockCompress.hlsli" 85 | 86 | #if defined(TARGET_UINT2) 87 | [numthreads(8, 8, 1)] 88 | void EncodeBC1_XDK(uint2 dtid : SV_DispatchThreadID) 89 | { 90 | float3 colors[16]; 91 | LoadTexelBlockRGB(_Source, dtid, colors); 92 | LinearToSRGB(colors); 93 | uint2 block = CompressBC1Block(colors); 94 | _Target[dtid] = block; 95 | } 96 | #endif 97 | 98 | #if defined(TARGET_UINT4) 99 | [numthreads(8, 8, 1)] 100 | void EncodeBC3_XDK(uint2 dtid : SV_DispatchThreadID) 101 | { 102 | float3 colors[16]; 103 | float alphas[16]; 104 | LoadTexelBlockRGBA(_Source, dtid, colors, alphas); 105 | LinearToSRGB(colors); 106 | uint4 block = CompressBC3Block(colors, alphas, 1.0f); 107 | _Target[dtid] = block; 108 | } 109 | #endif 110 | 111 | #endif 112 | -------------------------------------------------------------------------------- /Assets/GPUTexCompression/EncodeBCn.compute.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 876d69c76537649d180b4cc47db2d35c 3 | ComputeShaderImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/GPUTexCompression/EncodeBCn.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.Assertions; 3 | using UnityEngine.Experimental.Rendering; 4 | using UnityEngine.Rendering; 5 | 6 | public class EncodeBCn 7 | { 8 | public enum Format 9 | { 10 | None, 11 | BC1_AMD, 12 | BC1_XDK, 13 | BC3_AMD, 14 | BC3_XDK, 15 | } 16 | 17 | static readonly int s_Prop_Source = Shader.PropertyToID("_Source"); 18 | static readonly int s_Prop_Target = Shader.PropertyToID("_Target"); 19 | static readonly int s_Prop_Quality = Shader.PropertyToID("_Quality"); 20 | static readonly int s_Prop_EncodeBCn_Temp = Shader.PropertyToID("_EncodeBCn_Temp"); 21 | 22 | private ComputeShader m_EncodeShader; 23 | private int m_EncodeKernelBC1_AMD; 24 | private int m_EncodeKernelBC1_XDK; 25 | private int m_EncodeKernelBC3_AMD; 26 | private int m_EncodeKernelBC3_XDK; 27 | 28 | public EncodeBCn(ComputeShader encodeShader) 29 | { 30 | Assert.IsNotNull(encodeShader); 31 | m_EncodeShader = encodeShader; 32 | m_EncodeKernelBC1_AMD = m_EncodeShader.FindKernel("EncodeBC1_AMD"); 33 | m_EncodeKernelBC1_XDK = m_EncodeShader.FindKernel("EncodeBC1_XDK"); 34 | m_EncodeKernelBC3_AMD = m_EncodeShader.FindKernel("EncodeBC3_AMD"); 35 | m_EncodeKernelBC3_XDK = m_EncodeShader.FindKernel("EncodeBC3_XDK"); 36 | } 37 | 38 | public void Encode(CommandBuffer cmb, 39 | RenderTargetIdentifier source, int sourceWidth, int sourceHeight, 40 | RenderTargetIdentifier target, 41 | Format format, float quality) 42 | { 43 | if (format == Format.None) 44 | { 45 | cmb.CopyTexture(source, 0, target, 0); 46 | return; 47 | } 48 | int tempWidth = (sourceWidth + 3) / 4; 49 | int tempHeight = (sourceHeight + 3) / 4; 50 | var desc = new RenderTextureDescriptor 51 | { 52 | width = tempWidth, 53 | height = tempHeight, 54 | dimension = TextureDimension.Tex2D, 55 | enableRandomWrite = true, 56 | msaaSamples = 1 57 | }; 58 | int kernelIndex = format switch 59 | { 60 | Format.BC1_AMD => m_EncodeKernelBC1_AMD, 61 | Format.BC1_XDK => m_EncodeKernelBC1_XDK, 62 | Format.BC3_AMD => m_EncodeKernelBC3_AMD, 63 | Format.BC3_XDK => m_EncodeKernelBC3_XDK, 64 | _ => -1 65 | }; 66 | desc.graphicsFormat = format switch 67 | { 68 | Format.BC1_AMD => GraphicsFormat.R32G32_SInt, 69 | Format.BC1_XDK => GraphicsFormat.R32G32_SInt, 70 | _ => GraphicsFormat.R32G32B32A32_SInt 71 | }; 72 | m_EncodeShader.GetKernelThreadGroupSizes(kernelIndex, out var sizeX, out var sizeY, out var sizeZ); 73 | cmb.GetTemporaryRT(s_Prop_EncodeBCn_Temp, desc); 74 | cmb.SetComputeFloatParam(m_EncodeShader, s_Prop_Quality, quality); 75 | cmb.SetComputeTextureParam(m_EncodeShader, kernelIndex, s_Prop_Source, source); 76 | cmb.SetComputeTextureParam(m_EncodeShader, kernelIndex, s_Prop_Target, s_Prop_EncodeBCn_Temp); 77 | cmb.DispatchCompute(m_EncodeShader, kernelIndex, (int)((tempWidth + sizeX - 1) / sizeX), (int)((tempHeight + sizeY - 1) / sizeY), 1); 78 | cmb.CopyTexture(s_Prop_EncodeBCn_Temp, 0, target, 0); 79 | cmb.ReleaseTemporaryRT(s_Prop_EncodeBCn_Temp); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /Assets/GPUTexCompression/EncodeBCn.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d93736a721e024dbe88de59807604e43 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/GPUTexCompression/External.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 28f20e422be22463ea1bbb808fdb9ae3 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/GPUTexCompression/External/AMD_Compressonator.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e64d83db436d64f9ab2c23483002defa 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/GPUTexCompression/External/AMD_Compressonator/bcn_common_api.h: -------------------------------------------------------------------------------- 1 | //=============================================================================== 2 | // Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights to 7 | // use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | //=============================================================================== 23 | 24 | #ifndef BCN_COMMON_API_H_ 25 | #define BCN_COMMON_API_H_ 26 | 27 | //=================================================================== 28 | // NOTE: Do not use these API in production code, subject to changes 29 | //=================================================================== 30 | 31 | #ifndef ASPM_GPU 32 | #pragma warning(disable : 4244) 33 | #pragma warning(disable : 4201) 34 | #endif 35 | 36 | #include "common_def.h" 37 | 38 | #define CMP_MAX_16BITFLOAT 65504.0f 39 | #define CMP_FLT_MAX 3.402823466e+38F 40 | #define BC1ConstructColour(r, g, b) (((r) << 11) | ((g) << 5) | (b)) 41 | 42 | 43 | #ifdef ASPM_HLSL 44 | #define fabs(x) abs(x) 45 | #endif 46 | 47 | CMP_STATIC CGU_FLOAT cmp_fabs(CMP_IN CGU_FLOAT x) 48 | { 49 | return fabs(x); 50 | } 51 | 52 | CMP_STATIC CGU_FLOAT cmp_linearToSrgbf(CMP_IN CGU_FLOAT Color) 53 | { 54 | if (Color <= 0.0f) 55 | return (0.0f); 56 | if (Color >= 1.0f) 57 | return (1.0f); 58 | // standard : 0.0031308f 59 | if (Color <= 0.00313066844250063) 60 | return (Color * 12.92f); 61 | return (pow(fabs(Color), 1.0f / 2.4f) * 1.055f - 0.055f); 62 | } 63 | 64 | CMP_STATIC CGU_Vec3f cmp_linearToSrgb(CMP_IN CGU_Vec3f Color) 65 | { 66 | Color.x = cmp_linearToSrgbf(Color.x); 67 | Color.y = cmp_linearToSrgbf(Color.y); 68 | Color.z = cmp_linearToSrgbf(Color.z); 69 | return Color; 70 | } 71 | 72 | CMP_STATIC CGU_FLOAT cmp_srgbToLinearf(CMP_IN CGU_FLOAT Color) 73 | { 74 | if (Color <= 0.0f) 75 | return (0.0f); 76 | if (Color >= 1.0f) 77 | return (1.0f); 78 | // standard 0.04045f 79 | if (Color <= 0.0404482362771082) 80 | return (Color / 12.92f); 81 | return pow((Color + 0.055f) / 1.055f, 2.4f); 82 | } 83 | 84 | CMP_STATIC CGU_Vec3f cmp_srgbToLinear(CMP_IN CGU_Vec3f Color) 85 | { 86 | Color.x = cmp_srgbToLinearf(Color.x); 87 | Color.y = cmp_srgbToLinearf(Color.y); 88 | Color.z = cmp_srgbToLinearf(Color.z); 89 | return Color; 90 | } 91 | 92 | CMP_STATIC CGU_Vec3f cmp_565ToLinear(CMP_IN CGU_UINT32 n565) 93 | { 94 | CGU_UINT32 r0; 95 | CGU_UINT32 g0; 96 | CGU_UINT32 b0; 97 | 98 | r0 = ((n565 & 0xf800) >> 8); 99 | g0 = ((n565 & 0x07e0) >> 3); 100 | b0 = ((n565 & 0x001f) << 3); 101 | 102 | // Apply the lower bit replication to give full dynamic range (5,6,5) 103 | r0 += (r0 >> 5); 104 | g0 += (g0 >> 6); 105 | b0 += (b0 >> 5); 106 | 107 | CGU_Vec3f LinearColor; 108 | LinearColor.x = (CGU_FLOAT)r0; 109 | LinearColor.y = (CGU_FLOAT)g0; 110 | LinearColor.z = (CGU_FLOAT)b0; 111 | 112 | return LinearColor; 113 | } 114 | 115 | CMP_STATIC CGU_UINT32 cmp_get2Bit32(CMP_IN CGU_UINT32 value, CMP_IN CGU_UINT32 indexPos) 116 | { 117 | return (value >> (indexPos * 2)) & 0x3; 118 | } 119 | 120 | CMP_STATIC CGU_UINT32 cmp_set2Bit32(CMP_IN CGU_UINT32 value, CMP_IN CGU_UINT32 indexPos) 121 | { 122 | return ((value & 0x3) << (indexPos * 2)); 123 | } 124 | 125 | CMP_STATIC CGU_UINT32 cmp_constructColor(CMP_IN CGU_UINT32 R, CMP_IN CGU_UINT32 G, CMP_IN CGU_UINT32 B) 126 | { 127 | return (((R & 0x000000F8) << 8) | ((G & 0x000000FC) << 3) | ((B & 0x000000F8) >> 3)); 128 | } 129 | 130 | CMP_STATIC CGU_FLOAT cmp_clampf(CMP_IN CGU_FLOAT v, CMP_IN CGU_FLOAT a, CMP_IN CGU_FLOAT b) 131 | { 132 | if (v < a) 133 | return a; 134 | else if (v > b) 135 | return b; 136 | return v; 137 | } 138 | 139 | CMP_STATIC CGU_Vec3f cmp_clampVec3f(CMP_IN CGU_Vec3f value, CMP_IN CGU_FLOAT minValue, CMP_IN CGU_FLOAT maxValue) 140 | { 141 | #ifdef ASPM_GPU 142 | return clamp(value, minValue, maxValue); 143 | #else 144 | CGU_Vec3f revalue; 145 | revalue.x = cmp_clampf(value.x, minValue, maxValue); 146 | revalue.y = cmp_clampf(value.y, minValue, maxValue); 147 | revalue.z = cmp_clampf(value.z, minValue, maxValue); 148 | return revalue; 149 | #endif 150 | } 151 | 152 | CMP_STATIC CGU_Vec3f cmp_saturate(CMP_IN CGU_Vec3f value) 153 | { 154 | #ifdef ASPM_HLSL 155 | return saturate(value); 156 | #else 157 | return cmp_clampVec3f(value, 0.0f, 1.0f); 158 | #endif 159 | } 160 | 161 | static CGU_Vec3f cmp_powVec3f(CGU_Vec3f color, CGU_FLOAT ex) 162 | { 163 | #ifdef ASPM_GPU 164 | return pow(color, ex); 165 | #else 166 | CGU_Vec3f ColorSrgbPower; 167 | ColorSrgbPower.x = pow(color.x, ex); 168 | ColorSrgbPower.y = pow(color.y, ex); 169 | ColorSrgbPower.z = pow(color.z, ex); 170 | return ColorSrgbPower; 171 | #endif 172 | } 173 | 174 | CMP_STATIC CGU_Vec3f cmp_minVec3f(CMP_IN CGU_Vec3f a, CMP_IN CGU_Vec3f b) 175 | { 176 | #ifdef ASPM_HLSL 177 | return min(a, b); 178 | #endif 179 | CGU_Vec3f res; 180 | if (a.x < b.x) 181 | res.x = a.x; 182 | else 183 | res.x = b.x; 184 | if (a.y < b.y) 185 | res.y = a.y; 186 | else 187 | res.y = b.y; 188 | if (a.z < b.z) 189 | res.z = a.z; 190 | else 191 | res.z = b.z; 192 | return res; 193 | } 194 | 195 | CMP_STATIC CGU_Vec3f cmp_maxVec3f(CMP_IN CGU_Vec3f a, CMP_IN CGU_Vec3f b) 196 | { 197 | #ifdef ASPM_HLSL 198 | return max(a, b); 199 | #endif 200 | CGU_Vec3f res; 201 | if (a.x > b.x) 202 | res.x = a.x; 203 | else 204 | res.x = b.x; 205 | if (a.y > b.y) 206 | res.y = a.y; 207 | else 208 | res.y = b.y; 209 | if (a.z > b.z) 210 | res.z = a.z; 211 | else 212 | res.z = b.z; 213 | return res; 214 | } 215 | 216 | inline CGU_Vec3f cmp_min3f(CMP_IN CGU_Vec3f value1, CMP_IN CGU_Vec3f value2) 217 | { 218 | #ifdef ASPM_GPU 219 | return min(value1, value2); 220 | #else 221 | CGU_Vec3f res; 222 | res.x = CMP_MIN(value1.x, value2.x); 223 | res.y = CMP_MIN(value1.y, value2.y); 224 | res.z = CMP_MIN(value1.z, value2.z); 225 | return res; 226 | #endif 227 | } 228 | 229 | inline CGU_Vec3f cmp_max3f(CMP_IN CGU_Vec3f value1, CMP_IN CGU_Vec3f value2) 230 | { 231 | #ifdef ASPM_GPU 232 | return max(value1, value2); 233 | #else 234 | CGU_Vec3f res; 235 | res.x = CMP_MAX(value1.x, value2.x); 236 | res.y = CMP_MAX(value1.y, value2.y); 237 | res.z = CMP_MAX(value1.z, value2.z); 238 | return res; 239 | #endif 240 | } 241 | 242 | CMP_STATIC CGU_FLOAT cmp_minf(CMP_IN CGU_FLOAT a, CMP_IN CGU_FLOAT b) 243 | { 244 | return a < b ? a : b; 245 | } 246 | 247 | CMP_STATIC CGU_FLOAT cmp_maxf(CMP_IN CGU_FLOAT a, CMP_IN CGU_FLOAT b) 248 | { 249 | return a > b ? a : b; 250 | } 251 | 252 | CMP_STATIC CGU_FLOAT cmp_floor(CMP_IN CGU_FLOAT value) 253 | { 254 | return floor(value); 255 | } 256 | 257 | CMP_STATIC CGU_Vec3f cmp_floorVec3f(CMP_IN CGU_Vec3f value) 258 | { 259 | #ifdef ASPM_GPU 260 | return floor(value); 261 | #else 262 | CGU_Vec3f revalue; 263 | revalue.x = floor(value.x); 264 | revalue.y = floor(value.y); 265 | revalue.z = floor(value.z); 266 | return revalue; 267 | #endif 268 | } 269 | 270 | #ifndef ASPM_OPENCL 271 | 272 | //======================================================= 273 | // COMMON GPU & CPU API 274 | //======================================================= 275 | 276 | //====================== 277 | // implicit vector cast 278 | //====================== 279 | CMP_STATIC CGU_Vec4i cmp_castimp(CGU_Vec4ui v1) 280 | { 281 | #ifdef ASPM_HLSL 282 | return (v1); 283 | #else 284 | return (v1.x, v1.y, v1.z, v1.w); 285 | #endif 286 | } 287 | 288 | CMP_STATIC CGU_Vec3i cmp_castimp(CGU_Vec3ui v1) 289 | { 290 | #ifdef ASPM_HLSL 291 | return (v1); 292 | #else 293 | return (v1.x, v1.y, v1.z); 294 | #endif 295 | } 296 | 297 | //====================== 298 | // Min / Max 299 | //====================== 300 | 301 | CMP_STATIC CGU_UINT8 cmp_min8(CMP_IN CGU_UINT8 a, CMP_IN CGU_UINT8 b) 302 | { 303 | return a < b ? a : b; 304 | } 305 | 306 | CMP_STATIC CGU_UINT8 cmp_max8(CMP_IN CGU_UINT8 a, CMP_IN CGU_UINT8 b) 307 | { 308 | return a > b ? a : b; 309 | } 310 | 311 | CMP_STATIC CGU_UINT32 cmp_mini(CMP_IN CGU_UINT32 a, CMP_IN CGU_UINT32 b) 312 | { 313 | return (a < b) ? a : b; 314 | } 315 | 316 | CMP_STATIC CGU_UINT32 cmp_maxi(CMP_IN CGU_UINT32 a, CMP_IN CGU_UINT32 b) 317 | { 318 | return (a > b) ? a : b; 319 | } 320 | 321 | CMP_STATIC CGU_FLOAT cmp_max3(CMP_IN CGU_FLOAT i, CMP_IN CGU_FLOAT j, CMP_IN CGU_FLOAT k) 322 | { 323 | #ifdef ASPM_GLSL 324 | return max3(i, j, k); 325 | #else 326 | CGU_FLOAT max = i; 327 | 328 | if (max < j) 329 | max = j; 330 | 331 | if (max < k) 332 | max = k; 333 | 334 | return (max); 335 | #endif 336 | } 337 | 338 | 339 | CMP_STATIC CGU_Vec4ui cmp_minVec4ui(CMP_IN CGU_Vec4ui a, CMP_IN CGU_Vec4ui b) 340 | { 341 | //#ifdef ASPM_HLSL 342 | // return min(a, b); 343 | //#endif 344 | //#ifndef ASPM_GPU 345 | CGU_Vec4ui res; 346 | if (a.x < b.x) 347 | res.x = a.x; 348 | else 349 | res.x = b.x; 350 | if (a.y < b.y) 351 | res.y = a.y; 352 | else 353 | res.y = b.y; 354 | if (a.z < b.z) 355 | res.z = a.z; 356 | else 357 | res.z = b.z; 358 | if (a.w < b.w) 359 | res.w = a.w; 360 | else 361 | res.w = b.w; 362 | return res; 363 | //#endif 364 | } 365 | 366 | CMP_STATIC CGU_Vec4ui cmp_maxVec4ui(CMP_IN CGU_Vec4ui a, CMP_IN CGU_Vec4ui b) 367 | { 368 | //#ifdef ASPM_HLSL 369 | // return max(a, b); 370 | //#endif 371 | //#ifndef ASPM_GPU 372 | CGU_Vec4ui res; 373 | if (a.x > b.x) 374 | res.x = a.x; 375 | else 376 | res.x = b.x; 377 | if (a.y > b.y) 378 | res.y = a.y; 379 | else 380 | res.y = b.y; 381 | if (a.z > b.z) 382 | res.z = a.z; 383 | else 384 | res.z = b.z; 385 | if (a.w > b.w) 386 | res.w = a.w; 387 | else 388 | res.w = b.w; 389 | return res; 390 | //#endif 391 | } 392 | 393 | //====================== 394 | // Clamps 395 | //====================== 396 | 397 | CMP_STATIC CGU_UINT32 cmp_clampui32(CMP_IN CGU_UINT32 v, CMP_IN CGU_UINT32 a, CMP_IN CGU_UINT32 b) 398 | { 399 | if (v < a) 400 | return a; 401 | else if (v > b) 402 | return b; 403 | return v; 404 | } 405 | 406 | 407 | // Test Ref:https://en.wikipedia.org/wiki/Half-precision_floating-point_format 408 | // Half (in Hex) Float Comment 409 | // --------------------------------------------------------------------------- 410 | // 0001 (approx) = 0.000000059604645 smallest positive subnormal number 411 | // 03ff (approx) = 0.000060975552 largest subnormal number 412 | // 0400 (approx) = 0.00006103515625 smallest positive normal number 413 | // 7bff (approx) = 65504 largest normal number 414 | // 3bff (approx) = 0.99951172 largest number less than one 415 | // 3c00 (approx) = 1.00097656 smallest number larger than one 416 | // 3555 = 0.33325195 the rounding of 1/3 to nearest 417 | // c000 = ?2 418 | // 8000 = -0 419 | // 0000 = 0 420 | // 7c00 = infinity 421 | // fc00 = infinity 422 | // Half Float Math 423 | 424 | CMP_STATIC CGU_FLOAT HalfToFloat(CGU_UINT32 h) 425 | { 426 | #if defined(ASPM_GPU) 427 | CGU_FLOAT f = min16float((float)(h)); 428 | return f; 429 | #else 430 | union FP32 431 | { 432 | CGU_UINT32 u; 433 | CGU_FLOAT f; 434 | }; 435 | 436 | const FP32 magic = {(254 - 15) << 23}; 437 | const FP32 was_infnan = {(127 + 16) << 23}; 438 | 439 | FP32 o; 440 | o.u = (h & 0x7fff) << 13; // exponent/mantissa bits 441 | o.f *= magic.f; // exponent adjust 442 | if (o.f >= was_infnan.f) // check Inf/NaN 443 | o.u |= 255 << 23; 444 | o.u |= (h & 0x8000) << 16; // sign bit 445 | return o.f; 446 | #endif 447 | } 448 | 449 | // From BC6HEcode.hlsl 450 | 451 | CMP_STATIC CGU_FLOAT cmp_half2float1(CGU_UINT32 Value) 452 | { 453 | CGU_UINT32 Mantissa = (CGU_UINT32)(Value & 0x03FF); 454 | 455 | CGU_UINT32 Exponent; 456 | if ((Value & 0x7C00) != 0) // The value is normalized 457 | { 458 | Exponent = (CGU_UINT32)((Value >> 10) & 0x1F); 459 | } 460 | else if (Mantissa != 0) // The value is denormalized 461 | { 462 | // Normalize the value in the resulting float 463 | Exponent = 1; 464 | 465 | do 466 | { 467 | Exponent--; 468 | Mantissa <<= 1; 469 | } while ((Mantissa & 0x0400) == 0); 470 | 471 | Mantissa &= 0x03FF; 472 | } 473 | else // The value is zero 474 | { 475 | Exponent = (CGU_UINT32)(-112); 476 | } 477 | 478 | CGU_UINT32 Result = ((Value & 0x8000) << 16) | // Sign 479 | ((Exponent + 112) << 23) | // Exponent 480 | (Mantissa << 13); // Mantissa 481 | 482 | return CGU_FLOAT(Result); 483 | } 484 | 485 | CMP_STATIC CGU_Vec3f cmp_half2floatVec3(CGU_Vec3ui color_h) 486 | { 487 | //uint3 sign = color_h & 0x8000; 488 | //uint3 expo = color_h & 0x7C00; 489 | //uint3 base = color_h & 0x03FF; 490 | //return ( expo == 0 ) ? asfloat( ( sign << 16 ) | asuint( float3(base) / 16777216 ) ) //16777216 = 2^24 491 | // : asfloat( ( sign << 16 ) | ( ( ( expo + 0x1C000 ) | base ) << 13 ) ); //0x1C000 = 0x1FC00 - 0x3C00 492 | 493 | return CGU_Vec3f(cmp_half2float1(color_h.x), cmp_half2float1(color_h.y), cmp_half2float1(color_h.z)); 494 | } 495 | 496 | CMP_STATIC CGU_UINT16 FloatToHalf(CGU_FLOAT value) 497 | { 498 | #if defined(ASPM_GPU) 499 | return 0; 500 | #else 501 | union FP32 502 | { 503 | CGU_UINT16 u; 504 | float f; 505 | struct 506 | { 507 | CGU_UINT32 Mantissa : 23; 508 | CGU_UINT32 Exponent : 8; 509 | CGU_UINT32 Sign : 1; 510 | }; 511 | }; 512 | 513 | union FP16 514 | { 515 | CGU_UINT16 u; 516 | struct 517 | { 518 | CGU_UINT32 Mantissa : 10; 519 | CGU_UINT32 Exponent : 5; 520 | CGU_UINT32 Sign : 1; 521 | }; 522 | }; 523 | 524 | FP16 o = {0}; 525 | FP32 f; 526 | f.f = value; 527 | 528 | // Based on ISPC reference code (with minor modifications) 529 | if (f.Exponent == 0) // Signed zero/denormal (which will underflow) 530 | o.Exponent = 0; 531 | else if (f.Exponent == 255) // Inf or NaN (all exponent bits set) 532 | { 533 | o.Exponent = 31; 534 | o.Mantissa = f.Mantissa ? 0x200 : 0; // NaN->qNaN and Inf->Inf 535 | } 536 | else // Normalized number 537 | { 538 | // Exponent unbias the single, then bias the halfp 539 | int newexp = f.Exponent - 127 + 15; 540 | if (newexp >= 31) // Overflow, return signed infinity 541 | o.Exponent = 31; 542 | else if (newexp <= 0) // Underflow 543 | { 544 | if ((14 - newexp) <= 24) // Mantissa might be non-zero 545 | { 546 | CGU_UINT32 mant = f.Mantissa | 0x800000; // Hidden 1 bit 547 | o.Mantissa = mant >> (14 - newexp); 548 | if ((mant >> (13 - newexp)) & 1) // Check for rounding 549 | o.u++; // Round, might overflow into exp bit, but this is OK 550 | } 551 | } 552 | else 553 | { 554 | o.Exponent = newexp; 555 | o.Mantissa = f.Mantissa >> 13; 556 | if (f.Mantissa & 0x1000) // Check for rounding 557 | o.u++; // Round, might overflow to inf, this is OK 558 | } 559 | } 560 | 561 | o.Sign = f.Sign; 562 | return o.u; 563 | #endif 564 | } 565 | 566 | CMP_STATIC CGU_UINT32 cmp_float2halfui(CGU_FLOAT f) 567 | { 568 | CGU_UINT32 Result; 569 | 570 | CGU_UINT32 IValue = CGU_UINT32(f); 571 | CGU_UINT32 Sign = (IValue & 0x80000000U) >> 16U; 572 | IValue = IValue & 0x7FFFFFFFU; 573 | 574 | if (IValue > 0x47FFEFFFU) 575 | { 576 | // The number is too large to be represented as a half. Saturate to infinity. 577 | Result = 0x7FFFU; 578 | } 579 | else 580 | { 581 | if (IValue < 0x38800000U) 582 | { 583 | // The number is too small to be represented as a normalized half. 584 | // Convert it to a denormalized value. 585 | CGU_UINT32 Shift = 113U - (IValue >> 23U); 586 | IValue = (0x800000U | (IValue & 0x7FFFFFU)) >> Shift; 587 | } 588 | else 589 | { 590 | // Rebias the exponent to represent the value as a normalized half. 591 | IValue += 0xC8000000U; 592 | } 593 | 594 | Result = ((IValue + 0x0FFFU + ((IValue >> 13U) & 1U)) >> 13U) & 0x7FFFU; 595 | } 596 | return (Result | Sign); 597 | } 598 | 599 | CMP_STATIC CGU_Vec3ui cmp_float2half(CGU_Vec3f endPoint_f) 600 | { 601 | return CGU_Vec3ui(cmp_float2halfui(endPoint_f.x), cmp_float2halfui(endPoint_f.y), cmp_float2halfui(endPoint_f.z)); 602 | } 603 | 604 | CMP_STATIC CGU_UINT32 cmp_float2half1(CGU_FLOAT f) 605 | { 606 | CGU_UINT32 Result; 607 | 608 | CGU_UINT32 IValue = CGU_UINT32(f); //asuint(f); 609 | CGU_UINT32 Sign = (IValue & 0x80000000U) >> 16U; 610 | IValue = IValue & 0x7FFFFFFFU; 611 | 612 | if (IValue > 0x47FFEFFFU) 613 | { 614 | // The number is too large to be represented as a half. Saturate to infinity. 615 | Result = 0x7FFFU; 616 | } 617 | else 618 | { 619 | if (IValue < 0x38800000U) 620 | { 621 | // The number is too small to be represented as a normalized half. 622 | // Convert it to a denormalized value. 623 | CGU_UINT32 Shift = 113U - (IValue >> 23U); 624 | IValue = (0x800000U | (IValue & 0x7FFFFFU)) >> Shift; 625 | } 626 | else 627 | { 628 | // Rebias the exponent to represent the value as a normalized half. 629 | IValue += 0xC8000000U; 630 | } 631 | 632 | Result = ((IValue + 0x0FFFU + ((IValue >> 13U) & 1U)) >> 13U) & 0x7FFFU; 633 | } 634 | return (Result | Sign); 635 | } 636 | 637 | CMP_STATIC CGU_Vec3ui cmp_float2halfVec3(CGU_Vec3f endPoint_f) 638 | { 639 | return CGU_Vec3ui(cmp_float2half1(endPoint_f.x), cmp_float2half1(endPoint_f.y), cmp_float2half1(endPoint_f.z)); 640 | } 641 | 642 | CMP_STATIC CGU_FLOAT cmp_f32tof16(CMP_IN CGU_FLOAT value) 643 | { 644 | #ifdef ASPM_GLSL 645 | return packHalf2x16(CGU_Vec2f(value.x, 0.0)); 646 | #endif 647 | #ifdef ASPM_HLSL 648 | return f32tof16(value); 649 | #endif 650 | #ifndef ASPM_GPU 651 | return FloatToHalf(value); 652 | #endif 653 | } 654 | 655 | CMP_STATIC CGU_Vec3f cmp_f32tof16(CMP_IN CGU_Vec3f value) 656 | { 657 | #ifdef ASPM_GLSL 658 | return CGU_Vec3f(packHalf2x16(CGU_Vec2f(value.x, 0.0)), packHalf2x16(CGU_Vec2f(value.y, 0.0)), packHalf2x16(CGU_Vec2f(value.z, 0.0))); 659 | #endif 660 | #ifdef ASPM_HLSL 661 | return f32tof16(value); 662 | #endif 663 | #ifndef ASPM_GPU 664 | CGU_Vec3f res; 665 | res.x = FloatToHalf(value.x); 666 | res.y = FloatToHalf(value.y); 667 | res.z = FloatToHalf(value.z); 668 | return res; 669 | #endif 670 | } 671 | 672 | CMP_STATIC CGU_FLOAT cmp_f16tof32(CGU_UINT32 value) 673 | { 674 | #ifdef ASPM_GLSL 675 | return unpackHalf2x16(value).x; 676 | #endif 677 | #ifdef ASPM_HLSL 678 | return f16tof32(value); 679 | #endif 680 | #ifndef ASPM_GPU 681 | return HalfToFloat(value); 682 | #endif 683 | } 684 | 685 | CMP_STATIC CGU_Vec3f cmp_f16tof32(CGU_Vec3ui value) 686 | { 687 | #ifdef ASPM_GLSL 688 | return CGU_Vec3f(unpackHalf2x16(value.x).x, unpackHalf2x16(value.y).x, unpackHalf2x16(value.z).x); 689 | #endif 690 | #ifdef ASPM_HLSL 691 | return f16tof32(value); 692 | #endif 693 | #ifndef ASPM_GPU 694 | CGU_Vec3f res; 695 | res.x = HalfToFloat(value.x); 696 | res.y = HalfToFloat(value.y); 697 | res.z = HalfToFloat(value.z); 698 | return res; 699 | #endif 700 | } 701 | 702 | CMP_STATIC CGU_Vec3f cmp_f16tof32(CGU_Vec3f value) 703 | { 704 | #ifdef ASPM_GLSL 705 | return CGU_Vec3f(unpackHalf2x16(value.x).x, unpackHalf2x16(value.y).x, unpackHalf2x16(value.z).x); 706 | #endif 707 | #ifdef ASPM_HLSL 708 | return f16tof32(value); 709 | #endif 710 | #ifndef ASPM_GPU 711 | CGU_Vec3f res; 712 | res.x = HalfToFloat((CGU_UINT32)value.x); 713 | res.y = HalfToFloat((CGU_UINT32)value.y); 714 | res.z = HalfToFloat((CGU_UINT32)value.z); 715 | return res; 716 | #endif 717 | } 718 | 719 | CMP_STATIC void cmp_swap(CMP_INOUT CGU_Vec3f CMP_REFINOUT a, CMP_INOUT CGU_Vec3f CMP_REFINOUT b) 720 | { 721 | CGU_Vec3f tmp = a; 722 | a = b; 723 | b = tmp; 724 | } 725 | 726 | CMP_STATIC void cmp_swap(CMP_INOUT CGU_FLOAT CMP_REFINOUT a, CMP_INOUT CGU_FLOAT CMP_REFINOUT b) 727 | { 728 | CGU_FLOAT tmp = a; 729 | a = b; 730 | b = tmp; 731 | } 732 | 733 | CMP_STATIC void cmp_swap(CMP_INOUT CGU_Vec3i CMP_REFINOUT lhs, CMP_INOUT CGU_Vec3i CMP_REFINOUT rhs) // valided with msc code 734 | { 735 | CGU_Vec3i tmp = lhs; 736 | lhs = rhs; 737 | rhs = tmp; 738 | } 739 | 740 | CMP_STATIC CGU_INT cmp_dotVec2i(CMP_IN CGU_Vec2i value1, CMP_IN CGU_Vec2i value2) 741 | { 742 | #ifdef ASPM_GPU 743 | return dot(value1, value2); 744 | #else 745 | return (value1.x * value2.x) + (value1.y * value2.y); 746 | #endif 747 | } 748 | 749 | CMP_STATIC CGU_FLOAT cmp_dotVec3f(CMP_IN CGU_Vec3f value1, CMP_IN CGU_Vec3f value2) 750 | { 751 | #ifdef ASPM_GPU 752 | return dot(value1, value2); 753 | #else 754 | return (value1.x * value2.x) + (value1.y * value2.y) + (value1.z * value2.z); 755 | #endif 756 | } 757 | 758 | CMP_STATIC CGU_UINT32 cmp_dotVec3ui(CMP_IN CGU_Vec3ui value1, CMP_IN CGU_Vec3ui value2) 759 | { 760 | #ifdef ASPM_GPU 761 | return dot(value1, value2); 762 | #else 763 | return (value1.x * value2.x) + (value1.y * value2.y) + (value1.z * value2.z); 764 | #endif 765 | } 766 | 767 | CMP_STATIC CGU_UINT32 cmp_dotVec4i(CMP_IN CGU_Vec4i value1, CMP_IN CGU_Vec4i value2) 768 | { 769 | #ifdef ASPM_GPU 770 | return dot(value1, value2); 771 | #else 772 | return (value1.x * value2.x) + (value1.y * value2.y) + (value1.z * value2.z) + (value1.w * value2.w); 773 | #endif 774 | } 775 | 776 | CMP_STATIC CGU_UINT32 cmp_dotVec4ui(CMP_IN CGU_Vec4ui value1, CMP_IN CGU_Vec4ui value2) 777 | { 778 | #ifdef ASPM_GPU 779 | return dot(value1, value2); 780 | #else 781 | return (value1.x * value2.x) + (value1.y * value2.y) + (value1.z * value2.z) + (value1.w * value2.w); 782 | #endif 783 | } 784 | 785 | CMP_STATIC CGU_Vec3f cmp_clampVec3fi(CMP_IN CGU_Vec3f value, CMP_IN CGU_INT minValue, CMP_IN CGU_INT maxValue) 786 | { 787 | #ifdef ASPM_GPU 788 | return clamp(value, minValue, maxValue); 789 | #else 790 | CGU_Vec3f revalue; 791 | revalue.x = cmp_clampf(value.x, (CGU_FLOAT)minValue, (CGU_FLOAT)maxValue); 792 | revalue.y = cmp_clampf(value.y, (CGU_FLOAT)minValue, (CGU_FLOAT)maxValue); 793 | revalue.z = cmp_clampf(value.z, (CGU_FLOAT)minValue, (CGU_FLOAT)maxValue); 794 | return revalue; 795 | #endif 796 | } 797 | 798 | CMP_STATIC CGU_Vec4ui cmp_clampVec4ui(CMP_IN CGU_Vec4ui value, CMP_IN CGU_UINT32 minValue, CMP_IN CGU_UINT32 maxValue) 799 | { 800 | #ifdef ASPM_GPU 801 | return clamp(value, minValue, maxValue); 802 | #else 803 | CGU_Vec4ui revalue; 804 | revalue.x = cmp_clampui32(value.x, minValue, maxValue); 805 | revalue.y = cmp_clampui32(value.y, minValue, maxValue); 806 | revalue.z = cmp_clampui32(value.z, minValue, maxValue); 807 | revalue.w = cmp_clampui32(value.w, minValue, maxValue); 808 | return revalue; 809 | #endif 810 | } 811 | 812 | CMP_STATIC CGU_Vec4f cmp_clampVec4f(CMP_IN CGU_Vec4f value, CMP_IN CGU_FLOAT minValue, CMP_IN CGU_FLOAT maxValue) 813 | { 814 | #ifdef ASPM_GPU 815 | return clamp(value, minValue, maxValue); 816 | #else 817 | CGU_Vec4f revalue; 818 | revalue.x = cmp_clampf(value.x, minValue, maxValue); 819 | revalue.y = cmp_clampf(value.y, minValue, maxValue); 820 | revalue.z = cmp_clampf(value.z, minValue, maxValue); 821 | revalue.w = cmp_clampf(value.w, minValue, maxValue); 822 | return revalue; 823 | #endif 824 | } 825 | 826 | CMP_STATIC CGU_Vec3f cmp_clamp3Vec3f(CMP_IN CGU_Vec3f value, CMP_IN CGU_Vec3f minValue, CMP_IN CGU_Vec3f maxValue) 827 | { 828 | #ifdef ASPM_GPU 829 | return clamp(value, minValue, maxValue); 830 | #else 831 | CGU_Vec3f revalue; 832 | revalue.x = cmp_clampf(value.x, minValue.x, maxValue.x); 833 | revalue.y = cmp_clampf(value.y, minValue.y, maxValue.y); 834 | revalue.z = cmp_clampf(value.z, minValue.z, maxValue.z); 835 | return revalue; 836 | #endif 837 | } 838 | 839 | CMP_STATIC CGU_Vec3f cmp_exp2(CMP_IN CGU_Vec3f value) 840 | { 841 | #ifdef ASPM_GPU 842 | return exp2(value); 843 | #else 844 | CGU_Vec3f revalue; 845 | revalue.x = exp2(value.x); 846 | revalue.y = exp2(value.y); 847 | revalue.z = exp2(value.z); 848 | return revalue; 849 | #endif 850 | } 851 | 852 | 853 | CMP_STATIC CGU_Vec3f cmp_roundVec3f(CMP_IN CGU_Vec3f value) 854 | { 855 | #ifdef ASPM_HLSL 856 | return round(value); 857 | #endif 858 | #ifndef ASPM_HLSL 859 | CGU_Vec3f res; 860 | res.x = round(value.x); 861 | res.y = round(value.y); 862 | res.z = round(value.z); 863 | return res; 864 | #endif 865 | } 866 | 867 | CMP_STATIC CGU_Vec3f cmp_log2Vec3f(CMP_IN CGU_Vec3f value) 868 | { 869 | #ifdef ASPM_GPU 870 | return log2(value); 871 | #else 872 | CGU_Vec3f res; 873 | res.x = log2(value.x); 874 | res.y = log2(value.y); 875 | res.z = log2(value.z); 876 | return res; 877 | #endif 878 | } 879 | 880 | // used in BC1 LowQuality code 881 | CMP_STATIC CGU_FLOAT cmp_saturate(CMP_IN CGU_FLOAT value) 882 | { 883 | #ifdef ASPM_HLSL 884 | return saturate(value); 885 | #else 886 | return cmp_clampf(value, 0.0f, 1.0f); 887 | #endif 888 | } 889 | 890 | CMP_STATIC CGU_FLOAT cmp_rcp(CMP_IN CGU_FLOAT det) 891 | { 892 | #ifdef ASPM_HLSL 893 | return rcp(det); 894 | #else 895 | if (det > 0.0f) 896 | return (1 / det); 897 | else 898 | return 0.0f; 899 | #endif 900 | } 901 | 902 | CMP_STATIC CGU_UINT32 cmp_Get4BitIndexPos(CMP_IN CGU_FLOAT indexPos, CMP_IN CGU_FLOAT endPoint0Pos, CMP_IN CGU_FLOAT endPoint1Pos) 903 | { 904 | CGU_FLOAT r = (indexPos - endPoint0Pos) / (endPoint1Pos - endPoint0Pos); 905 | return cmp_clampui32(CGU_UINT32(r * 14.93333f + 0.03333f + 0.5f), 0, 15); 906 | } 907 | 908 | // Calculate Mean Square Least Error (MSLE) for 2 Vectors 909 | CMP_STATIC CGU_FLOAT cmp_CalcMSLE(CMP_IN CGU_Vec3f a, CMP_IN CGU_Vec3f b) 910 | { 911 | CGU_Vec3f err = cmp_log2Vec3f((b + 1.0f) / (a + 1.0f)); 912 | err = err * err; 913 | return err.x + err.y + err.z; 914 | } 915 | 916 | 917 | 918 | // Compute Endpoints (min/max) bounding box 919 | CMP_STATIC void cmp_GetTexelMinMax(CMP_IN CGU_Vec3f texels[16], CMP_INOUT CGU_Vec3f CMP_REFINOUT blockMin, CMP_INOUT CGU_Vec3f CMP_REFINOUT blockMax) 920 | { 921 | blockMin = texels[0]; 922 | blockMax = texels[0]; 923 | for (CGU_UINT32 i = 1u; i < 16u; ++i) 924 | { 925 | blockMin = cmp_minVec3f(blockMin, texels[i]); 926 | blockMax = cmp_maxVec3f(blockMax, texels[i]); 927 | } 928 | } 929 | 930 | // Refine Endpoints (min/max) by insetting bounding box in log2 RGB space 931 | CMP_STATIC void cmp_RefineMinMaxAsLog2(CMP_IN CGU_Vec3f texels[16], CMP_INOUT CGU_Vec3f CMP_REFINOUT blockMin, CMP_INOUT CGU_Vec3f CMP_REFINOUT blockMax) 932 | { 933 | CGU_Vec3f refinedBlockMin = blockMax; 934 | CGU_Vec3f refinedBlockMax = blockMin; 935 | for (CGU_UINT32 i = 0u; i < 16u; ++i) 936 | { 937 | refinedBlockMin = cmp_minVec3f(refinedBlockMin, texels[i] == blockMin ? refinedBlockMin : texels[i]); 938 | refinedBlockMax = cmp_maxVec3f(refinedBlockMax, texels[i] == blockMax ? refinedBlockMax : texels[i]); 939 | } 940 | 941 | CGU_Vec3f logBlockMax = cmp_log2Vec3f(blockMax + 1.0f); 942 | CGU_Vec3f logBlockMin = cmp_log2Vec3f(blockMin + 1.0f); 943 | 944 | CGU_Vec3f logRefinedBlockMax = cmp_log2Vec3f(refinedBlockMax + 1.0f); 945 | CGU_Vec3f logRefinedBlockMin = cmp_log2Vec3f(refinedBlockMin + 1.0f); 946 | CGU_Vec3f logBlockMaxExt = (logBlockMax - logBlockMin) * (1.0f / 32.0f); 947 | 948 | logBlockMin += cmp_minVec3f(logRefinedBlockMin - logBlockMin, logBlockMaxExt); 949 | logBlockMax -= cmp_minVec3f(logBlockMax - logRefinedBlockMax, logBlockMaxExt); 950 | 951 | blockMin = cmp_exp2(logBlockMin) - 1.0f; 952 | blockMax = cmp_exp2(logBlockMax) - 1.0f; 953 | } 954 | 955 | // Refine Endpoints (min/max) by Least Squares Optimization 956 | CMP_STATIC void cmp_RefineMinMaxAs16BitLeastSquares(CMP_IN CGU_Vec3f texels[16], 957 | CMP_INOUT CGU_Vec3f CMP_REFINOUT blockMin, 958 | CMP_INOUT CGU_Vec3f CMP_REFINOUT blockMax) 959 | { 960 | CGU_Vec3f blockDir = blockMax - blockMin; 961 | blockDir = blockDir / (blockDir.x + blockDir.y + blockDir.z); 962 | 963 | CGU_FLOAT endPoint0Pos = cmp_f32tof16(cmp_dotVec3f(blockMin, blockDir)); 964 | CGU_FLOAT endPoint1Pos = cmp_f32tof16(cmp_dotVec3f(blockMax, blockDir)); 965 | 966 | CGU_Vec3f alphaTexelSum = 0.0f; 967 | CGU_Vec3f betaTexelSum = 0.0f; 968 | CGU_FLOAT alphaBetaSum = 0.0f; 969 | CGU_FLOAT alphaSqSum = 0.0f; 970 | CGU_FLOAT betaSqSum = 0.0f; 971 | 972 | for (CGU_UINT32 i = 0; i < 16; i++) 973 | { 974 | CGU_FLOAT texelPos = cmp_f32tof16(cmp_dotVec3f(texels[i], blockDir)); 975 | CGU_UINT32 texelIndex = cmp_Get4BitIndexPos(texelPos, endPoint0Pos, endPoint1Pos); 976 | 977 | CGU_FLOAT beta = cmp_saturate(texelIndex / 15.0f); 978 | CGU_FLOAT alpha = 1.0f - beta; 979 | 980 | CGU_Vec3f texelF16; 981 | texelF16.x = cmp_f32tof16(texels[i].x); 982 | texelF16.y = cmp_f32tof16(texels[i].y); 983 | texelF16.z = cmp_f32tof16(texels[i].z); 984 | 985 | alphaTexelSum += texelF16 * alpha; 986 | betaTexelSum += texelF16 * beta; 987 | 988 | alphaBetaSum += alpha * beta; 989 | 990 | alphaSqSum += alpha * alpha; 991 | betaSqSum += beta * beta; 992 | } 993 | 994 | CGU_FLOAT det = alphaSqSum * betaSqSum - alphaBetaSum * alphaBetaSum; 995 | 996 | if (abs(det) > 0.00001f) 997 | { 998 | CGU_FLOAT detRcp = cmp_rcp(det); 999 | blockMin = cmp_clampVec3f((alphaTexelSum * betaSqSum - betaTexelSum * alphaBetaSum) * detRcp, 0.0f, CMP_MAX_16BITFLOAT); 1000 | blockMax = cmp_clampVec3f((betaTexelSum * alphaSqSum - alphaTexelSum * alphaBetaSum) * detRcp, 0.0f, CMP_MAX_16BITFLOAT); 1001 | blockMin = cmp_f16tof32(blockMin); 1002 | blockMax = cmp_f16tof32(blockMax); 1003 | } 1004 | } 1005 | 1006 | //============================================================================================= 1007 | 1008 | CMP_STATIC CGU_Vec3f cmp_fabsVec3f(CGU_Vec3f value) 1009 | { 1010 | #ifdef ASPM_HLSL 1011 | return abs(value); 1012 | #else 1013 | CGU_Vec3f res; 1014 | res.x = abs(value.x); 1015 | res.y = abs(value.y); 1016 | res.z = abs(value.z); 1017 | return res; 1018 | #endif 1019 | } 1020 | 1021 | 1022 | CMP_STATIC CGU_UINT32 cmp_constructColor(CMP_IN CGU_Vec3ui EndPoints) 1023 | { 1024 | return (((EndPoints.r & 0x000000F8) << 8) | ((EndPoints.g & 0x000000FC) << 3) | ((EndPoints.b & 0x000000F8) >> 3)); 1025 | } 1026 | 1027 | CMP_STATIC CGU_UINT32 cmp_constructColorBGR(CMP_IN CGU_Vec3f EndPoints) 1028 | { 1029 | return (((CGU_UINT32(EndPoints.b) & 0x000000F8) << 8) | ((CGU_UINT32(EndPoints.g) & 0x000000FC) << 3) | ((CGU_UINT32(EndPoints.r) & 0x000000F8) >> 3)); 1030 | } 1031 | 1032 | CMP_STATIC CGU_FLOAT cmp_mod(CMP_IN CGU_FLOAT value, CMP_IN CGU_FLOAT modval) 1033 | { 1034 | #ifdef ASPM_GLSL 1035 | return mod(value, modval); 1036 | #endif 1037 | return fmod(value, modval); 1038 | } 1039 | 1040 | CMP_STATIC CGU_Vec3f cmp_truncVec3f(CMP_IN CGU_Vec3f value) 1041 | { 1042 | #ifdef ASPM_HLSL 1043 | return trunc(value); 1044 | #else 1045 | CGU_Vec3f res; 1046 | res.x = trunc(value.x); 1047 | res.y = trunc(value.y); 1048 | res.z = trunc(value.z); 1049 | return res; 1050 | #endif 1051 | } 1052 | 1053 | CMP_STATIC CGU_Vec3f cmp_ceilVec3f(CMP_IN CGU_Vec3f value) 1054 | { 1055 | CGU_Vec3f res; 1056 | res.x = ceil(value.x); 1057 | res.y = ceil(value.y); 1058 | res.z = ceil(value.z); 1059 | return res; 1060 | } 1061 | 1062 | CMP_STATIC CGU_FLOAT cmp_sqrt(CGU_FLOAT value) 1063 | { 1064 | return sqrt(value); 1065 | } 1066 | 1067 | // Computes inverse square root over an implementation-defined range. The maximum error is implementation-defined. 1068 | CMP_STATIC CGV_FLOAT cmp_rsqrt(CGV_FLOAT f) 1069 | { 1070 | CGV_FLOAT sf = sqrt(f); 1071 | if (sf != 0) 1072 | return 1 / sqrt(f); 1073 | else 1074 | return 0.0f; 1075 | } 1076 | 1077 | // Common to BC7 API ------------------------------------------------------------------------------------------------------------------------ 1078 | 1079 | // valid bit range is 0..8 for mode 1 1080 | CMP_STATIC INLINE CGU_UINT32 cmp_shift_right_uint32(CMP_IN CGU_UINT32 v, CMP_IN CGU_INT bits) 1081 | { 1082 | return v >> bits; // (perf warning expected) 1083 | } 1084 | 1085 | CMP_STATIC INLINE CGU_INT cmp_clampi(CMP_IN CGU_INT value, CMP_IN CGU_INT low, CMP_IN CGU_INT high) 1086 | { 1087 | if (value < low) 1088 | return low; 1089 | else if (value > high) 1090 | return high; 1091 | return value; 1092 | } 1093 | 1094 | CMP_STATIC INLINE CGU_INT32 cmp_clampi32(CMP_IN CGU_INT32 value, CMP_IN CGU_INT32 low, CMP_IN CGU_INT32 high) 1095 | { 1096 | if (value < low) 1097 | value = low; 1098 | else if (value > high) 1099 | value = high; 1100 | return value; 1101 | } 1102 | 1103 | CMP_STATIC CGV_FLOAT cmp_dot4f(CMP_IN CGV_Vec4f value1, CMP_IN CGV_Vec4f value2) 1104 | { 1105 | #ifdef ASPM_GPU 1106 | return dot(value1, value2); 1107 | #else 1108 | return (value1.x * value2.x) + (value1.y * value2.y) + (value1.z * value2.z) + (value1.w * value2.w); 1109 | #endif 1110 | } 1111 | 1112 | CMP_STATIC INLINE void cmp_set_vec4f(CMP_INOUT CGU_Vec4f CMP_REFINOUT pV, CMP_IN CGU_FLOAT x, CMP_IN CGU_FLOAT y, CMP_IN CGU_FLOAT z, CMP_IN CGU_FLOAT w) 1113 | { 1114 | pV[0] = x; 1115 | pV[1] = y; 1116 | pV[2] = z; 1117 | pV[3] = w; 1118 | } 1119 | 1120 | CMP_STATIC INLINE void cmp_set_vec4ui(CGU_Vec4ui CMP_REFINOUT pV, CMP_IN CGU_UINT8 x, CMP_IN CGU_UINT8 y, CMP_IN CGU_UINT8 z, CMP_IN CGU_UINT8 w) 1121 | { 1122 | pV[0] = x; 1123 | pV[1] = y; 1124 | pV[2] = z; 1125 | pV[3] = w; 1126 | } 1127 | 1128 | CMP_STATIC inline void cmp_set_vec4ui_clamped(CGU_Vec4ui CMP_REFINOUT pRes, CMP_IN CGU_INT32 r, CMP_IN CGU_INT32 g, CMP_IN CGU_INT32 b, CMP_IN CGU_INT32 a) 1129 | { 1130 | pRes[0] = (CGU_UINT8)cmp_clampi32(r, 0, 255); 1131 | pRes[1] = (CGU_UINT8)cmp_clampi32(g, 0, 255); 1132 | pRes[2] = (CGU_UINT8)cmp_clampi32(b, 0, 255); 1133 | pRes[3] = (CGU_UINT8)cmp_clampi32(a, 0, 255); 1134 | } 1135 | 1136 | CMP_STATIC inline CGU_Vec4f cmp_clampNorm4f(CMP_IN CGU_Vec4f pV) 1137 | { 1138 | CGU_Vec4f res; 1139 | res[0] = cmp_clampf(pV[0], 0.0f, 1.0f); 1140 | res[1] = cmp_clampf(pV[1], 0.0f, 1.0f); 1141 | res[2] = cmp_clampf(pV[2], 0.0f, 1.0f); 1142 | res[3] = cmp_clampf(pV[3], 0.0f, 1.0f); 1143 | return res; 1144 | } 1145 | 1146 | CMP_STATIC INLINE CGU_Vec4f cmp_vec4ui_to_vec4f(CMP_IN CGU_Vec4ui pC) 1147 | { 1148 | CGU_Vec4f res; 1149 | cmp_set_vec4f(res, (CGU_FLOAT)pC[0], (CGU_FLOAT)pC[1], (CGU_FLOAT)pC[2], (CGU_FLOAT)pC[3]); 1150 | return res; 1151 | } 1152 | 1153 | CMP_STATIC INLINE void cmp_normalize(CGU_Vec4f CMP_REFINOUT pV) 1154 | { 1155 | CGU_FLOAT s = cmp_dot4f(pV, pV); 1156 | if (s != 0.0f) 1157 | { 1158 | s = 1.0f / cmp_sqrt(s); 1159 | pV *= s; 1160 | } 1161 | } 1162 | 1163 | CMP_STATIC INLINE CGV_FLOAT cmp_squaref(CMP_IN CGV_FLOAT v) 1164 | { 1165 | return v * v; 1166 | } 1167 | 1168 | CMP_STATIC INLINE CGU_INT cmp_squarei(CMP_IN CGU_INT i) 1169 | { 1170 | return i * i; 1171 | } 1172 | 1173 | CMP_STATIC CGU_UINT8 cmp_clampui8(CMP_IN CGU_UINT8 v, CMP_IN CGU_UINT8 a, CMP_IN CGU_UINT8 b) 1174 | { 1175 | if (v < a) 1176 | return a; 1177 | else if (v > b) 1178 | return b; 1179 | return v; 1180 | } 1181 | 1182 | CMP_STATIC CGU_INT32 cmp_abs32(CMP_IN CGU_INT32 v) 1183 | { 1184 | CGU_UINT32 msk = v >> 31; 1185 | return (v ^ msk) - msk; 1186 | } 1187 | 1188 | CMP_STATIC void cmp_swap32(CMP_INOUT CGU_UINT32 CMP_REFINOUT a, CMP_INOUT CGU_UINT32 CMP_REFINOUT b) 1189 | { 1190 | CGU_UINT32 t = a; 1191 | a = b; 1192 | b = t; 1193 | } 1194 | 1195 | // Computes inverse square root over an implementation-defined range. The maximum error is implementation-defined. 1196 | CMP_STATIC CGV_FLOAT cmp_Image_rsqrt(CMP_IN CGV_FLOAT f) 1197 | { 1198 | CGV_FLOAT sf = sqrt(f); 1199 | if (sf != 0) 1200 | return 1 / sqrt(f); 1201 | else 1202 | return 0.0f; 1203 | } 1204 | 1205 | CMP_STATIC void cmp_pack4bitindex32(CMP_INOUT CGU_UINT32 packed_index[2], CMP_IN CGU_UINT32 src_index[16]) 1206 | { 1207 | // Converts from unpacked index to packed index 1208 | packed_index[0] = 0x0000; 1209 | packed_index[1] = 0x0000; 1210 | CGU_UINT32 shift = 0; // was CGU_UINT8 1211 | for (CGU_INT k = 0; k < 8; k++) 1212 | { 1213 | packed_index[0] |= (CGU_UINT32)(src_index[k] & 0x0F) << shift; 1214 | packed_index[1] |= (CGU_UINT32)(src_index[k + 8] & 0x0F) << shift; 1215 | shift += 4; 1216 | } 1217 | } 1218 | 1219 | CMP_STATIC void cmp_pack4bitindex(CMP_INOUT CGU_UINT32 packed_index[2], CMP_IN CGU_UINT8 src_index[16]) 1220 | { 1221 | // Converts from unpacked index to packed index 1222 | packed_index[0] = 0x0000; 1223 | packed_index[1] = 0x0000; 1224 | CGU_UINT32 shift = 0; // was CGU_UINT8 1225 | for (CGU_INT k = 0; k < 8; k++) 1226 | { 1227 | packed_index[0] |= (CGU_UINT32)(src_index[k] & 0x0F) << shift; 1228 | packed_index[1] |= (CGU_UINT32)(src_index[k + 8] & 0x0F) << shift; 1229 | shift += 4; 1230 | } 1231 | } 1232 | 1233 | CMP_STATIC INLINE CGU_INT cmp_expandbits(CMP_IN CGU_INT v, CMP_IN CGU_INT bits) 1234 | { 1235 | CGU_INT vv = v << (8 - bits); 1236 | return vv + cmp_shift_right_uint32(vv, bits); 1237 | } 1238 | 1239 | // This code need further improvements and investigation 1240 | CMP_STATIC INLINE CGU_UINT8 cmp_ep_find_floor2(CMP_IN CGV_FLOAT v, CMP_IN CGU_UINT8 bits, CMP_IN CGU_UINT8 use_par, CMP_IN CGU_UINT8 odd) 1241 | { 1242 | CGU_UINT8 i1 = 0; 1243 | CGU_UINT8 i2 = 1 << (bits - use_par); 1244 | odd = use_par ? odd : 0; 1245 | while (i2 - i1 > 1) 1246 | { 1247 | CGU_UINT8 j = (CGU_UINT8)((i1 + i2) * 0.5f); 1248 | CGV_FLOAT ep_d = (CGV_FLOAT)cmp_expandbits((j << use_par) + odd, bits); 1249 | if (v >= ep_d) 1250 | i1 = j; 1251 | else 1252 | i2 = j; 1253 | } 1254 | 1255 | return (i1 << use_par) + odd; 1256 | } 1257 | 1258 | CMP_STATIC CGV_FLOAT cmp_absf(CMP_IN CGV_FLOAT a) 1259 | { 1260 | return a > 0.0F ? a : -a; 1261 | } 1262 | 1263 | CMP_STATIC INLINE CGU_UINT32 cmp_pow2Packed(CMP_IN CGU_INT x) 1264 | { 1265 | return 1 << x; 1266 | } 1267 | 1268 | CMP_STATIC INLINE CGU_UINT8 cmp_clampIndex(CMP_IN CGU_UINT8 v, CMP_IN CGU_UINT8 a, CMP_IN CGU_UINT8 b) 1269 | { 1270 | if (v < a) 1271 | return a; 1272 | else if (v > b) 1273 | return b; 1274 | return v; 1275 | } 1276 | 1277 | CMP_STATIC INLINE CGU_UINT8 shift_right_uint82(CMP_IN CGU_UINT8 v, CMP_IN CGU_UINT8 bits) 1278 | { 1279 | return v >> bits; // (perf warning expected) 1280 | } 1281 | 1282 | #endif 1283 | 1284 | CMP_STATIC CGU_INT cmp_QuantizeToBitSize(CMP_IN CGU_INT value, CMP_IN CGU_INT prec, CMP_IN CGU_BOOL signedfloat16) 1285 | { 1286 | if (prec <= 1) 1287 | return 0; 1288 | CGU_BOOL negvalue = false; 1289 | 1290 | // move data to use extra bits for processing 1291 | CGU_INT ivalue = value; 1292 | 1293 | if (signedfloat16) 1294 | { 1295 | if (value < 0) 1296 | { 1297 | negvalue = true; 1298 | value = -value; 1299 | } 1300 | prec--; 1301 | } 1302 | else 1303 | { 1304 | // clamp -ve 1305 | if (value < 0) 1306 | value = 0; 1307 | } 1308 | 1309 | CGU_INT iQuantized; 1310 | CGU_INT bias = (prec > 10 && prec != 16) ? ((1 << (prec - 11)) - 1) : 0; 1311 | bias = (prec == 16) ? 15 : bias; 1312 | 1313 | iQuantized = ((ivalue << prec) + bias) / (0x7bff + 1); // 16 bit Float Max 0x7bff 1314 | 1315 | return (negvalue ? -iQuantized : iQuantized); 1316 | } 1317 | 1318 | //======================================================= 1319 | // CPU GPU Macro API 1320 | //======================================================= 1321 | 1322 | #ifdef ASPM_GPU 1323 | #define cmp_min(a, b) min(a, b) 1324 | #define cmp_max(a, b) max(a, b) 1325 | #else 1326 | #ifndef cmp_min 1327 | #define cmp_min(a, b) ((a) < (b) ? (a) : (b)) 1328 | #endif 1329 | #ifndef cmp_max 1330 | #define cmp_max(a, b) ((a) > (b) ? (a) : (b)) 1331 | #endif 1332 | #endif 1333 | 1334 | //======================================================= 1335 | // CPU Template API 1336 | //======================================================= 1337 | 1338 | #ifndef ASPM_GPU 1339 | #ifndef TEMPLATE_API_INTERFACED 1340 | #define TEMPLATE_API_INTERFACED 1341 | 1342 | template 1343 | T clamp(T& v, const T& lo, const T& hi) 1344 | { 1345 | if (v < lo) 1346 | return lo; 1347 | else if (v > hi) 1348 | return hi; 1349 | return v; 1350 | } 1351 | 1352 | template 1353 | Vec4T clamp(Vec4T& v, const T& lo, const T& hi) 1354 | { 1355 | Vec4T res = v; 1356 | if (v.x < lo) 1357 | res.x = lo; 1358 | else if (v.x > hi) 1359 | res.x = hi; 1360 | if (v.y < lo) 1361 | res.y = lo; 1362 | else if (v.y > hi) 1363 | res.y = hi; 1364 | if (v.z < lo) 1365 | res.z = lo; 1366 | else if (v.w > hi) 1367 | res.w = hi; 1368 | if (v.w < lo) 1369 | res.w = lo; 1370 | else if (v.z > hi) 1371 | res.z = hi; 1372 | return res; 1373 | } 1374 | 1375 | 1376 | template 1377 | T dot(T& v1, T2& v2) 1378 | { 1379 | return (v1 * v2); 1380 | } 1381 | 1382 | template 1383 | T dot(Vec4T& v1, Vec4T& v2) 1384 | { 1385 | return (v1.x * v2.x + v1.y * v2.y + v1.z * v2.z + v1.w * v2.w); 1386 | } 1387 | 1388 | template 1389 | T dot(Vec4T& v1, Vec4T& v2) 1390 | { 1391 | return (v1.x * v2.x + v1.y * v2.y + v1.z * v2.z + v1.w * v2.w); 1392 | } 1393 | template 1394 | T dot(Vec3T& v1, Vec3T& v2) 1395 | { 1396 | return (v1.x * v2.x + v1.y * v2.y + v1.z * v2.z); 1397 | } 1398 | 1399 | template 1400 | T dot(Vec3T& v1, Vec3T& v2) 1401 | { 1402 | return (v1.x * v2.x + v1.y * v2.y + v1.z * v2.z); 1403 | } 1404 | 1405 | #endif // API_INTERFACED 1406 | #endif // ASPM_GPU 1407 | 1408 | #endif // 1409 | -------------------------------------------------------------------------------- /Assets/GPUTexCompression/External/AMD_Compressonator/bcn_common_api.h.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 512f3f628e0c14993ba24c1d4014037d 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 1 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | userData: 26 | assetBundleName: 27 | assetBundleVariant: 28 | -------------------------------------------------------------------------------- /Assets/GPUTexCompression/External/AMD_Compressonator/bcn_common_kernel.h.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 78b5e8d08444c4a9683393608716b098 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 1 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | userData: 26 | assetBundleName: 27 | assetBundleVariant: 28 | -------------------------------------------------------------------------------- /Assets/GPUTexCompression/External/AMD_Compressonator/common_def.h.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 27194ad3f83054b59adfc0c8e534b341 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 1 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | userData: 26 | assetBundleName: 27 | assetBundleVariant: 28 | -------------------------------------------------------------------------------- /Assets/GPUTexCompression/External/FastBlockCompress.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 426285cdc7dd9466ea1fce85df5fe7a1 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/GPUTexCompression/External/FastBlockCompress/BlockCompress.hlsli: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // BlockCompress.hlsli 3 | // 4 | // Helper functions for block compression 5 | // 6 | // Advanced Technology Group (ATG) 7 | // Copyright (C) Microsoft Corporation. All rights reserved. 8 | // 9 | //-------------------------------------------------------------------------------------- 10 | 11 | #define BlockCompressRS \ 12 | "RootFlags ( DENY_VERTEX_SHADER_ROOT_ACCESS |" \ 13 | " DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ 14 | " DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ 15 | " DENY_HULL_SHADER_ROOT_ACCESS )," \ 16 | "CBV(b0, visibility=SHADER_VISIBILITY_ALL)," \ 17 | "DescriptorTable(SRV(t0, numDescriptors=1), visibility=SHADER_VISIBILITY_ALL)," \ 18 | "DescriptorTable(UAV(u0, numDescriptors=1), visibility=SHADER_VISIBILITY_ALL)," \ 19 | "DescriptorTable(UAV(u1, numDescriptors=1), visibility=SHADER_VISIBILITY_ALL)," \ 20 | "DescriptorTable(UAV(u2, numDescriptors=1), visibility=SHADER_VISIBILITY_ALL)," \ 21 | "DescriptorTable(UAV(u3, numDescriptors=1), visibility=SHADER_VISIBILITY_ALL)," \ 22 | "DescriptorTable(UAV(u4, numDescriptors=1), visibility=SHADER_VISIBILITY_ALL)," \ 23 | "StaticSampler(s0, " \ 24 | " filter = FILTER_MIN_MAG_MIP_POINT," \ 25 | " addressU = TEXTURE_ADDRESS_CLAMP," \ 26 | " addressV = TEXTURE_ADDRESS_CLAMP," \ 27 | " addressW = TEXTURE_ADDRESS_CLAMP," \ 28 | " visibility = SHADER_VISIBILITY_ALL)" 29 | 30 | #define COMPRESS_ONE_MIP_THREADGROUP_WIDTH 8 31 | #define COMPRESS_TWO_MIPS_THREADGROUP_WIDTH 16 32 | 33 | #define MIP1_BLOCKS_PER_ROW 8 34 | 35 | // Constant buffer for block compression shaders 36 | cbuffer BlockCompressCB : register(b0) 37 | { 38 | float g_oneOverTextureWidth; 39 | } 40 | 41 | // CUSTOMBUILD : warning X4714: sum of temp registers and indexable temp registers times 256 threads exceeds the recommended total 16384. Performance may be reduced 42 | // This warning shows up in Debug mode due to the complexity of the unoptimized shaders, but it's harmless aside from the fact that the shaders will be slow in Debug 43 | #pragma warning(disable: 4714) 44 | 45 | //-------------------------------------------------------------------------------------- 46 | // Name: ColorTo565 47 | // Desc: Pack a 3-component color into a uint 48 | //-------------------------------------------------------------------------------------- 49 | uint ColorTo565(float3 color) 50 | { 51 | uint3 rgb = round(color * float3(31.0f, 63.0f, 31.0f)); 52 | return (rgb.r << 11) | (rgb.g << 5) | rgb.b; 53 | } 54 | 55 | 56 | //-------------------------------------------------------------------------------------- 57 | // Name: TexelToUV 58 | // Desc: Convert from a texel to the UV coordinates used in a Gather call 59 | //-------------------------------------------------------------------------------------- 60 | float2 TexelToUV(float2 texel, float oneOverTextureWidth) 61 | { 62 | // We Gather from the bottom-right corner of the texel 63 | return (texel + 1.0f) * oneOverTextureWidth; 64 | } 65 | 66 | 67 | //-------------------------------------------------------------------------------------- 68 | // Name: LoadTexelsRGB 69 | // Desc: Load the 16 RGB texels that form a block 70 | //-------------------------------------------------------------------------------------- 71 | void LoadTexelsRGB(Texture2D tex, SamplerState samp, float oneOverTextureWidth, uint2 threadIDWithinDispatch, out float3 block[16]) 72 | { 73 | float2 uv = TexelToUV(float2(threadIDWithinDispatch * 4), oneOverTextureWidth); 74 | 75 | float4 red = tex.GatherRed(samp, uv, int2(0, 0)); 76 | float4 green = tex.GatherGreen(samp, uv, int2(0, 0)); 77 | float4 blue = tex.GatherBlue(samp, uv, int2(0, 0)); 78 | block[0] = float3(red[3], green[3], blue[3]); 79 | block[1] = float3(red[2], green[2], blue[2]); 80 | block[4] = float3(red[0], green[0], blue[0]); 81 | block[5] = float3(red[1], green[1], blue[1]); 82 | 83 | red = tex.GatherRed(samp, uv, int2(2, 0)); 84 | green = tex.GatherGreen(samp, uv, int2(2, 0)); 85 | blue = tex.GatherBlue(samp, uv, int2(2, 0)); 86 | block[2] = float3(red[3], green[3], blue[3]); 87 | block[3] = float3(red[2], green[2], blue[2]); 88 | block[6] = float3(red[0], green[0], blue[0]); 89 | block[7] = float3(red[1], green[1], blue[1]); 90 | 91 | red = tex.GatherRed(samp, uv, int2(0, 2)); 92 | green = tex.GatherGreen(samp, uv, int2(0, 2)); 93 | blue = tex.GatherBlue(samp, uv, int2(0, 2)); 94 | block[8] = float3(red[3], green[3], blue[3]); 95 | block[9] = float3(red[2], green[2], blue[2]); 96 | block[12] = float3(red[0], green[0], blue[0]); 97 | block[13] = float3(red[1], green[1], blue[1]); 98 | 99 | red = tex.GatherRed(samp, uv, int2(2, 2)); 100 | green = tex.GatherGreen(samp, uv, int2(2, 2)); 101 | blue = tex.GatherBlue(samp, uv, int2(2, 2)); 102 | block[10] = float3(red[3], green[3], blue[3]); 103 | block[11] = float3(red[2], green[2], blue[2]); 104 | block[14] = float3(red[0], green[0], blue[0]); 105 | block[15] = float3(red[1], green[1], blue[1]); 106 | } 107 | 108 | 109 | //-------------------------------------------------------------------------------------- 110 | // Name: LoadTexelsRGBBias 111 | // Desc: Load the 16 RGB texels that form a block, with a mip bias 112 | //-------------------------------------------------------------------------------------- 113 | void LoadTexelsRGBBias(Texture2D tex, SamplerState samp, float oneOverTextureSize, uint2 threadIDWithinDispatch, uint mipBias, out float3 block[16]) 114 | { 115 | // We need to use Sample rather than Gather/Load for the Bias functions, because low mips will read outside 116 | // the texture boundary. When reading outside the boundary, Gather/Load return 0, but Sample can clamp 117 | float2 location = float2(threadIDWithinDispatch * 4) * oneOverTextureSize; 118 | block[0] = tex.SampleLevel(samp, location, mipBias, int2(0, 0)).rgb; 119 | block[1] = tex.SampleLevel(samp, location, mipBias, int2(1, 0)).rgb; 120 | block[2] = tex.SampleLevel(samp, location, mipBias, int2(2, 0)).rgb; 121 | block[3] = tex.SampleLevel(samp, location, mipBias, int2(3, 0)).rgb; 122 | block[4] = tex.SampleLevel(samp, location, mipBias, int2(0, 1)).rgb; 123 | block[5] = tex.SampleLevel(samp, location, mipBias, int2(1, 1)).rgb; 124 | block[6] = tex.SampleLevel(samp, location, mipBias, int2(2, 1)).rgb; 125 | block[7] = tex.SampleLevel(samp, location, mipBias, int2(3, 1)).rgb; 126 | block[8] = tex.SampleLevel(samp, location, mipBias, int2(0, 2)).rgb; 127 | block[9] = tex.SampleLevel(samp, location, mipBias, int2(1, 2)).rgb; 128 | block[10] = tex.SampleLevel(samp, location, mipBias, int2(2, 2)).rgb; 129 | block[11] = tex.SampleLevel(samp, location, mipBias, int2(3, 2)).rgb; 130 | block[12] = tex.SampleLevel(samp, location, mipBias, int2(0, 3)).rgb; 131 | block[13] = tex.SampleLevel(samp, location, mipBias, int2(1, 3)).rgb; 132 | block[14] = tex.SampleLevel(samp, location, mipBias, int2(2, 3)).rgb; 133 | block[15] = tex.SampleLevel(samp, location, mipBias, int2(3, 3)).rgb; 134 | } 135 | 136 | 137 | //-------------------------------------------------------------------------------------- 138 | // Name: LoadTexelsRGBA 139 | // Desc: Load the 16 RGBA texels that form a block 140 | //-------------------------------------------------------------------------------------- 141 | void LoadTexelsRGBA(Texture2D tex, uint2 threadIDWithinDispatch, out float3 blockRGB[16], out float blockA[16]) 142 | { 143 | float4 rgba; 144 | int3 location = int3(threadIDWithinDispatch * 4, 0); 145 | rgba = tex.Load(location, int2(0, 0)); blockRGB[0] = rgba.rgb; blockA[0] = rgba.a; 146 | rgba = tex.Load(location, int2(1, 0)); blockRGB[1] = rgba.rgb; blockA[1] = rgba.a; 147 | rgba = tex.Load(location, int2(2, 0)); blockRGB[2] = rgba.rgb; blockA[2] = rgba.a; 148 | rgba = tex.Load(location, int2(3, 0)); blockRGB[3] = rgba.rgb; blockA[3] = rgba.a; 149 | rgba = tex.Load(location, int2(0, 1)); blockRGB[4] = rgba.rgb; blockA[4] = rgba.a; 150 | rgba = tex.Load(location, int2(1, 1)); blockRGB[5] = rgba.rgb; blockA[5] = rgba.a; 151 | rgba = tex.Load(location, int2(2, 1)); blockRGB[6] = rgba.rgb; blockA[6] = rgba.a; 152 | rgba = tex.Load(location, int2(3, 1)); blockRGB[7] = rgba.rgb; blockA[7] = rgba.a; 153 | rgba = tex.Load(location, int2(0, 2)); blockRGB[8] = rgba.rgb; blockA[8] = rgba.a; 154 | rgba = tex.Load(location, int2(1, 2)); blockRGB[9] = rgba.rgb; blockA[9] = rgba.a; 155 | rgba = tex.Load(location, int2(2, 2)); blockRGB[10] = rgba.rgb; blockA[10] = rgba.a; 156 | rgba = tex.Load(location, int2(3, 2)); blockRGB[11] = rgba.rgb; blockA[11] = rgba.a; 157 | rgba = tex.Load(location, int2(0, 3)); blockRGB[12] = rgba.rgb; blockA[12] = rgba.a; 158 | rgba = tex.Load(location, int2(1, 3)); blockRGB[13] = rgba.rgb; blockA[13] = rgba.a; 159 | rgba = tex.Load(location, int2(2, 3)); blockRGB[14] = rgba.rgb; blockA[14] = rgba.a; 160 | rgba = tex.Load(location, int2(3, 3)); blockRGB[15] = rgba.rgb; blockA[15] = rgba.a; 161 | } 162 | 163 | 164 | //-------------------------------------------------------------------------------------- 165 | // Name: LoadTexelsRGBABias 166 | // Desc: Load the 16 RGBA texels that form a block, with a mip bias 167 | //-------------------------------------------------------------------------------------- 168 | void LoadTexelsRGBABias(Texture2D tex, SamplerState samp, float oneOverTextureSize, uint2 threadIDWithinDispatch, uint mipBias, out float3 blockRGB[16], out float blockA[16]) 169 | { 170 | // We need to use Sample rather than Gather/Load for the Bias functions, because low mips will read outside 171 | // the texture boundary. When reading outside the boundary, Gather/Load return 0, but Sample will clamp 172 | float4 rgba; 173 | float2 location = float2(threadIDWithinDispatch * 4) * oneOverTextureSize; 174 | rgba = tex.SampleLevel(samp, location, mipBias, int2(0, 0)); blockRGB[0] = rgba.rgb; blockA[0] = rgba.a; 175 | rgba = tex.SampleLevel(samp, location, mipBias, int2(1, 0)); blockRGB[1] = rgba.rgb; blockA[1] = rgba.a; 176 | rgba = tex.SampleLevel(samp, location, mipBias, int2(2, 0)); blockRGB[2] = rgba.rgb; blockA[2] = rgba.a; 177 | rgba = tex.SampleLevel(samp, location, mipBias, int2(3, 0)); blockRGB[3] = rgba.rgb; blockA[3] = rgba.a; 178 | rgba = tex.SampleLevel(samp, location, mipBias, int2(0, 1)); blockRGB[4] = rgba.rgb; blockA[4] = rgba.a; 179 | rgba = tex.SampleLevel(samp, location, mipBias, int2(1, 1)); blockRGB[5] = rgba.rgb; blockA[5] = rgba.a; 180 | rgba = tex.SampleLevel(samp, location, mipBias, int2(2, 1)); blockRGB[6] = rgba.rgb; blockA[6] = rgba.a; 181 | rgba = tex.SampleLevel(samp, location, mipBias, int2(3, 1)); blockRGB[7] = rgba.rgb; blockA[7] = rgba.a; 182 | rgba = tex.SampleLevel(samp, location, mipBias, int2(0, 2)); blockRGB[8] = rgba.rgb; blockA[8] = rgba.a; 183 | rgba = tex.SampleLevel(samp, location, mipBias, int2(1, 2)); blockRGB[9] = rgba.rgb; blockA[9] = rgba.a; 184 | rgba = tex.SampleLevel(samp, location, mipBias, int2(2, 2)); blockRGB[10] = rgba.rgb; blockA[10] = rgba.a; 185 | rgba = tex.SampleLevel(samp, location, mipBias, int2(3, 2)); blockRGB[11] = rgba.rgb; blockA[11] = rgba.a; 186 | rgba = tex.SampleLevel(samp, location, mipBias, int2(0, 3)); blockRGB[12] = rgba.rgb; blockA[12] = rgba.a; 187 | rgba = tex.SampleLevel(samp, location, mipBias, int2(1, 3)); blockRGB[13] = rgba.rgb; blockA[13] = rgba.a; 188 | rgba = tex.SampleLevel(samp, location, mipBias, int2(2, 3)); blockRGB[14] = rgba.rgb; blockA[14] = rgba.a; 189 | rgba = tex.SampleLevel(samp, location, mipBias, int2(3, 3)); blockRGB[15] = rgba.rgb; blockA[15] = rgba.a; 190 | } 191 | 192 | 193 | //-------------------------------------------------------------------------------------- 194 | // Name: LoadTexelsUV 195 | // Desc: Load the 16 UV texels that form a block 196 | //-------------------------------------------------------------------------------------- 197 | void LoadTexelsUV(Texture2D tex, SamplerState samp, float oneOverTextureWidth, uint2 threadIDWithinDispatch, out float blockU[16], out float blockV[16]) 198 | { 199 | float2 uv = TexelToUV(float2(threadIDWithinDispatch * 4), oneOverTextureWidth); 200 | 201 | float4 red = tex.GatherRed(samp, uv, int2(0, 0)); 202 | float4 green = tex.GatherGreen(samp, uv, int2(0, 0)); 203 | blockU[0] = red[3]; blockV[0] = green[3]; 204 | blockU[1] = red[2]; blockV[1] = green[2]; 205 | blockU[4] = red[0]; blockV[4] = green[0]; 206 | blockU[5] = red[1]; blockV[5] = green[1]; 207 | 208 | red = tex.GatherRed(samp, uv, int2(2, 0)); 209 | green = tex.GatherGreen(samp, uv, int2(2, 0)); 210 | blockU[2] = red[3]; blockV[2] = green[3]; 211 | blockU[3] = red[2]; blockV[3] = green[2]; 212 | blockU[6] = red[0]; blockV[6] = green[0]; 213 | blockU[7] = red[1]; blockV[7] = green[1]; 214 | 215 | red = tex.GatherRed(samp, uv, int2(0, 2)); 216 | green = tex.GatherGreen(samp, uv, int2(0, 2)); 217 | blockU[8] = red[3]; blockV[8] = green[3]; 218 | blockU[9] = red[2]; blockV[9] = green[2]; 219 | blockU[12] = red[0]; blockV[12] = green[0]; 220 | blockU[13] = red[1]; blockV[13] = green[1]; 221 | 222 | red = tex.GatherRed(samp, uv, int2(2, 2)); 223 | green = tex.GatherGreen(samp, uv, int2(2, 2)); 224 | blockU[10] = red[3]; blockV[10] = green[3]; 225 | blockU[11] = red[2]; blockV[11] = green[2]; 226 | blockU[14] = red[0]; blockV[14] = green[0]; 227 | blockU[15] = red[1]; blockV[15] = green[1]; 228 | } 229 | 230 | 231 | //-------------------------------------------------------------------------------------- 232 | // Name: LoadTexelsUVBias 233 | // Desc: Load the 16 UV texels that form a block, with a mip bias 234 | //-------------------------------------------------------------------------------------- 235 | void LoadTexelsUVBias(Texture2D tex, SamplerState samp, float oneOverTextureSize, uint2 threadIDWithinDispatch, uint mipBias, out float blockU[16], out float blockV[16]) 236 | { 237 | // We need to use Sample rather than Gather/Load for the Bias functions, because low mips will read outside 238 | // the texture boundary. When reading outside the boundary, Gather/Load return 0, but Sample will clamp 239 | float4 rgba; 240 | float2 location = float2(threadIDWithinDispatch * 4) * oneOverTextureSize; 241 | rgba = tex.SampleLevel(samp, location, mipBias, int2(0, 0)); blockU[0] = rgba.r; blockV[0] = rgba.g; 242 | rgba = tex.SampleLevel(samp, location, mipBias, int2(1, 0)); blockU[1] = rgba.r; blockV[1] = rgba.g; 243 | rgba = tex.SampleLevel(samp, location, mipBias, int2(2, 0)); blockU[2] = rgba.r; blockV[2] = rgba.g; 244 | rgba = tex.SampleLevel(samp, location, mipBias, int2(3, 0)); blockU[3] = rgba.r; blockV[3] = rgba.g; 245 | rgba = tex.SampleLevel(samp, location, mipBias, int2(0, 1)); blockU[4] = rgba.r; blockV[4] = rgba.g; 246 | rgba = tex.SampleLevel(samp, location, mipBias, int2(1, 1)); blockU[5] = rgba.r; blockV[5] = rgba.g; 247 | rgba = tex.SampleLevel(samp, location, mipBias, int2(2, 1)); blockU[6] = rgba.r; blockV[6] = rgba.g; 248 | rgba = tex.SampleLevel(samp, location, mipBias, int2(3, 1)); blockU[7] = rgba.r; blockV[7] = rgba.g; 249 | rgba = tex.SampleLevel(samp, location, mipBias, int2(0, 2)); blockU[8] = rgba.r; blockV[8] = rgba.g; 250 | rgba = tex.SampleLevel(samp, location, mipBias, int2(1, 2)); blockU[9] = rgba.r; blockV[9] = rgba.g; 251 | rgba = tex.SampleLevel(samp, location, mipBias, int2(2, 2)); blockU[10] = rgba.r; blockV[10] = rgba.g; 252 | rgba = tex.SampleLevel(samp, location, mipBias, int2(3, 2)); blockU[11] = rgba.r; blockV[11] = rgba.g; 253 | rgba = tex.SampleLevel(samp, location, mipBias, int2(0, 3)); blockU[12] = rgba.r; blockV[12] = rgba.g; 254 | rgba = tex.SampleLevel(samp, location, mipBias, int2(1, 3)); blockU[13] = rgba.r; blockV[13] = rgba.g; 255 | rgba = tex.SampleLevel(samp, location, mipBias, int2(2, 3)); blockU[14] = rgba.r; blockV[14] = rgba.g; 256 | rgba = tex.SampleLevel(samp, location, mipBias, int2(3, 3)); blockU[15] = rgba.r; blockV[15] = rgba.g; 257 | } 258 | 259 | 260 | //-------------------------------------------------------------------------------------- 261 | // Name: GetMinMaxChannel 262 | // Desc: Get the min and max of a single channel 263 | //-------------------------------------------------------------------------------------- 264 | void GetMinMaxChannel(float block[16], out float minC, out float maxC) 265 | { 266 | minC = block[0]; 267 | maxC = block[0]; 268 | 269 | for (int i = 1; i < 16; ++i) 270 | { 271 | minC = min(minC, block[i]); 272 | maxC = max(maxC, block[i]); 273 | } 274 | } 275 | 276 | 277 | //-------------------------------------------------------------------------------------- 278 | // Name: GetMinMaxUV 279 | // Desc: Get the min and max of two channels (UV) 280 | //-------------------------------------------------------------------------------------- 281 | void GetMinMaxUV(float blockU[16], float blockV[16], out float minU, out float maxU, out float minV, out float maxV) 282 | { 283 | minU = blockU[0]; 284 | maxU = blockU[0]; 285 | minV = blockV[0]; 286 | maxV = blockV[0]; 287 | 288 | for (int i = 1; i < 16; ++i) 289 | { 290 | minU = min(minU, blockU[i]); 291 | maxU = max(maxU, blockU[i]); 292 | minV = min(minV, blockV[i]); 293 | maxV = max(maxV, blockV[i]); 294 | } 295 | } 296 | 297 | 298 | //-------------------------------------------------------------------------------------- 299 | // Name: GetMinMaxRGB 300 | // Desc: Get the min and max of three channels (RGB) 301 | //-------------------------------------------------------------------------------------- 302 | void GetMinMaxRGB(float3 colorBlock[16], out float3 minColor, out float3 maxColor) 303 | { 304 | minColor = colorBlock[0]; 305 | maxColor = colorBlock[0]; 306 | 307 | for (int i = 1; i < 16; ++i) 308 | { 309 | minColor = min(minColor, colorBlock[i]); 310 | maxColor = max(maxColor, colorBlock[i]); 311 | } 312 | } 313 | 314 | 315 | //-------------------------------------------------------------------------------------- 316 | // Name: InsetMinMaxRGB 317 | // Desc: Slightly inset the min and max color values to reduce RMS error. 318 | // This is recommended by van Waveren & Castano, "Real-Time YCoCg-DXT Compression" 319 | // http://www.nvidia.com/object/real-time-ycocg-dxt-compression.html 320 | //-------------------------------------------------------------------------------------- 321 | void InsetMinMaxRGB(inout float3 minColor, inout float3 maxColor, float colorScale) 322 | { 323 | // Since we have four points, (1/16) * (max-min) will give us half the distance between 324 | // two points on the line in color space 325 | float3 offset = (1.0f / 16.0f) * (maxColor - minColor); 326 | 327 | // After applying the offset, we want to round up or down to the next integral color value (0 to 255) 328 | colorScale *= 255.0f; 329 | maxColor = ceil((maxColor - offset) * colorScale) / colorScale; 330 | minColor = floor((minColor + offset) * colorScale) / colorScale; 331 | } 332 | 333 | 334 | //-------------------------------------------------------------------------------------- 335 | // Name: GetIndicesRGB 336 | // Desc: Calculate the BC block indices for each color in the block 337 | //-------------------------------------------------------------------------------------- 338 | uint GetIndicesRGB(float3 block[16], float3 minColor, float3 maxColor) 339 | { 340 | uint indices = 0; 341 | 342 | // For each input color, we need to select between one of the following output colors: 343 | // 0: maxColor 344 | // 1: (2/3)*maxColor + (1/3)*minColor 345 | // 2: (1/3)*maxColor + (2/3)*minColor 346 | // 3: minColor 347 | // 348 | // We essentially just project (block[i] - maxColor) onto (minColor - maxColor), but we pull out 349 | // a few constant terms. 350 | float3 diag = minColor - maxColor; 351 | float stepInc = 3.0f / dot(diag, diag); // Scale up by 3, because our indices are between 0 and 3 352 | diag *= stepInc; 353 | float c = stepInc * (dot(maxColor, maxColor) - dot(maxColor, minColor)); 354 | 355 | for (int i = 15; i >= 0; --i) 356 | { 357 | // Compute the index for this block element 358 | uint index = round(dot(block[i], diag) + c); 359 | 360 | // Now we need to convert our index into the somewhat unintuivive BC1 indexing scheme: 361 | // 0: maxColor 362 | // 1: minColor 363 | // 2: (2/3)*maxColor + (1/3)*minColor 364 | // 3: (1/3)*maxColor + (2/3)*minColor 365 | // 366 | // The mapping is: 367 | // 0 -> 0 368 | // 1 -> 2 369 | // 2 -> 3 370 | // 3 -> 1 371 | // 372 | // We can perform this mapping using bitwise operations, which is faster 373 | // than predication or branching as long as it doesn't increase our register 374 | // count too much. The mapping in binary looks like: 375 | // 00 -> 00 376 | // 01 -> 10 377 | // 10 -> 11 378 | // 11 -> 01 379 | // 380 | // Splitting it up by bit, the output looks like: 381 | // bit1_out = bit0_in XOR bit1_in 382 | // bit0_out = bit1_in 383 | uint bit0_in = index & 1; 384 | uint bit1_in = index >> 1; 385 | indices |= ((bit0_in^bit1_in) << 1) | bit1_in; 386 | 387 | if (i != 0) 388 | { 389 | indices <<= 2; 390 | } 391 | } 392 | 393 | return indices; 394 | } 395 | 396 | 397 | //-------------------------------------------------------------------------------------- 398 | // Name: GetIndicesAlpha 399 | // Desc: Calculate the BC block indices for an alpha channel 400 | //-------------------------------------------------------------------------------------- 401 | void GetIndicesAlpha(float block[16], float minA, float maxA, inout uint2 packed) 402 | { 403 | float d = minA - maxA; 404 | float stepInc = 7.0f / d; 405 | 406 | // Both packed.x and packed.y contain index values, so we need two loops 407 | 408 | uint index = 0; 409 | uint shift = 16; 410 | for (int i = 0; i < 6; ++i) 411 | { 412 | // For each input alpha value, we need to select between one of eight output values 413 | // 0: maxA 414 | // 1: (6/7)*maxA + (1/7)*minA 415 | // ... 416 | // 6: (1/7)*maxA + (6/3)*minA 417 | // 7: minA 418 | index = round(stepInc * (block[i] - maxA)); 419 | 420 | // Now we need to convert our index into the BC indexing scheme: 421 | // 0: maxA 422 | // 1: minA 423 | // 2: (6/7)*maxA + (1/7)*minA 424 | // ... 425 | // 7: (1/7)*maxA + (6/3)*minA 426 | index += (index > 0) - (7 * (index == 7)); 427 | 428 | packed.x |= (index << shift); 429 | shift += 3; 430 | } 431 | 432 | // The 6th index straddles the two uints 433 | packed.y |= (index >> 1); 434 | 435 | shift = 2; 436 | for (i = 6; i < 16; ++i) 437 | { 438 | index = round((block[i] - maxA) * stepInc); 439 | index += (index > 0) - (7 * (index == 7)); 440 | 441 | packed.y |= (index << shift); 442 | shift += 3; 443 | } 444 | } 445 | 446 | 447 | //-------------------------------------------------------------------------------------- 448 | // Name: CompressBC1Block 449 | // Desc: Compress a BC1 block. colorScale is a scale value to be applied to the input 450 | // colors; this used as an optimization when compressing two mips at a time. 451 | // When compressing only a single mip, colorScale is always 1.0 452 | //-------------------------------------------------------------------------------------- 453 | uint2 CompressBC1Block(float3 block[16], float colorScale = 1.0f) 454 | { 455 | float3 minColor, maxColor; 456 | GetMinMaxRGB(block, minColor, maxColor); 457 | 458 | // Inset the min and max values 459 | InsetMinMaxRGB(minColor, maxColor, colorScale); 460 | 461 | // Pack our colors into uints 462 | uint minColor565 = ColorTo565(colorScale * minColor); 463 | uint maxColor565 = ColorTo565(colorScale * maxColor); 464 | 465 | uint indices = 0; 466 | if (minColor565 < maxColor565) 467 | { 468 | indices = GetIndicesRGB(block, minColor, maxColor); 469 | } 470 | 471 | return uint2((minColor565 << 16) | maxColor565, indices); 472 | } 473 | 474 | 475 | //-------------------------------------------------------------------------------------- 476 | // Name: CompressBC3Block 477 | // Desc: Compress a BC3 block. valueScale is a scale value to be applied to the input 478 | // values; this used as an optimization when compressing two mips at a time. 479 | // When compressing only a single mip, valueScale is always 1.0 480 | //-------------------------------------------------------------------------------------- 481 | uint4 CompressBC3Block(float3 blockRGB[16], float blockA[16], float valueScale = 1.0f) 482 | { 483 | float3 minColor, maxColor; 484 | float minA, maxA; 485 | GetMinMaxRGB(blockRGB, minColor, maxColor); 486 | GetMinMaxChannel(blockA, minA, maxA); 487 | 488 | // Inset the min and max color values. We don't inset the alpha values 489 | // because, while it may reduce the RMS error, it has a tendency to turn 490 | // fully opaque texels partially transparent, which is probably not desirable. 491 | InsetMinMaxRGB(minColor, maxColor, valueScale); 492 | 493 | // Pack our colors and alpha values into uints 494 | uint minColor565 = ColorTo565(valueScale * minColor); 495 | uint maxColor565 = ColorTo565(valueScale * maxColor); 496 | uint minAPacked = round(minA * valueScale * 255.0f); 497 | uint maxAPacked = round(maxA * valueScale * 255.0f); 498 | 499 | uint indices = 0; 500 | if (minColor565 < maxColor565) 501 | { 502 | indices = GetIndicesRGB(blockRGB, minColor, maxColor); 503 | } 504 | 505 | uint2 outA = uint2((minAPacked << 8) | maxAPacked, 0); 506 | if (minAPacked < maxAPacked) 507 | { 508 | GetIndicesAlpha(blockA, minA, maxA, outA); 509 | } 510 | 511 | return uint4(outA.x, outA.y, (minColor565 << 16) | maxColor565, indices); 512 | } 513 | 514 | 515 | //-------------------------------------------------------------------------------------- 516 | // Name: CompressBC5Block 517 | // Desc: Compress a BC5 block. valueScale is a scale value to be applied to the input 518 | // values; this used as an optimization when compressing two mips at a time. 519 | // When compressing only a single mip, valueScale is always 1.0 520 | //-------------------------------------------------------------------------------------- 521 | uint4 CompressBC5Block(float blockU[16], float blockV[16], float valueScale = 1.0f) 522 | { 523 | float minU, maxU, minV, maxV; 524 | GetMinMaxUV(blockU, blockV, minU, maxU, minV, maxV); 525 | 526 | // Pack our min and max uv values 527 | uint minUPacked = round(minU * valueScale * 255.0f); 528 | uint maxUPacked = round(maxU * valueScale * 255.0f); 529 | uint minVPacked = round(minV * valueScale * 255.0f); 530 | uint maxVPacked = round(maxV * valueScale * 255.0f); 531 | 532 | uint2 outU = uint2((minUPacked << 8) | maxUPacked, 0); 533 | uint2 outV = uint2((minVPacked << 8) | maxVPacked, 0); 534 | 535 | if (minUPacked < maxUPacked) 536 | { 537 | GetIndicesAlpha(blockU, minU, maxU, outU); 538 | } 539 | 540 | if (minVPacked < maxVPacked) 541 | { 542 | GetIndicesAlpha(blockV, minV, maxV, outV); 543 | } 544 | 545 | return uint4(outU.x, outU.y, outV.x, outV.y); 546 | } 547 | 548 | 549 | //-------------------------------------------------------------------------------------- 550 | // Name: CalcTailMipsParams 551 | // Desc: Calculate parameters used in the "compress tail mips" shaders 552 | //-------------------------------------------------------------------------------------- 553 | void CalcTailMipsParams(uint2 threadIDWithinDispatch, out float oneOverTextureSize, out uint2 blockID, out uint mipBias) 554 | { 555 | blockID = threadIDWithinDispatch; 556 | mipBias = 0; 557 | oneOverTextureSize = 1; 558 | 559 | // When compressing our tail mips, we only dispatch one 8x8 threadgroup. Different threads 560 | // are selected to compress different mip levels based on the position of thr thread in 561 | // the threadgroup. 562 | if (blockID.x < 4) 563 | { 564 | if (blockID.y < 4) 565 | { 566 | // 16x16 mip 567 | oneOverTextureSize = 1.0f / 16.0f; 568 | } 569 | else 570 | { 571 | // 1x1 mip 572 | mipBias = 4; 573 | blockID.y -= 4; 574 | } 575 | } 576 | else if (blockID.x < 6) 577 | { 578 | // 8x8 mip 579 | mipBias = 1; 580 | blockID -= float2(4, 4); 581 | oneOverTextureSize = 1.0f / 8.0f; 582 | } 583 | else if (blockID.x < 7) 584 | { 585 | // 4x4 mip 586 | mipBias = 2; 587 | blockID -= float2(6, 6); 588 | oneOverTextureSize = 1.0f / 4.0f; 589 | } 590 | else if (blockID.x < 8) 591 | { 592 | // 2x2 mip 593 | mipBias = 3; 594 | blockID -= float2(7, 7); 595 | oneOverTextureSize = 1.0f / 2.0f; 596 | } 597 | } 598 | -------------------------------------------------------------------------------- /Assets/GPUTexCompression/External/FastBlockCompress/BlockCompress.hlsli.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 274520f521ac84f31bde626cd4d46cdf 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 66c17849679894b4f95a0ae6115edb66 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Materials/TexGradient1.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 8 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: TexGradient1 11 | m_Shader: {fileID: 4800000, guid: fe2d1da6dffcf4653ab3ed0d242e25c1, type: 3} 12 | m_Parent: {fileID: 0} 13 | m_ModifiedSerializedProperties: 0 14 | m_ValidKeywords: [] 15 | m_InvalidKeywords: [] 16 | m_LightmapFlags: 4 17 | m_EnableInstancingVariants: 0 18 | m_DoubleSidedGI: 0 19 | m_CustomRenderQueue: -1 20 | stringTagMap: {} 21 | disabledShaderPasses: [] 22 | m_LockedProperties: 23 | m_SavedProperties: 24 | serializedVersion: 3 25 | m_TexEnvs: 26 | - _BumpMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailAlbedoMap: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailMask: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _DetailNormalMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _EmissionMap: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MainTex: 47 | m_Texture: {fileID: 2800000, guid: 9464e719047c34926995a97235334ecf, type: 3} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _MetallicGlossMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _OcclusionMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | - _ParallaxMap: 59 | m_Texture: {fileID: 0} 60 | m_Scale: {x: 1, y: 1} 61 | m_Offset: {x: 0, y: 0} 62 | m_Ints: [] 63 | m_Floats: 64 | - _BumpScale: 1 65 | - _Cutoff: 0.5 66 | - _DetailNormalMapScale: 1 67 | - _DstBlend: 0 68 | - _GlossMapScale: 1 69 | - _Glossiness: 0.5 70 | - _GlossyReflections: 1 71 | - _Metallic: 0 72 | - _Mode: 0 73 | - _OcclusionStrength: 1 74 | - _Parallax: 0.02 75 | - _SmoothnessTextureChannel: 0 76 | - _SpecularHighlights: 1 77 | - _SrcBlend: 1 78 | - _UVSec: 0 79 | - _ZWrite: 1 80 | m_Colors: 81 | - _Color: {r: 1, g: 1, b: 1, a: 1} 82 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 83 | m_BuildTextureStacks: [] 84 | -------------------------------------------------------------------------------- /Assets/Materials/TexGradient1.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2baf1ed0e19b74dcfbfef2c9e58b21d2 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Materials/TexGradient2.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 8 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: TexGradient2 11 | m_Shader: {fileID: 4800000, guid: fe2d1da6dffcf4653ab3ed0d242e25c1, type: 3} 12 | m_Parent: {fileID: 0} 13 | m_ModifiedSerializedProperties: 0 14 | m_ValidKeywords: [] 15 | m_InvalidKeywords: [] 16 | m_LightmapFlags: 4 17 | m_EnableInstancingVariants: 0 18 | m_DoubleSidedGI: 0 19 | m_CustomRenderQueue: -1 20 | stringTagMap: {} 21 | disabledShaderPasses: [] 22 | m_LockedProperties: 23 | m_SavedProperties: 24 | serializedVersion: 3 25 | m_TexEnvs: 26 | - _BumpMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailAlbedoMap: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailMask: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _DetailNormalMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _EmissionMap: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MainTex: 47 | m_Texture: {fileID: 2800000, guid: a6b49341d64a47f4e9f4e9091f50a067, type: 3} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _MetallicGlossMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _OcclusionMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | - _ParallaxMap: 59 | m_Texture: {fileID: 0} 60 | m_Scale: {x: 1, y: 1} 61 | m_Offset: {x: 0, y: 0} 62 | m_Ints: [] 63 | m_Floats: 64 | - _BumpScale: 1 65 | - _Cutoff: 0.5 66 | - _DetailNormalMapScale: 1 67 | - _DstBlend: 0 68 | - _GlossMapScale: 1 69 | - _Glossiness: 0.5 70 | - _GlossyReflections: 1 71 | - _Metallic: 0 72 | - _Mode: 0 73 | - _OcclusionStrength: 1 74 | - _Parallax: 0.02 75 | - _SmoothnessTextureChannel: 0 76 | - _SpecularHighlights: 1 77 | - _SrcBlend: 1 78 | - _UVSec: 0 79 | - _ZWrite: 1 80 | m_Colors: 81 | - _Color: {r: 1, g: 1, b: 1, a: 1} 82 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 83 | m_BuildTextureStacks: [] 84 | -------------------------------------------------------------------------------- /Assets/Materials/TexGradient2.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f0f65b11e799d514eb4f2096516b6aaf 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Materials/TexNoise.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 8 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: TexNoise 11 | m_Shader: {fileID: 4800000, guid: fe2d1da6dffcf4653ab3ed0d242e25c1, type: 3} 12 | m_Parent: {fileID: 0} 13 | m_ModifiedSerializedProperties: 0 14 | m_ValidKeywords: [] 15 | m_InvalidKeywords: [] 16 | m_LightmapFlags: 4 17 | m_EnableInstancingVariants: 0 18 | m_DoubleSidedGI: 0 19 | m_CustomRenderQueue: -1 20 | stringTagMap: {} 21 | disabledShaderPasses: [] 22 | m_LockedProperties: 23 | m_SavedProperties: 24 | serializedVersion: 3 25 | m_TexEnvs: 26 | - _BumpMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailAlbedoMap: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailMask: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _DetailNormalMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _EmissionMap: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 6, y: 6} 45 | m_Offset: {x: 0, y: 0} 46 | - _MainTex: 47 | m_Texture: {fileID: 2800000, guid: 7525456b364a24615821964ecf2d8b40, type: 3} 48 | m_Scale: {x: 6, y: 6} 49 | m_Offset: {x: 0, y: 0} 50 | - _MetallicGlossMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _OcclusionMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | - _ParallaxMap: 59 | m_Texture: {fileID: 0} 60 | m_Scale: {x: 1, y: 1} 61 | m_Offset: {x: 0, y: 0} 62 | m_Ints: [] 63 | m_Floats: 64 | - _BumpScale: 1 65 | - _Cutoff: 0.5 66 | - _DetailNormalMapScale: 1 67 | - _DstBlend: 0 68 | - _GlossMapScale: 1 69 | - _Glossiness: 0.5 70 | - _GlossyReflections: 1 71 | - _Metallic: 0 72 | - _Mode: 0 73 | - _OcclusionStrength: 1 74 | - _Parallax: 0.02 75 | - _SmoothnessTextureChannel: 0 76 | - _SpecularHighlights: 1 77 | - _SrcBlend: 1 78 | - _UVSec: 0 79 | - _ZWrite: 1 80 | m_Colors: 81 | - _Color: {r: 1, g: 1, b: 1, a: 1} 82 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 83 | m_BuildTextureStacks: [] 84 | -------------------------------------------------------------------------------- /Assets/Materials/TexNoise.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0a946540c77014651843a7ea8b477ae6 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/RenderTarget.renderTexture: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!84 &8400000 4 | RenderTexture: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_Name: RenderTarget 10 | m_ImageContentsHash: 11 | serializedVersion: 2 12 | Hash: 00000000000000000000000000000000 13 | m_ForcedFallbackFormat: 4 14 | m_DownscaleFallback: 0 15 | m_IsAlphaChannelOptional: 0 16 | serializedVersion: 5 17 | m_Width: 1280 18 | m_Height: 720 19 | m_AntiAliasing: 1 20 | m_MipCount: -1 21 | m_DepthStencilFormat: 94 22 | m_ColorFormat: 4 23 | m_MipMap: 0 24 | m_GenerateMips: 1 25 | m_SRGB: 1 26 | m_UseDynamicScale: 0 27 | m_BindMS: 0 28 | m_EnableCompatibleFormat: 1 29 | m_TextureSettings: 30 | serializedVersion: 2 31 | m_FilterMode: 1 32 | m_Aniso: 0 33 | m_MipBias: 0 34 | m_WrapU: 1 35 | m_WrapV: 1 36 | m_WrapW: 1 37 | m_Dimension: 2 38 | m_VolumeDepth: 1 39 | m_ShadowSamplingMode: 2 40 | -------------------------------------------------------------------------------- /Assets/RenderTarget.renderTexture.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 17741c07cfd6f4c29860a6143c77cae1 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 8400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9e66ad9b2040b45da971fe213cc5b41e 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/SkyMaterial.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 8 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: SkyMaterial 11 | m_Shader: {fileID: 4800000, guid: 3e9d5731f395047ed907693c8a86175b, type: 3} 12 | m_Parent: {fileID: 0} 13 | m_ModifiedSerializedProperties: 0 14 | m_ValidKeywords: [] 15 | m_InvalidKeywords: [] 16 | m_LightmapFlags: 4 17 | m_EnableInstancingVariants: 0 18 | m_DoubleSidedGI: 0 19 | m_CustomRenderQueue: -1 20 | stringTagMap: {} 21 | disabledShaderPasses: [] 22 | m_LockedProperties: 23 | m_SavedProperties: 24 | serializedVersion: 3 25 | m_TexEnvs: [] 26 | m_Ints: [] 27 | m_Floats: [] 28 | m_Colors: [] 29 | m_BuildTextureStacks: [] 30 | -------------------------------------------------------------------------------- /Assets/SkyMaterial.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2d6bfdaa2353f4fa58c74dd4a9952559 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/SkyShader.shader: -------------------------------------------------------------------------------- 1 | Shader "Skybox/Custom" 2 | { 3 | SubShader 4 | { 5 | Tags { "Queue"="Background" "RenderType"="Background" "PreviewType"="Skybox" } 6 | Cull Off ZWrite Off 7 | Pass 8 | { 9 | CGPROGRAM 10 | #pragma vertex vert 11 | #pragma fragment frag 12 | 13 | #include "UnityCG.cginc" 14 | 15 | struct appdata_t { 16 | float4 vertex : POSITION; 17 | }; 18 | 19 | struct v2f { 20 | float4 vertex : SV_POSITION; 21 | float3 uv : TEXCOORD0; 22 | }; 23 | 24 | v2f vert (appdata_t v) 25 | { 26 | v2f o; 27 | o.vertex = UnityObjectToClipPos(v.vertex); 28 | o.uv = v.vertex.xyz; 29 | return o; 30 | } 31 | 32 | half4 frag (v2f i) : SV_Target 33 | { 34 | float3 dir = i.uv * 0.5 + 0.5; 35 | return half4(frac(dir * 30), frac(dir.x*50+dir.z*50)); 36 | } 37 | ENDCG 38 | } 39 | } 40 | 41 | Fallback Off 42 | } 43 | -------------------------------------------------------------------------------- /Assets/SkyShader.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3e9d5731f395047ed907693c8a86175b 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TestGPUTexCompression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using UnityEngine; 4 | using UnityEngine.Experimental.Rendering; 5 | using UnityEngine.Rendering; 6 | 7 | public class TestGPUTexCompression : MonoBehaviour 8 | { 9 | public Texture m_SourceTexture; 10 | public EncodeBCn.Format m_Format = EncodeBCn.Format.BC3_AMD; 11 | [Range(0, 1)] public float m_Quality = 0.25f; 12 | public ComputeShader m_EncodeShader; 13 | public ComputeShader m_RMSEShader; 14 | public Material m_BlitMaterial; 15 | public Transform m_ObjectToRotate; 16 | public bool m_Rotate = true; 17 | 18 | private EncodeBCn m_Encoder; 19 | private Texture2D m_DestTexture; 20 | private CommandBuffer m_Cmd; 21 | 22 | private Vector2 m_RMSE = Vector2.zero; 23 | private GraphicsBuffer m_RMSEBuffer1; 24 | private GraphicsBuffer m_RMSEBuffer2; 25 | 26 | private EncodeBCn.Format m_CurFormat = EncodeBCn.Format.None; 27 | private float m_CurQuality = -1; 28 | 29 | private GUIContent[] m_FormatLabels = 30 | ((EncodeBCn.Format[]) Enum.GetValues(typeof(EncodeBCn.Format))).Select(f => new GUIContent(f.ToString())).ToArray(); 31 | 32 | readonly FrameTiming[] m_FrameTimings = new FrameTiming[1]; 33 | private float m_GpuTimesAccum = 0; 34 | private float m_CpuTimesAccum = 0; 35 | private int m_FramesAccum = 0; 36 | private float m_AvgFrameTime = 0; 37 | 38 | public void Start() 39 | { 40 | if (m_SourceTexture == null || m_SourceTexture.dimension != TextureDimension.Tex2D) 41 | { 42 | Debug.LogWarning($"Source texture is null or not 2D"); 43 | return; 44 | } 45 | m_Encoder = new EncodeBCn(m_EncodeShader); 46 | 47 | UpdateDestTexture(); 48 | 49 | m_Cmd = new CommandBuffer(); 50 | m_Cmd.name = "GPU BCn Compression"; 51 | UpdateCommandBuffer(); 52 | Camera.main.AddCommandBuffer(CameraEvent.AfterForwardAlpha, m_Cmd); 53 | } 54 | 55 | public void OnDestroy() 56 | { 57 | DestroyImmediate(m_DestTexture); 58 | m_Cmd?.Dispose(); m_Cmd = null; 59 | m_RMSEBuffer1?.Dispose(); m_RMSEBuffer1 = null; 60 | m_RMSEBuffer2?.Dispose(); m_RMSEBuffer2 = null; 61 | } 62 | 63 | void UpdateCommandBuffer() 64 | { 65 | m_Cmd.Clear(); 66 | m_Encoder.Encode(m_Cmd, m_SourceTexture, m_SourceTexture.width, m_SourceTexture.height, m_DestTexture, m_Format, m_Quality); 67 | m_Cmd.Blit(m_DestTexture, new RenderTargetIdentifier(BuiltinRenderTextureType.CurrentActive), m_BlitMaterial); 68 | } 69 | 70 | void UpdateDestTexture() 71 | { 72 | int width = m_SourceTexture.width; 73 | int height = m_SourceTexture.height; 74 | if (m_Format != EncodeBCn.Format.None) 75 | { 76 | width = (width + 3) / 4 * 4; 77 | height = (height + 3) / 4 * 4; 78 | } 79 | 80 | GraphicsFormat gfxFormat = m_Format switch 81 | { 82 | EncodeBCn.Format.None => m_SourceTexture.graphicsFormat, 83 | EncodeBCn.Format.BC1_AMD => GraphicsFormat.RGBA_DXT1_SRGB, 84 | EncodeBCn.Format.BC1_XDK => GraphicsFormat.RGBA_DXT1_SRGB, 85 | EncodeBCn.Format.BC3_AMD => GraphicsFormat.RGBA_DXT5_SRGB, 86 | EncodeBCn.Format.BC3_XDK => GraphicsFormat.RGBA_DXT5_SRGB, 87 | _ => GraphicsFormat.None 88 | }; 89 | m_DestTexture = new Texture2D(width, height, gfxFormat, 90 | TextureCreationFlags.DontInitializePixels | TextureCreationFlags.DontUploadUponCreate) 91 | { 92 | name = "BCn Compression Target" 93 | }; 94 | m_DestTexture.Apply(false, true); 95 | } 96 | 97 | void CalculateRMSE() 98 | { 99 | //if (Time.renderedFrameCount % 16 != 0) 100 | // return; 101 | 102 | int rmseFactor = 128; 103 | int bufferSize1 = m_SourceTexture.width * m_SourceTexture.height / rmseFactor; 104 | if (m_RMSEBuffer1 == null || m_RMSEBuffer1.count != bufferSize1) 105 | { 106 | m_RMSEBuffer1?.Dispose(); 107 | m_RMSEBuffer1 = new GraphicsBuffer(GraphicsBuffer.Target.Structured, bufferSize1, 8); 108 | } 109 | int bufferSize2 = bufferSize1 / rmseFactor; 110 | if (m_RMSEBuffer2 == null || m_RMSEBuffer2.count != bufferSize2) 111 | { 112 | m_RMSEBuffer2?.Dispose(); 113 | m_RMSEBuffer2 = new GraphicsBuffer(GraphicsBuffer.Target.Structured, bufferSize2, 8); 114 | } 115 | 116 | m_RMSEShader.SetInt("_TextureWidth", m_SourceTexture.width); 117 | m_RMSEShader.SetTexture(0, "_TextureA", m_SourceTexture); 118 | m_RMSEShader.SetTexture(0, "_TextureB", m_DestTexture); 119 | m_RMSEShader.SetBuffer(0, "_BufferOutput", m_RMSEBuffer1); 120 | m_RMSEShader.Dispatch(0, m_SourceTexture.width/128, m_SourceTexture.height, 1); 121 | 122 | m_RMSEShader.SetBuffer(1, "_BufferInput", m_RMSEBuffer1); 123 | m_RMSEShader.SetBuffer(1, "_BufferOutput", m_RMSEBuffer2); 124 | m_RMSEShader.Dispatch(1, m_RMSEBuffer1.count/128, 1, 1); 125 | 126 | AsyncGPUReadback.Request(m_RMSEBuffer2, request => 127 | { 128 | if (request.done) 129 | { 130 | var data = request.GetData(); 131 | Vector2 err = Vector2.zero; 132 | foreach (var e in data) 133 | err += e; 134 | 135 | m_RMSE.x = Mathf.Sqrt(err.x / (m_SourceTexture.width * m_SourceTexture.height)) / 3.0f; 136 | m_RMSE.y = Mathf.Sqrt(err.y / (m_SourceTexture.width * m_SourceTexture.height)); 137 | } 138 | }); 139 | } 140 | 141 | public void Update() 142 | { 143 | if (m_DestTexture == null || m_RMSEShader == null) 144 | return; 145 | 146 | if (m_Quality != m_CurQuality || m_Format != m_CurFormat) 147 | { 148 | UpdateDestTexture(); 149 | UpdateCommandBuffer(); 150 | m_CurQuality = m_Quality; 151 | m_CurFormat = m_Format; 152 | } 153 | 154 | RotateObjects(); 155 | 156 | CalculateFrameTimes(); 157 | CalculateRMSE(); 158 | } 159 | 160 | void RotateObjects() 161 | { 162 | if (m_ObjectToRotate == null) 163 | return; 164 | if (m_Rotate) 165 | { 166 | var rot = Time.deltaTime * 10.0f; 167 | m_ObjectToRotate.Rotate(0, rot, 0, Space.World); 168 | } 169 | else 170 | { 171 | m_ObjectToRotate.localRotation = Quaternion.identity; 172 | } 173 | } 174 | 175 | void CalculateFrameTimes() 176 | { 177 | FrameTimingManager.CaptureFrameTimings(); 178 | if (FrameTimingManager.GetLatestTimings(1, m_FrameTimings) != 1) 179 | return; // feature is off, or waiting for GPU readback 180 | 181 | // Looks like it reports GPU times as zeroes when GPU load is "high enough", so that's not 182 | // terribly useful (at least on DX11 / GeForce 3080 Ti). Let's report CPU frame time then :( 183 | //if (m_FrameTimings[0].gpuFrameTime == 0) 184 | // return; // disjoint frames, GPU restart, high GPU load (?) etc. 185 | 186 | if (m_FrameTimings[0].cpuTimeFrameComplete < m_FrameTimings[0].cpuTimePresentCalled) 187 | return; // sanity check 188 | 189 | m_CpuTimesAccum += (float) m_FrameTimings[0].cpuFrameTime; 190 | m_GpuTimesAccum += (float) m_FrameTimings[0].gpuFrameTime; 191 | m_FramesAccum++; 192 | if (m_GpuTimesAccum > 500 || m_CpuTimesAccum > 500) 193 | { 194 | //m_AvgGpuTime = m_GpuTimesAccum / m_FramesAccum; 195 | m_AvgFrameTime = m_CpuTimesAccum / m_FramesAccum; 196 | m_CpuTimesAccum = 0.0f; 197 | m_GpuTimesAccum = 0.0f; 198 | m_FramesAccum = 0; 199 | } 200 | } 201 | 202 | void OnGUI() 203 | { 204 | GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(2,2,2)); 205 | 206 | GUI.Box(new Rect(5, 5, 510, 120), GUIContent.none, GUI.skin.window); 207 | 208 | // format 209 | m_Format = (EncodeBCn.Format)GUI.Toolbar(new Rect(10, 10, 500, 20), (int)m_Format, m_FormatLabels); 210 | 211 | // quality slider 212 | DrawLabelWithOutline(new Rect(10, 40, 100, 20), new GUIContent("Quality")); 213 | int quality = Mathf.RoundToInt(m_Quality * 10); 214 | m_Quality = GUI.HorizontalSlider(new Rect(60, 45, 100, 20), quality, 0, 10) / 10.0f; 215 | DrawLabelWithOutline(new Rect(170, 40, 100, 20), new GUIContent(m_Quality.ToString("F1"))); 216 | 217 | // rotate checkbox 218 | m_Rotate = GUI.Toggle(new Rect(300, 40, 100, 20), m_Rotate, "Rotate Objects"); 219 | 220 | // stats 221 | var label = $"{m_SourceTexture.width}x{m_SourceTexture.height} {m_Format} q={m_Quality:F1}\nRMSE: RGB {m_RMSE.x:F3}, {m_RMSE.y:F3}\nFrame time: {m_AvgFrameTime:F3}ms ({SystemInfo.graphicsDeviceName} on {SystemInfo.graphicsDeviceType})"; 222 | var rect = new Rect(10, 70, 600, 60); 223 | DrawLabelWithOutline(rect, new GUIContent(label)); 224 | } 225 | 226 | static void DrawLabelWithOutline(Rect rect, GUIContent label) 227 | { 228 | GUI.color = Color.black; 229 | rect.x -= 1; rect.y -= 1; GUI.Label(rect, label); 230 | rect.x += 2; GUI.Label(rect, label); 231 | rect.y += 2; GUI.Label(rect, label); 232 | rect.x -= 2; GUI.Label(rect, label); 233 | GUI.color = Color.white; 234 | rect.x += 1; rect.y -= 1; GUI.Label(rect, label); 235 | } 236 | } 237 | -------------------------------------------------------------------------------- /Assets/TestGPUTexCompression.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c0e2479420267494599fcee0b9f4a31b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/TestGPUTexCompressionScene.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 2100000, guid: 2d6bfdaa2353f4fa58c74dd4a9952559, type: 2} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0.49983895, g: 0.49984354, b: 0.49983895, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 12 47 | m_GIWorkflowMode: 1 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 0 56 | m_LightmapEditorSettings: 57 | serializedVersion: 12 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_AtlasSize: 1024 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_ExtractAmbientOcclusion: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 1 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 500 79 | m_PVRBounces: 2 80 | m_PVREnvironmentSampleCount: 500 81 | m_PVREnvironmentReferencePointCount: 2048 82 | m_PVRFilteringMode: 2 83 | m_PVRDenoiserTypeDirect: 0 84 | m_PVRDenoiserTypeIndirect: 0 85 | m_PVRDenoiserTypeAO: 0 86 | m_PVRFilterTypeDirect: 0 87 | m_PVRFilterTypeIndirect: 0 88 | m_PVRFilterTypeAO: 0 89 | m_PVREnvironmentMIS: 0 90 | m_PVRCulling: 1 91 | m_PVRFilteringGaussRadiusDirect: 1 92 | m_PVRFilteringGaussRadiusIndirect: 5 93 | m_PVRFilteringGaussRadiusAO: 2 94 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 95 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 96 | m_PVRFilteringAtrousPositionSigmaAO: 1 97 | m_ExportTrainingData: 0 98 | m_TrainingDataDestination: TrainingData 99 | m_LightProbeSampleCountMultiplier: 4 100 | m_LightingDataAsset: {fileID: 0} 101 | m_LightingSettings: {fileID: 0} 102 | --- !u!196 &4 103 | NavMeshSettings: 104 | serializedVersion: 2 105 | m_ObjectHideFlags: 0 106 | m_BuildSettings: 107 | serializedVersion: 3 108 | agentTypeID: 0 109 | agentRadius: 0.5 110 | agentHeight: 2 111 | agentSlope: 45 112 | agentClimb: 0.4 113 | ledgeDropHeight: 0 114 | maxJumpAcrossDistance: 0 115 | minRegionArea: 2 116 | manualCellSize: 0 117 | cellSize: 0.16666667 118 | manualTileSize: 0 119 | tileSize: 256 120 | buildHeightMesh: 0 121 | maxJobWorkers: 0 122 | preserveTilesOutsideBounds: 0 123 | debug: 124 | m_Flags: 0 125 | m_NavMeshData: {fileID: 0} 126 | --- !u!1 &285895398 127 | GameObject: 128 | m_ObjectHideFlags: 0 129 | m_CorrespondingSourceObject: {fileID: 0} 130 | m_PrefabInstance: {fileID: 0} 131 | m_PrefabAsset: {fileID: 0} 132 | serializedVersion: 6 133 | m_Component: 134 | - component: {fileID: 285895401} 135 | - component: {fileID: 285895400} 136 | m_Layer: 0 137 | m_Name: RenderTargetCamera 138 | m_TagString: Untagged 139 | m_Icon: {fileID: 0} 140 | m_NavMeshLayer: 0 141 | m_StaticEditorFlags: 0 142 | m_IsActive: 1 143 | --- !u!20 &285895400 144 | Camera: 145 | m_ObjectHideFlags: 0 146 | m_CorrespondingSourceObject: {fileID: 0} 147 | m_PrefabInstance: {fileID: 0} 148 | m_PrefabAsset: {fileID: 0} 149 | m_GameObject: {fileID: 285895398} 150 | m_Enabled: 1 151 | serializedVersion: 2 152 | m_ClearFlags: 1 153 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 154 | m_projectionMatrixMode: 1 155 | m_GateFitMode: 2 156 | m_FOVAxisMode: 0 157 | m_Iso: 200 158 | m_ShutterSpeed: 0.005 159 | m_Aperture: 16 160 | m_FocusDistance: 10 161 | m_FocalLength: 50 162 | m_BladeCount: 5 163 | m_Curvature: {x: 2, y: 11} 164 | m_BarrelClipping: 0.25 165 | m_Anamorphism: 0 166 | m_SensorSize: {x: 36, y: 24} 167 | m_LensShift: {x: 0, y: 0} 168 | m_NormalizedViewPortRect: 169 | serializedVersion: 2 170 | x: 0 171 | y: 0 172 | width: 1 173 | height: 1 174 | near clip plane: 0.3 175 | far clip plane: 1000 176 | field of view: 60 177 | orthographic: 0 178 | orthographic size: 5 179 | m_Depth: 0 180 | m_CullingMask: 181 | serializedVersion: 2 182 | m_Bits: 4294967295 183 | m_RenderingPath: -1 184 | m_TargetTexture: {fileID: 8400000, guid: 17741c07cfd6f4c29860a6143c77cae1, type: 2} 185 | m_TargetDisplay: 0 186 | m_TargetEye: 3 187 | m_HDR: 1 188 | m_AllowMSAA: 1 189 | m_AllowDynamicResolution: 0 190 | m_ForceIntoRT: 0 191 | m_OcclusionCulling: 1 192 | m_StereoConvergence: 10 193 | m_StereoSeparation: 0.022 194 | --- !u!4 &285895401 195 | Transform: 196 | m_ObjectHideFlags: 0 197 | m_CorrespondingSourceObject: {fileID: 0} 198 | m_PrefabInstance: {fileID: 0} 199 | m_PrefabAsset: {fileID: 0} 200 | m_GameObject: {fileID: 285895398} 201 | m_LocalRotation: {x: -0.13410382, y: 0.59080815, z: -0.10038832, w: -0.78923005} 202 | m_LocalPosition: {x: 2.0978963, y: 1.4551265, z: -0.61600584} 203 | m_LocalScale: {x: 1, y: 1, z: 1} 204 | m_ConstrainProportionsScale: 0 205 | m_Children: [] 206 | m_Father: {fileID: 0} 207 | m_RootOrder: 2 208 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 209 | --- !u!1 &612763418 210 | GameObject: 211 | m_ObjectHideFlags: 0 212 | m_CorrespondingSourceObject: {fileID: 0} 213 | m_PrefabInstance: {fileID: 0} 214 | m_PrefabAsset: {fileID: 0} 215 | serializedVersion: 6 216 | m_Component: 217 | - component: {fileID: 612763422} 218 | - component: {fileID: 612763421} 219 | - component: {fileID: 612763420} 220 | m_Layer: 0 221 | m_Name: Cube 222 | m_TagString: Untagged 223 | m_Icon: {fileID: 0} 224 | m_NavMeshLayer: 0 225 | m_StaticEditorFlags: 0 226 | m_IsActive: 1 227 | --- !u!23 &612763420 228 | MeshRenderer: 229 | m_ObjectHideFlags: 0 230 | m_CorrespondingSourceObject: {fileID: 0} 231 | m_PrefabInstance: {fileID: 0} 232 | m_PrefabAsset: {fileID: 0} 233 | m_GameObject: {fileID: 612763418} 234 | m_Enabled: 1 235 | m_CastShadows: 1 236 | m_ReceiveShadows: 1 237 | m_DynamicOccludee: 1 238 | m_StaticShadowCaster: 0 239 | m_MotionVectors: 1 240 | m_LightProbeUsage: 1 241 | m_ReflectionProbeUsage: 1 242 | m_RayTracingMode: 2 243 | m_RayTraceProcedural: 0 244 | m_RenderingLayerMask: 1 245 | m_RendererPriority: 0 246 | m_Materials: 247 | - {fileID: 2100000, guid: 2baf1ed0e19b74dcfbfef2c9e58b21d2, type: 2} 248 | m_StaticBatchInfo: 249 | firstSubMesh: 0 250 | subMeshCount: 0 251 | m_StaticBatchRoot: {fileID: 0} 252 | m_ProbeAnchor: {fileID: 0} 253 | m_LightProbeVolumeOverride: {fileID: 0} 254 | m_ScaleInLightmap: 1 255 | m_ReceiveGI: 1 256 | m_PreserveUVs: 0 257 | m_IgnoreNormalsForChartDetection: 0 258 | m_ImportantGI: 0 259 | m_StitchLightmapSeams: 1 260 | m_SelectedEditorRenderState: 3 261 | m_MinimumChartSize: 4 262 | m_AutoUVMaxDistance: 0.5 263 | m_AutoUVMaxAngle: 89 264 | m_LightmapParameters: {fileID: 0} 265 | m_SortingLayerID: 0 266 | m_SortingLayer: 0 267 | m_SortingOrder: 0 268 | m_AdditionalVertexStreams: {fileID: 0} 269 | --- !u!33 &612763421 270 | MeshFilter: 271 | m_ObjectHideFlags: 0 272 | m_CorrespondingSourceObject: {fileID: 0} 273 | m_PrefabInstance: {fileID: 0} 274 | m_PrefabAsset: {fileID: 0} 275 | m_GameObject: {fileID: 612763418} 276 | m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} 277 | --- !u!4 &612763422 278 | Transform: 279 | m_ObjectHideFlags: 0 280 | m_CorrespondingSourceObject: {fileID: 0} 281 | m_PrefabInstance: {fileID: 0} 282 | m_PrefabAsset: {fileID: 0} 283 | m_GameObject: {fileID: 612763418} 284 | m_LocalRotation: {x: -0.24456716, y: 0.4779109, z: 0.0008939106, w: 0.8436749} 285 | m_LocalPosition: {x: 0.306, y: 0.69, z: -0.115} 286 | m_LocalScale: {x: 1, y: 1, z: 1} 287 | m_ConstrainProportionsScale: 0 288 | m_Children: [] 289 | m_Father: {fileID: 1374801553} 290 | m_RootOrder: -1 291 | m_LocalEulerAnglesHint: {x: -24.426, y: 62.276, z: -14.779} 292 | --- !u!1 &963194225 293 | GameObject: 294 | m_ObjectHideFlags: 0 295 | m_CorrespondingSourceObject: {fileID: 0} 296 | m_PrefabInstance: {fileID: 0} 297 | m_PrefabAsset: {fileID: 0} 298 | serializedVersion: 6 299 | m_Component: 300 | - component: {fileID: 963194228} 301 | - component: {fileID: 963194227} 302 | - component: {fileID: 963194226} 303 | m_Layer: 0 304 | m_Name: Main Camera 305 | m_TagString: MainCamera 306 | m_Icon: {fileID: 0} 307 | m_NavMeshLayer: 0 308 | m_StaticEditorFlags: 0 309 | m_IsActive: 1 310 | --- !u!81 &963194226 311 | AudioListener: 312 | m_ObjectHideFlags: 0 313 | m_CorrespondingSourceObject: {fileID: 0} 314 | m_PrefabInstance: {fileID: 0} 315 | m_PrefabAsset: {fileID: 0} 316 | m_GameObject: {fileID: 963194225} 317 | m_Enabled: 1 318 | --- !u!20 &963194227 319 | Camera: 320 | m_ObjectHideFlags: 0 321 | m_CorrespondingSourceObject: {fileID: 0} 322 | m_PrefabInstance: {fileID: 0} 323 | m_PrefabAsset: {fileID: 0} 324 | m_GameObject: {fileID: 963194225} 325 | m_Enabled: 1 326 | serializedVersion: 2 327 | m_ClearFlags: 1 328 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 329 | m_projectionMatrixMode: 1 330 | m_GateFitMode: 2 331 | m_FOVAxisMode: 0 332 | m_Iso: 200 333 | m_ShutterSpeed: 0.005 334 | m_Aperture: 16 335 | m_FocusDistance: 10 336 | m_FocalLength: 50 337 | m_BladeCount: 5 338 | m_Curvature: {x: 2, y: 11} 339 | m_BarrelClipping: 0.25 340 | m_Anamorphism: 0 341 | m_SensorSize: {x: 36, y: 24} 342 | m_LensShift: {x: 0, y: 0} 343 | m_NormalizedViewPortRect: 344 | serializedVersion: 2 345 | x: 0 346 | y: 0 347 | width: 1 348 | height: 1 349 | near clip plane: 0.3 350 | far clip plane: 1000 351 | field of view: 60 352 | orthographic: 0 353 | orthographic size: 5 354 | m_Depth: -1 355 | m_CullingMask: 356 | serializedVersion: 2 357 | m_Bits: 4294967295 358 | m_RenderingPath: -1 359 | m_TargetTexture: {fileID: 0} 360 | m_TargetDisplay: 0 361 | m_TargetEye: 3 362 | m_HDR: 1 363 | m_AllowMSAA: 1 364 | m_AllowDynamicResolution: 0 365 | m_ForceIntoRT: 0 366 | m_OcclusionCulling: 1 367 | m_StereoConvergence: 10 368 | m_StereoSeparation: 0.022 369 | --- !u!4 &963194228 370 | Transform: 371 | m_ObjectHideFlags: 0 372 | m_CorrespondingSourceObject: {fileID: 0} 373 | m_PrefabInstance: {fileID: 0} 374 | m_PrefabAsset: {fileID: 0} 375 | m_GameObject: {fileID: 963194225} 376 | m_LocalRotation: {x: -0.119877025, y: 0.4724199, z: -0.065037765, w: -0.87075776} 377 | m_LocalPosition: {x: 9.134004, y: 3.748145, z: -5.937686} 378 | m_LocalScale: {x: 1, y: 1, z: 1} 379 | m_ConstrainProportionsScale: 0 380 | m_Children: [] 381 | m_Father: {fileID: 0} 382 | m_RootOrder: 0 383 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 384 | --- !u!1 &1015091995 385 | GameObject: 386 | m_ObjectHideFlags: 0 387 | m_CorrespondingSourceObject: {fileID: 0} 388 | m_PrefabInstance: {fileID: 0} 389 | m_PrefabAsset: {fileID: 0} 390 | serializedVersion: 6 391 | m_Component: 392 | - component: {fileID: 1015091996} 393 | - component: {fileID: 1015091998} 394 | - component: {fileID: 1015091997} 395 | m_Layer: 0 396 | m_Name: Cube (1) 397 | m_TagString: Untagged 398 | m_Icon: {fileID: 0} 399 | m_NavMeshLayer: 0 400 | m_StaticEditorFlags: 0 401 | m_IsActive: 1 402 | --- !u!4 &1015091996 403 | Transform: 404 | m_ObjectHideFlags: 0 405 | m_CorrespondingSourceObject: {fileID: 0} 406 | m_PrefabInstance: {fileID: 0} 407 | m_PrefabAsset: {fileID: 0} 408 | m_GameObject: {fileID: 1015091995} 409 | m_LocalRotation: {x: -0.21521138, y: 0.8194362, z: 0.11618062, w: 0.5183728} 410 | m_LocalPosition: {x: -0.803, y: 0.69, z: 0.928} 411 | m_LocalScale: {x: 1, y: 1, z: 1} 412 | m_ConstrainProportionsScale: 0 413 | m_Children: [] 414 | m_Father: {fileID: 1374801553} 415 | m_RootOrder: -1 416 | m_LocalEulerAnglesHint: {x: -24.426, y: 118.581, z: -14.779} 417 | --- !u!23 &1015091997 418 | MeshRenderer: 419 | m_ObjectHideFlags: 0 420 | m_CorrespondingSourceObject: {fileID: 0} 421 | m_PrefabInstance: {fileID: 0} 422 | m_PrefabAsset: {fileID: 0} 423 | m_GameObject: {fileID: 1015091995} 424 | m_Enabled: 1 425 | m_CastShadows: 1 426 | m_ReceiveShadows: 1 427 | m_DynamicOccludee: 1 428 | m_StaticShadowCaster: 0 429 | m_MotionVectors: 1 430 | m_LightProbeUsage: 1 431 | m_ReflectionProbeUsage: 1 432 | m_RayTracingMode: 2 433 | m_RayTraceProcedural: 0 434 | m_RenderingLayerMask: 1 435 | m_RendererPriority: 0 436 | m_Materials: 437 | - {fileID: 2100000, guid: f0f65b11e799d514eb4f2096516b6aaf, type: 2} 438 | m_StaticBatchInfo: 439 | firstSubMesh: 0 440 | subMeshCount: 0 441 | m_StaticBatchRoot: {fileID: 0} 442 | m_ProbeAnchor: {fileID: 0} 443 | m_LightProbeVolumeOverride: {fileID: 0} 444 | m_ScaleInLightmap: 1 445 | m_ReceiveGI: 1 446 | m_PreserveUVs: 0 447 | m_IgnoreNormalsForChartDetection: 0 448 | m_ImportantGI: 0 449 | m_StitchLightmapSeams: 1 450 | m_SelectedEditorRenderState: 3 451 | m_MinimumChartSize: 4 452 | m_AutoUVMaxDistance: 0.5 453 | m_AutoUVMaxAngle: 89 454 | m_LightmapParameters: {fileID: 0} 455 | m_SortingLayerID: 0 456 | m_SortingLayer: 0 457 | m_SortingOrder: 0 458 | m_AdditionalVertexStreams: {fileID: 0} 459 | --- !u!33 &1015091998 460 | MeshFilter: 461 | m_ObjectHideFlags: 0 462 | m_CorrespondingSourceObject: {fileID: 0} 463 | m_PrefabInstance: {fileID: 0} 464 | m_PrefabAsset: {fileID: 0} 465 | m_GameObject: {fileID: 1015091995} 466 | m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} 467 | --- !u!1 &1374801549 468 | GameObject: 469 | m_ObjectHideFlags: 0 470 | m_CorrespondingSourceObject: {fileID: 0} 471 | m_PrefabInstance: {fileID: 0} 472 | m_PrefabAsset: {fileID: 0} 473 | serializedVersion: 6 474 | m_Component: 475 | - component: {fileID: 1374801553} 476 | - component: {fileID: 1374801552} 477 | - component: {fileID: 1374801551} 478 | m_Layer: 0 479 | m_Name: Plane 480 | m_TagString: Untagged 481 | m_Icon: {fileID: 0} 482 | m_NavMeshLayer: 0 483 | m_StaticEditorFlags: 0 484 | m_IsActive: 1 485 | --- !u!23 &1374801551 486 | MeshRenderer: 487 | m_ObjectHideFlags: 0 488 | m_CorrespondingSourceObject: {fileID: 0} 489 | m_PrefabInstance: {fileID: 0} 490 | m_PrefabAsset: {fileID: 0} 491 | m_GameObject: {fileID: 1374801549} 492 | m_Enabled: 1 493 | m_CastShadows: 1 494 | m_ReceiveShadows: 1 495 | m_DynamicOccludee: 1 496 | m_StaticShadowCaster: 0 497 | m_MotionVectors: 1 498 | m_LightProbeUsage: 1 499 | m_ReflectionProbeUsage: 1 500 | m_RayTracingMode: 2 501 | m_RayTraceProcedural: 0 502 | m_RenderingLayerMask: 1 503 | m_RendererPriority: 0 504 | m_Materials: 505 | - {fileID: 2100000, guid: 0a946540c77014651843a7ea8b477ae6, type: 2} 506 | m_StaticBatchInfo: 507 | firstSubMesh: 0 508 | subMeshCount: 0 509 | m_StaticBatchRoot: {fileID: 0} 510 | m_ProbeAnchor: {fileID: 0} 511 | m_LightProbeVolumeOverride: {fileID: 0} 512 | m_ScaleInLightmap: 1 513 | m_ReceiveGI: 1 514 | m_PreserveUVs: 0 515 | m_IgnoreNormalsForChartDetection: 0 516 | m_ImportantGI: 0 517 | m_StitchLightmapSeams: 1 518 | m_SelectedEditorRenderState: 3 519 | m_MinimumChartSize: 4 520 | m_AutoUVMaxDistance: 0.5 521 | m_AutoUVMaxAngle: 89 522 | m_LightmapParameters: {fileID: 0} 523 | m_SortingLayerID: 0 524 | m_SortingLayer: 0 525 | m_SortingOrder: 0 526 | m_AdditionalVertexStreams: {fileID: 0} 527 | --- !u!33 &1374801552 528 | MeshFilter: 529 | m_ObjectHideFlags: 0 530 | m_CorrespondingSourceObject: {fileID: 0} 531 | m_PrefabInstance: {fileID: 0} 532 | m_PrefabAsset: {fileID: 0} 533 | m_GameObject: {fileID: 1374801549} 534 | m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} 535 | --- !u!4 &1374801553 536 | Transform: 537 | m_ObjectHideFlags: 0 538 | m_CorrespondingSourceObject: {fileID: 0} 539 | m_PrefabInstance: {fileID: 0} 540 | m_PrefabAsset: {fileID: 0} 541 | m_GameObject: {fileID: 1374801549} 542 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 543 | m_LocalPosition: {x: 0, y: 0, z: 0} 544 | m_LocalScale: {x: 1, y: 1, z: 1} 545 | m_ConstrainProportionsScale: 0 546 | m_Children: 547 | - {fileID: 612763422} 548 | - {fileID: 1015091996} 549 | m_Father: {fileID: 0} 550 | m_RootOrder: 1 551 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 552 | --- !u!1 &2065864544 553 | GameObject: 554 | m_ObjectHideFlags: 0 555 | m_CorrespondingSourceObject: {fileID: 0} 556 | m_PrefabInstance: {fileID: 0} 557 | m_PrefabAsset: {fileID: 0} 558 | serializedVersion: 6 559 | m_Component: 560 | - component: {fileID: 2065864546} 561 | - component: {fileID: 2065864545} 562 | m_Layer: 0 563 | m_Name: TestGPUCompression 564 | m_TagString: Untagged 565 | m_Icon: {fileID: 0} 566 | m_NavMeshLayer: 0 567 | m_StaticEditorFlags: 0 568 | m_IsActive: 1 569 | --- !u!114 &2065864545 570 | MonoBehaviour: 571 | m_ObjectHideFlags: 0 572 | m_CorrespondingSourceObject: {fileID: 0} 573 | m_PrefabInstance: {fileID: 0} 574 | m_PrefabAsset: {fileID: 0} 575 | m_GameObject: {fileID: 2065864544} 576 | m_Enabled: 1 577 | m_EditorHideFlags: 0 578 | m_Script: {fileID: 11500000, guid: c0e2479420267494599fcee0b9f4a31b, type: 3} 579 | m_Name: 580 | m_EditorClassIdentifier: 581 | m_SourceTexture: {fileID: 8400000, guid: 17741c07cfd6f4c29860a6143c77cae1, type: 2} 582 | m_Format: 3 583 | m_Quality: 0.25 584 | m_EncodeShader: {fileID: 7200000, guid: 876d69c76537649d180b4cc47db2d35c, type: 3} 585 | m_RMSEShader: {fileID: 7200000, guid: 32471e8bf4ae541af82c44f322796de2, type: 3} 586 | m_BlitMaterial: {fileID: 2100000, guid: 3823dc36f697a4f80b14a7c19cb29647, type: 2} 587 | m_ObjectToRotate: {fileID: 1374801553} 588 | m_Rotate: 1 589 | --- !u!4 &2065864546 590 | Transform: 591 | m_ObjectHideFlags: 0 592 | m_CorrespondingSourceObject: {fileID: 0} 593 | m_PrefabInstance: {fileID: 0} 594 | m_PrefabAsset: {fileID: 0} 595 | m_GameObject: {fileID: 2065864544} 596 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 597 | m_LocalPosition: {x: 0, y: 0.69000006, z: 0} 598 | m_LocalScale: {x: 1, y: 1, z: 1} 599 | m_ConstrainProportionsScale: 0 600 | m_Children: [] 601 | m_Father: {fileID: 0} 602 | m_RootOrder: 3 603 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 604 | -------------------------------------------------------------------------------- /Assets/TestGPUTexCompressionScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9fc0d4010bbf28b4594072e72b8655ab 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/TexGradient1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aras-p/UnityGPUTexCompression/4bdbaa00623943b670805d22955c26b50070831d/Assets/TexGradient1.png -------------------------------------------------------------------------------- /Assets/TexGradient1.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9464e719047c34926995a97235334ecf 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 12 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | flipGreenChannel: 0 24 | isReadable: 0 25 | streamingMipmaps: 0 26 | streamingMipmapsPriority: 0 27 | vTOnly: 0 28 | ignoreMipmapLimit: 0 29 | grayScaleToAlpha: 0 30 | generateCubemap: 6 31 | cubemapConvolution: 0 32 | seamlessCubemap: 0 33 | textureFormat: 1 34 | maxTextureSize: 2048 35 | textureSettings: 36 | serializedVersion: 2 37 | filterMode: 1 38 | aniso: 1 39 | mipBias: 0 40 | wrapU: 0 41 | wrapV: 0 42 | wrapW: 0 43 | nPOTScale: 1 44 | lightmap: 0 45 | compressionQuality: 50 46 | spriteMode: 0 47 | spriteExtrude: 1 48 | spriteMeshType: 1 49 | alignment: 0 50 | spritePivot: {x: 0.5, y: 0.5} 51 | spritePixelsToUnits: 100 52 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 53 | spriteGenerateFallbackPhysicsShape: 1 54 | alphaUsage: 2 55 | alphaIsTransparency: 0 56 | spriteTessellationDetail: -1 57 | textureType: 0 58 | textureShape: 1 59 | singleChannelComponent: 0 60 | flipbookRows: 1 61 | flipbookColumns: 1 62 | maxTextureSizeSet: 0 63 | compressionQualitySet: 0 64 | textureFormatSet: 0 65 | ignorePngGamma: 0 66 | applyGammaDecoding: 0 67 | swizzle: 50462976 68 | cookieLightType: 0 69 | platformSettings: 70 | - serializedVersion: 3 71 | buildTarget: DefaultTexturePlatform 72 | maxTextureSize: 2048 73 | resizeAlgorithm: 0 74 | textureFormat: -1 75 | textureCompression: 0 76 | compressionQuality: 50 77 | crunchedCompression: 0 78 | allowsAlphaSplitting: 0 79 | overridden: 0 80 | ignorePlatformSupport: 0 81 | androidETC2FallbackOverride: 0 82 | forceMaximumCompressionQuality_BC6H_BC7: 0 83 | - serializedVersion: 3 84 | buildTarget: Standalone 85 | maxTextureSize: 2048 86 | resizeAlgorithm: 0 87 | textureFormat: -1 88 | textureCompression: 1 89 | compressionQuality: 50 90 | crunchedCompression: 0 91 | allowsAlphaSplitting: 0 92 | overridden: 0 93 | ignorePlatformSupport: 0 94 | androidETC2FallbackOverride: 0 95 | forceMaximumCompressionQuality_BC6H_BC7: 0 96 | - serializedVersion: 3 97 | buildTarget: Server 98 | maxTextureSize: 2048 99 | resizeAlgorithm: 0 100 | textureFormat: -1 101 | textureCompression: 1 102 | compressionQuality: 50 103 | crunchedCompression: 0 104 | allowsAlphaSplitting: 0 105 | overridden: 0 106 | ignorePlatformSupport: 0 107 | androidETC2FallbackOverride: 0 108 | forceMaximumCompressionQuality_BC6H_BC7: 0 109 | spriteSheet: 110 | serializedVersion: 2 111 | sprites: [] 112 | outline: [] 113 | physicsShape: [] 114 | bones: [] 115 | spriteID: 116 | internalID: 0 117 | vertices: [] 118 | indices: 119 | edges: [] 120 | weights: [] 121 | secondaryTextures: [] 122 | nameFileIdTable: {} 123 | mipmapLimitGroupName: 124 | pSDRemoveMatte: 0 125 | userData: 126 | assetBundleName: 127 | assetBundleVariant: 128 | -------------------------------------------------------------------------------- /Assets/TexGradient2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aras-p/UnityGPUTexCompression/4bdbaa00623943b670805d22955c26b50070831d/Assets/TexGradient2.png -------------------------------------------------------------------------------- /Assets/TexGradient2.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a6b49341d64a47f4e9f4e9091f50a067 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 12 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | flipGreenChannel: 0 24 | isReadable: 0 25 | streamingMipmaps: 0 26 | streamingMipmapsPriority: 0 27 | vTOnly: 0 28 | ignoreMipmapLimit: 0 29 | grayScaleToAlpha: 0 30 | generateCubemap: 6 31 | cubemapConvolution: 0 32 | seamlessCubemap: 0 33 | textureFormat: 1 34 | maxTextureSize: 2048 35 | textureSettings: 36 | serializedVersion: 2 37 | filterMode: 1 38 | aniso: 1 39 | mipBias: 0 40 | wrapU: 0 41 | wrapV: 0 42 | wrapW: 0 43 | nPOTScale: 1 44 | lightmap: 0 45 | compressionQuality: 50 46 | spriteMode: 0 47 | spriteExtrude: 1 48 | spriteMeshType: 1 49 | alignment: 0 50 | spritePivot: {x: 0.5, y: 0.5} 51 | spritePixelsToUnits: 100 52 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 53 | spriteGenerateFallbackPhysicsShape: 1 54 | alphaUsage: 2 55 | alphaIsTransparency: 0 56 | spriteTessellationDetail: -1 57 | textureType: 0 58 | textureShape: 1 59 | singleChannelComponent: 0 60 | flipbookRows: 1 61 | flipbookColumns: 1 62 | maxTextureSizeSet: 0 63 | compressionQualitySet: 0 64 | textureFormatSet: 0 65 | ignorePngGamma: 0 66 | applyGammaDecoding: 0 67 | swizzle: 50462976 68 | cookieLightType: 0 69 | platformSettings: 70 | - serializedVersion: 3 71 | buildTarget: DefaultTexturePlatform 72 | maxTextureSize: 2048 73 | resizeAlgorithm: 0 74 | textureFormat: -1 75 | textureCompression: 0 76 | compressionQuality: 50 77 | crunchedCompression: 0 78 | allowsAlphaSplitting: 0 79 | overridden: 0 80 | ignorePlatformSupport: 0 81 | androidETC2FallbackOverride: 0 82 | forceMaximumCompressionQuality_BC6H_BC7: 0 83 | - serializedVersion: 3 84 | buildTarget: Standalone 85 | maxTextureSize: 2048 86 | resizeAlgorithm: 0 87 | textureFormat: -1 88 | textureCompression: 1 89 | compressionQuality: 50 90 | crunchedCompression: 0 91 | allowsAlphaSplitting: 0 92 | overridden: 0 93 | ignorePlatformSupport: 0 94 | androidETC2FallbackOverride: 0 95 | forceMaximumCompressionQuality_BC6H_BC7: 0 96 | - serializedVersion: 3 97 | buildTarget: Server 98 | maxTextureSize: 2048 99 | resizeAlgorithm: 0 100 | textureFormat: -1 101 | textureCompression: 1 102 | compressionQuality: 50 103 | crunchedCompression: 0 104 | allowsAlphaSplitting: 0 105 | overridden: 0 106 | ignorePlatformSupport: 0 107 | androidETC2FallbackOverride: 0 108 | forceMaximumCompressionQuality_BC6H_BC7: 0 109 | spriteSheet: 110 | serializedVersion: 2 111 | sprites: [] 112 | outline: [] 113 | physicsShape: [] 114 | bones: [] 115 | spriteID: 116 | internalID: 0 117 | vertices: [] 118 | indices: 119 | edges: [] 120 | weights: [] 121 | secondaryTextures: [] 122 | nameFileIdTable: {} 123 | mipmapLimitGroupName: 124 | pSDRemoveMatte: 0 125 | userData: 126 | assetBundleName: 127 | assetBundleVariant: 128 | -------------------------------------------------------------------------------- /Assets/TexNoise.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aras-p/UnityGPUTexCompression/4bdbaa00623943b670805d22955c26b50070831d/Assets/TexNoise.tga -------------------------------------------------------------------------------- /Assets/TexNoise.tga.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7525456b364a24615821964ecf2d8b40 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 12 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | flipGreenChannel: 0 24 | isReadable: 0 25 | streamingMipmaps: 0 26 | streamingMipmapsPriority: 0 27 | vTOnly: 0 28 | ignoreMipmapLimit: 0 29 | grayScaleToAlpha: 0 30 | generateCubemap: 6 31 | cubemapConvolution: 0 32 | seamlessCubemap: 0 33 | textureFormat: 1 34 | maxTextureSize: 2048 35 | textureSettings: 36 | serializedVersion: 2 37 | filterMode: 1 38 | aniso: 1 39 | mipBias: 0 40 | wrapU: 0 41 | wrapV: 0 42 | wrapW: 0 43 | nPOTScale: 1 44 | lightmap: 0 45 | compressionQuality: 50 46 | spriteMode: 0 47 | spriteExtrude: 1 48 | spriteMeshType: 1 49 | alignment: 0 50 | spritePivot: {x: 0.5, y: 0.5} 51 | spritePixelsToUnits: 100 52 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 53 | spriteGenerateFallbackPhysicsShape: 1 54 | alphaUsage: 1 55 | alphaIsTransparency: 0 56 | spriteTessellationDetail: -1 57 | textureType: 0 58 | textureShape: 1 59 | singleChannelComponent: 0 60 | flipbookRows: 1 61 | flipbookColumns: 1 62 | maxTextureSizeSet: 0 63 | compressionQualitySet: 0 64 | textureFormatSet: 0 65 | ignorePngGamma: 0 66 | applyGammaDecoding: 0 67 | swizzle: 50462976 68 | cookieLightType: 0 69 | platformSettings: 70 | - serializedVersion: 3 71 | buildTarget: DefaultTexturePlatform 72 | maxTextureSize: 2048 73 | resizeAlgorithm: 0 74 | textureFormat: -1 75 | textureCompression: 0 76 | compressionQuality: 50 77 | crunchedCompression: 0 78 | allowsAlphaSplitting: 0 79 | overridden: 0 80 | ignorePlatformSupport: 0 81 | androidETC2FallbackOverride: 0 82 | forceMaximumCompressionQuality_BC6H_BC7: 0 83 | - serializedVersion: 3 84 | buildTarget: Standalone 85 | maxTextureSize: 2048 86 | resizeAlgorithm: 0 87 | textureFormat: -1 88 | textureCompression: 1 89 | compressionQuality: 50 90 | crunchedCompression: 0 91 | allowsAlphaSplitting: 0 92 | overridden: 0 93 | ignorePlatformSupport: 0 94 | androidETC2FallbackOverride: 0 95 | forceMaximumCompressionQuality_BC6H_BC7: 0 96 | - serializedVersion: 3 97 | buildTarget: Server 98 | maxTextureSize: 2048 99 | resizeAlgorithm: 0 100 | textureFormat: -1 101 | textureCompression: 1 102 | compressionQuality: 50 103 | crunchedCompression: 0 104 | allowsAlphaSplitting: 0 105 | overridden: 0 106 | ignorePlatformSupport: 0 107 | androidETC2FallbackOverride: 0 108 | forceMaximumCompressionQuality_BC6H_BC7: 0 109 | spriteSheet: 110 | serializedVersion: 2 111 | sprites: [] 112 | outline: [] 113 | physicsShape: [] 114 | bones: [] 115 | spriteID: 116 | internalID: 0 117 | vertices: [] 118 | indices: 119 | edges: [] 120 | weights: [] 121 | secondaryTextures: [] 122 | nameFileIdTable: {} 123 | mipmapLimitGroupName: 124 | pSDRemoveMatte: 0 125 | userData: 126 | assetBundleName: 127 | assetBundleVariant: 128 | -------------------------------------------------------------------------------- /Assets/UnlitTexture.shader: -------------------------------------------------------------------------------- 1 | Shader "Unlit/UnlitTexture" 2 | { 3 | Properties 4 | { 5 | _MainTex ("Texture", 2D) = "white" {} 6 | } 7 | SubShader 8 | { 9 | Tags { "RenderType"="Opaque" } 10 | LOD 100 11 | 12 | Pass 13 | { 14 | CGPROGRAM 15 | #pragma vertex vert 16 | #pragma fragment frag 17 | 18 | #include "UnityCG.cginc" 19 | 20 | struct appdata 21 | { 22 | float4 vertex : POSITION; 23 | float2 uv : TEXCOORD0; 24 | }; 25 | 26 | struct v2f 27 | { 28 | float2 uv : TEXCOORD0; 29 | float4 vertex : SV_POSITION; 30 | }; 31 | 32 | sampler2D _MainTex; 33 | float4 _MainTex_ST; 34 | 35 | v2f vert (appdata v) 36 | { 37 | v2f o; 38 | o.vertex = UnityObjectToClipPos(v.vertex); 39 | o.uv = TRANSFORM_TEX(v.uv, _MainTex); 40 | return o; 41 | } 42 | 43 | half4 frag (v2f i) : SV_Target 44 | { 45 | return tex2D(_MainTex, i.uv); 46 | } 47 | ENDCG 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Assets/UnlitTexture.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fe2d1da6dffcf4653ab3ed0d242e25c1 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.ide.rider": "3.0.24", 4 | "com.unity.modules.ai": "1.0.0", 5 | "com.unity.modules.androidjni": "1.0.0", 6 | "com.unity.modules.animation": "1.0.0", 7 | "com.unity.modules.assetbundle": "1.0.0", 8 | "com.unity.modules.audio": "1.0.0", 9 | "com.unity.modules.cloth": "1.0.0", 10 | "com.unity.modules.director": "1.0.0", 11 | "com.unity.modules.imageconversion": "1.0.0", 12 | "com.unity.modules.imgui": "1.0.0", 13 | "com.unity.modules.jsonserialize": "1.0.0", 14 | "com.unity.modules.particlesystem": "1.0.0", 15 | "com.unity.modules.physics": "1.0.0", 16 | "com.unity.modules.physics2d": "1.0.0", 17 | "com.unity.modules.screencapture": "1.0.0", 18 | "com.unity.modules.terrain": "1.0.0", 19 | "com.unity.modules.terrainphysics": "1.0.0", 20 | "com.unity.modules.tilemap": "1.0.0", 21 | "com.unity.modules.ui": "1.0.0", 22 | "com.unity.modules.uielements": "1.0.0", 23 | "com.unity.modules.umbra": "1.0.0", 24 | "com.unity.modules.unityanalytics": "1.0.0", 25 | "com.unity.modules.unitywebrequest": "1.0.0", 26 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 27 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 28 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 29 | "com.unity.modules.unitywebrequestwww": "1.0.0", 30 | "com.unity.modules.vehicles": "1.0.0", 31 | "com.unity.modules.video": "1.0.0", 32 | "com.unity.modules.vr": "1.0.0", 33 | "com.unity.modules.wind": "1.0.0", 34 | "com.unity.modules.xr": "1.0.0" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Packages/packages-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.ext.nunit": { 4 | "version": "1.0.6", 5 | "depth": 1, 6 | "source": "registry", 7 | "dependencies": {}, 8 | "url": "https://packages.unity.com" 9 | }, 10 | "com.unity.ide.rider": { 11 | "version": "3.0.24", 12 | "depth": 0, 13 | "source": "registry", 14 | "dependencies": { 15 | "com.unity.ext.nunit": "1.0.6" 16 | }, 17 | "url": "https://packages.unity.com" 18 | }, 19 | "com.unity.modules.ai": { 20 | "version": "1.0.0", 21 | "depth": 0, 22 | "source": "builtin", 23 | "dependencies": {} 24 | }, 25 | "com.unity.modules.androidjni": { 26 | "version": "1.0.0", 27 | "depth": 0, 28 | "source": "builtin", 29 | "dependencies": {} 30 | }, 31 | "com.unity.modules.animation": { 32 | "version": "1.0.0", 33 | "depth": 0, 34 | "source": "builtin", 35 | "dependencies": {} 36 | }, 37 | "com.unity.modules.assetbundle": { 38 | "version": "1.0.0", 39 | "depth": 0, 40 | "source": "builtin", 41 | "dependencies": {} 42 | }, 43 | "com.unity.modules.audio": { 44 | "version": "1.0.0", 45 | "depth": 0, 46 | "source": "builtin", 47 | "dependencies": {} 48 | }, 49 | "com.unity.modules.cloth": { 50 | "version": "1.0.0", 51 | "depth": 0, 52 | "source": "builtin", 53 | "dependencies": { 54 | "com.unity.modules.physics": "1.0.0" 55 | } 56 | }, 57 | "com.unity.modules.director": { 58 | "version": "1.0.0", 59 | "depth": 0, 60 | "source": "builtin", 61 | "dependencies": { 62 | "com.unity.modules.audio": "1.0.0", 63 | "com.unity.modules.animation": "1.0.0" 64 | } 65 | }, 66 | "com.unity.modules.imageconversion": { 67 | "version": "1.0.0", 68 | "depth": 0, 69 | "source": "builtin", 70 | "dependencies": {} 71 | }, 72 | "com.unity.modules.imgui": { 73 | "version": "1.0.0", 74 | "depth": 0, 75 | "source": "builtin", 76 | "dependencies": {} 77 | }, 78 | "com.unity.modules.jsonserialize": { 79 | "version": "1.0.0", 80 | "depth": 0, 81 | "source": "builtin", 82 | "dependencies": {} 83 | }, 84 | "com.unity.modules.particlesystem": { 85 | "version": "1.0.0", 86 | "depth": 0, 87 | "source": "builtin", 88 | "dependencies": {} 89 | }, 90 | "com.unity.modules.physics": { 91 | "version": "1.0.0", 92 | "depth": 0, 93 | "source": "builtin", 94 | "dependencies": {} 95 | }, 96 | "com.unity.modules.physics2d": { 97 | "version": "1.0.0", 98 | "depth": 0, 99 | "source": "builtin", 100 | "dependencies": {} 101 | }, 102 | "com.unity.modules.screencapture": { 103 | "version": "1.0.0", 104 | "depth": 0, 105 | "source": "builtin", 106 | "dependencies": { 107 | "com.unity.modules.imageconversion": "1.0.0" 108 | } 109 | }, 110 | "com.unity.modules.subsystems": { 111 | "version": "1.0.0", 112 | "depth": 1, 113 | "source": "builtin", 114 | "dependencies": { 115 | "com.unity.modules.jsonserialize": "1.0.0" 116 | } 117 | }, 118 | "com.unity.modules.terrain": { 119 | "version": "1.0.0", 120 | "depth": 0, 121 | "source": "builtin", 122 | "dependencies": {} 123 | }, 124 | "com.unity.modules.terrainphysics": { 125 | "version": "1.0.0", 126 | "depth": 0, 127 | "source": "builtin", 128 | "dependencies": { 129 | "com.unity.modules.physics": "1.0.0", 130 | "com.unity.modules.terrain": "1.0.0" 131 | } 132 | }, 133 | "com.unity.modules.tilemap": { 134 | "version": "1.0.0", 135 | "depth": 0, 136 | "source": "builtin", 137 | "dependencies": { 138 | "com.unity.modules.physics2d": "1.0.0" 139 | } 140 | }, 141 | "com.unity.modules.ui": { 142 | "version": "1.0.0", 143 | "depth": 0, 144 | "source": "builtin", 145 | "dependencies": {} 146 | }, 147 | "com.unity.modules.uielements": { 148 | "version": "1.0.0", 149 | "depth": 0, 150 | "source": "builtin", 151 | "dependencies": { 152 | "com.unity.modules.ui": "1.0.0", 153 | "com.unity.modules.imgui": "1.0.0", 154 | "com.unity.modules.jsonserialize": "1.0.0" 155 | } 156 | }, 157 | "com.unity.modules.umbra": { 158 | "version": "1.0.0", 159 | "depth": 0, 160 | "source": "builtin", 161 | "dependencies": {} 162 | }, 163 | "com.unity.modules.unityanalytics": { 164 | "version": "1.0.0", 165 | "depth": 0, 166 | "source": "builtin", 167 | "dependencies": { 168 | "com.unity.modules.unitywebrequest": "1.0.0", 169 | "com.unity.modules.jsonserialize": "1.0.0" 170 | } 171 | }, 172 | "com.unity.modules.unitywebrequest": { 173 | "version": "1.0.0", 174 | "depth": 0, 175 | "source": "builtin", 176 | "dependencies": {} 177 | }, 178 | "com.unity.modules.unitywebrequestassetbundle": { 179 | "version": "1.0.0", 180 | "depth": 0, 181 | "source": "builtin", 182 | "dependencies": { 183 | "com.unity.modules.assetbundle": "1.0.0", 184 | "com.unity.modules.unitywebrequest": "1.0.0" 185 | } 186 | }, 187 | "com.unity.modules.unitywebrequestaudio": { 188 | "version": "1.0.0", 189 | "depth": 0, 190 | "source": "builtin", 191 | "dependencies": { 192 | "com.unity.modules.unitywebrequest": "1.0.0", 193 | "com.unity.modules.audio": "1.0.0" 194 | } 195 | }, 196 | "com.unity.modules.unitywebrequesttexture": { 197 | "version": "1.0.0", 198 | "depth": 0, 199 | "source": "builtin", 200 | "dependencies": { 201 | "com.unity.modules.unitywebrequest": "1.0.0", 202 | "com.unity.modules.imageconversion": "1.0.0" 203 | } 204 | }, 205 | "com.unity.modules.unitywebrequestwww": { 206 | "version": "1.0.0", 207 | "depth": 0, 208 | "source": "builtin", 209 | "dependencies": { 210 | "com.unity.modules.unitywebrequest": "1.0.0", 211 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 212 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 213 | "com.unity.modules.audio": "1.0.0", 214 | "com.unity.modules.assetbundle": "1.0.0", 215 | "com.unity.modules.imageconversion": "1.0.0" 216 | } 217 | }, 218 | "com.unity.modules.vehicles": { 219 | "version": "1.0.0", 220 | "depth": 0, 221 | "source": "builtin", 222 | "dependencies": { 223 | "com.unity.modules.physics": "1.0.0" 224 | } 225 | }, 226 | "com.unity.modules.video": { 227 | "version": "1.0.0", 228 | "depth": 0, 229 | "source": "builtin", 230 | "dependencies": { 231 | "com.unity.modules.audio": "1.0.0", 232 | "com.unity.modules.ui": "1.0.0", 233 | "com.unity.modules.unitywebrequest": "1.0.0" 234 | } 235 | }, 236 | "com.unity.modules.vr": { 237 | "version": "1.0.0", 238 | "depth": 0, 239 | "source": "builtin", 240 | "dependencies": { 241 | "com.unity.modules.jsonserialize": "1.0.0", 242 | "com.unity.modules.physics": "1.0.0", 243 | "com.unity.modules.xr": "1.0.0" 244 | } 245 | }, 246 | "com.unity.modules.wind": { 247 | "version": "1.0.0", 248 | "depth": 0, 249 | "source": "builtin", 250 | "dependencies": {} 251 | }, 252 | "com.unity.modules.xr": { 253 | "version": "1.0.0", 254 | "depth": 0, 255 | "source": "builtin", 256 | "dependencies": { 257 | "com.unity.modules.physics": "1.0.0", 258 | "com.unity.modules.jsonserialize": "1.0.0", 259 | "com.unity.modules.subsystems": "1.0.0" 260 | } 261 | } 262 | } 263 | } 264 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Volume: 1 8 | Rolloff Scale: 1 9 | Doppler Factor: 1 10 | Default Speaker Mode: 2 11 | m_SampleRate: 0 12 | m_DSPBufferSize: 1024 13 | m_VirtualVoiceCount: 512 14 | m_RealVoiceCount: 32 15 | m_SpatializerPlugin: 16 | m_AmbisonicDecoderPlugin: 17 | m_DisableAudio: 0 18 | m_VirtualizeEffects: 1 19 | m_RequestedDSPBufferSize: 1024 20 | -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 11 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_ClothInterCollisionDistance: 0 18 | m_ClothInterCollisionStiffness: 0 19 | m_ContactsGeneration: 1 20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 0 23 | m_ReuseCollisionCallbacks: 1 24 | m_ClothInterCollisionSettingsToggle: 0 25 | m_ContactPairsMode: 0 26 | m_BroadphaseType: 0 27 | m_WorldBounds: 28 | m_Center: {x: 0, y: 0, z: 0} 29 | m_Extent: {x: 250, y: 250, z: 250} 30 | m_WorldSubdivisions: 8 31 | m_FrictionType: 0 32 | m_EnableEnhancedDeterminism: 0 33 | m_EnableUnifiedHeightmaps: 1 34 | m_DefaultMaxAngluarSpeed: 7 35 | -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: [] 8 | m_configObjects: {} 9 | -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 11 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_LineEndingsForNewScripts: 0 10 | m_DefaultBehaviorMode: 0 11 | m_PrefabRegularEnvironment: {fileID: 0} 12 | m_PrefabUIEnvironment: {fileID: 0} 13 | m_SpritePackerMode: 0 14 | m_SpritePackerPaddingPower: 1 15 | m_EtcTextureCompressorBehavior: 1 16 | m_EtcTextureFastCompressor: 1 17 | m_EtcTextureNormalCompressor: 2 18 | m_EtcTextureBestCompressor: 4 19 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp;asmref 20 | m_ProjectGenerationRootNamespace: 21 | m_CollabEditorSettings: 22 | inProgressEnabled: 1 23 | m_EnableTextureStreamingInEditMode: 1 24 | m_EnableTextureStreamingInPlayMode: 1 25 | m_AsyncShaderCompilation: 1 26 | m_EnterPlayModeOptionsEnabled: 0 27 | m_EnterPlayModeOptions: 3 28 | m_ShowLightmapResolutionOverlay: 1 29 | m_UseLegacyProbeSampleCount: 0 30 | m_SerializeInlineMappingsOnOneLine: 1 31 | -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 13 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | m_PreloadedShaders: [] 39 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 40 | type: 0} 41 | m_CustomRenderPipeline: {fileID: 0} 42 | m_TransparencySortMode: 0 43 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 44 | m_DefaultRenderingPath: 1 45 | m_DefaultMobileRenderingPath: 1 46 | m_TierSettings: [] 47 | m_LightmapStripping: 0 48 | m_FogStripping: 0 49 | m_InstancingStripping: 0 50 | m_LightmapKeepPlain: 1 51 | m_LightmapKeepDirCombined: 1 52 | m_LightmapKeepDynamicPlain: 1 53 | m_LightmapKeepDynamicDirCombined: 1 54 | m_LightmapKeepShadowMask: 1 55 | m_LightmapKeepSubtractive: 1 56 | m_FogKeepLinear: 1 57 | m_FogKeepExp: 1 58 | m_FogKeepExp2: 1 59 | m_AlbedoSwatchInfos: [] 60 | m_LightsUseLinearIntensity: 0 61 | m_LightsUseColorTemperature: 0 62 | m_LogWhenShaderIsCompiled: 0 63 | m_AllowEnlightenSupportForUpgradedProject: 0 64 | -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /ProjectSettings/MemorySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!387306366 &1 4 | MemorySettings: 5 | m_ObjectHideFlags: 0 6 | m_EditorMemorySettings: 7 | m_MainAllocatorBlockSize: -1 8 | m_ThreadAllocatorBlockSize: -1 9 | m_MainGfxBlockSize: -1 10 | m_ThreadGfxBlockSize: -1 11 | m_CacheBlockSize: -1 12 | m_TypetreeBlockSize: -1 13 | m_ProfilerBlockSize: -1 14 | m_ProfilerEditorBlockSize: -1 15 | m_BucketAllocatorGranularity: -1 16 | m_BucketAllocatorBucketsCount: -1 17 | m_BucketAllocatorBlockSize: -1 18 | m_BucketAllocatorBlockCount: -1 19 | m_ProfilerBucketAllocatorGranularity: -1 20 | m_ProfilerBucketAllocatorBucketsCount: -1 21 | m_ProfilerBucketAllocatorBlockSize: -1 22 | m_ProfilerBucketAllocatorBlockCount: -1 23 | m_TempAllocatorSizeMain: -1 24 | m_JobTempAllocatorBlockSize: -1 25 | m_BackgroundJobTempAllocatorBlockSize: -1 26 | m_JobTempAllocatorReducedBlockSize: -1 27 | m_TempAllocatorSizeGIBakingWorker: -1 28 | m_TempAllocatorSizeNavMeshWorker: -1 29 | m_TempAllocatorSizeAudioWorker: -1 30 | m_TempAllocatorSizeCloudWorker: -1 31 | m_TempAllocatorSizeGfx: -1 32 | m_TempAllocatorSizeJobWorker: -1 33 | m_TempAllocatorSizeBackgroundWorker: -1 34 | m_TempAllocatorSizePreloadManager: -1 35 | m_PlatformMemorySettings: {} 36 | -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /ProjectSettings/PackageManagerSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &1 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 61 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | m_EnablePreReleasePackages: 0 16 | m_EnablePackageDependencies: 0 17 | m_AdvancedSettingsExpanded: 1 18 | m_ScopedRegistriesSettingsExpanded: 1 19 | m_SeeAllPackageVersions: 0 20 | oneTimeWarningShown: 0 21 | m_Registries: 22 | - m_Id: main 23 | m_Name: 24 | m_Url: https://packages.unity.com 25 | m_Scopes: [] 26 | m_IsDefault: 1 27 | m_Capabilities: 7 28 | m_UserSelectedRegistryName: 29 | m_UserAddingNewScopedRegistry: 0 30 | m_RegistryInfoDraft: 31 | m_Modified: 0 32 | m_ErrorMessage: 33 | m_UserModificationsInstanceId: -830 34 | m_OriginalInstanceId: -832 35 | m_LoadAssets: 0 36 | -------------------------------------------------------------------------------- /ProjectSettings/Packages/com.unity.testtools.codecoverage/Settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "m_Dictionary": { 3 | "m_DictionaryValues": [] 4 | } 5 | } -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 4 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_JobOptions: 23 | serializedVersion: 2 24 | useMultithreading: 0 25 | useConsistencySorting: 0 26 | m_InterpolationPosesPerJob: 100 27 | m_NewContactsPerJob: 30 28 | m_CollideContactsPerJob: 100 29 | m_ClearFlagsPerJob: 200 30 | m_ClearBodyForcesPerJob: 200 31 | m_SyncDiscreteFixturesPerJob: 50 32 | m_SyncContinuousFixturesPerJob: 50 33 | m_FindNearestContactsPerJob: 100 34 | m_UpdateTriggerContactsPerJob: 100 35 | m_IslandSolverCostThreshold: 100 36 | m_IslandSolverBodyCostScale: 1 37 | m_IslandSolverContactCostScale: 10 38 | m_IslandSolverJointCostScale: 10 39 | m_IslandSolverBodiesPerJob: 50 40 | m_IslandSolverContactsPerJob: 50 41 | m_AutoSimulation: 1 42 | m_QueriesHitTriggers: 1 43 | m_QueriesStartInColliders: 1 44 | m_CallbacksOnDisable: 1 45 | m_ReuseCollisionCallbacks: 1 46 | m_AutoSyncTransforms: 0 47 | m_AlwaysShowColliders: 0 48 | m_ShowColliderSleep: 1 49 | m_ShowColliderContacts: 0 50 | m_ShowColliderAABB: 0 51 | m_ContactArrowScale: 0.2 52 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 53 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 54 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 55 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 56 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 57 | -------------------------------------------------------------------------------- /ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_DefaultPresets: {} 8 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!129 &1 4 | PlayerSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 26 7 | productGUID: ad829496f42434ae9879482ceab328b7 8 | AndroidProfiler: 0 9 | AndroidFilterTouchesWhenObscured: 0 10 | AndroidEnableSustainedPerformanceMode: 0 11 | defaultScreenOrientation: 4 12 | targetDevice: 2 13 | useOnDemandResources: 0 14 | accelerometerFrequency: 60 15 | companyName: DefaultCompany 16 | productName: UnityGPUTexCompression 17 | defaultCursor: {fileID: 0} 18 | cursorHotspot: {x: 0, y: 0} 19 | m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1} 20 | m_ShowUnitySplashScreen: 1 21 | m_ShowUnitySplashLogo: 1 22 | m_SplashScreenOverlayOpacity: 1 23 | m_SplashScreenAnimation: 1 24 | m_SplashScreenLogoStyle: 1 25 | m_SplashScreenDrawMode: 0 26 | m_SplashScreenBackgroundAnimationZoom: 1 27 | m_SplashScreenLogoAnimationZoom: 1 28 | m_SplashScreenBackgroundLandscapeAspect: 1 29 | m_SplashScreenBackgroundPortraitAspect: 1 30 | m_SplashScreenBackgroundLandscapeUvs: 31 | serializedVersion: 2 32 | x: 0 33 | y: 0 34 | width: 1 35 | height: 1 36 | m_SplashScreenBackgroundPortraitUvs: 37 | serializedVersion: 2 38 | x: 0 39 | y: 0 40 | width: 1 41 | height: 1 42 | m_SplashScreenLogos: [] 43 | m_VirtualRealitySplashScreen: {fileID: 0} 44 | m_HolographicTrackingLossScreen: {fileID: 0} 45 | defaultScreenWidth: 1920 46 | defaultScreenHeight: 1080 47 | defaultScreenWidthWeb: 960 48 | defaultScreenHeightWeb: 600 49 | m_StereoRenderingPath: 0 50 | m_ActiveColorSpace: 1 51 | m_SpriteBatchVertexThreshold: 300 52 | m_MTRendering: 1 53 | mipStripping: 0 54 | numberOfMipsStripped: 0 55 | numberOfMipsStrippedPerMipmapLimitGroup: {} 56 | m_StackTraceTypes: 010000000100000001000000010000000100000001000000 57 | iosShowActivityIndicatorOnLoading: -1 58 | androidShowActivityIndicatorOnLoading: -1 59 | iosUseCustomAppBackgroundBehavior: 0 60 | allowedAutorotateToPortrait: 1 61 | allowedAutorotateToPortraitUpsideDown: 1 62 | allowedAutorotateToLandscapeRight: 1 63 | allowedAutorotateToLandscapeLeft: 1 64 | useOSAutorotation: 1 65 | use32BitDisplayBuffer: 1 66 | preserveFramebufferAlpha: 0 67 | disableDepthAndStencilBuffers: 0 68 | androidStartInFullscreen: 1 69 | androidRenderOutsideSafeArea: 1 70 | androidUseSwappy: 1 71 | androidBlitType: 0 72 | androidResizableWindow: 0 73 | androidDefaultWindowWidth: 1920 74 | androidDefaultWindowHeight: 1080 75 | androidMinimumWindowWidth: 400 76 | androidMinimumWindowHeight: 300 77 | androidFullscreenMode: 1 78 | defaultIsNativeResolution: 1 79 | macRetinaSupport: 1 80 | runInBackground: 1 81 | captureSingleScreen: 0 82 | muteOtherAudioSources: 0 83 | Prepare IOS For Recording: 0 84 | Force IOS Speakers When Recording: 0 85 | deferSystemGesturesMode: 0 86 | hideHomeButton: 0 87 | submitAnalytics: 1 88 | usePlayerLog: 1 89 | bakeCollisionMeshes: 0 90 | forceSingleInstance: 0 91 | useFlipModelSwapchain: 1 92 | resizableWindow: 0 93 | useMacAppStoreValidation: 0 94 | macAppStoreCategory: public.app-category.games 95 | gpuSkinning: 1 96 | xboxPIXTextureCapture: 0 97 | xboxEnableAvatar: 0 98 | xboxEnableKinect: 0 99 | xboxEnableKinectAutoTracking: 0 100 | xboxEnableFitness: 0 101 | visibleInBackground: 1 102 | allowFullscreenSwitch: 1 103 | fullscreenMode: 1 104 | xboxSpeechDB: 0 105 | xboxEnableHeadOrientation: 0 106 | xboxEnableGuest: 0 107 | xboxEnablePIXSampling: 0 108 | metalFramebufferOnly: 0 109 | xboxOneResolution: 0 110 | xboxOneSResolution: 0 111 | xboxOneXResolution: 3 112 | xboxOneMonoLoggingLevel: 0 113 | xboxOneLoggingLevel: 1 114 | xboxOneDisableEsram: 0 115 | xboxOneEnableTypeOptimization: 0 116 | xboxOnePresentImmediateThreshold: 0 117 | switchQueueCommandMemory: 0 118 | switchQueueControlMemory: 16384 119 | switchQueueComputeMemory: 262144 120 | switchNVNShaderPoolsGranularity: 33554432 121 | switchNVNDefaultPoolsGranularity: 16777216 122 | switchNVNOtherPoolsGranularity: 16777216 123 | switchGpuScratchPoolGranularity: 2097152 124 | switchAllowGpuScratchShrinking: 0 125 | switchNVNMaxPublicTextureIDCount: 0 126 | switchNVNMaxPublicSamplerIDCount: 0 127 | switchNVNGraphicsFirmwareMemory: 32 128 | stadiaPresentMode: 0 129 | stadiaTargetFramerate: 0 130 | vulkanNumSwapchainBuffers: 3 131 | vulkanEnableSetSRGBWrite: 0 132 | vulkanEnablePreTransform: 1 133 | vulkanEnableLateAcquireNextImage: 0 134 | vulkanEnableCommandBufferRecycling: 1 135 | loadStoreDebugModeEnabled: 0 136 | bundleVersion: 0.1 137 | preloadedAssets: [] 138 | metroInputSource: 0 139 | wsaTransparentSwapchain: 0 140 | m_HolographicPauseOnTrackingLoss: 1 141 | xboxOneDisableKinectGpuReservation: 1 142 | xboxOneEnable7thCore: 1 143 | vrSettings: 144 | enable360StereoCapture: 0 145 | isWsaHolographicRemotingEnabled: 0 146 | enableFrameTimingStats: 1 147 | enableOpenGLProfilerGPURecorders: 1 148 | useHDRDisplay: 0 149 | hdrBitDepth: 0 150 | m_ColorGamuts: 00000000 151 | targetPixelDensity: 30 152 | resolutionScalingMode: 0 153 | resetResolutionOnWindowResize: 0 154 | androidSupportedAspectRatio: 1 155 | androidMaxAspectRatio: 2.1 156 | applicationIdentifier: 157 | Standalone: com.DefaultCompany.UnityGPUTexCompression 158 | buildNumber: 159 | Bratwurst: 0 160 | Standalone: 0 161 | iPhone: 0 162 | tvOS: 0 163 | overrideDefaultApplicationIdentifier: 0 164 | AndroidBundleVersionCode: 1 165 | AndroidMinSdkVersion: 22 166 | AndroidTargetSdkVersion: 0 167 | AndroidPreferredInstallLocation: 1 168 | aotOptions: 169 | stripEngineCode: 1 170 | iPhoneStrippingLevel: 0 171 | iPhoneScriptCallOptimization: 0 172 | ForceInternetPermission: 0 173 | ForceSDCardPermission: 0 174 | CreateWallpaper: 0 175 | APKExpansionFiles: 0 176 | keepLoadedShadersAlive: 0 177 | StripUnusedMeshComponents: 1 178 | strictShaderVariantMatching: 0 179 | VertexChannelCompressionMask: 4054 180 | iPhoneSdkVersion: 988 181 | iOSTargetOSVersionString: 12.0 182 | tvOSSdkVersion: 0 183 | tvOSRequireExtendedGameController: 0 184 | tvOSTargetOSVersionString: 12.0 185 | bratwurstSdkVersion: 0 186 | bratwurstTargetOSVersionString: 16.4 187 | uIPrerenderedIcon: 0 188 | uIRequiresPersistentWiFi: 0 189 | uIRequiresFullScreen: 1 190 | uIStatusBarHidden: 1 191 | uIExitOnSuspend: 0 192 | uIStatusBarStyle: 0 193 | appleTVSplashScreen: {fileID: 0} 194 | appleTVSplashScreen2x: {fileID: 0} 195 | tvOSSmallIconLayers: [] 196 | tvOSSmallIconLayers2x: [] 197 | tvOSLargeIconLayers: [] 198 | tvOSLargeIconLayers2x: [] 199 | tvOSTopShelfImageLayers: [] 200 | tvOSTopShelfImageLayers2x: [] 201 | tvOSTopShelfImageWideLayers: [] 202 | tvOSTopShelfImageWideLayers2x: [] 203 | iOSLaunchScreenType: 0 204 | iOSLaunchScreenPortrait: {fileID: 0} 205 | iOSLaunchScreenLandscape: {fileID: 0} 206 | iOSLaunchScreenBackgroundColor: 207 | serializedVersion: 2 208 | rgba: 0 209 | iOSLaunchScreenFillPct: 100 210 | iOSLaunchScreenSize: 100 211 | iOSLaunchScreenCustomXibPath: 212 | iOSLaunchScreeniPadType: 0 213 | iOSLaunchScreeniPadImage: {fileID: 0} 214 | iOSLaunchScreeniPadBackgroundColor: 215 | serializedVersion: 2 216 | rgba: 0 217 | iOSLaunchScreeniPadFillPct: 100 218 | iOSLaunchScreeniPadSize: 100 219 | iOSLaunchScreeniPadCustomXibPath: 220 | iOSLaunchScreenCustomStoryboardPath: 221 | iOSLaunchScreeniPadCustomStoryboardPath: 222 | iOSDeviceRequirements: [] 223 | iOSURLSchemes: [] 224 | macOSURLSchemes: [] 225 | iOSBackgroundModes: 0 226 | iOSMetalForceHardShadows: 0 227 | metalEditorSupport: 1 228 | metalAPIValidation: 1 229 | iOSRenderExtraFrameOnPause: 0 230 | iosCopyPluginsCodeInsteadOfSymlink: 0 231 | appleDeveloperTeamID: 232 | iOSManualSigningProvisioningProfileID: 233 | tvOSManualSigningProvisioningProfileID: 234 | bratwurstManualSigningProvisioningProfileID: 235 | iOSManualSigningProvisioningProfileType: 0 236 | tvOSManualSigningProvisioningProfileType: 0 237 | bratwurstManualSigningProvisioningProfileType: 0 238 | appleEnableAutomaticSigning: 0 239 | iOSRequireARKit: 0 240 | iOSAutomaticallyDetectAndAddCapabilities: 1 241 | appleEnableProMotion: 0 242 | shaderPrecisionModel: 0 243 | clonedFromGUID: c0afd0d1d80e3634a9dac47e8a0426ea 244 | templatePackageId: com.unity.template.3d@8.1.1 245 | templateDefaultScene: Assets/Scenes/SampleScene.unity 246 | useCustomMainManifest: 0 247 | useCustomLauncherManifest: 0 248 | useCustomMainGradleTemplate: 0 249 | useCustomLauncherGradleManifest: 0 250 | useCustomBaseGradleTemplate: 0 251 | useCustomGradlePropertiesTemplate: 0 252 | useCustomGradleSettingsTemplate: 0 253 | useCustomProguardFile: 0 254 | AndroidTargetArchitectures: 1 255 | AndroidTargetDevices: 0 256 | AndroidSplashScreenScale: 0 257 | androidSplashScreen: {fileID: 0} 258 | AndroidKeystoreName: 259 | AndroidKeyaliasName: 260 | AndroidEnableArmv9SecurityFeatures: 0 261 | AndroidBuildApkPerCpuArchitecture: 0 262 | AndroidTVCompatibility: 0 263 | AndroidIsGame: 1 264 | AndroidEnableTango: 0 265 | androidEnableBanner: 1 266 | androidUseLowAccuracyLocation: 0 267 | androidUseCustomKeystore: 0 268 | m_AndroidBanners: 269 | - width: 320 270 | height: 180 271 | banner: {fileID: 0} 272 | androidGamepadSupportLevel: 0 273 | chromeosInputEmulation: 1 274 | AndroidMinifyRelease: 0 275 | AndroidMinifyDebug: 0 276 | AndroidValidateAppBundleSize: 1 277 | AndroidAppBundleSizeToValidate: 150 278 | m_BuildTargetIcons: [] 279 | m_BuildTargetPlatformIcons: [] 280 | m_BuildTargetBatching: 281 | - m_BuildTarget: Standalone 282 | m_StaticBatching: 1 283 | m_DynamicBatching: 0 284 | - m_BuildTarget: tvOS 285 | m_StaticBatching: 1 286 | m_DynamicBatching: 0 287 | - m_BuildTarget: Android 288 | m_StaticBatching: 1 289 | m_DynamicBatching: 0 290 | - m_BuildTarget: iPhone 291 | m_StaticBatching: 1 292 | m_DynamicBatching: 0 293 | - m_BuildTarget: WebGL 294 | m_StaticBatching: 0 295 | m_DynamicBatching: 0 296 | m_BuildTargetShaderSettings: [] 297 | m_BuildTargetGraphicsJobs: 298 | - m_BuildTarget: MacStandaloneSupport 299 | m_GraphicsJobs: 0 300 | - m_BuildTarget: Switch 301 | m_GraphicsJobs: 1 302 | - m_BuildTarget: MetroSupport 303 | m_GraphicsJobs: 1 304 | - m_BuildTarget: AppleTVSupport 305 | m_GraphicsJobs: 0 306 | - m_BuildTarget: BJMSupport 307 | m_GraphicsJobs: 1 308 | - m_BuildTarget: LinuxStandaloneSupport 309 | m_GraphicsJobs: 1 310 | - m_BuildTarget: PS4Player 311 | m_GraphicsJobs: 1 312 | - m_BuildTarget: iOSSupport 313 | m_GraphicsJobs: 0 314 | - m_BuildTarget: WindowsStandaloneSupport 315 | m_GraphicsJobs: 1 316 | - m_BuildTarget: XboxOnePlayer 317 | m_GraphicsJobs: 1 318 | - m_BuildTarget: LuminSupport 319 | m_GraphicsJobs: 0 320 | - m_BuildTarget: AndroidPlayer 321 | m_GraphicsJobs: 0 322 | - m_BuildTarget: WebGLSupport 323 | m_GraphicsJobs: 0 324 | m_BuildTargetGraphicsJobMode: 325 | - m_BuildTarget: PS4Player 326 | m_GraphicsJobMode: 0 327 | - m_BuildTarget: XboxOnePlayer 328 | m_GraphicsJobMode: 0 329 | m_BuildTargetGraphicsAPIs: 330 | - m_BuildTarget: AndroidPlayer 331 | m_APIs: 150000000b000000 332 | m_Automatic: 1 333 | - m_BuildTarget: iOSSupport 334 | m_APIs: 10000000 335 | m_Automatic: 1 336 | - m_BuildTarget: AppleTVSupport 337 | m_APIs: 10000000 338 | m_Automatic: 1 339 | - m_BuildTarget: WebGLSupport 340 | m_APIs: 0b000000 341 | m_Automatic: 1 342 | - m_BuildTarget: WindowsStandaloneSupport 343 | m_APIs: 020000001200000015000000 344 | m_Automatic: 0 345 | m_BuildTargetVRSettings: 346 | - m_BuildTarget: Standalone 347 | m_Enabled: 0 348 | m_Devices: 349 | - Oculus 350 | - OpenVR 351 | m_DefaultShaderChunkSizeInMB: 16 352 | m_DefaultShaderChunkCount: 0 353 | openGLRequireES31: 0 354 | openGLRequireES31AEP: 0 355 | openGLRequireES32: 0 356 | m_TemplateCustomTags: {} 357 | mobileMTRendering: 358 | Android: 1 359 | iPhone: 1 360 | tvOS: 1 361 | m_BuildTargetGroupLightmapEncodingQuality: 362 | - m_BuildTarget: Android 363 | m_EncodingQuality: 1 364 | - m_BuildTarget: iPhone 365 | m_EncodingQuality: 1 366 | - m_BuildTarget: tvOS 367 | m_EncodingQuality: 1 368 | m_BuildTargetGroupHDRCubemapEncodingQuality: 369 | - m_BuildTarget: Android 370 | m_EncodingQuality: 1 371 | - m_BuildTarget: iPhone 372 | m_EncodingQuality: 1 373 | - m_BuildTarget: tvOS 374 | m_EncodingQuality: 1 375 | m_BuildTargetGroupLightmapSettings: [] 376 | m_BuildTargetGroupLoadStoreDebugModeSettings: [] 377 | m_BuildTargetNormalMapEncoding: 378 | - m_BuildTarget: Android 379 | m_Encoding: 1 380 | - m_BuildTarget: iPhone 381 | m_Encoding: 1 382 | - m_BuildTarget: tvOS 383 | m_Encoding: 1 384 | m_BuildTargetDefaultTextureCompressionFormat: 385 | - m_BuildTarget: Android 386 | m_Format: 3 387 | playModeTestRunnerEnabled: 0 388 | runPlayModeTestAsEditModeTest: 0 389 | actionOnDotNetUnhandledException: 1 390 | enableInternalProfiler: 0 391 | logObjCUncaughtExceptions: 1 392 | enableCrashReportAPI: 0 393 | cameraUsageDescription: 394 | locationUsageDescription: 395 | microphoneUsageDescription: 396 | bluetoothUsageDescription: 397 | macOSTargetOSVersion: 10.13.0 398 | switchNMETAOverride: 399 | switchNetLibKey: 400 | switchSocketMemoryPoolSize: 6144 401 | switchSocketAllocatorPoolSize: 128 402 | switchSocketConcurrencyLimit: 14 403 | switchScreenResolutionBehavior: 2 404 | switchUseCPUProfiler: 0 405 | switchUseGOLDLinker: 0 406 | switchLTOSetting: 0 407 | switchApplicationID: 0x01004b9000490000 408 | switchNSODependencies: 409 | switchCompilerFlags: 410 | switchTitleNames_0: 411 | switchTitleNames_1: 412 | switchTitleNames_2: 413 | switchTitleNames_3: 414 | switchTitleNames_4: 415 | switchTitleNames_5: 416 | switchTitleNames_6: 417 | switchTitleNames_7: 418 | switchTitleNames_8: 419 | switchTitleNames_9: 420 | switchTitleNames_10: 421 | switchTitleNames_11: 422 | switchTitleNames_12: 423 | switchTitleNames_13: 424 | switchTitleNames_14: 425 | switchTitleNames_15: 426 | switchPublisherNames_0: 427 | switchPublisherNames_1: 428 | switchPublisherNames_2: 429 | switchPublisherNames_3: 430 | switchPublisherNames_4: 431 | switchPublisherNames_5: 432 | switchPublisherNames_6: 433 | switchPublisherNames_7: 434 | switchPublisherNames_8: 435 | switchPublisherNames_9: 436 | switchPublisherNames_10: 437 | switchPublisherNames_11: 438 | switchPublisherNames_12: 439 | switchPublisherNames_13: 440 | switchPublisherNames_14: 441 | switchPublisherNames_15: 442 | switchIcons_0: {fileID: 0} 443 | switchIcons_1: {fileID: 0} 444 | switchIcons_2: {fileID: 0} 445 | switchIcons_3: {fileID: 0} 446 | switchIcons_4: {fileID: 0} 447 | switchIcons_5: {fileID: 0} 448 | switchIcons_6: {fileID: 0} 449 | switchIcons_7: {fileID: 0} 450 | switchIcons_8: {fileID: 0} 451 | switchIcons_9: {fileID: 0} 452 | switchIcons_10: {fileID: 0} 453 | switchIcons_11: {fileID: 0} 454 | switchIcons_12: {fileID: 0} 455 | switchIcons_13: {fileID: 0} 456 | switchIcons_14: {fileID: 0} 457 | switchIcons_15: {fileID: 0} 458 | switchSmallIcons_0: {fileID: 0} 459 | switchSmallIcons_1: {fileID: 0} 460 | switchSmallIcons_2: {fileID: 0} 461 | switchSmallIcons_3: {fileID: 0} 462 | switchSmallIcons_4: {fileID: 0} 463 | switchSmallIcons_5: {fileID: 0} 464 | switchSmallIcons_6: {fileID: 0} 465 | switchSmallIcons_7: {fileID: 0} 466 | switchSmallIcons_8: {fileID: 0} 467 | switchSmallIcons_9: {fileID: 0} 468 | switchSmallIcons_10: {fileID: 0} 469 | switchSmallIcons_11: {fileID: 0} 470 | switchSmallIcons_12: {fileID: 0} 471 | switchSmallIcons_13: {fileID: 0} 472 | switchSmallIcons_14: {fileID: 0} 473 | switchSmallIcons_15: {fileID: 0} 474 | switchManualHTML: 475 | switchAccessibleURLs: 476 | switchLegalInformation: 477 | switchMainThreadStackSize: 1048576 478 | switchPresenceGroupId: 479 | switchLogoHandling: 0 480 | switchReleaseVersion: 0 481 | switchDisplayVersion: 1.0.0 482 | switchStartupUserAccount: 0 483 | switchSupportedLanguagesMask: 0 484 | switchLogoType: 0 485 | switchApplicationErrorCodeCategory: 486 | switchUserAccountSaveDataSize: 0 487 | switchUserAccountSaveDataJournalSize: 0 488 | switchApplicationAttribute: 0 489 | switchCardSpecSize: -1 490 | switchCardSpecClock: -1 491 | switchRatingsMask: 0 492 | switchRatingsInt_0: 0 493 | switchRatingsInt_1: 0 494 | switchRatingsInt_2: 0 495 | switchRatingsInt_3: 0 496 | switchRatingsInt_4: 0 497 | switchRatingsInt_5: 0 498 | switchRatingsInt_6: 0 499 | switchRatingsInt_7: 0 500 | switchRatingsInt_8: 0 501 | switchRatingsInt_9: 0 502 | switchRatingsInt_10: 0 503 | switchRatingsInt_11: 0 504 | switchRatingsInt_12: 0 505 | switchLocalCommunicationIds_0: 506 | switchLocalCommunicationIds_1: 507 | switchLocalCommunicationIds_2: 508 | switchLocalCommunicationIds_3: 509 | switchLocalCommunicationIds_4: 510 | switchLocalCommunicationIds_5: 511 | switchLocalCommunicationIds_6: 512 | switchLocalCommunicationIds_7: 513 | switchParentalControl: 0 514 | switchAllowsScreenshot: 1 515 | switchAllowsVideoCapturing: 1 516 | switchAllowsRuntimeAddOnContentInstall: 0 517 | switchDataLossConfirmation: 0 518 | switchUserAccountLockEnabled: 0 519 | switchSystemResourceMemory: 16777216 520 | switchSupportedNpadStyles: 22 521 | switchNativeFsCacheSize: 32 522 | switchIsHoldTypeHorizontal: 0 523 | switchSupportedNpadCount: 8 524 | switchEnableTouchScreen: 1 525 | switchSocketConfigEnabled: 0 526 | switchTcpInitialSendBufferSize: 32 527 | switchTcpInitialReceiveBufferSize: 64 528 | switchTcpAutoSendBufferSizeMax: 256 529 | switchTcpAutoReceiveBufferSizeMax: 256 530 | switchUdpSendBufferSize: 9 531 | switchUdpReceiveBufferSize: 42 532 | switchSocketBufferEfficiency: 4 533 | switchSocketInitializeEnabled: 1 534 | switchNetworkInterfaceManagerInitializeEnabled: 1 535 | switchPlayerConnectionEnabled: 1 536 | switchUseNewStyleFilepaths: 1 537 | switchUseLegacyFmodPriorities: 0 538 | switchUseMicroSleepForYield: 1 539 | switchEnableRamDiskSupport: 0 540 | switchMicroSleepForYieldTime: 25 541 | switchRamDiskSpaceSize: 12 542 | ps4NPAgeRating: 12 543 | ps4NPTitleSecret: 544 | ps4NPTrophyPackPath: 545 | ps4ParentalLevel: 11 546 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 547 | ps4Category: 0 548 | ps4MasterVersion: 01.00 549 | ps4AppVersion: 01.00 550 | ps4AppType: 0 551 | ps4ParamSfxPath: 552 | ps4VideoOutPixelFormat: 0 553 | ps4VideoOutInitialWidth: 1920 554 | ps4VideoOutBaseModeInitialWidth: 1920 555 | ps4VideoOutReprojectionRate: 60 556 | ps4PronunciationXMLPath: 557 | ps4PronunciationSIGPath: 558 | ps4BackgroundImagePath: 559 | ps4StartupImagePath: 560 | ps4StartupImagesFolder: 561 | ps4IconImagesFolder: 562 | ps4SaveDataImagePath: 563 | ps4SdkOverride: 564 | ps4BGMPath: 565 | ps4ShareFilePath: 566 | ps4ShareOverlayImagePath: 567 | ps4PrivacyGuardImagePath: 568 | ps4ExtraSceSysFile: 569 | ps4NPtitleDatPath: 570 | ps4RemotePlayKeyAssignment: -1 571 | ps4RemotePlayKeyMappingDir: 572 | ps4PlayTogetherPlayerCount: 0 573 | ps4EnterButtonAssignment: 1 574 | ps4ApplicationParam1: 0 575 | ps4ApplicationParam2: 0 576 | ps4ApplicationParam3: 0 577 | ps4ApplicationParam4: 0 578 | ps4DownloadDataSize: 0 579 | ps4GarlicHeapSize: 2048 580 | ps4ProGarlicHeapSize: 2560 581 | playerPrefsMaxSize: 32768 582 | ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ 583 | ps4pnSessions: 1 584 | ps4pnPresence: 1 585 | ps4pnFriends: 1 586 | ps4pnGameCustomData: 1 587 | playerPrefsSupport: 0 588 | enableApplicationExit: 0 589 | resetTempFolder: 1 590 | restrictedAudioUsageRights: 0 591 | ps4UseResolutionFallback: 0 592 | ps4ReprojectionSupport: 0 593 | ps4UseAudio3dBackend: 0 594 | ps4UseLowGarlicFragmentationMode: 1 595 | ps4SocialScreenEnabled: 0 596 | ps4ScriptOptimizationLevel: 0 597 | ps4Audio3dVirtualSpeakerCount: 14 598 | ps4attribCpuUsage: 0 599 | ps4PatchPkgPath: 600 | ps4PatchLatestPkgPath: 601 | ps4PatchChangeinfoPath: 602 | ps4PatchDayOne: 0 603 | ps4attribUserManagement: 0 604 | ps4attribMoveSupport: 0 605 | ps4attrib3DSupport: 0 606 | ps4attribShareSupport: 0 607 | ps4attribExclusiveVR: 0 608 | ps4disableAutoHideSplash: 0 609 | ps4videoRecordingFeaturesUsed: 0 610 | ps4contentSearchFeaturesUsed: 0 611 | ps4CompatibilityPS5: 0 612 | ps4AllowPS5Detection: 0 613 | ps4GPU800MHz: 1 614 | ps4attribEyeToEyeDistanceSettingVR: 0 615 | ps4IncludedModules: [] 616 | ps4attribVROutputEnabled: 0 617 | monoEnv: 618 | splashScreenBackgroundSourceLandscape: {fileID: 0} 619 | splashScreenBackgroundSourcePortrait: {fileID: 0} 620 | blurSplashScreenBackground: 1 621 | spritePackerPolicy: 622 | webGLMemorySize: 16 623 | webGLExceptionSupport: 1 624 | webGLNameFilesAsHashes: 0 625 | webGLShowDiagnostics: 0 626 | webGLDataCaching: 1 627 | webGLDebugSymbols: 0 628 | webGLEmscriptenArgs: 629 | webGLModulesDirectory: 630 | webGLTemplate: APPLICATION:Default 631 | webGLAnalyzeBuildSize: 0 632 | webGLUseEmbeddedResources: 0 633 | webGLCompressionFormat: 1 634 | webGLWasmArithmeticExceptions: 0 635 | webGLLinkerTarget: 1 636 | webGLThreadsSupport: 0 637 | webGLDecompressionFallback: 0 638 | webGLInitialMemorySize: 32 639 | webGLMaximumMemorySize: 2048 640 | webGLMemoryGrowthMode: 2 641 | webGLMemoryLinearGrowthStep: 16 642 | webGLMemoryGeometricGrowthStep: 0.2 643 | webGLMemoryGeometricGrowthCap: 96 644 | webGLPowerPreference: 2 645 | scriptingDefineSymbols: {} 646 | additionalCompilerArguments: {} 647 | platformArchitecture: {} 648 | scriptingBackend: {} 649 | il2cppCompilerConfiguration: {} 650 | il2cppCodeGeneration: {} 651 | managedStrippingLevel: 652 | Bratwurst: 1 653 | EmbeddedLinux: 1 654 | GameCoreScarlett: 1 655 | GameCoreXboxOne: 1 656 | Nintendo Switch: 1 657 | PS4: 1 658 | PS5: 1 659 | QNX: 1 660 | Stadia: 1 661 | WebGL: 1 662 | Windows Store Apps: 1 663 | XboxOne: 1 664 | iPhone: 1 665 | tvOS: 1 666 | incrementalIl2cppBuild: {} 667 | suppressCommonWarnings: 1 668 | allowUnsafeCode: 0 669 | useDeterministicCompilation: 1 670 | additionalIl2CppArgs: 671 | scriptingRuntimeVersion: 1 672 | gcIncremental: 1 673 | gcWBarrierValidation: 0 674 | apiCompatibilityLevelPerPlatform: {} 675 | m_RenderingPath: 1 676 | m_MobileRenderingPath: 1 677 | metroPackageName: UnityGPUTexCompression 678 | metroPackageVersion: 679 | metroCertificatePath: 680 | metroCertificatePassword: 681 | metroCertificateSubject: 682 | metroCertificateIssuer: 683 | metroCertificateNotAfter: 0000000000000000 684 | metroApplicationDescription: UnityGPUTexCompression 685 | wsaImages: {} 686 | metroTileShortName: 687 | metroTileShowName: 0 688 | metroMediumTileShowName: 0 689 | metroLargeTileShowName: 0 690 | metroWideTileShowName: 0 691 | metroSupportStreamingInstall: 0 692 | metroLastRequiredScene: 0 693 | metroDefaultTileSize: 1 694 | metroTileForegroundText: 2 695 | metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} 696 | metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, a: 1} 697 | metroSplashScreenUseBackgroundColor: 0 698 | platformCapabilities: {} 699 | metroTargetDeviceFamilies: {} 700 | metroFTAName: 701 | metroFTAFileTypes: [] 702 | metroProtocolName: 703 | vcxProjDefaultLanguage: 704 | XboxOneProductId: 705 | XboxOneUpdateKey: 706 | XboxOneSandboxId: 707 | XboxOneContentId: 708 | XboxOneTitleId: 709 | XboxOneSCId: 710 | XboxOneGameOsOverridePath: 711 | XboxOnePackagingOverridePath: 712 | XboxOneAppManifestOverridePath: 713 | XboxOneVersion: 1.0.0.0 714 | XboxOnePackageEncryption: 0 715 | XboxOnePackageUpdateGranularity: 2 716 | XboxOneDescription: 717 | XboxOneLanguage: 718 | - enus 719 | XboxOneCapability: [] 720 | XboxOneGameRating: {} 721 | XboxOneIsContentPackage: 0 722 | XboxOneEnhancedXboxCompatibilityMode: 0 723 | XboxOneEnableGPUVariability: 1 724 | XboxOneSockets: {} 725 | XboxOneSplashScreen: {fileID: 0} 726 | XboxOneAllowedProductIds: [] 727 | XboxOnePersistentLocalStorageSize: 0 728 | XboxOneXTitleMemory: 8 729 | XboxOneOverrideIdentityName: 730 | XboxOneOverrideIdentityPublisher: 731 | vrEditorSettings: {} 732 | cloudServicesEnabled: 733 | UNet: 1 734 | luminIcon: 735 | m_Name: 736 | m_ModelFolderPath: 737 | m_PortalFolderPath: 738 | luminCert: 739 | m_CertPath: 740 | m_SignPackage: 1 741 | luminIsChannelApp: 0 742 | luminVersion: 743 | m_VersionCode: 1 744 | m_VersionName: 745 | hmiPlayerDataPath: 746 | hmiForceSRGBBlit: 1 747 | embeddedLinuxEnableGamepadInput: 1 748 | hmiLogStartupTiming: 0 749 | hmiCpuConfiguration: 750 | apiCompatibilityLevel: 6 751 | activeInputHandler: 0 752 | windowsGamepadBackendHint: 0 753 | cloudProjectId: 754 | framebufferDepthMemorylessMode: 0 755 | qualitySettingsNames: [] 756 | projectName: 757 | organizationId: 758 | cloudEnabled: 0 759 | legacyClampBlendShapeWeights: 0 760 | hmiLoadingImage: {fileID: 0} 761 | platformRequiresReadableAssets: 0 762 | virtualTexturingSupportEnabled: 0 763 | insecureHttpOption: 0 764 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2022.3.4f1 2 | m_EditorVersionWithRevision: 2022.3.4f1 (35713cd46cd7) 3 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 0 8 | m_QualitySettings: 9 | - serializedVersion: 3 10 | name: Medium 11 | pixelLightCount: 4 12 | shadows: 2 13 | shadowResolution: 2 14 | shadowProjection: 1 15 | shadowCascades: 4 16 | shadowDistance: 150 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 1 21 | skinWeights: 4 22 | globalTextureMipmapLimit: 0 23 | textureMipmapLimitSettings: [] 24 | anisotropicTextures: 1 25 | antiAliasing: 0 26 | softParticles: 1 27 | softVegetation: 1 28 | realtimeReflectionProbes: 1 29 | billboardsFaceCameraPosition: 1 30 | useLegacyDetailDistribution: 1 31 | vSyncCount: 0 32 | lodBias: 2 33 | maximumLODLevel: 0 34 | enableLODCrossFade: 1 35 | streamingMipmapsActive: 0 36 | streamingMipmapsAddAllCameras: 1 37 | streamingMipmapsMemoryBudget: 512 38 | streamingMipmapsRenderersPerFrame: 512 39 | streamingMipmapsMaxLevelReduction: 2 40 | streamingMipmapsMaxFileIORequests: 1024 41 | particleRaycastBudget: 4096 42 | asyncUploadTimeSlice: 2 43 | asyncUploadBufferSize: 16 44 | asyncUploadPersistentBuffer: 1 45 | resolutionScalingFixedDPIFactor: 1 46 | customRenderPipeline: {fileID: 0} 47 | terrainQualityOverrides: 0 48 | terrainPixelError: 1 49 | terrainDetailDensityScale: 1 50 | terrainBasemapDistance: 1000 51 | terrainDetailDistance: 80 52 | terrainTreeDistance: 5000 53 | terrainBillboardStart: 50 54 | terrainFadeLength: 5 55 | terrainMaxTrees: 50 56 | excludedTargetPlatforms: [] 57 | m_TextureMipmapLimitGroupNames: [] 58 | m_PerPlatformDefaultQuality: 59 | Android: 0 60 | Lumin: 0 61 | Nintendo 3DS: 0 62 | Nintendo Switch: 0 63 | PS4: 0 64 | PSP2: 0 65 | Server: 0 66 | Stadia: 0 67 | Standalone: 0 68 | WebGL: 0 69 | Windows Store Apps: 0 70 | XboxOne: 0 71 | iPhone: 0 72 | tvOS: 0 73 | -------------------------------------------------------------------------------- /ProjectSettings/SceneTemplateSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "templatePinStates": [], 3 | "dependencyTypeInfos": [ 4 | { 5 | "userAdded": false, 6 | "type": "UnityEngine.AnimationClip", 7 | "defaultInstantiationMode": 0 8 | }, 9 | { 10 | "userAdded": false, 11 | "type": "UnityEditor.Animations.AnimatorController", 12 | "defaultInstantiationMode": 0 13 | }, 14 | { 15 | "userAdded": false, 16 | "type": "UnityEngine.AnimatorOverrideController", 17 | "defaultInstantiationMode": 0 18 | }, 19 | { 20 | "userAdded": false, 21 | "type": "UnityEditor.Audio.AudioMixerController", 22 | "defaultInstantiationMode": 0 23 | }, 24 | { 25 | "userAdded": false, 26 | "type": "UnityEngine.ComputeShader", 27 | "defaultInstantiationMode": 1 28 | }, 29 | { 30 | "userAdded": false, 31 | "type": "UnityEngine.Cubemap", 32 | "defaultInstantiationMode": 0 33 | }, 34 | { 35 | "userAdded": false, 36 | "type": "UnityEngine.GameObject", 37 | "defaultInstantiationMode": 0 38 | }, 39 | { 40 | "userAdded": false, 41 | "type": "UnityEditor.LightingDataAsset", 42 | "defaultInstantiationMode": 0 43 | }, 44 | { 45 | "userAdded": false, 46 | "type": "UnityEngine.LightingSettings", 47 | "defaultInstantiationMode": 0 48 | }, 49 | { 50 | "userAdded": false, 51 | "type": "UnityEngine.Material", 52 | "defaultInstantiationMode": 0 53 | }, 54 | { 55 | "userAdded": false, 56 | "type": "UnityEditor.MonoScript", 57 | "defaultInstantiationMode": 1 58 | }, 59 | { 60 | "userAdded": false, 61 | "type": "UnityEngine.PhysicMaterial", 62 | "defaultInstantiationMode": 0 63 | }, 64 | { 65 | "userAdded": false, 66 | "type": "UnityEngine.PhysicsMaterial2D", 67 | "defaultInstantiationMode": 0 68 | }, 69 | { 70 | "userAdded": false, 71 | "type": "UnityEngine.Rendering.PostProcessing.PostProcessProfile", 72 | "defaultInstantiationMode": 0 73 | }, 74 | { 75 | "userAdded": false, 76 | "type": "UnityEngine.Rendering.PostProcessing.PostProcessResources", 77 | "defaultInstantiationMode": 0 78 | }, 79 | { 80 | "userAdded": false, 81 | "type": "UnityEngine.Rendering.VolumeProfile", 82 | "defaultInstantiationMode": 0 83 | }, 84 | { 85 | "userAdded": false, 86 | "type": "UnityEditor.SceneAsset", 87 | "defaultInstantiationMode": 1 88 | }, 89 | { 90 | "userAdded": false, 91 | "type": "UnityEngine.Shader", 92 | "defaultInstantiationMode": 1 93 | }, 94 | { 95 | "userAdded": false, 96 | "type": "UnityEngine.ShaderVariantCollection", 97 | "defaultInstantiationMode": 1 98 | }, 99 | { 100 | "userAdded": false, 101 | "type": "UnityEngine.Texture", 102 | "defaultInstantiationMode": 0 103 | }, 104 | { 105 | "userAdded": false, 106 | "type": "UnityEngine.Texture2D", 107 | "defaultInstantiationMode": 0 108 | }, 109 | { 110 | "userAdded": false, 111 | "type": "UnityEngine.Timeline.TimelineAsset", 112 | "defaultInstantiationMode": 0 113 | } 114 | ], 115 | "defaultDependencyTypeInfo": { 116 | "userAdded": false, 117 | "type": "", 118 | "defaultInstantiationMode": 1 119 | }, 120 | "newSceneOverride": 0 121 | } -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 1 7 | m_Enabled: 0 8 | m_TestMode: 0 9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events 10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events 11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com 12 | m_DashboardUrl: https://dashboard.unity3d.com 13 | m_TestInitMode: 0 14 | CrashReportingSettings: 15 | m_EventUrl: https://perf-events.cloud.unity3d.com 16 | m_Enabled: 0 17 | m_LogBufferSize: 10 18 | m_CaptureEditorExceptions: 1 19 | UnityPurchasingSettings: 20 | m_Enabled: 0 21 | m_TestMode: 0 22 | UnityAnalyticsSettings: 23 | m_Enabled: 0 24 | m_TestMode: 0 25 | m_InitializeOnStartup: 1 26 | m_PackageRequiringCoreStatsPresent: 0 27 | UnityAdsSettings: 28 | m_Enabled: 0 29 | m_InitializeOnStartup: 1 30 | m_TestMode: 0 31 | m_IosGameId: 32 | m_AndroidGameId: 33 | m_GameIds: {} 34 | m_GameId: 35 | PerformanceReportingSettings: 36 | m_Enabled: 0 37 | -------------------------------------------------------------------------------- /ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_StripUpdateShader: {fileID: 0} 10 | m_RenderPipeSettingsPath: 11 | m_FixedTimeStep: 0.016666668 12 | m_MaxDeltaTime: 0.05 13 | -------------------------------------------------------------------------------- /ProjectSettings/VersionControlSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!890905787 &1 4 | VersionControlSettings: 5 | m_ObjectHideFlags: 0 6 | m_Mode: Visible Meta Files 7 | m_CollabEditorSettings: 8 | inProgressEnabled: 1 9 | -------------------------------------------------------------------------------- /ProjectSettings/XRSettings.asset: -------------------------------------------------------------------------------- 1 | { 2 | "m_SettingKeys": [ 3 | "VR Device Disabled", 4 | "VR Device User Alert" 5 | ], 6 | "m_SettingValues": [ 7 | "False", 8 | "False" 9 | ] 10 | } -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Realtime DXT/BCn compression, in Unity, on the GPU 2 | 3 | Small testbed to see how compute shaders can be used to do texture compression _on the GPU_ in Unity. 4 | 5 | ![Screenshot](/screenshot.png?raw=true "Screenshot") 6 | 7 | ### Outline of how to do GPU texture compression: 8 | 9 | 1. Input is any 2D texture (regular texture, render texture etc.) that the GPU can sample. 10 | 2. We'll need a temporary `RenderTexture` that is 4x smaller than the destination texture on each axis, i.e. each "pixel" in it is one BCn block. 11 | Format of the texture is `GraphicsFormat.R32G32_SInt` (64 bits) for DXT1/BC1, and `GraphicsFormat.R32G32B32A32_SInt` (128 bits) otherwise. We'll want to 12 | make it writable from a compute shader by setting `enableRandomWrite=true`. 13 | 3. Output is same size as input (plus any padding to be multiple-of-4 size) `Texture2D` using one of compressed formats (DXT1/BC1, DXT5/BC3 etc.). 14 | We only need it to exist on the GPU, so create Texture2D with `TextureCreationFlags.DontInitializePixels | TextureCreationFlags.DontUploadUponCreate` 15 | flags to save some time, and call `Apply(false, true)` on it; the last argument ditches the CPU side memory copy. 16 | 4. A compute shader reads input texture from step 1, does {whatever GPU texture compression you do}, and writes into the "one pixel per BCn block" 17 | temporary texture from step 2. 18 | 5. Now we must copy from temporary "one pixel per BCn block" texture (step 2) into actual destination texture (step 3). `Graphics.CopyTexture` 19 | or `CommandBuffer.CopyTexture` with just source and destination textures *will not work* (since that one checks "does width and height match", 20 | which they don't - they differ 4x on each axis). 21 | But, `Graphics.CopyTexture` (or CommandBuffer equivalent) that takes `srcElement` and `dstElement` arguments (zeroes for the largest mip level) 22 | *does work*! 23 | 7. Profit! 📈 24 | 25 | ### What is in this project: 26 | 27 | Project is based on Unity 2022.3.4. There's one scene that renders things, compresses the rendered result and displays it on screen. The display on screen also shows 28 | the difference (multiplied 2x) between original and compressed, as well as alpha channel and difference of that between original and compressed. 29 | 30 | Actual GPU texture compressors are just code taken from external projects, under `GPUTexCompression/External`: 31 | 32 | * `AMD_Compressonator`: [AMD Compressonator](https://github.com/GPUOpen-Tools/compressonator/tree/master/cmp_core/shaders), rev 7d929e9 (2023 Jan 26), MIT license. BC1 and BC3 33 | compression with a tunable quality level. 34 | * `FastBlockCompress`: [Microsoft Xbox ATG](https://github.com/microsoft/Xbox-ATG-Samples/tree/main/XDKSamples/Graphics/FastBlockCompress/Shaders), rev 180fa6d 35 | (2018 Dec 14), MIT license. BC1 and BC3 compression (ignores quality setting). 36 | 37 | It is extremely likely that better real-time compute shader texture compressors are possible, the two above are just the ones I found that were already written in HLSL. There's also [Betsy](https://github.com/darksylinc/betsy) but that one is written in GLSL, and possibly some others. This example is not so much about compressor 38 | itself, but rather "how to plug that into Unity". 39 | 40 | 41 | Timings for compression of 1280x720 image into BC3 format on several configurations I tried: 42 | 43 | | | GeForce 3080 Ti (D3D11, D3D12, Vulkan) | Apple M1 Max (Metal) | 44 | |:--- |:--- |:--- | 45 | |XDK | 0.01ms, RMSE 3.877, 2.006 | 0.01ms, RMSE 3.865, 1.994 | 46 | |AMD q<0.5 | 0.01ms, RMSE 3.562, 2.006 | 0.17ms, RMSE 3.563, 1.994 | 47 | |AMD q<0.8 | 0.01ms, RMSE 2.817, 2.006 | 0.83ms, RMSE 2.819, 1.994 | 48 | |AMD q<=1 | 3.10ms, RMSE 2.544, 1.534 | 117ms😲, RMSE 2.544, 1.524 | 49 | 50 | On Apple/Metal the AMD compressor at "high" quality level is _astonishingly_ slow when using the default (FXC) HLSL shader compiler. However, switching 51 | to a more modern DXC shader compiler `#pragma use_dxc metal` does not work at all, gives a "Error creating compute pipeline state: Compiler 52 | encountered an internal error" failure when the compute shader is actually used. Fun! 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aras-p/UnityGPUTexCompression/4bdbaa00623943b670805d22955c26b50070831d/screenshot.png --------------------------------------------------------------------------------