Satin API

Satin API

3M Downloads

Shader Pass JSON vertex/fragment domain:shader_program

lmvdz opened this issue ยท 1 comments

commented

Describe the bug

Does the vertex and fragment in a shader pass json also use domain:program?

I saw it mentioned here: https://github.com/Ladysnake/Satin/wiki/Shader-Pass-format#mandatory-fields.

Satin adds the possibility of using an Identifier format for both fragment and vertex file locations (domain:shader_source_file).

I've copied the blit straight from minecraft.

net.minecraft.client.gl.ShaderParseException: Invalid shaders/program/blit.json: Couldn't compile vertex program: 0(15) : error C1035: assignment of incompatible types
	at net.minecraft.client.gl.ShaderParseException.wrap(ShaderParseException.java:50) ~[minecraft-1.15.2-mapped-net.fabricmc.yarn-1.15.2+build.15-v2.jar:?]
ShaderParseException.java:50
	at net.minecraft.client.gl.JsonGlProgram.<init>(JsonGlProgram.java:135) ~[minecraft-1.15.2-mapped-net.fabricmc.yarn-1.15.2+build.15-v2.jar:?]
	at net.minecraft.client.gl.PostProcessShader.<init>(PostProcessShader.java:30) ~[minecraft-1.15.2-mapped-net.fabricmc.yarn-1.15.2+build.15-v2.jar:?]
	at net.minecraft.client.gl.ShaderEffect.addPass(ShaderEffect.java:285) ~[minecraft-1.15.2-mapped-net.fabricmc.yarn-1.15.2+build.15-v2.jar:?]
ShaderEffect.java:285
	at net.minecraft.client.gl.ShaderEffect.parsePass(ShaderEffect.java:139) ~[minecraft-1.15.2-mapped-net.fabricmc.yarn-1.15.2+build.15-v2.jar:?]
ShaderEffect.java:139
	at net.minecraft.client.gl.ShaderEffect.parseEffect(ShaderEffect.java:92) ~[minecraft-1.15.2-mapped-net.fabricmc.yarn-1.15.2+build.15-v2.jar:?]
ShaderEffect.java:92
	at net.minecraft.client.gl.ShaderEffect.<init>(ShaderEffect.java:53) ~[minecraft-1.15.2-mapped-net.fabricmc.yarn-1.15.2+build.15-v2.jar:?]

assets/delirium/shaders/post/blit.json

{
    "targets": ["swap"],

    "passes": [{
            "name": "delirium:blit",
            "intarget": "minecraft:main",
            "outtarget": "swap"
        },
        {
            "name": "delirium:blit",
            "intarget": "swap",
            "outtarget": "minecraft:main"
        }
    ]
}

assets/delirium/shaders/program/blit.json

{
    "blend": {
        "func": "add",
        "srcrgb": "srcalpha",
        "dstrgb": "1-srcalpha"
    },
    "vertex": "delirium:blit",
    "fragment": "delirium:blit",
    "attributes": ["Position"],
    "samplers": [{
        "name": "DiffuseSampler"
    }],
    "uniforms": [{
            "name": "ProjMat",
            "type": "matrix4x4",
            "count": 16,
            "values": [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0]
        },
        {
            "name": "OutSize",
            "type": "float",
            "count": 2,
            "values": [1.0, 1.0]
        },
        {
            "name": "ColorModulate",
            "type": "float",
            "count": 4,
            "values": [1.0, 1.0, 1.0, 1.0]
        }
    ]
}

assets/delirium/shaders/program/blit.vsh

#version 110

attribute vec4 Position;

uniform mat4 ProjMat;
uniform vec2 OutSize;

varying vec2 texCoord;

void main(){
    vec4 outPos = ProjMat * vec4(Position.xy, 0.0, 1.0);
    gl_Position = vec4(outPos.xy, 0.2, 1.0);

    texCoord = Position.xy / OutSize;
}

assets/delirium/shaders/program/blit.fsh

#version 110

uniform sampler2D DiffuseSampler;

uniform vec4 ColorModulate;

varying vec2 texCoord;

void main() {

    gl_FragColor = texture2D(DiffuseSampler, texCoord) * ColorModulate;

}

image

To Reproduce
copy minecraft:blit into delirium:blit (including json for post, json for program, vsh, and fsh)

  • Minecraft Version [1.15.2]
  • Satin Version [master-SNAPSHOT]
commented

not a big problem, just don't do it.