vlc/vlc-3.0 | branch: master | Steve Lhomme <[email protected]> | Tue Jan 9 14:26:06 2018 +0100| [4ab5f9915fa6d63b2dd344b8c8b9a1c226aa3dc5] | committer: Steve Lhomme
d3d11_fmt: add a function to create the render targets for a texture (cherry picked from commit cfc6df0a17d32bdbfdc318567a633a1e85eb6a9b) > http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=4ab5f9915fa6d63b2dd344b8c8b9a1c226aa3dc5 --- modules/video_output/win32/d3d11_shaders.c | 23 +++++++++++++++++++++++ modules/video_output/win32/d3d11_shaders.h | 3 +++ 2 files changed, 26 insertions(+) diff --git a/modules/video_output/win32/d3d11_shaders.c b/modules/video_output/win32/d3d11_shaders.c index 8cb113e7ba..747916f1bb 100644 --- a/modules/video_output/win32/d3d11_shaders.c +++ b/modules/video_output/win32/d3d11_shaders.c @@ -514,3 +514,26 @@ float GetFormatLuminance(vlc_object_t *o, const video_format_t *fmt) return DEFAULT_BRIGHTNESS; } } + +HRESULT D3D11_CreateRenderTargets( d3d11_device_t *d3d_dev, ID3D11Resource *texture, + const d3d_format_t *cfg, ID3D11RenderTargetView *output[D3D11_MAX_SHADER_VIEW] ) +{ + D3D11_RENDER_TARGET_VIEW_DESC renderTargetViewDesc; + renderTargetViewDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; + renderTargetViewDesc.Texture2D.MipSlice = 0; + + for (size_t i=0; i<D3D11_MAX_SHADER_VIEW; i++) + { + if (cfg->resourceFormat[i]) + { + renderTargetViewDesc.Format = cfg->resourceFormat[i]; + HRESULT hr = ID3D11Device_CreateRenderTargetView(d3d_dev->d3ddevice, texture, + &renderTargetViewDesc, &output[i]); + if (FAILED(hr)) + { + return hr; + } + } + } + return S_OK; +} diff --git a/modules/video_output/win32/d3d11_shaders.h b/modules/video_output/win32/d3d11_shaders.h index f33182e4b0..5eb7e3bade 100644 --- a/modules/video_output/win32/d3d11_shaders.h +++ b/modules/video_output/win32/d3d11_shaders.h @@ -90,4 +90,7 @@ HRESULT D3D11_CompilePixelShader(vlc_object_t *, d3d11_handle_t *, bool legacy_s float GetFormatLuminance(vlc_object_t *, const video_format_t *); #define GetFormatLuminance(a,b) GetFormatLuminance(VLC_OBJECT(a),b) +HRESULT D3D11_CreateRenderTargets(d3d11_device_t *, ID3D11Resource *, const d3d_format_t *, + ID3D11RenderTargetView *output[D3D11_MAX_SHADER_VIEW]); + #endif /* VLC_D3D11_SHADERS_H */ _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
