|
14 | 14 | #include "Shaders/VolumeFog.h"
|
15 | 15 | #include "util.h"
|
16 | 16 |
|
| 17 | + |
17 | 18 | namespace atfix {
|
18 | 19 |
|
| 20 | +extern "C" bool IsAMD(); |
| 21 | + |
19 | 22 | /** Hooking-related stuff */
|
20 | 23 | using PFN_ID3D11Device_CreateVertexShader = HRESULT(STDMETHODCALLTYPE*) (ID3D11Device*, const void*, SIZE_T, ID3D11ClassLinkage*, ID3D11VertexShader**);
|
21 | 24 | using PFN_ID3D11Device_CreatePixelShader = HRESULT(STDMETHODCALLTYPE*) (ID3D11Device*, const void*, SIZE_T, ID3D11ClassLinkage*, ID3D11PixelShader**);
|
@@ -56,23 +59,30 @@ HRESULT STDMETHODCALLTYPE ID3D11Device_CreateVertexShader(
|
56 | 59 | static constexpr std::array<uint32_t, 4> DefaultShader = { 0x49d8396e, 0x5b9dfd57, 0xb4f45dba, 0xe6d8b741 };
|
57 | 60 |
|
58 | 61 | const uint32_t* hash = reinterpret_cast<const uint32_t*>(reinterpret_cast<const uint8_t*>(pShaderBytecode) + 4);
|
59 |
| - |
| 62 | + bool AMD = IsAMD(); |
60 | 63 | if (std::equal(ParticleShader1.begin(), ParticleShader1.end(), hash)) {
|
61 | 64 |
|
62 | 65 | if (!Particle1B) {
|
63 | 66 | Particle1B = true;
|
64 | 67 | log("Particle found");
|
65 | 68 | }
|
66 |
| - return procs->CreateVertexShader(pDevice, FIXED_PARTICLE_SHADER1, sizeof(FIXED_PARTICLE_SHADER1), pClassLinkage, ppVertexShader); |
| 69 | + if (AMD) { |
| 70 | + return procs->CreateVertexShader(pDevice, FIXED_PARTICLE_SHADER1, sizeof(FIXED_PARTICLE_SHADER1), pClassLinkage, ppVertexShader); |
| 71 | + } else { |
| 72 | + return procs->CreateVertexShader(pDevice, pShaderBytecode, BytecodeLength, pClassLinkage, ppVertexShader); |
| 73 | + } |
67 | 74 |
|
68 | 75 | } else if (std::equal(ParticleShader2.begin(), ParticleShader2.end(), hash)) {
|
69 | 76 |
|
70 | 77 | if (!Particle2B) {
|
71 | 78 | Particle2B = true;
|
72 | 79 | log("Particle Iterate found");
|
73 | 80 | }
|
74 |
| - return procs->CreateVertexShader(pDevice, FIXED_PARTICLE_SHADER2, sizeof(FIXED_PARTICLE_SHADER2), pClassLinkage, ppVertexShader); |
75 |
| - |
| 81 | + if (AMD) { |
| 82 | + return procs->CreateVertexShader(pDevice, FIXED_PARTICLE_SHADER2, sizeof(FIXED_PARTICLE_SHADER2), pClassLinkage, ppVertexShader); |
| 83 | + } else { |
| 84 | + return procs->CreateVertexShader(pDevice, pShaderBytecode, BytecodeLength, pClassLinkage, ppVertexShader); |
| 85 | + } |
76 | 86 | }
|
77 | 87 | #ifndef RELEASELOW
|
78 | 88 | else if (std::equal(VolumeFogShader.begin(), VolumeFogShader.end(), hash)) {
|
|
0 commit comments