Commit 89c422ad by Xinghua Cao Committed by Commit Bot

ES31: Support memoryBarrier and memoryBarrierRegion APIs

BUG=angleproject:2280 TEST=dEQP-GLES31.functional.compute.basic.image_barrier_single dEQP-GLES31.functional.compute.basic.image_barrier_multiple dEQP-GLES31.functional.compute.basic.ssbo_cmd_barrier_single dEQP-GLES31.functional.compute.basic.ssbo_cmd_barrier_multiple dEQP-GLES31.functional.synchronization.* Change-Id: If14debab21247dc4b446e86d1642fbc9376b6dd7 Reviewed-on: https://chromium-review.googlesource.com/798803 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 37385e11
...@@ -4277,12 +4277,12 @@ void Context::texStorage3D(GLenum target, ...@@ -4277,12 +4277,12 @@ void Context::texStorage3D(GLenum target,
void Context::memoryBarrier(GLbitfield barriers) void Context::memoryBarrier(GLbitfield barriers)
{ {
UNIMPLEMENTED(); handleError(mImplementation->memoryBarrier(this, barriers));
} }
void Context::memoryBarrierByRegion(GLbitfield barriers) void Context::memoryBarrierByRegion(GLbitfield barriers)
{ {
UNIMPLEMENTED(); handleError(mImplementation->memoryBarrierByRegion(this, barriers));
} }
GLenum Context::checkFramebufferStatus(GLenum target) GLenum Context::checkFramebufferStatus(GLenum target)
......
...@@ -76,6 +76,7 @@ ERRMSG(InvalidImageUnit, ...@@ -76,6 +76,7 @@ ERRMSG(InvalidImageUnit,
"Image unit cannot be greater than or equal to the value of MAX_IMAGE_UNITS."); "Image unit cannot be greater than or equal to the value of MAX_IMAGE_UNITS.");
ERRMSG(InvalidInternalFormat, "Invalid internal format."); ERRMSG(InvalidInternalFormat, "Invalid internal format.");
ERRMSG(InvalidMatrixMode, "Invalid matrix mode."); ERRMSG(InvalidMatrixMode, "Invalid matrix mode.");
ERRMSG(InvalidMemoryBarrierBit, "Invalid memory barrier bit.");
ERRMSG(InvalidMipLevel, "Level of detail outside of range."); ERRMSG(InvalidMipLevel, "Level of detail outside of range.");
ERRMSG(InvalidName, "Invalid name."); ERRMSG(InvalidName, "Invalid name.");
ERRMSG(InvalidNameCharacters, "Name contains invalid characters."); ERRMSG(InvalidNameCharacters, "Name contains invalid characters.");
......
...@@ -161,6 +161,8 @@ class ContextImpl : public GLImplFactory ...@@ -161,6 +161,8 @@ class ContextImpl : public GLImplFactory
GLuint numGroupsX, GLuint numGroupsX,
GLuint numGroupsY, GLuint numGroupsY,
GLuint numGroupsZ) = 0; GLuint numGroupsZ) = 0;
virtual gl::Error memoryBarrier(const gl::Context *context, GLbitfield barriers) = 0;
virtual gl::Error memoryBarrierByRegion(const gl::Context *context, GLbitfield barriers) = 0;
const gl::ContextState &getContextState() { return mState; } const gl::ContextState &getContextState() { return mState; }
int getClientMajorVersion() const { return mState.getClientMajorVersion(); } int getClientMajorVersion() const { return mState.getClientMajorVersion(); }
......
...@@ -402,4 +402,16 @@ gl::Error Context11::prepareForDrawCall(const gl::Context *context, GLenum drawM ...@@ -402,4 +402,16 @@ gl::Error Context11::prepareForDrawCall(const gl::Context *context, GLenum drawM
return gl::NoError(); return gl::NoError();
} }
gl::Error Context11::memoryBarrier(const gl::Context *context, GLbitfield barriers)
{
UNIMPLEMENTED();
return gl::NoError();
}
gl::Error Context11::memoryBarrierByRegion(const gl::Context *context, GLbitfield barriers)
{
UNIMPLEMENTED();
return gl::NoError();
}
} // namespace rx } // namespace rx
...@@ -142,6 +142,9 @@ class Context11 : public ContextImpl ...@@ -142,6 +142,9 @@ class Context11 : public ContextImpl
GLuint numGroupsY, GLuint numGroupsY,
GLuint numGroupsZ) override; GLuint numGroupsZ) override;
gl::Error memoryBarrier(const gl::Context *context, GLbitfield barriers) override;
gl::Error memoryBarrierByRegion(const gl::Context *context, GLbitfield barriers) override;
gl::Error triggerDrawCallProgramRecompilation(const gl::Context *context, GLenum drawMode); gl::Error triggerDrawCallProgramRecompilation(const gl::Context *context, GLenum drawMode);
private: private:
......
...@@ -300,4 +300,16 @@ gl::Error Context9::dispatchCompute(const gl::Context *context, ...@@ -300,4 +300,16 @@ gl::Error Context9::dispatchCompute(const gl::Context *context,
return gl::InternalError() << "D3D9 doesn't support ES 3.1 DispatchCompute API"; return gl::InternalError() << "D3D9 doesn't support ES 3.1 DispatchCompute API";
} }
gl::Error Context9::memoryBarrier(const gl::Context *context, GLbitfield barriers)
{
UNREACHABLE();
return gl::InternalError() << "D3D9 doesn't support ES 3.1 memoryBarrier API";
}
gl::Error Context9::memoryBarrierByRegion(const gl::Context *context, GLbitfield barriers)
{
UNREACHABLE();
return gl::InternalError() << "D3D9 doesn't support ES 3.1 memoryBarrierByRegion API";
}
} // namespace rx } // namespace rx
...@@ -139,6 +139,8 @@ class Context9 : public ContextImpl ...@@ -139,6 +139,8 @@ class Context9 : public ContextImpl
GLuint numGroupsX, GLuint numGroupsX,
GLuint numGroupsY, GLuint numGroupsY,
GLuint numGroupsZ) override; GLuint numGroupsZ) override;
gl::Error memoryBarrier(const gl::Context *context, GLbitfield barriers) override;
gl::Error memoryBarrierByRegion(const gl::Context *context, GLbitfield barriers) override;
Renderer9 *getRenderer() const { return mRenderer; } Renderer9 *getRenderer() const { return mRenderer; }
......
...@@ -420,4 +420,13 @@ gl::Error ContextGL::dispatchCompute(const gl::Context *context, ...@@ -420,4 +420,13 @@ gl::Error ContextGL::dispatchCompute(const gl::Context *context,
return mRenderer->dispatchCompute(context, numGroupsX, numGroupsY, numGroupsZ); return mRenderer->dispatchCompute(context, numGroupsX, numGroupsY, numGroupsZ);
} }
gl::Error ContextGL::memoryBarrier(const gl::Context *context, GLbitfield barriers)
{
return mRenderer->memoryBarrier(barriers);
}
gl::Error ContextGL::memoryBarrierByRegion(const gl::Context *context, GLbitfield barriers)
{
return mRenderer->memoryBarrierByRegion(barriers);
}
} // namespace rx } // namespace rx
...@@ -198,6 +198,8 @@ class ContextGL : public ContextImpl ...@@ -198,6 +198,8 @@ class ContextGL : public ContextImpl
GLuint numGroupsX, GLuint numGroupsX,
GLuint numGroupsY, GLuint numGroupsY,
GLuint numGroupsZ) override; GLuint numGroupsZ) override;
gl::Error memoryBarrier(const gl::Context *context, GLbitfield barriers) override;
gl::Error memoryBarrierByRegion(const gl::Context *context, GLbitfield barriers) override;
private: private:
RendererGL *mRenderer; RendererGL *mRenderer;
......
...@@ -734,4 +734,15 @@ gl::Error RendererGL::dispatchCompute(const gl::Context *context, ...@@ -734,4 +734,15 @@ gl::Error RendererGL::dispatchCompute(const gl::Context *context,
return gl::NoError(); return gl::NoError();
} }
gl::Error RendererGL::memoryBarrier(GLbitfield barriers)
{
mFunctions->memoryBarrier(barriers);
return gl::NoError();
}
gl::Error RendererGL::memoryBarrierByRegion(GLbitfield barriers)
{
mFunctions->memoryBarrierByRegion(barriers);
return gl::NoError();
}
} // namespace rx } // namespace rx
...@@ -177,6 +177,8 @@ class RendererGL : angle::NonCopyable ...@@ -177,6 +177,8 @@ class RendererGL : angle::NonCopyable
GLuint numGroupsX, GLuint numGroupsX,
GLuint numGroupsY, GLuint numGroupsY,
GLuint numGroupsZ); GLuint numGroupsZ);
gl::Error memoryBarrier(GLbitfield barriers);
gl::Error memoryBarrierByRegion(GLbitfield barriers);
private: private:
void ensureCapsInitialized() const; void ensureCapsInitialized() const;
......
...@@ -415,4 +415,14 @@ gl::Error ContextNULL::dispatchCompute(const gl::Context *context, ...@@ -415,4 +415,14 @@ gl::Error ContextNULL::dispatchCompute(const gl::Context *context,
return gl::NoError(); return gl::NoError();
} }
gl::Error ContextNULL::memoryBarrier(const gl::Context *context, GLbitfield barriers)
{
return gl::NoError();
}
gl::Error ContextNULL::memoryBarrierByRegion(const gl::Context *context, GLbitfield barriers)
{
return gl::NoError();
}
} // namespace rx } // namespace rx
...@@ -198,6 +198,8 @@ class ContextNULL : public ContextImpl ...@@ -198,6 +198,8 @@ class ContextNULL : public ContextImpl
GLuint numGroupsX, GLuint numGroupsX,
GLuint numGroupsY, GLuint numGroupsY,
GLuint numGroupsZ) override; GLuint numGroupsZ) override;
gl::Error memoryBarrier(const gl::Context *context, GLbitfield barriers) override;
gl::Error memoryBarrierByRegion(const gl::Context *context, GLbitfield barriers) override;
private: private:
gl::Caps mCaps; gl::Caps mCaps;
......
...@@ -884,6 +884,18 @@ gl::Error ContextVk::dispatchCompute(const gl::Context *context, ...@@ -884,6 +884,18 @@ gl::Error ContextVk::dispatchCompute(const gl::Context *context,
return gl::InternalError(); return gl::InternalError();
} }
gl::Error ContextVk::memoryBarrier(const gl::Context *context, GLbitfield barriers)
{
UNIMPLEMENTED();
return gl::InternalError();
}
gl::Error ContextVk::memoryBarrierByRegion(const gl::Context *context, GLbitfield barriers)
{
UNIMPLEMENTED();
return gl::InternalError();
}
vk::DescriptorPool *ContextVk::getDescriptorPool() vk::DescriptorPool *ContextVk::getDescriptorPool()
{ {
return &mDescriptorPool; return &mDescriptorPool;
......
...@@ -153,6 +153,8 @@ class ContextVk : public ContextImpl, public ResourceVk ...@@ -153,6 +153,8 @@ class ContextVk : public ContextImpl, public ResourceVk
GLuint numGroupsX, GLuint numGroupsX,
GLuint numGroupsY, GLuint numGroupsY,
GLuint numGroupsZ) override; GLuint numGroupsZ) override;
gl::Error memoryBarrier(const gl::Context *context, GLbitfield barriers) override;
gl::Error memoryBarrierByRegion(const gl::Context *context, GLbitfield barriers) override;
vk::DescriptorPool *getDescriptorPool(); vk::DescriptorPool *getDescriptorPool();
......
...@@ -1754,14 +1754,56 @@ bool ValidateGetProgramPipelineInfoLog(Context *context, ...@@ -1754,14 +1754,56 @@ bool ValidateGetProgramPipelineInfoLog(Context *context,
bool ValidateMemoryBarrier(Context *context, GLbitfield barriers) bool ValidateMemoryBarrier(Context *context, GLbitfield barriers)
{ {
UNIMPLEMENTED(); if (context->getClientVersion() < ES_3_1)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false; return false;
}
if (barriers == GL_ALL_BARRIER_BITS)
{
return true;
}
GLbitfield supported_barrier_bits =
GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT | GL_ELEMENT_ARRAY_BARRIER_BIT | GL_UNIFORM_BARRIER_BIT |
GL_TEXTURE_FETCH_BARRIER_BIT | GL_SHADER_IMAGE_ACCESS_BARRIER_BIT | GL_COMMAND_BARRIER_BIT |
GL_PIXEL_BUFFER_BARRIER_BIT | GL_TEXTURE_UPDATE_BARRIER_BIT | GL_BUFFER_UPDATE_BARRIER_BIT |
GL_FRAMEBUFFER_BARRIER_BIT | GL_TRANSFORM_FEEDBACK_BARRIER_BIT |
GL_ATOMIC_COUNTER_BARRIER_BIT | GL_SHADER_STORAGE_BARRIER_BIT;
if ((barriers & ~supported_barrier_bits) != 0)
{
ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidMemoryBarrierBit);
return false;
}
return true;
} }
bool ValidateMemoryBarrierByRegion(Context *context, GLbitfield barriers) bool ValidateMemoryBarrierByRegion(Context *context, GLbitfield barriers)
{ {
UNIMPLEMENTED(); if (context->getClientVersion() < ES_3_1)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false; return false;
}
if (barriers == GL_ALL_BARRIER_BITS)
{
return true;
}
GLbitfield supported_barrier_bits = GL_ATOMIC_COUNTER_BARRIER_BIT | GL_FRAMEBUFFER_BARRIER_BIT |
GL_SHADER_IMAGE_ACCESS_BARRIER_BIT |
GL_SHADER_STORAGE_BARRIER_BIT |
GL_TEXTURE_FETCH_BARRIER_BIT | GL_UNIFORM_BARRIER_BIT;
if ((barriers & ~supported_barrier_bits) != 0)
{
ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidMemoryBarrierBit);
return false;
}
return true;
} }
bool ValidateSampleMaski(Context *context, GLuint maskNumber, GLbitfield mask) bool ValidateSampleMaski(Context *context, GLuint maskNumber, GLbitfield mask)
......
...@@ -1100,6 +1100,7 @@ ...@@ -1100,6 +1100,7 @@
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_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_with_and_without_instance_name = FAIL
1951 D3D11 : dEQP-GLES31.functional.shaders.linkage.shader_storage_block.mismatch_block_array_size = 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 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.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_size = FAIL
...@@ -1126,10 +1127,6 @@ ...@@ -1126,10 +1127,6 @@
1442 OPENGL : dEQP-GLES31.functional.program_interface_query.uniform_block.referenced_by.* = FAIL 1442 OPENGL : dEQP-GLES31.functional.program_interface_query.uniform_block.referenced_by.* = FAIL
1442 OPENGL : dEQP-GLES31.functional.compute.basic.copy_image_to_ssbo_large = FAIL 1442 OPENGL : dEQP-GLES31.functional.compute.basic.copy_image_to_ssbo_large = FAIL
1442 OPENGL : dEQP-GLES31.functional.compute.basic.copy_ssbo_to_image_large = FAIL 1442 OPENGL : dEQP-GLES31.functional.compute.basic.copy_ssbo_to_image_large = FAIL
2280 OPENGL : dEQP-GLES31.functional.compute.basic.ssbo_cmd_barrier_single = FAIL
2280 OPENGL : dEQP-GLES31.functional.compute.basic.ssbo_cmd_barrier_multiple = FAIL
2280 OPENGL : dEQP-GLES31.functional.compute.basic.image_barrier_single = FAIL
2280 OPENGL : dEQP-GLES31.functional.compute.basic.image_barrier_multiple = FAIL
2270 OPENGL : dEQP-GLES31.functional.compute.indirect_dispatch.* = FAIL 2270 OPENGL : dEQP-GLES31.functional.compute.indirect_dispatch.* = FAIL
2272 WIN NVIDIA OPENGL : dEQP-GLES31.functional.ssbo.layout.2_level_unsized* = FAIL 2272 WIN NVIDIA OPENGL : dEQP-GLES31.functional.ssbo.layout.2_level_unsized* = FAIL
2272 WIN NVIDIA OPENGL : dEQP-GLES31.functional.ssbo.layout.3_level_unsized* = FAIL 2272 WIN NVIDIA OPENGL : dEQP-GLES31.functional.ssbo.layout.3_level_unsized* = FAIL
...@@ -1210,7 +1207,7 @@ ...@@ -1210,7 +1207,7 @@
1442 OPENGL D3D11 : dEQP-GLES31.functional.state_query.internal_format.renderbuffer.rgba32ui_samples = FAIL 1442 OPENGL D3D11 : dEQP-GLES31.functional.state_query.internal_format.renderbuffer.rgba32ui_samples = FAIL
1442 OPENGL D3D11 : dEQP-GLES31.functional.state_query.program.program_separable_get_programiv = FAIL 1442 OPENGL D3D11 : dEQP-GLES31.functional.state_query.program.program_separable_get_programiv = FAIL
1442 OPENGL D3D11 : dEQP-GLES31.functional.state_query.program_pipeline.* = FAIL 1442 OPENGL D3D11 : dEQP-GLES31.functional.state_query.program_pipeline.* = FAIL
1442 OPENGL D3D11 : dEQP-GLES31.functional.synchronization.* = FAIL 1442 OPENGL D3D11 : dEQP-GLES31.functional.synchronization.inter_call.without_memory_barrier.atomic_counter_dispatch_100_calls_1k_invocations = FAIL
1442 OPENGL D3D11 : dEQP-GLES31.functional.separate_shader.* = FAIL 1442 OPENGL D3D11 : dEQP-GLES31.functional.separate_shader.* = FAIL
1442 OPENGL D3D11 : dEQP-GLES31.functional.debug.error_filters.case_11 = FAIL 1442 OPENGL D3D11 : dEQP-GLES31.functional.debug.error_filters.case_11 = FAIL
1442 OPENGL D3D11 : dEQP-GLES31.functional.debug.error_groups.case_11 = FAIL 1442 OPENGL D3D11 : dEQP-GLES31.functional.debug.error_groups.case_11 = 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