From 743acfb792ac145478cb1c79b03c188638cd1394 Mon Sep 17 00:00:00 2001 From: "Mark.lin" Date: Fri, 14 Aug 2026 16:39:04 +0800 Subject: [PATCH] swap:false --- .gitignore | 1 + sdk/gvfg/src/gpu/d3d_conversion_pipeline.cpp | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 0b75fd2..57597dd 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ CaptureDemo/CaptureDemo/release/ CaptureDemo/CaptureDemo/*.yuv CaptureDemo/CaptureDemo/*.raw CaptureDemo/CaptureDemo/*.rgb +CaptureDemo diff --git a/sdk/gvfg/src/gpu/d3d_conversion_pipeline.cpp b/sdk/gvfg/src/gpu/d3d_conversion_pipeline.cpp index 1f7f88e..ccb8ab6 100644 --- a/sdk/gvfg/src/gpu/d3d_conversion_pipeline.cpp +++ b/sdk/gvfg/src/gpu/d3d_conversion_pipeline.cpp @@ -170,7 +170,7 @@ Texture2D texP : register(t0); // true: interpret the raw chroma words as Y0,V,Y1,U. // false: interpret them as standard Y210 Y0,U,Y1,V. -static const bool kSwapUV = true; +static const bool kSwapUV = false; cbuffer ProcAmp : register(b0) { @@ -812,10 +812,10 @@ bool D3DPreviewPipeline::readback_to_buffer(void *destination, } bool D3DPreviewPipeline::readback_nv12_to_buffer(void *destination, - uint64_t destination_size, - int destination_row_bytes, - int frame_w, - int frame_h) + uint64_t destination_size, + int destination_row_bytes, + int frame_w, + int frame_h) { if (!d3d_ || !ctx_ || !destination || !rt_nv12_y_ || !rt_nv12_uv_ || frame_w <= 0 || frame_h <= 0 || (frame_w & 1) != 0 || (frame_h & 1) != 0 || @@ -826,7 +826,8 @@ bool D3DPreviewPipeline::readback_nv12_to_buffer(void *destination, return false; auto ensureStaging = [this](ComPtr &texture, UINT width, UINT height, - DXGI_FORMAT format) { + DXGI_FORMAT format) + { if (texture) { D3D11_TEXTURE2D_DESC current{}; @@ -856,7 +857,8 @@ bool D3DPreviewPipeline::readback_nv12_to_buffer(void *destination, auto copyPlane = [this, dst, destination_row_bytes](ID3D11Texture2D *source, ID3D11Texture2D *staging, int rows, int copyBytes, - size_t destinationOffset) { + size_t destinationOffset) + { ctx_->CopyResource(staging, source); D3D11_MAPPED_SUBRESOURCE mapped{}; if (FAILED(ctx_->Map(staging, 0, D3D11_MAP_READ, 0, &mapped))) @@ -980,8 +982,8 @@ bool D3DPreviewPipeline::upload_y210_frame(const uint8_t *data, int src_stride, bool D3DPreviewPipeline::render_uploaded_yuv_to_fp16(gvfg_render_pixfmt_t fmt, int frame_w, int frame_h) { ID3D11Texture2D *texture = fmt == GVFG_RENDER_FMT_YUY2 - ? upload_yuy2_packed_.Get() - : upload_y210_packed_.Get(); + ? upload_yuy2_packed_.Get() + : upload_y210_packed_.Get(); return render_texture_to_fp16(texture, fmt, frame_w, frame_h); }