[vlc-commits] direct3d11: keep the projection mode in the quad
Steve Lhomme
git at videolan.org
Fri Apr 27 15:33:00 CEST 2018
vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Apr 26 15:43:34 2018 +0200| [ea86a4cddc7ba47a8253031eb4c1380592ff4cd9] | committer: Hugo Beauzée-Luyssen
direct3d11: keep the projection mode in the quad
(cherry picked from commit f73b07e1e9af494efc68a397169863c95ef23c93)
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=ea86a4cddc7ba47a8253031eb4c1380592ff4cd9
---
modules/video_output/win32/direct3d11.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 0cf6e85cab..bd3abe9873 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -116,6 +116,7 @@ typedef struct
D3D11_VIEWPORT cropViewport;
unsigned int i_width;
unsigned int i_height;
+ video_projection_mode_t projection;
PS_CONSTANT_BUFFER shaderConstants;
} d3d_quad_t;
@@ -239,7 +240,6 @@ static int SetupQuad(vout_display_t *, const video_format_t *, d3d_quad_t *, con
video_orientation_t);
static bool UpdateQuadPosition( vout_display_t *vd, d3d_quad_t *quad,
const RECT *output,
- video_projection_mode_t projection,
video_orientation_t orientation );
static void ReleaseQuad(d3d_quad_t *);
static void UpdatePicQuadPosition(vout_display_t *);
@@ -973,7 +973,7 @@ static void UpdateSize(vout_display_t *vd)
UpdatePicQuadPosition(vd);
UpdateQuadPosition(vd, &sys->picQuad, &sys->sys.rect_src_clipped,
- vd->fmt.projection_mode, vd->fmt.orientation);
+ vd->fmt.orientation);
#if defined(HAVE_ID3D11VIDEODECODER)
if( sys->context_lock != INVALID_HANDLE_VALUE )
@@ -2662,13 +2662,12 @@ static void SetupQuadCube(d3d_vertex_t *dst_data, const RECT *output,
}
-static bool AllocQuadVertices(vout_display_t *vd, d3d_quad_t *quad,
- video_projection_mode_t projection)
+static bool AllocQuadVertices(vout_display_t *vd, d3d_quad_t *quad)
{
HRESULT hr;
vout_display_sys_t *sys = vd->sys;
- switch (projection)
+ switch (quad->projection)
{
case PROJECTION_MODE_RECTANGULAR:
quad->vertexCount = 4;
@@ -2683,7 +2682,7 @@ static bool AllocQuadVertices(vout_display_t *vd, d3d_quad_t *quad,
quad->indexCount = 6 * 2 * 3;
break;
default:
- msg_Warn(vd, "Projection mode %d not handled", projection);
+ msg_Warn(vd, "Projection mode %d not handled", quad->projection);
return false;
}
@@ -2721,7 +2720,6 @@ static bool AllocQuadVertices(vout_display_t *vd, d3d_quad_t *quad,
static bool UpdateQuadPosition( vout_display_t *vd, d3d_quad_t *quad,
const RECT *output,
- video_projection_mode_t projection,
video_orientation_t orientation )
{
vout_display_sys_t *sys = vd->sys;
@@ -2748,7 +2746,7 @@ static bool UpdateQuadPosition( vout_display_t *vd, d3d_quad_t *quad,
}
WORD *triangle_pos = mappedResource.pData;
- switch (projection)
+ switch (quad->projection)
{
case PROJECTION_MODE_RECTANGULAR:
SetupQuadFlat(dst_data, output, quad, triangle_pos, orientation);
@@ -2760,7 +2758,7 @@ static bool UpdateQuadPosition( vout_display_t *vd, d3d_quad_t *quad,
SetupQuadCube(dst_data, output, quad, triangle_pos);
break;
default:
- msg_Warn(vd, "Projection mode %d not handled", projection);
+ msg_Warn(vd, "Projection mode %d not handled", quad->projection);
return false;
}
@@ -2909,6 +2907,7 @@ static int SetupQuad(vout_display_t *vd, const video_format_t *fmt, d3d_quad_t *
goto error;
}
quad->PSConstantsCount = 2;
+ quad->projection = projection;
/* vertex shader constant buffer */
if (projection == PROJECTION_MODE_EQUIRECTANGULAR
@@ -2929,9 +2928,9 @@ static int SetupQuad(vout_display_t *vd, const video_format_t *fmt, d3d_quad_t *
quad->picSys.context = sys->d3d_dev.d3dcontext;
ID3D11DeviceContext_AddRef(quad->picSys.context);
- if (!AllocQuadVertices(vd, quad, projection))
+ if (!AllocQuadVertices(vd, quad))
goto error;
- if (!UpdateQuadPosition(vd, quad, output, projection, orientation))
+ if (!UpdateQuadPosition(vd, quad, output, orientation))
goto error;
quad->d3dpixelShader = d3dpixelShader;
@@ -3155,7 +3154,7 @@ static int Direct3D11MapSubpicture(vout_display_t *vd, int *subpicture_region_co
}
quad_picture = (*region)[i];
} else {
- UpdateQuadPosition(vd, (d3d_quad_t *) quad_picture->p_sys, &output, PROJECTION_MODE_RECTANGULAR, ORIENT_NORMAL);
+ UpdateQuadPosition(vd, (d3d_quad_t *) quad_picture->p_sys, &output, ORIENT_NORMAL);
}
hr = ID3D11DeviceContext_Map(sys->d3d_dev.d3dcontext, ((d3d_quad_t *) quad_picture->p_sys)->picSys.resource[KNOWN_DXGI_INDEX], 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
More information about the vlc-commits
mailing list