diff --git a/src/vrend_blitter.c b/src/vrend_blitter.c index 430e14b..d215ce2 100644 --- a/src/vrend_blitter.c +++ b/src/vrend_blitter.c @@ -205,19 +205,22 @@ static GLuint blit_build_frag_blit_msaa_depth(struct vrend_blitter_ctx *blit_ctx char shader_buf[4096]; int is_shad; const char *twm; - + const char *ivec; + switch (tgsi_tex_target) { case TGSI_TEXTURE_2D_MSAA: twm = ".xy"; + ivec = "ivec2"; break; case TGSI_TEXTURE_2D_ARRAY_MSAA: twm = ".xyz"; + ivec = "ivec3"; break; default: return 0; } - snprintf(shader_buf, 4096, fs_texfetch_ds_msaa, vrend_shader_samplertypeconv(tgsi_tex_target, &is_shad), twm); + snprintf(shader_buf, 4096, fs_texfetch_ds_msaa, vrend_shader_samplertypeconv(tgsi_tex_target, &is_shad), ivec, twm); fs_id = glCreateShader(GL_FRAGMENT_SHADER); diff --git a/src/vrend_blitter.h b/src/vrend_blitter.h index c64b1ce..7d1e694 100644 --- a/src/vrend_blitter.h +++ b/src/vrend_blitter.h @@ -38,8 +38,8 @@ static const char *fs_texfetch_ds_msaa = { "uniform sampler%s samp;\n" "in vec4 tc;\n" "void main() {\n" - " gl_FragDepth = float(texelFetch(samp, tc%s, tc.z).x);\n" + " gl_FragDepth = float(texelFetch(samp, %s(tc%s), int(tc.z)).x);\n" "}\n" }; - + #endif