Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(571)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa_intel.cc

Issue 2103893003: gpu, cmaa: don't blend the leftmost and bottom-most edges. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa _intel.h" 5 #include "gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa _intel.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "gpu/command_buffer/service/framebuffer_manager.h" 8 #include "gpu/command_buffer/service/framebuffer_manager.h"
9 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 9 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
10 #include "ui/gl/gl_context.h" 10 #include "ui/gl/gl_context.h"
(...skipping 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after
1363 vec4(float(0x80u | pe) / 255.0, 0, 0, 0)); 1363 vec4(float(0x80u | pe) / 255.0, 0, 0, 0));
1364 } 1364 }
1365 } 1365 }
1366 } 1366 }
1367 \n#endif\n // DETECT_EDGES2 1367 \n#endif\n // DETECT_EDGES2
1368 1368
1369 \n#ifdef COMBINE_EDGES\n 1369 \n#ifdef COMBINE_EDGES\n
1370 void CombineEdges() { 1370 void CombineEdges() {
1371 ivec3 screenPosIBase = ivec3(ivec2(gl_FragCoord.xy) * 2, 0); 1371 ivec3 screenPosIBase = ivec3(ivec2(gl_FragCoord.xy) * 2, 0);
1372 vec3 screenPosBase = vec3(screenPosIBase); 1372 vec3 screenPosBase = vec3(screenPosIBase);
1373 uvec2 notBottomLeft = uvec2(screenPosIBase.xy != ivec2(0, 0));
piman 2016/06/28 21:08:09 "screenPosIBase.xy != ivec2(0, 0)" is a boolean sc
dshwang 2016/06/29 10:35:56 sorry for obfuscated code, because I want to avoid
dshwang 2016/06/29 13:54:36 I actually wanted component wise comparison; notEq
1373 uint packedEdgesArray[3 * 3]; 1374 uint packedEdgesArray[3 * 3];
1374 1375
1375 // use only if it has the 'prev frame' flag:[sample * 255.0 - 127.5] 1376 // use only if it has the 'prev frame' flag:[sample * 255.0 - 127.5]
1376 //-> if it has the last bit flag (128), it's going to stay above 0 1377 //-> if it has the last bit flag (128), it's going to stay above 0
1377 uvec4 sampA = uvec4( 1378 uvec4 sampA = uvec4(
1378 textureGatherOffset(g_src0TextureFlt, 1379 textureGatherOffset(g_src0TextureFlt,
1379 screenPosBase.xy * g_OneOverScreenSize, 1380 screenPosBase.xy * g_OneOverScreenSize,
1380 ivec2(1, 0)) * 255.0 - 127.5); 1381 ivec2(1, 0)) * 255.0 - 127.5);
1381 uvec4 sampB = uvec4( 1382 uvec4 sampB = uvec4(
1382 textureGatherOffset(g_src0TextureFlt, 1383 textureGatherOffset(g_src0TextureFlt,
1383 screenPosBase.xy * g_OneOverScreenSize, 1384 screenPosBase.xy * g_OneOverScreenSize,
1384 ivec2(0, 1)) * 255.0 - 127.5); 1385 ivec2(0, 1)) * 255.0 - 127.5);
1385 uint sampC = uint( 1386 uint sampC = uint(
1386 texelFetchOffset(g_src0TextureFlt, screenPosIBase.xy, 0, 1387 texelFetchOffset(g_src0TextureFlt, screenPosIBase.xy, 0,
1387 ivec2(1, 1)).r * 255.0 - 127.5); 1388 ivec2(1, 1)).r * 255.0 - 127.5);
1388 1389
1389 packedEdgesArray[(0) * 3 + (0)] = 0u; 1390 packedEdgesArray[(0) * 3 + (0)] = 0u;
1390 packedEdgesArray[(1) * 3 + (0)] = sampA.w; 1391 // The bottom-most edge of the texture is not edge.
1391 packedEdgesArray[(2) * 3 + (0)] = sampA.z; 1392 // Note: texelFetch() on out of range gives an undefined value.
1393 packedEdgesArray[(1) * 3 + (0)] = sampA.w * notBottomLeft.y;
1394 packedEdgesArray[(2) * 3 + (0)] = sampA.z * notBottomLeft.y;
1392 packedEdgesArray[(1) * 3 + (1)] = sampA.x; 1395 packedEdgesArray[(1) * 3 + (1)] = sampA.x;
1393 packedEdgesArray[(2) * 3 + (1)] = sampA.y; 1396 packedEdgesArray[(2) * 3 + (1)] = sampA.y;
1394 packedEdgesArray[(0) * 3 + (1)] = sampB.w; 1397 // The left-most edge of the texture is not edge.
1395 packedEdgesArray[(0) * 3 + (2)] = sampB.x; 1398 packedEdgesArray[(0) * 3 + (1)] = sampB.w * notBottomLeft.x;
1399 packedEdgesArray[(0) * 3 + (2)] = sampB.x * notBottomLeft.x;
1396 packedEdgesArray[(1) * 3 + (2)] = sampB.y; 1400 packedEdgesArray[(1) * 3 + (2)] = sampB.y;
1397 packedEdgesArray[(2) * 3 + (2)] = sampC; 1401 packedEdgesArray[(2) * 3 + (2)] = sampC;
1398 1402
1399 uvec4 pixelsC = uvec4(packedEdgesArray[(1 + 0) * 3 + (1 + 0)], 1403 uvec4 pixelsC = uvec4(packedEdgesArray[(1 + 0) * 3 + (1 + 0)],
1400 packedEdgesArray[(1 + 1) * 3 + (1 + 0)], 1404 packedEdgesArray[(1 + 1) * 3 + (1 + 0)],
1401 packedEdgesArray[(1 + 0) * 3 + (1 + 1)], 1405 packedEdgesArray[(1 + 0) * 3 + (1 + 1)],
1402 packedEdgesArray[(1 + 1) * 3 + (1 + 1)]); 1406 packedEdgesArray[(1 + 1) * 3 + (1 + 1)]);
1403 uvec4 pixelsL = uvec4(packedEdgesArray[(0 + 0) * 3 + (1 + 0)], 1407 uvec4 pixelsL = uvec4(packedEdgesArray[(0 + 0) * 3 + (1 + 0)],
1404 packedEdgesArray[(0 + 1) * 3 + (1 + 0)], 1408 packedEdgesArray[(0 + 1) * 3 + (1 + 0)],
1405 packedEdgesArray[(0 + 0) * 3 + (1 + 1)], 1409 packedEdgesArray[(0 + 0) * 3 + (1 + 1)],
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
1835 \n#ifdef OUT_FBO\n 1839 \n#ifdef OUT_FBO\n
1836 outColor = pixel; 1840 outColor = pixel;
1837 \n#else\n 1841 \n#else\n
1838 imageStore(outTexture, screenPosI, pixel); 1842 imageStore(outTexture, screenPosI, pixel);
1839 \n#endif\n 1843 \n#endif\n
1840 } 1844 }
1841 ); 1845 );
1842 /* clang-format on */ 1846 /* clang-format on */
1843 1847
1844 } // namespace gpu 1848 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698