MCPcopy Create free account
hub / github.com/aliasIsolation/aliasIsolation / CreatePixelShader_hook

Function CreatePixelShader_hook

src/dll/shaderHooks.cpp:79–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77
78
79HRESULT WINAPI CreatePixelShader_hook(void* thisptr, const char* bytecode, SIZE_T bytecodeLength, void* classLinkage, ID3D11PixelShader** pixelShader)
80{
81 HRESULT res = g_d3dHookOrig.CreatePixelShader(thisptr, bytecode, bytecodeLength, classLinkage, pixelShader);
82 clearPixelShaderReplacement(*pixelShader);
83
84 if (bytecodeLength > 0) {
85 if ('D' == bytecode[0] && 'X' == bytecode[1] && 'B' == bytecode[2] && 'C' == bytecode[3])
86 {
87 const unsigned *const hash = (unsigned*)(bytecode+4);
88
89 // RGBM encode pixel shader
90 if (hash[0] == 0x4fcfc7f7 && hash[1] == 0x5c5e12cf && hash[2] == 0x059e8b33 && hash[3] == 0x11f8489b)
91 {
92 g_alienResources.rgbmEncodePs = *pixelShader;
93 return res;
94 }
95
96 // DoF encode pixel shader
97 if (hash[0] == 0x29ed6504 && hash[1] == 0x77d5438c && hash[2] == 0xe9c206c8 && hash[3] == 0xb1f27ba2)
98 {
99 g_alienResources.dofEncodePs = *pixelShader;
100 return res;
101 }
102
103 // Camera motion pixel shader
104 if (hash[0] == 0x1fb3edd4 && hash[1] == 0xe984323b && hash[2] == 0x11bcf154 && hash[3] == 0x5a029c94)
105 {
106 g_alienResources.cameraMotionPs = *pixelShader;
107 return res;
108 }
109
110 // Replace the original SMAA spatial pass by a post-sharpening filter
111 if (hash[0] == 0x02b5231b && hash[1] == 0x8b3879b8 && hash[2] == 0x7db9bc8d && hash[3] == 0xf46a9d78)
112 {
113 g_sharpenPsHandle = ShaderRegistry::addPixelShader("sharpen_ps.cso");
114 replacePixelShader(*pixelShader, g_sharpenPsHandle);
115 return res;
116 }
117
118 // Replace the shadow-map linearize shader with one with better numerical stability. The original flickers in vanilla Alien.
119 if (hash[0] == 0x3c7b9d08 && hash[1] == 0x7b3adf54 && hash[2] == 0x3bfc6b9d && hash[3] == 0x1b0ec92e)
120 {
121 replacePixelShader(*pixelShader, ShaderRegistry::addPixelShader("shadowLinearize_ps.cso"));
122 return res;
123 }
124
125 // Ditto, for shadow downsampling.
126 if (hash[0] == 0x8d485646 && hash[1] == 0x7d707454 && hash[2] == 0x95bf6cb1 && hash[3] == 0x09b85460)
127 {
128 replacePixelShader(*pixelShader, ShaderRegistry::addPixelShader("shadowDownsample_ps.cso"));
129 return res;
130 }
131
132 // Replace the bloom merge PS
133 if (hash[0] == 0xc0fbe484 && hash[1] == 0x2d952c03 && hash[2] == 0x993de248 && hash[3] == 0x56ad9263)
134 {
135 replacePixelShader(*pixelShader, ShaderRegistry::addPixelShader("bloomMerge_ps.cso"));
136 return res;

Callers

nothing calls this directly

Calls 3

addPixelShaderFunction · 0.85
replacePixelShaderFunction · 0.85

Tested by

no test coverage detected