diff --git a/src/vrend_blitter.c b/src/vrend_blitter.c index 96d0e65..2194b28 100644 --- a/src/vrend_blitter.c +++ b/src/vrend_blitter.c @@ -246,6 +246,7 @@ static GLuint blit_build_frag_tex_col_msaa(struct vrend_blitter_ctx *blit_ctx, const char *ext_str = blit_ctx->use_gles ? "" : "#extension GL_ARB_texture_multisample : enable\n"; + bool is_array = false; switch (tgsi_tex_target) { case TGSI_TEXTURE_2D_MSAA: twm = ".xy"; @@ -254,6 +255,7 @@ static GLuint blit_build_frag_tex_col_msaa(struct vrend_blitter_ctx *blit_ctx, case TGSI_TEXTURE_2D_ARRAY_MSAA: twm = ".xyz"; ivec = "ivec3"; + is_array = true; break; default: return 0; @@ -263,7 +265,9 @@ static GLuint blit_build_frag_tex_col_msaa(struct vrend_blitter_ctx *blit_ctx, create_dest_swizzle_snippet(swizzle, dest_swizzle_snippet); snprintf(shader_buf, 4096, - blit_ctx->use_gles ? FS_TEXFETCH_COL_MSAA_GLES : FS_TEXFETCH_COL_MSAA_GL, + blit_ctx->use_gles ? + (is_array ? FS_TEXFETCH_COL_MSAA_ARRAY_GLES : FS_TEXFETCH_COL_MSAA_GLES) + : FS_TEXFETCH_COL_MSAA_GL, ext_str, vec4_type_for_tgsi_ret(tgsi_ret), vrend_shader_samplerreturnconv(tgsi_ret), vrend_shader_samplertypeconv(blit_ctx->use_gles, tgsi_tex_target, &is_shad), @@ -324,7 +328,8 @@ static GLuint blit_build_frag_tex_writedepth(struct vrend_blitter_ctx *blit_ctx, break; } - snprintf(shader_buf, 4096, blit_ctx->use_gles ? FS_TEXFETCH_DS_GLES : FS_TEXFETCH_DS_GL, + snprintf(shader_buf, 4096, blit_ctx->use_gles ? FS_TEXFETCH_DS_GLES + : FS_TEXFETCH_DS_GL, vrend_shader_samplertypeconv(blit_ctx->use_gles, tgsi_tex_target, &is_shad), twm); fs_id = glCreateShader(GL_FRAGMENT_SHADER); @@ -345,6 +350,7 @@ static GLuint blit_build_frag_blit_msaa_depth(struct vrend_blitter_ctx *blit_ctx const char *twm; const char *ivec; + bool is_array = false; switch (tgsi_tex_target) { case TGSI_TEXTURE_2D_MSAA: twm = ".xy"; @@ -353,12 +359,15 @@ static GLuint blit_build_frag_blit_msaa_depth(struct vrend_blitter_ctx *blit_ctx case TGSI_TEXTURE_2D_ARRAY_MSAA: twm = ".xyz"; ivec = "ivec3"; + is_array = true; break; default: return 0; } - snprintf(shader_buf, 4096, blit_ctx->use_gles ? FS_TEXFETCH_DS_MSAA_GLES : FS_TEXFETCH_DS_MSAA_GL, + snprintf(shader_buf, 4096, blit_ctx->use_gles ? + (is_array ? FS_TEXFETCH_DS_MSAA_ARRAY_GLES : FS_TEXFETCH_DS_MSAA_GLES) + : FS_TEXFETCH_DS_MSAA_GL, vrend_shader_samplertypeconv(blit_ctx->use_gles, 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 d92fe18..24de0f8 100644 --- a/src/vrend_blitter.h +++ b/src/vrend_blitter.h @@ -35,6 +35,13 @@ "#version 310 es\n" \ "precision mediump float;\n" \ +#define HEADER_GLES_MS_ARRAY \ + "// Blitter\n" \ + "#version 310 es\n" \ + "#extension GL_OES_texture_storage_multisample_2d_array: require\n" \ + "precision mediump float;\n" \ + + #define VS_PASSTHROUGH_BODY \ "in vec4 arg0;\n" \ "in vec4 arg1;\n" \ @@ -91,6 +98,7 @@ #define FS_TEXFETCH_COL_MSAA_GL HEADER_GL FS_TEXFETCH_COL_MSAA_BODY #define FS_TEXFETCH_COL_MSAA_GLES HEADER_GLES FS_TEXFETCH_COL_MSAA_BODY +#define FS_TEXFETCH_COL_MSAA_ARRAY_GLES HEADER_GLES_MS_ARRAY FS_TEXFETCH_COL_MSAA_BODY #define FS_TEXFETCH_DS_BODY \ "uniform sampler%s samp;\n" \ @@ -121,6 +129,7 @@ #define FS_TEXFETCH_DS_MSAA_GL HEADER_GL FS_TEXFETCH_DS_MSAA_BODY #define FS_TEXFETCH_DS_MSAA_GLES HEADER_GLES FS_TEXFETCH_DS_MSAA_BODY_GLES +#define FS_TEXFETCH_DS_MSAA_ARRAY_GLES HEADER_GLES_MS_ARRAY FS_TEXFETCH_DS_MSAA_BODY_GLES #endif