summaryrefslogtreecommitdiffhomepage
path: root/dev/LibSCI/GPU.h
blob: 52ae6b1d84c3d3eb4f2bb8dffa3052631c640ca0 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* -------------------------------------------

Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.

File: GPU.h
Purpose: GFX System Calls.

------------------------------------------- */

#ifndef SCI_GPU_H
#define SCI_GPU_H

#include <LibSCI/SCI.h>

/// ------------------------------------------------------------------------------------------ //
/// @brief GPU API.
/// ------------------------------------------------------------------------------------------ //

struct GPUCmdBuffer;

typedef VoidPtr GPUObject;

/// ------------------------------------------------------------------------------------------ //
/// @brief Command buffer structure type.
/// ------------------------------------------------------------------------------------------ //
struct GPUCmdBuffer final
{
	VoidPtr Data{nullptr};
	SizeT	DataSz{0};
	SizeT	BufferLayer{0};
	Bool	IsGPGPUData{false};
	Bool	BufferFirst{false};

	Bool isGPGPUData()
	{
		return this->isValid() && !this->BufferFirst && this->IsGPGPUData;
	}

	Bool isBackBuffer()
	{
		return !this->BufferFirst;
	}

	Bool isValid()
	{
		return this->Data && (this->DataSz > 0) && (MmGetHeapFlags(this->Data) != -1);
	}
};

IMPORT_C GPUObject GPUNewFromDeviceName(_Input const Char* device_name);

IMPORT_C SInt32 GPUDisposeDevice(GPUObject gpu_handle, Bool cancel_all, Bool flush_all);

IMPORT_C SInt32 GPUSendCmdBufferListWithCnt(GPUCmdBuffer** cmd_list, SizeT cmd_list_cnt);

#endif // ifndef SCI_GPU_H