Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
36 changes: 36 additions & 0 deletions common/attic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# attic

Code parked here is **excluded from compilation**.

- `particle/`, `ParticleRenderer.kt` — the GPU particle system, retired during the 26.2
migration. It was built directly on OpenGL (VAO/VBO double buffering, transform feedback)
and has no equivalent in the 26.2 `GpuDevice` wrapper API. Call sites in
`ScreenEffectRenderer`, `FinderArrowEntityRenderer` and `ClientboundExplosionPayload`
are commented out and marked with `GPU particle system retired (see common/attic)`.

- `client/shader/{Program,Shader,ResourceShader,ShaderCompiler,ShaderCompilerV1,
ShaderStageStore,ShaderSourceDescriptor,ShaderExecutable,ShaderStage,Uniform,
UniformLocation,UniformWriter,FloatUniform,Vector2fUniform,Vector3fUniform,
Vector4fUniform,IntUniform,Matrix4fUniform,MonolithicProgramUniformWriter,
SeparableProgramUniformWriter,UniformBufferProvider}.kt`, `client/shader/component/`,
`client/shader/cache/` — the pre-26.2 mesh-shader compilation/linking/uniform-writer
infrastructure (raw `glCreateProgram`/`glAttachShader`/`glUniform*`, per-pointer
`UniformProvider(name) { pointer -> ... }`). Superseded by
`heckerpowered.matrix.client.shader.BlitProgram` + the new std140-block
`UniformProvider`/`TextureProvider` (see `BlitProgram.kt`/`UniformProvider.kt`), which
compiles GLSL through the vanilla `ShaderManager` and has no concept of a globally bound
program. There is no wrapper-API equivalent for "bind this program globally, then let
unrelated immediate-mode/vertex-attribute mesh code draw against it" — callers that relied
on that (`DissolveShader.enableShader/disableShader`, `PositionColorProgram`,
`MagicList.kt`, `ManaBar.kt`, `MatrixHud.kt`) either dropped the mesh-shader path or are
pending rework by whoever owns those files.

- `client/render/{OpenGLExtensions,FramebufferCapture,AdvancedFramebuffer,
GpuPerformanceCounter}.kt`, `client/render/state/` (whole dir, including
`state/capabilities/`) — raw-GL debugging/state-capture/state-isolation helpers
(`glGetError`, GL capability snapshot+restore, `StateIsolation.isolate { }` wrappers).
On the 26.2 wrapper API blend/depth state is baked into `RenderPipeline`s per draw call
and render passes are self-contained, so there is nothing left to snapshot/restore around
a draw; callers that wrapped draws in `StateIsolation.isolate(...)` had the wrapper
removed and the blend/depth args translated into `BlitProgram.drawTo`'s `blend` parameter
where applicable.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

package heckerpowered.matrix.client.render

import com.mojang.blaze3d.platform.GlConst
import com.mojang.blaze3d.platform.GlStateManager
import com.mojang.blaze3d.opengl.GlConst
import com.mojang.blaze3d.opengl.GlStateManager

object FramebufferCapture {
private var previousFramebuffer: Int = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package heckerpowered.matrix.client.render.state

import net.minecraft.client.gl.Framebuffer
import com.mojang.blaze3d.pipeline.RenderTarget
import org.lwjgl.opengl.GL11.glGetInteger
import org.lwjgl.opengl.GL30.*

Expand All @@ -18,7 +18,7 @@ class FramebufferState(val framebuffer: Int) : RenderPipelineState {
}
}

constructor(framebuffer: Framebuffer) : this(framebuffer.fbo)
constructor(framebuffer: RenderTarget) : this(framebuffer.fbo)

override fun apply(): RenderPipelineSnapshot {
val snapshot = captureSnapshot()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package heckerpowered.matrix.client.render.state

import net.minecraft.client.gl.Framebuffer
import com.mojang.blaze3d.pipeline.RenderTarget
import org.lwjgl.opengl.GL46

class ViewportState(val viewportX: Int, val viewportY: Int, val viewportWidth: Int, val viewportHeight: Int) : RenderPipelineState {
Expand All @@ -24,7 +24,7 @@ class ViewportState(val viewportX: Int, val viewportY: Int, val viewportWidth: I
}
}

constructor(framebuffer: Framebuffer) : this(0, 0, framebuffer.viewportWidth, framebuffer.viewportHeight)
constructor(framebuffer: RenderTarget) : this(0, 0, framebuffer.viewportWidth, framebuffer.viewportHeight)

override fun apply(): RenderPipelineSnapshot {
val snapshot = captureSnapshot()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package heckerpowered.matrix.client.shader

import com.mojang.blaze3d.platform.GlConst
import com.mojang.blaze3d.opengl.GlConst
import heckerpowered.matrix.client.render.MatrixRenderSystem
import heckerpowered.matrix.client.shader.cache.ShaderCompilationException
import org.lwjgl.opengl.ARBShadingLanguageInclude
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package heckerpowered.matrix.client.shader

import com.mojang.blaze3d.platform.GlConst
import com.mojang.blaze3d.opengl.GlConst
import heckerpowered.matrix.client.render.OpenGLExtensions
import heckerpowered.matrix.client.shader.cache.ShaderCompilationException
import kotlinx.coroutines.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ in vec2 fragTexCoord;
out vec4 fragColor;

uniform sampler2D image;
uniform float radius;

layout(std140) uniform MatrixPostUniforms {
vec4 blurParams0;
};

#define radius blurParams0.x

const vec2 BlurDir = vec2(1.2, 0.8);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#version 330

#moj_import <minecraft:dynamictransforms.glsl>

in vec4 vertexColor;

out vec4 fragColor;

void main() {
vec2 coord = gl_PointCoord * 2.0 - 1.0;
float squaredDistance = dot(coord, coord);
if (squaredDistance > 1.0) {
discard;
}

fragColor = vertexColor * ColorModulator;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#version 330

#moj_import <minecraft:dynamictransforms.glsl>
#moj_import <minecraft:projection.glsl>

in vec3 Position;
in vec2 UV0;
in vec4 Color;

out vec4 vertexColor;

void main() {
vec4 viewPosition = ModelViewMat * vec4(Position, 1.0);
gl_Position = ProjMat * viewPosition;

float distance = max(length(viewPosition.xyz), 0.01);
gl_PointSize = UV0.x / distance;

vertexColor = Color * UV0.y;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ layout (location = 7) in vec4 InColor;
layout (location = 8) in vec4 InOrientation;
layout (location = 9) in vec3 InAngularVelocity;

uniform float MinScaleFactor = .0;
uniform float MinScaleFactor = 0.0;
uniform float MaxScaleFactor = 2.0;
uniform float VelocityThreshold = 1.0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
in vec2 fragTexCoord;

uniform sampler2D framebuffer;
uniform vec2 direction;

layout(std140) uniform MatrixPostUniforms {
vec4 MatrixPostData0;
vec4 MatrixPostData1;
vec4 MatrixPostData2;
vec4 MatrixPostData3;
};

#define direction MatrixPostData0.xy

out vec4 fragColor;

Expand All @@ -21,4 +29,4 @@ void main() {
}

fragColor = vec4(result, 1.0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
in vec2 fragTexCoord;

uniform sampler2D framebuffer;
uniform float filterRadius = 15;

layout(std140) uniform MatrixPostUniforms {
vec4 MatrixPostData0;
vec4 MatrixPostData1;
vec4 MatrixPostData2;
vec4 MatrixPostData3;
};

#define filterRadius MatrixPostData0.x

out vec4 fragColor;

Expand All @@ -20,4 +28,4 @@ void main() {
color /= 16.0;

fragColor = color * 1.2;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@ in vec2 fragTexCoord;

uniform sampler2D opacityMask;
uniform sampler2D noiseTexture;
uniform float grainStrength = 0.05;

layout(std140) uniform MatrixPostUniforms {
vec4 grainParams;
};

#define grainStrength grainParams.x

out vec4 fragColor;

void main() {
vec4 opacity = texture(opacityMask, fragTexCoord);
if (opacity.a == .0) {
if (opacity.a == 0.0) {
discard;
}
fragColor = texture(noiseTexture, fragTexCoord) * grainStrength;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@
in vec2 fragTexCoord;

uniform sampler2D framebuffer;
uniform float primaryLevelOfDetail;
uniform float secondaryLevelOfDetail;
uniform float alpha = 0.5;

layout(std140) uniform MatrixPostUniforms {
vec4 MatrixPostData0;
vec4 MatrixPostData1;
vec4 MatrixPostData2;
vec4 MatrixPostData3;
};

#define primaryLevelOfDetail MatrixPostData0.x
#define secondaryLevelOfDetail MatrixPostData0.y
#define alpha MatrixPostData0.z

out vec4 fragColor;

Expand All @@ -14,4 +22,4 @@ void main() {
vec4 secondaryColor = textureLod(framebuffer, fragTexCoord, secondaryLevelOfDetail);
vec4 mixColor = mix(primaryColor, secondaryColor, alpha);
fragColor = mixColor;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ out vec4 fragColor;

void main() {
vec4 opacity = texture(opacityMask, fragTexCoord);
if (opacity.a == .0) {
if (opacity.a == 0.0) {
discard;
}
fragColor = texture(colorAttachment, fragTexCoord);
Expand Down
11 changes: 11 additions & 0 deletions common/attic/shaders/post/refraction/refraction.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#version 330 core

in vec2 fragTexCoord;

uniform sampler2D framebuffer;

out vec4 fragColor;

void main() {
fragColor = texture(framebuffer, fragTexCoord);
}
4 changes: 4 additions & 0 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ dependencies {
testImplementation("org.junit.jupiter:junit-jupiter:5.10.0")

implementation(project(":ledger"))
// Ledger is a plain Kotlin library, not an installed mod: without jar-in-jar bundling it
// only exists on the dev classpath and production dies with NoClassDefFoundError on the
// first mana tick.
include(project(":ledger"))
}

tasks.test {
Expand Down
Loading