1 | /* $Id: shaderlib.h 96407 2022-08-22 17:43:14Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * shaderlib -- interface to WINE's Direct3D shader functions
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2014-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_shaderlib_shaderlib_h
|
---|
29 | #define VBOX_INCLUDED_SRC_Graphics_shaderlib_shaderlib_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #include <VBox/cdefs.h>
|
---|
35 |
|
---|
36 | RT_C_DECLS_BEGIN
|
---|
37 |
|
---|
38 | #ifdef IN_SHADERLIB_STATIC
|
---|
39 | # define SHADERDECL(type) DECLHIDDEN(type) RTCALL
|
---|
40 | #else
|
---|
41 | # define SHADERDECL(type) DECLEXPORT(type) RTCALL
|
---|
42 | #endif
|
---|
43 |
|
---|
44 | /** Pointer to shaderlib callback interface. */
|
---|
45 | typedef struct VBOXVMSVGASHADERIF *PVBOXVMSVGASHADERIF;
|
---|
46 | /**
|
---|
47 | * Interface the shader lib can use to talk back to the VBox VMSVGA OGL 3D code.
|
---|
48 | */
|
---|
49 | typedef struct VBOXVMSVGASHADERIF
|
---|
50 | {
|
---|
51 | /**
|
---|
52 | * Switches the initialization profile in builds where we have to juggle two
|
---|
53 | * OpenGL profiles to gather all the data (i.e. mac os x).
|
---|
54 | *
|
---|
55 | * @param pThis Pointer to this structure.
|
---|
56 | * @param fOtherProfile If set, switch to the non-default profile. If
|
---|
57 | * clear, switch back to the default profile.
|
---|
58 | */
|
---|
59 | DECLCALLBACKMEMBER(void, pfnSwitchInitProfile,(PVBOXVMSVGASHADERIF pThis, bool fOtherProfile));
|
---|
60 |
|
---|
61 | /**
|
---|
62 | * Extension enumeration function.
|
---|
63 | *
|
---|
64 | * @param pThis Pointer to this structure.
|
---|
65 | * @param ppvEnumCtx Pointer to a void point that's initialized to NULL
|
---|
66 | * before the first call.
|
---|
67 | * @param pszBuf Where to store the extension name. Garbled on
|
---|
68 | * overflow (we assume no overflow).
|
---|
69 | * @param cbBuf The size of the buffer @a pszBuf points to.
|
---|
70 | * @param fOtherProfile Indicates which profile to get extensions from,
|
---|
71 | * we'll use the default profile if CLEAR and the
|
---|
72 | * non-default if SET.
|
---|
73 | */
|
---|
74 | DECLCALLBACKMEMBER(bool, pfnGetNextExtension,(PVBOXVMSVGASHADERIF pThis, void **ppvEnumCtx, char *pszBuf, size_t cbBuf,
|
---|
75 | bool fOtherProfile));
|
---|
76 | } VBOXVMSVGASHADERIF;
|
---|
77 |
|
---|
78 | SHADERDECL(int) ShaderInitLib(PVBOXVMSVGASHADERIF pVBoxShaderIf);
|
---|
79 | SHADERDECL(int) ShaderDestroyLib(void);
|
---|
80 |
|
---|
81 | SHADERDECL(int) ShaderContextCreate(void **ppShaderContext);
|
---|
82 | SHADERDECL(int) ShaderContextDestroy(void *pShaderContext);
|
---|
83 |
|
---|
84 | SHADERDECL(int) ShaderCreateVertexShader(void *pShaderContext, const uint32_t *pShaderData, uint32_t cbShaderData, void **pShaderObj);
|
---|
85 | SHADERDECL(int) ShaderCreatePixelShader(void *pShaderContext, const uint32_t *pShaderData, uint32_t cbShaderData, void **pShaderObj);
|
---|
86 |
|
---|
87 | SHADERDECL(int) ShaderDestroyVertexShader(void *pShaderContext, void *pShaderObj);
|
---|
88 | SHADERDECL(int) ShaderDestroyPixelShader(void *pShaderContext, void *pShaderObj);
|
---|
89 |
|
---|
90 | SHADERDECL(int) ShaderSetVertexShader(void *pShaderContext, void *pShaderObj);
|
---|
91 | SHADERDECL(int) ShaderSetPixelShader(void *pShaderContext, void *pShaderObj);
|
---|
92 |
|
---|
93 | SHADERDECL(int) ShaderSetVertexShaderConstantB(void *pShaderContext, uint32_t reg, const uint8_t *pValues, uint32_t cRegisters);
|
---|
94 | SHADERDECL(int) ShaderSetVertexShaderConstantI(void *pShaderContext, uint32_t reg, const int32_t *pValues, uint32_t cRegisters);
|
---|
95 | SHADERDECL(int) ShaderSetVertexShaderConstantF(void *pShaderContext, uint32_t reg, const float *pValues, uint32_t cRegisters);
|
---|
96 |
|
---|
97 | SHADERDECL(int) ShaderSetPixelShaderConstantB(void *pShaderContext, uint32_t reg, const uint8_t *pValues, uint32_t cRegisters);
|
---|
98 | SHADERDECL(int) ShaderSetPixelShaderConstantI(void *pShaderContext, uint32_t reg, const int32_t *pValues, uint32_t cRegisters);
|
---|
99 | SHADERDECL(int) ShaderSetPixelShaderConstantF(void *pShaderContext, uint32_t reg, const float *pValues, uint32_t cRegisters);
|
---|
100 |
|
---|
101 | SHADERDECL(int) ShaderSetPositionTransformed(void *pShaderContext, unsigned cxViewPort, unsigned cyViewPort, bool fPreTransformed);
|
---|
102 |
|
---|
103 | SHADERDECL(int) ShaderUpdateState(void *pShaderContext, uint32_t rtHeight);
|
---|
104 |
|
---|
105 | SHADERDECL(int) ShaderTransformProjection(unsigned cxViewPort, unsigned cyViewPort, float matrix[16], bool fPretransformed);
|
---|
106 |
|
---|
107 | RT_C_DECLS_END
|
---|
108 |
|
---|
109 | #endif /* !VBOX_INCLUDED_SRC_Graphics_shaderlib_shaderlib_h */
|
---|
110 |
|
---|