Skip to content

Commit a5f2251

Browse files
committed
Progress on 1.21.2 port
1 parent 7da1402 commit a5f2251

23 files changed

+164
-523
lines changed

1_21_2_model.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Minecraft Shader Loading
1+
# Minecraft's new Shader system
2+
3+
## Shader Loading
24

35
`ShaderLoader` loads every file in the `shaders` directory
46
ending in `.json`, `.fsh`, `.vsh`, or `.glsl`
@@ -85,3 +87,23 @@ classDiagram
8587
TextureSampler : +int width
8688
TextureSampler : +int height
8789
```
90+
91+
## Post-process effect rendering
92+
93+
Post effect rendering is now divided into two steps:
94+
1. building a reusable frame graph
95+
2. rendering the frame graph
96+
97+
### Building the frame graph
98+
99+
```mermaid
100+
---
101+
title: Frame Graph structure
102+
---
103+
classDiagram
104+
Node <|-- ObjectNode
105+
Node <|-- ResourceNode
106+
ResourceNode "1" --* "*" FrameGraphBuilder
107+
ObjectNode "1" --* "*" FrameGraphBuilder
108+
FramePass "1" --* "*" FrameGraphBuilder
109+
```

src/main/java/org/ladysnake/satin/api/managed/ManagedFramebuffer.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ public interface ManagedFramebuffer {
6161
*/
6262
void clear();
6363

64-
void clear(boolean swallowErrors);
65-
6664
/**
6765
* Gets a simple {@link RenderLayer} that is functionally identical to {@code baseLayer},
6866
* but with a different {@link RenderPhase.Target} that binds this framebuffer.

src/main/java/org/ladysnake/satin/api/managed/ManagedShaderEffect.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -140,23 +140,6 @@ public interface ManagedShaderEffect extends UniformFinder {
140140
@API(status = EXPERIMENTAL, since = "1.4.0")
141141
ManagedFramebuffer getTarget(String name);
142142

143-
/**
144-
* Forwards to {@link #setupDynamicUniforms(int, Runnable)} with an index of 0
145-
*
146-
* @param dynamicSetBlock a block in which dynamic uniforms are set
147-
*/
148-
@API(status = EXPERIMENTAL, since = "1.0.0")
149-
void setupDynamicUniforms(Runnable dynamicSetBlock);
150-
151-
/**
152-
* Runs the given block while the shader at the given index is active
153-
*
154-
* @param index the shader index within the group
155-
* @param dynamicSetBlock a block in which dynamic name uniforms are set
156-
*/
157-
@API(status = EXPERIMENTAL, since = "1.0.0")
158-
void setupDynamicUniforms(int index, Runnable dynamicSetBlock);
159-
160143
/**
161144
* Sets the value of a uniform declared in json
162145
*

src/main/java/org/ladysnake/satin/api/managed/uniform/SamplerUniform.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,6 @@
2626
@API(status = MAINTAINED)
2727
public interface SamplerUniform {
2828

29-
/**
30-
* Sets the value of a sampler uniform declared in json using the Opengl texture slot id (between 0 and 30).
31-
* @param activeTexture the active texture id to be used by the sampler
32-
* @see org.lwjgl.opengl.GL13#GL_TEXTURE0
33-
*/
34-
@API(status = MAINTAINED, since = "1.4.0")
35-
void setDirect(int activeTexture);
36-
3729
/**
3830
* Sets the value of a sampler uniform declared in json
3931
*

src/main/java/org/ladysnake/satin/api/util/ShaderPrograms.java

Lines changed: 0 additions & 239 deletions
This file was deleted.

src/main/java/org/ladysnake/satin/impl/CustomFormatFramebuffers.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ public class CustomFormatFramebuffers {
3737
* <p>Refer to {@link SimpleFramebuffer} for the list of parameters
3838
*/
3939
@API(status = API.Status.EXPERIMENTAL)
40-
public static Framebuffer create(int width, int height, boolean useDepth, boolean getError, TextureFormat format) {
40+
public static Framebuffer create(int width, int height, boolean useDepth, TextureFormat format) {
4141
try {
4242
FORMAT.set(format);
43-
return new SimpleFramebuffer(width, height, useDepth, getError);
43+
return new SimpleFramebuffer(width, height, useDepth);
4444
} finally {
4545
FORMAT.remove();
4646
}

src/main/java/org/ladysnake/satin/impl/FramebufferWrapper.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import net.minecraft.client.util.Window;
2525
import org.ladysnake.satin.Satin;
2626
import org.ladysnake.satin.api.managed.ManagedFramebuffer;
27+
import org.ladysnake.satin.mixin.client.AccessiblePassesShaderEffect;
2728

2829
import javax.annotation.Nullable;
2930

@@ -46,9 +47,10 @@ void findTarget(@Nullable PostEffectProcessor shaderEffect) {
4647
if (shaderEffect == null) {
4748
this.wrapped = null;
4849
} else {
49-
this.wrapped = shaderEffect.getSecondaryTarget(this.name);
50+
// FIXME create the target instead and add it to a FramebufferSet
51+
this.wrapped = null; ((AccessiblePassesShaderEffect) shaderEffect).getInternalTargets().get(this.name);
5052
if (this.wrapped == null) {
51-
Satin.LOGGER.warn("No target framebuffer found with name {} in shader {}", this.name, shaderEffect.getName());
53+
Satin.LOGGER.warn("No target framebuffer found with name {} in shader", this.name);
5254
}
5355
}
5456
}
@@ -86,19 +88,14 @@ public void draw() {
8688
@Override
8789
public void draw(int width, int height, boolean disableBlend) {
8890
if (this.wrapped != null) {
89-
this.wrapped.draw(width, height, disableBlend);
91+
this.wrapped.draw(width, height);
9092
}
9193
}
9294

9395
@Override
9496
public void clear() {
95-
clear(MinecraftClient.IS_SYSTEM_MAC);
96-
}
97-
98-
@Override
99-
public void clear(boolean swallowErrors) {
10097
if (this.wrapped != null) {
101-
this.wrapped.clear(swallowErrors);
98+
this.wrapped.clear();
10299
}
103100
}
104101

0 commit comments

Comments
 (0)