wined3d: Get rid of the WINED3DRASTER_STATUS typedef.
[wine] / dlls / wined3d / shader_sm4.c
1 /*
2  * Copyright 2009 Henri Verbeet for CodeWeavers
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18
19 #include "config.h"
20 #include "wine/port.h"
21
22 #include "wined3d_private.h"
23
24 WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
25
26 #define WINED3D_SM4_INSTRUCTION_MODIFIER        (1 << 31)
27
28 #define WINED3D_SM4_INSTRUCTION_LENGTH_SHIFT    24
29 #define WINED3D_SM4_INSTRUCTION_LENGTH_MASK     (0xf << WINED3D_SM4_INSTRUCTION_LENGTH_SHIFT)
30
31 #define WINED3D_SM4_OPCODE_MASK                 0xff
32
33 #define WINED3D_SM4_REGISTER_MODIFIER           (1 << 31)
34
35 #define WINED3D_SM4_REGISTER_ORDER_SHIFT        20
36 #define WINED3D_SM4_REGISTER_ORDER_MASK         (0x3 << WINED3D_SM4_REGISTER_ORDER_SHIFT)
37
38 #define WINED3D_SM4_REGISTER_TYPE_SHIFT         12
39 #define WINED3D_SM4_REGISTER_TYPE_MASK          (0xf << WINED3D_SM4_REGISTER_TYPE_SHIFT)
40
41 #define WINED3D_SM4_IMMCONST_TYPE_SHIFT         0
42 #define WINED3D_SM4_IMMCONST_TYPE_MASK          (0x3 << WINED3D_SM4_IMMCONST_TYPE_SHIFT)
43
44 #define WINED3D_SM4_WRITEMASK_SHIFT             4
45 #define WINED3D_SM4_WRITEMASK_MASK              (0xf << WINED3D_SM4_WRITEMASK_SHIFT)
46
47 #define WINED3D_SM4_SWIZZLE_SHIFT               4
48 #define WINED3D_SM4_SWIZZLE_MASK                (0xff << WINED3D_SM4_SWIZZLE_SHIFT)
49
50 #define WINED3D_SM4_VERSION_MAJOR(version)      (((version) >> 4) & 0xf)
51 #define WINED3D_SM4_VERSION_MINOR(version)      (((version) >> 0) & 0xf)
52
53 enum wined3d_sm4_opcode
54 {
55     WINED3D_SM4_OP_ADD          = 0x00,
56     WINED3D_SM4_OP_AND          = 0x01,
57     WINED3D_SM4_OP_BREAK        = 0x02,
58     WINED3D_SM4_OP_BREAKC       = 0x03,
59     WINED3D_SM4_OP_CUT          = 0x09,
60     WINED3D_SM4_OP_DERIV_RTX    = 0x0b,
61     WINED3D_SM4_OP_DERIV_RTY    = 0x0c,
62     WINED3D_SM4_OP_DIV          = 0x0e,
63     WINED3D_SM4_OP_DP3          = 0x10,
64     WINED3D_SM4_OP_DP4          = 0x11,
65     WINED3D_SM4_OP_EMIT         = 0x13,
66     WINED3D_SM4_OP_ENDIF        = 0x15,
67     WINED3D_SM4_OP_ENDLOOP      = 0x16,
68     WINED3D_SM4_OP_EQ           = 0x18,
69     WINED3D_SM4_OP_EXP          = 0x19,
70     WINED3D_SM4_OP_FRC          = 0x1a,
71     WINED3D_SM4_OP_FTOI         = 0x1b,
72     WINED3D_SM4_OP_GE           = 0x1d,
73     WINED3D_SM4_OP_IADD         = 0x1e,
74     WINED3D_SM4_OP_IF           = 0x1f,
75     WINED3D_SM4_OP_IEQ          = 0x20,
76     WINED3D_SM4_OP_IGE          = 0x21,
77     WINED3D_SM4_OP_IMUL         = 0x26,
78     WINED3D_SM4_OP_ITOF         = 0x2b,
79     WINED3D_SM4_OP_LD           = 0x2d,
80     WINED3D_SM4_OP_LOG          = 0x2f,
81     WINED3D_SM4_OP_LOOP         = 0x30,
82     WINED3D_SM4_OP_LT           = 0x31,
83     WINED3D_SM4_OP_MAD          = 0x32,
84     WINED3D_SM4_OP_MIN          = 0x33,
85     WINED3D_SM4_OP_MAX          = 0x34,
86     WINED3D_SM4_OP_MOV          = 0x36,
87     WINED3D_SM4_OP_MOVC         = 0x37,
88     WINED3D_SM4_OP_MUL          = 0x38,
89     WINED3D_SM4_OP_RET          = 0x3e,
90     WINED3D_SM4_OP_ROUND_NI     = 0x41,
91     WINED3D_SM4_OP_RSQ          = 0x44,
92     WINED3D_SM4_OP_SAMPLE       = 0x45,
93     WINED3D_SM4_OP_SAMPLE_LOD   = 0x48,
94     WINED3D_SM4_OP_SAMPLE_GRAD  = 0x49,
95     WINED3D_SM4_OP_SQRT         = 0x4b,
96     WINED3D_SM4_OP_SINCOS       = 0x4d,
97     WINED3D_SM4_OP_UDIV         = 0x4e,
98     WINED3D_SM4_OP_USHR         = 0x55,
99     WINED3D_SM4_OP_UTOF         = 0x56,
100     WINED3D_SM4_OP_XOR          = 0x57,
101 };
102
103 enum wined3d_sm4_register_type
104 {
105     WINED3D_SM4_RT_TEMP         = 0x0,
106     WINED3D_SM4_RT_INPUT        = 0x1,
107     WINED3D_SM4_RT_OUTPUT       = 0x2,
108     WINED3D_SM4_RT_IMMCONST     = 0x4,
109     WINED3D_SM4_RT_SAMPLER      = 0x6,
110     WINED3D_SM4_RT_CONSTBUFFER  = 0x8,
111     WINED3D_SM4_RT_NULL         = 0xd,
112 };
113
114 enum wined3d_sm4_immconst_type
115 {
116     WINED3D_SM4_IMMCONST_SCALAR = 0x1,
117     WINED3D_SM4_IMMCONST_VEC4   = 0x2,
118 };
119
120 struct wined3d_sm4_data
121 {
122     struct wined3d_shader_version shader_version;
123     const DWORD *end;
124     const struct wined3d_shader_signature *output_signature;
125 };
126
127 struct wined3d_sm4_opcode_info
128 {
129     enum wined3d_sm4_opcode opcode;
130     enum WINED3D_SHADER_INSTRUCTION_HANDLER handler_idx;
131     UINT dst_count;
132     UINT src_count;
133 };
134
135 struct sysval_map
136 {
137     enum wined3d_sysval_semantic sysval;
138     enum wined3d_shader_register_type register_type;
139     UINT register_idx;
140 };
141
142 static const struct wined3d_sm4_opcode_info opcode_table[] =
143 {
144     {WINED3D_SM4_OP_ADD,        WINED3DSIH_ADD,         1,  2},
145     {WINED3D_SM4_OP_AND,        WINED3DSIH_AND,         1,  2},
146     {WINED3D_SM4_OP_BREAK,      WINED3DSIH_BREAK,       0,  0},
147     {WINED3D_SM4_OP_BREAKC,     WINED3DSIH_BREAKP,      0,  1},
148     {WINED3D_SM4_OP_CUT,        WINED3DSIH_CUT,         0,  0},
149     {WINED3D_SM4_OP_DERIV_RTX,  WINED3DSIH_DSX,         1,  1},
150     {WINED3D_SM4_OP_DERIV_RTY,  WINED3DSIH_DSY,         1,  1},
151     {WINED3D_SM4_OP_DIV,        WINED3DSIH_DIV,         1,  2},
152     {WINED3D_SM4_OP_DP3,        WINED3DSIH_DP3,         1,  2},
153     {WINED3D_SM4_OP_DP4,        WINED3DSIH_DP4,         1,  2},
154     {WINED3D_SM4_OP_EMIT,       WINED3DSIH_EMIT,        0,  0},
155     {WINED3D_SM4_OP_ENDIF,      WINED3DSIH_ENDIF,       0,  0},
156     {WINED3D_SM4_OP_ENDLOOP,    WINED3DSIH_ENDLOOP,     0,  0},
157     {WINED3D_SM4_OP_EQ,         WINED3DSIH_EQ,          1,  2},
158     {WINED3D_SM4_OP_EXP,        WINED3DSIH_EXP,         1,  1},
159     {WINED3D_SM4_OP_FRC,        WINED3DSIH_FRC,         1,  1},
160     {WINED3D_SM4_OP_FTOI,       WINED3DSIH_FTOI,        1,  1},
161     {WINED3D_SM4_OP_GE,         WINED3DSIH_GE,          1,  2},
162     {WINED3D_SM4_OP_IADD,       WINED3DSIH_IADD,        1,  2},
163     {WINED3D_SM4_OP_IF,         WINED3DSIH_IF,          0,  1},
164     {WINED3D_SM4_OP_IEQ,        WINED3DSIH_IEQ,         1,  2},
165     {WINED3D_SM4_OP_IGE,        WINED3DSIH_IGE,         1,  2},
166     {WINED3D_SM4_OP_IMUL,       WINED3DSIH_IMUL,        2,  2},
167     {WINED3D_SM4_OP_ITOF,       WINED3DSIH_ITOF,        1,  1},
168     {WINED3D_SM4_OP_LD,         WINED3DSIH_LD,          1,  2},
169     {WINED3D_SM4_OP_LOG,        WINED3DSIH_LOG,         1,  1},
170     {WINED3D_SM4_OP_LOOP,       WINED3DSIH_LOOP,        0,  0},
171     {WINED3D_SM4_OP_LT,         WINED3DSIH_LT,          1,  2},
172     {WINED3D_SM4_OP_MAD,        WINED3DSIH_MAD,         1,  3},
173     {WINED3D_SM4_OP_MIN,        WINED3DSIH_MIN,         1,  2},
174     {WINED3D_SM4_OP_MAX,        WINED3DSIH_MAX,         1,  2},
175     {WINED3D_SM4_OP_MOV,        WINED3DSIH_MOV,         1,  1},
176     {WINED3D_SM4_OP_MOVC,       WINED3DSIH_MOVC,        1,  3},
177     {WINED3D_SM4_OP_MUL,        WINED3DSIH_MUL,         1,  2},
178     {WINED3D_SM4_OP_RET,        WINED3DSIH_RET,         0,  0},
179     {WINED3D_SM4_OP_ROUND_NI,   WINED3DSIH_ROUND_NI,    1,  1},
180     {WINED3D_SM4_OP_RSQ,        WINED3DSIH_RSQ,         1,  1},
181     {WINED3D_SM4_OP_SAMPLE,     WINED3DSIH_SAMPLE,      1,  3},
182     {WINED3D_SM4_OP_SAMPLE_LOD, WINED3DSIH_SAMPLE_LOD,  1,  4},
183     {WINED3D_SM4_OP_SAMPLE_GRAD,WINED3DSIH_SAMPLE_GRAD, 1,  5},
184     {WINED3D_SM4_OP_SQRT,       WINED3DSIH_SQRT,        1,  1},
185     {WINED3D_SM4_OP_SINCOS,     WINED3DSIH_SINCOS,      2,  1},
186     {WINED3D_SM4_OP_UDIV,       WINED3DSIH_UDIV,        2,  2},
187     {WINED3D_SM4_OP_USHR,       WINED3DSIH_USHR,        1,  2},
188     {WINED3D_SM4_OP_UTOF,       WINED3DSIH_UTOF,        1,  1},
189     {WINED3D_SM4_OP_XOR,        WINED3DSIH_XOR,         1,  2},
190 };
191
192 static const enum wined3d_shader_register_type register_type_table[] =
193 {
194     /* WINED3D_SM4_RT_TEMP */           WINED3DSPR_TEMP,
195     /* WINED3D_SM4_RT_INPUT */          WINED3DSPR_INPUT,
196     /* WINED3D_SM4_RT_OUTPUT */         WINED3DSPR_OUTPUT,
197     /* UNKNOWN */                       0,
198     /* WINED3D_SM4_RT_IMMCONST */       WINED3DSPR_IMMCONST,
199     /* UNKNOWN */                       0,
200     /* WINED3D_SM4_RT_SAMPLER */        WINED3DSPR_SAMPLER,
201     /* WINED3D_SM4_RT_RESOURCE */       WINED3DSPR_RESOURCE,
202     /* WINED3D_SM4_RT_CONSTBUFFER */    WINED3DSPR_CONSTBUFFER,
203     /* UNKNOWN */                       0,
204     /* UNKNOWN */                       0,
205     /* UNKNOWN */                       0,
206     /* UNKNOWN */                       0,
207     /* WINED3D_SM4_RT_NULL */           WINED3DSPR_NULL,
208 };
209
210 static const struct sysval_map sysval_map[] =
211 {
212     {WINED3D_SV_DEPTH,      WINED3DSPR_DEPTHOUT,    0},
213     {WINED3D_SV_TARGET0,    WINED3DSPR_COLOROUT,    0},
214     {WINED3D_SV_TARGET1,    WINED3DSPR_COLOROUT,    1},
215     {WINED3D_SV_TARGET2,    WINED3DSPR_COLOROUT,    2},
216     {WINED3D_SV_TARGET3,    WINED3DSPR_COLOROUT,    3},
217     {WINED3D_SV_TARGET4,    WINED3DSPR_COLOROUT,    4},
218     {WINED3D_SV_TARGET5,    WINED3DSPR_COLOROUT,    5},
219     {WINED3D_SV_TARGET6,    WINED3DSPR_COLOROUT,    6},
220     {WINED3D_SV_TARGET7,    WINED3DSPR_COLOROUT,    7},
221 };
222
223 static const struct wined3d_sm4_opcode_info *get_opcode_info(enum wined3d_sm4_opcode opcode)
224 {
225     unsigned int i;
226
227     for (i = 0; i < sizeof(opcode_table) / sizeof(*opcode_table); ++i)
228     {
229         if (opcode == opcode_table[i].opcode) return &opcode_table[i];
230     }
231
232     return NULL;
233 }
234
235 static void map_sysval(enum wined3d_sysval_semantic sysval, struct wined3d_shader_register *reg)
236 {
237     unsigned int i;
238
239     for (i = 0; i < sizeof(sysval_map) / sizeof(*sysval_map); ++i)
240     {
241         if (sysval == sysval_map[i].sysval)
242         {
243             reg->type = sysval_map[i].register_type;
244             reg->idx = sysval_map[i].register_idx;
245         }
246     }
247 }
248
249 static void map_register(const struct wined3d_sm4_data *priv, struct wined3d_shader_register *reg)
250 {
251     switch (priv->shader_version.type)
252     {
253         case WINED3D_SHADER_TYPE_PIXEL:
254             if (reg->type == WINED3DSPR_OUTPUT)
255             {
256                 unsigned int i;
257                 const struct wined3d_shader_signature *s = priv->output_signature;
258
259                 if (!s)
260                 {
261                     ERR("Shader has no output signature, unable to map register.\n");
262                     break;
263                 }
264
265                 for (i = 0; i < s->element_count; ++i)
266                 {
267                     if (s->elements[i].register_idx == reg->idx)
268                     {
269                         map_sysval(s->elements[i].sysval_semantic, reg);
270                         break;
271                     }
272                 }
273             }
274             break;
275
276         default:
277             break;
278     }
279 }
280
281 static void *shader_sm4_init(const DWORD *byte_code, const struct wined3d_shader_signature *output_signature)
282 {
283     struct wined3d_sm4_data *priv = HeapAlloc(GetProcessHeap(), 0, sizeof(*priv));
284     if (!priv)
285     {
286         ERR("Failed to allocate private data\n");
287         return NULL;
288     }
289
290     priv->output_signature = output_signature;
291
292     return priv;
293 }
294
295 static void shader_sm4_free(void *data)
296 {
297     HeapFree(GetProcessHeap(), 0, data);
298 }
299
300 static void shader_sm4_read_header(void *data, const DWORD **ptr, struct wined3d_shader_version *shader_version)
301 {
302     struct wined3d_sm4_data *priv = data;
303     DWORD version_token;
304
305     priv->end = *ptr;
306
307     version_token = *(*ptr)++;
308     TRACE("version: 0x%08x\n", version_token);
309
310     TRACE("token count: %u\n", **ptr);
311     priv->end += *(*ptr)++;
312
313     switch (version_token >> 16)
314     {
315         case WINED3D_SM4_PS:
316             priv->shader_version.type = WINED3D_SHADER_TYPE_PIXEL;
317             break;
318
319         case WINED3D_SM4_VS:
320             priv->shader_version.type = WINED3D_SHADER_TYPE_VERTEX;
321             break;
322
323         case WINED3D_SM4_GS:
324             priv->shader_version.type = WINED3D_SHADER_TYPE_GEOMETRY;
325             break;
326
327         default:
328             FIXME("Unrecognized shader type %#x\n", version_token >> 16);
329     }
330     priv->shader_version.major = WINED3D_SM4_VERSION_MAJOR(version_token);
331     priv->shader_version.minor = WINED3D_SM4_VERSION_MINOR(version_token);
332
333     *shader_version = priv->shader_version;
334 }
335
336 static void shader_sm4_read_opcode(void *data, const DWORD **ptr, struct wined3d_shader_instruction *ins,
337         UINT *param_size)
338 {
339     const struct wined3d_sm4_opcode_info *opcode_info;
340     DWORD token = *(*ptr)++;
341     DWORD opcode = token & WINED3D_SM4_OPCODE_MASK;
342
343     *param_size = ((token & WINED3D_SM4_INSTRUCTION_LENGTH_MASK) >> WINED3D_SM4_INSTRUCTION_LENGTH_SHIFT) - 1;
344
345     opcode_info = get_opcode_info(opcode);
346     if (!opcode_info)
347     {
348         FIXME("Unrecognized opcode %#x, token 0x%08x\n", opcode, token);
349         ins->handler_idx = WINED3DSIH_TABLE_SIZE;
350         return;
351     }
352
353     ins->handler_idx = opcode_info->handler_idx;
354     ins->flags = 0;
355     ins->coissue = 0;
356     ins->predicate = 0;
357     ins->dst_count = opcode_info->dst_count;
358     ins->src_count = opcode_info->src_count;
359
360     if (token & WINED3D_SM4_INSTRUCTION_MODIFIER)
361     {
362         DWORD modifier = *(*ptr)++;
363         FIXME("Skipping modifier 0x%08x.\n", modifier);
364     }
365 }
366
367 static void shader_sm4_read_src_param(void *data, const DWORD **ptr, struct wined3d_shader_src_param *src_param,
368         struct wined3d_shader_src_param *src_rel_addr)
369 {
370     struct wined3d_sm4_data *priv = data;
371     DWORD token = *(*ptr)++;
372     enum wined3d_sm4_register_type register_type;
373     DWORD order;
374
375     register_type = (token & WINED3D_SM4_REGISTER_TYPE_MASK) >> WINED3D_SM4_REGISTER_TYPE_SHIFT;
376     if (register_type >= sizeof(register_type_table) / sizeof(*register_type_table))
377     {
378         FIXME("Unhandled register type %#x\n", register_type);
379         src_param->reg.type = WINED3DSPR_TEMP;
380     }
381     else
382     {
383         src_param->reg.type = register_type_table[register_type];
384     }
385
386     if (token & WINED3D_SM4_REGISTER_MODIFIER)
387     {
388         DWORD modifier = *(*ptr)++;
389
390         /* FIXME: This will probably break down at some point. The SM4
391          * modifiers look like flags, while wined3d currently has an enum
392          * with possible combinations, e.g. WINED3DSPSM_ABSNEG. */
393         switch (modifier)
394         {
395             case 0x41:
396                 src_param->modifiers = WINED3DSPSM_NEG;
397                 break;
398
399             case 0x81:
400                 src_param->modifiers = WINED3DSPSM_ABS;
401                 break;
402
403             default:
404                 FIXME("Skipping modifier 0x%08x.\n", modifier);
405                 src_param->modifiers = WINED3DSPSM_NONE;
406                 break;
407         }
408     }
409     else
410     {
411         src_param->modifiers = WINED3DSPSM_NONE;
412     }
413
414     order = (token & WINED3D_SM4_REGISTER_ORDER_MASK) >> WINED3D_SM4_REGISTER_ORDER_SHIFT;
415
416     if (order < 1) src_param->reg.idx = ~0U;
417     else src_param->reg.idx = *(*ptr)++;
418
419     if (order < 2) src_param->reg.array_idx = ~0U;
420     else src_param->reg.array_idx = *(*ptr)++;
421
422     if (order > 2) FIXME("Unhandled order %u.\n", order);
423
424     if (register_type == WINED3D_SM4_RT_IMMCONST)
425     {
426         enum wined3d_sm4_immconst_type immconst_type =
427                 (token & WINED3D_SM4_IMMCONST_TYPE_MASK) >> WINED3D_SM4_IMMCONST_TYPE_SHIFT;
428         src_param->swizzle = WINED3DSP_NOSWIZZLE;
429
430         switch(immconst_type)
431         {
432             case WINED3D_SM4_IMMCONST_SCALAR:
433                 src_param->reg.immconst_type = WINED3D_IMMCONST_SCALAR;
434                 memcpy(src_param->reg.immconst_data, *ptr, 1 * sizeof(DWORD));
435                 *ptr += 1;
436                 break;
437
438             case WINED3D_SM4_IMMCONST_VEC4:
439                 src_param->reg.immconst_type = WINED3D_IMMCONST_VEC4;
440                 memcpy(src_param->reg.immconst_data, *ptr, 4 * sizeof(DWORD));
441                 *ptr += 4;
442                 break;
443
444             default:
445                 FIXME("Unhandled immediate constant type %#x\n", immconst_type);
446                 break;
447         }
448     }
449     else
450     {
451         src_param->swizzle = (token & WINED3D_SM4_SWIZZLE_MASK) >> WINED3D_SM4_SWIZZLE_SHIFT;
452     }
453
454     src_param->reg.rel_addr = NULL;
455
456     map_register(priv, &src_param->reg);
457 }
458
459 static void shader_sm4_read_dst_param(void *data, const DWORD **ptr, struct wined3d_shader_dst_param *dst_param,
460         struct wined3d_shader_src_param *dst_rel_addr)
461 {
462     struct wined3d_sm4_data *priv = data;
463     DWORD token = *(*ptr)++;
464     enum wined3d_sm4_register_type register_type;
465     DWORD order;
466
467     register_type = (token & WINED3D_SM4_REGISTER_TYPE_MASK) >> WINED3D_SM4_REGISTER_TYPE_SHIFT;
468     if (register_type >= sizeof(register_type_table) / sizeof(*register_type_table))
469     {
470         FIXME("Unhandled register type %#x\n", register_type);
471         dst_param->reg.type = WINED3DSPR_TEMP;
472     }
473     else
474     {
475         dst_param->reg.type = register_type_table[register_type];
476     }
477
478     order = (token & WINED3D_SM4_REGISTER_ORDER_MASK) >> WINED3D_SM4_REGISTER_ORDER_SHIFT;
479
480     if (order < 1) dst_param->reg.idx = ~0U;
481     else dst_param->reg.idx = *(*ptr)++;
482
483     if (order < 2) dst_param->reg.array_idx = ~0U;
484     else dst_param->reg.array_idx = *(*ptr)++;
485
486     if (order > 2) FIXME("Unhandled order %u.\n", order);
487
488     dst_param->write_mask = (token & WINED3D_SM4_WRITEMASK_MASK) >> WINED3D_SM4_WRITEMASK_SHIFT;
489     dst_param->modifiers = 0;
490     dst_param->shift = 0;
491     dst_param->reg.rel_addr = NULL;
492
493     map_register(priv, &dst_param->reg);
494 }
495
496 static void shader_sm4_read_semantic(const DWORD **ptr, struct wined3d_shader_semantic *semantic)
497 {
498     FIXME("ptr %p, semantic %p stub!\n", ptr, semantic);
499 }
500
501 static void shader_sm4_read_comment(const DWORD **ptr, const char **comment, UINT *comment_size)
502 {
503     FIXME("ptr %p, comment %p, comment_size %p stub!\n", ptr, comment, comment_size);
504     *comment = NULL;
505 }
506
507 static BOOL shader_sm4_is_end(void *data, const DWORD **ptr)
508 {
509     struct wined3d_sm4_data *priv = data;
510     return *ptr == priv->end;
511 }
512
513 const struct wined3d_shader_frontend sm4_shader_frontend =
514 {
515     shader_sm4_init,
516     shader_sm4_free,
517     shader_sm4_read_header,
518     shader_sm4_read_opcode,
519     shader_sm4_read_src_param,
520     shader_sm4_read_dst_param,
521     shader_sm4_read_semantic,
522     shader_sm4_read_comment,
523     shader_sm4_is_end,
524 };