Title: [275012] trunk/Source/ThirdParty/ANGLE
- Revision
- 275012
- Author
- [email protected]
- Date
- 2021-03-24 23:10:22 -0700 (Wed, 24 Mar 2021)
Log Message
Metal ANGLE non-blockers: Fix webgl/1.0.3/conformance/uniforms/uniform-default-values.html, Stencil debug layer assertions
https://bugs.webkit.org/show_bug.cgi?id=223667
https://bugs.webkit.org/show_bug.cgi?id=223667
On Release, uniformDefaultValues was resetting program memory
either early, or oddly. Since program reflection should be constant
per Shader anyway, drop the 'reset' after assigning reflection data.
In addition, clamp stencil rectangle to always be within framebuffer bounds. Code taken from upstream ANGLE.
Patch by Kyle Piddington <[email protected]> on 2021-03-24
Reviewed by Dean Jackson.
* src/libANGLE/renderer/metal/ProgramMtl.mm:
(rx::ProgramMtl::linkImplDirect):
* src/libANGLE/renderer/metal/mtl_command_buffer.mm:
(rx::mtl::RenderCommandEncoder::initAttachmentWriteDependencyAndScissorRect):
(rx::mtl::RenderCommandEncoder::restart):
(rx::mtl::RenderCommandEncoder::setScissorRect):
* src/libANGLE/renderer/metal/mtl_glslang_mtl_utils.mm:
(rx::mtl::TranslatedShaderInfo::reset):
(rx::mtl::GlslangGetMSL):
Modified Paths
Diff
Modified: trunk/Source/ThirdParty/ANGLE/ChangeLog (275011 => 275012)
--- trunk/Source/ThirdParty/ANGLE/ChangeLog 2021-03-25 05:46:13 UTC (rev 275011)
+++ trunk/Source/ThirdParty/ANGLE/ChangeLog 2021-03-25 06:10:22 UTC (rev 275012)
@@ -1,8 +1,34 @@
2021-03-24 Kyle Piddington <[email protected]>
+ Metal ANGLE non-blockers: Fix webgl/1.0.3/conformance/uniforms/uniform-default-values.html, Stencil debug layer assertions
+ https://bugs.webkit.org/show_bug.cgi?id=223667
+
+ https://bugs.webkit.org/show_bug.cgi?id=223667
+
+ On Release, uniformDefaultValues was resetting program memory
+ either early, or oddly. Since program reflection should be constant
+ per Shader anyway, drop the 'reset' after assigning reflection data.
+
+ In addition, clamp stencil rectangle to always be within framebuffer bounds. Code taken from upstream ANGLE.
+
+
+ Reviewed by Dean Jackson.
+
+ * src/libANGLE/renderer/metal/ProgramMtl.mm:
+ (rx::ProgramMtl::linkImplDirect):
+ * src/libANGLE/renderer/metal/mtl_command_buffer.mm:
+ (rx::mtl::RenderCommandEncoder::initAttachmentWriteDependencyAndScissorRect):
+ (rx::mtl::RenderCommandEncoder::restart):
+ (rx::mtl::RenderCommandEncoder::setScissorRect):
+ * src/libANGLE/renderer/metal/mtl_glslang_mtl_utils.mm:
+ (rx::mtl::TranslatedShaderInfo::reset):
+ (rx::mtl::GlslangGetMSL):
+
+2021-03-24 Kyle Piddington <[email protected]>
+
Metal ANGLE crashes LayoutTests/inspector/canvas/updateShader-webgl.html
- Rather than rely on an instance variable in a C++ class, just query the dictionary constant when needed.
-
+ Rather than rely on an instance variable in a C++ class, just query the dictionary constant when needed.
+
https://bugs.webkit.org/show_bug.cgi?id=223695
Reviewed by Dean Jackson.
Modified: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/mtl_command_buffer.mm (275011 => 275012)
--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/mtl_command_buffer.mm 2021-03-25 05:46:13 UTC (rev 275011)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/mtl_command_buffer.mm 2021-03-25 06:10:22 UTC (rev 275012)
@@ -1128,6 +1128,24 @@
mStateCache.reset();
}
+
+inline void RenderCommandEncoder::initAttachmentWriteDependencyAndScissorRect(
+ const RenderPassAttachmentDesc &attachment)
+{
+ TextureRef texture = attachment.texture();
+ if (texture)
+ {
+ cmdBuffer().setWriteDependency(texture);
+
+ const MipmapNativeLevel &mipLevel = attachment.level();
+
+ mRenderPassMaxScissorRect.width =
+ std::min<NSUInteger>(mRenderPassMaxScissorRect.width, texture->width(mipLevel));
+ mRenderPassMaxScissorRect.height =
+ std::min<NSUInteger>(mRenderPassMaxScissorRect.height, texture->height(mipLevel));
+ }
+}
+
inline void RenderCommandEncoder::initWriteDependency(const TextureRef &texture)
{
if (texture)
@@ -1248,16 +1266,19 @@
mRenderPassDesc = desc;
mRecording = true;
mHasDrawCalls = false;
-
+ mRenderPassMaxScissorRect = {.x = 0,
+ .y = 0,
+ .width = std::numeric_limits<NSUInteger>::max(),
+ .height = std::numeric_limits<NSUInteger>::max()};
// mask writing dependency & set appropriate store options
for (uint32_t i = 0; i < mRenderPassDesc.numColorAttachments; ++i)
{
- initWriteDependency(mRenderPassDesc.colorAttachments[i].texture());
+ initAttachmentWriteDependencyAndScissorRect(mRenderPassDesc.colorAttachments[i]);
}
- initWriteDependency(mRenderPassDesc.depthAttachment.texture());
+ initAttachmentWriteDependencyAndScissorRect(mRenderPassDesc.depthAttachment);
- initWriteDependency(mRenderPassDesc.stencilAttachment.texture());
+ initAttachmentWriteDependencyAndScissorRect(mRenderPassDesc.stencilAttachment);
// Convert to Objective-C descriptor
mRenderPassDesc.convertToMetalDesc(mCachedRenderPassDescObjC);
@@ -1388,13 +1409,25 @@
RenderCommandEncoder &RenderCommandEncoder::setScissorRect(const MTLScissorRect &rect)
{
- if (mStateCache.scissorRect.valid() && mStateCache.scissorRect.value() == rect)
+ NSUInteger clampedWidth = rect.x > mRenderPassMaxScissorRect.width ? 0 : mRenderPassMaxScissorRect.width - rect.x;
+ NSUInteger clampedHeight = rect.y > mRenderPassMaxScissorRect.height ? 0 : mRenderPassMaxScissorRect.height - rect.y;
+
+ MTLScissorRect clampedRect = {
+ rect.x, rect.y, std::min(rect.width, clampedWidth), std::min(rect.height, clampedHeight) };
+
+ if (mStateCache.scissorRect.valid() && mStateCache.scissorRect.value() == clampedRect)
{
return *this;
}
- mStateCache.scissorRect = rect;
+
+ if (ANGLE_UNLIKELY(clampedRect.width == 0 || clampedRect.height == 0))
+ {
+ //An empty rectangle isn't a valid scissor.
+ return *this;
+ }
+ mStateCache.scissorRect = clampedRect;
- mCommands.push(CmdType::SetScissorRect).push(rect);
+ mCommands.push(CmdType::SetScissorRect).push(clampedRect);
return *this;
}
Modified: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/mtl_glslang_mtl_utils.mm (275011 => 275012)
--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/mtl_glslang_mtl_utils.mm 2021-03-25 05:46:13 UTC (rev 275011)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/mtl_glslang_mtl_utils.mm 2021-03-25 06:10:22 UTC (rev 275012)
@@ -46,8 +46,8 @@
for (mtl::SamplerBinding &binding : actualSamplerBindings)
{
binding.textureBinding = mtl::kMaxShaderSamplers;
+ binding.samplerBinding = 0;
}
-
for (uint32_t &binding : actualUBOBindings)
{
binding = mtl::kMaxShaderBuffers;
@@ -428,7 +428,7 @@
(*mslCodeOut)[type] = source;
(*mslShaderInfoOut)[type].metalShaderSource = source;
gl::Shader *shader = programState.getAttachedShader(type);
- sh::TranslatorMetalReflection *reflection = getReflectionFromShader(shader);
+ const sh::TranslatorMetalReflection *reflection = getReflectionFromShader(shader);
if(reflection->hasUBOs)
{
(*mslShaderInfoOut)[type].hasUBOArgumentBuffer = true;
@@ -454,7 +454,6 @@
GetAssignedSamplerBindings(reflection, originalSamplerBindings, structSamplers,
&mslShaderInfoOut->at(type).actualSamplerBindings);
}
- reflection->reset();
}
return angle::Result::Continue;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes