2 * Copyright © 2013 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
21 * DEALINGS IN THE SOFTWARE.
24 #include "main/mtypes.h"
25 #include "program/prog_parameter.h"
26 #include "main/shaderapi.h"
28 #include "brw_context.h"
29 #include "brw_state.h"
32 /* Creates a new TES constant buffer reflecting the current TES program's
33 * constants, if needed by the TES program.
35 * Otherwise, constants go through the CURBEs using the brw_constant_buffer
39 brw_upload_tes_pull_constants(struct brw_context
*brw
)
41 struct brw_stage_state
*stage_state
= &brw
->tes
.base
;
43 /* BRW_NEW_TESS_PROGRAMS */
44 struct brw_program
*dp
=
45 (struct brw_program
*) brw
->programs
[MESA_SHADER_TESS_EVAL
];
50 /* BRW_NEW_TES_PROG_DATA */
51 const struct brw_stage_prog_data
*prog_data
= brw
->tes
.base
.prog_data
;
53 _mesa_shader_write_subroutine_indices(&brw
->ctx
, MESA_SHADER_TESS_EVAL
);
54 /* _NEW_PROGRAM_CONSTANTS */
55 brw_upload_pull_constants(brw
, BRW_NEW_TES_CONSTBUF
, &dp
->program
,
56 stage_state
, prog_data
);
59 const struct brw_tracked_state brw_tes_pull_constants
= {
61 .mesa
= _NEW_PROGRAM_CONSTANTS
,
62 .brw
= BRW_NEW_BATCH
|
63 BRW_NEW_TES_PROG_DATA
|
64 BRW_NEW_TESS_PROGRAMS
,
66 .emit
= brw_upload_tes_pull_constants
,
70 brw_upload_tes_ubo_surfaces(struct brw_context
*brw
)
72 struct gl_context
*ctx
= &brw
->ctx
;
75 struct gl_program
*prog
=
76 ctx
->_Shader
->CurrentProgram
[MESA_SHADER_TESS_EVAL
];
78 /* BRW_NEW_TES_PROG_DATA */
79 struct brw_stage_prog_data
*prog_data
= brw
->tes
.base
.prog_data
;
81 brw_upload_ubo_surfaces(brw
, prog
, &brw
->tes
.base
, prog_data
);
84 const struct brw_tracked_state brw_tes_ubo_surfaces
= {
87 .brw
= BRW_NEW_BATCH
|
88 BRW_NEW_TES_PROG_DATA
|
89 BRW_NEW_UNIFORM_BUFFER
,
91 .emit
= brw_upload_tes_ubo_surfaces
,
95 brw_upload_tes_abo_surfaces(struct brw_context
*brw
)
98 const struct gl_program
*tep
= brw
->programs
[MESA_SHADER_TESS_EVAL
];
101 /* BRW_NEW_TES_PROG_DATA */
102 brw_upload_abo_surfaces(brw
, tep
, &brw
->tes
.base
,
103 brw
->tes
.base
.prog_data
);
107 const struct brw_tracked_state brw_tes_abo_surfaces
= {
109 .mesa
= _NEW_PROGRAM
,
110 .brw
= BRW_NEW_ATOMIC_BUFFER
|
112 BRW_NEW_TES_PROG_DATA
,
114 .emit
= brw_upload_tes_abo_surfaces
,
118 brw_upload_tes_image_surfaces(struct brw_context
*brw
)
120 /* BRW_NEW_TESS_PROGRAMS */
121 const struct gl_program
*tep
= brw
->programs
[MESA_SHADER_TESS_EVAL
];
124 /* BRW_NEW_TES_PROG_DATA, BRW_NEW_IMAGE_UNITS */
125 brw_upload_image_surfaces(brw
, tep
, &brw
->tes
.base
,
126 brw
->tes
.base
.prog_data
);
130 const struct brw_tracked_state brw_tes_image_surfaces
= {
132 .brw
= BRW_NEW_BATCH
|
134 BRW_NEW_IMAGE_UNITS
|
135 BRW_NEW_TESS_PROGRAMS
|
136 BRW_NEW_TES_PROG_DATA
,
138 .emit
= brw_upload_tes_image_surfaces
,