1 | /* $Id: DevVGA-SVGA3d-dx-shader.h 96450 2022-08-24 08:37:38Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * DevVGA - VMWare SVGA device - VGPU10+ (DX) shader utilities.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2020-2022 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef VBOX_INCLUDED_SRC_Graphics_DevVGA_SVGA3d_dx_shader_h
|
---|
29 | #define VBOX_INCLUDED_SRC_Graphics_DevVGA_SVGA3d_dx_shader_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #ifndef VMSVGA3D_DX
|
---|
35 | # error "This include file is for VMSVGA3D_DX."
|
---|
36 | #endif
|
---|
37 |
|
---|
38 | #include <iprt/types.h>
|
---|
39 |
|
---|
40 | #include "vmsvga_headers_begin.h"
|
---|
41 | #pragma pack(1) /* VMSVGA structures are '__packed'. */
|
---|
42 | #include <svga3d_reg.h>
|
---|
43 | #include <VGPU10ShaderTokens.h>
|
---|
44 | #pragma pack()
|
---|
45 | #include "vmsvga_headers_end.h"
|
---|
46 |
|
---|
47 | /* SVGA3dDXSignatureRegisterComponentType (D3D10_SB_REGISTER_COMPONENT_TYPE) */
|
---|
48 | #define SVGADX_SIGNATURE_REGISTER_COMPONENT_UINT32 1
|
---|
49 | #define SVGADX_SIGNATURE_REGISTER_COMPONENT_SINT32 2
|
---|
50 | #define SVGADX_SIGNATURE_REGISTER_COMPONENT_FLOAT32 3
|
---|
51 |
|
---|
52 | typedef struct DXShaderAttributeSemantic
|
---|
53 | {
|
---|
54 | const char *pcszSemanticName;
|
---|
55 | uint32_t SemanticIndex;
|
---|
56 | } DXShaderAttributeSemantic;
|
---|
57 |
|
---|
58 | typedef struct DXShaderInfo
|
---|
59 | {
|
---|
60 | VGPU10_PROGRAM_TYPE enmProgramType;
|
---|
61 | bool fGuestSignatures : 1;
|
---|
62 | void *pvBytecode;
|
---|
63 | uint32_t cbBytecode;
|
---|
64 | uint32_t cInputSignature;
|
---|
65 | uint32_t cOutputSignature;
|
---|
66 | uint32_t cPatchConstantSignature;
|
---|
67 | uint32_t cDclResource;
|
---|
68 | SVGA3dDXSignatureEntry aInputSignature[32];
|
---|
69 | SVGA3dDXSignatureEntry aOutputSignature[32];
|
---|
70 | SVGA3dDXSignatureEntry aPatchConstantSignature[32];
|
---|
71 | DXShaderAttributeSemantic aInputSemantic[32];
|
---|
72 | DXShaderAttributeSemantic aOutputSemantic[32];
|
---|
73 | DXShaderAttributeSemantic aPatchConstantSemantic[32];
|
---|
74 | uint32_t aOffDclResource[SVGA3D_DX_MAX_SRVIEWS];
|
---|
75 | } DXShaderInfo;
|
---|
76 |
|
---|
77 | int DXShaderParse(void const *pvCode, uint32_t cbCode, DXShaderInfo *pInfo);
|
---|
78 | void DXShaderGenerateSemantics(DXShaderInfo *pInfo);
|
---|
79 | void DXShaderFree(DXShaderInfo *pInfo);
|
---|
80 | int DXShaderUpdateResources(DXShaderInfo const *pInfo, VGPU10_RESOURCE_DIMENSION *paResourceDimension,
|
---|
81 | VGPU10_RESOURCE_RETURN_TYPE *paResourceReturnType, uint32_t cResources);
|
---|
82 | VGPU10_RESOURCE_RETURN_TYPE DXShaderResourceReturnTypeFromFormat(SVGA3dSurfaceFormat format);
|
---|
83 | SVGA3dDXSignatureRegisterComponentType DXShaderComponentTypeFromFormat(SVGA3dSurfaceFormat format);
|
---|
84 | int DXShaderCreateDXBC(DXShaderInfo const *pInfo, void **ppvDXBC, uint32_t *pcbDXBC);
|
---|
85 | char const *DXShaderGetOutputSemanticName(DXShaderInfo const *pInfo, uint32_t idxRegister, SVGA3dDXSignatureSemanticName *pSemanticName);
|
---|
86 |
|
---|
87 | #endif /* !VBOX_INCLUDED_SRC_Graphics_DevVGA_SVGA3d_dx_shader_h */
|
---|