Skip to content

Commit

Permalink
orka: Revert changing origin of viewport to upper left corner
Browse files Browse the repository at this point in the history
Without it, it would almost always require an extra render pass when
rendering using a frame graph to avoid textures being rendered upside
down.
  • Loading branch information
onox committed Apr 1, 2024
1 parent 5452060 commit e3701a4
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 19 deletions.
14 changes: 0 additions & 14 deletions docs/rendering/removed-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,6 @@ Some conventions have changed to Vulkan's:
The range of the depth of the clipping volume has been changed from
the default of [-1, 1] to Vulkan's [0, 1].

- **Origin of window coordinates is upper-left**.
The origin of the window coordinates has been changed to upper-left,
which is the origin used by other rendering APIs and windowing systems.

If a shader uses `:::glsl gl_FragCoord`, then you may need to redefine it:

```glsl
layout(origin_upper_left) in vec4 gl_FragCoord;
```

If the output on the screen is upside down, then render to a texture
instead and read it in some resolve or tonemapping pass that outputs
to the default framebuffer.

## Other removed features

Over the years, OpenGL has accumulated a lot of functionality. Some of which
Expand Down
4 changes: 0 additions & 4 deletions orka/data/shaders/effects/blur.frag
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#extension GL_ARB_shader_storage_buffer_object : require

layout(origin_upper_left) in vec4 gl_FragCoord;

// SPDX-License-Identifier: Apache-2.0
//
// Copyright (c) 2020 onox <[email protected]>
Expand All @@ -20,8 +18,6 @@ layout(origin_upper_left) in vec4 gl_FragCoord;
// See the License for the specific language governing permissions and
// limitations under the License.

layout(origin_upper_left) in vec4 gl_FragCoord;

uniform bool horizontal;

layout(binding = 0) uniform sampler2DRect inputImage;
Expand Down
2 changes: 1 addition & 1 deletion orka/src/egl/orka-contexts-egl.adb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ package body Orka.Contexts.EGL is
Orka.Debug.Set_Log_Messages (Enable => Flags.Debug);

GL.Rasterization.Set_Provoking_Vertex (GL.Rasterization.First_Vertex);
GL.Viewports.Set_Clipping (GL.Viewports.Upper_Left, GL.Viewports.Zero_To_One);
GL.Viewports.Set_Clipping (GL.Viewports.Lower_Left, GL.Viewports.Zero_To_One);

-- Enable reversed Z for better depth precision at great distances
-- See https://developer.nvidia.com/content/depth-precision-visualized
Expand Down

0 comments on commit e3701a4

Please sign in to comment.