MCPcopy Create free account
hub / github.com/crosire/reshade / ReShadeCreateEffectRuntime

Function ReShadeCreateEffectRuntime

source/addon.cpp:124–223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122#include "d3d12/d3d12_impl_swapchain.hpp"
123
124bool ReShadeCreateEffectRuntime(reshade::api::device_api api, void *opaque_device, void *opaque_command_queue, void *opaque_swapchain, const char *config_path, reshade::api::effect_runtime **out_runtime)
125{
126 if (out_runtime == nullptr)
127 return false;
128 *out_runtime = nullptr;
129
130 if (opaque_swapchain == nullptr || config_path == nullptr)
131 return false;
132
133 reshade::api::swapchain *swapchain_impl = nullptr;
134 reshade::api::command_queue *graphics_queue_impl = nullptr;
135
136 switch (api)
137 {
138 case reshade::api::device_api::d3d9:
139 {
140 com_ptr<IDirect3DDevice9> device;
141 com_ptr<IDirect3DSwapChain9> swapchain;
142 if (FAILED(static_cast<IUnknown *>(opaque_swapchain)->QueryInterface(&swapchain)))
143 return false;
144 if (FAILED(swapchain->GetDevice(&device)) || device.get() != opaque_device)
145 return false;
146
147 const auto device_impl = new reshade::d3d9::device_impl(device.get());
148 swapchain_impl = new reshade::d3d9::swapchain_impl(device_impl, swapchain.get());
149 graphics_queue_impl = device_impl;
150 }
151 break;
152 case reshade::api::device_api::d3d10:
153 {
154 com_ptr<ID3D10Device1> device;
155 com_ptr<IDXGISwapChain> swapchain;
156 if (FAILED(static_cast<IUnknown *>(opaque_swapchain)->QueryInterface(&swapchain)))
157 return false;
158 if (FAILED(swapchain->GetDevice(IID_PPV_ARGS(&device))) || device.get() != opaque_device)
159 return false;
160
161 const auto device_impl = new reshade::d3d10::device_impl(device.get());
162 swapchain_impl = new reshade::d3d10::swapchain_impl(device_impl, swapchain.get());
163 graphics_queue_impl = device_impl;
164 }
165 break;
166 case reshade::api::device_api::d3d11:
167 {
168 com_ptr<ID3D11Device> device;
169 com_ptr<IDXGISwapChain> swapchain;
170 if (FAILED(static_cast<IUnknown *>(opaque_swapchain)->QueryInterface(&swapchain)))
171 return false;
172 if (FAILED(swapchain->GetDevice(IID_PPV_ARGS(&device))) || device.get() != opaque_device)
173 return false;
174
175 com_ptr<ID3D11DeviceContext> device_context;
176 if (opaque_command_queue != nullptr)
177 {
178 if (FAILED(static_cast<IUnknown *>(opaque_command_queue)->QueryInterface(&device_context)))
179 return false;
180 }
181 else

Callers 1

create_effect_runtimeFunction · 0.85

Calls 6

GetImmediateContextMethod · 0.80
QueryInterfaceMethod · 0.45
GetDeviceMethod · 0.45
getMethod · 0.45
on_initMethod · 0.45

Tested by

no test coverage detected