blob: 985fd7605104d4944d177763d19bb881f3d9a3e2 [file] [log] [blame]
Chia-I Wu1f7540b2014-08-22 13:56:18 +08001/*
2 * XGL
3 *
4 * Copyright (C) 2014 LunarG, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
Chia-I Wu44e42362014-09-02 08:32:09 +080023 *
24 * Authors:
25 * Chia-I Wu <olv@lunarg.com>
Chia-I Wu1f7540b2014-08-22 13:56:18 +080026 */
27
Chia-I Wu98824592014-09-02 09:42:46 +080028#include "shader.h"
Chia-I Wu1f7540b2014-08-22 13:56:18 +080029#include "pipeline_priv.h"
30
Chia-I Wu20983762014-09-02 12:07:28 +080031static struct intel_pipeline_rmap_slot *rmap_get_slot(struct intel_pipeline_rmap *rmap,
32 XGL_DESCRIPTOR_SET_SLOT_TYPE type,
33 XGL_UINT index)
Chia-I Wu1f7540b2014-08-22 13:56:18 +080034{
35 const XGL_UINT resource_offset = rmap->rt_count;
36 const XGL_UINT uav_offset = resource_offset + rmap->resource_count;
37 const XGL_UINT sampler_offset = uav_offset + rmap->uav_count;
Chia-I Wu20983762014-09-02 12:07:28 +080038 struct intel_pipeline_rmap_slot *slot;
Chia-I Wu1f7540b2014-08-22 13:56:18 +080039
40 switch (type) {
41 case XGL_SLOT_UNUSED:
42 slot = NULL;
43 break;
44 case XGL_SLOT_SHADER_RESOURCE:
45 slot = &rmap->slots[resource_offset + index];
46 break;
47 case XGL_SLOT_SHADER_UAV:
48 slot = &rmap->slots[uav_offset + index];
49 break;
50 case XGL_SLOT_SHADER_SAMPLER:
51 slot = &rmap->slots[sampler_offset + index];
52 break;
53 default:
54 assert(!"unknown rmap slot type");
55 slot = NULL;
56 break;
57 }
58
59 return slot;
60}
61
Chia-I Wu20983762014-09-02 12:07:28 +080062static bool rmap_init_slots_with_path(struct intel_pipeline_rmap *rmap,
Chia-I Wu1f7540b2014-08-22 13:56:18 +080063 const XGL_DESCRIPTOR_SET_MAPPING *mapping,
64 XGL_UINT *nest_path,
65 XGL_UINT nest_level)
66{
67 XGL_UINT i;
68
69 for (i = 0; i < mapping->descriptorCount; i++) {
70 const XGL_DESCRIPTOR_SLOT_INFO *info = &mapping->pDescriptorInfo[i];
Chia-I Wu20983762014-09-02 12:07:28 +080071 struct intel_pipeline_rmap_slot *slot;
Chia-I Wu1f7540b2014-08-22 13:56:18 +080072
73 if (info->slotObjectType == XGL_SLOT_NEXT_DESCRIPTOR_SET) {
74 nest_path[nest_level] = i;
75 if (!rmap_init_slots_with_path(rmap, info->pNextLevelSet,
76 nest_path, nest_level + 1))
77 return false;
78
79 continue;
80 }
81
82 slot = rmap_get_slot(rmap, info->slotObjectType,
83 info->shaderEntityIndex);
84 if (!slot)
85 continue;
86
87 assert(!slot->path_len);
88 slot->path_len = nest_level + 1;
89
90 if (nest_level) {
91 slot->u.path = icd_alloc(sizeof(slot->u.path[0]) *
92 slot->path_len, 0, XGL_SYSTEM_ALLOC_INTERNAL);
93 if (!slot->u.path) {
94 slot->path_len = 0;
95 return false;
96 }
97
98 memcpy(slot->u.path, nest_path,
99 sizeof(slot->u.path[0]) * nest_level);
100 slot->u.path[nest_level] = i;
101 } else {
102 slot->u.index = i;
103 }
104 }
105
106 return true;
107}
108
Chia-I Wu20983762014-09-02 12:07:28 +0800109static bool rmap_init_slots(struct intel_pipeline_rmap *rmap,
Chia-I Wu1f7540b2014-08-22 13:56:18 +0800110 const XGL_DESCRIPTOR_SET_MAPPING *mapping,
111 XGL_UINT depth)
112{
113 XGL_UINT *nest_path;
114 bool ok;
115
116 if (depth) {
117 nest_path = icd_alloc(sizeof(nest_path[0]) * depth,
118 0, XGL_SYSTEM_ALLOC_INTERNAL_TEMP);
119 if (!nest_path)
120 return false;
121 } else {
122 nest_path = NULL;
123 }
124
125 ok = rmap_init_slots_with_path(rmap, mapping, nest_path, 0);
126
127 if (nest_path)
128 icd_free(nest_path);
129
130 return ok;
131}
132
Chia-I Wu20983762014-09-02 12:07:28 +0800133static void rmap_update_count(struct intel_pipeline_rmap *rmap,
Chia-I Wu1f7540b2014-08-22 13:56:18 +0800134 XGL_DESCRIPTOR_SET_SLOT_TYPE type,
135 XGL_UINT index)
136{
137 switch (type) {
138 case XGL_SLOT_UNUSED:
139 break;
140 case XGL_SLOT_SHADER_RESOURCE:
141 if (rmap->resource_count < index + 1)
142 rmap->resource_count = index + 1;
143 break;
144 case XGL_SLOT_SHADER_UAV:
145 if (rmap->uav_count < index + 1)
146 rmap->uav_count = index + 1;
147 break;
148 case XGL_SLOT_SHADER_SAMPLER:
149 if (rmap->sampler_count < index + 1)
150 rmap->sampler_count = index + 1;
151 break;
152 default:
153 assert(!"unknown rmap slot type");
154 break;
155 }
156}
157
Chia-I Wu20983762014-09-02 12:07:28 +0800158static XGL_UINT rmap_init_counts(struct intel_pipeline_rmap *rmap,
Chia-I Wu1f7540b2014-08-22 13:56:18 +0800159 const XGL_DESCRIPTOR_SET_MAPPING *mapping)
160{
161 XGL_UINT depth = 0;
162 XGL_UINT i;
163
164 for (i = 0; i < mapping->descriptorCount; i++) {
165 const XGL_DESCRIPTOR_SLOT_INFO *info = &mapping->pDescriptorInfo[i];
166
167 if (info->slotObjectType == XGL_SLOT_NEXT_DESCRIPTOR_SET) {
168 const XGL_UINT d = rmap_init_counts(rmap,
169 info->pNextLevelSet);
170 if (depth < d + 1)
171 depth = d + 1;
172
173 continue;
174 }
175
176 rmap_update_count(rmap, info->slotObjectType,
177 info->shaderEntityIndex);
178 }
179
180 return depth;
181}
182
Chia-I Wu20983762014-09-02 12:07:28 +0800183static void rmap_destroy(struct intel_pipeline_rmap *rmap)
Chia-I Wua6d50aa2014-09-02 10:21:34 +0800184{
185 XGL_UINT i;
186
187 for (i = 0; i < rmap->slot_count; i++) {
Chia-I Wu20983762014-09-02 12:07:28 +0800188 struct intel_pipeline_rmap_slot *slot = &rmap->slots[i];
Chia-I Wua6d50aa2014-09-02 10:21:34 +0800189
190 switch (slot->path_len) {
191 case 0:
192 case 1:
Chia-I Wu20983762014-09-02 12:07:28 +0800193 case INTEL_PIPELINE_RMAP_SLOT_RT:
194 case INTEL_PIPELINE_RMAP_SLOT_DYN:
Chia-I Wua6d50aa2014-09-02 10:21:34 +0800195 break;
196 default:
197 icd_free(slot->u.path);
198 break;
199 }
200 }
201
202 icd_free(rmap->slots);
203 icd_free(rmap);
204}
205
Chia-I Wu20983762014-09-02 12:07:28 +0800206static struct intel_pipeline_rmap *rmap_create(struct intel_dev *dev,
207 const XGL_DESCRIPTOR_SET_MAPPING *mapping,
208 const XGL_DYNAMIC_MEMORY_VIEW_SLOT_INFO *dyn,
209 XGL_UINT rt_count)
Chia-I Wu1f7540b2014-08-22 13:56:18 +0800210{
Chia-I Wu20983762014-09-02 12:07:28 +0800211 struct intel_pipeline_rmap *rmap;
212 struct intel_pipeline_rmap_slot *slot;
Chia-I Wu1f7540b2014-08-22 13:56:18 +0800213 XGL_UINT depth, rt;
214
215 rmap = icd_alloc(sizeof(*rmap), 0, XGL_SYSTEM_ALLOC_INTERNAL);
216 if (!rmap)
217 return NULL;
218
219 memset(rmap, 0, sizeof(*rmap));
220
221 depth = rmap_init_counts(rmap, mapping);
222
223 /* add RTs and the dynamic memory view */
224 rmap_update_count(rmap, dyn->slotObjectType, dyn->shaderEntityIndex);
225 rmap->rt_count = rt_count;
226
227 rmap->slot_count = rmap->rt_count + rmap->resource_count +
228 rmap->uav_count + rmap->sampler_count;
229
230 rmap->slots = icd_alloc(sizeof(rmap->slots[0]) * rmap->slot_count,
231 0, XGL_SYSTEM_ALLOC_INTERNAL);
232 if (!rmap->slots) {
233 icd_free(rmap);
234 return NULL;
235 }
236
237 memset(rmap->slots, 0, sizeof(rmap->slots[0]) * rmap->slot_count);
238
239 if (!rmap_init_slots(rmap, mapping, depth)) {
Chia-I Wua6d50aa2014-09-02 10:21:34 +0800240 rmap_destroy(rmap);
Chia-I Wu1f7540b2014-08-22 13:56:18 +0800241 return NULL;
242 }
243
244 /* add RTs and the dynamic memory view */
245 slot = rmap_get_slot(rmap, dyn->slotObjectType, dyn->shaderEntityIndex);
246 if (slot) {
Chia-I Wu20983762014-09-02 12:07:28 +0800247 slot->path_len = INTEL_PIPELINE_RMAP_SLOT_DYN;
Chia-I Wu1f7540b2014-08-22 13:56:18 +0800248 slot->u.index = 0;
249 }
250 for (rt = 0; rt < rmap->rt_count; rt++) {
251 slot = &rmap->slots[rt];
Chia-I Wu20983762014-09-02 12:07:28 +0800252 slot->path_len = INTEL_PIPELINE_RMAP_SLOT_RT;
Chia-I Wu1f7540b2014-08-22 13:56:18 +0800253 slot->u.index = rt;
254 }
255
256 return rmap;
257}
258
Chia-I Wuf2b6d722014-09-02 08:52:27 +0800259static XGL_RESULT pipeline_shader_copy_pcb(struct intel_pipeline_shader *sh,
Chia-I Wuc3ddee62014-09-02 10:53:20 +0800260 const XGL_LINK_CONST_BUFFER *buffers,
261 XGL_UINT buffer_count)
262{
263 XGL_SIZE pcb_size = 0;
264 XGL_UINT i;
265
266 /*
267 * XXX This is not enough. We need a mapping from buffer id to pcb
268 * offset, and we need to check against hardware limits.
269 */
270 for (i = 0; i < buffer_count; i++) {
271 const XGL_LINK_CONST_BUFFER *buf = &buffers[i];
272
273 pcb_size += buf->bufferSize;
274 }
275
276 sh->pcb = icd_alloc(pcb_size, 0, XGL_SYSTEM_ALLOC_INTERNAL);
277 if (!sh->pcb)
278 return XGL_ERROR_OUT_OF_MEMORY;
279
280 pcb_size = 0;
281 for (i = 0; i < buffer_count; i++) {
282 const XGL_LINK_CONST_BUFFER *buf = &buffers[i];
283
284 memcpy((char *) sh->pcb + pcb_size, buf->pBufferData, buf->bufferSize);
285 pcb_size += buf->bufferSize;
286 }
287
288 sh->pcb_size = pcb_size;
289
290 return XGL_SUCCESS;
291}
292
Chia-I Wuf2b6d722014-09-02 08:52:27 +0800293static XGL_RESULT pipeline_shader_copy_ir(struct intel_pipeline_shader *sh,
Chia-I Wu39026c92014-09-02 10:03:19 +0800294 const struct intel_shader *ir)
Chia-I Wu98824592014-09-02 09:42:46 +0800295{
Chia-I Wu39026c92014-09-02 10:03:19 +0800296 sh->pCode = icd_alloc(ir->ir->size, 0, XGL_SYSTEM_ALLOC_INTERNAL_SHADER);
297 if (!sh->pCode)
Chia-I Wu98824592014-09-02 09:42:46 +0800298 return XGL_ERROR_OUT_OF_MEMORY;
299
Chia-I Wu39026c92014-09-02 10:03:19 +0800300 memcpy(sh->pCode, ir->ir->kernel, ir->ir->size);
301 sh->codeSize = ir->ir->size;
Chia-I Wu98824592014-09-02 09:42:46 +0800302
Chia-I Wu39026c92014-09-02 10:03:19 +0800303 sh->uses = ir->uses;
Chia-I Wu98824592014-09-02 09:42:46 +0800304
Chia-I Wu39026c92014-09-02 10:03:19 +0800305 sh->in_count = ir->in_count;
306 sh->out_count = ir->out_count;
307 sh->sampler_count = ir->sampler_count;
308 sh->surface_count = ir->surface_count;
309 sh->urb_grf_start = ir->urb_grf_start;
Chia-I Wu39026c92014-09-02 10:03:19 +0800310 sh->barycentric_interps = ir->barycentric_interps;
311
312 return XGL_SUCCESS;
313}
314
315static XGL_RESULT pipeline_build_vs(struct intel_pipeline *pipeline,
316 const struct intel_pipeline_create_info *info)
317{
Chia-I Wuf2b6d722014-09-02 08:52:27 +0800318 struct intel_pipeline_shader *vs = &pipeline->vs;
Chia-I Wu39026c92014-09-02 10:03:19 +0800319 XGL_RESULT ret;
320
321 ret = pipeline_shader_copy_ir(vs, intel_shader(info->vs.shader));
322 if (ret != XGL_SUCCESS)
323 return ret;
324
Chia-I Wuc3ddee62014-09-02 10:53:20 +0800325 ret = pipeline_shader_copy_pcb(vs, info->vs.pLinkConstBufferInfo,
326 info->vs.linkConstBufferCount);
327 if (ret != XGL_SUCCESS) {
328 icd_free(vs->pCode);
329 return ret;
330 }
331
Chia-I Wu39026c92014-09-02 10:03:19 +0800332 vs->rmap = rmap_create(pipeline->dev,
333 &info->vs.descriptorSetMapping[0],
334 &info->vs.dynamicMemoryViewMapping, 0);
335 if (!vs->rmap) {
336 icd_free(vs->pCode);
Chia-I Wuc3ddee62014-09-02 10:53:20 +0800337 icd_free(vs->pcb);
Chia-I Wu39026c92014-09-02 10:03:19 +0800338 return XGL_ERROR_OUT_OF_MEMORY;
Chia-I Wu98824592014-09-02 09:42:46 +0800339 }
340
Chia-I Wu39026c92014-09-02 10:03:19 +0800341 pipeline->active_shaders |= SHADER_VERTEX_FLAG;
342
343 return XGL_SUCCESS;
344}
345
346static XGL_RESULT pipeline_build_tcs(struct intel_pipeline *pipeline,
347 const struct intel_pipeline_create_info *info)
348{
Chia-I Wu95959fb2014-09-02 11:01:03 +0800349 struct intel_pipeline_shader *tcs = &pipeline->tcs;
Chia-I Wu39026c92014-09-02 10:03:19 +0800350 XGL_RESULT ret;
351
352 ret = pipeline_shader_copy_ir(tcs, intel_shader(info->tcs.shader));
353 if (ret != XGL_SUCCESS)
354 return ret;
355
Chia-I Wuc3ddee62014-09-02 10:53:20 +0800356 ret = pipeline_shader_copy_pcb(tcs, info->tcs.pLinkConstBufferInfo,
357 info->tcs.linkConstBufferCount);
358 if (ret != XGL_SUCCESS) {
359 icd_free(tcs->pCode);
360 return ret;
361 }
362
Chia-I Wu39026c92014-09-02 10:03:19 +0800363 pipeline->active_shaders |= SHADER_TESS_CONTROL_FLAG;
364
365 return XGL_SUCCESS;
366}
367
368static XGL_RESULT pipeline_build_tes(struct intel_pipeline *pipeline,
369 const struct intel_pipeline_create_info *info)
370{
Chia-I Wu95959fb2014-09-02 11:01:03 +0800371 struct intel_pipeline_shader *tes = &pipeline->tes;
Chia-I Wu39026c92014-09-02 10:03:19 +0800372 XGL_RESULT ret;
373
374 ret = pipeline_shader_copy_ir(tes, intel_shader(info->tes.shader));
375 if (ret != XGL_SUCCESS)
376 return ret;
377
Chia-I Wuc3ddee62014-09-02 10:53:20 +0800378 ret = pipeline_shader_copy_pcb(tes, info->tes.pLinkConstBufferInfo,
379 info->tes.linkConstBufferCount);
380 if (ret != XGL_SUCCESS) {
381 icd_free(tes->pCode);
382 return ret;
383 }
384
Chia-I Wu39026c92014-09-02 10:03:19 +0800385 pipeline->active_shaders |= SHADER_TESS_EVAL_FLAG;
386
387 return XGL_SUCCESS;
388}
389
390static XGL_RESULT pipeline_build_gs(struct intel_pipeline *pipeline,
391 const struct intel_pipeline_create_info *info)
392{
Chia-I Wuf2b6d722014-09-02 08:52:27 +0800393 struct intel_pipeline_shader *gs = &pipeline->gs;
Chia-I Wu39026c92014-09-02 10:03:19 +0800394 XGL_RESULT ret;
395
396 ret = pipeline_shader_copy_ir(gs, intel_shader(info->gs.shader));
397 if (ret != XGL_SUCCESS)
398 return ret;
399
Chia-I Wuc3ddee62014-09-02 10:53:20 +0800400 ret = pipeline_shader_copy_pcb(gs, info->gs.pLinkConstBufferInfo,
401 info->gs.linkConstBufferCount);
402 if (ret != XGL_SUCCESS) {
403 icd_free(gs->pCode);
404 return ret;
405 }
406
Chia-I Wu39026c92014-09-02 10:03:19 +0800407 pipeline->active_shaders |= SHADER_GEOMETRY_FLAG;
408
409 return XGL_SUCCESS;
410}
411
412static XGL_RESULT pipeline_build_fs(struct intel_pipeline *pipeline,
413 const struct intel_pipeline_create_info *info)
414{
Chia-I Wuf2b6d722014-09-02 08:52:27 +0800415 struct intel_pipeline_shader *fs = &pipeline->fs;
Chia-I Wu39026c92014-09-02 10:03:19 +0800416 XGL_RESULT ret;
417
418 ret = pipeline_shader_copy_ir(fs, intel_shader(info->fs.shader));
419 if (ret != XGL_SUCCESS)
420 return ret;
421
Chia-I Wuc3ddee62014-09-02 10:53:20 +0800422 ret = pipeline_shader_copy_pcb(fs, info->fs.pLinkConstBufferInfo,
423 info->fs.linkConstBufferCount);
424 if (ret != XGL_SUCCESS) {
425 icd_free(fs->pCode);
426 return ret;
427 }
428
Chia-I Wu39026c92014-09-02 10:03:19 +0800429 /* assuming one RT; need to parse the shader */
430 fs->rmap = rmap_create(pipeline->dev,
431 &info->fs.descriptorSetMapping[0],
432 &info->fs.dynamicMemoryViewMapping, 1);
433 if (!fs->rmap) {
Chia-I Wuc3ddee62014-09-02 10:53:20 +0800434 icd_free(fs->pcb);
Chia-I Wu39026c92014-09-02 10:03:19 +0800435 icd_free(fs->pCode);
436 return XGL_ERROR_OUT_OF_MEMORY;
437 }
438
Chia-I Wu39026c92014-09-02 10:03:19 +0800439 pipeline->active_shaders |= SHADER_FRAGMENT_FLAG;
440
441 return XGL_SUCCESS;
442}
443
444static XGL_RESULT pipeline_build_cs(struct intel_pipeline *pipeline,
445 const struct intel_pipeline_create_info *info)
446{
Chia-I Wu95959fb2014-09-02 11:01:03 +0800447 struct intel_pipeline_shader *cs = &pipeline->cs;
Chia-I Wu39026c92014-09-02 10:03:19 +0800448 XGL_RESULT ret;
449
450 ret = pipeline_shader_copy_ir(cs, intel_shader(info->compute.cs.shader));
451 if (ret != XGL_SUCCESS)
452 return ret;
453
Chia-I Wuc3ddee62014-09-02 10:53:20 +0800454 ret = pipeline_shader_copy_pcb(cs, info->compute.cs.pLinkConstBufferInfo,
455 info->compute.cs.linkConstBufferCount);
456 if (ret != XGL_SUCCESS) {
457 icd_free(cs->pCode);
458 return ret;
459 }
460
Chia-I Wu39026c92014-09-02 10:03:19 +0800461 pipeline->active_shaders |= SHADER_COMPUTE_FLAG;
462
Chia-I Wu98824592014-09-02 09:42:46 +0800463 return XGL_SUCCESS;
464}
465
466XGL_RESULT pipeline_build_shaders(struct intel_pipeline *pipeline,
467 const struct intel_pipeline_create_info *info)
468{
469 XGL_RESULT ret = XGL_SUCCESS;
470
471 if (ret == XGL_SUCCESS && info->vs.shader)
Chia-I Wu39026c92014-09-02 10:03:19 +0800472 ret = pipeline_build_vs(pipeline, info);
Chia-I Wu98824592014-09-02 09:42:46 +0800473 if (ret == XGL_SUCCESS && info->tcs.shader)
Chia-I Wu39026c92014-09-02 10:03:19 +0800474 ret = pipeline_build_tcs(pipeline, info);
Chia-I Wu98824592014-09-02 09:42:46 +0800475 if (ret == XGL_SUCCESS && info->tes.shader)
Chia-I Wu39026c92014-09-02 10:03:19 +0800476 ret = pipeline_build_tes(pipeline, info);
Chia-I Wu98824592014-09-02 09:42:46 +0800477 if (ret == XGL_SUCCESS && info->gs.shader)
Chia-I Wu39026c92014-09-02 10:03:19 +0800478 ret = pipeline_build_gs(pipeline, info);
Chia-I Wu98824592014-09-02 09:42:46 +0800479 if (ret == XGL_SUCCESS && info->fs.shader)
Chia-I Wu39026c92014-09-02 10:03:19 +0800480 ret = pipeline_build_fs(pipeline, info);
481
482 if (ret == XGL_SUCCESS && info->compute.cs.shader)
483 ret = pipeline_build_cs(pipeline, info);
Chia-I Wu98824592014-09-02 09:42:46 +0800484
485 return ret;
486}
487
Chia-I Wuf2b6d722014-09-02 08:52:27 +0800488static void pipeline_tear_shader(struct intel_pipeline_shader *sh)
Chia-I Wu39026c92014-09-02 10:03:19 +0800489{
490 icd_free(sh->pCode);
Chia-I Wuc3ddee62014-09-02 10:53:20 +0800491 if (sh->pcb)
492 icd_free(sh->pcb);
Chia-I Wu39026c92014-09-02 10:03:19 +0800493 if (sh->rmap)
494 rmap_destroy(sh->rmap);
495}
496
Chia-I Wu98824592014-09-02 09:42:46 +0800497void pipeline_tear_shaders(struct intel_pipeline *pipeline)
498{
499 if (pipeline->active_shaders & SHADER_VERTEX_FLAG) {
Chia-I Wuc3ddee62014-09-02 10:53:20 +0800500 pipeline_tear_shader(&pipeline->vs);
Chia-I Wu98824592014-09-02 09:42:46 +0800501 }
502
Chia-I Wu39026c92014-09-02 10:03:19 +0800503 if (pipeline->active_shaders & SHADER_TESS_CONTROL_FLAG) {
Chia-I Wu95959fb2014-09-02 11:01:03 +0800504 pipeline_tear_shader(&pipeline->tcs);
Chia-I Wu39026c92014-09-02 10:03:19 +0800505 }
506
507 if (pipeline->active_shaders & SHADER_TESS_EVAL_FLAG) {
Chia-I Wu95959fb2014-09-02 11:01:03 +0800508 pipeline_tear_shader(&pipeline->tes);
Chia-I Wu39026c92014-09-02 10:03:19 +0800509 }
510
511 if (pipeline->active_shaders & SHADER_GEOMETRY_FLAG) {
512 pipeline_tear_shader(&pipeline->gs);
513 }
514
515 if (pipeline->active_shaders & SHADER_FRAGMENT_FLAG) {
Chia-I Wuc3ddee62014-09-02 10:53:20 +0800516 pipeline_tear_shader(&pipeline->fs);
Chia-I Wu39026c92014-09-02 10:03:19 +0800517 }
518
519 if (pipeline->active_shaders & SHADER_COMPUTE_FLAG) {
Chia-I Wu95959fb2014-09-02 11:01:03 +0800520 pipeline_tear_shader(&pipeline->cs);
Chia-I Wu39026c92014-09-02 10:03:19 +0800521 }
Chia-I Wu98824592014-09-02 09:42:46 +0800522}