Home | History | Annotate | Download | only in glsl

Lines Matching full: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
250 /* Generate a link error if the shader has declared this array with
261 /* Generate a link error if the shader attempts to access an input
266 linker_error(this->prog, "%s shader accesses element %i of "
283 * Visitor that determines the highest stream id to which a (geometry) shader
514 * shader inputs (via layout(location=...)), and generic fragment shader
537 * shader.
548 struct gl_linked_shader *shader,
557 /* From section 7.1 (Vertex Shader Special Variables) of the
560 * "It is an error for a shader to statically write both
570 clip_distance.run(shader->ir);
571 cull_distance.run(shader->ir);
585 clip_vertex.run(shader->ir);
588 linker_error(prog, "%s shader writes to both `gl_ClipVertex' "
590 _mesa_shader_stage_to_string(shader->Stage));
594 linker_error(prog, "%s shader writes to both `gl_ClipVertex' "
596 _mesa_shader_stage_to_string(shader->Stage));
603 shader->symbols->get_variable("gl_ClipDistance");
609 shader->symbols->get_variable("gl_CullDistance");
622 linker_error(prog, "%s shader: the combined size of "
626 _mesa_shader_stage_to_string(shader->Stage),
634 * Verify that a vertex shader executable meets all semantic requirements.
639 * \param shader Vertex shader executable to be verified
643 struct gl_linked_shader *shader,
646 if (shader == NULL)
653 * position. All executions of a well-formed vertex shader
657 * position. All executions of a well-formed vertex shader
664 * position. It can be written at any time during shader
665 * execution. It may also be read back by a vertex shader
670 * the vertex shader executable does not write gl_Position."
677 find.run(shader->ir);
681 "vertex shader does not write to `gl_Position'. "
685 "vertex shader does not write to `gl_Position'. \n");
691 analyze_clip_cull_usage(prog, shader, ctx,
698 struct gl_linked_shader *shader,
701 if (shader == NULL)
704 analyze_clip_cull_usage(prog, shader, ctx,
711 * Verify that a fragment shader executable meets all semantic requirements
713 * \param shader Fragment shader executable to be verified
717 struct gl_linked_shader *shader)
719 if (shader == NULL)
725 frag_color.run(shader->ir);
726 frag_data.run(shader->ir);
729 linker_error(prog, "fragment shader writes to both "
735 * Verify that a geometry shader executable meets all semantic requirements
740 * \param shader Geometry shader executable to be verified
744 struct gl_linked_shader *shader,
747 if (shader == NULL)
750 unsigned num_vertices = vertices_per_prim(shader->info.Geom.InputType);
753 analyze_clip_cull_usage(prog, shader, ctx,
785 * contains a geometry shader calling EmitStreamVertex() or
905 /* If it is an unsized array in a Shader Storage Block,
946 * by earlier shader stage. If so, mark it explicit in this stage
987 * "If gl_FragDepth is redeclared in any fragment shader in a
1009 "qualifier in any fragment shader, it must be "
1087 * shader interface.
1107 * Perform validation of uniforms used across multiple shader stages
1250 * This is used when instruction trees are cloned from one shader and placed in
1252 * do not exist in the target shader. This function finds these \c ir_variable
1254 * shader.
1256 * If there is no matching variable in the target shader, a clone of the
1257 * \c ir_variable is made and added to the target shader. The new variable is
1262 * linked shader.
1612 struct gl_shader *shader = shader_list[i];
1615 if (shader->info.TransformFeedback.BufferStride[j]) {
1617 shader->info.TransformFeedback.BufferStride[j] != 0 &&
1619 shader->info.TransformFeedback.BufferStride[j]) {
1625 shader->info.TransformFeedback.BufferStride[j]);
1629 if (shader->info.TransformFeedback.BufferStride[j])
1631 shader->info.TransformFeedback.BufferStride[j];
1662 * Performs the cross-validation of tessellation control shader vertices and
1664 * and propagates them to the linked TCS and linked shader program.
1679 * "All tessellation control shader layout declarations in a program
1688 struct gl_shader *shader = shader_list[i];
1690 if (shader->info.TessCtrl.VerticesOut != 0) {
1693 shader->info.TessCtrl.VerticesOut) {
1694 linker_error(prog, "tessellation control shader defined with "
1697 shader->info.TessCtrl.VerticesOut);
1701 shader->info.TessCtrl.VerticesOut;
1706 * since we already know we're in the right type of shader program
1710 linker_error(prog, "tessellation control shader didn't declare "
1718 * Performs the cross-validation of tessellation evaluation shader
1721 * to the linked TES and linked shader program.
1739 * "At least one tessellation evaluation shader (compilation unit) in
1752 struct gl_shader *shader = shader_list[i];
1754 if (shader->info.TessEval.PrimitiveMode != PRIM_UNKNOWN) {
1757 shader->info.TessEval.PrimitiveMode) {
1758 linker_error(prog, "tessellation evaluation shader defined with "
1762 linked_shader->info.TessEval.PrimitiveMode = shader->info.TessEval.PrimitiveMode;
1765 if (shader->info.TessEval.Spacing != 0) {
1768 shader->info.TessEval.Spacing) {
1769 linker_error(prog, "tessellation evaluation shader defined with "
1773 linked_shader->info.TessEval.Spacing = shader->info.TessEval.Spacing;
1776 if (shader->info.TessEval.VertexOrder != 0) {
1779 shader->info.TessEval.VertexOrder) {
1780 linker_error(prog, "tessellation evaluation shader defined with "
1785 shader->info.TessEval.VertexOrder;
1788 if (shader->info.TessEval.PointMode != -1) {
1791 shader->info.TessEval.PointMode) {
1792 linker_error(prog, "tessellation evaluation shader defined with "
1797 shader->info.TessEval.PointMode;
1803 * since we already know we're in the right type of shader program
1808 "tessellation evaluation shader didn't declare input "
1827 * and propagates them to the linked FS and linked shader program.
1846 struct gl_shader *shader = shader_list[i];
1849 * "If gl_FragCoord is redeclared in any fragment shader in a program,
1854 && !shader->info.redeclares_gl_fragcoord
1855 && shader->info.uses_gl_fragcoord)
1856 || (shader->info.redeclares_gl_fragcoord
1859 linker_error(prog, "fragment shader defined with conflicting "
1869 shader->info.redeclares_gl_fragcoord &&
1870 (shader->info.origin_upper_left !=
1872 shader->info.pixel_center_integer !=
1874 linker_error(prog, "fragment shader defined with conflicting "
1878 /* Update the linked shader state. Note that uses_gl_fragcoord should
1883 if (shader->info.redeclares_gl_fragcoord ||
1884 shader->info.uses_gl_fragcoord) {
1886 shader->info.redeclares_gl_fragcoord;
1889 shader->info.uses_gl_fragcoord;
1891 shader->info.origin_upper_left;
1893 shader->info.pixel_center_integer;
1897 shader->info.EarlyFragmentTests;
1899 shader->info.InnerCoverage;
1901 shader->info.PostDepthCoverage;
1903 linked_shader->Program->sh.fs.BlendSupport |= shader->BlendSupport;
1908 * Performs the cross-validation of geometry shader max_vertices and
1910 * and propagates them to the linked GS and linked shader program.
1932 * "All geometry shader output layout declarations in a program
1941 struct gl_shader *shader = shader_list[i];
1943 if (shader->info.Geom.InputType != PRIM_UNKNOWN) {
1946 shader->info.Geom.InputType) {
1947 linker_error(prog, "geometry shader defined with conflicting "
1951 linked_shader->info.Geom.InputType = shader->info.Geom.InputType;
1954 if (shader->info.Geom.OutputType != PRIM_UNKNOWN) {
1957 shader->info.Geom.OutputType) {
1958 linker_error(prog, "geometry shader defined with conflicting "
1962 linked_shader->info.Geom.OutputType = shader->info.Geom.OutputType;
1965 if (shader->info.Geom.VerticesOut != -1) {
1968 shader->info.Geom.VerticesOut) {
1969 linker_error(prog, "geometry shader defined with conflicting "
1972 shader->info.Geom.VerticesOut);
1975 linked_shader->info.Geom.VerticesOut = shader->info.Geom.VerticesOut;
1978 if (shader->info.Geom.Invocations != 0) {
1981 shader->info.Geom.Invocations) {
1982 linker_error(prog, "geometry shader defined with conflicting "
1985 shader->info.Geom.Invocations);
1988 linked_shader->info.Geom.Invocations = shader->info.Geom.Invocations;
1993 * since we already know we're in the right type of shader program
1998 "geometry shader didn't declare primitive input type\n");
2004 "geometry shader didn't declare primitive output type\n");
2010 "geometry shader didn't declare max_vertices\n");
2020 * Perform cross-validation of compute shader local_size_{x,y,z} layout
2022 * linked CS and linked shader program.
2035 /* This function is called for all shader stages, but it only has an effect
2052 struct gl_shader *shader = shader_list[sh];
2054 if (shader->info.Comp.LocalSize[0] != 0) {
2058 shader->info.Comp.LocalSize[i]) {
2059 linker_error(prog, "compute shader defined with conflicting "
2067 shader->info.Comp.LocalSize[i];
2069 } else if (shader->info.Comp.LocalSizeVariable) {
2073 * If one compute shader attached to a program declares a
2074 * variable local group size and a second compute shader
2078 linker_error(prog, "compute shader defined with both fixed and "
2087 * since we already know we're in the right type of shader program
2092 linker_error(prog, "compute shader must contain a fixed or a variable "
2105 * Combine a group of shaders for a single stage to generate a linked shader
2108 * If this function is supplied a single shader, it is cloned, and the new
2109 * shader is returned.
2157 /* If the other shader has no function (and therefore no function
2158 * signatures) with the same name, skip to the next shader.
2180 /* Find the shader that defines main, and make a clone of it.
2183 * found, find the shader that defines it. Clone the reference and add
2184 * it to the shader. Repeat until there are no undefined references or
2199 linker_error(prog, "%s shader lacks `main'\n",
2207 /* Create program and attach it to the linked shader */
2236 /* The pointer to the main function in the final linked shader (i.e., the
2237 * copy of the original shader that contained the main function).
2281 /* Copy ubo blocks to linked shader list */
2290 /* Copy ssbo blocks to linked shader list */
2304 /* Set the size of geometry shader input arrays */
2331 * Update the sizes of linked shader uniform arrays to the maximum
2435 /* If no control shader is present, then the TES inputs are statically
2515 * \param prog Shader program whose variables need locations assigned
2523 * error is emitted to the shader link log and false is returned.
2554 * 1. Invalidate the location assignments for all vertex shader inputs.
2660 /* From GL4.5 core spec, section 15.2 (Shader Execution):
2682 * assigned in the shader (presumably via a layout qualifier), make sure
2707 * path through the shader consumes more than one attribute of
2710 * through the shader consumes multiple aliased attributes,
2716 * "A program will fail to link if any two non-vertex shader
2724 * if they detect that every path through the vertex shader
2726 * location. For all shader types, a program will fail to link
2740 * the shader consumes more than one attribute of a set of
2743 * shader consumes multiple aliased attributes, but implemen-
2752 * through the vertex shader executable accesses multiple inputs
2762 ? "vertex shader input" : "fragment shader output";
2783 * "Additionally, for fragment shader outputs, if two
2873 "vertex shader inputs" : "fragment shader outputs",
2924 ? "vertex shader input" : "fragment shader output";
2973 /* Find all shader outputs in the "producer" stage.
3023 * gl_FragDepth is not used in the shader, it's removed from the IR.
3078 linker_error(prog, "Too many %s shader texture samplers\n",
3085 linker_warning(prog, "Too many %s shader default uniform block "
3091 linker_error(prog, "Too many %s shader default uniform block "
3100 linker_warning(prog, "Too many %s shader uniform components, "
3105 linker_error(prog, "Too many %s shader uniform components\n",
3124 linker_error(prog, "Too many %s shader storage blocks (%d/%d)\n",
3136 linker_error(prog, "Too many combined shader storage blocks (%d/%d)\n",
3154 linker_error(prog, "Shader storage block %s too big (%d/%d)\n",
3207 linker_error(prog, "Too many %s shader subroutine uniforms\n",
3213 * Validate shader image resources.
3230 linker_error(prog, "Too many %s shader image uniforms (%u > %u)\n",
3254 linker_error(prog, "Too many combined image uniforms, shader storage "
3364 * in the same shader stage, otherwise a compiler or linker error
3507 * "For an active shader storage block member declared as an array, an
3518 /* The shader storage block member is a struct, then generate the entry */
3522 /* Shader storage block member is an array, only generate an entry for the
3616 /* Shader symbol table may contain variables that have
3704 * qualifier, except for vertex shader inputs and fragment shader
3844 * from the shader source."
3996 * the number of active array elements of the top-level shader storage
4034 /* If the given variable is already a top-level shader storage
4037 * shader storage block or not instanced.
4056 /* Check if its top-level shader storage block member of an
4074 * the number of active array elements of the top-level shader storage
4102 * shader storage block member containing the active variable is
4225 /* Empty shader, no resources. */
4322 /* Add program shader storage blocks. */
4347 /* add shader subroutines */
4387 /* Search for array derefs in shader. */
4444 * "Each subroutine with an index qualifier in the shader must be
4452 "shader must be unique\n");
4489 * When separate shader programs are enabled, only input/outputs between
4491 * from the shader interface. Other inputs/outputs must remain active.
4520 /* For a single shader program only allow inputs to the vertex shader
4521 * and outputs from the fragment shader to be removed.
4528 /* For multi-stage separate shader programs only allow inputs and
4529 * outputs between the shader stages to be removed as well as inputs
4530 * to the vertex shader and outputs from the fragment shader.
4551 /* Mark all generic shader inputs and outputs as unpaired. */
4580 * "If the shader used to record output variables for transform feedback
4587 /* Find last stage before fragment shader */
4620 * shader;
4624 "no vertex, tessellation, or geometry shader is "
4636 /* If there is no fragment shader we need to set transform feedback.
4687 * ensures that inter-shader outputs written to in an earlier stage
4782 * - No shader objects are attached to program."
4785 * Compatibility Profile missing shader stages are replaced by
4833 /* In desktop GLSL, different shader versions may be linked together. In
4834 * GLSL ES, all shader versions must be the same.
4850 linker_error(prog, "Geometry shader must be linked with "
4851 "vertex shader\n");
4856 linker_error(prog, "Tessellation evaluation shader must be linked "
4857 "with vertex shader\n");
4862 linker_error(prog, "Tessellation control shader must be linked with "
4863 "vertex shader\n");
4868 * eval shader, but that can only be used with transform feedback and
4873 * a tess control shader was dropped, because some hw vendors couldn't
4874 * support tessellation without a tess eval shader, but the linker
4880 * Do what's reasonable and always require a tess eval shader if a tess
4881 * control shader is present.
4885 linker_error(prog, "Tessellation control shader must be linked with "
4886 "tessellation evaluation shader\n");
4895 "type of shader\n");
5006 /* Cross-validate uniform blocks between shader stages */
5096 /* OpenGL ES < 3.1 requires that a vertex shader and a fragment shader both
5098 * anything about shader linking when one of the shaders (vertex or
5099 * fragment shader) is absent. So, the extension shouldn't change the
5109 * * program contains objects to form either a vertex shader or
5110 * fragment shader, and program is not separable, and does not
5111 * contain objects to form both a vertex shader and fragment
5112 * shader."
5115 * when we have a compute shader. For example:
5118 * - Geom or Tess without a Vertex shader is a link error which means we
5119 * always require a Vertex shader and hence a Fragment shader.
5120 * - Finally a Compute shader linked with any other stage is a link error.
5125 linker_error(prog, "program lacks a vertex shader\n");
5127 linker_error(prog, "program lacks a fragment shader\n");