Render examples.

This commit is contained in:
Jeroen van Rijn
2025-10-10 12:24:28 +02:00
parent 4068eeb5fa
commit ece213afca
29 changed files with 146 additions and 139 deletions
+18 -17
View File
@@ -23,9 +23,6 @@ Example:
fmt.printfln("CPU cores: %vc/%vt", si.cpu.physical_cores, si.cpu.logical_cores)
fmt.printfln("RAM: %#.1M", si.ram.total_ram)
// fmt.printfln("Features: %v", si.cpu.features)
// fmt.printfln("MacOS version: %v", si.macos_version)
fmt.println()
for gpu, i in si.gpus {
fmt.printfln("GPU #%v:", i)
@@ -37,26 +34,30 @@ Example:
- Example Windows output:
Odin: dev-2022-09
OS: Windows 10 Professional (version: 20H2), build: 19042.1466
OS: OS_Version{
Odin: dev-2025-10
OS: Windows 10 Professional (version: 22H2), build: 19045.6396
OS: OS_Version{
platform = "Windows",
major = 10,
minor = 0,
patch = 0,
_ = Version{
major = 10,
minor = 0,
patch = 0,
},
build = [
19042,
1466,
19045,
6396,
],
version = "20H2",
as_string = "Windows 10 Professional (version: 20H2), build: 19042.1466",
version = "22H2",
as_string = "Windows 10 Professional (version: 22H2), build: 19045.6396",
}
CPU: AMD Ryzen 7 1800X Eight-Core Processor
RAM: 64.0 GiB
CPU: AMD Ryzen 9 5950X 16-Core Processor
CPU cores: 16c/32t
RAM: 63.9 GiB
GPU #0:
Vendor: Advanced Micro Devices, Inc.
Model: Radeon RX Vega
VRAM: 8.0 GiB
Model: AMD Radeon RX 9070
VRAM: 15.9 GiB
- Example macOS output:
+7 -6
View File
@@ -285,25 +285,26 @@ init_gpu_info :: proc "contextless" () {
context = runtime.default_context()
gpu_list: [dynamic]GPU
gpu_index: int
for {
// TODO: Use registry APIs to iterate over entries instead of trying 0000..0009.
for gpu_index in 0..<10 {
key := fmt.tprintf("%v\\%04d", GPU_INFO_BASE, gpu_index)
gpu: ^GPU
if vendor, ok := read_reg_string(sys.HKEY_LOCAL_MACHINE, key, "ProviderName"); ok {
append(&gpu_list, GPU{vendor_name = vendor})
gpu = &gpu_list[len(gpu_list) - 1]
} else {
break
continue
}
if desc, ok := read_reg_string(sys.HKEY_LOCAL_MACHINE, key, "DriverDesc"); ok {
gpu_list[gpu_index].model_name = desc
gpu.model_name = desc
}
if vram, ok := read_reg_i64(sys.HKEY_LOCAL_MACHINE, key, "HardwareInformation.qwMemorySize"); ok {
gpu_list[gpu_index].total_ram = int(vram)
gpu.total_ram = int(vram)
}
gpu_index += 1
}
gpus = gpu_list[:]
}