mirror of
https://github.com/perfect-dark-pc-port/perfect_dark.git
synced 2026-10-23 15:52:41 +02:00
port: fix blur-related crash on Intel GPUs
This commit is contained in:
1 parent
49f607dd79
commit
c487e423b1
1 file changed
+9
-12
@@ -396,25 +396,22 @@ static struct ShaderProgram* gfx_opengl_create_and_load_new_shader(uint64_t shad
|
||||
|
||||
if (cc_features.opt_blur) {
|
||||
// blur filter, used for menu backgrounds
|
||||
// used to be two for loops from 0 to 4, but apparently intel drivers crashed trying to unroll it
|
||||
append_line(fs_buf, &fs_len, R"(
|
||||
const vec4 blurOffsets = vec4(-1.5, -0.5, +0.5, +1.5);
|
||||
const mat4 blurWeights = mat4(
|
||||
const lowp float blurWeights[16] = float[16](
|
||||
0.009947, 0.009641, 0.008778, 0.007509,
|
||||
0.009641, 0.009345, 0.008508, 0.007278,
|
||||
0.008778, 0.008508, 0.007747, 0.006626,
|
||||
0.007509, 0.007278, 0.006626, 0.005668
|
||||
);
|
||||
lowp vec4 hookTexture2D(in sampler2D tex, in vec2 texCoord, in vec2 texSize) {
|
||||
lowp vec4 color = vec4(0.0);
|
||||
lowp float wacc = 0.0;
|
||||
for (int y = 0; y < 4; ++y) {
|
||||
for (int x = 0; x < 4; ++x) {
|
||||
vec2 ofs = vec2(blurOffsets[x], blurOffsets[y]) / texSize;
|
||||
wacc += blurWeights[x][y];
|
||||
color += texture2D(tex, texCoord + ofs) * blurWeights[x][y];
|
||||
}
|
||||
lowp vec4 hookTexture2D(in sampler2D t, in vec2 uv, in vec2 tsize) {
|
||||
lowp vec4 cw = vec4(0.0);
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
vec2 xy = vec2(float(i & 3), float(i >> 2));
|
||||
vec2 ofs = (vec2(-1.5) + xy) / tsize;
|
||||
cw += vec4(texture2D(t, uv + ofs).rgb * blurWeights[i], blurWeights[i]);
|
||||
}
|
||||
return vec4(color.rgb / wacc, 1.0);
|
||||
return vec4(cw.rgb / cw.a, 1.0);
|
||||
})"
|
||||
);
|
||||
} else if (current_filter_mode == FILTER_THREE_POINT) {
|
||||
|
||||
Reference in new issue
Block a user