You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adjusted framebuffer size and rotation shader variables and functions.
Framebuffer size, both pre and post rotation, and framebuffer rotation are
now available through dsInstanceTransformData and dsViewFramebufferData to
allow them to change based on the bound framebuffer.
dsInstanceTransformData allows it to be accessed for the common case
without additional variables, dsViewFramebufferData maintains one copy of
the values for all instances for a group that is drawn together. Added
separate uniforms for dsShadowInstanceTransformData that omits the
framebuffer elements.
Renamed various transformation functions to be more consistent. Shared
implementations are now provided in CoordinateHelpers.mslh where parameters
may come from different uniforms.
Going from clip to view space no longer adjusts the clip. This avoids
duplicate adjustments, which can also differ based on where the coordinates
came from. (projection matrix or framebuffer position)
Adjusted the internal uniforms for OpenGL to reduce the amount of work
required to adjust the fragment coordinates and have more info available
for adjusting the clips. This now requires two vec4 uniforms, but should
be faster at runtime and provide more flexibility.
Removed DS_ADJUST_TEXTURE_CLIP() macro and removed the dsViewTransformData
variable for the texture transform. Defines are now used for the projection
texture transforms for standard situations for shadow mapping and SSAO.
* Use the `DS_ADJUST_CLIP(x)` macro with the clip position (such as that assigned to gl_Position) to ensure the clip position x is transformed to the correct space.
29
29
* If using a direct clip position without a projection matrix, use `DS_ADJUST_DIRECT_CLIP(x)` instead.
30
-
* If used as a guaranteed texture target, such as a texture projection, use `DS_ADJUST_TEXTURE_CLIP(x)` instead.
31
30
* When support for older hardware with OpenGL 2.x, use the `DS_RG_SWZL` macro for RG-format textures. (e.g. `color.DS_RG_SWZL`) This ensures compatibility with targets that use luminance-alpha textures instead.
32
31
* Subpass inputs may always be used. Defines are provided to fall back to a standard texture lookup on targets that don't support them directly.
33
32
* When declaring subpass inputs, instead of using `layout(input_attachment_index = i) uniform subpassInput input`, declare as `inputAttachment(i) input`.
@@ -75,6 +74,8 @@ Most render states are set by declaring the render state in the shader pipeline.
75
74
The following built-in defines are available when writing shaders:
76
75
77
76
*`DS_MIN_CLIP_Z`: The minimum Z value in clip space. In most cases this is 0.0, but for OpenGL it may be -1.0 or 0.0 depending on whether the `preferHalfDepthRange` renderer option is enabled and the device supports adjusting the clip range.
77
+
*`DS_CLIP_Z_TO_DEPTH_MUL` and `DS_CLIP_Z_TO_DEPTH_ADD`: The multiplication and addition factors to convert from clip z to depth values, applied as `z*DS_CLIP_Z_TO_DEPTH_MUL + DS_CLIP_Z_TO_DEPTH_ADD`.
78
+
*`DS_DEPTH_TO_CLIP_Z_MUL` and `DS_DEPTH_TO_CLIP_Z_ADD`: The multiplication and addition factors to convert from depth values to clip z, applied as `z*DS_DEPTH_TO_CLIP_Z_MUL + DS_DEPTH_TO_CLIP_Z_ADD`.
78
79
*`DS_ADJUST_CLIP(v)`: Call when assigning `gl_Position` at the end of the vertex shader to adjust for the current system's clip space. It's assumed that the position was computed with the projection matrix.
79
80
*`DS_ADJUST_DIRECT_CLIP(v)`: Same as `DS_ADJUST_CLIP`, except for creating the position directly in clip space rather than using the projection matrix.
80
81
*`DS_RG_SWZL`: Swizzle for RG channel textures. This takes into account older versions of OpenGL that use lumanance alpha for two-channel textures, which requires `ra` rather than `rg`.
0 commit comments