Changeset 95870 in webkit
- Timestamp:
- Sep 23, 2011 3:28:55 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 1 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r95869 r95870 1 2011-09-23 David Reveman <reveman@chromium.org> 2 3 [Chromium] Fix CSS 3D corner anti-aliasing. 4 https://bugs.webkit.org/show_bug.cgi?id=68087 5 6 Reviewed by James Robinson. 7 8 Add a test to check sharp corner rendering of CSS 3D transformed 9 elements. 10 11 * platform/chromium-gpu-linux/compositing/flat-with-transformed-child-expected.checksum: Removed. 12 * platform/chromium-gpu-linux/compositing/flat-with-transformed-child-expected.png: Added. 13 * platform/chromium-gpu-linux/platform/chromium/compositing/3d-corners-expected.png: Added. 14 * platform/chromium-gpu-linux/platform/chromium/compositing/backface-visibility-transformed-expected.png: 15 * platform/chromium-gpu-linux/platform/chromium/compositing/perpendicular-layer-sorting-expected.png: 16 * platform/chromium/compositing/3d-corners-expected.txt: Added. 17 * platform/chromium/compositing/3d-corners.html: Added. 18 * platform/chromium/test_expectations.txt: 19 1 20 2011-09-23 Mihai Parparita <mihaip@chromium.org> 2 21 -
trunk/LayoutTests/platform/chromium/test_expectations.txt
r95869 r95870 3339 3339 BUGWK57311 SKIP : fast/exclusions = PASS 3340 3340 3341 BUGWK68087 WIN MAC GPU GPU-CG : compositing/flat-with-transformed-child.html = IMAGE 3342 BUGWK68087 WIN MAC GPU GPU-CG : platform/chromium/compositing/3d-corners.html = IMAGE 3343 BUGWK68087 WIN MAC GPU GPU-CG : platform/chromium/compositing/backface-visibility-transformed.html = IMAGE 3344 BUGWK68087 WIN MAC GPU GPU-CG : platform/chromium/compositing/perpendicular-layer-sorting.html = IMAGE 3345 3341 3346 BUGCR85755 : fast/js/exception-properties.html = TEXT 3342 3347 -
trunk/Source/WebCore/ChangeLog
r95865 r95870 1 2011-09-23 David Reveman <reveman@chromium.org> 2 3 [Chromium] Fix CSS 3D corner anti-aliasing. 4 https://bugs.webkit.org/show_bug.cgi?id=68087 5 6 Reviewed by James Robinson. 7 8 Render sharp corners more correctly by adding bounding box 9 edges to anti-aliasing shaders. 10 11 Test: platform/chromium/compositing/3d-corners.html 12 13 * platform/graphics/chromium/ShaderChromium.cpp: 14 (WebCore::FragmentShaderRGBATexAlphaAA::getShaderString): 15 (WebCore::FragmentShaderRGBATexClampAlphaAA::getShaderString): 16 (WebCore::FragmentShaderRGBATexClampSwizzleAlphaAA::getShaderString): 17 (WebCore::FragmentShaderRGBATexAlphaMaskAA::getShaderString): 18 * platform/graphics/chromium/cc/CCRenderSurface.cpp: 19 (WebCore::CCRenderSurface::drawLayer): 20 (WebCore::CCRenderSurface::drawSurface): 21 * platform/graphics/chromium/cc/CCRenderSurface.h: 22 * platform/graphics/chromium/cc/CCTiledLayerImpl.cpp: 23 (WebCore::CCTiledLayerImpl::draw): 24 (WebCore::CCTiledLayerImpl::drawTiles): 25 * platform/graphics/chromium/cc/CCTiledLayerImpl.h: 26 1 27 2011-09-23 Oliver Hunt <oliver@apple.com> 2 28 -
trunk/Source/WebCore/platform/graphics/chromium/ShaderChromium.cpp
r94703 r95870 306 306 uniform sampler2D s_texture; 307 307 uniform float alpha; 308 uniform vec3 edge[ 4];308 uniform vec3 edge[8]; 309 309 void main() 310 310 { … … 315 315 float a2 = clamp(dot(edge[2], pos), 0.0, 1.0); 316 316 float a3 = clamp(dot(edge[3], pos), 0.0, 1.0); 317 gl_FragColor = texColor * alpha * min(a0, a2) * min(a1, a3); 317 float a4 = clamp(dot(edge[4], pos), 0.0, 1.0); 318 float a5 = clamp(dot(edge[5], pos), 0.0, 1.0); 319 float a6 = clamp(dot(edge[6], pos), 0.0, 1.0); 320 float a7 = clamp(dot(edge[7], pos), 0.0, 1.0); 321 gl_FragColor = texColor * alpha * min(min(a0, a2) * min(a1, a3), min(a4, a6) * min(a5, a7)); 318 322 } 319 323 ); … … 346 350 uniform float alpha; 347 351 uniform vec4 fragmentTexTransform; 348 uniform vec3 edge[ 4];352 uniform vec3 edge[8]; 349 353 void main() 350 354 { … … 356 360 float a2 = clamp(dot(edge[2], pos), 0.0, 1.0); 357 361 float a3 = clamp(dot(edge[3], pos), 0.0, 1.0); 358 gl_FragColor = texColor * alpha * min(a0, a2) * min(a1, a3); 362 float a4 = clamp(dot(edge[4], pos), 0.0, 1.0); 363 float a5 = clamp(dot(edge[5], pos), 0.0, 1.0); 364 float a6 = clamp(dot(edge[6], pos), 0.0, 1.0); 365 float a7 = clamp(dot(edge[7], pos), 0.0, 1.0); 366 gl_FragColor = texColor * alpha * min(min(a0, a2) * min(a1, a3), min(a4, a6) * min(a5, a7)); 359 367 } 360 368 ); … … 369 377 uniform float alpha; 370 378 uniform vec4 fragmentTexTransform; 371 uniform vec3 edge[ 4];379 uniform vec3 edge[8]; 372 380 void main() 373 381 { … … 379 387 float a2 = clamp(dot(edge[2], pos), 0.0, 1.0); 380 388 float a3 = clamp(dot(edge[3], pos), 0.0, 1.0); 381 gl_FragColor = vec4(texColor.z, texColor.y, texColor.x, texColor.w) * alpha * min(a0, a2) * min(a1, a3); 389 float a4 = clamp(dot(edge[4], pos), 0.0, 1.0); 390 float a5 = clamp(dot(edge[5], pos), 0.0, 1.0); 391 float a6 = clamp(dot(edge[6], pos), 0.0, 1.0); 392 float a7 = clamp(dot(edge[7], pos), 0.0, 1.0); 393 gl_FragColor = vec4(texColor.z, texColor.y, texColor.x, texColor.w) * alpha * min(min(a0, a2) * min(a1, a3), min(a4, a6) * min(a5, a7)); 382 394 } 383 395 ); … … 441 453 uniform sampler2D s_mask; 442 454 uniform float alpha; 443 uniform vec3 edge[ 4];455 uniform vec3 edge[8]; 444 456 void main() 445 457 { … … 451 463 float a2 = clamp(dot(edge[2], pos), 0.0, 1.0); 452 464 float a3 = clamp(dot(edge[3], pos), 0.0, 1.0); 453 gl_FragColor = vec4(texColor.x, texColor.y, texColor.z, texColor.w) * alpha * maskColor.w * min(a0, a2) * min(a1, a3); 465 float a4 = clamp(dot(edge[4], pos), 0.0, 1.0); 466 float a5 = clamp(dot(edge[5], pos), 0.0, 1.0); 467 float a6 = clamp(dot(edge[6], pos), 0.0, 1.0); 468 float a7 = clamp(dot(edge[7], pos), 0.0, 1.0); 469 gl_FragColor = vec4(texColor.x, texColor.y, texColor.z, texColor.w) * alpha * maskColor.w * min(min(a0, a2) * min(a1, a3), min(a4, a6) * min(a5, a7)); 454 470 } 455 471 ); -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp
r95341 r95870 138 138 139 139 FloatQuad quad = deviceMatrix.mapQuad(layerRenderer->sharedGeometryQuad()); 140 CCLayerQuad deviceRect = CCLayerQuad(FloatQuad(quad.boundingBox())); 140 141 CCLayerQuad layerQuad = CCLayerQuad(quad); 141 142 … … 148 149 #endif 149 150 150 if (useAA) 151 if (useAA) { 152 deviceRect.inflateAntiAliasingDistance(); 151 153 layerQuad.inflateAntiAliasingDistance(); 154 } 152 155 153 156 bool useMask = false; … … 159 162 if (useAA) { 160 163 const MaskProgramAA* program = layerRenderer->renderSurfaceMaskProgramAA(); 161 drawSurface(layerRenderer, maskLayer, drawTransform, deviceMatrix, layerQuad, program, program->fragmentShader().maskSamplerLocation(), program->vertexShader().pointLocation(), program->fragmentShader().edgeLocation());164 drawSurface(layerRenderer, maskLayer, drawTransform, deviceMatrix, deviceRect, layerQuad, program, program->fragmentShader().maskSamplerLocation(), program->vertexShader().pointLocation(), program->fragmentShader().edgeLocation()); 162 165 } else { 163 166 const MaskProgram* program = layerRenderer->renderSurfaceMaskProgram(); 164 drawSurface(layerRenderer, maskLayer, drawTransform, deviceMatrix, layerQuad, program, program->fragmentShader().maskSamplerLocation(), -1, -1);167 drawSurface(layerRenderer, maskLayer, drawTransform, deviceMatrix, deviceRect, layerQuad, program, program->fragmentShader().maskSamplerLocation(), -1, -1); 165 168 } 166 169 } else { 167 170 if (useAA) { 168 171 const ProgramAA* program = layerRenderer->renderSurfaceProgramAA(); 169 drawSurface(layerRenderer, maskLayer, drawTransform, deviceMatrix, layerQuad, program, -1, program->vertexShader().pointLocation(), program->fragmentShader().edgeLocation());172 drawSurface(layerRenderer, maskLayer, drawTransform, deviceMatrix, deviceRect, layerQuad, program, -1, program->vertexShader().pointLocation(), program->fragmentShader().edgeLocation()); 170 173 } else { 171 174 const Program* program = layerRenderer->renderSurfaceProgram(); 172 drawSurface(layerRenderer, maskLayer, drawTransform, deviceMatrix, layerQuad, program, -1, -1, -1);175 drawSurface(layerRenderer, maskLayer, drawTransform, deviceMatrix, deviceRect, layerQuad, program, -1, -1, -1); 173 176 } 174 177 } … … 176 179 177 180 template <class T> 178 void CCRenderSurface::drawSurface(LayerRendererChromium* layerRenderer, CCLayerImpl* maskLayer, const TransformationMatrix& drawTransform, const TransformationMatrix& deviceTransform, const CCLayerQuad& layerQuad, const T* program, int shaderMaskSamplerLocation, int shaderQuadLocation, int shaderEdgeLocation)181 void CCRenderSurface::drawSurface(LayerRendererChromium* layerRenderer, CCLayerImpl* maskLayer, const TransformationMatrix& drawTransform, const TransformationMatrix& deviceTransform, const CCLayerQuad& deviceRect, const CCLayerQuad& layerQuad, const T* program, int shaderMaskSamplerLocation, int shaderQuadLocation, int shaderEdgeLocation) 179 182 { 180 183 GraphicsContext3D* context3D = layerRenderer->context(); … … 195 198 196 199 if (shaderEdgeLocation != -1) { 197 float edge[ 12];200 float edge[24]; 198 201 layerQuad.toFloatArray(edge); 199 GLC(context3D, context3D->uniform3fv(shaderEdgeLocation, edge, 4)); 202 deviceRect.toFloatArray(&edge[12]); 203 GLC(context3D, context3D->uniform3fv(shaderEdgeLocation, edge, 8)); 200 204 } 201 205 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h
r95135 r95870 101 101 void drawLayer(LayerRendererChromium*, CCLayerImpl*, const TransformationMatrix&); 102 102 template <class T> 103 void drawSurface(LayerRendererChromium*, CCLayerImpl*, const TransformationMatrix& drawTransform, const TransformationMatrix& deviceTransform, const CCLayerQuad& , const T* program, int shaderMaskSamplerLocation, int shaderQuadLocation, int shaderEdgeLocation);103 void drawSurface(LayerRendererChromium*, CCLayerImpl*, const TransformationMatrix& drawTransform, const TransformationMatrix& deviceTransform, const CCLayerQuad& deviceRect, const CCLayerQuad&, const T* program, int shaderMaskSamplerLocation, int shaderQuadLocation, int shaderEdgeLocation); 104 104 105 105 CCLayerImpl* m_owningLayer; -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp
r95348 r95870 107 107 108 108 FloatQuad quad = deviceMatrix.mapQuad(FloatQuad(layerRect)); 109 CCLayerQuad deviceRect = CCLayerQuad(FloatQuad(quad.boundingBox())); 109 110 CCLayerQuad layerQuad = CCLayerQuad(quad); 110 111 … … 117 118 #endif 118 119 119 if (useAA) 120 if (useAA) { 121 deviceRect.inflateAntiAliasingDistance(); 120 122 layerQuad.inflateAntiAliasingDistance(); 123 } 121 124 122 125 GraphicsContext3D* context = layerRenderer->context(); … … 130 133 if (useAA) { 131 134 const ProgramAA* program = layerRenderer->tilerProgramAA(); 132 drawTiles(layerRenderer, layerRect, m_tilingTransform, deviceMatrix, layerQuad, drawOpacity(), program, program->fragmentShader().fragmentTexTransformLocation(), program->fragmentShader().edgeLocation());135 drawTiles(layerRenderer, layerRect, m_tilingTransform, deviceMatrix, deviceRect, layerQuad, drawOpacity(), program, program->fragmentShader().fragmentTexTransformLocation(), program->fragmentShader().edgeLocation()); 133 136 } else { 134 137 const Program* program = layerRenderer->tilerProgram(); 135 drawTiles(layerRenderer, layerRect, m_tilingTransform, deviceMatrix, layerQuad, drawOpacity(), program, -1, -1);138 drawTiles(layerRenderer, layerRect, m_tilingTransform, deviceMatrix, deviceRect, layerQuad, drawOpacity(), program, -1, -1); 136 139 } 137 140 break; … … 139 142 if (useAA) { 140 143 const ProgramSwizzleAA* program = layerRenderer->tilerProgramSwizzleAA(); 141 drawTiles(layerRenderer, layerRect, m_tilingTransform, deviceMatrix, layerQuad, drawOpacity(), program, program->fragmentShader().fragmentTexTransformLocation(), program->fragmentShader().edgeLocation());144 drawTiles(layerRenderer, layerRect, m_tilingTransform, deviceMatrix, deviceRect, layerQuad, drawOpacity(), program, program->fragmentShader().fragmentTexTransformLocation(), program->fragmentShader().edgeLocation()); 142 145 } else { 143 146 const ProgramSwizzle* program = layerRenderer->tilerProgramSwizzle(); 144 drawTiles(layerRenderer, layerRect, m_tilingTransform, deviceMatrix, layerQuad, drawOpacity(), program, -1, -1);147 drawTiles(layerRenderer, layerRect, m_tilingTransform, deviceMatrix, deviceRect, layerQuad, drawOpacity(), program, -1, -1); 145 148 } 146 149 break; … … 173 176 174 177 template <class T> 175 void CCTiledLayerImpl::drawTiles(LayerRendererChromium* layerRenderer, const IntRect& contentRect, const TransformationMatrix& globalTransform, const TransformationMatrix& deviceTransform, const CCLayerQuad& contentQuad, float opacity, const T* program, int fragmentTexTransformLocation, int edgeLocation)178 void CCTiledLayerImpl::drawTiles(LayerRendererChromium* layerRenderer, const IntRect& contentRect, const TransformationMatrix& globalTransform, const TransformationMatrix& deviceTransform, const CCLayerQuad& deviceRect, const CCLayerQuad& contentQuad, float opacity, const T* program, int fragmentTexTransformLocation, int edgeLocation) 176 179 { 177 180 GraphicsContext3D* context = layerRenderer->context(); … … 183 186 184 187 if (edgeLocation != -1) { 185 float edge[ 12];188 float edge[24]; 186 189 contentQuad.toFloatArray(edge); 187 GLC(context, context->uniform3fv(edgeLocation, edge, 4)); 190 deviceRect.toFloatArray(&edge[12]); 191 GLC(context, context->uniform3fv(edgeLocation, edge, 8)); 188 192 } 189 193 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.h
r95135 r95870 78 78 // Draw all tiles that intersect with contentRect. 79 79 template <class T> 80 void drawTiles(LayerRendererChromium*, const IntRect& contentRect, const TransformationMatrix& globalTransform, const TransformationMatrix& deviceTransform, const CCLayerQuad& , float opacity, const T* program, int fragmentTexTransformLocation, int edgeLocation);80 void drawTiles(LayerRendererChromium*, const IntRect& contentRect, const TransformationMatrix& globalTransform, const TransformationMatrix& deviceTransform, const CCLayerQuad& deviceRect, const CCLayerQuad& contentQuad, float opacity, const T* program, int fragmentTexTransformLocation, int edgeLocation); 81 81 82 82 TransformationMatrix m_tilingTransform;
Note: See TracChangeset
for help on using the changeset viewer.