vrend: Fix wrong numlayers in vrend_make_view

The old code is buggy and set numlayers to 1 for GL_TEXTURE_2D_ARRAY
when creating the view. Just change to use array_size directly.

This fixes such tests in CtsNativeHardwareTestCases:

android.hardware.nativehardware.cts.AHardwareBufferNativeTests#MultipleLayers_ColorTest_MipmapComplete_GL_RGB10_A2
android.hardware.nativehardware.cts.AHardwareBufferNativeTests#MultipleLayers_ColorTest_MipmapComplete_GL_RGB8
android.hardware.nativehardware.cts.AHardwareBufferNativeTests#MultipleLayers_ColorTest_MipmapComplete_GL_RGBA16F
android.hardware.nativehardware.cts.AHardwareBufferNativeTests#MultipleLayers_ColorTest_MipmapComplete_GL_RGBA8
android.hardware.nativehardware.cts.AHardwareBufferNativeTests#MultipleLayers_ColorTest_MipmapComplete_GL_SRGB8_ALPHA8_sRGB

Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Lepton Wu <lepton@chromium.org>
macos/master
Lepton Wu 5 years ago
parent 66c57963aa
commit 1686cf92a7
  1. 6
      src/vrend_renderer.c

@ -8276,10 +8276,6 @@ static GLuint vrend_make_view(struct vrend_resource *res, enum virgl_formats for
util_format_name(format), util_format_name(format),
format != dst_fmt ? "(emulated)" : ""); format != dst_fmt ? "(emulated)" : "");
unsigned layers_factor = 1;
if (res->target == GL_TEXTURE_CUBE_MAP || res->target == GL_TEXTURE_CUBE_MAP_ARRAY)
layers_factor = 6;
if (vrend_state.use_gles) { if (vrend_state.use_gles) {
assert(res->target != GL_TEXTURE_RECTANGLE_NV); assert(res->target != GL_TEXTURE_RECTANGLE_NV);
assert(res->target != GL_TEXTURE_1D); assert(res->target != GL_TEXTURE_1D);
@ -8287,7 +8283,7 @@ static GLuint vrend_make_view(struct vrend_resource *res, enum virgl_formats for
} }
glTextureView(view_id, res->target, res->id, fmt, 0, res->base.last_level + 1, glTextureView(view_id, res->target, res->id, fmt, 0, res->base.last_level + 1,
0, layers_factor * res->base.depth0); 0, res->base.array_size);
return view_id; return view_id;
} }

Loading…
Cancel
Save