1/**************************************************************************
2 *
3 * Copyright 2012-2021 VMware, Inc.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
18 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 * USE OR OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * The above copyright notice and this permission notice (including the
23 * next paragraph) shall be included in all copies or substantial portions
24 * of the Software.
25 *
26 **************************************************************************/
27
28/*
29 * Shader.h --
30 *    Functions that manipulate shader resources.
31 */
32
33#ifndef SHADER_H
34#define SHADER_H
35
36#include "DriverIncludes.h"
37
38struct Device;
39struct Shader;
40
41void *
42CreateEmptyShader(Device *pDevice,
43                  enum pipe_shader_type processor);
44
45void
46DeleteEmptyShader(Device *pDevice,
47                  enum pipe_shader_type processor, void *handle);
48
49unsigned
50ShaderFindOutputMapping(Shader *shader, unsigned registerIndex);
51
52SIZE_T APIENTRY
53CalcPrivateShaderSize(D3D10DDI_HDEVICE hDevice,
54                      __in_ecount (pShaderCode[1]) const UINT *pShaderCode,
55                      __in const D3D10DDIARG_STAGE_IO_SIGNATURES *pSignatures);
56
57void APIENTRY
58DestroyShader(D3D10DDI_HDEVICE hDevice, D3D10DDI_HSHADER hShader);
59
60SIZE_T APIENTRY
61CalcPrivateSamplerSize(D3D10DDI_HDEVICE hDevice,
62                       __in const D3D10_DDI_SAMPLER_DESC *pSamplerDesc);
63
64void APIENTRY CreateSampler(D3D10DDI_HDEVICE hDevice,
65                   __in const D3D10_DDI_SAMPLER_DESC *pSamplerDesc,
66                   D3D10DDI_HSAMPLER hSampler, D3D10DDI_HRTSAMPLER hRTSampler);
67
68void APIENTRY DestroySampler(D3D10DDI_HDEVICE hDevice, D3D10DDI_HSAMPLER hSampler);
69
70void APIENTRY CreateVertexShader(D3D10DDI_HDEVICE hDevice,
71                        __in_ecount (pShaderCode[1]) const UINT *pCode,
72                        D3D10DDI_HSHADER hShader, D3D10DDI_HRTSHADER hRTShader,
73                        __in const D3D10DDIARG_STAGE_IO_SIGNATURES *pSignatures);
74
75void APIENTRY VsSetShader(D3D10DDI_HDEVICE hDevice, D3D10DDI_HSHADER hShader);
76
77void APIENTRY VsSetShaderResources(
78   D3D10DDI_HDEVICE hDevice, UINT Offset, UINT NumViews,
79   __in_ecount (NumViews) const D3D10DDI_HSHADERRESOURCEVIEW *phShaderResourceViews);
80void APIENTRY VsSetConstantBuffers(D3D10DDI_HDEVICE hDevice, UINT StartBuffer, UINT NumBuffers,
81                          __in_ecount (NumBuffers) const D3D10DDI_HRESOURCE *phBuffers);
82
83void APIENTRY VsSetSamplers(D3D10DDI_HDEVICE hDevice, UINT Offset, UINT NumSamplers,
84                   __in_ecount (NumSamplers) const D3D10DDI_HSAMPLER *phSamplers);
85
86void APIENTRY CreateGeometryShader(D3D10DDI_HDEVICE hDevice,
87                          __in_ecount (pShaderCode[1]) const UINT *pCode,
88                          D3D10DDI_HSHADER hShader, D3D10DDI_HRTSHADER hRTShader,
89                          __in const D3D10DDIARG_STAGE_IO_SIGNATURES *pSignatures);
90
91void APIENTRY GsSetShader(D3D10DDI_HDEVICE hDevice, D3D10DDI_HSHADER hShader);
92
93void APIENTRY GsSetShaderResources(
94   D3D10DDI_HDEVICE hDevice, UINT Offset, UINT NumViews,
95   __in_ecount (NumViews) const D3D10DDI_HSHADERRESOURCEVIEW *phShaderResourceViews);
96
97void APIENTRY GsSetConstantBuffers(D3D10DDI_HDEVICE hDevice, UINT StartBuffer, UINT NumBuffers,
98                          __in_ecount (NumBuffers) const D3D10DDI_HRESOURCE *phBuffers);
99
100void APIENTRY GsSetSamplers(D3D10DDI_HDEVICE hDevice, UINT Offset, UINT NumSamplers,
101                   __in_ecount (NumSamplers) const D3D10DDI_HSAMPLER *phSamplers);
102
103SIZE_T APIENTRY CalcPrivateGeometryShaderWithStreamOutput(
104   D3D10DDI_HDEVICE hDevice,
105   __in const D3D10DDIARG_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT *pCreateGeometryShaderWithStreamOutput,
106   __in const D3D10DDIARG_STAGE_IO_SIGNATURES *pSignatures);
107
108void APIENTRY CreateGeometryShaderWithStreamOutput(
109   D3D10DDI_HDEVICE hDevice,
110   __in const D3D10DDIARG_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT *pCreateGeometryShaderWithStreamOutput,
111   D3D10DDI_HSHADER hShader, D3D10DDI_HRTSHADER hRTShader,
112   __in const D3D10DDIARG_STAGE_IO_SIGNATURES *pSignatures);
113
114void APIENTRY SoSetTargets(D3D10DDI_HDEVICE hDevice, UINT SOTargets, UINT ClearTargets,
115                  __in_ecount (SOTargets) const D3D10DDI_HRESOURCE *phResource,
116                  __in_ecount (SOTargets) const UINT *pOffsets);
117
118void APIENTRY CreatePixelShader(D3D10DDI_HDEVICE hDevice,
119                       __in_ecount (pShaderCode[1]) const UINT *pCode,
120                       D3D10DDI_HSHADER hShader, D3D10DDI_HRTSHADER hRTShader,
121                       __in const D3D10DDIARG_STAGE_IO_SIGNATURES *pSignatures);
122void APIENTRY PsSetShader(D3D10DDI_HDEVICE hDevice, D3D10DDI_HSHADER hShader);
123
124void APIENTRY PsSetShaderResources(
125   D3D10DDI_HDEVICE hDevice, UINT Offset, UINT NumViews,
126   __in_ecount (NumViews) const D3D10DDI_HSHADERRESOURCEVIEW *phShaderResourceViews);
127
128void APIENTRY PsSetConstantBuffers(D3D10DDI_HDEVICE hDevice, UINT StartBuffer, UINT NumBuffers,
129                          __in_ecount (NumBuffers) const D3D10DDI_HRESOURCE *phBuffers);
130
131void APIENTRY PsSetSamplers(D3D10DDI_HDEVICE hDevice, UINT Offset, UINT NumSamplers,
132                   __in_ecount (NumSamplers) const D3D10DDI_HSAMPLER *phSamplers);
133
134void APIENTRY ShaderResourceViewReadAfterWriteHazard(
135   D3D10DDI_HDEVICE hDevice, D3D10DDI_HSHADERRESOURCEVIEW hShaderResourceView,
136   D3D10DDI_HRESOURCE hResource);
137
138SIZE_T APIENTRY CalcPrivateShaderResourceViewSize(
139   D3D10DDI_HDEVICE hDevice,
140   __in const D3D10DDIARG_CREATESHADERRESOURCEVIEW *pCreateShaderResourceView);
141
142void APIENTRY CreateShaderResourceView(
143   D3D10DDI_HDEVICE hDevice,
144   __in const D3D10DDIARG_CREATESHADERRESOURCEVIEW *pCreateShaderResourceView,
145   D3D10DDI_HSHADERRESOURCEVIEW hShaderResourceView,
146   D3D10DDI_HRTSHADERRESOURCEVIEW hRTShaderResourceView);
147
148SIZE_T APIENTRY CalcPrivateShaderResourceViewSize1(
149   D3D10DDI_HDEVICE hDevice,
150   __in const D3D10_1DDIARG_CREATESHADERRESOURCEVIEW *pCreateShaderResourceView);
151
152void APIENTRY CreateShaderResourceView1(
153   D3D10DDI_HDEVICE hDevice,
154   __in const D3D10_1DDIARG_CREATESHADERRESOURCEVIEW *pCreateShaderResourceView,
155   D3D10DDI_HSHADERRESOURCEVIEW hShaderResourceView,
156   D3D10DDI_HRTSHADERRESOURCEVIEW hRTShaderResourceView);
157
158void APIENTRY DestroyShaderResourceView(D3D10DDI_HDEVICE hDevice,
159                               D3D10DDI_HSHADERRESOURCEVIEW hShaderResourceView);
160
161void APIENTRY GenMips(D3D10DDI_HDEVICE hDevice,
162             D3D10DDI_HSHADERRESOURCEVIEW hShaderResourceView);
163
164#endif   /* SHADER_H */
165