Skip to content

Commit

Permalink
d3d11: more build env checks to avoid build error
Browse files Browse the repository at this point in the history
d3d11.h provided by mingw is not complete. maybe I can consider https://
github.com/gongminmin/UniversalDXSDK
  • Loading branch information
wang-bin committed Apr 7, 2016
1 parent d7e5dea commit baf7e69
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion config.tests/d3d11va/d3d11va.pro
Original file line number Diff line number Diff line change
@@ -1,6 1,6 @@
CONFIG -= qt
CONFIG = console

CONFIG = c 11
SOURCES = main.cpp
include(../paths.pri)
LIBS = -lavcodec
2 changes: 1 addition & 1 deletion config.tests/d3d11va/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 24,9 @@ extern "C" {
}
#include <wrl/client.h> //ComPtr is used in QtAV


int main()
{
av_d3d11va_alloc_context();
D3D11_VIDEO_PROCESSOR_STREAM s; //used by vp
return 0;
}
6 changes: 3 additions & 3 deletions src/codec/video/VideoDecoderD3D11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 176,16 @@ VideoFrame VideoDecoderD3D11::frame()
, view_desc.Texture2D.ArraySlice
, NULL);
struct ScopedMap {
ScopedMap(ComPtr<ID3D11DeviceContext> ctx, ComPtr<ID3D11Resource> res, D3D11_MAPPED_SUBRESOURCE *mapped): c(ctx), r(res) {
ScopedMap(ComPtr<ID3D11DeviceContext> ctx, ComPtr<ID3D11Texture2D> res, D3D11_MAPPED_SUBRESOURCE *mapped): c(ctx), r(res) {
DX_ENSURE(c->Map(r.Get(), 0, D3D11_MAP_READ, 0, mapped)); //TODO: check error
}
~ScopedMap() { c->Unmap(r.Get(), 0);}
ComPtr<ID3D11DeviceContext> c;
ComPtr<ID3D11Resource> r;
ComPtr<ID3D11Texture2D> r;
};

D3D11_MAPPED_SUBRESOURCE mapped;
ScopedMap sm(d.d3dctx, d.texture_cpu, &mapped);
ScopedMap sm(d.d3dctx, d.texture_cpu, &mapped); //mingw error if ComPtr<T> constructs from ComPtr<U> [T=ID3D11Resource, U=ID3D11Texture2D]
Q_UNUSED(sm);
int pitch[3] = { (int)mapped.RowPitch, 0, 0}; //compute chroma later
uint8_t *src[] = { (uint8_t*)mapped.pData, 0, 0}; //compute chroma later
Expand Down
1 change: 1 addition & 0 deletions src/directx/D3D11VP.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 23,7 @@
#define QTAV_D3D11VP_H
#include <d3d11.h>
#include <wrl/client.h>
#include <QtCore/QRect>
using namespace Microsoft::WRL;
namespace QtAV {
namespace dx {
Expand Down

0 comments on commit baf7e69

Please sign in to comment.