Skip to content

Commit ff48b0f

Browse files
committed
fix stuff from kloppi's pr
1 parent 76147d7 commit ff48b0f

File tree

11 files changed

+65
-42
lines changed

11 files changed

+65
-42
lines changed

src/content/docs/current/Reference/Attributes/overview.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Overview: attributes"
3-
description: Attributes are per-vertex data available only in the vertex stage.
3+
description: Attributes are per-vertex data available only in the vertex stage.
44
sidebar:
55
label: Overview
66
order: 1
@@ -22,4 +22,4 @@ The GLSL `compatibility` profile provides several built in attributes. Iris/Opti
2222
| `gl_TextureMatrix[0]` | [`textureMatrix`](/current/reference/uniforms/matrices#texturematrix) | texture uv matrix |
2323
| [`entityColor`](/current/reference/uniforms/rendering#entitycolor) | [`vaUV1`](/current/reference/attributes/vauv1) (not recommended, even in `core`) | entity overlay |
2424
| `gl_MultiTexCoord1` / `gl_MultiTexCoord2` | [`vaUV2`](/current/reference/attributes/vauv2) | lightmap coordinate |
25-
| `gl_TextureMatrix[1]` | [`TEXTURE_MATRIX_2`](/current/reference/attributes/vauv2) (hardcoded matrix) | lightmap coordinate matrix |
25+
| `gl_TextureMatrix[1]` | [`TEXTURE_MATRIX_2`](/current/reference/attributes/vauv2) (hardcoded matrix) | lightmap coordinate matrix |

src/content/docs/current/Reference/Buffers/custom_textures.mdx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ texture.<stage>.<bufferName> = <path>
1717
### Texture types
1818
OptiFine/Iris support four different texture types, which are specified in the `<path>` parameter.
1919

20-
#### Images from shader files
20+
#### Textures from shader pack files
2121
Image files can be loaded from the shader pack files by replacing `<path>` with the file path to the image relative to the `shaders` folder. For example `texture.composite.colortex5 = textures/perlin.png` would load `perlin.png` from the `shaders/textures` folder. Iris supports only `.png` image format, whereas OptiFine supports `.png` and `.jpg` formats.
2222

2323
#### Textures from game files / resource packs
@@ -26,7 +26,7 @@ Textures can also be loaded from the resource pack by replacing `<path>` with `m
2626
#### Atlas and dynamic textures
2727
Atlas textures (such as the block atlas) can be loaded by passing their file path, starting with `minecraft:textures/atlas/`. For example, `texture.composite.colortex9 = minecraft:textures/atlas/blocks.png` loads the block atlas into `colortex9`. A list of available texture atlases can be found in the [Minecraft Wiki](https://minecraft.wiki/w/Texture_atlas#Navigation) under "Procedurally-generated" in the Navigation table.
2828

29-
Additionally, the lightmap dynamic texture can be loaded using either `minecraft:dynamic/lightmap_1` or `minecraft:dynamic/light_map_1`. This texture is equivalent to the `lightmap` sampler used in [gbuffers](/current/reference/programs/gbuffers). For example `texture.prepare.colortex2 = minecraft:dynamic/lightmap_1` loads the lightmap into `colortex2`.
29+
Additionally, the lightmap dynamic texture can be loaded using either `minecraft:dynamic/lightmap_1` or `minecraft:dynamic/light_map_1`. This texture is equivalent to the `lightmap` sampler used in [gbuffers](/current/reference/programs/gbuffers). For example `texture.prepare.colortex2 = minecraft:dynamic/lightmap_1` loads the lightmap into `colortex2`.
3030

3131
#### Raw textures
3232
Raw textures can be loaded from the shader files, similarly to image files. However raw textures are uncompressed binary files, where the bytes represent the values in the texture directly. Raw files can also encode 3D textures, and the texture format can be directly controlled (images are always loaded as RGBA8). To use a raw texture, add the following parameters to the custom texture directive:
@@ -62,6 +62,10 @@ When using the OptiFine specification, replace `<stage>` with the stage of progr
6262
| `deferred` | [`deferred`](/current/reference/programs/deferred) programs |
6363
| `composite` | [`composite`](/current/reference/programs/composite) and [`final`](/current/reference/programs/final) programs |
6464

65+
:::caution[Warning]
66+
On Iris, binding a custom texture to the `composite` stage will also bind it in the `final` program. OptiFine does not do this, and as such in OptiFine there is no way to bind a custom texture to the `final` program.
67+
:::
68+
6569

6670
## `customTexture` directive <Badge text="Iris Exclusive" variant="tip" size="medium" />
6771
Iris adds support for the `customTexture` directive, which allows a custom texture to be accessed via a different sampler instead of overriding an existing sampler. This allows creation of a sampler of (mostly) any name, which replaces `<name>` in the directive and is used in the shader code. Otherwise, the syntax of the enhanced custom textures are identical to standard custom textures.
@@ -99,4 +103,4 @@ Hardware bilinear filtering and wrapping/clamping behavior can be controlled wit
99103

100104
By default, image files will use nearest neighbor and wrapping, and raw textures will use bilinear filtering and clamping. Shader provided mcmeta files cannot be used for resource pack / atlas textures.
101105

102-
<img src="/cucumber.png" width="1" height="1" />
106+
<img src="/cucumber.png" width="1" height="1" />

src/content/docs/current/Reference/Buffers/depthtex.mdx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,7 @@ These buffers can be read from any program, but will contain garbage data until
1919

2020
#### Writing
2121

22-
These buffers are automatically written to by [`gbuffers`](/current/reference/programs/gbuffers) programs, and store the screenspace z coordinate at each pixel. You can manually write to this buffer by setting the `gl_FragDepth` variable in any `gbuffers` fragment shader. If `gl_FragDepth` is used in a shader, the automatic writing will be disabled and the shader is responsible for writing all depth values.
23-
24-
#### Size
25-
26-
These buffers are the same resolution as the Minecraft window. This cannot be configured.
27-
28-
#### Format / precision
29-
30-
These buffers only store information in a single channel, the `r` component. The depth buffer precision is hardware / driver dependent. However, most hardware uses either 24-bit or 32-bit (`R24` or `R32`) precision.
22+
These buffers are automatically written to by [`gbuffers`](/current/reference/programs/gbuffers) programs, and store the screenspace z coordinate at each pixel. You can manually write to this buffer by setting the `gl_FragDepth` variable in the fragment shader. If `gl_FragDepth` is used, it must have a value assigned for all execution paths. For more information see [the OpenGL Docs](https://registry.khronos.org/OpenGL-Refpages/gl4/html/gl_FragDepth.xhtml).
3123

3224
:::tip
3325
The default (automatic) behavior of writing to the depth buffer is as follows:
@@ -36,6 +28,14 @@ gl_FragDepth = gl_FragCoord.z;
3628
```
3729
:::
3830

31+
#### Size
32+
33+
These buffers are the same resolution as the Minecraft window. This cannot be configured.
34+
35+
#### Format / precision
36+
37+
These buffers only store information in a single channel, the `r` component. The depth buffer precision is hardware / driver dependent. However, most hardware uses either 24-bit or 32-bit (`R24` or `R32`) precision.
38+
3939
#### Clearing
4040

4141
All these buffers clear to `vec4(1.0)`. This cannot be configured.
Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
---
22
title: "Overview: buffers"
3-
description: Buffers are
3+
description: Buffers are
44
sidebar:
55
label: Overview
66
order: 1
77
---
88

9-
**Buffers** are dedicated memory used to temporarily store color data, depth information, and other rendering details. They are most commonly used in shader programming to hold **textures**, but can also be used for [shader storage buffer objects](/current/reference/buffers/ssbo). Buffers are accessed through sampling a `sampler2D` uniform.
9+
**Buffers** are dedicated areas of memory used to temporarily store color data, depth information, or any other information used for rendering. The following are buffers Iris/OptiFine make available by default, some of which can be written to and read from, and some of which can only be read from.
1010

11-
| Sampler | [Format](/current/reference/buffers/image) | Size |
11+
| Sampler | [Format](/current/reference/buffers/image) | Size |
1212
| ------------------------------------------------------ | -------------- | ----------------------- |
13-
| [`colortexN`](/current/reference/buffers/colortex) | `RGBA`* | display resolution* |
14-
| [`depthtexN`](/current/reference/buffers/colortex) | `R24` / `R32`| display resolution |
15-
| [`noisetex`](/current/reference/buffers/colortex) | `RGB8`* | 256 x 256* |
16-
| [`shadowColorN`](/current/reference/buffers/colortex) | `RGBA`* | shadow map resolution* |
13+
| [`colortexN`](/current/reference/buffers/colortex) | `RGBA`* | Display Resolution* |
14+
| [`depthtexN`](/current/reference/buffers/colortex) | `R24` / `R32`| Display Resolution |
15+
| [`noisetex`](/current/reference/buffers/colortex) | `RGB8`* | 256 x 256 |
16+
| [`shadowtexN`](/current/reference/buffers/shadowtex) | `R24` / `R32`| Shadow Map Resolution* |
17+
| [`shadowColorN`](/current/reference/buffers/colortex) | `RGBA`* | Shadow Map Resolution* |
1718

18-
<sup>*Configurable in [shaders.properties](current/reference/shadersproperties/overview)</sup><br/>
19+
<sup>*Configurable</sup><br/>
20+
<sup>†Dependent on drivers</sup>
1921

20-
<sup>†Dependent on drivers</sup>
22+
Also provided are three [texture atlases](/reference/Buffers/atlases.mdx). These have the format `RGBA8` and their resolution can be determined with [`atlasSize`](https://shaders.properties/current/reference/uniforms/rendering/#atlassize).
23+
24+
On Iris, additional buffers can be created through through the use of [custom textures](/reference/buffers/custom_textures/), [custom images](/reference/buffers/custom_images/), and [SSBOs](/reference/buffers/ssbo/)

src/content/docs/current/Reference/Buffers/shadowtex.mdx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,17 @@ There are two samplers for accessing the shadow depth buffer.
1616

1717
#### Writing
1818

19-
These buffers are automatically written to by the [`shadow`](/current/reference/programs/gbuffers) program, and store the screenspace z coordinate at each pixel. You can manually write to this buffer by setting the `gl_FragDepth` variable in any `gbuffers` fragment shader. If `gl_FragDepth` is used in a shader, the automatic writing will be disabled and the shader is responsible for writing all depth values.
19+
These buffers are automatically written to by the [`shadow`](/current/reference/programs/shadow) and [`shadow_*`](/current/reference/programs/shadow/#additional-shadow-programs-iris-18) programs, and store the screenspace z coordinate at each pixel. You can manually write to this buffer by setting the `gl_FragDepth` variable in the fragment shader. If `gl_FragDepth` is used, it must have a value assigned for all execution paths. For more information see [the OpenGL Docs](https://registry.khronos.org/OpenGL-Refpages/gl4/html/gl_FragDepth.xhtml).
2020

21-
#### Size
21+
:::tip
22+
The default (automatic) behavior of writing to the depth buffer is as follows:
23+
```glsl
24+
gl_FragDepth = gl_FragCoord.z;
25+
```
26+
:::
2227

23-
These buffers are the same resolution as the Minecraft window. This cannot be configured.
28+
#### Size
29+
These buffers default to the shadow pass resolution, which can be controlled with the [`shadowMapResolution`](/current/reference/constants/shadowmapresolution) constant.
2430

2531
#### Format / precision
2632

@@ -38,6 +44,6 @@ These buffers do not flip.
3844
The alias `waterShadow` points to the same buffer as `shadowtex0`. If `waterShadow` is present anywhere in the code, then the alias `shadow` will point to the same buffer as `shadowtex1`, otherwise it will point to the buffer `shadowtex0`.
3945

4046
## Hardware Sampling
41-
[`shadowHardwareFiltering`](/current/reference/constants/shadowhardwarefiltering) enables support hardware sampling (depth comparison mode) for hardware shadow filtering. This turns the shadowtex samplers into `sampler2DShadow` samplers, which when sampled take the full `xyz` coordinates of the shadow position. The passed `z` coordinate is then compared to the values in the buffer around the `xy` coordinate, and the result is the weighted average of these comparisons. This produces a filtering effect on the shadow with very little to no performance impact. More information can be found in the [Khronos Wiki](https://www.khronos.org/opengl/wiki/Sampler_Object#Comparison_mode).
47+
[`shadowHardwareFiltering`](/current/reference/constants/shadowhardwarefiltering) enables hardware filtering (depth comparison mode). This turns the shadowtex samplers into `sampler2DShadow` samplers, which when sampled take the full `xyz` coordinates of the shadow position. The passed `z` coordinate is then compared to the values in the buffer around the `xy` coordinate, and the result is the weighted average of these comparisons. This produces a filtering effect on the shadow with very little to no performance impact. More information can be found in the [Khronos Wiki](https://www.khronos.org/opengl/wiki/Sampler_Object#Comparison_mode).
4248

43-
When hardware sampling is used, the texture read no longer returns the distance stored in the buffer, but the result of a filtering depth comparison. This prevents its use in algorithms such as PCSS that rely on the actual value stored in the buffer. However, Iris enables the use of separate buffers for hardware sampling, `shadowtex0HW` and `shadowtex1HW`, while retaining the original functionality on the base shadowtex buffers. This requires the [`SEPARATE_HARDWARE_SAMPLERS`](/current/reference/shadersproperties/flags) feature flag as well as setting [`shadowHardwareFiltering`](/current/reference/constants/shadowhardwarefiltering) to true.
49+
When hardware sampling is used, the texture read no longer returns the distance stored in the buffer, but the result of a filtering depth comparison. This prevents its use in algorithms such as PCSS that rely on the actual value stored in the buffer. However, Iris enables the use of separate buffers for hardware sampling, `shadowtex0HW` and `shadowtex1HW`, while retaining the original functionality on the base shadowtex buffers. This requires the [`SEPARATE_HARDWARE_SAMPLERS`](/current/reference/shadersproperties/flags) feature flag as well as setting [`shadowHardwareFiltering`](/current/reference/constants/shadowhardwarefiltering) to true.

src/content/docs/current/Reference/Constants/shadow_mipmaps.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ sidebar:
1717

1818
---
1919

20-
These directives tells Iris to generate a mipmap chain for a [shadowtex](/current/reference/buffers/shadowtex) buffer. This directive only needs to be defined once in the shader pack, and can be defined in (mostly) any shader file. The mipmap will be generated after the [`shadow`](/current/reference/programs/shadow) pass but before [`shadowcomp`](/current/reference/programs/shadow_comp).
20+
These directives tell Iris to generate a mipmap chain for a given [shadowtex](/current/reference/buffers/shadowtex) buffer. Each one only needs to be defined once in the shader pack, and can be defined in (mostly) any shader file. The mipmap will be generated after the [`shadow`](/current/reference/programs/shadow) pass but before [`shadowcomp`](/current/reference/programs/shadow_comp).
2121

22-
`generateShadowMipmap` will generate mipmaps for both `shadowtex0` and `shadowtex1`, whereas `shadowtexMipmap` will generate mipmaps for only `shadowtex0`.
22+
`generateShadowMipmap` will generate mipmaps for both `shadowtex0` and `shadowtex1`.
2323

2424

2525
## ShadowColor
@@ -38,6 +38,6 @@ These directives tells Iris to generate a mipmap chain for a [shadowtex](/curren
3838
These directives are currently bugged. Mipmap chains for shadowcolor buffers will *not* be generated. Mipmaps for shadowtex buffers work as intended.
3939
:::
4040

41-
These directives tells Iris to generate a mipmap chain for a [shadowcolor](/current/reference/buffers/shadowcolor) buffer. This directive only needs to be defined once in the shader pack, and can be defined in (mostly) any shader file. The mipmap will be generated after the [`shadow`](/current/reference/programs/shadow) pass but before [`shadowcomp`](/current/reference/programs/shadow_comp).
41+
These directives tell Iris to generate a mipmap chain for a [shadowcolor](/current/reference/buffers/shadowcolor) buffer. This directive only needs to be defined once in the shader pack, and can be defined in (mostly) any shader file. The mipmap will be generated after the [`shadow`](/current/reference/programs/shadow) pass but before [`shadowcomp`](/current/reference/programs/shadow_comp).
4242

43-
`generateShadowColorMipmap` will generate mipmaps for both `shadowcolor0` and `shadowcolor1`.
43+
`generateShadowColorMipmap` will generate mipmaps for both `shadowcolor0` and `shadowcolor1`.
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
---
22
title: "Overview: macros"
3-
description: Buffers are
3+
description: Compile time constants providing information about the environment.
44
sidebar:
55
label: Overview
66
order: 1
77
---
88

9-
Macros are a way of getting data, typically metadata about Iris itself, Minecraft, or hardware. Macros have two distinct categories:
10-
1. **Value** macros: Iris will set the value of a macro to some data.
11-
2. **Boolean** macros: Iris will define a macro if its criteria is met. This can be tested using the `ifdef` and `ifndef` directives.
9+
Macros are compile time constants that provide information about the environment Iris/OptiFine is running in. For more information, see the [OpenGL Docs on Preprocessor directives](https://www.khronos.org/opengl/wiki/Core_Language_(GLSL)#Preprocessor_directives).

src/content/docs/current/Reference/Miscellaneous/debug_mode.mdx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,13 @@ Iris provides a debug mode with several features to facilitate development of sh
1111
1. In the in-game Shader Selection screen (`Options > Video Settings > Shader Packs`, default keybind <kbd>O</kbd>) press <kbd>Ctrl + D</kbd> (Windows / Linux) or <kbd>Cmd + D</kbd> (macOS)
1212
2. Set the `enableDebugOptions` field to `true` in Iris's settings file (`/config/iris.properties`)
1313

14+
:::caution[Warning]
15+
On some GPU drivers, such as the AMD driver on Windows, enabling debug mode can cause the game to crash on startup. This can be resolved by setting `use_no_error_g_l_context` to `false` in `.minecraft/config/sodium-options.json` or by disabling the no error context in the game's settings (if you have the power of foresight).
16+
:::
17+
1418
Debug mode's features are as follows:
1519

16-
- **Pretty printing**: code generated by the [Iris patcher](/current/reference/miscellaneous/patcher) is saved to `/patched_shaders/`
17-
- **Error window**: when an error in a shader is encountered, the error is presented to a pop-up window in-game
18-
- **Parity**: patched shader code more accurately represents the source code. As of right now, this only prevents the patcher from deleting unused functions
20+
- **Patched code output**: code generated by the [Iris patcher](/current/reference/miscellaneous/patcher) is saved to `/patched_shaders/`. This is useful because
21+
- The line numbers Iris provides in error messages correspond to this patched code, not your original code.
22+
- The patcher can occasionally make mistakes, especially if your code is malformed in some way. Being able to see the output it produces is crucial in resolving these issues.
23+
- **Error window**: If the shader fails to compile, the error message will be displayed directly on the screen, instead of only being printed to the log.

0 commit comments

Comments
 (0)