[BGM Shader] Fix shader uniform names

This commit is contained in:
Luke Hubmayer-Werner 2024-07-15 01:36:14 +09:30
parent 8b006976b4
commit df2cfd8cff
1 changed files with 6 additions and 6 deletions

View File

@ -3,8 +3,8 @@
// Unfortunately, this loses type-checking on [0.0, 1.0] vs [0,255] etc. so a lot of this will involve comments declaring ranges. // Unfortunately, this loses type-checking on [0.0, 1.0] vs [0,255] etc. so a lot of this will involve comments declaring ranges.
shader_type canvas_item; shader_type canvas_item;
render_mode blend_premul_alpha; render_mode blend_premul_alpha;
uniform int INT_TEX_WIDTH = 4096; uniform int INT_OUTPUT_WIDTH = 4096;
uniform vec2 TEX_SIZE = vec2(4096.0, 4096.0); uniform vec2 OUTPUT_FRAMEBUFFER_SIZE = vec2(4096.0, 4096.0);
// I feel like these magic numbers are a bit more intuitive in hex // I feel like these magic numbers are a bit more intuitive in hex
const float x00FF = float(0x00FF); // 255.0 const float x00FF = float(0x00FF); // 255.0
const float x0100 = float(0x0100); // 256.0 const float x0100 = float(0x0100); // 256.0
@ -64,7 +64,7 @@ vec2 pack_float_to_int16(float value) {
// // and exporting a value derived from the UV // // and exporting a value derived from the UV
// vec4 output; // vec4 output;
// float sample_1 = rescale_int16(unpack_int16(texture(tex, uv).xw)); // float sample_1 = rescale_int16(unpack_int16(texture(tex, uv).xw));
// float sample_2 = rescale_int16(dot(trunc(uv*TEX_SIZE), vec2(1.0, TEX_SIZE))); // float sample_2 = rescale_int16(dot(trunc(uv*OUTPUT_FRAMEBUFFER_SIZE), vec2(1.0, OUTPUT_FRAMEBUFFER_SIZE)));
// output.xy = pack_float_to_int16(sample_1); // output.xy = pack_float_to_int16(sample_1);
// output.zw = pack_float_to_int16(sample_2); // output.zw = pack_float_to_int16(sample_2);
// return output; // return output;
@ -209,8 +209,8 @@ vec4 render_song(sampler2D tex, int smp) {
void fragment() { void fragment() {
// GLES2 // GLES2
vec2 uv = vec2(UV.x, 1.0-UV.y); vec2 uv = vec2(UV.x, 1.0-UV.y);
// uv = (trunc(uv*TEX_SIZE)+0.5)/TEX_SIZE; // uv = (trunc(uv*OUTPUT_FRAMEBUFFER_SIZE)+0.5)/OUTPUT_FRAMEBUFFER_SIZE;
// COLOR.xyzw = test_writeback(TEXTURE, uv); // COLOR.xyzw = test_writeback(TEXTURE, uv);
ivec2 xy = ivec2(trunc(uv*TEX_SIZE)); ivec2 xy = ivec2(trunc(uv*OUTPUT_FRAMEBUFFER_SIZE));
COLOR.xyzw = render_song(TEXTURE, xy.x + (xy.y*INT_TEX_WIDTH)); COLOR.xyzw = render_song(TEXTURE, xy.x + (xy.y*INT_OUTPUT_WIDTH));
} }