blob: 2ec4bf8ae5a07883bbb5166c7f0087d3ed3a6d3d (
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
/* $Id$ */
/** @file
* DevVGA - VMWare SVGA device - VGPU10+ (DX) shader utilities.
*/
/*
* Copyright (C) 2020-2022 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#ifndef VBOX_INCLUDED_SRC_Graphics_DevVGA_SVGA3d_dx_shader_h
#define VBOX_INCLUDED_SRC_Graphics_DevVGA_SVGA3d_dx_shader_h
#ifndef RT_WITHOUT_PRAGMA_ONCE
# pragma once
#endif
#ifndef VMSVGA3D_DX
# error "This include file is for VMSVGA3D_DX."
#endif
#include <iprt/types.h>
#include "vmsvga_headers_begin.h"
#pragma pack(1) /* VMSVGA structures are '__packed'. */
#include <svga3d_reg.h>
#include <VGPU10ShaderTokens.h>
#pragma pack()
#include "vmsvga_headers_end.h"
/* SVGA3dDXSignatureRegisterComponentType */
#define SVGADX_SIGNATURE_REGISTER_COMPONENT_UINT32 1
#define SVGADX_SIGNATURE_REGISTER_COMPONENT_SINT32 2
#define SVGADX_SIGNATURE_REGISTER_COMPONENT_FLOAT32 3
typedef struct DXShaderAttributeSemantic
{
const char *pcszSemanticName;
uint32_t SemanticIndex;
} DXShaderAttributeSemantic;
typedef struct DXShaderInfo
{
VGPU10_PROGRAM_TYPE enmProgramType;
bool fGuestSignatures : 1;
void *pvBytecode;
uint32_t cbBytecode;
uint32_t cInputSignature;
uint32_t cOutputSignature;
uint32_t cPatchConstantSignature;
uint32_t cDclResource;
SVGA3dDXSignatureEntry aInputSignature[32];
SVGA3dDXSignatureEntry aOutputSignature[32];
SVGA3dDXSignatureEntry aPatchConstantSignature[32];
DXShaderAttributeSemantic aInputSemantic[32];
DXShaderAttributeSemantic aOutputSemantic[32];
DXShaderAttributeSemantic aPatchConstantSemantic[32];
uint32_t aOffDclResource[SVGA3D_DX_MAX_SRVIEWS];
} DXShaderInfo;
int DXShaderParse(void const *pvCode, uint32_t cbCode, DXShaderInfo *pInfo);
void DXShaderGenerateSemantics(DXShaderInfo *pInfo);
void DXShaderFree(DXShaderInfo *pInfo);
int DXShaderUpdateResources(DXShaderInfo const *pInfo, VGPU10_RESOURCE_DIMENSION *paResourceDimension,
VGPU10_RESOURCE_RETURN_TYPE *paResourceReturnType, uint32_t cResources);
VGPU10_RESOURCE_RETURN_TYPE DXShaderResourceReturnTypeFromFormat(SVGA3dSurfaceFormat format);
SVGA3dDXSignatureRegisterComponentType DXShaderComponentTypeFromFormat(SVGA3dSurfaceFormat format);
int DXShaderCreateDXBC(DXShaderInfo const *pInfo, void **ppvDXBC, uint32_t *pcbDXBC);
char const *DXShaderGetOutputSemanticName(DXShaderInfo const *pInfo, uint32_t idxRegister, SVGA3dDXSignatureSemanticName *pSemanticName);
#endif /* !VBOX_INCLUDED_SRC_Graphics_DevVGA_SVGA3d_dx_shader_h */
|