Commit d0a7d10f by Jiawei Shao Committed by Commit Bot

ES3.1: Set unordered access view related resource limits on D3D11

This patch sets the implementation-dependent resources limits related to unordered access views (images, shader storage blocks, atomic counter buffers and fragment shader outputs) on D3D11 back-ends. For pixel shaders, the render targets and unordered access views share the same resource slots when being written out, so we plan to allocate these slots as follows: - As there are 8 slots for UAVs and RTVs in feature level 11_0, currently we assign 1 slot for atomic counter buffer and 7 slots that are shared among images, shader storage blocks and fragment shader outputs. - As there are 64 slots for UAVs and RTVs in feature level 11_1, currently we assign 4 slots for atomic counter buffers and 60 slots that are shared among images, shader storage blocks and fragment shader outputs. We also limit the maximum number of draw buffers to 7 if we create ES 3.1 context on D3D11 feature level is 11_0 because the value of combined shader output resources is 7. This patch also labels several dEQP cases from "FAIL" to "SKIP" because since the resource limits on ssbos, atomic counter buffers and images in rendering pipeline are set in D3D11 back-ends, the GLSL programs in these cases can pass all the related link checks, thus these cases will crash due to reaching the unimplemented parts when they are running on ANGLE D3D11 back-ends. BUG=angleproject:2345 TEST=dEQP-GLES31.functional.state_query.integer.max_compute_atomic_counter_buffers_* dEQP-GLES31.functional.state_query.integer.max_compute_shader_storage_blocks_* dEQP-GLES31.functional.state_query.integer.max_atomic_counter_buffer_bindings_* dEQP-GLES31.functional.state_query.integer.max_combined_atomic_counter_buffers_* dEQP-GLES31.functional.state_query.integer.max_image_units_* dEQP-GLES31.functional.state_query.integer.max_combined_image_uniforms_* dEQP-GLES31.functional.state_query.integer.max_shader_storage_buffer_bindings_* dEQP-GLES31.functional.state_query.integer.max_combined_shader_storage_blocks_* dEQP-GLES31.functional.state_query.integer.max_combined_shader_output_resources_* Change-Id: I56a4e6c60d4f6f5bd6f238ae8ce425fb5072a4a3 Reviewed-on: https://chromium-review.googlesource.com/1046372Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
parent 5f9482f4
......@@ -150,7 +150,7 @@ class ContextImpl : public GLImplFactory
virtual void onMakeCurrent(const gl::Context *context) = 0;
// Native capabilities, unmodified by gl::Context.
virtual const gl::Caps &getNativeCaps() const = 0;
virtual gl::Caps getNativeCaps() const = 0;
virtual const gl::TextureCapsMap &getNativeTextureCaps() const = 0;
virtual const gl::Extensions &getNativeExtensions() const = 0;
virtual const gl::Limitations &getNativeLimitations() const = 0;
......
......@@ -423,9 +423,30 @@ void Context11::onMakeCurrent(const gl::Context *context)
ANGLE_SWALLOW_ERR(mRenderer->getStateManager()->onMakeCurrent(context));
}
const gl::Caps &Context11::getNativeCaps() const
{
return mRenderer->getNativeCaps();
gl::Caps Context11::getNativeCaps() const
{
gl::Caps caps = mRenderer->getNativeCaps();
// For pixel shaders, the render targets and unordered access views share the same resource
// slots, so the maximum number of fragment shader outputs depends on the current context
// version:
// - If current context is ES 3.0 and below, we use D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT(8)
// as the value of max draw buffers because UAVs are not used.
// - If current context is ES 3.1 and the feature level is 11_0, the RTVs and UAVs share 8
// slots. As ES 3.1 requires at least 1 atomic counter buffer in compute shaders, the value
// of max combined shader output resources is limited to 7, thus only 7 RTV slots can be
// used simultaneously.
// - If current context is ES 3.1 and the feature level is 11_1, the RTVs and UAVs share 64
// slots. Currently we allocate 60 slots for combined shader output resources, so we can use
// at most D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT(8) RTVs simultaneously.
if (mState.getClientVersion() >= gl::ES_3_1 &&
mRenderer->getRenderer11DeviceCaps().featureLevel == D3D_FEATURE_LEVEL_11_0)
{
caps.maxDrawBuffers = caps.maxCombinedShaderOutputResources;
caps.maxColorAttachments = caps.maxCombinedShaderOutputResources;
}
return caps;
}
const gl::TextureCapsMap &Context11::getNativeTextureCaps() const
......
......@@ -130,7 +130,7 @@ class Context11 : public ContextImpl
void onMakeCurrent(const gl::Context *context) override;
// Caps queries
const gl::Caps &getNativeCaps() const override;
gl::Caps getNativeCaps() const override;
const gl::TextureCapsMap &getNativeTextureCaps() const override;
const gl::Extensions &getNativeExtensions() const override;
const gl::Limitations &getNativeLimitations() const override;
......
......@@ -929,45 +929,68 @@ size_t GetMaximumComputeTextureUnits(D3D_FEATURE_LEVEL featureLevel)
}
}
size_t GetMaximumImageUnits(D3D_FEATURE_LEVEL featureLevel)
void SetUAVRelatedResourceLimits(D3D_FEATURE_LEVEL featureLevel, gl::Caps *caps)
{
switch (featureLevel)
{
case D3D_FEATURE_LEVEL_11_1:
case D3D_FEATURE_LEVEL_11_0:
// TODO(xinghua.cao@intel.com): Get a more accurate limit. For now using
// the minimum requirement for GLES 3.1.
return 4;
default:
return 0;
}
}
ASSERT(caps);
GLuint reservedUAVsForAtomicCounterBuffers = 0u;
// For pixel shaders, the render targets and unordered access views share the same resource
// slots when being written out.
// https://msdn.microsoft.com/en-us/library/windows/desktop/ff476465(v=vs.85).aspx
GLuint maxNumRTVsAndUAVs = 0u;
size_t GetMaximumComputeImageUniforms(D3D_FEATURE_LEVEL featureLevel)
{
switch (featureLevel)
{
case D3D_FEATURE_LEVEL_11_1:
// Currently we allocate 4 UAV slots for atomic counter buffers on feature level 11_1.
reservedUAVsForAtomicCounterBuffers = 4u;
maxNumRTVsAndUAVs = D3D11_1_UAV_SLOT_COUNT;
break;
case D3D_FEATURE_LEVEL_11_0:
// TODO(xinghua.cao@intel.com): Get a more accurate limit. For now using
// the minimum requirement for GLES 3.1.
return 4;
// Currently we allocate 1 UAV slot for atomic counter buffers on feature level 11_0.
reservedUAVsForAtomicCounterBuffers = 1u;
maxNumRTVsAndUAVs = D3D11_PS_CS_UAV_REGISTER_COUNT;
break;
default:
return 0;
return;
}
}
size_t GetMaximumCombinedShaderOutputResources(D3D_FEATURE_LEVEL featureLevel)
{
switch (featureLevel)
// Set limits on atomic counter buffers in fragment shaders and compute shaders.
caps->maxCombinedAtomicCounterBuffers = reservedUAVsForAtomicCounterBuffers;
caps->maxComputeAtomicCounterBuffers = reservedUAVsForAtomicCounterBuffers;
caps->maxFragmentAtomicCounterBuffers = reservedUAVsForAtomicCounterBuffers;
caps->maxAtomicCounterBufferBindings = reservedUAVsForAtomicCounterBuffers;
// Allocate the remaining slots for images and shader storage blocks.
// The maximum number of fragment shader outputs depends on the current context version, so we
// will not set it here. See comments in Context11::initialize().
caps->maxCombinedShaderOutputResources =
maxNumRTVsAndUAVs - reservedUAVsForAtomicCounterBuffers;
// Set limits on images and shader storage blocks in fragment shaders and compute shaders.
caps->maxCombinedShaderStorageBlocks = caps->maxCombinedShaderOutputResources;
caps->maxShaderStorageBlocks[gl::ShaderType::Compute] = caps->maxCombinedShaderOutputResources;
caps->maxShaderStorageBlocks[gl::ShaderType::Fragment] = caps->maxCombinedShaderOutputResources;
caps->maxShaderStorageBufferBindings = caps->maxCombinedShaderOutputResources;
caps->maxImageUnits = caps->maxCombinedShaderOutputResources;
caps->maxCombinedImageUniforms = caps->maxCombinedShaderOutputResources;
caps->maxComputeImageUniforms = caps->maxCombinedShaderOutputResources;
caps->maxFragmentImageUniforms = caps->maxCombinedShaderOutputResources;
// On feature level 11_1, UAVs are also available in vertex shaders and geometry shaders.
if (featureLevel == D3D_FEATURE_LEVEL_11_1)
{
// TODO(jiawei.shao@intel.com): Get a more accurate limit. For now using the minimum
// requirement for GLES 3.1.
case D3D_FEATURE_LEVEL_11_1:
case D3D_FEATURE_LEVEL_11_0:
return 4;
default:
return 0;
caps->maxVertexAtomicCounterBuffers = caps->maxCombinedAtomicCounterBuffers;
caps->maxGeometryAtomicCounterBuffers = caps->maxCombinedAtomicCounterBuffers;
caps->maxVertexImageUniforms = caps->maxCombinedShaderOutputResources;
caps->maxShaderStorageBlocks[gl::ShaderType::Vertex] =
caps->maxCombinedShaderOutputResources;
caps->maxGeometryImageUniforms = caps->maxCombinedShaderOutputResources;
caps->maxShaderStorageBlocks[gl::ShaderType::Geometry] =
caps->maxCombinedShaderOutputResources;
}
}
......@@ -1409,11 +1432,8 @@ void GenerateCaps(ID3D11Device *device,
static_cast<GLuint>(GetMaximumComputeUniformBlocks(featureLevel));
caps->maxShaderTextureImageUnits[gl::ShaderType::Compute] =
static_cast<GLuint>(GetMaximumComputeTextureUnits(featureLevel));
caps->maxImageUnits = static_cast<GLuint>(GetMaximumImageUnits(featureLevel));
caps->maxComputeImageUniforms =
static_cast<GLuint>(GetMaximumComputeImageUniforms(featureLevel));
caps->maxCombinedShaderOutputResources =
static_cast<GLuint>(GetMaximumCombinedShaderOutputResources(featureLevel));
SetUAVRelatedResourceLimits(featureLevel, caps);
// Aggregate shader limits
caps->maxUniformBufferBindings = caps->maxShaderUniformBlocks[gl::ShaderType::Vertex] +
......
......@@ -274,7 +274,7 @@ void Context9::onMakeCurrent(const gl::Context *context)
{
}
const gl::Caps &Context9::getNativeCaps() const
gl::Caps Context9::getNativeCaps() const
{
return mRenderer->getNativeCaps();
}
......
......@@ -130,7 +130,7 @@ class Context9 : public ContextImpl
void onMakeCurrent(const gl::Context *context) override;
// Caps queries
const gl::Caps &getNativeCaps() const override;
gl::Caps getNativeCaps() const override;
const gl::TextureCapsMap &getNativeTextureCaps() const override;
const gl::Extensions &getNativeExtensions() const override;
const gl::Limitations &getNativeLimitations() const override;
......
......@@ -386,7 +386,7 @@ void ContextGL::onMakeCurrent(const gl::Context *context)
ANGLE_SWALLOW_ERR(mRenderer->getStateManager()->onMakeCurrent(context));
}
const gl::Caps &ContextGL::getNativeCaps() const
gl::Caps ContextGL::getNativeCaps() const
{
return mRenderer->getNativeCaps();
}
......
......@@ -184,7 +184,7 @@ class ContextGL : public ContextImpl
void onMakeCurrent(const gl::Context *context) override;
// Caps queries
const gl::Caps &getNativeCaps() const override;
gl::Caps getNativeCaps() const override;
const gl::TextureCapsMap &getNativeTextureCaps() const override;
const gl::Extensions &getNativeExtensions() const override;
const gl::Limitations &getNativeLimitations() const override;
......
......@@ -313,7 +313,7 @@ void ContextNULL::onMakeCurrent(const gl::Context *context)
{
}
const gl::Caps &ContextNULL::getNativeCaps() const
gl::Caps ContextNULL::getNativeCaps() const
{
return mCaps;
}
......
......@@ -152,7 +152,7 @@ class ContextNULL : public ContextImpl
void onMakeCurrent(const gl::Context *context) override;
// Native capabilities, unmodified by gl::Context.
const gl::Caps &getNativeCaps() const override;
gl::Caps getNativeCaps() const override;
const gl::TextureCapsMap &getNativeTextureCaps() const override;
const gl::Extensions &getNativeExtensions() const override;
const gl::Limitations &getNativeLimitations() const override;
......
......@@ -636,7 +636,7 @@ void ContextVk::onMakeCurrent(const gl::Context * /*context*/)
{
}
const gl::Caps &ContextVk::getNativeCaps() const
gl::Caps ContextVk::getNativeCaps() const
{
return mRenderer->getNativeCaps();
}
......
......@@ -97,7 +97,7 @@ class ContextVk : public ContextImpl
void onMakeCurrent(const gl::Context *context) override;
// Native capabilities, unmodified by gl::Context.
const gl::Caps &getNativeCaps() const override;
gl::Caps getNativeCaps() const override;
const gl::TextureCapsMap &getNativeTextureCaps() const override;
const gl::Extensions &getNativeExtensions() const override;
const gl::Limitations &getNativeLimitations() const override;
......
......@@ -55,28 +55,27 @@
1941 OPENGL D3D11 : dEQP-GLES31.functional.geometry_shading.instanced.invocation_per_layer_* = SKIP
1941 OPENGL D3D11 : dEQP-GLES31.functional.geometry_shading.instanced.multiple_layers_per_invocation_* = SKIP
1442 D3D11 : dEQP-GLES31.functional.compute* = SKIP
1729 D3D11 : dEQP-GLES31.functional.atomic_counter.* = SKIP
1951 D3D11 : dEQP-GLES31.functional.layout_binding.ssbo.* = SKIP
1951 D3D11 : dEQP-GLES31.functional.shaders.opaque_type_indexing.ssbo.* = SKIP
1729 D3D11 : dEQP-GLES31.functional.state_query.indexed.atomic_counter_buffer_* = SKIP
1951 D3D11 : dEQP-GLES31.functional.state_query.indexed.shader_storage_buffer_* = SKIP
1442 D3D11 : dEQP-GLES31.functional.program_interface_query.* = SKIP
1442 D3D11 : dEQP-GLES31.functional.synchronization.* = SKIP
1951 D3D11 : dEQP-GLES31.functional.ssbo.* = SKIP
1442 D3D11 : dEQP-GLES31.functional.layout_binding.image.* = SKIP
1951 D3D11 : dEQP-GLES31.functional.shaders.linkage.es31.shader_storage_block.* = SKIP
// D3D11 Failing Tests
1442 D3D11 : dEQP-GLES31.functional.state_query.integer.max_compute_shared_memory_size_* = FAIL
1442 D3D11 : dEQP-GLES31.functional.state_query.integer.max_compute_atomic_counter_buffers_* = FAIL
1442 D3D11 : dEQP-GLES31.functional.state_query.integer.max_compute_atomic_counters_* = FAIL
1442 D3D11 : dEQP-GLES31.functional.state_query.integer.max_compute_shader_storage_blocks_* = FAIL
1442 D3D11 : dEQP-GLES31.functional.state_query.integer.max_atomic_counter_buffer_bindings_* = FAIL
1442 D3D11 : dEQP-GLES31.functional.state_query.integer.max_atomic_counter_buffer_size_* = FAIL
1442 D3D11 : dEQP-GLES31.functional.state_query.integer.max_combined_atomic_counter_buffers_* = FAIL
1442 D3D11 : dEQP-GLES31.functional.state_query.integer.max_combined_atomic_counters* = FAIL
1442 D3D11 : dEQP-GLES31.functional.state_query.integer.max_image_units_* = FAIL
1442 D3D11 : dEQP-GLES31.functional.state_query.integer.max_combined_image_uniforms_* = FAIL
1442 D3D11 : dEQP-GLES31.functional.state_query.integer.max_shader_storage_buffer_bindings_* = FAIL
1442 D3D11 : dEQP-GLES31.functional.state_query.integer.max_shader_storage_block_size_* = FAIL
1442 D3D11 : dEQP-GLES31.functional.state_query.integer.max_combined_shader_storage_blocks_* = FAIL
1442 D3D11 : dEQP-GLES31.functional.state_query.integer.max_uniform_buffer_bindings_* = FAIL
1442 D3D11 : dEQP-GLES31.functional.state_query.integer.max_combined_texture_image_units_* = FAIL
1729 D3D11 : dEQP-GLES31.functional.state_query.indexed.atomic_counter_buffer_* = FAIL
1951 D3D11 : dEQP-GLES31.functional.state_query.indexed.shader_storage_buffer_* = FAIL
1442 D3D11 : dEQP-GLES31.functional.state_query.program.compute_work_group_size_get_programiv = FAIL
1442 D3D11 : dEQP-GLES31.functional.layout_binding.ssbo.* = FAIL
1442 D3D11 : dEQP-GLES31.functional.compute* = FAIL
1442 D3D11 : dEQP-GLES31.functional.atomic_counter.* = FAIL
1442 D3D11 : dEQP-GLES31.functional.debug.async.case_4_log = SKIP
1442 D3D11 : dEQP-GLES31.functional.debug.async.case_5_callback = SKIP
1442 D3D11 : dEQP-GLES31.functional.debug.error_filters.case_2 = SKIP
......@@ -91,7 +90,6 @@
1442 D3D11 : dEQP-GLES31.functional.debug.error_groups.case_10 = SKIP
1442 D3D11 : dEQP-GLES31.functional.state_query.program.active_atomic_counter_buffers_get_programiv = FAIL
1442 D3D11 : dEQP-GLES31.functional.layout_binding.ubo.* = FAIL
1442 D3D11 : dEQP-GLES31.functional.program_interface_query.* = FAIL
1663 D3D11 : dEQP-GLES31.functional.draw_indirect.compute_interop.* = FAIL
1442 D3D11 : dEQP-GLES31.functional.shaders.builtin_constants.core.max_vertex_attribs = FAIL
1442 D3D11 : dEQP-GLES31.functional.shaders.builtin_constants.core.max_vertex_uniform_vectors = FAIL
......@@ -1130,16 +1128,6 @@
1951 D3D11 : dEQP-GLES31.functional.shaders.builtin_functions.precision.inverse.mediump_compute.mat2 = FAIL
1951 D3D11 : dEQP-GLES31.functional.shaders.builtin_functions.precision.frexp.* = FAIL
1951 D3D11 : dEQP-GLES31.functional.shaders.builtin_functions.precision.ldexp.* = FAIL
1951 D3D11 : dEQP-GLES31.functional.shaders.linkage.shader_storage_block.mismatch_number_of_declarations = FAIL
1951 D3D11 : dEQP-GLES31.functional.shaders.linkage.shader_storage_block.mismatch_order = FAIL
1951 D3D11 : dEQP-GLES31.functional.shaders.linkage.shader_storage_block.mismatch_type = FAIL
1951 D3D11 : dEQP-GLES31.functional.shaders.linkage.shader_storage_block.mismatch_member_name = FAIL
1951 D3D11 : dEQP-GLES31.functional.shaders.linkage.shader_storage_block.mismatch_member_unsized_sized_array = FAIL
1951 D3D11 : dEQP-GLES31.functional.shaders.linkage.shader_storage_block.mismatch_member_array_size = FAIL
1951 D3D11 : dEQP-GLES31.functional.shaders.linkage.shader_storage_block.mismatch_with_and_without_instance_name = FAIL
1951 D3D11 : dEQP-GLES31.functional.shaders.linkage.shader_storage_block.mismatch_block_array_size = FAIL
1442 D3D11 : dEQP-GLES31.functional.synchronization.* = FAIL
1951 D3D11 : dEQP-GLES31.functional.ssbo.* = FAIL
1442 D3D11 : dEQP-GLES31.functional.shaders.builtin_var.compute.num_work_groups = FAIL
1442 D3D11 : dEQP-GLES31.functional.shaders.builtin_var.compute.work_group_size = FAIL
1442 D3D11 : dEQP-GLES31.functional.shaders.builtin_var.compute.work_group_id = FAIL
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment