Commit 085a3bfe authored by Laszlo Agocs's avatar Laszlo Agocs

d3d: prevent pch breaks caused by including com stuff in public header

parent c07c86df
......@@ -61,9 +61,11 @@ QRhiD3D11::QRhiD3D11(QRhiInitParams *params)
debugLayer = d3dparams->enableDebugLayer;
importedDevice = d3dparams->importExistingDevice;
if (importedDevice) {
dev = d3dparams->dev;
if (SUCCEEDED(d3dparams->context->QueryInterface(IID_ID3D11DeviceContext1, reinterpret_cast<void **>(&context)))) {
d3dparams->context->Release();
dev = reinterpret_cast<ID3D11Device *>(d3dparams->dev);
ID3D11DeviceContext *ctx = reinterpret_cast<ID3D11DeviceContext *>(d3dparams->context);
if (SUCCEEDED(ctx->QueryInterface(IID_ID3D11DeviceContext1, reinterpret_cast<void **>(&context)))) {
// get rid of the ref added by QueryInterface
ctx->Release();
} else {
qWarning("ID3D11DeviceContext1 not supported by context, cannot import");
importedDevice = false;
......
......@@ -39,8 +39,8 @@
#include <QtRhi/qrhi.h>
#ifdef Q_OS_WIN
#include <d3d11_1.h>
// no d3d includes here, to prevent precompiled header mess (due to this being
// a public header)
QT_BEGIN_NAMESPACE
......@@ -51,12 +51,10 @@ struct Q_RHI_EXPORT QRhiD3D11InitParams : public QRhiInitParams
bool importExistingDevice = false;
// both must be given when importExistingDevice is true. ownership not taken.
// leave them unset otherwise.
ID3D11Device *dev = nullptr;
ID3D11DeviceContext *context = nullptr;
void *dev = nullptr;
void *context = nullptr;
};
QT_END_NAMESPACE
#endif // Q_OS_WIN
#endif
......@@ -46,6 +46,7 @@
#include <QShaderDescription>
#include <QWindow>
#include <d3d11_1.h>
#include <dxgi1_3.h>
QT_BEGIN_NAMESPACE
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment