[vlc-commits] direct3d11: use D3D11_MAP_WRITE to update the shader constants

Steve Lhomme git at videolan.org
Thu Feb 8 14:32:30 CET 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Feb  8 13:30:55 2018 +0100| [73b5de4394f0bc5e076c0514257b4b6417ed179b] | committer: Steve Lhomme

direct3d11: use D3D11_MAP_WRITE to update the shader constants

Otherwise the other fields are lost when updating one field

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=73b5de4394f0bc5e076c0514257b4b6417ed179b
---

 modules/video_output/win32/direct3d11.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 435ad00208..fa50bce6a7 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1048,7 +1048,7 @@ static void UpdateQuadLuminanceScale(vout_display_t *vd, d3d_quad_t *quad, float
     if (quad->f_luminance_scale == luminanceScale)
         return;
 
-    HRESULT hr = ID3D11DeviceContext_Map(sys->d3d_dev.d3dcontext, (ID3D11Resource *)quad->pPixelShaderConstants[0], 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
+    HRESULT hr = ID3D11DeviceContext_Map(sys->d3d_dev.d3dcontext, (ID3D11Resource *)quad->pPixelShaderConstants[0], 0, D3D11_MAP_WRITE, 0, &mappedResource);
     if (SUCCEEDED(hr)) {
         PS_CONSTANT_BUFFER *dst_data = mappedResource.pData;
         quad->f_luminance_scale = luminanceScale;
@@ -2882,7 +2882,7 @@ static void UpdateQuadOpacity(vout_display_t *vd, const d3d_quad_t *quad, float
     vout_display_sys_t *sys = vd->sys;
     D3D11_MAPPED_SUBRESOURCE mappedResource;
 
-    HRESULT hr = ID3D11DeviceContext_Map(sys->d3d_dev.d3dcontext, (ID3D11Resource *)quad->pPixelShaderConstants[0], 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
+    HRESULT hr = ID3D11DeviceContext_Map(sys->d3d_dev.d3dcontext, (ID3D11Resource *)quad->pPixelShaderConstants[0], 0, D3D11_MAP_WRITE, 0, &mappedResource);
     if (SUCCEEDED(hr)) {
         PS_CONSTANT_BUFFER *dst_data = mappedResource.pData;
         dst_data->Opacity = opacity;



More information about the vlc-commits mailing list