Vertex Rendering/Rendering Failure: Difference between revisions
Jump to navigation
Jump to search
You can render with persistent-mapped buffers. |
0x5fmanpat (talk | contribs) Fix typo - GL_PATCHS |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
The {{enum|GL_INVALID_OPERATION}} error can happen when issuing any | The {{enum|GL_INVALID_OPERATION}} error can happen when issuing any drawing command for many reasons, most of which have little to do with the actual drawing command itself. The following represent conditions you must ensure are valid when issuing a drawing command. | ||
* A non-zero [[Vertex Array Object]] must be bound (though no arrays have to be enabled, so it can be a freshly-created vertex array object). | * A non-zero [[Vertex Array Object]] must be bound (though no arrays have to be enabled, so it can be a freshly-created vertex array object). | ||
Line 5: | Line 5: | ||
* The current program object or program pipeline object must be successfully linked and valid for the current state. This includes: | * The current program object or program pipeline object must be successfully linked and valid for the current state. This includes: | ||
** If there is an active [[Tessellation Evaluation Shader]] or [[Geometry Shader]], then there must also be an active [[Vertex Shader]] present. | ** If there is an active [[Tessellation Evaluation Shader]] or [[Geometry Shader]], then there must also be an active [[Vertex Shader]] present. | ||
** Any active programs cannot have two or more [[Sampler | ** Any active programs cannot have two or more [[Sampler Type|sampler variables of different types]] which are associated with the same texture image unit. | ||
** Any active programs cannot have two or more [[Image Load Store#Image types|image variables of different types]] which are associated with the same image unit. | ** Any active programs cannot have two or more [[Image Load Store#Image types|image variables of different types]] which are associated with the same image unit. | ||
* Program pipeline objects have additional rules. In the case of a unified program, these would all be linker errors, but program pipelines have to check at render-time: | * Program pipeline objects have additional rules. In the case of a unified program, these would all be linker errors, but program pipelines have to check at render-time: | ||
** Programs from one program object cannot come between two shader stages that are defined by different program object. So if you have program A which has a vertex and fragment shader, you cannot put program B into the pipeline with a geometry shader between them. | ** Programs from one program object cannot come between two shader stages that are defined by different program object. So if you have program A which has a vertex and fragment shader, you cannot put program B into the pipeline with a geometry shader between them. | ||
** The number of active [[Sampler (GLSL)|samplers]], [[Image Load Store|images]], [[Uniform Buffer Object|uniform buffers]], and [[Shader Storage Buffer Object|shader storage buffers]] (where applicable) across all images must not [[Shader | ** The number of active [[Sampler (GLSL)|samplers]], [[Image Load Store|images]], [[Uniform Buffer Object|uniform buffers]], and [[Shader Storage Buffer Object|shader storage buffers]] (where applicable) across all images must not [[Shader Resource Limit|exceed the combined implementation-defined limits]]. This is statically checked by the linker for non-separate programs, but must be render-time checked with program pipelines. | ||
** If a [[Geometry Shader]] and a [[Tessellation Evaluation Shader]] are present and not linked into the same program, the [[ | ** If a [[Geometry Shader]] and a [[Tessellation Evaluation Shader]] are present and not linked into the same program, the [[Geometry Shader Primitive Specification|GS's input primitive type]] must match the primitive generated by the [[TES Patch Type|TES's patch output type]]. | ||
** If a [[Tessellation Control Shader]] is active, a [[Tessellation Evaluation Shader]] must also be active. | ** If a [[Tessellation Control Shader]] is active, a [[Tessellation Evaluation Shader]] must also be active. | ||
* Textures used by the current programs' samplers and/or images must be complete. | * Textures used by the current programs' samplers and/or images must be complete. | ||
* If a [[Geometry Shader]] is present, the primitive type fed to the GS must be compatible with the primitive input for the GS. If no TES is active, then the {{param|mode}} primitive type from the | * If a [[Geometry Shader]] is present, the primitive type fed to the GS must be compatible with the primitive input for the GS. If no TES is active, then the {{param|mode}} primitive type from the drawing command must match. | ||
* If [[Transform Feedback]] is active, the transform feedback mode must match the applicable primitive mode. That mode is determined as follows: | * If [[Transform Feedback]] is active, the transform feedback mode must match the applicable primitive mode. That mode is determined as follows: | ||
** If a [[Geometry Shader]] is active, then the applicable primitive mode is the [[ | ** If a [[Geometry Shader]] is active, then the applicable primitive mode is the [[Geometry Shader Primitive Specification|GS's output primitive type]]. | ||
** If no GS is active but a [[Tessellation Evaluation Shader]] is active, then the applicable primitive mode is the TES's output primitive type. | ** If no GS is active but a [[Tessellation Evaluation Shader]] is active, then the applicable primitive mode is the TES's output primitive type. | ||
** Otherwise, the applicable primitive type is the primitive mode provided to the | ** Otherwise, the applicable primitive type is the primitive mode provided to the drawing command. | ||
* {{param|mode}} may be {{enum| | * {{param|mode}} may be {{enum|GL_PATCHES}} if and only if a [[Tessellation Evaluation Shader]] is active. And vice versa. | ||
* Buffer objects being read from or written by an OpenGL rendering call must not be [[Buffer | * Buffer objects being read from or written by an OpenGL rendering call must not be [[Persistent Buffer Mapping|mapped in a non-persistent fashion]]. This includes, but is not limited to: | ||
** A buffer bound for [[Vertex Specification|attribute or index data]]. | ** A buffer bound for [[Vertex Specification|attribute or index data]]. | ||
** A buffer bound for [[Transform Feedback]] when that is active. | ** A buffer bound for [[Transform Feedback]] when that is active. | ||
Line 26: | Line 26: | ||
This list is not comprehensive. If you know of more, please add them here. | This list is not comprehensive. If you know of more, please add them here. | ||
{{note|Rendering without a program or program pipeline does not yield a {{enum|GL_INVALID_OPERATION}} error. It is undefined behavior instead.}} |
Latest revision as of 15:48, 31 July 2024
The GL_INVALID_OPERATION error can happen when issuing any drawing command for many reasons, most of which have little to do with the actual drawing command itself. The following represent conditions you must ensure are valid when issuing a drawing command.
- A non-zero Vertex Array Object must be bound (though no arrays have to be enabled, so it can be a freshly-created vertex array object).
- The current framebuffer must be complete. The Default Framebuffer (if present) is always complete, so this usually happens with Framebuffer Objects.
- The current program object or program pipeline object must be successfully linked and valid for the current state. This includes:
- If there is an active Tessellation Evaluation Shader or Geometry Shader, then there must also be an active Vertex Shader present.
- Any active programs cannot have two or more sampler variables of different types which are associated with the same texture image unit.
- Any active programs cannot have two or more image variables of different types which are associated with the same image unit.
- Program pipeline objects have additional rules. In the case of a unified program, these would all be linker errors, but program pipelines have to check at render-time:
- Programs from one program object cannot come between two shader stages that are defined by different program object. So if you have program A which has a vertex and fragment shader, you cannot put program B into the pipeline with a geometry shader between them.
- The number of active samplers, images, uniform buffers, and shader storage buffers (where applicable) across all images must not exceed the combined implementation-defined limits. This is statically checked by the linker for non-separate programs, but must be render-time checked with program pipelines.
- If a Geometry Shader and a Tessellation Evaluation Shader are present and not linked into the same program, the GS's input primitive type must match the primitive generated by the TES's patch output type.
- If a Tessellation Control Shader is active, a Tessellation Evaluation Shader must also be active.
- Textures used by the current programs' samplers and/or images must be complete.
- If a Geometry Shader is present, the primitive type fed to the GS must be compatible with the primitive input for the GS. If no TES is active, then the mode primitive type from the drawing command must match.
- If Transform Feedback is active, the transform feedback mode must match the applicable primitive mode. That mode is determined as follows:
- If a Geometry Shader is active, then the applicable primitive mode is the GS's output primitive type.
- If no GS is active but a Tessellation Evaluation Shader is active, then the applicable primitive mode is the TES's output primitive type.
- Otherwise, the applicable primitive type is the primitive mode provided to the drawing command.
- mode may be GL_PATCHES if and only if a Tessellation Evaluation Shader is active. And vice versa.
- Buffer objects being read from or written by an OpenGL rendering call must not be mapped in a non-persistent fashion. This includes, but is not limited to:
- A buffer bound for attribute or index data.
- A buffer bound for Transform Feedback when that is active.
- A buffer bound for uniforms, shader storage, or Atomic Counters when any shader reads from (or writes to) that buffer.
- A buffer bound as a texture or Image Load Store image.
This list is not comprehensive. If you know of more, please add them here.
Note: Rendering without a program or program pipeline does not yield a GL_INVALID_OPERATION error. It is undefined behavior instead.