2025-07-10 13:29:03 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <input/events/window.hpp>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include <renderer/blender.hpp"            // required for forward declaratio>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include <renderer/buffers.hpp"            // required for forward declaratio>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include <renderer/dx/graphics_context.hpp>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include <renderer/dx/shared_context.hpp>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include <renderer/render_command.hpp> // required for forward declaratio>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include <renderer/renderer.hpp>       // required for forward declaratio>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include <ui/ui.hpp>                   // required for forward declaratio>
							 | 
						
					
						
							
								
									
										
										
										
											2021-06-02 09:07:45 +04:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#define GLFW_EXPOSE_NATIVE_WIN32
							 | 
						
					
						
							
								
									
										
										
										
											2021-07-01 19:25:46 +04:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <glfw/glfw3.h>
							 | 
						
					
						
							
								
									
										
										
										
											2021-06-02 09:07:45 +04:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include <glfw/glfw3native.h>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-11 00:05:48 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								namespace lt {
							 | 
						
					
						
							
								
									
										
										
										
											2021-06-02 09:07:45 +04:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-05 13:28:41 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								dxGraphicsContext::dxGraphicsContext(GLFWwindow *windowHandle)
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-05 14:23:01 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    : m_window_handle(windowHandle)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    , m_debug_interface(nullptr)
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// set 'GraphicsAPI';
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-05 14:23:01 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									m_graphics_api = GraphicsAPI::DirectX;
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-05 14:23:01 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									m_shared_context = std::make_shared<dxSharedContext>();
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// setup stuff
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-05 15:36:53 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									setup_device_and_swap_chain(windowHandle);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									setup_render_targets();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									setup_debug_interface();
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-05 15:36:53 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void dxGraphicsContext::setup_device_and_swap_chain(GLFWwindow *windowHandle)
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-06 14:02:50 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									auto context = std::static_pointer_cast<dxSharedContext>(m_shared_context);
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// swap chain desc
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-06 14:02:50 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									auto sd = DXGI_SWAP_CHAIN_DESC { 0 };
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// buffer desc
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-05 13:28:41 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									sd.BufferDesc.Width = 1u;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									sd.BufferDesc.Height = 1u;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									sd.BufferDesc.RefreshRate.Numerator = NULL;   // :#todo
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									sd.BufferDesc.RefreshRate.Denominator = NULL; // :#todo
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-05 13:28:41 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									sd.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									sd.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// sample desc (for multi sampling) #todo: implement multi-samplingz
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-05 13:28:41 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									sd.SampleDesc.Count = 1u;
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									sd.SampleDesc.Quality = 0u;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// #todo: support swap chains with more than 1 back-buffer
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									sd.BufferCount = 1u;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// #todo: don't handle Windows's window with glfw, create it yourself
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									sd.OutputWindow = static_cast<HWND>(glfwGetWin32Window(windowHandle));
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-05 13:28:41 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									sd.Windowed = true;
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									sd.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									sd.Flags = NULL;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// determine device flags
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-06 14:02:50 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									auto flags = UINT { NULL };
							 | 
						
					
						
							
								
									
										
										
										
											2021-06-15 09:39:11 +04:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#ifdef LIGHT_DEBUG
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									flags = D3D11_CREATE_DEVICE_DEBUG;
							 | 
						
					
						
							
								
									
										
										
										
											2021-06-15 09:39:11 +04:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#endif
							 | 
						
					
						
							
								
									
										
										
										
											2021-06-02 09:07:45 +04:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// create device and swap chain
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-05 15:36:53 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									dxc(D3D11CreateDeviceAndSwapChain(
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-05 13:28:41 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									    nullptr,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    D3D_DRIVER_TYPE_HARDWARE,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    NULL,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    flags,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    nullptr,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    NULL,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    D3D11_SDK_VERSION,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    &sd,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    &context->GetSwapChainRef(),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    &context->GetDeviceRef(),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    nullptr,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    &context->GetDeviceContextRef()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									));
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-05 15:36:53 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void dxGraphicsContext::setup_render_targets()
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-06 14:02:50 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									auto context = std::static_pointer_cast<dxSharedContext>(m_shared_context);
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// set primitive topology
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-05 15:36:53 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									context->get_device_context()->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// create render target view
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-06 14:02:50 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									auto backBuffer = Microsoft::WRL::ComPtr<ID3D11Resource> {};
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-05 15:36:53 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									dxc(context->get_swap_chain()->GetBuffer(0u, __uuidof(ID3D11Resource), &backBuffer));
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-11 14:05:59 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									dxc(context->get_device()->CreateRenderTargetView(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    backBuffer.Get(),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    nullptr,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    &context->GetRenderTargetViewRef()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									));
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// set render target view
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-05 15:36:53 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									context->get_device_context()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    ->OMSetRenderTargets(1u, context->get_render_target_view().GetAddressOf(), nullptr);
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-05 15:36:53 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void dxGraphicsContext::setup_debug_interface()
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2021-06-19 15:12:42 +04:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#ifdef LIGHT_DEBUG
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-05 14:23:01 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									Ref<dxSharedContext> context = std::static_pointer_cast<dxSharedContext>(m_shared_context);
							 | 
						
					
						
							
								
									
										
										
										
											2021-06-15 09:39:11 +04:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									HRESULT hr;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									Microsoft::WRL::ComPtr<ID3D11Debug> debugInterface = nullptr;
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-05 15:36:53 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									dxc(context->get_device()->QueryInterface(__uuidof(ID3D11Debug), &debugInterface));
							 | 
						
					
						
							
								
									
										
										
										
											2021-07-22 13:00:41 +04:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									Microsoft::WRL::ComPtr<ID3D11InfoQueue> infoQueue = nullptr;
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-05 15:36:53 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									dxc(debugInterface->QueryInterface(__uuidof(ID3D11InfoQueue), &infoQueue));
							 | 
						
					
						
							
								
									
										
										
										
											2021-07-22 13:00:41 +04:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									infoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_CORRUPTION, true);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									infoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_ERROR, true);
							 | 
						
					
						
							
								
									
										
										
										
											2021-06-15 09:39:11 +04:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									D3D11_MESSAGE_ID hide[] = {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										D3D11_MESSAGE_ID_UNKNOWN,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										// #todo: add more messages here as needed
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									};
							 | 
						
					
						
							
								
									
										
										
										
											2021-06-15 09:39:11 +04:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									D3D11_INFO_QUEUE_FILTER filter = {};
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-05 13:28:41 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									filter.DenyList.NumIDs = _countof(hide);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									filter.DenyList.pIDList = hide;
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									infoQueue->AddStorageFilterEntries(&filter);
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-05 15:36:53 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									infoQueue->release();
							 | 
						
					
						
							
								
									
										
										
										
											2021-06-21 18:08:25 +04:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#endif
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-05 15:36:53 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void dxGraphicsContext::log_debug_data()
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-06 14:02:50 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									auto context = std::static_pointer_cast<dxSharedContext>(m_shared_context);
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// locals
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-06 14:02:50 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									auto *DXGIDevice = (IDXGIDevice *) {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									auto *DXGIAdapter = (IDXGIAdapter *) {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									auto *DXGIAdapterDesc = (DXGI_ADAPTER_DESC *) {};
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-05 15:36:53 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									context->get_device()->QueryInterface(__uuidof(IDXGIDevice), (void **)&DXGIDevice);
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									DXGIDevice->GetAdapter(&DXGIAdapter);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									DXGIAdapter->GetDesc(&DXGIAdapterDesc);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// get the adapter's description
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-06 14:02:50 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									auto DefChar = ' ';
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									char ch[180];
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									WideCharToMultiByte(CP_ACP, 0, DXGIAdapterDesc.Description, -1, ch, 180, &DefChar, NULL);
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-06 14:02:50 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									auto adapterDesc = std::string { ch };
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// release memory
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-05 15:36:53 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									DXGIDevice->release();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									DXGIAdapter->release();
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// #todo: log more information
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-06 16:30:38 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									log_inf("________________________________________");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									log_inf("dxGraphicsContext:");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									log_inf("        renderer: {}", adapterDesc);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									log_inf("________________________________________");
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-07 21:57:00 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-11 00:05:48 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								} // namespace lt
							 |