2 * Copyright © 2016 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
25 #include "mesa/main/mtypes.h"
28 copy_shader_info(const struct gl_shader_program
*shader_prog
,
29 struct gl_linked_shader
*sh
)
31 shader_info
*info
= &sh
->Program
->info
;
33 info
->inputs_read
= sh
->Program
->InputsRead
;
34 info
->double_inputs_read
= sh
->Program
->DoubleInputsRead
;
35 info
->outputs_written
= sh
->Program
->OutputsWritten
;
36 info
->outputs_read
= sh
->Program
->OutputsRead
;
37 info
->patch_inputs_read
= sh
->Program
->PatchInputsRead
;
38 info
->patch_outputs_written
= sh
->Program
->PatchOutputsWritten
;
39 info
->system_values_read
= sh
->Program
->SystemValuesRead
;
40 info
->uses_texture_gather
= sh
->Program
->UsesGather
;
43 case MESA_SHADER_TESS_EVAL
: {
44 struct gl_tess_eval_program
*tep
=
45 (struct gl_tess_eval_program
*)sh
->Program
;
47 info
->tes
.primitive_mode
= tep
->PrimitiveMode
;
48 info
->tes
.spacing
= tep
->Spacing
;
49 info
->tes
.vertex_order
= tep
->VertexOrder
;
50 info
->tes
.point_mode
= tep
->PointMode
;
54 case MESA_SHADER_GEOMETRY
:
55 info
->gs
.vertices_in
= shader_prog
->Geom
.VerticesIn
;
56 info
->gs
.output_primitive
= sh
->info
.Geom
.OutputType
;
57 info
->gs
.vertices_out
= sh
->info
.Geom
.VerticesOut
;
58 info
->gs
.invocations
= sh
->info
.Geom
.Invocations
;
59 info
->gs
.uses_end_primitive
= shader_prog
->Geom
.UsesEndPrimitive
;
60 info
->gs
.uses_streams
= shader_prog
->Geom
.UsesStreams
;
63 case MESA_SHADER_FRAGMENT
: {
64 struct gl_fragment_program
*fp
=
65 (struct gl_fragment_program
*)sh
->Program
;
67 info
->fs
.uses_discard
= fp
->UsesKill
;
68 info
->fs
.uses_sample_qualifier
= fp
->IsSample
!= 0;
69 info
->fs
.early_fragment_tests
= sh
->info
.EarlyFragmentTests
;
70 info
->fs
.depth_layout
= fp
->FragDepthLayout
;
74 case MESA_SHADER_COMPUTE
: {
75 struct gl_compute_program
*cp
= (struct gl_compute_program
*)sh
->Program
;
76 info
->cs
.local_size
[0] = cp
->LocalSize
[0];
77 info
->cs
.local_size
[1] = cp
->LocalSize
[1];
78 info
->cs
.local_size
[2] = cp
->LocalSize
[2];
83 break; /* No stage-specific info */