Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ba8694f
feat(vdd-shaders): add vortex and wave shader pairs with HLSL sources…
cto-new[bot] Jan 18, 2026
b1785c3
Merge pull request #2 from zjoasan/feat-virtual-display-driver-hlsl-s…
cto-new[bot] Jan 18, 2026
5f1f975
added crt_shader.crt
zjoasan Jan 18, 2026
db988b8
feat(shader): add vortex_shader and wave_shader under Common/Include/…
cto-new[bot] Jan 20, 2026
9166780
Merge pull request #3 from zjoasan/feat/vdd-add-vortex-wave-shaders
cto-new[bot] Jan 20, 2026
e96668f
testcode intergation
zjoasan Jan 20, 2026
4901538
from another agent
zjoasan Jan 21, 2026
3eaaaa3
feat(igpu-shaders): prepare blind-review diffs for shader/iGPU integr…
cto-new[bot] Jan 21, 2026
40418e2
Merge pull request #6 from zjoasan/igpu-shader-prefix-blind-review-diffs
cto-new[bot] Jan 21, 2026
5baffdf
Delete testcode folder from repository root
cto-new[bot] Jan 21, 2026
c279ea9
Merge pull request #7 from zjoasan/chore/remove-testcode-folder
cto-new[bot] Jan 21, 2026
6b57a3c
originals
zjoasan Jan 21, 2026
4d0d6b3
feat(org-sync): align current files with orgfolder baseline and remar…
cto-new[bot] Jan 21, 2026
7041213
Merge pull request #8 from zjoasan/sync-orgfolder-baseline-remark-cur…
cto-new[bot] Jan 21, 2026
92ed279
refactor(structure): move CRT_shader.h to new include path and remove…
cto-new[bot] Jan 21, 2026
8f6ed41
Merge pull request #9 from zjoasan/refactor/move-crt-shader-to-common…
cto-new[bot] Jan 21, 2026
7c2b01a
chore(project): remove orgfolder and scripts directories
cto-new[bot] Jan 21, 2026
66a0c96
Merge pull request #10 from zjoasan/delete-orgfolder-scripts
cto-new[bot] Jan 21, 2026
c57785f
Delete BLIND_REVIEW_DIFFS_README.md
zjoasan Jan 21, 2026
2b39927
Delete AdapterOption.h.blind.diff
zjoasan Jan 21, 2026
9cb352b
Delete Driver.cpp.blind.diff
zjoasan Jan 21, 2026
8b7da0b
Delete Driver.h.blind.diff
zjoasan Jan 21, 2026
37b2ed0
Merge branch 'VirtualDrivers:master' into master
zjoasan Jan 21, 2026
674d71f
feat(dxgi-shared-shader): integrate DXGI shared texture and keyed mut…
cto-new[bot] Jan 21, 2026
6a3ae8a
Merge pull request #12 from zjoasan/feat-igpu-shader-dxgi-keyed-mutex
cto-new[bot] Jan 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 137 additions & 3 deletions Common/Include/AdapterOption.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include <wrl/client.h> // For ComPtr
#include <dxgi.h> // For IDXGIAdapter, IDXGIFactory1
#include <algorithm> // For sort
#include <wrl/client.h> // For ComPtr
#include <dxgi.h> // For IDXGIAdapter, IDXGIFactory1
#include <algorithm> // For sort
#include <setupapi.h>
#include <devguid.h>
#include <devpropdef.h>
Expand Down Expand Up @@ -65,6 +65,100 @@ vector<GPUInfo> getAvailableGPUs() {
return gpus;
}

// #--- // Find the integrated GPU (iGPU) from available adapters
// #--- // Returns optional LUID if iGPU is found, nullopt otherwise
// #--- inline std::optional<LUID> findiGPU() {
// #--- auto gpus = getAvailableGPUs();
// #--- if (gpus.empty()) {
// #--- return std::nullopt;
// #--- }
// #---
// #--- // iGPU detection criteria:
// #--- // 1. Not a software adapter (has dedicated video memory > 0)
// #--- // 2. Low dedicated video memory (typically < 512MB for integrated)
// #--- // 3. Usually Intel HD/UHD graphics (Vendor ID 0x8086) or AMD APU (Vendor ID 0x1002)
// #--- // 4. Often the GPU with least dedicated memory (excluding software adapters)
// #---
// #--- const UINT64 iGPUMemoryThreshold = 512ULL * 1024ULL * 1024ULL; // 512MB threshold
// #--- const UINT intelVendorId = 0x8086; // Intel
// #--- const UINT amdVendorId = 0x1002; // AMD (for APUs)
// #---
// #--- std::optional<LUID> iGPULuid = std::nullopt;
// #--- UINT64 minDedicatedMemory = UINT64_MAX;
// #--- const GPUInfo* candidateGPU = nullptr;
// #---
// #--- // First pass: Look for Intel or AMD integrated graphics with low memory
// #--- for (const auto& gpu : gpus) {
// #--- const auto& desc = gpu.desc;
// #---
// #--- // Skip software adapters (zero dedicated memory)
// #--- if (desc.DedicatedVideoMemory == 0) {
// #--- continue;
// #--- }
// #---
// #--- // Check for integrated GPU characteristics
// #--- bool isLikelyiGPU = false;
// #---
// #--- // Check by vendor ID (Intel or AMD APU)
// #--- if (desc.VendorId == intelVendorId || desc.VendorId == amdVendorId) {
// #--- // Intel HD/UHD graphics typically have specific naming patterns
// #--- wstring name = desc.Description;
// #--- if (name.find(L"Intel") != wstring::npos &&
// #--- (name.find(L"HD") != wstring::npos || name.find(L"UHD") != wstring::npos)) {
// #--- isLikelyiGPU = true;
// #--- }
// #--- // Check if it has low dedicated memory (typical for iGPU)
// #--- if (desc.DedicatedVideoMemory < iGPUMemoryThreshold) {
// #--- isLikelyiGPU = true;
// #--- }
// #--- }
// #---
// #--- // Track the GPU with least dedicated memory (usually iGPU)
// #--- if (desc.DedicatedVideoMemory < minDedicatedMemory) {
// #--- minDedicatedMemory = desc.DedicatedVideoMemory;
// #--- // Prioritize Intel/AMD candidates, but also consider low memory GPUs
// #--- if (isLikelyiGPU || desc.DedicatedVideoMemory < iGPUMemoryThreshold) {
// #--- candidateGPU = &gpu;
// #--- }
// #--- }
// #--- }
// #---
// #--- // If we found a candidate with Intel/AMD or low memory, return it
// #--- if (candidateGPU != nullptr) {
// #--- return candidateGPU->desc.AdapterLuid;
// #--- }
// #---
// #--- // Fallback: If no clear iGPU found by vendor, return the GPU with least memory
// #--- // (assuming discrete GPUs typically have more memory)
// #--- if (minDedicatedMemory != UINT64_MAX && minDedicatedMemory < iGPUMemoryThreshold) {
// #--- for (const auto& gpu : gpus) {
// #--- if (gpu.desc.DedicatedVideoMemory == minDedicatedMemory) {
// #--- return gpu.desc.AdapterLuid;
// #--- }
// #--- }
// #--- }
// #---
// #--- return std::nullopt;
// #--- }

// #--- // Get iGPU name if available
// #--- inline wstring getiGPUName() {
// #--- auto luidOpt = findiGPU();
// #--- if (!luidOpt.has_value()) {
// #--- return L"";
// #--- }
// #---
// #--- auto gpus = getAvailableGPUs();
// #--- for (const auto& gpu : gpus) {
// #--- if (gpu.desc.AdapterLuid.LowPart == luidOpt.value().LowPart &&
// #--- gpu.desc.AdapterLuid.HighPart == luidOpt.value().HighPart) {
// #--- return gpu.name;
// #--- }
// #--- }
// #---
// #--- return L"";
// #--- }

// Resolve an adapter LUID from a PCI bus number by enumerating display devices (SetupAPI).
// Returns nullopt if no match is found or if the system doesn't expose the LUID property.
inline std::optional<LUID> ResolveAdapterLuidFromPciBus(uint32_t targetBusIndex) {
Expand Down Expand Up @@ -133,6 +227,12 @@ class AdapterOption {
LUID adapterLuid{}; // Adapter's unique identifier (LUID)
wstring target_name{}; // Target adapter name

// #--- // --- iGPU SUPPORT ---
// #--- bool hasiGPU{}; // Indicates if an iGPU was detected
// #--- LUID iGPULuid{}; // Integrated GPU's unique identifier (LUID)
// #--- wstring iGPU_name{}; // Integrated GPU name
// #--- // --- END iGPU SUPPORT ---

// Select the best GPU based on dedicated video memory
wstring selectBestGPU() {
auto gpus = getAvailableGPUs();
Expand Down Expand Up @@ -187,6 +287,40 @@ class AdapterOption {
}
}

// #--- // --- iGPU DETECTION METHODS ---
// #--- // Detect and select the integrated GPU (iGPU)
// #--- // Returns true if iGPU is found and set, false otherwise
// #--- bool selectiGPU() {
// #--- auto luidOpt = findiGPU();
// #--- if (luidOpt.has_value()) {
// #--- iGPULuid = luidOpt.value();
// #--- iGPU_name = getiGPUName();
// #--- hasiGPU = true;
// #--- return true;
// #--- }
// #--- hasiGPU = false;
// #--- return false;
// #--- }
// #---
// #--- // Get the iGPU LUID if available
// #--- std::optional<LUID> getiGPULuid() const {
// #--- if (hasiGPU) {
// #--- return iGPULuid;
// #--- }
// #--- return std::nullopt;
// #--- }
// #---
// #--- // Check if iGPU is available
// #--- bool hasIntegratedGPU() const {
// #--- return hasiGPU;
// #--- }
// #---
// #--- // Get iGPU name
// #--- wstring getiGPUName() const {
// #--- return iGPU_name;
// #--- }
// #--- // --- END iGPU DETECTION METHODS ---

private:
// Find and set the adapter by name, optionally using "name,bus" where bus is the PCI bus number.
bool findAndSetAdapter(const wstring& adapterSpec) {
Expand Down
Loading