MCPcopy Create free account
hub / github.com/aliasIsolation/aliasIsolation / STDMETHODCALLTYPE PSSetShader_hook

Function STDMETHODCALLTYPE PSSetShader_hook

src/dll/rendering.cpp:146–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144// ----------------------------------------------------------------------------------------------------------------
145
146void STDMETHODCALLTYPE PSSetShader_hook(ID3D11DeviceContext *context,
147 /* [annotation] */
148 _In_opt_ ID3D11PixelShader *pPixelShader,
149 /* [annotation] */
150 _In_reads_opt_(NumClassInstances) ID3D11ClassInstance *const *ppClassInstances,
151 UINT NumClassInstances)
152{
153 ZoneScopedN(__FUNCTION__);
154
155 ID3D11PixelShader *shader = pPixelShader;
156#ifndef ALIASISOLATION_NO_PS_OVERRIDES
157 auto replaced = getReplacedShader(pPixelShader);
158 if (replaced == g_sharpenPsHandle && g_sharpenPsHandle.isValid())
159 {
160 modifySharpenPass(context);
161 shader = ShaderRegistry::getPs(replaced);
162 }
163#endif
164
165 g_d3dHookOrig.PSSetShader(context, shader, ppClassInstances, NumClassInstances);
166
167#ifndef ALIASISOLATION_NO_PS_OVERRIDES
168 if (g_alienResources.cameraMotionPs == pPixelShader && g_alienResources.cameraMotionPs != nullptr)
169 {
170 g_alienResources.cbDefaultPSC = nullptr;
171 context->PSGetConstantBuffers(2, 1, &g_alienResources.cbDefaultPSC);
172
173 CComPtr<ID3D11RenderTargetView> rtv;
174 context->OMGetRenderTargets(1, &rtv.p, nullptr);
175 g_alienResources.velocityRtv = rtv;
176
177 CComPtr<ID3D11Resource> rtRes = nullptr;
178 if (rtv)
179 {
180 rtv->GetResource(&rtRes.p);
181 }
182 else
183 {
184 LOG_MSG("[aliasIsolation::rendering] FATAL ERROR - rtv->GetResource(&rtRes.p) - Failed to get resource "
185 "from render target view!\n",
186 "");
187 DebugBreak();
188 }
189
190 g_alienResources.velocitySrv = srvFromTex((ID3D11Texture2D *)rtRes.p);
191 }
192#endif
193}
194
195// ----------------------------------------------------------------------------------------------------------------
196

Callers

nothing calls this directly

Calls 5

getReplacedShaderFunction · 0.85
modifySharpenPassFunction · 0.85
getPsFunction · 0.85
srvFromTexFunction · 0.85
isValidMethod · 0.80

Tested by

no test coverage detected