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

Unified 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: remove g_Depth uniform because frag shader controls depth by itself 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa_intel.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa_intel.cc b/gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa_intel.cc
index 65eca9ad36afcc8233508bcb22a70cae8970dcdb..71efc7f415fe5b43fcb28a73038de010f7264ada 100644
--- a/gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa_intel.cc
+++ b/gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa_intel.cc
@@ -348,8 +348,7 @@ void ApplyFramebufferAttachmentCMAAINTELResourceManager::ApplyCMAAEffectTexture(
{
glUseProgram(edges0_shader_);
- glUniform1f(0, 1.0f);
- glUniform2f(1, 1.0f / width_, 1.0f / height_);
+ glUniform2f(0, 1.0f / width_, 1.0f / height_);
glDepthMask(GL_TRUE);
glDepthFunc(GL_ALWAYS);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
@@ -378,8 +377,7 @@ void ApplyFramebufferAttachmentCMAAINTELResourceManager::ApplyCMAAEffectTexture(
// image2D g_resultTexture edge_texture_b image0
{
glUseProgram(edges1_shader_);
- glUniform1f(0, 0.0f);
- glUniform2f(1, 1.0f / width_, 1.0f / height_);
+ glUniform2f(0, 1.0f / width_, 1.0f / height_);
glDepthMask(GL_FALSE);
glDepthFunc(GL_LESS);
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
@@ -399,9 +397,7 @@ void ApplyFramebufferAttachmentCMAAINTELResourceManager::ApplyCMAAEffectTexture(
}
// - Combine RightBottom (.xy) edges from previous pass into
- // RightBottomLeftTop (.xyzw) edges and output it into the mask (have to
- // fill in the whole buffer including empty ones for the line length
- // detection to work correctly).
+ // RightBottomLeftTop (.xyzw) edges and output it into the mask.
// - On all pixels with any edge, input buffer into a temporary color buffer
// needed for correct blending in the next pass (other pixels not needed
// so not copied to avoid bandwidth use).
@@ -415,13 +411,12 @@ void ApplyFramebufferAttachmentCMAAINTELResourceManager::ApplyCMAAEffectTexture(
// gl_FragDepth mini4_edge_texture_ fbo.depth
{
// Combine edges: each pixel will now contain info on all (top, right,
- // bottom, left) edges; also create depth mask as above depth and mark
- // potential Z sAND also copy source color data but only on edge pixels
+ // bottom, left) edges; also mark depth 1 value on all pixels with any edge
+ // and also copy source color data but only on edge pixels
glUseProgram(edges_combine_shader_);
- glUniform1f(0, 1.0f);
- glUniform2f(1, 1.0f / width_, 1.0f / height_);
+ glUniform2f(0, 1.0f / width_, 1.0f / height_);
glDepthMask(GL_TRUE);
- glDepthFunc(GL_ALWAYS);
+ glDepthFunc(GL_LESS);
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
if (!is_gles31_compatible_) {
@@ -455,8 +450,7 @@ void ApplyFramebufferAttachmentCMAAINTELResourceManager::ApplyCMAAEffectTexture(
// gl_FragDepth mini4_edge_texture_ fbo.depth
{
glUseProgram(process_and_apply_shader_);
- glUniform1f(0, 0.0f);
- glUniform2f(1, 1.0f / width_, 1.0f / height_);
+ glUniform2f(0, 1.0f / width_, 1.0f / height_);
glDepthMask(GL_FALSE);
glDepthFunc(GL_LESS);
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
@@ -690,7 +684,6 @@ GLuint ApplyFramebufferAttachmentCMAAINTELResourceManager::CreateShader(
const char ApplyFramebufferAttachmentCMAAINTELResourceManager::vert_str_[] =
SHADER(
precision highp float;
- layout(location = 0) uniform float g_Depth;
// No input data.
// Verts are autogenerated.
//
@@ -703,7 +696,7 @@ const char ApplyFramebufferAttachmentCMAAINTELResourceManager::vert_str_[] =
{
float x = -1.0 + float((gl_VertexID & 1) << 2);
float y = -1.0 + float((gl_VertexID & 2) << 1);
- gl_Position = vec4(x, y, g_Depth, 1.0);
+ gl_Position = vec4(x, y, 0.0, 1.0);
}
);
@@ -716,12 +709,10 @@ const char ApplyFramebufferAttachmentCMAAINTELResourceManager::cmaa_frag_s1_[] =
\n#define EDGE_DETECT_THRESHOLD 13.0f\n
\n#define saturate(x) clamp((x), 0.0, 1.0)\n
- // bind to location 0
- layout(location = 0) uniform float g_Depth;
// bind to a uniform buffer bind point 0
- layout(location = 1) uniform vec2 g_OneOverScreenSize;
+ layout(location = 0) uniform vec2 g_OneOverScreenSize;
\n#ifndef EDGE_DETECT_THRESHOLD\n
- layout(location = 2) uniform float g_ColorThreshold;
+ layout(location = 1) uniform float g_ColorThreshold;
\n#endif\n
\n#ifdef SUPPORTS_USAMPLER2D\n
« 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