From 28bef8c54fe413affca1626065fe20e979c6f2b7 Mon Sep 17 00:00:00 2001 From: Indev Date: Mon, 1 Jul 2024 23:15:59 +0300 Subject: [PATCH] Use a fake 2d array in dither shader so it compiles with older glsl versions (1.20 at least) --- src/hardware/hw_shaders.h | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/hardware/hw_shaders.h b/src/hardware/hw_shaders.h index d564ddfe6..fc36ad251 100644 --- a/src/hardware/hw_shaders.h +++ b/src/hardware/hw_shaders.h @@ -75,17 +75,17 @@ "vec2 normalizedPosition = position * vec2(halfResolutionx / scr_resolution.x, halfResolutiony / scr_resolution.y);\n" \ "int x = int(mod(normalizedPosition.x, 8.0));\n" \ "int y = int(mod(normalizedPosition.y, 8.0));\n" \ - "float bayerMatrix[8][8] = float[8][8](\n" \ - "float[8](0.0, 32.0, 8.0, 40.0, 2.0, 34.0, 10.0, 42.0),\n" \ - "float[8](48.0, 16.0, 56.0, 24.0, 50.0, 18.0, 58.0, 26.0),\n" \ - "float[8](12.0, 44.0, 4.0, 36.0, 14.0, 46.0, 6.0, 38.0),\n" \ - "float[8](60.0, 28.0, 52.0, 20.0, 62.0, 30.0, 54.0, 22.0),\n" \ - "float[8](3.0, 35.0, 11.0, 43.0, 1.0, 33.0, 9.0, 41.0),\n" \ - "float[8](51.0, 19.0, 59.0, 27.0, 49.0, 17.0, 57.0, 25.0),\n" \ - "float[8](15.0, 47.0, 7.0, 39.0, 13.0, 45.0, 5.0, 37.0),\n" \ - "float[8](63.0, 31.0, 55.0, 23.0, 61.0, 29.0, 53.0, 21.0)\n" \ + "float bayerMatrix[8*8] = float[8*8](\n" \ + "0.0, 32.0, 8.0, 40.0, 2.0, 34.0, 10.0, 42.0,\n" \ + "48.0, 16.0, 56.0, 24.0, 50.0, 18.0, 58.0, 26.0,\n" \ + "12.0, 44.0, 4.0, 36.0, 14.0, 46.0, 6.0, 38.0,\n" \ + "60.0, 28.0, 52.0, 20.0, 62.0, 30.0, 54.0, 22.0,\n" \ + "3.0, 35.0, 11.0, 43.0, 1.0, 33.0, 9.0, 41.0,\n" \ + "51.0, 19.0, 59.0, 27.0, 49.0, 17.0, 57.0, 25.0,\n" \ + "15.0, 47.0, 7.0, 39.0, 13.0, 45.0, 5.0, 37.0,\n" \ + "63.0, 31.0, 55.0, 23.0, 61.0, 29.0, 53.0, 21.0\n" \ ");\n" \ - "float threshold = bayerMatrix[y][x] / 64.0;\n" \ + "float threshold = bayerMatrix[y*8 + x] / 64.0;\n" \ "return baseValue + threshold - 0.5 / 64.0;\n" \ #define GLSL_DOOM_COLORMAP_NODITHER \ @@ -201,10 +201,12 @@ // hand tuned adjustments for light level calculation #define GLSL_FLOOR_FUDGES \ + "#version 120\n" \ "#define STARTMAP_FUDGE 1.06\n" \ "#define SCALE_FUDGE 1.15\n" #define GLSL_WALL_FUDGES \ + "#version 120\n" \ "#define STARTMAP_FUDGE 1.05\n" \ "#define SCALE_FUDGE 2.2\n"