VirtualBox

source: vbox/trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx-shader.h@ 104932

Last change on this file since 104932 was 99535, checked in by vboxsync, 20 months ago

Devices/Graphics: SVGA_REG_CAP2; SET_*_CONSTANT_BUFFER_OFFSET; fixes for shader parser. bugref:9830

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.3 KB
Line 
1/* $Id: DevVGA-SVGA3d-dx-shader.h 99535 2023-04-26 16:52:49Z vboxsync $ */
2/** @file
3 * DevVGA - VMWare SVGA device - VGPU10+ (DX) shader utilities.
4 */
5
6/*
7 * Copyright (C) 2020-2023 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
52typedef struct DXShaderAttributeSemantic
53{
54 const char *pcszSemanticName;
55 uint32_t SemanticIndex;
56} DXShaderAttributeSemantic;
57
58typedef 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
77int DXShaderParse(void const *pvCode, uint32_t cbCode, DXShaderInfo *pInfo);
78void DXShaderGenerateSemantics(DXShaderInfo *pInfo);
79void DXShaderSortSignatures(DXShaderInfo *pInfo);
80void DXShaderFree(DXShaderInfo *pInfo);
81int DXShaderUpdateResources(DXShaderInfo const *pInfo, VGPU10_RESOURCE_DIMENSION *paResourceDimension,
82 VGPU10_RESOURCE_RETURN_TYPE *paResourceReturnType, uint32_t cResources);
83VGPU10_RESOURCE_RETURN_TYPE DXShaderResourceReturnTypeFromFormat(SVGA3dSurfaceFormat format);
84SVGA3dDXSignatureRegisterComponentType DXShaderComponentTypeFromFormat(SVGA3dSurfaceFormat format);
85int DXShaderCreateDXBC(DXShaderInfo const *pInfo, void **ppvDXBC, uint32_t *pcbDXBC);
86char const *DXShaderGetOutputSemanticName(DXShaderInfo const *pInfo, uint32_t idxRegister, SVGA3dDXSignatureSemanticName *pSemanticName);
87
88#endif /* !VBOX_INCLUDED_SRC_Graphics_DevVGA_SVGA3d_dx_shader_h */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette