d3d12: Enable cubemap arrays

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14161>
This commit is contained in:
Jesse Natalie 2021-12-08 07:05:53 -08:00
parent 5b32915055
commit fe963f336c
6 changed files with 38 additions and 51 deletions

View File

@ -317,8 +317,6 @@ spec/!opengl 3.2/gl-3.2-adj-prims line cull-front pv-first: fail
spec/!opengl 3.2/gl-3.2-adj-prims line cull-front pv-last: fail
spec/!opengl 3.2/gl-3.2-adj-prims pv-first: fail
spec/!opengl 3.2/gl-3.2-adj-prims pv-last: fail
spec/!opengl 3.2/layered-rendering/clear-color-all-types cube_map_array mipmapped: skip
spec/!opengl 3.2/layered-rendering/clear-color-all-types cube_map_array single_level: skip
spec/!opengl 3.2/layered-rendering/gl-layer-cube-map: fail
spec/!opengl 3.2/layered-rendering/gl-layer-render: fail
spec/!opengl 3.2/layered-rendering/gl-layer-render-clipped: fail
@ -559,7 +557,6 @@ spec/arb_direct_state_access/create-transformfeedbacks: skip
spec/arb_direct_state_access/getcompressedtextureimage: skip
spec/arb_direct_state_access/gettextureimage-formats: crash
spec/arb_direct_state_access/gettransformfeedback: skip
spec/arb_direct_state_access/textures-storage/cube array texture: skip
spec/arb_direct_state_access/transformfeedback-bufferbase: skip
spec/arb_direct_state_access/transformfeedback-bufferrange: skip
spec/arb_draw_indirect/arb_draw_indirect-api-errors: skip
@ -595,7 +592,6 @@ spec/arb_framebuffer_no_attachments/arb_framebuffer_no_attachments-minmax: skip
spec/arb_framebuffer_no_attachments/arb_framebuffer_no_attachments-params: skip
spec/arb_framebuffer_no_attachments/arb_framebuffer_no_attachments-query: skip
spec/arb_framebuffer_no_attachments/arb_framebuffer_no_attachments-roundup-samples: skip
spec/arb_framebuffer_object/fbo-incomplete/invalid layer of a cube-array texture: skip
spec/arb_framebuffer_srgb/arb_framebuffer_srgb-srgb_conformance: fail
spec/arb_geometry_shader4/arb_geometry_shader4-ignore-adjacent-vertices gl_line_strip_adjacency: skip
spec/arb_geometry_shader4/arb_geometry_shader4-ignore-adjacent-vertices gl_lines_adjacency: skip
@ -1859,7 +1855,6 @@ spec/arb_pipeline_statistics_query/arb_pipeline_statistics_query-frag: skip
spec/arb_pipeline_statistics_query/arb_pipeline_statistics_query-geom: skip
spec/arb_pipeline_statistics_query/arb_pipeline_statistics_query-vert: skip
spec/arb_pipeline_statistics_query/arb_pipeline_statistics_query-vert_adj: skip
spec/arb_pixel_buffer_object/texsubimage cube_map_array pbo: skip
spec/arb_point_parameters/arb_point_parameters-point-attenuation: fail
spec/arb_point_sprite/arb_point_sprite-mipmap: fail
spec/arb_post_depth_coverage/arb_post_depth_coverage-basic: skip
@ -2135,7 +2130,6 @@ spec/arb_sparse_buffer/buffer-data: skip
spec/arb_sparse_buffer/commit: skip
spec/arb_sparse_buffer/minmax: skip
spec/arb_stencil_texturing/draw: fail
spec/arb_stencil_texturing/glblitframebuffer corrupts state/gl_texture_cube_map_array: skip
spec/arb_sync/clientwaitsync-timeout: skip
spec/arb_tessellation_shader/arb_tessellation_shader-get-tcs-params: skip
spec/arb_tessellation_shader/arb_tessellation_shader-get-tes-params: skip
@ -2315,34 +2309,11 @@ spec/arb_texture_cube_map/copyteximage cube samples=32: skip
spec/arb_texture_cube_map/copyteximage cube samples=4: skip
spec/arb_texture_cube_map/copyteximage cube samples=6: skip
spec/arb_texture_cube_map/copyteximage cube samples=8: skip
spec/arb_texture_cube_map_array/arb_texture_cube_map_array-cubemap: skip
spec/arb_texture_cube_map_array/arb_texture_cube_map_array-cubemap-lod: skip
spec/arb_texture_cube_map_array/arb_texture_cube_map_array-fbo-cubemap-array: skip
spec/arb_texture_cube_map_array/arb_texture_cube_map_array-get: skip
spec/arb_texture_cube_map_array/arb_texture_cube_map_array-sampler-cube-array-shadow: skip
spec/arb_texture_cube_map_array/arb_texture_cube_map_array-teximage3d-invalid-values: skip
spec/arb_texture_cube_map_array/fbo-generatemipmap-cubemap array: skip
spec/arb_texture_cube_map_array/fbo-generatemipmap-cubemap array rgb9_e5: skip
spec/arb_texture_cube_map_array/fbo-generatemipmap-cubemap array s3tc_dxt1: skip
spec/arb_texture_cube_map_array/getteximage-targets cube_array: skip
spec/arb_texture_cube_map_array/glsl-resource-not-bound cubearray: skip
spec/arb_texture_cube_map_array/texsubimage cube_map_array: skip
spec/arb_texture_cube_map_array/texturesize/fs-texturesize-isamplercubearray: skip
spec/arb_texture_cube_map_array/texturesize/fs-texturesize-samplercubearray: skip
spec/arb_texture_cube_map_array/texturesize/fs-texturesize-samplercubearrayshadow: skip
spec/arb_texture_cube_map_array/texturesize/fs-texturesize-usamplercubearray: skip
spec/arb_texture_cube_map_array/texturesize/gs-texturesize-isamplercubearray: skip
spec/arb_texture_cube_map_array/texturesize/gs-texturesize-samplercubearray: skip
spec/arb_texture_cube_map_array/texturesize/gs-texturesize-samplercubearrayshadow: skip
spec/arb_texture_cube_map_array/texturesize/gs-texturesize-usamplercubearray: skip
spec/arb_texture_cube_map_array/arb_texture_cube_map_array-cubemap: fail
spec/arb_texture_cube_map_array/texturesize/tes-texturesize-isamplercubearray: skip
spec/arb_texture_cube_map_array/texturesize/tes-texturesize-samplercubearray: skip
spec/arb_texture_cube_map_array/texturesize/tes-texturesize-samplercubearrayshadow: skip
spec/arb_texture_cube_map_array/texturesize/tes-texturesize-usamplercubearray: skip
spec/arb_texture_cube_map_array/texturesize/vs-texturesize-isamplercubearray: skip
spec/arb_texture_cube_map_array/texturesize/vs-texturesize-samplercubearray: skip
spec/arb_texture_cube_map_array/texturesize/vs-texturesize-samplercubearrayshadow: skip
spec/arb_texture_cube_map_array/texturesize/vs-texturesize-usamplercubearray: skip
spec/arb_texture_float/multisample-formats 32 gl_arb_texture_float: skip
spec/arb_texture_gather/texturegather/fs-r-none-float-2d: skip
spec/arb_texture_gather/texturegather/fs-r-none-float-2darray: skip
@ -3529,7 +3500,6 @@ spec/arb_texture_stencil8/texwrap formats offset/gl_stencil_index8, swizzled: fa
spec/arb_texture_stencil8/texwrap formats/gl_stencil_index8: fail
spec/arb_texture_stencil8/texwrap formats/gl_stencil_index8, npot: fail
spec/arb_texture_stencil8/texwrap formats/gl_stencil_index8, swizzled: fail
spec/arb_texture_storage/texture-storage/cube array texture: skip
spec/arb_texture_view/bug-layers-image: skip
spec/arb_texture_view/clear-into-view-2d: skip
spec/arb_texture_view/clear-into-view-2d-array: skip
@ -4194,7 +4164,6 @@ spec/ext_texture_compression_latc/texwrap formats: skip
spec/ext_texture_compression_latc/texwrap formats bordercolor: skip
spec/ext_texture_compression_latc/texwrap formats bordercolor-swizzled: skip
spec/ext_texture_compression_rgtc/rgtc-api_gles2: skip
spec/ext_texture_compression_s3tc/getteximage-targets cube_array s3tc: skip
spec/ext_texture_compression_s3tc/s3tc-errors: fail
spec/ext_texture_compression_s3tc/s3tc-errors_gles2: skip
spec/ext_texture_compression_s3tc/s3tc-targeted: fail
@ -4514,11 +4483,6 @@ spec/glsl-1.10/execution/varying-packing/simple vec4 array: crash
spec/glsl-1.10/execution/varying-packing/simple vec4 arrays_of_arrays: crash
spec/glsl-1.10/execution/varying-packing/simple vec4 separate: crash
spec/glsl-1.30/execution/fs-texelfetch-2d: fail
spec/glsl-1.30/execution/tex-miplevel-selection texture() cubearray: skip
spec/glsl-1.30/execution/tex-miplevel-selection texture() cubearrayshadow: skip
spec/glsl-1.30/execution/tex-miplevel-selection texture(bias) cubearray: skip
spec/glsl-1.30/execution/tex-miplevel-selection texturegrad cubearray: skip
spec/glsl-1.30/execution/tex-miplevel-selection texturelod cubearray: skip
spec/glsl-1.30/execution/tex-miplevel-selection textureoffset 2darrayshadow: skip
spec/glsl-1.50/execution/geometry/primitive-types gl_triangle_strip: fail
spec/glsl-1.50/execution/geometry/primitive-types gl_triangle_strip_adjacency: fail
@ -4710,10 +4674,10 @@ wgl/wgl-sanity: skip
summary:
name: results
---- --------
pass: 14314
fail: 480
pass: 14360
fail: 481
crash: 68
skip: 4141
skip: 4104
timeout: 0
warn: 10
incomplete: 0
@ -4722,4 +4686,4 @@ summary:
changes: 0
fixes: 0
regressions: 0
total: 19023
total: 19033

View File

@ -883,6 +883,14 @@ d3d12_init_sampler_view_descriptor(struct d3d12_sampler_view *sampler_view)
desc.TextureCube.MipLevels = sampler_view->mip_levels;
desc.TextureCube.ResourceMinLODClamp = 0.0f;
break;
case D3D12_SRV_DIMENSION_TEXTURECUBEARRAY:
assert(array_size % 6 == 0);
desc.TextureCubeArray.MostDetailedMip = state->u.tex.first_level;
desc.TextureCubeArray.MipLevels = sampler_view->mip_levels;
desc.TextureCubeArray.First2DArrayFace = state->u.tex.first_layer;
desc.TextureCubeArray.NumCubes = array_size / 6;
desc.TextureCubeArray.ResourceMinLODClamp = 0.0f;
break;
case D3D12_SRV_DIMENSION_BUFFER:
desc.Buffer.FirstElement = 0;
desc.Buffer.StructureByteStride = 0;

View File

@ -64,6 +64,7 @@ typedef struct {
nir_ssa_def *arx;
nir_ssa_def *ary;
nir_ssa_def *arz;
nir_ssa_def *array;
} coord_t;
@ -79,6 +80,9 @@ evaluate_face_x(nir_builder *b, coord_t *coord)
nir_ssa_def *y = nir_fadd(b, nir_fmul(b, ima, coord->ry), nir_imm_float(b, 0.5));
nir_ssa_def *face = nir_bcsel(b, positive, nir_imm_float(b, 0.0), nir_imm_float(b, 1.0));
if (coord->array)
face = nir_fadd(b, face, coord->array);
return nir_vec3(b, x,y, face);
}
@ -93,6 +97,9 @@ evaluate_face_y(nir_builder *b, coord_t *coord)
nir_ssa_def *y = nir_fadd(b, nir_fmul(b, nir_fmul(b, sign, ima), coord->rz), nir_imm_float(b, 0.5));
nir_ssa_def *face = nir_bcsel(b, positive, nir_imm_float(b, 2.0), nir_imm_float(b, 3.0));
if (coord->array)
face = nir_fadd(b, face, coord->array);
return nir_vec3(b, x,y, face);
}
@ -107,6 +114,9 @@ evaluate_face_z(nir_builder *b, coord_t *coord)
nir_ssa_def *y = nir_fadd(b, nir_fmul(b, ima, coord->ry), nir_imm_float(b, 0.5));
nir_ssa_def *face = nir_bcsel(b, positive, nir_imm_float(b, 4.0), nir_imm_float(b, 5.0));
if (coord->array)
face = nir_fadd(b, face, coord->array);
return nir_vec3(b, x,y, face);
}
@ -144,9 +154,6 @@ create_array_tex_from_cube_tex(nir_builder *b, nir_tex_instr *tex, nir_ssa_def *
static nir_ssa_def *
lower_cube_sample(nir_builder *b, nir_tex_instr *tex)
{
/* We don't support cube map arrays yet */
assert(!tex->is_array);
int coord_index = nir_tex_instr_src_index(tex, nir_tex_src_coord);
assert(coord_index >= 0);
@ -160,6 +167,9 @@ lower_cube_sample(nir_builder *b, nir_tex_instr *tex)
coords.arx = nir_fabs(b, coords.rx);
coords.ary = nir_fabs(b, coords.ry);
coords.arz = nir_fabs(b, coords.rz);
coords.array = NULL;
if (tex->is_array)
coords.array = nir_fmul(b, nir_channel(b, coord, 3), nir_imm_float(b, 6.0f));
nir_ssa_def *use_face_x = nir_iand(b,
nir_fge(b, coords.arx, coords.ary),
@ -189,12 +199,18 @@ lower_cube_sample(nir_builder *b, nir_tex_instr *tex)
return create_array_tex_from_cube_tex(b, tex, coord_and_face);
}
/* We don't expect the array size here */
static nir_ssa_def *
lower_cube_txs(nir_builder *b, nir_tex_instr *tex)
{
b->cursor = nir_after_instr(&tex->instr);
return nir_channels(b, &tex->dest.ssa, 3);
if (!tex->is_array)
return nir_channels(b, &tex->dest.ssa, 3);
nir_ssa_def *array_dim = nir_channel(b, &tex->dest.ssa, 2);
nir_ssa_def *cube_array_dim = nir_idiv(b, array_dim, nir_imm_int(b, 6));
return nir_vec3(b, nir_channel(b, &tex->dest.ssa, 0),
nir_channel(b, &tex->dest.ssa, 1),
cube_array_dim);
}
static const struct glsl_type *
@ -210,8 +226,6 @@ make_2darray_from_cubemap(const struct glsl_type *type)
static const struct glsl_type *
make_2darray_from_cubemap_with_array(const struct glsl_type *type)
{
/* While we don't (yet) support cube map arrays, there still may be arrays
* of cube maps */
if (glsl_type_is_array(type)) {
const struct glsl_type *new_type = glsl_without_array(type);
return new_type != type ? glsl_array_type(make_2darray_from_cubemap(glsl_without_array(type)),

View File

@ -107,6 +107,7 @@ static inline bool
d3d12_subresource_id_uses_layer(enum pipe_texture_target target)
{
return target == PIPE_TEXTURE_CUBE ||
target == PIPE_TEXTURE_CUBE_ARRAY ||
target == PIPE_TEXTURE_1D_ARRAY ||
target == PIPE_TEXTURE_2D_ARRAY;
}

View File

@ -191,10 +191,8 @@ d3d12_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_TEXTURE_MULTISAMPLE:
return 1;
#if 0 /* TODO: Enable me */
case PIPE_CAP_CUBE_MAP_ARRAY:
return screen->max_feature_level >= D3D_FEATURE_LEVEL_10_1;
#endif
return 1;
case PIPE_CAP_TEXTURE_BUFFER_OBJECTS:
return 1;

View File

@ -45,6 +45,7 @@ view_dsv_dimension(enum pipe_texture_target target, unsigned samples)
case PIPE_TEXTURE_2D_ARRAY:
case PIPE_TEXTURE_CUBE:
case PIPE_TEXTURE_CUBE_ARRAY:
return samples > 1 ? D3D12_DSV_DIMENSION_TEXTURE2DMSARRAY :
D3D12_DSV_DIMENSION_TEXTURE2DARRAY;
@ -68,6 +69,7 @@ view_rtv_dimension(enum pipe_texture_target target, unsigned samples)
case PIPE_TEXTURE_2D_ARRAY:
case PIPE_TEXTURE_CUBE:
case PIPE_TEXTURE_CUBE_ARRAY:
return samples > 1 ? D3D12_RTV_DIMENSION_TEXTURE2DMSARRAY :
D3D12_RTV_DIMENSION_TEXTURE2DARRAY;