From: Seungha Yang Date: Fri, 5 May 2023 12:53:44 +0000 (+0900) Subject: d3d11memory: Don't clear wrapped texture memory X-Git-Tag: 1.22.7~301 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;ds=inline;h=e23645b5ad364658dcd8840f4754c08007a4d2fb;p=platform%2Fupstream%2Fgstreamer.git d3d11memory: Don't clear wrapped texture memory The external texture may hold already rendered scene and therefore it should not be cleared in alloc method Part-of: --- diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11memory.cpp b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11memory.cpp index ccefdc3..a593701 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11memory.cpp +++ b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11memory.cpp @@ -1473,6 +1473,7 @@ gst_d3d11_allocator_alloc_internal (GstD3D11Allocator * self, GstD3D11Memory *dmem; ID3D11RenderTargetView *rtv = nullptr; GstD3D11ClearRTVFunc clear_func = nullptr; + gboolean is_new_texture = TRUE; device_handle = gst_d3d11_device_get_device_handle (device); @@ -1482,6 +1483,8 @@ gst_d3d11_allocator_alloc_internal (GstD3D11Allocator * self, GST_ERROR_OBJECT (self, "Couldn't create texture"); return nullptr; } + } else { + is_new_texture = FALSE; } mem = @@ -1489,6 +1492,10 @@ gst_d3d11_allocator_alloc_internal (GstD3D11Allocator * self, if (!mem) return nullptr; + /* Don't clear external texture */ + if (!is_new_texture) + return mem; + /* Clear with YUV black if needed and possible * TODO: do this using UAV if RTV is not allowed (e.g., packed YUV formats) */ if ((desc->BindFlags & D3D11_BIND_RENDER_TARGET) == 0)