Add GPU text overlays and streamline SDK conversion paths
- add an internal DirectWrite/Direct2D OSD core for YUY2 and Y210 with configurable position, font size, RGB color, and up to 32 printable ASCII characters - expose per-channel OSD set/clear APIs and blend only the visible overlay rectangle on the GPU while preserving the frame read/release contract and tracking native versus processed buffer ownership - convert native YUY2/Y210 directly to BGRA8, RGB10A2, or NV12 with reusable output resources, avoiding unnecessary FP16 intermediates and scene copies - draw native-size and reduced previews directly to the swapchain and allocate an FP16 intermediate only for enlarged previews while retaining the existing upload queue and format support - bump the SDK version to 1.0.2, fix the installed customer API reference path, update conversion and OSD documentation, and remove the old 0922 SDK archive Validation: git diff --cached --check passed before commit. No SDK rebuild or hardware runtime validation was performed in this commit pass.
This commit is contained in:
@@ -1,30 +1,34 @@
|
||||
# Preview GPU path
|
||||
# Preview GPU conversion paths
|
||||
|
||||
The preview worker now runs:
|
||||
`gvfg_preview.dll` remains independent of `gvfg.dll`. Both targets compile
|
||||
one shared private conversion source, `d3d_conversion_pipeline.cpp`, into
|
||||
their own DLLs. There is no cross-DLL bridge, new public texture API, or
|
||||
runtime SDK dependency in the preview helper.
|
||||
|
||||
1. Execute the upload slot's command list (the SDK frame was already released by the caller).
|
||||
2. Convert packed YUY2/Y210 into a full-resolution FP16 target.
|
||||
3. Sample that FP16 target directly into the 8-bit or 10-bit swapchain, preserving aspect ratio.
|
||||
4. Present(0, 0). DXGI handles presentation waits; no application retry loop.
|
||||
CPU-buffer conversion uses dedicated outputs. YUY2/Y210 to NV12 preserves
|
||||
native luma and averages chroma vertically; Y210 codes are reduced to 8 bits.
|
||||
BGRA8 and RGB10A2 use one native RGB draw. No export path requires FP16 or a
|
||||
scene copy. Output targets and staging textures are allocated on demand and
|
||||
reused. Both NV12 plane copies are submitted before either CPU Map.
|
||||
|
||||
Compared with the previous preview, this removes one full-frame FP16 CopyResource per image. The 8-bit path also removes an intermediate BGRA8 draw and quantizes only at the swapchain. FP16 precision and the requested swapchain bit depth remain; no capture-frame decimation was added. Scaled 8-bit output may differ slightly because rounding now occurs after scaling instead of before it.
|
||||
Preview uploads remain in the existing four slots, with three FIFO pending
|
||||
frames and a 50 ms queue-age limit. Native-size and reduced-size preview draw
|
||||
directly into the swapchain. Reduction interpolates decoded RGB. Enlargement
|
||||
lazily allocates one FP16 target and uses hardware bilinear sampling, avoiding
|
||||
repeated native decoding for each enlarged output sample. All five existing
|
||||
formats retain their color/bit-depth rules. Preview has no CPU readback.
|
||||
|
||||
Each of the four upload slots owns its SRV; the worker no longer creates an SRV for every preview frame. YUY2/Y210 shaders use one packed texture load per output pixel. The old ProcAmp settings were fixed at neutral, so unused neighbor sharpness reads and neutral color adjustments were removed; BT.709 coefficients, packing, Y210 word shifts and odd-tail chroma behavior remain. Constant-buffer data updates only when source dimensions change, but its binding is restored each draw.
|
||||
## Verification (2026-10-12)
|
||||
|
||||
Preview-only resource initialization allocates only the FP16 conversion target, omitting scene, BGRA8 export, RGB10 export and NV12 planes. Export conversion still uses the default full resource path; no public capture or buffer API signature changed. Export shaders are not compiled for preview-only initialization.
|
||||
Rebuilt Release DLLs passed public YUY2/Y210 to BGRA8/RGB10A2/NV12 checks
|
||||
against independent CPU reference values, padded strides, chroma averaging,
|
||||
size/format switching, and odd-NV12 rejection. WARP and hardware tests of the
|
||||
private conversion source passed all five formats, 8/10-bit output, native,
|
||||
reduced and enlarged sizes, and cached/uncached source views. Actual independent
|
||||
preview DLL hidden-HWND tests passed format and precision switches, queue
|
||||
drain, clear and destruction. DLL imports and exports are checked separately.
|
||||
|
||||
Swapchain resize/release unbinds the render target before releasing local references. Preview configuration/resource changes and drawing share the D3D mutex. No GPU mutex is held while subsequently acquiring the renderer mutex in the worker completion path.
|
||||
|
||||
## Validation boundary
|
||||
|
||||
Source checks only in this change: no application/shader build, GPU timing or hardware playback test. These changes remove identifiable work but do not establish a GPU utilization reduction or identify the reported 10-bit startup failure.
|
||||
|
||||
User validation reported after the source change: GPU utilization decreased by approximately 15%. This is a user-reported observation, not an agent-run benchmark; baseline/final readings and whether the difference is relative or in percentage points were not specified. Resolution of the 10-bit startup failure was not reported.
|
||||
|
||||
Build the preview DLL with the changed shared pipeline source. If distributing the SDK GPU buffer converter, rebuild that DLL too because it shares the shader source. Keep the APP and preview DLL from the same delivery-statistics API revision.
|
||||
|
||||
On the target Ryzen 7 7700 system, compare identical resolution/FPS/window size and input formats before/after. Check 8-bit and 10-bit colors (including gradients), resize/fullscreen, repeated Start/Stop, Present skip counts and GPU engine utilization. Also verify public BGRA8/RGB10A2/NV12 buffer conversion if shipping its rebuilt DLL. Capture HRESULT details if 10-bit still fails; do not infer insufficient GPU capacity solely from utilization.
|
||||
|
||||
Expected preview pacing skips and audio queue evictions are not reported by the Sample. Preview/render failures, frame-ID anomalies, and audio write failures are logged as errors, aggregated at most once per five seconds. Mutex/drain/join waits service synchronous Windows sent messages without dispatching queued application input. Blocking Present still has no application timeout; device hangs and window transitions require hardware validation.
|
||||
|
||||
Preview queue policy: three pending/upload-reserved slots plus one presenting slot. Consume in enqueue order, keep frames within a 50 ms queue-age limit, and skip incoming frames only when capacity is full. Expired queued frames are counted in the existing replaced field (APP label: expired). This is not a 50 ms bound on blocking Present or physical scanout.
|
||||
These component tests do not establish long-run capture/recording stability,
|
||||
visible fullscreen behavior, physical monitor scanout, or Task Manager GPU
|
||||
percentages. Previous performance measurements motivated the adaptive scaling
|
||||
choice; this verification does not claim a new utilization benchmark.
|
||||
|
||||
@@ -643,10 +643,9 @@ private:
|
||||
renderFmt = gvfg::internal::GVFG_RENDER_FMT_RGBA16;
|
||||
else if (work.pixelFormat == GVFG_PREVIEW_PIXFMT_DICOM_YBR_FULL_422)
|
||||
renderFmt = gvfg::internal::GVFG_RENDER_FMT_DICOM_YBR_FULL_422;
|
||||
rendered = pipeline_->render_texture_to_fp16(work.texture.Get(), renderFmt,
|
||||
work.width, work.height, work.view.Get());
|
||||
if (rendered)
|
||||
presentResult = pipeline_->present_preview(work.width, work.height);
|
||||
presentResult = pipeline_->present_texture(work.texture.Get(), work.view.Get(), renderFmt,
|
||||
work.width, work.height, work.bitDepth);
|
||||
rendered = presentResult != gvfg::internal::GVFG_PREVIEW_PRESENT_FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -708,7 +707,7 @@ private:
|
||||
desc.swapchain_10bit = gvfg::internal::GVFG_RENDER_PREVIEW_BITDEPTH_AUTO;
|
||||
pipeline_->configurePreview(desc);
|
||||
pipeline_->set_source_bit_depth(sourceBitDepth > 0 ? sourceBitDepth : 8);
|
||||
const bool ready = pipeline_->ensure_rt_and_pipeline(width, height, true) &&
|
||||
const bool ready = pipeline_->ensure_states() &&
|
||||
pipeline_->ensure_preview_swapchain(width, height);
|
||||
return ready;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user