1b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul/**************************************************************************
2b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul *
3b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
4b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul * All Rights Reserved.
5b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul *
6b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul * Permission is hereby granted, free of charge, to any person obtaining a
7b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul * copy of this software and associated documentation files (the
8b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul * "Software"), to deal in the Software without restriction, including
9b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul * without limitation the rights to use, copy, modify, merge, publish,
10b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul * distribute, sub license, and/or sell copies of the Software, and to
11b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul * permit persons to whom the Software is furnished to do so, subject to
12b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul * the following conditions:
13b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul *
14b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul * The above copyright notice and this permission notice (including the
15b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul * next paragraph) shall be included in all copies or substantial portions
16b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul * of the Software.
17b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul *
18b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul *
26b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul **************************************************************************/
27b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
28b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul /*
29b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul  * Authors:
30b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul  *   Keith Whitwell <keith@tungstengraphics.com>
31b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul  *   Brian Paul
32b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul  */
33b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
34b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul#include "util/u_math.h"
35b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul#include "util/u_memory.h"
36b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul#include "pipe/p_config.h"
37b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
38b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul#include "draw_vs.h"
39b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
40b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul#if defined(PIPE_ARCH_PPC)
41b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
42b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul#include "pipe/p_shader_tokens.h"
43b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
44b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul#include "draw_private.h"
45b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul#include "draw_context.h"
46b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
47b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul#include "rtasm/rtasm_cpu.h"
48b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul#include "rtasm/rtasm_ppc.h"
49b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul#include "tgsi/tgsi_ppc.h"
50b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul#include "tgsi/tgsi_parse.h"
5104dd8b71b48f69fdcef9ad559b57e1e665695b64Keith Whitwell#include "tgsi/tgsi_exec.h"
52b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
53b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
54b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
55b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paultypedef void (PIPE_CDECL *codegen_function) (float (*inputs)[4][4],
56b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul                                             float (*outputs)[4][4],
57b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul                                             float (*temps)[4][4],
58f4e9526addc617dc78af9b1af781ffe09ce62504Brian Paul                                             float (*immeds)[4],
59abbbe876ac98596b143da295abf6887e0a4e50d2Brian Paul                                             float (*consts)[4],
60abbbe876ac98596b143da295abf6887e0a4e50d2Brian Paul                                             const float *builtins);
61b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
62b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
63b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paulstruct draw_ppc_vertex_shader {
64b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   struct draw_vertex_shader base;
65b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   struct ppc_function ppc_program;
66b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
67b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   codegen_function func;
68b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul};
69b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
70b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
71b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paulstatic void
72b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paulvs_ppc_prepare( struct draw_vertex_shader *base,
73b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul		struct draw_context *draw )
74b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul{
7575b92764a7820558fb2b6cd27a2ab0487ef2f9baBrian Paul   /* nothing */
76b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul}
77b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
78b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
7975b92764a7820558fb2b6cd27a2ab0487ef2f9baBrian Paul/**
8075b92764a7820558fb2b6cd27a2ab0487ef2f9baBrian Paul * Simplified vertex shader interface for the pt paths.  Given the
81b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul * complexity of code-generating all the above operations together,
82b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul * it's time to try doing all the other stuff separately.
83b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul */
84b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paulstatic void
85b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paulvs_ppc_run_linear( struct draw_vertex_shader *base,
86b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul		   const float (*input)[4],
87b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul		   float (*output)[4],
887c5f255201f42303188137f56ea8acc030444f0eMichal Krol                  const void *constants[PIPE_MAX_CONSTANT_BUFFERS],
89b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul		   unsigned count,
90b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul		   unsigned input_stride,
91b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul		   unsigned output_stride )
92b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul{
93b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   struct draw_ppc_vertex_shader *shader = (struct draw_ppc_vertex_shader *)base;
94b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   unsigned int i;
95b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
96b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul#define MAX_VERTICES 4
97b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
98b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   /* loop over verts */
99b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   for (i = 0; i < count; i += MAX_VERTICES) {
100b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul      const uint max_vertices = MIN2(MAX_VERTICES, count - i);
1015dfd5ed5e7d23d4ee8572669af2673c3a1315763José Fonseca      PIPE_ALIGN_VAR(16) float inputs_soa[PIPE_MAX_SHADER_INPUTS][4][4];
1025dfd5ed5e7d23d4ee8572669af2673c3a1315763José Fonseca      PIPE_ALIGN_VAR(16) float outputs_soa[PIPE_MAX_SHADER_OUTPUTS][4][4];
1035dfd5ed5e7d23d4ee8572669af2673c3a1315763José Fonseca      PIPE_ALIGN_VAR(16) float temps_soa[TGSI_EXEC_NUM_TEMPS][4][4];
104b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul      uint attr;
105b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
106b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul      /* convert (up to) four input verts to SoA format */
107b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul      for (attr = 0; attr < base->info.num_inputs; attr++) {
108b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul         const float *vIn = (const float *) input;
109b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul         uint vert;
110b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul         for (vert = 0; vert < max_vertices; vert++) {
111b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul#if 0
112b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul            if (attr==0)
113b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul               printf("Input v%d a%d: %f %f %f %f\n",
114b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul                      vert, attr, vIn[0], vIn[1], vIn[2], vIn[3]);
115b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul#endif
116b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul            inputs_soa[attr][0][vert] = vIn[attr * 4 + 0];
117b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul            inputs_soa[attr][1][vert] = vIn[attr * 4 + 1];
118b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul            inputs_soa[attr][2][vert] = vIn[attr * 4 + 2];
119b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul            inputs_soa[attr][3][vert] = vIn[attr * 4 + 3];
120b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul            vIn += input_stride / 4;
121b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul         }
122b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul      }
123b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
124b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul      /* run compiled shader
125b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul       */
126b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul      shader->func(inputs_soa, outputs_soa, temps_soa,
127f4e9526addc617dc78af9b1af781ffe09ce62504Brian Paul		   (float (*)[4]) shader->base.immediates,
1287327a84b18140f30f2a4254066ae8ed025a8dfc0Michel Dänzer                   (float (*)[4])constants[0],
129abbbe876ac98596b143da295abf6887e0a4e50d2Brian Paul                   ppc_builtin_constants);
130b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
131b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul      /* convert (up to) four output verts from SoA back to AoS format */
132b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul      for (attr = 0; attr < base->info.num_outputs; attr++) {
133b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul         float *vOut = (float *) output;
134b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul         uint vert;
135b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul         for (vert = 0; vert < max_vertices; vert++) {
136b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul            vOut[attr * 4 + 0] = outputs_soa[attr][0][vert];
137b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul            vOut[attr * 4 + 1] = outputs_soa[attr][1][vert];
138b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul            vOut[attr * 4 + 2] = outputs_soa[attr][2][vert];
139b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul            vOut[attr * 4 + 3] = outputs_soa[attr][3][vert];
140b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul#if 0
141b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul            if (attr==0)
142b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul               printf("Output v%d a%d: %f %f %f %f\n",
143b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul                      vert, attr, vOut[0], vOut[1], vOut[2], vOut[3]);
144b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul#endif
145b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul            vOut += output_stride / 4;
146b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul         }
147b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul      }
148b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
149b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul      /* advance to next group of four input/output verts */
150b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul      input = (const float (*)[4])((const char *)input + input_stride * max_vertices);
151b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul      output = (float (*)[4])((char *)output + output_stride * max_vertices);
152b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   }
153b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul}
154b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
155b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
156b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paulstatic void
157b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paulvs_ppc_delete( struct draw_vertex_shader *base )
158b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul{
159b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   struct draw_ppc_vertex_shader *shader = (struct draw_ppc_vertex_shader *)base;
160b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
161b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   ppc_release_func( &shader->ppc_program );
162b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
163b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   align_free( (void *) shader->base.immediates );
164b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
165b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   FREE( (void*) shader->base.state.tokens );
166b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   FREE( shader );
167b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul}
168b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
169b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
170b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paulstruct draw_vertex_shader *
171b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Pauldraw_create_vs_ppc(struct draw_context *draw,
17275b92764a7820558fb2b6cd27a2ab0487ef2f9baBrian Paul                   const struct pipe_shader_state *templ)
173b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul{
174b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   struct draw_ppc_vertex_shader *vs;
175b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
176b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   vs = CALLOC_STRUCT( draw_ppc_vertex_shader );
177b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   if (vs == NULL)
178b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul      return NULL;
179b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
180b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   /* we make a private copy of the tokens */
181b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   vs->base.state.tokens = tgsi_dup_tokens(templ->tokens);
182b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   if (!vs->base.state.tokens)
183b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul      goto fail;
184b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
185b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   tgsi_scan_shader(templ->tokens, &vs->base.info);
186b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
187b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   vs->base.draw = draw;
1884eb3225b38ce12cb34ab3d90804c9683bd7b4ed3José Fonseca   vs->base.create_variant = draw_vs_create_variant_generic;
189b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   vs->base.prepare = vs_ppc_prepare;
190b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   vs->base.run_linear = vs_ppc_run_linear;
191b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   vs->base.delete = vs_ppc_delete;
192b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
193f4e9526addc617dc78af9b1af781ffe09ce62504Brian Paul   vs->base.immediates = align_malloc(TGSI_EXEC_NUM_IMMEDIATES * 4 *
194b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul                                      sizeof(float), 16);
195b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
196725ba94ce5701aa8690c7ab2ea792dda86cbbe7aBrian Paul   ppc_init_func( &vs->ppc_program );
197b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
1982ebd969f0f0d0e45e6ac462059cf322f037775f1Brian Paul#if 0
1992ebd969f0f0d0e45e6ac462059cf322f037775f1Brian Paul   ppc_print_code(&vs->ppc_program, TRUE);
2002ebd969f0f0d0e45e6ac462059cf322f037775f1Brian Paul   ppc_indent(&vs->ppc_program, 8);
2012ebd969f0f0d0e45e6ac462059cf322f037775f1Brian Paul#endif
2022ebd969f0f0d0e45e6ac462059cf322f037775f1Brian Paul
203b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   if (!tgsi_emit_ppc( (struct tgsi_token *) vs->base.state.tokens,
204b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul			&vs->ppc_program,
205f4e9526addc617dc78af9b1af781ffe09ce62504Brian Paul                       (float (*)[4]) vs->base.immediates,
206b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul                        TRUE ))
207b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul      goto fail;
208b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
209b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   vs->func = (codegen_function) ppc_get_func( &vs->ppc_program );
210b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   if (!vs->func) {
211b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul      goto fail;
212b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   }
213b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
214b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   return &vs->base;
215b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
216b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paulfail:
217abbbe876ac98596b143da295abf6887e0a4e50d2Brian Paul   /*
218b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   debug_error("tgsi_emit_ppc() failed, falling back to interpreter\n");
219abbbe876ac98596b143da295abf6887e0a4e50d2Brian Paul   */
220b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
221b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   ppc_release_func( &vs->ppc_program );
222b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
223b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   FREE(vs);
224b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   return NULL;
225b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul}
226b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
227b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
228b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
229b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul#else /* PIPE_ARCH_PPC */
230b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
231b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
232b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paulstruct draw_vertex_shader *
233b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Pauldraw_create_vs_ppc( struct draw_context *draw,
234b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul		    const struct pipe_shader_state *templ )
235b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul{
236b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul   return (void *) 0;
237b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul}
238b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
239b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul
240b7da4c3dc199ee382bb9924ac86a3485deccc62dBrian Paul#endif /* PIPE_ARCH_PPC */
241