blitter: fix invalid texelFetch call

Triggered by piglit/bin/ext_framebuffer_multisample-no-color 2 depth single -auto -fbo
macos/master
Marc-André Lureau 10 years ago committed by Dave Airlie
parent 043320c4f1
commit e9ca2d4ad3
  1. 7
      src/vrend_blitter.c
  2. 4
      src/vrend_blitter.h

@ -205,19 +205,22 @@ static GLuint blit_build_frag_blit_msaa_depth(struct vrend_blitter_ctx *blit_ctx
char shader_buf[4096]; char shader_buf[4096];
int is_shad; int is_shad;
const char *twm; const char *twm;
const char *ivec;
switch (tgsi_tex_target) { switch (tgsi_tex_target) {
case TGSI_TEXTURE_2D_MSAA: case TGSI_TEXTURE_2D_MSAA:
twm = ".xy"; twm = ".xy";
ivec = "ivec2";
break; break;
case TGSI_TEXTURE_2D_ARRAY_MSAA: case TGSI_TEXTURE_2D_ARRAY_MSAA:
twm = ".xyz"; twm = ".xyz";
ivec = "ivec3";
break; break;
default: default:
return 0; 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); fs_id = glCreateShader(GL_FRAGMENT_SHADER);

@ -38,8 +38,8 @@ static const char *fs_texfetch_ds_msaa = {
"uniform sampler%s samp;\n" "uniform sampler%s samp;\n"
"in vec4 tc;\n" "in vec4 tc;\n"
"void main() {\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" "}\n"
}; };
#endif #endif

Loading…
Cancel
Save