blob: c2197e167a57823ccd1c5adb88fc2adfab71282a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
/*
* Copyright (c) 2022, Stephan Unverwerth <s.unverwerth@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Error.h>
#include <AK/NonnullOwnPtr.h>
#include <AK/NonnullRefPtr.h>
#include <AK/RefCounted.h>
#include <AK/StringView.h>
#include <AK/Weakable.h>
#include <LibGPU/Device.h>
#include <LibGfx/Size.h>
namespace GPU {
class Driver final
: public RefCounted<Driver>
, public Weakable<Driver> {
public:
static ErrorOr<NonnullRefPtr<Driver>> try_create(StringView driver_name);
~Driver();
ErrorOr<NonnullOwnPtr<Device>> try_create_device(Gfx::IntSize size);
private:
Driver(void* dlopen_result, serenity_gpu_create_device_t device_creation_function)
: m_dlopen_result { dlopen_result }
, m_serenity_gpu_create_device { device_creation_function }
{
VERIFY(dlopen_result);
VERIFY(device_creation_function);
}
void* const m_dlopen_result { nullptr };
serenity_gpu_create_device_t m_serenity_gpu_create_device { nullptr };
};
}
|