mirror of
https://github.com/Patoke/4JLibs.git
synced 2026-05-29 09:04:30 +00:00
feat: decompile shader hlsl and a pre-build batch script to generate the headers with bytecode
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
// Vertex shaders
|
||||
#include "VS_PF3_TF2_CB4_NB4_XW1.h"
|
||||
#include "VS_PF3_TF2_CB4_NB4_XW1_Lighting.h"
|
||||
#include "VS_PF3_TF2_CB4_NB4_XW1_TexGen.h"
|
||||
#include "VS_Compressed.h"
|
||||
#include "VS_PF3_TF2_CB4_NB4_XW1.h"
|
||||
#include "VS_PF3_TF2_CB4_NB4_XW1_LIGHTING.h"
|
||||
#include "VS_PF3_TF2_CB4_NB4_XW1_TEXGEN.h"
|
||||
#include "VS_ScreenClear.h"
|
||||
#include "VS_ScreenSpace.h"
|
||||
|
||||
// Pixel shaders
|
||||
#include "PS_ForceLOD.h"
|
||||
#include "PS_ScreenClear.h"
|
||||
#include "PS_ScreenSpace.h"
|
||||
#include "PS_Standard.h"
|
||||
#include "PS_TextureProjection.h"
|
||||
#include "PS_TextureProjection.h"
|
||||
#include "PS_ForceLOD.h"
|
||||
#include "PS_ScreenSpace.h"
|
||||
#include "PS_ScreenClear.h"
|
||||
@@ -133,6 +133,10 @@
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<Lib />
|
||||
<PreBuildEvent>
|
||||
<Command>cd shaders && build.bat</Command>
|
||||
<Message>Build Shaders</Message>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
@@ -156,6 +160,12 @@
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<Lib />
|
||||
<PreBuildEvent>
|
||||
<Command>cd shaders && build.bat</Command>
|
||||
</PreBuildEvent>
|
||||
<PreBuildEvent>
|
||||
<Message>Build Shaders</Message>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="4J_Render.h" />
|
||||
@@ -179,8 +189,8 @@
|
||||
<ClInclude Include="Renderer.h" />
|
||||
<ClInclude Include="VS_Compressed.h" />
|
||||
<ClInclude Include="VS_PF3_TF2_CB4_NB4_XW1.h" />
|
||||
<ClInclude Include="VS_PF3_TF2_CB4_NB4_XW1_Lighting.h" />
|
||||
<ClInclude Include="VS_PF3_TF2_CB4_NB4_XW1_Texgen.h" />
|
||||
<ClInclude Include="VS_PF3_TF2_CB4_NB4_XW1_LIGHTING.h" />
|
||||
<ClInclude Include="VS_PF3_TF2_CB4_NB4_XW1_TEXGEN.h" />
|
||||
<ClInclude Include="VS_ScreenClear.h" />
|
||||
<ClInclude Include="VS_ScreenSpace.h" />
|
||||
<ClInclude Include="zlib\zconf.h" />
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
<Filter Include="Header Files\microprofile">
|
||||
<UniqueIdentifier>{6cbd8b95-ff51-42d2-a66f-282d3a11c042}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\generated">
|
||||
<UniqueIdentifier>{3b83a35a-3f4e-4ae3-b7fa-17a84f509af5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h">
|
||||
@@ -35,42 +38,9 @@
|
||||
<ClInclude Include="Renderer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PS_Standard.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PS_TextureProjection.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PS_ForceLOD.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VS_ScreenClear.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VS_ScreenSpace.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VS_PF3_TF2_CB4_NB4_XW1.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VS_PF3_TF2_CB4_NB4_XW1_Lighting.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VS_PF3_TF2_CB4_NB4_XW1_Texgen.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VS_Compressed.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CompiledShaders.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PS_ScreenClear.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PS_ScreenSpace.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="zlib\zconf.h">
|
||||
<Filter>Header Files\zlib</Filter>
|
||||
</ClInclude>
|
||||
@@ -110,6 +80,39 @@
|
||||
<ClInclude Include="Profiler.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PS_ForceLOD.h">
|
||||
<Filter>Header Files\generated</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PS_ScreenClear.h">
|
||||
<Filter>Header Files\generated</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PS_ScreenSpace.h">
|
||||
<Filter>Header Files\generated</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PS_Standard.h">
|
||||
<Filter>Header Files\generated</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PS_TextureProjection.h">
|
||||
<Filter>Header Files\generated</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VS_Compressed.h">
|
||||
<Filter>Header Files\generated</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VS_PF3_TF2_CB4_NB4_XW1.h">
|
||||
<Filter>Header Files\generated</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VS_PF3_TF2_CB4_NB4_XW1_LIGHTING.h">
|
||||
<Filter>Header Files\generated</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VS_PF3_TF2_CB4_NB4_XW1_TEXGEN.h">
|
||||
<Filter>Header Files\generated</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VS_ScreenClear.h">
|
||||
<Filter>Header Files\generated</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VS_ScreenSpace.h">
|
||||
<Filter>Header Files\generated</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
|
||||
21
Windows_Libs/Dev/Render/shaders/build.bat
Normal file
21
Windows_Libs/Dev/Render/shaders/build.bat
Normal file
@@ -0,0 +1,21 @@
|
||||
@echo off
|
||||
|
||||
set OUT=../
|
||||
set OPT=/O3 /nologo
|
||||
|
||||
for /d %%i in ("C:\Program Files (x86)\Windows Kits\10\bin\10.*") do set FXC="%%i\x64\fxc.exe"
|
||||
|
||||
if not defined FXC echo FXC not found && exit /b 1
|
||||
if not exist %OUT% mkdir %OUT%
|
||||
|
||||
%FXC% %OPT% /T vs_4_0 /E main /D COMPRESSED /Fh %OUT%/VS_Compressed.h /Vn g_main_VS_Compressed main_VS.hlsl
|
||||
%FXC% %OPT% /T vs_4_0 /E main /Fh %OUT%/VS_PF3_TF2_CB4_NB4_XW1.h /Vn g_main_VS_PF3_TF2_CB4_NB4_XW1 main_VS.hlsl
|
||||
%FXC% %OPT% /T vs_4_0 /E main /D LIGHTING /Fh %OUT%/VS_PF3_TF2_CB4_NB4_XW1_LIGHTING.h /Vn g_main_VS_PF3_TF2_CB4_NB4_XW1_LIGHTING main_VS.hlsl
|
||||
%FXC% %OPT% /T vs_4_0 /E main /D TEXGEN /Fh %OUT%/VS_PF3_TF2_CB4_NB4_XW1_TEXGEN.h /Vn g_main_VS_PF3_TF2_CB4_NB4_XW1_TEXGEN main_VS.hlsl
|
||||
%FXC% %OPT% /T vs_4_0 /E VS_ScreenSpace /Fh %OUT%/VS_ScreenSpace.h /Vn g_main_VS_ScreenSpace screen_VS.hlsl
|
||||
%FXC% %OPT% /T vs_4_0 /E VS_ScreenClear /Fh %OUT%/VS_ScreenClear.h /Vn g_main_VS_ScreenClear screen_VS.hlsl
|
||||
%FXC% %OPT% /T ps_4_0 /E main /Fh %OUT%/PS_Standard.h /Vn g_main_PS_Standard main_PS.hlsl
|
||||
%FXC% %OPT% /T ps_4_0 /E main /D TEXTURE_PROJECTION /Fh %OUT%/PS_TextureProjection.h /Vn g_main_PS_TextureProjection main_PS.hlsl
|
||||
%FXC% %OPT% /T ps_4_0 /E main /D FORCE_LOD /Fh %OUT%/PS_ForceLOD.h /Vn g_main_PS_ForceLOD main_PS.hlsl
|
||||
%FXC% %OPT% /T ps_4_0 /E PS_ScreenSpace /Fh %OUT%/PS_ScreenSpace.h /Vn g_main_PS_ScreenSpace screen_PS.hlsl
|
||||
%FXC% %OPT% /T ps_4_0 /E PS_ScreenClear /Fh %OUT%/PS_ScreenClear.h /Vn g_main_PS_ScreenClear screen_PS.hlsl
|
||||
76
Windows_Libs/Dev/Render/shaders/main_PS.hlsl
Normal file
76
Windows_Libs/Dev/Render/shaders/main_PS.hlsl
Normal file
@@ -0,0 +1,76 @@
|
||||
cbuffer diffuse : register(b0)
|
||||
{
|
||||
float4 diffuse_colour;
|
||||
};
|
||||
cbuffer fog : register(b1)
|
||||
{
|
||||
float4 fog_colour;
|
||||
};
|
||||
cbuffer alphaTest : register(b3)
|
||||
{
|
||||
float4 alphaTestRef;
|
||||
};
|
||||
|
||||
#ifdef FORCE_LOD
|
||||
cbuffer forcedLOD : register(b5)
|
||||
{
|
||||
float4 forcedLod;
|
||||
};
|
||||
#endif
|
||||
|
||||
SamplerState diffuse_sampler_s : register(s0);
|
||||
Texture2D<float4> diffuse_texture : register(t0);
|
||||
|
||||
struct PS_INPUT
|
||||
{
|
||||
float4 v0 : SV_POSITION;
|
||||
float4 v1 : COLOR0;
|
||||
linear centroid float4 v2 : TEXCOORD0;
|
||||
};
|
||||
|
||||
float4 main(PS_INPUT input) : SV_TARGET
|
||||
{
|
||||
float4 r0, r1;
|
||||
|
||||
#ifdef TEXTURE_PROJECTION
|
||||
r0.xy = input.v2.xy / input.v2.ww;
|
||||
r0.xyzw = diffuse_texture.Sample(diffuse_sampler_s, r0.xy).xyzw;
|
||||
r0.xyzw = diffuse_colour.xyzw * r0.xyzw;
|
||||
r0.w = input.v1.w * r0.w;
|
||||
r1.x = (r0.w < alphaTestRef.w) ? 1 : 0;
|
||||
if (r1.x != 0) discard;
|
||||
r0.xyz = r0.xyz * input.v1.xyz + -fog_colour.xyz;
|
||||
float4 o0;
|
||||
o0.xyz = input.v2.zzz * r0.xyz + fog_colour.xyz;
|
||||
o0.w = r0.w;
|
||||
return o0;
|
||||
|
||||
#elif defined(FORCE_LOD)
|
||||
r0.xyzw = diffuse_texture.SampleLevel(diffuse_sampler_s, input.v2.xy, forcedLod.x).xyzw;
|
||||
r0.xyzw = diffuse_colour.xyzw * r0.xyzw;
|
||||
r0.w = input.v1.w * r0.w;
|
||||
r1.x = (r0.w < alphaTestRef.w) ? 1 : 0;
|
||||
if (r1.x != 0) discard;
|
||||
r0.xyz = r0.xyz * input.v1.xyz + -fog_colour.xyz;
|
||||
float4 o0;
|
||||
o0.xyz = input.v2.zzz * r0.xyz + fog_colour.xyz;
|
||||
o0.w = r0.w;
|
||||
return o0;
|
||||
|
||||
#else
|
||||
r0.x = (1 < input.v2.x) ? 1 : 0;
|
||||
if (r0.x != 0)
|
||||
r0.xyzw = diffuse_texture.SampleLevel(diffuse_sampler_s, input.v2.xy, 0).xyzw;
|
||||
else
|
||||
r0.xyzw = diffuse_texture.Sample(diffuse_sampler_s, input.v2.xy).xyzw;
|
||||
r0.xyzw = diffuse_colour.xyzw * r0.xyzw;
|
||||
r0.w = input.v1.w * r0.w;
|
||||
r1.x = (r0.w < alphaTestRef.w) ? 1 : 0;
|
||||
if (r1.x != 0) discard;
|
||||
r0.xyz = r0.xyz * input.v1.xyz + -fog_colour.xyz;
|
||||
float4 o0;
|
||||
o0.xyz = input.v2.zzz * r0.xyz + fog_colour.xyz;
|
||||
o0.w = r0.w;
|
||||
return o0;
|
||||
#endif
|
||||
}
|
||||
226
Windows_Libs/Dev/Render/shaders/main_VS.hlsl
Normal file
226
Windows_Libs/Dev/Render/shaders/main_VS.hlsl
Normal file
@@ -0,0 +1,226 @@
|
||||
#ifndef COMPRESSED
|
||||
|
||||
cbuffer positionTransformWV : register(b0)
|
||||
{
|
||||
float4x4 matWV;
|
||||
};
|
||||
cbuffer positionTransformWV2 : register(b1)
|
||||
{
|
||||
float4x4 matWV2;
|
||||
};
|
||||
cbuffer positionTransformProj : register(b2)
|
||||
{
|
||||
float4x4 matP;
|
||||
};
|
||||
cbuffer textureTransform : register(b3)
|
||||
{
|
||||
float4x4 matUV;
|
||||
};
|
||||
cbuffer textureUV2 : register(b4)
|
||||
{
|
||||
float4 vecUVT2;
|
||||
};
|
||||
cbuffer fog : register(b5)
|
||||
{
|
||||
float4 vecFog;
|
||||
};
|
||||
|
||||
#ifdef LIGHTING
|
||||
cbuffer lighting : register(b6)
|
||||
{
|
||||
float3 vecLight0;
|
||||
float3 vecLight1;
|
||||
float4 vecLight0Col;
|
||||
float4 vecLight1Col;
|
||||
float4 vecLightAmbientCol;
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef TEXGEN
|
||||
cbuffer texgen : register(b7)
|
||||
{
|
||||
float4x4 matTexGenEye;
|
||||
float4x4 matTexGenObj;
|
||||
};
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
cbuffer positionTransformWV : register(b0)
|
||||
{
|
||||
float4x4 matWV;
|
||||
};
|
||||
cbuffer positionTransformProj : register(b2)
|
||||
{
|
||||
float4x4 matP;
|
||||
};
|
||||
cbuffer textureUV2 : register(b4)
|
||||
{
|
||||
float4 vecUVT2;
|
||||
};
|
||||
cbuffer fog : register(b5)
|
||||
{
|
||||
float4 vecFog;
|
||||
};
|
||||
cbuffer positionTransform2 : register(b8)
|
||||
{
|
||||
float4 vecWV2Trans;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
SamplerState light_sampler_s : register(s0);
|
||||
Texture2D<float4> light_texture : register(t0);
|
||||
|
||||
#ifndef COMPRESSED
|
||||
struct VS_INPUT
|
||||
{
|
||||
float4 v0 : POSITION0;
|
||||
float4 v1 : COLOR0;
|
||||
float3 v2 : NORMAL0;
|
||||
float4 v3 : TEXCOORD0;
|
||||
int2 v4 : TEXCOORD1;
|
||||
};
|
||||
#else
|
||||
struct VS_INPUT
|
||||
{
|
||||
int4 v0 : POSITION0;
|
||||
int4 v1 : TEXCOORD0;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct VS_OUTPUT
|
||||
{
|
||||
float4 o0 : SV_POSITION;
|
||||
float4 o1 : COLOR0;
|
||||
float4 o2 : TEXCOORD0;
|
||||
};
|
||||
|
||||
float4 fog_calc(float4 vecFog, float eyeZ)
|
||||
{
|
||||
float4 r0;
|
||||
r0.x = vecFog.x + eyeZ;
|
||||
r0.y = vecFog.x * eyeZ;
|
||||
r0.y = 1.44269502 * r0.y;
|
||||
r0.y = exp2(r0.y);
|
||||
r0.y = min(1, r0.y);
|
||||
r0.x = saturate(vecFog.y * r0.x);
|
||||
bool bLinear = (vecFog.z == 1);
|
||||
bool bExp = (vecFog.z == 2);
|
||||
r0.y = bExp ? r0.y : 1;
|
||||
r0.z = bLinear ? r0.x : r0.y;
|
||||
return r0;
|
||||
}
|
||||
|
||||
VS_OUTPUT main(VS_INPUT input)
|
||||
{
|
||||
VS_OUTPUT output;
|
||||
float4 r0, r1, r2;
|
||||
|
||||
#ifndef COMPRESSED
|
||||
|
||||
r0.xyzw = matWV2._m01_m11_m21_m31 * input.v0.yyyy;
|
||||
r0.xyzw = matWV2._m00_m10_m20_m30 * input.v0.xxxx + r0.xyzw;
|
||||
r0.xyzw = matWV2._m02_m12_m22_m32 * input.v0.zzzz + r0.xyzw;
|
||||
r0.xyzw = matWV2._m03_m13_m23_m33 * input.v0.wwww + r0.xyzw;
|
||||
r1.xyzw = matWV._m01_m11_m21_m31 * r0.yyyy;
|
||||
r1.xyzw = matWV._m00_m10_m20_m30 * r0.xxxx + r1.xyzw;
|
||||
r1.xyzw = matWV._m02_m12_m22_m32 * r0.zzzz + r1.xyzw;
|
||||
r0.xyzw = matWV._m03_m13_m23_m33 * r0.wwww + r1.xyzw;
|
||||
r1.xyzw = matP._m01_m11_m21_m31 * r0.yyyy;
|
||||
r1.xyzw = matP._m00_m10_m20_m30 * r0.xxxx + r1.xyzw;
|
||||
r1.xyzw = matP._m02_m12_m22_m32 * r0.zzzw + r1.xyzw;
|
||||
output.o0.xyzw = matP._m03_m13_m23_m33 * r0.wwww + r1.xyzw;
|
||||
|
||||
r0.xy = (int2)input.v4.xy;
|
||||
r0.xy = float2(0.00390625, 0.00390625) * r0.xy;
|
||||
r0.xy = max(vecUVT2.xy, r0.xy);
|
||||
r0.xy = frac(r0.xy);
|
||||
r1.xyzw = light_texture.SampleLevel(light_sampler_s, r0.xy, 0).xyzw;
|
||||
r1.w = 1;
|
||||
output.o1.xyzw = input.v1.wzyx * r1.xyzw;
|
||||
|
||||
#ifdef LIGHTING
|
||||
r0.xyw = matWV2._m01_m11_m21 * input.v2.yyy;
|
||||
r0.xyw = matWV2._m00_m10_m20 * input.v2.xxx + r0.xyw;
|
||||
r0.xyw = matWV2._m02_m12_m22 * input.v2.zzz + r0.xyw;
|
||||
r1.xyz = matWV._m01_m11_m21 * r0.yyy;
|
||||
r1.xyz = matWV._m00_m10_m20 * r0.xxx + r1.xyz;
|
||||
r0.xyw = matWV._m02_m12_m22 * r0.www + r1.xyz;
|
||||
r1.x = dot(r0.xyw, r0.xyw);
|
||||
r1.x = rsqrt(r1.x);
|
||||
r0.xyw = r1.xxx * r0.xyw;
|
||||
r1.x = dot(vecLight1.xyz, r0.xyw);
|
||||
r0.x = dot(vecLight0.xyz, r0.xyw);
|
||||
r0.x = max(0, r0.x);
|
||||
r0.y = max(0, r1.x);
|
||||
r1.xyzw = vecLight1Col.xyzw * r0.yyyy;
|
||||
r1.xyzw = r0.xxxx * vecLight0Col.xyzw + r1.xyzw;
|
||||
r1.xyzw = saturate(vecLightAmbientCol.xyzw + r1.xyzw);
|
||||
|
||||
r0.xy = (int2)input.v4.xy;
|
||||
r0.xy = float2(0.00390625, 0.00390625) * r0.xy;
|
||||
r0.xy = max(vecUVT2.xy, r0.xy);
|
||||
r0.xy = frac(r0.xy);
|
||||
r2.xyzw = light_texture.SampleLevel(light_sampler_s, r0.xy, 0).xyzw;
|
||||
r0.xyw = input.v1.wzy * r2.xyz;
|
||||
output.o1.xyz = r1.xyz * r0.xyw;
|
||||
output.o1.w = r1.w;
|
||||
#endif
|
||||
|
||||
#ifdef TEXGEN
|
||||
r1.xyzw = matTexGenEye._m01_m11_m21_m31 * r0.yyyy;
|
||||
r1.xyzw = matTexGenEye._m00_m10_m20_m30 * r0.xxxx + r1.xyzw;
|
||||
r1.xyzw = matTexGenEye._m02_m12_m22_m32 * r0.zzzz + r1.xyzw;
|
||||
r1.xyzw = matTexGenEye._m03_m13_m23_m33 * r0.wwww + r1.xyzw;
|
||||
r2.xyzw = matTexGenObj._m01_m11_m21_m31 * input.v0.yyyy;
|
||||
r2.xyzw = matTexGenObj._m00_m10_m20_m30 * input.v0.xxxx + r2.xyzw;
|
||||
r2.xyzw = matTexGenObj._m02_m12_m22_m32 * input.v0.zzzz + r2.xyzw;
|
||||
r2.xyzw = matTexGenObj._m03_m13_m23_m33 * input.v0.wwww + r2.xyzw;
|
||||
r1.xyzw = r2.xyzw + r1.xyzw;
|
||||
r0.xyw = matUV._m01_m11_m31 * r1.yyy;
|
||||
r0.xyw = matUV._m00_m10_m30 * r1.xxx + r0.xyw;
|
||||
r0.xyw = matUV._m02_m12_m32 * r1.zzz + r0.xyw;
|
||||
output.o2.xyw = matUV._m03_m13_m33 * r1.www + r0.xyw;
|
||||
#else
|
||||
r0.xy = matUV._m01_m11 * input.v3.yy;
|
||||
r0.xy = matUV._m00_m10 * input.v3.xx + r0.xy;
|
||||
output.o2.xy = matUV._m03_m13 + r0.xy;
|
||||
output.o2.w = 1;
|
||||
#endif
|
||||
|
||||
float4 fog = fog_calc(vecFog, r0.z);
|
||||
output.o2.z = fog.z;
|
||||
|
||||
#else // COMPRESSED
|
||||
|
||||
r0.xyzw = (int4)input.v0.xyzw;
|
||||
r0.xyz = r0.xyz * float3(0.0009765625, 0.0009765625, 0.0009765625) + vecWV2Trans.xyz;
|
||||
r0.w = 32768 + r0.w;
|
||||
r1.xyz = float3(1.52587891e-05, 0.00048828125, 0.03125) * r0.www;
|
||||
r1.xyz = frac(r1.xyz);
|
||||
r2.xyzw = matWV._m01_m11_m21_m31 * r0.yyyy;
|
||||
r2.xyzw = matWV._m00_m10_m20_m30 * r0.xxxx + r2.xyzw;
|
||||
r0.xyzw = matWV._m02_m12_m22_m32 * r0.zzzz + r2.xyzw;
|
||||
r0.xyzw = matWV._m03_m13_m23_m33 + r0.xyzw;
|
||||
r2.xyzw = matP._m01_m11_m21_m31 * r0.yyyy;
|
||||
r2.xyzw = matP._m00_m10_m20_m30 * r0.xxxx + r2.xyzw;
|
||||
r2.xyzw = matP._m02_m12_m22_m32 * r0.zzzz + r2.xyzw;
|
||||
output.o0.xyzw = matP._m03_m13_m23_m33 * r0.wwww + r2.xyzw;
|
||||
r2.xyzw = (int4)input.v1.zwxy;
|
||||
r2.xyzw = float4(0.00390625, 0.00390625, 0.000122070312, 0.000122070312) * r2.xyzw;
|
||||
r0.xy = max(vecUVT2.xy, r2.xy);
|
||||
output.o2.xy = r2.zw;
|
||||
r0.xy = frac(r0.xy);
|
||||
r2.xyzw = light_texture.SampleLevel(light_sampler_s, r0.xy, 0).xyzw;
|
||||
output.o1.xyz = r2.xyz * r1.xyz;
|
||||
output.o1.w = 1;
|
||||
|
||||
float4 fog = fog_calc(vecFog, r0.z);
|
||||
output.o2.z = fog.z;
|
||||
output.o2.w = 1;
|
||||
|
||||
#endif
|
||||
|
||||
return output;
|
||||
}
|
||||
21
Windows_Libs/Dev/Render/shaders/screen_PS.hlsl
Normal file
21
Windows_Libs/Dev/Render/shaders/screen_PS.hlsl
Normal file
@@ -0,0 +1,21 @@
|
||||
cbuffer cbuff : register(b4)
|
||||
{
|
||||
float4 clear_colour;
|
||||
};
|
||||
|
||||
SamplerState screen_sampler_s : register(s0);
|
||||
Texture2D<float4> screen_texture : register(t0);
|
||||
|
||||
float4 PS_ScreenSpace(float4 v0 : SV_POSITION, float2 v1 : TEXCOORD0) : SV_TARGET
|
||||
{
|
||||
float4 o0;
|
||||
o0.xyzw = screen_texture.Sample(screen_sampler_s, v1.xy).xyzw;
|
||||
return o0;
|
||||
}
|
||||
|
||||
float4 PS_ScreenClear(float4 v0 : SV_POSITION) : SV_TARGET
|
||||
{
|
||||
float4 o0;
|
||||
o0.xyzw = clear_colour.xyzw;
|
||||
return o0;
|
||||
}
|
||||
34
Windows_Libs/Dev/Render/shaders/screen_VS.hlsl
Normal file
34
Windows_Libs/Dev/Render/shaders/screen_VS.hlsl
Normal file
@@ -0,0 +1,34 @@
|
||||
cbuffer screenspace_constants : register(b9)
|
||||
{
|
||||
float4 v_scaleoffset;
|
||||
};
|
||||
|
||||
void VS_ScreenSpace(uint v0 : SV_VertexID, out float4 o0 : SV_POSITION, out float2 o1 : TEXCOORD0)
|
||||
{
|
||||
float4 r0, r1;
|
||||
|
||||
o0.zw = float2(1, 1);
|
||||
r0.xy = (int2)v0.xx & int2(1, -2);
|
||||
r0.z = (uint)r0.x << 1;
|
||||
r0.yz = (int2)r0.yz + int2(-1, -1);
|
||||
r1.x = (int)r0.x;
|
||||
o0.xy = (int2)r0.zy;
|
||||
r0.x = (uint)v0.x >> 1;
|
||||
r0.x = (int)-r0.x + 1;
|
||||
r1.y = (int)r0.x;
|
||||
o1.xy = r1.xy * v_scaleoffset.zw + v_scaleoffset.xy;
|
||||
}
|
||||
|
||||
void VS_ScreenClear(uint v0 : SV_VertexID, out float4 o0 : SV_POSITION)
|
||||
{
|
||||
float4 r0;
|
||||
|
||||
r0.x = (uint)v0.x << 1;
|
||||
r0.x = (int)r0.x & 2;
|
||||
r0.x = (int)r0.x + -1;
|
||||
o0.x = (int)r0.x;
|
||||
r0.x = (int)v0.x & -2;
|
||||
r0.x = (int)r0.x + -1;
|
||||
o0.y = (int)r0.x;
|
||||
o0.zw = float2(1, 1);
|
||||
}
|
||||
Reference in New Issue
Block a user