Lines Matching defs:shader
31 * In the first stage shaders are partitioned into groups based on the shader
35 * - Undefined references in each shader are resolve to definitions in
36 * another shader.
42 * The result, in the terminology of the GLSL spec, is a set of shader
46 * on each of the shader executables.
48 * - Each shader executable must define a \c main function.
49 * - Each vertex shader executable must write to \c gl_Position.
50 * - Each fragment shader executable must write to either \c gl_FragData or
53 * In the final stage individual shader executables are linked to create a
56 * - Types of uniforms defined in multiple shader stages with the same name
58 * - Initializers for uniforms defined in multiple shader stages with the
295 /* Generate a link error if the shader has declared this array with
306 /* Generate a link error if the shader attempts to access an input
311 linker_error(this->prog, "%s shader accesses element %i of "
361 * Visitor that determines the highest stream id to which a (geometry) shader
494 * shader inputs (via layout(location=...)), and generic fragment shader
507 * shader.
518 struct gl_linked_shader *shader,
526 do_dead_functions(shader->ir);
536 * "It is an error for a shader to statically write both
552 find_assignments(shader->ir, variables);
565 linker_error(prog, "%s shader writes to both `gl_ClipVertex' "
567 _mesa_shader_stage_to_string(shader->Stage));
571 linker_error(prog, "%s shader writes to both `gl_ClipVertex' "
573 _mesa_shader_stage_to_string(shader->Stage));
580 shader->symbols->get_variable("gl_ClipDistance");
586 shader->symbols->get_variable("gl_CullDistance");
599 linker_error(prog, "%s shader: the combined size of "
603 _mesa_shader_stage_to_string(shader->Stage),
611 * Verify that a vertex shader executable meets all semantic requirements.
616 * \param shader Vertex shader executable to be verified
620 struct gl_linked_shader *shader,
623 if (shader == NULL)
630 * position. All executions of a well-formed vertex shader
634 * position. All executions of a well-formed vertex shader
641 * position. It can be written at any time during shader
642 * execution. It may also be read back by a vertex shader
647 * the vertex shader executable does not write gl_Position."
654 find_assignments(shader->ir, &gl_Position);
658 "vertex shader does not write to `gl_Position'. "
662 "vertex shader does not write to `gl_Position'. \n");
668 analyze_clip_cull_usage(prog, shader, consts, &shader->Program->info);
673 struct gl_linked_shader *shader,
676 if (shader == NULL)
679 analyze_clip_cull_usage(prog, shader, consts, &shader->Program->info);
684 * Verify that a fragment shader executable meets all semantic requirements
686 * \param shader Fragment shader executable to be verified
690 struct gl_linked_shader *shader)
692 if (shader == NULL)
698 find_assignments(shader->ir, variables);
701 linker_error(prog, "fragment shader writes to both "
707 * Verify that a geometry shader executable meets all semantic requirements
712 * \param shader Geometry shader executable to be verified
716 struct gl_linked_shader *shader,
719 if (shader == NULL)
723 vertices_per_prim(shader->Program->info.gs.input_primitive);
726 analyze_clip_cull_usage(prog, shader, consts, &shader->Program->info);
756 * contains a geometry shader calling EmitStreamVertex() or
858 * inside a shader. The cross validation is done at the Interface Block
919 * by earlier shader stage. If so, mark it explicit in this stage
960 * "If gl_FragDepth is redeclared in any fragment shader in a
982 "qualifier in any fragment shader, it must be "
1083 * "It is a link-time error if any particular shader interface
1117 * Perform validation of uniforms used across multiple shader stages
1267 "fragment shader built-in `%s' has invariant qualifier, "
1268 "but vertex shader built-in `%s' lacks invariant qualifier\n",
1279 "fragment shader built-in `%s' has invariant qualifier, "
1280 "but vertex shader built-in `%s' lacks invariant qualifier\n",
1289 "fragment shader built-in `%s' can not be declared as invariant\n",
1312 * This is used when instruction trees are cloned from one shader and placed in
1314 * do not exist in the target shader. This function finds these \c ir_variable
1316 * shader.
1318 * If there is no matching variable in the target shader, a clone of the
1319 * \c ir_variable is made and added to the target shader. The new variable is
1324 * linked shader.
1696 struct gl_shader *shader = shader_list[i];
1699 if (shader->TransformFeedbackBufferStride[j]) {
1702 shader->TransformFeedbackBufferStride[j];
1706 shader->TransformFeedbackBufferStride[j]){
1711 shader->TransformFeedbackBufferStride[j]);
1735 struct gl_shader *shader = shader_list[i];
1737 if (shader->bindless_sampler)
1739 if (shader->bindless_image)
1741 if (shader->bound_sampler)
1743 if (shader->bound_image)
1763 * the value for the linked shader.
1773 /* Find first shader with explicit layer declaration */
1782 /* Now make sure that each subsequent shader's explicit layer declaration
1796 * Performs the cross-validation of tessellation control shader vertices and
1798 * and propagates them to the linked TCS and linked shader program.
1813 * "All tessellation control shader layout declarations in a program
1822 struct gl_shader *shader = shader_list[i];
1824 if (shader->info.TessCtrl.VerticesOut != 0) {
1827 (unsigned) shader->info.TessCtrl.VerticesOut) {
1828 linker_error(prog, "tessellation control shader defined with "
1831 shader->info.TessCtrl.VerticesOut);
1835 shader->info.TessCtrl.VerticesOut;
1840 * since we already know we're in the right type of shader program
1844 linker_error(prog, "tessellation control shader didn't declare "
1852 * Performs the cross-validation of tessellation evaluation shader
1855 * to the linked TES and linked shader program.
1874 * "At least one tessellation evaluation shader (compilation unit) in
1887 struct gl_shader *shader = shader_list[i];
1889 if (shader->info.TessEval._PrimitiveMode != TESS_PRIMITIVE_UNSPECIFIED) {
1892 shader->info.TessEval._PrimitiveMode) {
1893 linker_error(prog, "tessellation evaluation shader defined with "
1898 shader->info.TessEval._PrimitiveMode;
1901 if (shader->info.TessEval.Spacing != 0) {
1903 shader->info.TessEval.Spacing) {
1904 linker_error(prog, "tessellation evaluation shader defined with "
1908 gl_prog->info.tess.spacing = shader->info.TessEval.Spacing;
1911 if (shader->info.TessEval.VertexOrder != 0) {
1913 vertex_order != shader->info.TessEval.VertexOrder) {
1914 linker_error(prog, "tessellation evaluation shader defined with "
1918 vertex_order = shader->info.TessEval.VertexOrder;
1921 if (shader->info.TessEval.PointMode != -1) {
1923 point_mode != shader->info.TessEval.PointMode) {
1924 linker_error(prog, "tessellation evaluation shader defined with "
1928 point_mode = shader->info.TessEval.PointMode;
1934 * since we already know we're in the right type of shader program
1939 "tessellation evaluation shader didn't declare input "
1963 * and propagates them to the linked FS and linked shader program.
1982 struct gl_shader *shader = shader_list[i];
1985 * "If gl_FragCoord is redeclared in any fragment shader in a program,
1989 if ((redeclares_gl_fragcoord && !shader->redeclares_gl_fragcoord &&
1990 shader->uses_gl_fragcoord)
1991 || (shader->redeclares_gl_fragcoord && !redeclares_gl_fragcoord &&
1993 linker_error(prog, "fragment shader defined with conflicting "
2002 if (redeclares_gl_fragcoord && shader->redeclares_gl_fragcoord &&
2003 (shader->origin_upper_left != origin_upper_left ||
2004 shader->pixel_center_integer != pixel_center_integer)) {
2005 linker_error(prog, "fragment shader defined with conflicting "
2009 /* Update the linked shader state. Note that uses_gl_fragcoord should
2014 if (shader->redeclares_gl_fragcoord || shader->uses_gl_fragcoord) {
2015 redeclares_gl_fragcoord = shader->redeclares_gl_fragcoord;
2016 uses_gl_fragcoord |= shader->uses_gl_fragcoord;
2017 origin_upper_left = shader->origin_upper_left;
2018 pixel_center_integer = shader->pixel_center_integer;
2022 shader->EarlyFragmentTests || shader->PostDepthCoverage;
2023 linked_shader->Program->info.fs.inner_coverage |= shader->InnerCoverage;
2025 shader->PostDepthCoverage;
2027 shader->PixelInterlockOrdered;
2029 shader->PixelInterlockUnordered;
2031 shader->SampleInterlockOrdered;
2033 shader->SampleInterlockUnordered;
2034 linked_shader->Program->info.fs.advanced_blend_modes |= shader->BlendSupport;
2042 * Performs the cross-validation of geometry shader max_vertices and
2044 * and propagates them to the linked GS and linked shader program.
2067 * "All geometry shader output layout declarations in a program
2076 struct gl_shader *shader = shader_list[i];
2078 if (shader->info.Geom.InputType != SHADER_PRIM_UNKNOWN) {
2081 shader->info.Geom.InputType) {
2082 linker_error(prog, "geometry shader defined with conflicting "
2086 gl_prog->info.gs.input_primitive = (enum shader_prim)shader->info.Geom.InputType;
2089 if (shader->info.Geom.OutputType != SHADER_PRIM_UNKNOWN) {
2092 shader->info.Geom.OutputType) {
2093 linker_error(prog, "geometry shader defined with conflicting "
2097 gl_prog->info.gs.output_primitive = (enum shader_prim)shader->info.Geom.OutputType;
2100 if (shader->info.Geom.VerticesOut != -1) {
2102 vertices_out != shader->info.Geom.VerticesOut) {
2103 linker_error(prog, "geometry shader defined with conflicting "
2105 vertices_out, shader->info.Geom.VerticesOut);
2108 vertices_out = shader->info.Geom.VerticesOut;
2111 if (shader->info.Geom.Invocations != 0) {
2114 (unsigned) shader->info.Geom.Invocations) {
2115 linker_error(prog, "geometry shader defined with conflicting "
2118 shader->info.Geom.Invocations);
2121 gl_prog->info.gs.invocations = shader->info.Geom.Invocations;
2126 * since we already know we're in the right type of shader program
2131 "geometry shader didn't declare primitive input type\n");
2137 "geometry shader didn't declare primitive output type\n");
2143 "geometry shader didn't declare max_vertices\n");
2155 * Perform cross-validation of compute shader local_size_{x,y,z} layout and
2157 * propagate them to the linked CS and linked shader program.
2165 /* This function is called for all shader stages, but it only has an effect
2189 struct gl_shader *shader = shader_list[sh];
2191 if (shader->info.Comp.LocalSize[0] != 0) {
2195 shader->info.Comp.LocalSize[i]) {
2196 linker_error(prog, "compute shader defined with conflicting "
2204 shader->info.Comp.LocalSize[i];
2206 } else if (shader->info.Comp.LocalSizeVariable) {
2210 * If one compute shader attached to a program declares a
2211 * variable local group size and a second compute shader
2215 linker_error(prog, "compute shader defined with both fixed and "
2222 enum gl_derivative_group group = shader->info.Comp.DerivativeGroup;
2226 linker_error(prog, "compute shader defined with conflicting "
2235 * since we already know we're in the right type of shader program
2240 linker_error(prog, "compute shader must contain a fixed or a variable "
2272 * directly used in a shader with the main function.
2283 /* Skip shader object with main function */
2307 * Combine a group of shaders for a single stage to generate a linked shader
2310 * If this function is supplied a single shader, it is cloned, and the new
2311 * shader is returned.
2360 /* If the other shader has no function (and therefore no function
2361 * signatures) with the same name, skip to the next shader.
2383 /* Find the shader that defines main, and make a clone of it.
2386 * found, find the shader that defines it. Clone the reference and add
2387 * it to the shader. Repeat until there are no undefined references or
2402 linker_error(prog, "%s shader lacks `main'\n",
2410 /* Create program and attach it to the linked shader */
2442 /* The pointer to the main function in the final linked shader (i.e., the
2443 * copy of the original shader that contained the main function).
2502 linker_error(prog, "Too many %s shader storage blocks (%d/%d)\n",
2512 /* Copy ubo blocks to linked shader list */
2522 /* Copy ssbo blocks to linked shader list */
2536 /* Set the size of geometry shader input arrays */
2588 /* If no control shader is present, then the TES inputs are statically
2669 * true is returned. Otherwise an error is emitted to the shader link log and
2701 * 1. Invalidate the location assignments for all vertex shader inputs.
2743 * fragment shader outputs.
2828 * assigned in the shader (presumably via a layout qualifier), make sure
2853 * path through the shader consumes more than one attribute of
2856 * through the shader consumes multiple aliased attributes,
2862 * "A program will fail to link if any two non-vertex shader
2870 * if they detect that every path through the vertex shader
2872 * location. For all shader types, a program will fail to link
2886 * the shader consumes more than one attribute of a set of
2889 * shader consumes multiple aliased attributes, but implemen-
2898 * through the vertex shader executable accesses multiple inputs
2908 ? "vertex shader input" : "fragment shader output";
2929 * "Additionally, for fragment shader outputs, if two
3028 "vertex shader inputs" : "fragment shader outputs",
3082 ? "vertex shader input" : "fragment shader output";
3131 * gl_FragDepth is not used in the shader, it's removed from the IR.
3275 * in the same shader stage, otherwise a compiler or linker error
3393 * "Each subroutine with an index qualifier in the shader must be
3401 "shader must be unique\n");
3429 * "A program will fail to compile or link if any shader
3442 linker_error(prog, "%s shader contains two or more function "
3476 * When separate shader programs are enabled, only input/outputs between
3478 * from the shader interface. Other inputs/outputs must remain active.
3524 /* Mark all generic shader inputs and outputs as unpaired. */
3574 * - No shader objects are attached to program."
3577 * Compatibility Profile missing shader stages are replaced by
3629 /* In desktop GLSL, different shader versions may be linked together. In
3630 * GLSL ES, all shader versions must be the same.
3647 linker_error(prog, "Geometry shader must be linked with "
3648 "vertex shader\n");
3653 linker_error(prog, "Tessellation evaluation shader must be linked "
3654 "with vertex shader\n");
3659 linker_error(prog, "Tessellation control shader must be linked with "
3660 "vertex shader\n");
3669 * shader [...] and [...] the program is not separable and
3670 * contains no object to form a tessellation evaluation shader"
3673 * eval shader, but that can only be used with transform feedback and
3678 * a tess control shader was dropped, because some hw vendors couldn't
3679 * support tessellation without a tess eval shader, but the linker
3685 * Do what's reasonable and always require a tess eval shader if a tess
3686 * control shader is present.
3690 linker_error(prog, "Tessellation control shader must be linked with "
3691 "tessellation evaluation shader\n");
3699 "containing a tessellation evaluation shader to also "
3700 "be linked with a tessellation control shader\n");
3710 "type of shader\n");
3817 /* Cross-validate uniform blocks between shader stages */
3889 * vertex shader inputs here.
3912 /* OpenGL ES < 3.1 requires that a vertex shader and a fragment shader both
3914 * anything about shader linking when one of the shaders (vertex or
3915 * fragment shader) is absent. So, the extension shouldn't change the
3925 * * program contains objects to form either a vertex shader or
3926 * fragment shader, and program is not separable, and does not
3927 * contain objects to form both a vertex shader and fragment
3928 * shader."
3931 * when we have a compute shader. For example:
3934 * - Geom or Tess without a Vertex shader is a link error which means we
3935 * always require a Vertex shader and hence a Fragment shader.
3936 * - Finally a Compute shader linked with any other stage is a link error.
3941 linker_error(prog, "program lacks a vertex shader\n");
3943 linker_error(prog, "program lacks a fragment shader\n");