Changeset 282627 in webkit
- Timestamp:
- Sep 16, 2021, 6:59:06 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/TestExpectations (modified) (1 diff)
-
Source/ThirdParty/ANGLE/ChangeLog (modified) (1 diff)
-
Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/mtl_utils.mm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r282626 r282627 1 2021-09-16 Kyle Piddington <kpiddington@apple.com> 2 3 webgl/2.0.y/conformance/extensions/webgl-compressed-texture-s3tc-srgb.html fails on Intel+AMD Metal 4 https://bugs.webkit.org/show_bug.cgi?id=229941 5 6 Zero-initialize compressed textures explicitly, as they aren't implicitly initalized in Metal. 7 Reviewed by Kenneth Russell <kbr@chromium.org>. 8 9 * TestExpectations: 10 1 11 2021-09-16 Cameron McCormack <heycam@apple.com> 2 12 -
trunk/LayoutTests/TestExpectations
r282626 r282627 3697 3697 webgl/2.0.y/conformance2/vertex_arrays/vertex-array-object.html [ Pass ] 3698 3698 webgl/1.0.x/conformance/extensions/oes-vertex-array-object.html [ Pass ] 3699 3700 # Explicitly turn on conformance test until all of webgl/2.0.y is enabled 3701 webgl/2.0.y/conformance/extensions/webgl-compressed-texture-s3tc-srgb.html [ Pass ] 3699 3702 3700 3703 # WebGL 1.0.3 and 2.0.0 tests where behavior is obsolete and WebKit contains implementation -
trunk/Source/ThirdParty/ANGLE/ChangeLog
r281794 r282627 1 2021-09-16 Kyle Piddington <kpiddington@apple.com> 2 3 webgl/2.0.y/conformance/extensions/webgl-compressed-texture-s3tc-srgb.html fails on Intel+AMD Metal 4 https://bugs.webkit.org/show_bug.cgi?id=229941 5 6 Zero-initialize compressed textures explicitly, as they aren't implicitly initalized in Metal. 7 Reviewed by Kenneth Russell <kbr@chromium.org>. 8 9 * src/libANGLE/renderer/metal/mtl_utils.h: 10 * src/libANGLE/renderer/metal/mtl_utils.mm: 11 (rx::mtl::GetCompressedBufferForTextureWithFormat): 12 (rx::mtl::InitializeCompressedTextureContents): 13 (rx::mtl::InitializeTextureContents): 14 1 15 2021-08-31 Kimmo Kinnunen <kkinnunen@apple.com> 2 16 -
trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/mtl_utils.mm
r279606 r282627 104 104 } 105 105 106 bool GetCompressedBufferSizeAndRowLengthForTextureWithFormat(const TextureRef &texture, 107 const Format &textureObjFormat, 108 const ImageNativeIndex &index, 109 size_t *bytesPerRowOut, 110 size_t *bytesPerImageOut) 111 { 112 gl::Extents size = texture->size(index); 113 GLuint bufferSizeInBytes; 114 uint32_t bufferRowLength; 115 if (!textureObjFormat.intendedInternalFormat().computeCompressedImageSize(size, 116 &bufferSizeInBytes)) 117 { 118 return false; 119 } 120 if (!textureObjFormat.intendedInternalFormat().computeBufferRowLength(size.width, 121 &bufferRowLength)) 122 { 123 return false; 124 } 125 *bytesPerImageOut = bufferSizeInBytes; 126 *bytesPerRowOut = bufferRowLength; 127 return true; 128 } 129 130 static angle::Result InitializeCompressedTextureContents(const gl::Context *context, 131 const TextureRef &texture, 132 const Format &textureObjFormat, 133 const ImageNativeIndex &index, 134 const uint layer, 135 const uint startDepth) 136 { 137 assert(textureObjFormat.actualAngleFormat().isBlock); 138 size_t bytesPerRow = 0; 139 size_t bytesPerImage = 0; 140 141 if (!GetCompressedBufferSizeAndRowLengthForTextureWithFormat(texture, textureObjFormat, index, 142 &bytesPerRow, &bytesPerImage)) 143 { 144 return angle::Result::Stop; 145 } 146 ContextMtl *contextMtl = mtl::GetImpl(context); 147 gl::Extents extents = texture->size(index); 148 if (texture->isCPUAccessible()) 149 { 150 angle::MemoryBuffer buffer; 151 if (!buffer.resize(bytesPerImage)) 152 { 153 return angle::Result::Stop; 154 } 155 buffer.fill(0); 156 for (NSUInteger d = 0; d < static_cast<NSUInteger>(extents.depth); ++d) 157 { 158 auto mtlTextureRegion = MTLRegionMake2D(0, 0, extents.width, extents.height); 159 mtlTextureRegion.origin.z = d + startDepth; 160 texture->replaceRegion(contextMtl, mtlTextureRegion, index.getNativeLevel(), layer, 161 buffer.data(), bytesPerRow, 0); 162 } 163 } 164 else 165 { 166 mtl::BufferRef zeroBuffer; 167 ANGLE_TRY(mtl::Buffer::MakeBuffer(contextMtl, bytesPerImage, nullptr, &zeroBuffer)); 168 mtl::BlitCommandEncoder *blitEncoder = contextMtl->getBlitCommandEncoder(); 169 for (NSUInteger d = 0; d < static_cast<NSUInteger>(extents.depth); ++d) 170 { 171 auto blitOrigin = MTLOriginMake(0, 0, d + startDepth); 172 blitEncoder->copyBufferToTexture(zeroBuffer, 0, bytesPerRow, 0, 173 MTLSizeMake(extents.width, extents.height, 1), texture, 174 layer, index.getNativeLevel(), blitOrigin, 0); 175 } 176 177 blitEncoder->endEncoding(); 178 } 179 return angle::Result::Continue; 180 } 181 106 182 angle::Result InitializeTextureContents(const gl::Context *context, 107 183 const TextureRef &texture, … … 119 195 forceGPUInitialization = true; 120 196 #endif // TARGET_OS_SIMULATOR 121 197 122 198 // This function is called in many places to initialize the content of a texture. 123 199 // So it's better we do the sanity check here instead of let the callers do it themselves: 124 if (!textureObjFormat.valid() || actualAngleFormat.isBlock || actualAngleFormat.depthBits > 0 || 200 // TODO: (kpiddington) update InitializeTextureContents with an upstreamed version that handles 201 // depth/stencil textures. 202 if (!textureObjFormat.valid() || actualAngleFormat.depthBits > 0 || 125 203 actualAngleFormat.stencilBits > 0) 126 204 { 127 // If dst format is compressed, ignore.205 // Depth or stencil textures need an updated path. 128 206 return angle::Result::Continue; 129 207 } … … 151 229 break; 152 230 } 231 } 232 233 if (actualAngleFormat.isBlock) 234 { 235 return InitializeCompressedTextureContents(context, texture, textureObjFormat, index, layer, 236 startDepth); 153 237 } 154 238
Note:
See TracChangeset
for help on using the changeset viewer.