[vlc-commits] direct3d11: rename the texture mapping functions
Steve Lhomme
git at videolan.org
Wed Feb 8 14:46:02 CET 2017
vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Wed Feb 8 14:27:00 2017 +0100| [10a5d70c422a50562e8ee1f03092d4c0b005b07c] | committer: Jean-Baptiste Kempf
direct3d11: rename the texture mapping functions
And move the code to avoid declaration + definition.
Make Direct3D11UnmapPoolTexture void to be compatible with the pool unlock
prototype.
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=10a5d70c422a50562e8ee1f03092d4c0b005b07c
---
modules/video_output/win32/direct3d11.c | 53 ++++++++++++++++-----------------
1 file changed, 25 insertions(+), 28 deletions(-)
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index e7eef8b..f86456d 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -214,8 +214,6 @@ static void Direct3D11DestroyPool(vout_display_t *);
static void DestroyDisplayPicture(picture_t *);
static void DestroyDisplayPoolPicture(picture_t *);
-static int Direct3D11MapTexture(picture_t *);
-static int Direct3D11UnmapTexture(picture_t *);
static void Direct3D11DeleteRegions(int, picture_t **);
static int Direct3D11MapSubpicture(vout_display_t *, int *, picture_t ***, subpicture_t *);
@@ -401,6 +399,28 @@ static const char *globPixelShaderBiplanarYUYV_2RGB = "\
}\
";
+static int Direct3D11MapPoolTexture(picture_t *picture)
+{
+ picture_sys_pool_t *p_sys = (picture_sys_pool_t*) picture->p_sys;
+ vout_display_t *vd = p_sys->vd;
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+ HRESULT hr;
+ hr = ID3D11DeviceContext_Map(vd->sys->d3dcontext, (ID3D11Resource *)p_sys->texture, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
+ if( FAILED(hr) )
+ {
+ msg_Dbg( vd, "failed to map the texture (hr=0x%lX)", hr );
+ return VLC_EGENERIC;
+ }
+ return CommonUpdatePicture(picture, NULL, mappedResource.pData, mappedResource.RowPitch);
+}
+
+static void Direct3D11UnmapPoolTexture(picture_t *picture)
+{
+ picture_sys_pool_t *p_sys = (picture_sys_pool_t*)picture->p_sys;
+ vout_display_t *vd = p_sys->vd;
+ ID3D11DeviceContext_Unmap(vd->sys->d3dcontext, (ID3D11Resource *)p_sys->texture, 0);
+}
+
#if !VLC_WINSTORE_APP
static int OpenHwnd(vout_display_t *vd)
{
@@ -1175,7 +1195,7 @@ static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
ID3D11DeviceContext_ClearDepthStencilView(sys->d3dcontext, sys->d3ddepthStencilView, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0);
if ( !is_d3d11_opaque(picture->format.i_chroma))
- Direct3D11UnmapTexture(picture);
+ Direct3D11UnmapPoolTexture(picture);
/* Render the quad */
DisplayD3DPicture(sys, &sys->picQuad, sys->picQuad.picSys.resourceView);
@@ -1745,8 +1765,8 @@ static int Direct3D11CreatePool(vout_display_t *vd, video_format_t *fmt)
memset(&pool_cfg, 0, sizeof(pool_cfg));
pool_cfg.picture_count = 1;
pool_cfg.picture = &picture;
- pool_cfg.lock = Direct3D11MapTexture;
- //pool_cfg.unlock = Direct3D11UnmapTexture;
+ pool_cfg.lock = Direct3D11MapPoolTexture;
+ //pool_cfg.unlock = Direct3D11UnmapPoolTexture;
sys->sys.pool = picture_pool_NewExtended(&pool_cfg);
if (!sys->sys.pool) {
@@ -2239,29 +2259,6 @@ static void Direct3D11DestroyResources(vout_display_t *vd)
msg_Dbg(vd, "Direct3D11 resources destroyed");
}
-static int Direct3D11MapTexture(picture_t *picture)
-{
- picture_sys_pool_t *p_sys = (picture_sys_pool_t*) picture->p_sys;
- vout_display_t *vd = p_sys->vd;
- D3D11_MAPPED_SUBRESOURCE mappedResource;
- HRESULT hr;
- hr = ID3D11DeviceContext_Map(vd->sys->d3dcontext, (ID3D11Resource *)p_sys->texture, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
- if( FAILED(hr) )
- {
- msg_Dbg( vd, "failed to map the texture (hr=0x%lX)", hr );
- return VLC_EGENERIC;
- }
- return CommonUpdatePicture(picture, NULL, mappedResource.pData, mappedResource.RowPitch);
-}
-
-static int Direct3D11UnmapTexture(picture_t *picture)
-{
- picture_sys_pool_t *p_sys = (picture_sys_pool_t*)picture->p_sys;
- vout_display_t *vd = p_sys->vd;
- ID3D11DeviceContext_Unmap(vd->sys->d3dcontext, (ID3D11Resource *)p_sys->texture, 0);
- return VLC_SUCCESS;
-}
-
static void Direct3D11DeleteRegions(int count, picture_t **region)
{
for (int i = 0; i < count; ++i) {
More information about the vlc-commits
mailing list