MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / init_instance

Function init_instance

tests/cgpu/DeviceInitialize/DeviceInitialize.cpp:29–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27};
28
29CGPUInstanceId init_instance(ECGPUBackend backend, bool enable_debug_layer, bool enableGPUValidation)
30{
31 SKR_DECLARE_ZERO(CGPUInstanceDescriptor, desc)
32 desc.backend = backend;
33 desc.enable_debug_layer = enable_debug_layer;
34 desc.enable_gpu_based_validation = enableGPUValidation;
35 CGPUInstanceId instance = cgpu_create_instance(&desc);
36 SKR_DECLARE_ZERO(CGPUInstanceFeatures, instance_features)
37 cgpu_query_instance_features(instance, &instance_features);
38 if (backend == ECGPUBackend::CGPU_BACKEND_VULKAN)
39 {
40 EXPECT_TRUE(instance_features.specialization_constant);
41 }
42 else if (backend == ECGPUBackend::CGPU_BACKEND_D3D12)
43 {
44 EXPECT_FALSE(instance_features.specialization_constant);
45 }
46 else if (backend == ECGPUBackend::CGPU_BACKEND_METAL)
47 {
48 EXPECT_TRUE(instance_features.specialization_constant);
49 }
50 return instance;
51}
52
53int enum_adapters(CGPUInstanceId instance)
54{

Callers 1

test_allMethod · 0.85

Calls 2

cgpu_create_instanceFunction · 0.85

Tested by 1

test_allMethod · 0.68