void RBench::Start(BOOLEAN trace) { // clock_t t1, t2, t3, t4; TaskState *t; Packet *workQ; if (trace) InitTrace(); else tracing = FALSE; InitScheduler(); // t1 = clock(); // printf("\nRichards benchmark: initializing...\n"); t = new TaskState; t->Running(); // Idler CreateIdler(Idler, 0, NoWork, t); workQ = new Packet(NoWork, Worker, WorkPacket); // Worker workQ = new Packet(workQ , Worker, WorkPacket); t = new TaskState; t->WaitingWithPacket(); CreateWorker(Worker, 1000, workQ, t); workQ = new Packet(NoWork, DeviceA, DevicePacket); // HandlerA workQ = new Packet(workQ , DeviceA, DevicePacket); workQ = new Packet(workQ , DeviceA, DevicePacket); t = new TaskState; t->WaitingWithPacket(); CreateHandler(HandlerA, 2000, workQ, t); workQ = new Packet(NoWork, DeviceB, DevicePacket); // HandlerB workQ = new Packet(workQ , DeviceB, DevicePacket); workQ = new Packet(workQ , DeviceB, DevicePacket); t = new TaskState; t->WaitingWithPacket(); CreateHandler(HandlerB, 3000, workQ, t); t = new TaskState; t->Waiting(); // DeviceA CreateDevice(DeviceA, 4000, NoWork, t); t = new TaskState; t->Waiting(); // DeviceB CreateDevice(DeviceB, 5000, NoWork, t); // printf("starting...\n"); // t2 = clock(); Schedule(); // t3 = clock(); // printf("done.\n"); // printf("QueuePacketCount = %d, HoldCount = %d.\nThese results are %s", // queuePacketCount, holdCount, // (queuePacketCount == 23246 && holdCount == 9297) ? // "correct." : "wrong!" // ); if (! (queuePacketCount == 23246 && holdCount == 9297)) { printf("error: richards results are incorrect\n"); } // t4 = clock(); // printf("\nScheduler time = %g seconds, total time = %g\n", // (double)(t3 - t2) / CLK_TCK, // (double)(t4 - t1) / CLK_TCK); }
bool AudioRenderer::Push(IMediaSample* pSample, AM_SAMPLE2_PROPERTIES& sampleProps, CAMEvent* pFilledEvent) { DspChunk chunk; { CAutoLock objectLock(this); assert(m_inputFormat); assert(m_state != State_Stopped); try { // Clear the device if related settings were changed. CheckDeviceSettings(); // Create the device if needed. if (!m_device) CreateDevice(); // Establish time/frame relation. chunk = m_sampleCorrection.ProcessSample(pSample, sampleProps, m_live || m_externalClock); // Apply clock corrections. if (!m_live && m_device && m_state == State_Running) ApplyClockCorrection(); // Apply dsp chain. if (m_device && !m_device->IsBitstream()) { auto f = [&](DspBase* pDsp) { pDsp->Process(chunk); }; EnumerateProcessors(f); DspChunk::ToFormat(m_device->GetDspFormat(), chunk); } // Apply rate corrections (rate matching and clock slaving). if (m_device && !m_device->IsBitstream() && m_device->IsRealtime() && m_state == State_Running) ApplyRateCorrection(chunk); // Don't deny the allocator its right to reuse IMediaSample while the chunk is hanging in the buffer. if (m_device && m_device->IsRealtime()) chunk.FreeMediaSample(); } catch (HRESULT) { ClearDevice(); } catch (std::bad_alloc&) { ClearDevice(); chunk = DspChunk(); } } // Send processed sample to the device. return PushToDevice(chunk, pFilledEvent); }
bool VulkanCommon::PrepareVulkan( OS::WindowParameters parameters ) { Window = parameters; if( !LoadVulkanLibrary() ) { return false; } if( !LoadExportedEntryPoints() ) { return false; } if( !LoadGlobalLevelEntryPoints() ) { return false; } if( !CreateInstance() ) { return false; } if( !LoadInstanceLevelEntryPoints() ) { return false; } if( !CreatePresentationSurface() ) { return false; } if( !CreateDevice() ) { return false; } if( !LoadDeviceLevelEntryPoints() ) { return false; } if( !GetDeviceQueue() ) { return false; } if( !CreateSwapChain() ) { return false; } return true; }
NTSTATUS DriverEntry(IN PDRIVER_OBJECT pDriverObject, IN PUNICODE_STRING pRegistryPath) { KdPrint(("%wZ DriverEntry.\r\n", pRegistryPath)); // 初始化事件、锁、链表头 KeInitializeEvent(&g_Event, SynchronizationEvent, TRUE); KeInitializeSpinLock(&g_Lock); InitializeListHead(&g_ListHead); // 开始注册表监控 CmRegisterCallback(RegistryCallback, 0, &g_Cookie); // 创建设备和符号链接 CreateDevice(pDriverObject); // IoControl pDriverObject->MajorFunction[IRP_MJ_CREATE] = CreateCompleteRoutine; pDriverObject->MajorFunction[IRP_MJ_CLOSE] = CloseCompleteRoutine; pDriverObject->MajorFunction[IRP_MJ_READ] = ReadCompleteRoutine; pDriverObject->MajorFunction[IRP_MJ_WRITE] = WriteCompleteRoutine; pDriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = DeviceControlCompleteRoutine; pDriverObject->DriverUnload = DriverUnload; return STATUS_SUCCESS; }
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) { _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); _CrtSetBreakAlloc(60); // Register the windows class WNDCLASS wndClass; wndClass.style = CS_DBLCLKS; wndClass.lpfnWndProc = StaticWndProc; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = 0; wndClass.hInstance = hInstance; wndClass.hIcon = NULL; wndClass.hCursor = LoadCursor( NULL, IDC_ARROW ); wndClass.hbrBackground = ( HBRUSH )GetStockObject( BLACK_BRUSH ); wndClass.lpszMenuName = NULL; wndClass.lpszClassName = "Direct3DWindowClass"; if( !RegisterClass( &wndClass ) ) { DWORD dwError = GetLastError(); if( dwError != ERROR_CLASS_ALREADY_EXISTS ) return -1; } // Find the window's initial size, but it might be changed later int nDefaultWidth = 1280; int nDefaultHeight = 720; RECT rc; SetRect( &rc, 0, 0, nDefaultWidth, nDefaultHeight ); AdjustWindowRect( &rc, WS_OVERLAPPEDWINDOW, false ); // Create the render window HWND hWnd = CreateWindow( "Direct3DWindowClass", "Vortex", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, ( rc.right - rc.left ), ( rc.bottom - rc.top ), 0, NULL, hInstance, 0 ); if( hWnd == NULL ) { DWORD dwError = GetLastError(); return -1; } gHWND = hWnd; ShowWindow( hWnd, SW_SHOW ); CreateDevice( nDefaultWidth, nDefaultHeight ); g_plugin.PluginPreInitialize(0,0); g_plugin.PluginInitialize( pD3DDevice, 0, 0, nDefaultWidth, nDefaultHeight, nDefaultHeight / (float)nDefaultWidth); MainLoop(); g_plugin.PluginQuit(); pD3DDevice->Release(); pD3D9->Release(); return 0; }
bool Tutorial01::PrepareVulkan() { if( !LoadVulkanLibrary() ) { return false; } if( !LoadExportedEntryPoints() ) { return false; } if( !LoadGlobalLevelEntryPoints() ) { return false; } if( !CreateInstance() ) { return false; } if( !LoadInstanceLevelEntryPoints() ) { return false; } if( !CreateDevice() ) { return false; } if( !LoadDeviceLevelEntryPoints() ) { return false; } if( !GetDeviceQueue() ) { return false; } return true; }
Context* Context::Create(const HWND i_renderingWindow) { IDirect3D9* direct3dInterface = nullptr; IDirect3DDevice9* direct3dDevice = nullptr; if (!CreateInterface(direct3dInterface) || !CreateDevice(direct3dInterface, i_renderingWindow, direct3dDevice) || !SetSamplerState(direct3dDevice) ) goto OnError; Context *context = new Context(i_renderingWindow); if (context) { context->direct3dDevice = direct3dDevice; context->direct3dInterface = direct3dInterface; } else { Lame::UserOutput::Display("Failed to create Direct3D Context, due to insufficient memory.", "Context Loading Error"); } return context; OnError: if (direct3dInterface) { if (direct3dDevice) { direct3dDevice->Release(); direct3dDevice = nullptr; } direct3dInterface->Release(); direct3dInterface = nullptr; } return nullptr; }
rhi::IDevice::Result Device::Create(rhi::IDeviceAdapter* pAdapter, bool withDbg) { m_pGpu = static_cast<DeviceAdapter*>(pAdapter)->m_pGpu; VkPhysicalDevice& Gpu = *static_cast<DeviceAdapter*>(pAdapter)->m_pGpu; vkGetPhysicalDeviceMemoryProperties(Gpu, &m_MemoryProperties); VkResult err = CreateDevice(Gpu, withDbg, &m_Device); if (err) { VKLOG(Fatal, "Device-Create: Could not create Vulkan Device : %s.", ErrorString(err).c_str()); return rhi::IDevice::DeviceNotFound; } else { LoadVulkan(RHIRoot::GetInstance(), m_Device); #if K3DPLATFORM_OS_WIN && _DEBUG if (withDbg) { SetupDebugging(RHIRoot::GetInstance(), VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_REPORT_WARNING_BIT_EXT | VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT, nullptr); } #endif m_ResourceManager = std::make_unique<ResourceManager>(this, 1024, 1024); m_ContextPool = std::make_unique<CommandContextPool>(this); InitCmdQueue(VK_QUEUE_GRAPHICS_BIT, m_GfxQueueIndex, 0); return rhi::IDevice::DeviceFound; } }
extern "C" NTSTATUS DriverEntry ( IN PDRIVER_OBJECT pDriverObject, IN PUNICODE_STRING pRegistryPath ) { NTSTATUS status; KdPrint(("Enter DriverEntry\n")); //注册其他驱动调用函数入口 pDriverObject->DriverUnload = IoDriverUnload; pDriverObject->MajorFunction[IRP_MJ_CREATE] = HOSTZHEN_DispatchCreateClose; pDriverObject->MajorFunction[IRP_MJ_CLOSE] = HOSTZHEN_DispatchCreateClose; pDriverObject->MajorFunction[IRP_MJ_WRITE] = HOSTZHEN_DispatchCreateClose; pDriverObject->MajorFunction[IRP_MJ_READ] = HOSTZHEN_DispatchCreateClose; pDriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = IoDispatchDeviceControl; //_asm int 3 //创建驱动设备对象 status = CreateDevice(pDriverObject); pDriverObject->Flags |= DO_BUFFERED_IO; g_pSystemProcess = PsGetCurrentProcess(); g_pDriverObj = pDriverObject; g_KeServiceDescriptorTableShadow = (PServiceDescriptorTable)GetKeServiceDescriptorTableShadow(); DataInitialize(); KdPrint(("DriverEntry end\n")); return status; }
extern "C" NTSTATUS DriverEntry( IN PDRIVER_OBJECT pDriverObject, IN PUNICODE_STRING pRegistryPath) { //入口程序 //设置卸载派遣函数 pDriverObject->DriverUnload=DriverUnload; DbgPrint("DriverEntry Started!\n"); //设置相应派遣函数 pDriverObject->MajorFunction[IRP_MJ_CREATE]=DDKDispatchRoutine; pDriverObject->MajorFunction[IRP_MJ_CLOSE]=DDKDispatchRoutine; pDriverObject->MajorFunction[IRP_MJ_READ]=DDKDispatchRoutine; pDriverObject->MajorFunction[IRP_MJ_WRITE]=DDKDispatchRoutine; pDriverObject->MajorFunction[IRP_MJ_CLEANUP]=DDKDispatchRoutine; pDriverObject->MajorFunction[IRP_MJ_SET_INFORMATION]=DDKDispatchRoutine; pDriverObject->MajorFunction[IRP_MJ_SHUTDOWN]=DDKDispatchRoutine; pDriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL]=DDKDispatchRoutine; //设置设备控制派遣函数 pDriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL]=DDKDeviceIoControl; //创建设备 NTSTATUS status=CreateDevice(pDriverObject); DbgPrint("DriverEntry Ended!\n"); return STATUS_SUCCESS; }
mini3d::OGLWrapper::OGLWrapper() : fullscreenWindow(0), oSWrapper(0) { oSWrapper = new OSWrapper(); CreateInternalWindow(); CreateDevice(); Init(); }
extern "C" NTSTATUS DriverEntry ( IN PDRIVER_OBJECT pDriverObject, IN PUNICODE_STRING pRegistryPath ) { NTSTATUS status = STATUS_SUCCESS; KdPrint(("Enter DriverEntry\n")); //注册其他驱动调用函数入口 pDriverObject->DriverUnload = HelloDDKUnload; pDriverObject->MajorFunction[IRP_MJ_CREATE] = HelloDDKDispatchRoutine; pDriverObject->MajorFunction[IRP_MJ_CLOSE] = HelloDDKDispatchRoutine; pDriverObject->MajorFunction[IRP_MJ_WRITE] = HelloDDKDispatchRoutine; pDriverObject->MajorFunction[IRP_MJ_READ] = HelloDDKDispatchRoutine; //创建驱动设备对象 status = CreateDevice(pDriverObject); UNICODE_STRING devName; RtlInitUnicodeString(&devName,L"\\Device\\MyDDKDevice");//浅拷贝 UNICODE_STRING tTestUnicode; RtlInitUnicodeString(&tTestUnicode,devName.Buffer); PrintInfo(pDriverObject); KdPrint(("DriverEntry end\n")); TestList(); TestLookaside(); return status; }
FeatureStatus DeviceManagerDx::CreateContentDevice() { RefPtr<IDXGIAdapter1> adapter; if (!mDeviceStatus->isWARP()) { adapter = GetDXGIAdapter(); if (!adapter) { gfxCriticalNote << "Could not get a DXGI adapter"; return FeatureStatus::Unavailable; } } HRESULT hr; RefPtr<ID3D11Device> device; UINT flags = D3D11_CREATE_DEVICE_BGRA_SUPPORT; D3D_DRIVER_TYPE type = mDeviceStatus->isWARP() ? D3D_DRIVER_TYPE_WARP : D3D_DRIVER_TYPE_UNKNOWN; if (!CreateDevice(adapter, type, flags, hr, device)) { gfxCriticalNote << "Recovered from crash while creating a D3D11 content device"; gfxWindowsPlatform::RecordContentDeviceFailure(TelemetryDeviceCode::Content); return FeatureStatus::CrashedInHandler; } if (FAILED(hr) || !device) { gfxCriticalNote << "Failed to create a D3D11 content device: " << hexa(hr); gfxWindowsPlatform::RecordContentDeviceFailure(TelemetryDeviceCode::Content); return FeatureStatus::Failed; } // InitializeD2D() will abort early if the compositor device did not support // texture sharing. If we're in the content process, we can't rely on the // parent device alone: some systems have dual GPUs that are capable of // binding the parent and child processes to different GPUs. As a safety net, // we re-check texture sharing against the newly created D3D11 content device. // If it fails, we won't use Direct2D. if (XRE_IsContentProcess()) { if (!D3D11Checks::DoesTextureSharingWork(device)) { return FeatureStatus::Failed; } DebugOnly<bool> ok = ContentAdapterIsParentAdapter(device); MOZ_ASSERT(ok); } { MutexAutoLock lock(mDeviceLock); mContentDevice = device; } mContentDevice->SetExceptionMode(0); RefPtr<ID3D10Multithread> multi; hr = mContentDevice->QueryInterface(__uuidof(ID3D10Multithread), getter_AddRefs(multi)); if (SUCCEEDED(hr) && multi) { multi->SetMultithreadProtected(TRUE); } return FeatureStatus::Available; }
void FrkKeyboard::Init(){ ZeroMemory(&m_hBuffer, sizeof(m_hBuffer)); InitDirectInput(); CreateDevice(); SetCooperativeLevel(); SetDataFormat(); Acquire(); }
bool CInputDevice::Create(HWND hWnd,HWND hWndD3D) { m_hWnd = hWnd; m_hWndD3D = hWndD3D; bool bResult = CreateDevice(); assert(bResult); return bResult; }
void FVulkanDevice::InitGPU(int32 DeviceIndex) { // Query features VulkanRHI::vkGetPhysicalDeviceFeatures(Gpu, &Features); UE_LOG(LogVulkanRHI, Display, TEXT("Geometry %d Tessellation %d"), Features.geometryShader, Features.tessellationShader); CreateDevice(); SetupFormats(); MemoryManager.Init(this); ResourceHeapManager.Init(); FenceManager.Init(this); StagingManager.Init(this, Queue); // allocate ring buffer memory UBRingBuffer = new FVulkanRingBuffer(this, VULKAN_UB_RING_BUFFER_SIZE, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT); #if VULKAN_ENABLE_PIPELINE_CACHE PipelineStateCache = new FVulkanPipelineStateCache(this); TArray<FString> CacheFilenames; if (PLATFORM_ANDROID) { CacheFilenames.Add(FPaths::GameDir() / TEXT("Build") / TEXT("ShaderCaches") / TEXT("Android") / TEXT("VulkanPSO.cache")); } CacheFilenames.Add(FPaths::GameSavedDir() / TEXT("VulkanPSO.cache")); PipelineStateCache->InitAndLoad(CacheFilenames); #endif bool bSupportsTimestamps = (GpuProps.limits.timestampComputeAndGraphics == VK_TRUE); if (bSupportsTimestamps) { check(!TimestampQueryPool[0]); for (int32 Index = 0; Index < NumTimestampPools; ++Index) { TimestampQueryPool[Index] = new FVulkanTimestampQueryPool(this); } } else { UE_LOG(LogVulkanRHI, Warning, TEXT("Timestamps not supported on Device")); } ImmediateContext = new FVulkanCommandListContext((FVulkanDynamicRHI*)GDynamicRHI, this, true); // Setup default resource { FSamplerStateInitializerRHI Default(SF_Point); DefaultSampler = new FVulkanSamplerState(Default, *this); } }
CComPtr<IAudioClient> CreateClient( const std::string& device_id, EDataFlow data_flow, ERole role) { if (device_id.empty()) return CreateDefaultClient(data_flow, role); CComPtr<IMMDevice> device(CreateDevice(device_id)); if (!device) return CComPtr<IAudioClient>(); return CreateClient(device); }
bool Graphics::Init(const HWND i_mainWindow) { if (!CreateInterface(i_mainWindow)) { return false; } // Create an interface to a Direct3D device if (CreateDevice(i_mainWindow)) { s_mainWindow = i_mainWindow; } else { goto OnError; } for (DWORD i = 0; i < 8; ++i) { s_direct3dDevice->SetSamplerState(i, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); s_direct3dDevice->SetSamplerState(i, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); s_direct3dDevice->SetSamplerState(i, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR); } m_light_1->Initialize(); g_font->Initialize(s_direct3dDevice, 20.0f); debug_menu = new DebugMenu(s_direct3dDevice); float *camSpeed = new float; camSpeed = &mainCamera_->camSpeed; #ifdef _DEBUG debug_menu->CreateSlider("Speed: ", 20.0f, 30.0f, camSpeed); //debug_menu->CreateSlider("TurnSpeed: ", 20.0f, 30.0f, camSpeed); debug_menu->CreateButton("Reset Cam:", &ResetCamera); debug_menu->CreateText("FPS: ", "60.0"); debug_menu->CreateDebugCube(); debug_menu->CreateDebugSphere(); bool *flyCamFlag = new bool; flyCamFlag = &mainCamera_->flyCam_; debug_menu->CreateCheckBox("FlyCam: ", flyCamFlag); #endif mainCamera_->Initialize(s_direct3dDevice, s_mainWindow); mainCamera_->Initialize(s_direct3dDevice, s_mainWindow); default_material = new Material("data/Models/Mario_Material.txt"); default_material->Initialize(s_direct3dDevice, s_mainWindow, m_light_1); mainCamera_->SetConstantTable(default_material->GetConstantTableVertex(), default_material->GetConstantTableFragment()); return true; OnError: ShutDown(); return false; }
/*------------------------------------------- main関数 --------------------------------------------*/ int wmain(int argc, WCHAR* argv[]) { HRESULT hr; // ロケールを設定 _wsetlocale(LC_ALL, L"Japanese"); // ********************************************************** // Direct3D11デバイスの作成 hr = CreateDevice(); // ********************************************************** // コンピュート・シェーダの作成 if (SUCCEEDED(hr)) hr = CreateShader(); // ********************************************************** // 定数バッファの作成 if (SUCCEEDED(hr)) hr = CreateCBuffer(); // ********************************************************** // リソースの作成 if (SUCCEEDED(hr)) hr = CreateResource(); // ********************************************************** // シェーダ リソース ビューの作成 if (SUCCEEDED(hr)) hr = CreateSRV(); // ********************************************************** // アンオーダード・アクセス・ビューの作成 if (SUCCEEDED(hr)) hr = CreateUAV(); // ********************************************************** // コンピュート・シェーダを使った演算 if (SUCCEEDED(hr)) ComputeShader(); // ********************************************************** // 開放 SAFE_RELEASE(g_pUAV[1]); SAFE_RELEASE(g_pUAV[0]); SAFE_RELEASE(g_pSRV[1]); SAFE_RELEASE(g_pSRV[0]); SAFE_RELEASE(g_pReadBackBuffer); SAFE_RELEASE(g_pBuffer[1]); SAFE_RELEASE(g_pBuffer[0]); SAFE_RELEASE(g_pCBuffer); SAFE_RELEASE(g_pComputeShader); SAFE_RELEASE(g_pImmediateContext); SAFE_RELEASE(g_pD3DDevice); return 0; }
//------------------------------------------------------------------------------------------ bool CGraphicDevice::Initialize(int i_nWidth, int i_nHeight) { HRESULT hr = S_OK; // D3Dオブジェクトの作成 m_pd3d9 = Direct3DCreate9(D3D_SDK_VERSION); if( !m_pd3d9 ) { return false; } // ダミーウィンドウを作成 if( CreateDummyWindow() == false ) { return false; } // デバイスを作成 if( CreateDevice(i_nWidth, i_nHeight) == false ) { return false; } // レンダーターゲットの作成 if( CreateRenderTarget(i_nWidth, i_nHeight) == false ) { return false; } /// 全てに成功 /// m_nWidth = i_nWidth; m_nHeight = i_nHeight; // ビューポートの設定 m_viewport.X = 0; m_viewport.Y = 0; m_viewport.Width = i_nWidth; m_viewport.Height = i_nHeight; m_viewport.MinZ = 0.0f; m_viewport.MaxZ = 1.0f; // トランスフォームの初期化(単位行列化) for(int i = 0; i < TransformType_Max; ++i) { D3DXMatrixIdentity( &m_mTransform[i] ); } // シェーダ管理の初期化 shader::CShaderMan::CreateInstance(); shader::CShaderMan::GetInstance()->Initialize(); m_bValid = true; return true; }
bool DeviceMapper::CreateDevice(const std::string& name, const DmTable& table) { if (!CreateDevice(name)) { return false; } if (!LoadTableAndActivate(name, table)) { DeleteDevice(name); return false; } return true; }
static void SC_CreateDevice(__SYSCALL_PARAM_BLOCK* pspb) { pspb->lpRetValue = (LPVOID)CreateDevice( (LPSTR)PARAM(0), (DWORD)PARAM(1), (DWORD)PARAM(2), (DWORD)PARAM(3), (DWORD)PARAM(4), (LPVOID)PARAM(5), (__DRIVER_OBJECT*)PARAM(6)); }
/*! Initializes the DirectX9 device * * @param[in] hWnd Pointer to the window * @returns ICRESULT Status of initialization * **/ ICRESULT icGXDeviceDX11::Init(class icWindow* const pWindow) { // we can only create a device with a handle to the window if ( pWindow ) { m_pMainWindow = pWindow; return CreateDevice(); } return IC_FAIL_GEN; }// END FUNCTION Init( void* hWnd )
MM::Device* Hub::CreatePeripheralDevice(const char* adapterName) { for(unsigned i = 0; i < GetNumberOfInstalledDevices(); i++) { MM::Device* d = GetInstalledDevice(i); char name[MM::MaxStrLength]; d->GetName(name); if(strcmp(adapterName, name) == 0) return CreateDevice(adapterName); } return 0; }
bool AngelCore::AngelSubSystem::RenderManager::StartUp(...) { if (!CreateDevice()) { AngelCore::AngelSubSystem::AngelLog::WriteErrorMessage("Failed Creating Device Failed"); return false; } m_enableMotionBlur = false; m_enableBloom = false; m_enableDepthOfField = false; return true; }
// Direct3D Device EnumCallback 함수 HRESULT WINAPI DeviceEnumCallback( LPGUID lpGuid, LPSTR lpDeviceDescription, LPSTR lpDeviceName, LPD3DDEVICEDESC lpD3DHWDeviceDesc, LPD3DDEVICEDESC lpD3DHELDeviceDesc, LPVOID lpUserArg ) { if ( !lpUserArg ) return DDENUMRET_OK; // Direct3D Device 리스트에 추가 LPDEVICEDESC desc, *lpDesc = (LPDEVICEDESC *)lpUserArg; if ( !*lpDesc ) desc = *lpDesc = CreateDevice(); else desc = CreateDevice( *lpDesc ); // Guid값 복사 memcpy( &desc->guid, lpGuid, sizeof(GUID) ); // 디바이스 정보 복사 strcpy( desc->szName, lpDeviceName ); strcpy( desc->szDesc, lpDeviceDescription ); // 하드웨어 드라이브 인지 검사 하고 드라이브 정보 복사 if ( lpD3DHWDeviceDesc->dcmColorModel ) { desc->bIsHardware = TRUE; memcpy( &desc->Desc, lpD3DHWDeviceDesc, sizeof(D3DDEVICEDESC) ); } else { desc->bIsHardware = FALSE; memcpy( &desc->Desc, lpD3DHELDeviceDesc, sizeof(D3DDEVICEDESC) ); } return DDENUMRET_OK; }
static HRESULT STDMETHODCALLTYPE MyCreateDevice(IDirect3DN* pThis, REFCLSID rguid, LPDIRECTDRAWSURFACEN surf, LPDIRECT3DDEVICEN* device) { d3ddebugprintf(__FUNCTION__ "(0x%X, 0x%X?) called.\n", rguid.Data1, MyDirect3D<IDirect3DN>::deviceGuid); //HRESULT hr = CreateDevice(pThis, IID_IDirect3DRampDevice, surf, device); // this forces to use a software device // FixSurface(surf); HRESULT hr = CreateDevice(pThis, rguid, surf, device); if(SUCCEEDED(hr)) HookCOMInterface(MyDirect3D<IDirect3DN>::deviceGuid, (LPVOID*)device); else ddrawdebugprintf("CreateDevice failed with hr = 0x%X.\n", hr); //cmdprintf("DEBUGPAUSE: B"); //return -1; return hr; }
IntersectionApiCL* IntersectionApiCL::CreateFromOpenClContext(cl_context context, cl_device_id device, cl_command_queue queue) { auto calc = dynamic_cast<Calc::CalcCl*>(GetCalc()); if (calc) { return new IntersectionApiImpl(new CalcIntersectionDeviceCl(calc, calc->CreateDevice(context, device, queue))); } return nullptr; }
void EnableVulkan( xcb_connection_t *connection, xcb_window_t *window, struct display_camera *camera ) #endif { VkPhysicalDevice useDevice; struct SwapChain chain; SetupDevice(); useDevice = vl.physicalDevices[0]; CreateDevice( useDevice ); swapChainConnect( &chain ); swapChainPlatformConnect( &chain, hInstance, camera->hWndInstance ); }
void DeviceManagerDx::CreateWARPCompositorDevice() { ScopedGfxFeatureReporter reporterWARP("D3D11-WARP", gfxPrefs::LayersD3D11ForceWARP()); FeatureState& d3d11 = gfxConfig::GetFeature(Feature::D3D11_COMPOSITING); HRESULT hr; RefPtr<ID3D11Device> device; // Use D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS // to prevent bug 1092260. IE 11 also uses this flag. UINT flags = D3D11_CREATE_DEVICE_BGRA_SUPPORT; if (!CreateDevice(nullptr, D3D_DRIVER_TYPE_WARP, flags, hr, device)) { gfxCriticalError() << "Exception occurred initializing WARP D3D11 device!"; d3d11.SetFailed(FeatureStatus::CrashedInHandler, "Crashed creating a D3D11 WARP device", NS_LITERAL_CSTRING("FEATURE_FAILURE_D3D11_WARP_DEVICE")); } if (FAILED(hr) || !device) { // This should always succeed... in theory. gfxCriticalError() << "Failed to initialize WARP D3D11 device! " << hexa(hr); d3d11.SetFailed(FeatureStatus::Failed, "Failed to create a D3D11 WARP device", NS_LITERAL_CSTRING("FEATURE_FAILURE_D3D11_WARP_DEVICE2")); return; } // Only test for texture sharing on Windows 8 since it puts the device into // an unusable state if used on Windows 7 bool textureSharingWorks = false; if (IsWin8OrLater()) { textureSharingWorks = D3D11Checks::DoesTextureSharingWork(device); } DxgiAdapterDesc nullAdapter; PodZero(&nullAdapter); int featureLevel = device->GetFeatureLevel(); { MutexAutoLock lock(mDeviceLock); mCompositorDevice = device; mDeviceStatus = Some(D3D11DeviceStatus( true, textureSharingWorks, featureLevel, nullAdapter)); } mCompositorDevice->SetExceptionMode(0); reporterWARP.SetSuccessful(); }