Added HLSL source files and compiled shader files

* this should remove the hidden dependency on d3dcompiler_xx.dll.
This commit is contained in:
NovaRain
2022-01-17 21:14:01 +08:00
parent fc5863ac46
commit 45e2037082
8 changed files with 1597 additions and 92 deletions
File diff suppressed because it is too large Load Diff
+49
View File
@@ -0,0 +1,49 @@
texture image;
texture palette;
texture head;
texture highlight;
sampler s0 = sampler_state { texture=<image>; };
sampler s1 = sampler_state { texture=<palette>; minFilter=none; magFilter=none; addressU=clamp; addressV=clamp; };
sampler s2 = sampler_state { texture=<head>; minFilter=linear; magFilter=linear; addressU=clamp; addressV=clamp; };
sampler s3 = sampler_state { texture=<highlight>; minFilter=linear; magFilter=linear; addressU=clamp; addressV=clamp; };
float2 size;
float2 corner;
float2 sizehl;
float2 cornerhl;
int showhl;
// shader for displaying head textures
float4 P1(in float2 Tex : TEXCOORD0) : COLOR0
{
float backdrop = tex2D(s0, Tex).a;
float3 result;
if (abs(backdrop - 1.0) < 0.001) { // (48.0 / 255.0) // 48 - key index color
result = tex2D(s2, saturate((Tex - corner) / size));
} else {
result = tex1D(s1, backdrop); // get color in palette
}
// blend highlights
if (showhl) {
float4 h = tex2D(s3, saturate((Tex - cornerhl) / sizehl));
result = saturate(result + h); // saturate(result * (1 - h.a) * h.rgb * h.a)
}
return float4(result, 1);
}
technique T1
{
pass p1 { PixelShader = compile ps_2_0 P1(); }
}
// main shader
float4 P0(in float2 Tex : TEXCOORD0) : COLOR0
{
float3 result = tex1D(s1, tex2D(s0, Tex).a); // get color in palette
return float4(result, 1);
}
technique T0
{
pass p0 { PixelShader = compile ps_2_0 P0(); }
}
File diff suppressed because it is too large Load Diff
+49
View File
@@ -0,0 +1,49 @@
texture image;
texture palette;
texture head;
texture highlight;
sampler s0 = sampler_state { texture=<image>; };
sampler s1 = sampler_state { texture=<palette>; minFilter=none; magFilter=none; addressU=clamp; addressV=clamp; };
sampler s2 = sampler_state { texture=<head>; minFilter=linear; magFilter=linear; addressU=clamp; addressV=clamp; };
sampler s3 = sampler_state { texture=<highlight>; minFilter=linear; magFilter=linear; addressU=clamp; addressV=clamp; };
float2 size;
float2 corner;
float2 sizehl;
float2 cornerhl;
int showhl;
// shader for displaying head textures
float4 P1(in float2 Tex : TEXCOORD0) : COLOR0
{
float backdrop = tex2D(s0, Tex).r;
float3 result;
if (abs(backdrop - 1.0) < 0.001) {
result = tex2D(s2, saturate((Tex - corner) / size));
} else {
result = tex1D(s1, backdrop);
}
// blend highlights
if (showhl) {
float4 h = tex2D(s3, saturate((Tex - cornerhl) / sizehl));
result = saturate(result + h);
}
return float4(result, 1);
}
technique T1
{
pass p1 { PixelShader = compile ps_2_0 P1(); }
}
// main shader
float4 P0(in float2 Tex : TEXCOORD0) : COLOR0
{
float3 result = tex1D(s1, tex2D(s0, Tex).r);
return float4(result, 1);
}
technique T0
{
pass p0 { PixelShader = compile ps_2_0 P0(); }
}
+6 -2
View File
@@ -28,6 +28,9 @@
#include "..\HRP\Init.h"
#include "..\HRP\MoviesScreen.h"
#include "..\HLSL\A8PixelShader.h"
#include "..\HLSL\L8PixelShader.h"
#include "Graphics.h"
namespace sfall
@@ -197,8 +200,9 @@ static void ResetDevice(bool create) {
bool A8IsSupported = (d3d9Device->CreateTexture(ResWidth, ResHeight, 1, 0, D3DFMT_A8, D3DPOOL_SYSTEMMEM, &mainTex, 0) == D3D_OK);
if (Graphics::GPUBlt) {
const char* shader = (A8IsSupported) ? gpuEffectA8 : gpuEffectL8;
if (D3DXCreateEffect(d3d9Device, shader, strlen(shader), 0, 0, 0, 0, &gpuBltEffect, 0) == D3D_OK) {
const BYTE* shader = (A8IsSupported) ? gpuEffectA8 : gpuEffectL8;
const UINT size = (A8IsSupported) ? sizeof(gpuEffectA8) : sizeof(gpuEffectL8);
if (D3DXCreateEffect(d3d9Device, shader, size, 0, 0, 0, 0, &gpuBltEffect, 0) == D3D_OK) {
gpuBltMainTex = gpuBltEffect->GetParameterByName(0, "image");
gpuBltPalette = gpuBltEffect->GetParameterByName(0, "palette");
// for head textures
-90
View File
@@ -118,94 +118,4 @@ public:
}
};
static const char* gpuEffectA8 =
"texture image;"
"texture palette;"
"texture head;"
"texture highlight;"
"sampler s0 = sampler_state { texture=<image>; };"
"sampler s1 = sampler_state { texture=<palette>; minFilter=none; magFilter=none; addressU=clamp; addressV=clamp; };"
"sampler s2 = sampler_state { texture=<head>; minFilter=linear; magFilter=linear; addressU=clamp; addressV=clamp; };"
"sampler s3 = sampler_state { texture=<highlight>; minFilter=linear; magFilter=linear; addressU=clamp; addressV=clamp; };"
"float2 size;"
"float2 corner;"
"float2 sizehl;"
"float2 cornerhl;"
"int showhl;"
// shader for displaying head textures
"float4 P1( in float2 Tex : TEXCOORD0 ) : COLOR0 {"
"float backdrop = tex2D(s0, Tex).a;"
"float3 result;"
"if (abs(backdrop - 1.0) < 0.001) {" // (48.0 / 255.0) // 48 - key index color
"result = tex2D(s2, saturate((Tex - corner) / size));"
"} else {"
"result = tex1D(s1, backdrop);" // get color in palette
"}"
// blend highlights
"if (showhl) {"
"float4 h = tex2D(s3, saturate((Tex - cornerhl) / sizehl));"
"result = saturate(result + h);" // saturate(result * (1 - h.a) * h.rgb * h.a)"
"}"
"return float4(result, 1);"
"}"
"technique T1"
"{"
"pass p1 { PixelShader = compile ps_2_0 P1(); }"
"}"
// main shader
"float4 P0( in float2 Tex : TEXCOORD0 ) : COLOR0 {"
"float3 result = tex1D(s1, tex2D(s0, Tex).a);" // get color in palette
"return float4(result, 1);"
"}"
"technique T0"
"{"
"pass p0 { PixelShader = compile ps_2_0 P0(); }"
"}";
static const char* gpuEffectL8 =
"texture image;"
"texture palette;"
"texture head;"
"texture highlight;"
"sampler s0 = sampler_state { texture=<image>; };"
"sampler s1 = sampler_state { texture=<palette>; minFilter=none; magFilter=none; addressU=clamp; addressV=clamp; };"
"sampler s2 = sampler_state { texture=<head>; minFilter=linear; magFilter=linear; addressU=clamp; addressV=clamp; };"
"sampler s3 = sampler_state { texture=<highlight>; minFilter=linear; magFilter=linear; addressU=clamp; addressV=clamp; };"
"float2 size;"
"float2 corner;"
"float2 sizehl;"
"float2 cornerhl;"
"int showhl;"
// shader for displaying head textures
"float4 P1( in float2 Tex : TEXCOORD0 ) : COLOR0 {"
"float backdrop = tex2D(s0, Tex).r;"
"float3 result;"
"if (abs(backdrop - 1.0) < 0.001) {"
"result = tex2D(s2, saturate((Tex - corner) / size));"
"} else {"
"result = tex1D(s1, backdrop);"
"}"
// blend highlights
"if (showhl) {"
"float4 h = tex2D(s3, saturate((Tex - cornerhl) / sizehl));"
"result = saturate(result + h);"
"}"
"return float4(result, 1);"
"}"
"technique T1"
"{"
"pass p1 { PixelShader = compile ps_2_0 P1(); }"
"}"
// main shader
"float4 P0( in float2 Tex : TEXCOORD0 ) : COLOR0 {"
"float3 result = tex1D(s1, tex2D(s0, Tex).r);"
"return float4(result, 1);"
"}"
"technique T0"
"{"
"pass p0 { PixelShader = compile ps_2_0 P0(); }"
"}";
}
+72
View File
@@ -82,6 +82,18 @@
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='ReleaseXP|Win32'">false</GenerateManifest>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='DevXP|Win32'">false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ExecutablePath>$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)</ExecutablePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DevXP|Win32'">
<ExecutablePath>$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)</ExecutablePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ExecutablePath>$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)</ExecutablePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseXP|Win32'">
<ExecutablePath>$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)</ExecutablePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
@@ -123,6 +135,17 @@
<PostBuildEvent>
<Command>"$(ProjectDir)postbuild.cmd" debug "$(TargetPath)"</Command>
</PostBuildEvent>
<FxCompile>
<EntryPointName />
</FxCompile>
<FxCompile>
<ShaderType>Effect</ShaderType>
</FxCompile>
<FxCompile>
<ShaderModel>2.0</ShaderModel>
<HeaderFileOutput>$(SolutionDir)HLSL\%(Filename).h</HeaderFileOutput>
<ObjectFileOutput />
</FxCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
@@ -176,6 +199,17 @@
<PostBuildEvent>
<Command>"$(ProjectDir)postbuild.cmd" release "$(TargetPath)"</Command>
</PostBuildEvent>
<FxCompile>
<EntryPointName />
</FxCompile>
<FxCompile>
<ShaderType>Effect</ShaderType>
</FxCompile>
<FxCompile>
<ShaderModel>2.0</ShaderModel>
<HeaderFileOutput>$(SolutionDir)HLSL\%(Filename).h</HeaderFileOutput>
<ObjectFileOutput />
</FxCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseXP|Win32'">
<ClCompile>
@@ -229,6 +263,17 @@
<PostBuildEvent>
<Command>"$(ProjectDir)postbuild.cmd" releasexp "$(TargetPath)"</Command>
</PostBuildEvent>
<FxCompile>
<EntryPointName />
</FxCompile>
<FxCompile>
<ShaderType>Effect</ShaderType>
</FxCompile>
<FxCompile>
<ShaderModel>2.0</ShaderModel>
<HeaderFileOutput>$(SolutionDir)HLSL\%(Filename).h</HeaderFileOutput>
<ObjectFileOutput />
</FxCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DevXP|Win32'">
<ClCompile>
@@ -283,6 +328,17 @@
<PostBuildEvent>
<Command>"$(ProjectDir)postbuild.cmd" devxp "$(TargetPath)"</Command>
</PostBuildEvent>
<FxCompile>
<EntryPointName />
</FxCompile>
<FxCompile>
<ShaderType>Effect</ShaderType>
</FxCompile>
<FxCompile>
<ShaderModel>2.0</ShaderModel>
<HeaderFileOutput>$(SolutionDir)HLSL\%(Filename).h</HeaderFileOutput>
<ObjectFileOutput />
</FxCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="CheckAddress.h" />
@@ -311,6 +367,8 @@
<ClInclude Include="Game\skills.h" />
<ClInclude Include="Game\stats.h" />
<ClInclude Include="Game\tilemap.h" />
<ClInclude Include="HLSL\A8PixelShader.h" />
<ClInclude Include="HLSL\L8PixelShader.h" />
<ClInclude Include="HRP\Character.h" />
<ClInclude Include="HRP\CreditsScreen.h" />
<ClInclude Include="HRP\DeathScreen.h" />
@@ -578,6 +636,20 @@
<ItemGroup>
<ResourceCompile Include="version.rc" />
</ItemGroup>
<ItemGroup>
<FxCompile Include="HLSL\A8PixelShader.hlsl">
<VariableName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">gpuEffectA8</VariableName>
<VariableName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">gpuEffectA8</VariableName>
<VariableName Condition="'$(Configuration)|$(Platform)'=='ReleaseXP|Win32'">gpuEffectA8</VariableName>
<VariableName Condition="'$(Configuration)|$(Platform)'=='DevXP|Win32'">gpuEffectA8</VariableName>
</FxCompile>
<FxCompile Include="HLSL\L8PixelShader.hlsl">
<VariableName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">gpuEffectL8</VariableName>
<VariableName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">gpuEffectL8</VariableName>
<VariableName Condition="'$(Configuration)|$(Platform)'=='ReleaseXP|Win32'">gpuEffectL8</VariableName>
<VariableName Condition="'$(Configuration)|$(Platform)'=='DevXP|Win32'">gpuEffectL8</VariableName>
</FxCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
+17
View File
@@ -34,6 +34,9 @@
<Filter Include="HRP\ViewMap">
<UniqueIdentifier>{d15672c6-4446-4325-8e14-a1143f26fc23}</UniqueIdentifier>
</Filter>
<Filter Include="HLSL">
<UniqueIdentifier>{2fe2bab1-d5fc-4986-bd21-cbf61eabbd34}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="main.h" />
@@ -443,6 +446,12 @@
<ClInclude Include="FalloutEngine\GamePids.h">
<Filter>FalloutEngine</Filter>
</ClInclude>
<ClInclude Include="HLSL\A8PixelShader.h">
<Filter>HLSL</Filter>
</ClInclude>
<ClInclude Include="HLSL\L8PixelShader.h">
<Filter>HLSL</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
@@ -822,4 +831,12 @@
<ItemGroup>
<None Include="exports.def" />
</ItemGroup>
<ItemGroup>
<FxCompile Include="HLSL\A8PixelShader.hlsl">
<Filter>HLSL</Filter>
</FxCompile>
<FxCompile Include="HLSL\L8PixelShader.hlsl">
<Filter>HLSL</Filter>
</FxCompile>
</ItemGroup>
</Project>