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

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

Issue 2125803002: gpu, cmaa: optimize COMBINE_EDGES path to reduce fragment shader tasks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update comments 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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 392
393 glActiveTexture(GL_TEXTURE1); 393 glActiveTexture(GL_TEXTURE1);
394 glBindTexture(GL_TEXTURE_2D, mini4_edge_texture_); 394 glBindTexture(GL_TEXTURE_2D, mini4_edge_texture_);
395 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 395 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
396 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 396 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
397 397
398 glDrawArrays(GL_TRIANGLES, 0, 3); 398 glDrawArrays(GL_TRIANGLES, 0, 3);
399 } 399 }
400 400
401 // - Combine RightBottom (.xy) edges from previous pass into 401 // - Combine RightBottom (.xy) edges from previous pass into
402 // RightBottomLeftTop (.xyzw) edges and output it into the mask (have to 402 // RightBottomLeftTop (.xyzw) edges and output it into the mask.
403 // fill in the whole buffer including empty ones for the line length
404 // detection to work correctly).
dshwang 2016/07/06 10:27:30 It's wrong, because all edge information is genera
405 // - On all pixels with any edge, input buffer into a temporary color buffer 403 // - On all pixels with any edge, input buffer into a temporary color buffer
406 // needed for correct blending in the next pass (other pixels not needed 404 // needed for correct blending in the next pass (other pixels not needed
407 // so not copied to avoid bandwidth use). 405 // so not copied to avoid bandwidth use).
408 // - On all pixels with 2 or more edges output positive depth mask for the 406 // - On all pixels with 2 or more edges output positive depth mask for the
409 // next pass. 407 // next pass.
410 408
411 // Inputs 409 // Inputs
412 // g_src0TextureFlt edge_texture_b tex1 //ps 410 // g_src0TextureFlt edge_texture_b tex1 //ps
413 // Outputs 411 // Outputs
414 // image2D g_resultTextureSlot2 edge_texture_a image2 412 // image2D g_resultTextureSlot2 edge_texture_a image2
415 // gl_FragDepth mini4_edge_texture_ fbo.depth 413 // gl_FragDepth mini4_edge_texture_ fbo.depth
416 { 414 {
417 // Combine edges: each pixel will now contain info on all (top, right, 415 // Combine edges: each pixel will now contain info on all (top, right,
418 // bottom, left) edges; also create depth mask as above depth and mark 416 // bottom, left) edges; also mark depth 1 value on all pixels with any edge
419 // potential Z sAND also copy source color data but only on edge pixels 417 // and also copy source color data but only on edge pixels
420 glUseProgram(edges_combine_shader_); 418 glUseProgram(edges_combine_shader_);
421 glUniform1f(0, 1.0f); 419 glUniform1f(0, 0.0f);
422 glUniform2f(1, 1.0f / width_, 1.0f / height_); 420 glUniform2f(1, 1.0f / width_, 1.0f / height_);
423 glDepthMask(GL_TRUE); 421 glDepthMask(GL_TRUE);
424 glDepthFunc(GL_ALWAYS); 422 glDepthFunc(GL_LESS);
425 glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); 423 glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
426 424
427 if (!is_gles31_compatible_) { 425 if (!is_gles31_compatible_) {
428 glUniform1i(edges_combine_shader_result_texture_slot2_, 2); 426 glUniform1i(edges_combine_shader_result_texture_slot2_, 2);
429 } 427 }
430 glBindImageTextureEXT(2, edge_texture_a, 0, GL_FALSE, 0, GL_WRITE_ONLY, 428 glBindImageTextureEXT(2, edge_texture_a, 0, GL_FALSE, 0, GL_WRITE_ONLY,
431 edge_format); 429 edge_format);
432 430
433 glActiveTexture(GL_TEXTURE1); 431 glActiveTexture(GL_TEXTURE1);
434 glBindTexture(GL_TEXTURE_2D, edge_texture_b); 432 glBindTexture(GL_TEXTURE_2D, edge_texture_b);
(...skipping 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after
1883 \n#ifdef OUT_FBO\n 1881 \n#ifdef OUT_FBO\n
1884 outColor = pixel; 1882 outColor = pixel;
1885 \n#else\n 1883 \n#else\n
1886 imageStore(outTexture, screenPosI, pixel); 1884 imageStore(outTexture, screenPosI, pixel);
1887 \n#endif\n 1885 \n#endif\n
1888 } 1886 }
1889 ); 1887 );
1890 /* clang-format on */ 1888 /* clang-format on */
1891 1889
1892 } // namespace gpu 1890 } // 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