summaryrefslogtreecommitdiffstatshomepage
path: root/docs/source/plugins/inputmacro.rst
blob: 959faa05fbeb90240981a72911f0996b803c9e7b (plain) (blame)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
.. _plugins-inputmacro:

Input Macro Plugin
==================

.. contents:: :local:


.. _plugins-inputmacro-intro:

Introduction
------------

The input macro plugin allows you to trigger a sequence of emulated input
actions with a key or button combination.  This can help people with
disabilities or injuries that make some input sequences difficult.  It can also
be used as a way to cheat in games that require rapid sequences of inputs, like
the running events in Track & Field, or the eating minigame in Daisu-Kiss.

To configure the input macro plugin, activate the main menu (press **Tab**
during emulation by default), select **Plugin Options**, and then select **Input
Macros**.  Configured input macros for the current system are listed, along with
their activation sequences (initially there will be no input macros configured).
Select a macro to edit it, or choose **Add macro** to set up a new input macro.
See :ref:`plugins-inputmacro-settings` for details on editing input macros.  You
can delete an input macro by highlighting it in the menu and pressing the UI
Clear key (Del/Delete/Forward Delete on the keyboard by default).

Input macros are saved in the **inputmacro** folder in the plugin data folder
(see the :ref:`homepath option <mame-commandline-homepath>`).  A file is created
for each system with input macros configured, named according to the system’s
short name (or ROM set name), with the extension ``.cfg``.  For example, input
macros for Daisu-Kiss will be saved in the file **daiskiss.cfg** in the
**inputmacro** folder in your plugin data folder.  The input macros are stored
in JSON format.


.. _plugins-inputmacro-settings:

Editing input macros
--------------------

The options for editing input macros are the same whether you’re creating a new
macro or editing an existing macro.  Input macros consist of a sequence of
*steps*.  Each step optionally waits for a configurable delay, then activates
one or more emulated inputs for a specified duration.  You can choose what
should happen if the activation sequence is still held when the final step of
the macro completes: the emulated inputs can be released, the final step can be
prolonged, or the macro can loop back to any step in the sequence.

The settings in first section of the macro editing menu apply to the macro as a
whole:

* The **Name** will be used in the list of input macros, so it helps to make it
  descriptive.  Press the UI Select key (Return/Enter on the keyboard or the
  first button on the first joystick by default) to edit the current name, or
  press the UI Clear key to type a new name.  Press the UI Select key before
  moving to another menu item to save the new name; press the UI Back key
  (Escape/Esc on the keyboard by default) to change discard the new name.
* Select **Activation combination** to set the control (or combination of
  controls) you want to use to activate the macro.  Keep in mind that regular
  input assignments still apply, so you will probably want to use a combination
  that isn’t being used for any other emulated input in the system.
* Set **On release** to specify what should happen if the activation sequence is
  released before the macro completes.  When set to *Stop immediately*, any
  emulated inputs activated by the macro will be released immediately, and no
  further steps will be processed; when set to *Complete macro*, the macro will
  continue to be processed until the end of the final step.
* Set **When held** to specify what should happen if the activation sequence is
  held after the final step of the macro completes.  When set to *Release*, any
  inputs activated by the macro will be released, and the macro will not be
  reactivated until the activation sequence is released and pressed again; when
  set to *Prolong step <n>* where *<n>* is the number of the final step of the
  macro, the emulated inputs activated by the final step of the macro will
  remain active until the activation sequence is released; when set to *Loop to
  step <n>* where *<n>* is a step number, macro processing will return to that
  step, including its delay, if the activation sequence is held after the final
  step completes.

Each step has delay, duration and input settings:

* Set the **Delay** to the number of emulated video frame intervals to wait
  before activating the inputs for the step.  During the delay, no emulated
  inputs will be activated by the macro.  You can reset the setting to zero by
  pressing the UI Clear key.
* Set the **Duration** to the number of emulated video frame intervals to hold
  the emulated inputs for the step active before moving to the next step (or
  completing the macro in the case of the final step).  You can reset the
  setting to one frame by pressing the UI Clear key.
* Set the **Input** settings to the emulated inputs to activate for the step.
  Only non-toggle digital inputs are supported.  Select **Add input** to set
  multiple inputs for a step (this option will only appear after you set the
  first input for the initially created step when creating a new macro).  If
  the step has multiple inputs, you can highlight an input on the menu and press
  the UI Clear key to delete it (all steps must have at least one input, so you
  can’t delete the only input for a step).
* If the macro has multiple steps, you can select **Delete step** to delete a
  step (this options does not appear if the macro only has a single step).
  Remember to check that the **On release** and **When held** settings are
  correct after deleting steps.

To add a step to the macro, highlight **Add step at position** (below the
existing steps), use the UI Left/Right keys or click the arrows to set the
position where you’d like to insert the new step, and then press the UI Select
key (or double-click the menu item) to add the new step.  You will be prompted
to set the first input for the new step.  Remember to check the **On release**
and **When held** settings after adding steps.  The **Add step at position**
item will only appear after you set the first input for the initially created
step when creating a new macro.

When creating a new macro, there is a **Cancel** option that changes to
**Create** after you set the activating sequence and the first input for the
initially created step.  Select **Create** to finish creating the macro and
return to the list of input macros.  The new macro will be added at the end of
the list.  Press the UI Back key, or select **Cancel** before setting the
activation sequence/input, to return to the previous menu without creating the
new macro.

When editing an existing macro, select **Done** or press the UI Back key to
return to the list of input macros.  Changes take effect immediately.


.. _plugins-inputmacro-examples:

Example macros
--------------

Raiden autofire
~~~~~~~~~~~~~~~

This provides player 1 autofire functionality using the space bar.  The same
thing could be achieved using the :ref:`plugins-autofire`, but this demonstrates
a simple looping macro:

* **Name**: P1 Autofire
* **Activation combination**: Kbd Space
* **On release**: Stop immediately
* **When held**: Loop to step 2
* **Step 1**:

  * **Delay (frames)**: 0
  * **Duration (frames)**: 2
  * **Input 1**: P1 Button 1
* **Step 2**:

  * **Delay (frames)**: 4
  * **Duration (frames)**: 2
  * **Input 1**: P1 Button 1

The first step has no delay so that firing begins as soon as the space bar is
pressed.  The second step has sufficient delay to ensure the game recognises the
button being pressed and released again.  The second step is repeated as long as
the space bar is held down.

Track & Field sprint cheat
~~~~~~~~~~~~~~~~~~~~~~~~~~

This allows you to run in Konami Track & Field by holding a single button.  This
takes most of the skill (and fun) out of the game:

* **Name**: P1 Sprint
* **Activation combination**: Kbd Shift
* **On release**: Stop immediately
* **When held**: Loop to step 2
* **Step 1**:

  * **Delay (frames)**: 0
  * **Duration (frames)**: 1
  * **Input 1**: P1 Button 1
* **Step 2**:

  * **Delay (frames)**: 1
  * **Duration (frames)**: 1
  * **Input 1**: P1 Button 3
* **Step 3**:

  * **Delay (frames)**: 1
  * **Duration (frames)**: 1
  * **Input 1**: P1 Button 1

This macro rapidly alternates pressing buttons 1 and 3 – the pattern required to
run in the game.

Street Fighter II Shoryuken
~~~~~~~~~~~~~~~~~~~~~~~~~~~

This macro allows you to perform a right-facing Shōryūken (Dragon Punch) by
pressing a single key:

* **Name**: 1P Shoryuken LP
* **Activation combination**: Kbd M
* **On release**: Complete macro
* **When held**: Prolong step 6
* **Step 1**:

  * **Delay (frames)**: 0
  * **Duration (frames)**: 1
  * **Input 1**: P1 Right
* **Step 2**:

  * **Delay (frames)**: 1
  * **Duration (frames)**: 1
  * **Input 1**: P1 Down
* **Step 3**:

  * **Delay (frames)**: 0
  * **Duration (frames)**: 1
  * **Input 1**: P1 Down
  * **Input 2**: P1 Right
* **Step 4**:

  * **Delay (frames)**: 0
  * **Duration (frames)**: 1
  * **Input 1**: P1 Right
* **Step 5**:

  * **Delay (frames)**: 0
  * **Duration (frames)**: 1
  * **Input 1**: P1 Right
  * **Input 2**: P1 Jab Punch
* **Step 6**:

  * **Delay (frames)**: 0
  * **Duration (frames)**: 1
  * **Input 1**: P1 Jab Punch

This macro involves steps that activate multiple inputs.  The macro will
complete if the activation sequence is released early, allowing you to tap the
key momentarily to perform the move.  Holding the activation sequence holds down
the attack button.
// // D3D10_SHADER_FORCE_PS_SOFTWARE_NO_OPT // Force compiler to compile against the next highest available software // target for pixel shaders. This flag also turns optimizations off, // and debugging on. // // D3D10_SHADER_NO_PRESHADER // Disables Preshaders. Using this flag will cause the compiler to not // pull out static expression for evaluation on the host cpu // // D3D10_SHADER_AVOID_FLOW_CONTROL // Hint compiler to avoid flow-control constructs where possible. // // D3D10_SHADER_PREFER_FLOW_CONTROL // Hint compiler to prefer flow-control constructs where possible. // // D3D10_SHADER_ENABLE_STRICTNESS // By default, the HLSL/Effect compilers are not strict on deprecated syntax. // Specifying this flag enables the strict mode. Deprecated syntax may be // removed in a future release, and enabling syntax is a good way to make sure // your shaders comply to the latest spec. // // D3D10_SHADER_ENABLE_BACKWARDS_COMPATIBILITY // This enables older shaders to compile to 4_0 targets. // //---------------------------------------------------------------------------- #define D3D10_SHADER_DEBUG (1 << 0) #define D3D10_SHADER_SKIP_VALIDATION (1 << 1) #define D3D10_SHADER_SKIP_OPTIMIZATION (1 << 2) #define D3D10_SHADER_PACK_MATRIX_ROW_MAJOR (1 << 3) #define D3D10_SHADER_PACK_MATRIX_COLUMN_MAJOR (1 << 4) #define D3D10_SHADER_PARTIAL_PRECISION (1 << 5) #define D3D10_SHADER_FORCE_VS_SOFTWARE_NO_OPT (1 << 6) #define D3D10_SHADER_FORCE_PS_SOFTWARE_NO_OPT (1 << 7) #define D3D10_SHADER_NO_PRESHADER (1 << 8) #define D3D10_SHADER_AVOID_FLOW_CONTROL (1 << 9) #define D3D10_SHADER_PREFER_FLOW_CONTROL (1 << 10) #define D3D10_SHADER_ENABLE_STRICTNESS (1 << 11) #define D3D10_SHADER_ENABLE_BACKWARDS_COMPATIBILITY (1 << 12) #define D3D10_SHADER_IEEE_STRICTNESS (1 << 13) #define D3D10_SHADER_WARNINGS_ARE_ERRORS (1 << 18) // optimization level flags #define D3D10_SHADER_OPTIMIZATION_LEVEL0 (1 << 14) #define D3D10_SHADER_OPTIMIZATION_LEVEL1 0 #define D3D10_SHADER_OPTIMIZATION_LEVEL2 ((1 << 14) | (1 << 15)) #define D3D10_SHADER_OPTIMIZATION_LEVEL3 (1 << 15) typedef D3D_SHADER_MACRO D3D10_SHADER_MACRO; typedef D3D10_SHADER_MACRO* LPD3D10_SHADER_MACRO; typedef D3D_SHADER_VARIABLE_CLASS D3D10_SHADER_VARIABLE_CLASS; typedef D3D10_SHADER_VARIABLE_CLASS* LPD3D10_SHADER_VARIABLE_CLASS; typedef D3D_SHADER_VARIABLE_FLAGS D3D10_SHADER_VARIABLE_FLAGS; typedef D3D10_SHADER_VARIABLE_FLAGS* LPD3D10_SHADER_VARIABLE_FLAGS; typedef D3D_SHADER_VARIABLE_TYPE D3D10_SHADER_VARIABLE_TYPE; typedef D3D10_SHADER_VARIABLE_TYPE* LPD3D10_SHADER_VARIABLE_TYPE; typedef D3D_SHADER_INPUT_FLAGS D3D10_SHADER_INPUT_FLAGS; typedef D3D10_SHADER_INPUT_FLAGS* LPD3D10_SHADER_INPUT_FLAGS; typedef D3D_SHADER_INPUT_TYPE D3D10_SHADER_INPUT_TYPE; typedef D3D10_SHADER_INPUT_TYPE* LPD3D10_SHADER_INPUT_TYPE; typedef D3D_SHADER_CBUFFER_FLAGS D3D10_SHADER_CBUFFER_FLAGS; typedef D3D10_SHADER_CBUFFER_FLAGS* LPD3D10_SHADER_CBUFFER_FLAGS; typedef D3D_CBUFFER_TYPE D3D10_CBUFFER_TYPE; typedef D3D10_CBUFFER_TYPE* LPD3D10_CBUFFER_TYPE; typedef D3D_NAME D3D10_NAME; typedef D3D_RESOURCE_RETURN_TYPE D3D10_RESOURCE_RETURN_TYPE; typedef D3D_REGISTER_COMPONENT_TYPE D3D10_REGISTER_COMPONENT_TYPE; typedef D3D_INCLUDE_TYPE D3D10_INCLUDE_TYPE; // ID3D10Include has been made version-neutral and moved to d3dcommon.h. typedef interface ID3DInclude ID3D10Include; typedef interface ID3DInclude* LPD3D10INCLUDE; #define IID_ID3D10Include IID_ID3DInclude //---------------------------------------------------------------------------- // ID3D10ShaderReflection: //---------------------------------------------------------------------------- // // Structure definitions // typedef struct _D3D10_SHADER_DESC { UINT Version; // Shader version LPCSTR Creator; // Creator string UINT Flags; // Shader compilation/parse flags UINT ConstantBuffers; // Number of constant buffers UINT BoundResources; // Number of bound resources UINT InputParameters; // Number of parameters in the input signature UINT OutputParameters; // Number of parameters in the output signature UINT InstructionCount; // Number of emitted instructions UINT TempRegisterCount; // Number of temporary registers used UINT TempArrayCount; // Number of temporary arrays used UINT DefCount; // Number of constant defines UINT DclCount; // Number of declarations (input + output) UINT TextureNormalInstructions; // Number of non-categorized texture instructions UINT TextureLoadInstructions; // Number of texture load instructions UINT TextureCompInstructions; // Number of texture comparison instructions UINT TextureBiasInstructions; // Number of texture bias instructions UINT TextureGradientInstructions; // Number of texture gradient instructions UINT FloatInstructionCount; // Number of floating point arithmetic instructions used UINT IntInstructionCount; // Number of signed integer arithmetic instructions used UINT UintInstructionCount; // Number of unsigned integer arithmetic instructions used UINT StaticFlowControlCount; // Number of static flow control instructions used UINT DynamicFlowControlCount; // Number of dynamic flow control instructions used UINT MacroInstructionCount; // Number of macro instructions used UINT ArrayInstructionCount; // Number of array instructions used UINT CutInstructionCount; // Number of cut instructions used UINT EmitInstructionCount; // Number of emit instructions used D3D10_PRIMITIVE_TOPOLOGY GSOutputTopology; // Geometry shader output topology UINT GSMaxOutputVertexCount; // Geometry shader maximum output vertex count } D3D10_SHADER_DESC; typedef struct _D3D10_SHADER_BUFFER_DESC { LPCSTR Name; // Name of the constant buffer D3D10_CBUFFER_TYPE Type; // Indicates that this is a CBuffer or TBuffer UINT Variables; // Number of member variables UINT Size; // Size of CB (in bytes) UINT uFlags; // Buffer description flags } D3D10_SHADER_BUFFER_DESC; typedef struct _D3D10_SHADER_VARIABLE_DESC { LPCSTR Name; // Name of the variable UINT StartOffset; // Offset in constant buffer's backing store UINT Size; // Size of variable (in bytes) UINT uFlags; // Variable flags LPVOID DefaultValue; // Raw pointer to default value } D3D10_SHADER_VARIABLE_DESC; typedef struct _D3D10_SHADER_TYPE_DESC { D3D10_SHADER_VARIABLE_CLASS Class; // Variable class (e.g. object, matrix, etc.) D3D10_SHADER_VARIABLE_TYPE Type; // Variable type (e.g. float, sampler, etc.) UINT Rows; // Number of rows (for matrices, 1 for other numeric, 0 if not applicable) UINT Columns; // Number of columns (for vectors & matrices, 1 for other numeric, 0 if not applicable) UINT Elements; // Number of elements (0 if not an array) UINT Members; // Number of members (0 if not a structure) UINT Offset; // Offset from the start of structure (0 if not a structure member) } D3D10_SHADER_TYPE_DESC; typedef struct _D3D10_SHADER_INPUT_BIND_DESC { LPCSTR Name; // Name of the resource D3D10_SHADER_INPUT_TYPE Type; // Type of resource (e.g. texture, cbuffer, etc.) UINT BindPoint; // Starting bind point UINT BindCount; // Number of contiguous bind points (for arrays) UINT uFlags; // Input binding flags D3D10_RESOURCE_RETURN_TYPE ReturnType; // Return type (if texture) D3D10_SRV_DIMENSION Dimension; // Dimension (if texture) UINT NumSamples; // Number of samples (0 if not MS texture) } D3D10_SHADER_INPUT_BIND_DESC; typedef struct _D3D10_SIGNATURE_PARAMETER_DESC { LPCSTR SemanticName; // Name of the semantic UINT SemanticIndex; // Index of the semantic UINT Register; // Number of member variables D3D10_NAME SystemValueType;// A predefined system value, or D3D10_NAME_UNDEFINED if not applicable D3D10_REGISTER_COMPONENT_TYPE ComponentType;// Scalar type (e.g. uint, float, etc.) BYTE Mask; // Mask to indicate which components of the register // are used (combination of D3D10_COMPONENT_MASK values) BYTE ReadWriteMask; // Mask to indicate whether a given component is // never written (if this is an output signature) or // always read (if this is an input signature). // (combination of D3D10_COMPONENT_MASK values) } D3D10_SIGNATURE_PARAMETER_DESC; // // Interface definitions // typedef interface ID3D10ShaderReflectionType ID3D10ShaderReflectionType; typedef interface ID3D10ShaderReflectionType *LPD3D10SHADERREFLECTIONTYPE; // {C530AD7D-9B16-4395-A979-BA2ECFF83ADD} DEFINE_GUID(IID_ID3D10ShaderReflectionType, 0xc530ad7d, 0x9b16, 0x4395, 0xa9, 0x79, 0xba, 0x2e, 0xcf, 0xf8, 0x3a, 0xdd); #undef INTERFACE #define INTERFACE ID3D10ShaderReflectionType DECLARE_INTERFACE(ID3D10ShaderReflectionType) { STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_TYPE_DESC *pDesc) PURE; STDMETHOD_(ID3D10ShaderReflectionType*, GetMemberTypeByIndex)(THIS_ UINT Index) PURE; STDMETHOD_(ID3D10ShaderReflectionType*, GetMemberTypeByName)(THIS_ LPCSTR Name) PURE; STDMETHOD_(LPCSTR, GetMemberTypeName)(THIS_ UINT Index) PURE; }; typedef interface ID3D10ShaderReflectionVariable ID3D10ShaderReflectionVariable; typedef interface ID3D10ShaderReflectionVariable *LPD3D10SHADERREFLECTIONVARIABLE; // {1BF63C95-2650-405d-99C1-3636BD1DA0A1} DEFINE_GUID(IID_ID3D10ShaderReflectionVariable, 0x1bf63c95, 0x2650, 0x405d, 0x99, 0xc1, 0x36, 0x36, 0xbd, 0x1d, 0xa0, 0xa1); #undef INTERFACE #define INTERFACE ID3D10ShaderReflectionVariable DECLARE_INTERFACE(ID3D10ShaderReflectionVariable) { STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_VARIABLE_DESC *pDesc) PURE; STDMETHOD_(ID3D10ShaderReflectionType*, GetType)(THIS) PURE; }; typedef interface ID3D10ShaderReflectionConstantBuffer ID3D10ShaderReflectionConstantBuffer; typedef interface ID3D10ShaderReflectionConstantBuffer *LPD3D10SHADERREFLECTIONCONSTANTBUFFER; // {66C66A94-DDDD-4b62-A66A-F0DA33C2B4D0} DEFINE_GUID(IID_ID3D10ShaderReflectionConstantBuffer, 0x66c66a94, 0xdddd, 0x4b62, 0xa6, 0x6a, 0xf0, 0xda, 0x33, 0xc2, 0xb4, 0xd0); #undef INTERFACE #define INTERFACE ID3D10ShaderReflectionConstantBuffer DECLARE_INTERFACE(ID3D10ShaderReflectionConstantBuffer) { STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_BUFFER_DESC *pDesc) PURE; STDMETHOD_(ID3D10ShaderReflectionVariable*, GetVariableByIndex)(THIS_ UINT Index) PURE; STDMETHOD_(ID3D10ShaderReflectionVariable*, GetVariableByName)(THIS_ LPCSTR Name) PURE; }; typedef interface ID3D10ShaderReflection ID3D10ShaderReflection; typedef interface ID3D10ShaderReflection *LPD3D10SHADERREFLECTION; // {D40E20B6-F8F7-42ad-AB20-4BAF8F15DFAA} DEFINE_GUID(IID_ID3D10ShaderReflection, 0xd40e20b6, 0xf8f7, 0x42ad, 0xab, 0x20, 0x4b, 0xaf, 0x8f, 0x15, 0xdf, 0xaa); #undef INTERFACE #define INTERFACE ID3D10ShaderReflection DECLARE_INTERFACE_(ID3D10ShaderReflection, IUnknown) { STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_DESC *pDesc) PURE; STDMETHOD_(ID3D10ShaderReflectionConstantBuffer*, GetConstantBufferByIndex)(THIS_ UINT Index) PURE; STDMETHOD_(ID3D10ShaderReflectionConstantBuffer*, GetConstantBufferByName)(THIS_ LPCSTR Name) PURE; STDMETHOD(GetResourceBindingDesc)(THIS_ UINT ResourceIndex, D3D10_SHADER_INPUT_BIND_DESC *pDesc) PURE; STDMETHOD(GetInputParameterDesc)(THIS_ UINT ParameterIndex, D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE; STDMETHOD(GetOutputParameterDesc)(THIS_ UINT ParameterIndex, D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE; }; ////////////////////////////////////////////////////////////////////////////// // APIs ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus extern "C" { #endif //__cplusplus //---------------------------------------------------------------------------- // D3D10CompileShader: // ------------------ // Compiles a shader. // // Parameters: // pSrcFile // Source file name. // hSrcModule // Module handle. if NULL, current module will be used. // pSrcResource // Resource name in module. // pSrcData // Pointer to source code. // SrcDataLen // Size of source code, in bytes. // pDefines // Optional NULL-terminated array of preprocessor macro definitions. // pInclude // Optional interface pointer to use for handling #include directives. // If this parameter is NULL, #includes will be honored when compiling // from file, and will error when compiling from resource or memory. // pFunctionName // Name of the entrypoint function where execution should begin. // pProfile // Instruction set to be used when generating code. The D3D10 entry // point currently supports only "vs_4_0", "ps_4_0", and "gs_4_0". // Flags // See D3D10_SHADER_xxx flags. // ppShader // Returns a buffer containing the created shader. This buffer contains // the compiled shader code, as well as any embedded debug and symbol // table info. (See D3D10GetShaderConstantTable) // ppErrorMsgs // Returns a buffer containing a listing of errors and warnings that were // encountered during the compile. If you are running in a debugger, // these are the same messages you will see in your debug output. //---------------------------------------------------------------------------- HRESULT WINAPI D3D10CompileShader(LPCSTR pSrcData, SIZE_T SrcDataLen, LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs); //---------------------------------------------------------------------------- // D3D10DisassembleShader: // ---------------------- // Takes a binary shader, and returns a buffer containing text assembly. // // Parameters: // pShader // Pointer to the shader byte code. // BytecodeLength // Size of the shader byte code in bytes. // EnableColorCode // Emit HTML tags for color coding the output? // pComments // Pointer to a comment string to include at the top of the shader. // ppDisassembly // Returns a buffer containing the disassembled shader. //---------------------------------------------------------------------------- HRESULT WINAPI D3D10DisassembleShader(CONST void *pShader, SIZE_T BytecodeLength, BOOL EnableColorCode, LPCSTR pComments, ID3D10Blob** ppDisassembly); //---------------------------------------------------------------------------- // D3D10GetPixelShaderProfile/D3D10GetVertexShaderProfile/D3D10GetGeometryShaderProfile: // ----------------------------------------------------- // Returns the name of the HLSL profile best suited to a given device. // // Parameters: // pDevice // Pointer to the device in question //---------------------------------------------------------------------------- LPCSTR WINAPI D3D10GetPixelShaderProfile(ID3D10Device *pDevice); LPCSTR WINAPI D3D10GetVertexShaderProfile(ID3D10Device *pDevice); LPCSTR WINAPI D3D10GetGeometryShaderProfile(ID3D10Device *pDevice); //---------------------------------------------------------------------------- // D3D10ReflectShader: // ------------------ // Creates a shader reflection object that can be used to retrieve information // about a compiled shader // // Parameters: // pShaderBytecode // Pointer to a compiled shader (same pointer that is passed into // ID3D10Device::CreateShader) // BytecodeLength // Length of the shader bytecode buffer // ppReflector // [out] Returns a ID3D10ShaderReflection object that can be used to // retrieve shader resource and constant buffer information // //---------------------------------------------------------------------------- HRESULT WINAPI D3D10ReflectShader(CONST void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10ShaderReflection **ppReflector); //---------------------------------------------------------------------------- // D3D10PreprocessShader // --------------------- // Creates a shader reflection object that can be used to retrieve information // about a compiled shader // // Parameters: // pSrcData // Pointer to source code // SrcDataLen // Size of source code, in bytes // pFileName // Source file name (used for error output) // pDefines // Optional NULL-terminated array of preprocessor macro definitions. // pInclude // Optional interface pointer to use for handling #include directives. // If this parameter is NULL, #includes will be honored when assembling // from file, and will error when assembling from resource or memory. // ppShaderText // Returns a buffer containing a single large string that represents // the resulting formatted token stream // ppErrorMsgs // Returns a buffer containing a listing of errors and warnings that were // encountered during assembly. If you are running in a debugger, // these are the same messages you will see in your debug output. //---------------------------------------------------------------------------- HRESULT WINAPI D3D10PreprocessShader(LPCSTR pSrcData, SIZE_T SrcDataSize, LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs); ////////////////////////////////////////////////////////////////////////// // // Shader blob manipulation routines // --------------------------------- // // void *pShaderBytecode - a buffer containing the result of an HLSL // compilation. Typically this opaque buffer contains several // discrete sections including the shader executable code, the input // signature, and the output signature. This can typically be retrieved // by calling ID3D10Blob::GetBufferPointer() on the returned blob // from HLSL's compile APIs. // // UINT BytecodeLength - the length of pShaderBytecode. This can // typically be retrieved by calling ID3D10Blob::GetBufferSize() // on the returned blob from HLSL's compile APIs. // // ID3D10Blob **ppSignatureBlob(s) - a newly created buffer that // contains only the signature portions of the original bytecode. // This is a copy; the original bytecode is not modified. You may // specify NULL for this parameter to have the bytecode validated // for the presence of the corresponding signatures without actually // copying them and creating a new blob. // // Returns E_INVALIDARG if any required parameters are NULL // Returns E_FAIL is the bytecode is corrupt or missing signatures // Returns S_OK on success // ////////////////////////////////////////////////////////////////////////// HRESULT WINAPI D3D10GetInputSignatureBlob(CONST void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob **ppSignatureBlob); HRESULT WINAPI D3D10GetOutputSignatureBlob(CONST void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob **ppSignatureBlob); HRESULT WINAPI D3D10GetInputAndOutputSignatureBlob(CONST void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob **ppSignatureBlob); //---------------------------------------------------------------------------- // D3D10GetShaderDebugInfo: // ----------------------- // Gets shader debug info. Debug info is generated by D3D10CompileShader and is // embedded in the body of the shader. // // Parameters: // pShaderBytecode // Pointer to the function bytecode // BytecodeLength // Length of the shader bytecode buffer // ppDebugInfo // Buffer used to return debug info. For information about the layout // of this buffer, see definition of D3D10_SHADER_DEBUG_INFO above. //---------------------------------------------------------------------------- HRESULT WINAPI D3D10GetShaderDebugInfo(CONST void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob** ppDebugInfo); #ifdef __cplusplus } #endif //__cplusplus #endif //__D3D10SHADER_H__