vlc | branch: master | Steve Lhomme <[email protected]> | Fri Jul 13 14:10:19 2018 +0200| [8672af25565dbf3edc1ecce03ac0686cef662906] | committer: Steve Lhomme
direct3d11: separate the Vertex Shader from the quad The quad is related to the pixels, not really the geometry > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8672af25565dbf3edc1ecce03ac0686cef662906 --- modules/video_output/win32/d3d11_quad.c | 10 +++------- modules/video_output/win32/d3d11_quad.h | 5 ++--- modules/video_output/win32/d3d11_shaders.h | 1 - modules/video_output/win32/direct3d11.c | 13 ++++++++----- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/modules/video_output/win32/d3d11_quad.c b/modules/video_output/win32/d3d11_quad.c index b896c4d5ca..51609bee05 100644 --- a/modules/video_output/win32/d3d11_quad.c +++ b/modules/video_output/win32/d3d11_quad.c @@ -41,7 +41,7 @@ #define nbLatBands SPHERE_SLICES #define nbLonBands SPHERE_SLICES -void D3D11_RenderQuad(d3d11_device_t *d3d_dev, d3d_quad_t *quad, +void D3D11_RenderQuad(d3d11_device_t *d3d_dev, d3d_quad_t *quad, d3d_vshader_t *vsshader, ID3D11ShaderResourceView *resourceView[D3D11_MAX_SHADER_VIEW], ID3D11RenderTargetView *d3drenderTargetView[D3D11_MAX_SHADER_VIEW]) { @@ -51,13 +51,13 @@ void D3D11_RenderQuad(d3d11_device_t *d3d_dev, d3d_quad_t *quad, ID3D11DeviceContext_IASetPrimitiveTopology(d3d_dev->d3dcontext, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); /* vertex shader */ - ID3D11DeviceContext_IASetInputLayout(d3d_dev->d3dcontext, quad->vertexShader.layout); + ID3D11DeviceContext_IASetInputLayout(d3d_dev->d3dcontext, vsshader->layout); ID3D11DeviceContext_IASetVertexBuffers(d3d_dev->d3dcontext, 0, 1, &quad->pVertexBuffer, &quad->vertexStride, &offset); ID3D11DeviceContext_IASetIndexBuffer(d3d_dev->d3dcontext, quad->pIndexBuffer, DXGI_FORMAT_R16_UINT, 0); if ( quad->pVertexShaderConstants ) ID3D11DeviceContext_VSSetConstantBuffers(d3d_dev->d3dcontext, 0, 1, &quad->pVertexShaderConstants); - ID3D11DeviceContext_VSSetShader(d3d_dev->d3dcontext, quad->vertexShader.shader, NULL, 0); + ID3D11DeviceContext_VSSetShader(d3d_dev->d3dcontext, vsshader->shader, NULL, 0); if (quad->d3dsampState[0]) ID3D11DeviceContext_PSSetSamplers(d3d_dev->d3dcontext, 0, 2, quad->d3dsampState); @@ -156,7 +156,6 @@ void D3D11_ReleaseQuad(d3d_quad_t *quad) ID3D11Buffer_Release(quad->pVertexBuffer); quad->pVertexBuffer = NULL; } - D3D11_ReleaseVertexShader(&quad->vertexShader); if (quad->pIndexBuffer) { ID3D11Buffer_Release(quad->pIndexBuffer); @@ -690,7 +689,6 @@ error: #undef D3D11_SetupQuad int D3D11_SetupQuad(vlc_object_t *o, d3d11_device_t *d3d_dev, const video_format_t *fmt, d3d_quad_t *quad, const display_info_t *displayFormat, const RECT *output, - d3d_vshader_t *shader, video_orientation_t orientation) { const bool RGB_shader = IsRGBShader(quad->formatInfo); @@ -841,8 +839,6 @@ int D3D11_SetupQuad(vlc_object_t *o, d3d11_device_t *d3d_dev, const video_format quad->cropViewport[i].MinDepth = 0.0f; quad->cropViewport[i].MaxDepth = 1.0f; } - D3D11_ReleaseVertexShader(&quad->vertexShader); - D3D11_SetVertexShader(&quad->vertexShader, shader); quad->resourceCount = DxgiResourceCount(quad->formatInfo); return VLC_SUCCESS; diff --git a/modules/video_output/win32/d3d11_quad.h b/modules/video_output/win32/d3d11_quad.h index 0b96433355..c39eb58307 100644 --- a/modules/video_output/win32/d3d11_quad.h +++ b/modules/video_output/win32/d3d11_quad.h @@ -45,7 +45,7 @@ typedef struct d3d_vertex_t { } texture; } d3d_vertex_t; -void D3D11_RenderQuad(d3d11_device_t *, d3d_quad_t *, +void D3D11_RenderQuad(d3d11_device_t *, d3d_quad_t *, d3d_vshader_t *, ID3D11ShaderResourceView *resourceViews[D3D11_MAX_SHADER_VIEW], ID3D11RenderTargetView *renderTarget[D3D11_MAX_SHADER_VIEW]); @@ -56,9 +56,8 @@ void D3D11_ReleaseQuad(d3d_quad_t *); int D3D11_SetupQuad(vlc_object_t *, d3d11_device_t *, const video_format_t *, d3d_quad_t *, const display_info_t *, const RECT *, - d3d_vshader_t *, video_orientation_t); -#define D3D11_SetupQuad(a,b,c,d,e,f,g,h) D3D11_SetupQuad(VLC_OBJECT(a),b,c,d,e,f,g,h) +#define D3D11_SetupQuad(a,b,c,d,e,f,g) D3D11_SetupQuad(VLC_OBJECT(a),b,c,d,e,f,g) bool D3D11_UpdateQuadPosition( vlc_object_t *, d3d11_device_t *, d3d_quad_t *, const RECT *output, video_orientation_t ); diff --git a/modules/video_output/win32/d3d11_shaders.h b/modules/video_output/win32/d3d11_shaders.h index 13c7d23596..7dd580a699 100644 --- a/modules/video_output/win32/d3d11_shaders.h +++ b/modules/video_output/win32/d3d11_shaders.h @@ -97,7 +97,6 @@ typedef struct UINT PSConstantsCount; ID3D11PixelShader *d3dpixelShader[D3D11_MAX_SHADER_VIEW]; ID3D11SamplerState *d3dsampState[2]; - d3d_vshader_t vertexShader; D3D11_VIEWPORT cropViewport[D3D11_MAX_SHADER_VIEW]; unsigned int i_width; unsigned int i_height; diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c index 6f7250e076..d32f50c90d 100644 --- a/modules/video_output/win32/direct3d11.c +++ b/modules/video_output/win32/direct3d11.c @@ -360,7 +360,6 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned pool_size) } if (D3D11_SetupQuad( vd, &sys->d3d_dev, &surface_fmt, &sys->picQuad, &sys->display, &sys->sys.rect_src_clipped, - vd->fmt.projection_mode == PROJECTION_MODE_RECTANGULAR ? &sys->flatVShader : &sys->projectionVShader, vd->fmt.orientation ) != VLC_SUCCESS) { msg_Err(vd, "Could not Create the main quad picture."); return NULL; @@ -908,12 +907,16 @@ static void Prepare(vout_display_t *vd, picture_t *picture, } /* Render the quad */ + ID3D11ShaderResourceView **resourceView; if (!is_d3d11_opaque(picture->format.i_chroma) || sys->legacy_shader) - D3D11_RenderQuad(&sys->d3d_dev, &sys->picQuad, sys->stagingSys.resourceView, sys->d3drenderTargetView); + resourceView = sys->stagingSys.resourceView; else { picture_sys_t *p_sys = ActivePictureSys(picture); - D3D11_RenderQuad(&sys->d3d_dev, &sys->picQuad, p_sys->resourceView, sys->d3drenderTargetView); + resourceView = p_sys->resourceView; } + D3D11_RenderQuad(&sys->d3d_dev, &sys->picQuad, + vd->fmt.projection_mode == PROJECTION_MODE_RECTANGULAR ? &sys->flatVShader : &sys->projectionVShader, + resourceView, sys->d3drenderTargetView); if (subpicture) { // draw the additional vertices @@ -921,7 +924,7 @@ static void Prepare(vout_display_t *vd, picture_t *picture, if (sys->d3dregions[i]) { d3d_quad_t *quad = (d3d_quad_t *) sys->d3dregions[i]->p_sys; - D3D11_RenderQuad(&sys->d3d_dev, quad, quad->picSys.resourceView, sys->d3drenderTargetView); + D3D11_RenderQuad(&sys->d3d_dev, quad, &sys->flatVShader, quad->picSys.resourceView, sys->d3drenderTargetView); } } } @@ -1681,7 +1684,7 @@ static int Direct3D11MapSubpicture(vout_display_t *vd, int *subpicture_region_co } err = D3D11_SetupQuad( vd, &sys->d3d_dev, &r->fmt, d3dquad, &sys->display, &output, - &sys->flatVShader, ORIENT_NORMAL ); + ORIENT_NORMAL ); if (err != VLC_SUCCESS) { msg_Err(vd, "Failed to setup %dx%d quad for OSD", r->fmt.i_visible_width, r->fmt.i_visible_height); _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
