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 b9209835ff59f42a90c35ec838a81ccef0fb802b..1c87d6c2b462d0ee09d996d1eb48cc8af6b2db50 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 |
@@ -29,7 +29,6 @@ ApplyFramebufferAttachmentCMAAINTELResourceManager:: |
width_(0), |
height_(0), |
copy_to_framebuffer_shader_(0), |
- copy_to_image_shader_(0), |
edges0_shader_(0), |
edges1_shader_(0), |
edges_combine_shader_(0), |
@@ -43,12 +42,11 @@ ApplyFramebufferAttachmentCMAAINTELResourceManager:: |
edges1_texture_(0), |
mini4_edge_texture_(0), |
mini4_edge_depth_texture_(0), |
- edges1_shader_result_texture_float4_slot1_(0), |
- edges1_shader_result_texture_(0), |
- edges_combine_shader_result_texture_float4_slot1_(0), |
- process_and_apply_shader_result_texture_float4_slot1_(0), |
- edges_combine_shader_result_texture_slot2_(0), |
- copy_to_image_shader_outTexture_(0) {} |
+ edges0_shader_result_rgba_texture_slot1_(0), |
+ edges0_shader_target_texture_slot2_(0), |
+ edges1_shader_result_edge_texture_(0), |
+ process_and_apply_shader_result_rgba_texture_slot1_(0), |
+ edges_combine_shader_result_edge_texture_(0) {} |
ApplyFramebufferAttachmentCMAAINTELResourceManager:: |
~ApplyFramebufferAttachmentCMAAINTELResourceManager() { |
@@ -61,9 +59,8 @@ void ApplyFramebufferAttachmentCMAAINTELResourceManager::Initialize( |
is_gles31_compatible_ = |
decoder->GetGLContext()->GetVersionInfo()->IsAtLeastGLES(3, 1); |
- copy_to_image_shader_ = CreateProgram("", vert_str_, copy_frag_str_); |
copy_to_framebuffer_shader_ = |
- CreateProgram("#define OUT_FBO 1\n", vert_str_, copy_frag_str_); |
+ CreateProgram("", vert_str_, copy_frag_str_); |
// Check if RGBA8UI is supported as an FBO colour target with depth. |
// If not supported, GLSL needs to convert the data to/from float so there is |
@@ -180,18 +177,16 @@ void ApplyFramebufferAttachmentCMAAINTELResourceManager::Initialize( |
process_and_apply_shader_ = |
CreateProgram(blur.str().c_str(), vert_str_, cmaa_frag_c_str); |
- edges1_shader_result_texture_float4_slot1_ = |
- glGetUniformLocation(edges0_shader_, "g_resultTextureFlt4Slot1"); |
- edges1_shader_result_texture_ = |
- glGetUniformLocation(edges1_shader_, "g_resultTexture"); |
- edges_combine_shader_result_texture_float4_slot1_ = |
- glGetUniformLocation(edges_combine_shader_, "g_resultTextureFlt4Slot1"); |
- edges_combine_shader_result_texture_slot2_ = |
- glGetUniformLocation(edges_combine_shader_, "g_resultTextureSlot2"); |
- process_and_apply_shader_result_texture_float4_slot1_ = glGetUniformLocation( |
- process_and_apply_shader_, "g_resultTextureFlt4Slot1"); |
- copy_to_image_shader_outTexture_ = |
- glGetUniformLocation(copy_to_image_shader_, "outTexture"); |
+ edges0_shader_result_rgba_texture_slot1_ = |
+ glGetUniformLocation(edges0_shader_, "g_resultRGBATextureSlot1"); |
+ edges0_shader_target_texture_slot2_ = |
+ glGetUniformLocation(edges0_shader_, "g_targetTextureSlot2"); |
+ edges1_shader_result_edge_texture_ = |
+ glGetUniformLocation(edges1_shader_, "g_resultEdgeTexture"); |
+ edges_combine_shader_result_edge_texture_ = |
+ glGetUniformLocation(edges_combine_shader_, "g_resultEdgeTexture"); |
+ process_and_apply_shader_result_rgba_texture_slot1_ = glGetUniformLocation( |
+ process_and_apply_shader_, "g_resultRGBATextureSlot1"); |
initialized_ = true; |
} |
@@ -202,7 +197,6 @@ void ApplyFramebufferAttachmentCMAAINTELResourceManager::Destroy() { |
ReleaseTextures(); |
- glDeleteProgram(copy_to_image_shader_); |
glDeleteProgram(copy_to_framebuffer_shader_); |
glDeleteProgram(process_and_apply_shader_); |
glDeleteProgram(edges_combine_shader_); |
@@ -224,7 +218,10 @@ void ApplyFramebufferAttachmentCMAAINTELResourceManager:: |
if (!framebuffer) |
return; |
- GLuint last_framebuffer = framebuffer->service_id(); |
+ glDisable(GL_SCISSOR_TEST); |
+ glDisable(GL_STENCIL_TEST); |
+ glDisable(GL_CULL_FACE); |
+ glDisable(GL_BLEND); |
// Process each color attachment of the current draw framebuffer. |
uint32_t max_draw_buffers = decoder->GetContextGroup()->max_draw_buffers(); |
@@ -249,39 +246,15 @@ void ApplyFramebufferAttachmentCMAAINTELResourceManager:: |
// Process using a GL_RGBA8 copy if this is not the case. |
bool do_copy = internal_format != GL_RGBA8; |
- // Copy source_texture to rgba8_texture_ |
- if (do_copy) { |
- CopyTexture(source_texture, rgba8_texture_, false); |
- } |
- |
// CMAA Effect |
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, last_framebuffer); |
if (do_copy) { |
- ApplyCMAAEffectTexture(rgba8_texture_, rgba8_texture_); |
+ ApplyCMAAEffectTexture(source_texture, rgba8_texture_, do_copy); |
+ CopyTexture(rgba8_texture_, source_texture); |
} else { |
- ApplyCMAAEffectTexture(source_texture, source_texture); |
+ ApplyCMAAEffectTexture(source_texture, source_texture, do_copy); |
} |
- // Copy rgba8_texture_ to source_texture |
- if (do_copy) { |
- // Move source_texture to the first color attachment of the copy fbo. |
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, last_framebuffer); |
- glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, |
- GL_TEXTURE_2D, 0, 0); |
- glBindFramebufferEXT(GL_FRAMEBUFFER, copy_framebuffer_); |
- glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, |
- GL_TEXTURE_2D, source_texture, 0); |
- |
- CopyTexture(rgba8_texture_, source_texture, true); |
- |
- // Restore color attachments |
- glBindFramebufferEXT(GL_FRAMEBUFFER, copy_framebuffer_); |
- glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, |
- GL_TEXTURE_2D, rgba8_texture_, 0); |
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, last_framebuffer); |
- glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, |
- GL_TEXTURE_2D, source_texture, 0); |
- } |
+ decoder->RestoreTextureState(source_texture); |
} |
} |
@@ -298,7 +271,8 @@ void ApplyFramebufferAttachmentCMAAINTELResourceManager:: |
void ApplyFramebufferAttachmentCMAAINTELResourceManager::ApplyCMAAEffectTexture( |
GLuint source_texture, |
- GLuint dest_texture) { |
+ GLuint dest_texture, |
+ bool do_copy) { |
frame_id_++; |
GLuint edge_texture_a; |
@@ -344,7 +318,7 @@ void ApplyFramebufferAttachmentCMAAINTELResourceManager::ApplyCMAAEffectTexture( |
// Outputs |
// gl_FragDepth mini4_edge_depth_texture_ fbo.depth |
// out uvec4 outEdges mini4_edge_texture_ fbo.col |
- // image2D g_resultTextureFlt4Slot1 working_color_texture_ image1 |
+ // image2D g_resultRGBATextureSlot1 working_color_texture_ image1 |
GLenum edge_format = supports_r8_image_ ? GL_R8 : GL_R32F; |
{ |
@@ -355,10 +329,18 @@ void ApplyFramebufferAttachmentCMAAINTELResourceManager::ApplyCMAAEffectTexture( |
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); |
if (!is_gles31_compatible_) { |
- glUniform1i(edges1_shader_result_texture_float4_slot1_, 1); |
+ glUniform1i(edges0_shader_result_rgba_texture_slot1_, 1); |
+ glUniform1i(edges0_shader_target_texture_slot2_, 2); |
} |
glBindImageTextureEXT(1, working_color_texture_, 0, GL_FALSE, 0, |
GL_WRITE_ONLY, GL_RGBA8); |
+ if (do_copy) { |
+ glUniform1i(2, GL_TRUE); |
+ glBindImageTextureEXT(2, dest_texture, 0, GL_FALSE, 0, GL_WRITE_ONLY, |
+ GL_RGBA8); |
+ } else { |
+ glUniform1i(2, GL_FALSE); |
+ } |
glActiveTexture(GL_TEXTURE0); |
glBindTexture(GL_TEXTURE_2D, source_texture); |
@@ -375,7 +357,7 @@ void ApplyFramebufferAttachmentCMAAINTELResourceManager::ApplyCMAAEffectTexture( |
// Inputs |
// g_src0Texture4Uint mini4_edge_texture_ tex1 |
// Outputs |
- // image2D g_resultTexture edge_texture_b image0 |
+ // image2D g_resultEdgeTexture edge_texture_b image0 |
{ |
glUseProgram(edges1_shader_); |
glUniform2f(0, 1.0f / width_, 1.0f / height_); |
@@ -384,7 +366,7 @@ void ApplyFramebufferAttachmentCMAAINTELResourceManager::ApplyCMAAEffectTexture( |
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); |
if (!is_gles31_compatible_) { |
- glUniform1i(edges1_shader_result_texture_, 0); |
+ glUniform1i(edges1_shader_result_edge_texture_, 0); |
} |
glBindImageTextureEXT(0, edge_texture_b, 0, GL_FALSE, 0, GL_WRITE_ONLY, |
edge_format); |
@@ -408,7 +390,7 @@ void ApplyFramebufferAttachmentCMAAINTELResourceManager::ApplyCMAAEffectTexture( |
// Inputs |
// g_src0TextureFlt edge_texture_b tex1 //ps |
// Outputs |
- // image2D g_resultTextureSlot2 edge_texture_a image2 |
+ // image2D g_resultEdgeTexture edge_texture_a image2 |
// gl_FragDepth mini4_edge_texture_ fbo.depth |
{ |
// Combine edges: each pixel will now contain info on all (top, right, |
@@ -421,9 +403,9 @@ void ApplyFramebufferAttachmentCMAAINTELResourceManager::ApplyCMAAEffectTexture( |
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); |
if (!is_gles31_compatible_) { |
- glUniform1i(edges_combine_shader_result_texture_slot2_, 2); |
+ glUniform1i(edges_combine_shader_result_edge_texture_, 0); |
} |
- glBindImageTextureEXT(2, edge_texture_a, 0, GL_FALSE, 0, GL_WRITE_ONLY, |
+ glBindImageTextureEXT(0, edge_texture_a, 0, GL_FALSE, 0, GL_WRITE_ONLY, |
edge_format); |
glActiveTexture(GL_TEXTURE1); |
@@ -447,7 +429,7 @@ void ApplyFramebufferAttachmentCMAAINTELResourceManager::ApplyCMAAEffectTexture( |
// g_src0TextureFlt edge_texture_a tex1 //ps |
// sampled |
// Outputs |
- // g_resultTextureFlt4Slot1 dest_texture image1 |
+ // g_resultRGBATextureSlot1 dest_texture image1 |
// gl_FragDepth mini4_edge_texture_ fbo.depth |
{ |
glUseProgram(process_and_apply_shader_); |
@@ -457,7 +439,7 @@ void ApplyFramebufferAttachmentCMAAINTELResourceManager::ApplyCMAAEffectTexture( |
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); |
if (!is_gles31_compatible_) { |
- glUniform1i(process_and_apply_shader_result_texture_float4_slot1_, 1); |
+ glUniform1i(process_and_apply_shader_result_rgba_texture_slot1_, 1); |
} |
glBindImageTextureEXT(1, dest_texture, 0, GL_FALSE, 0, GL_WRITE_ONLY, |
GL_RGBA8); |
@@ -495,6 +477,9 @@ void ApplyFramebufferAttachmentCMAAINTELResourceManager::OnSize(GLint width, |
glGenTextures(1, &rgba8_texture_); |
glBindTexture(GL_TEXTURE_2D, rgba8_texture_); |
glTexStorage2DEXT(GL_TEXTURE_2D, 1, GL_RGBA8, width, height); |
+ glBindFramebufferEXT(GL_FRAMEBUFFER, copy_framebuffer_); |
+ glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, |
+ rgba8_texture_, 0); |
// Edges texture - R8 |
// OpenGLES has no single component 8/16-bit image support, so needs to be R32 |
@@ -564,29 +549,21 @@ void ApplyFramebufferAttachmentCMAAINTELResourceManager::ReleaseTextures() { |
textures_initialized_ = false; |
} |
+// TODO(dshwang): reuse CopyTextureCHROMIUMResourceManager. crbug.com/535198 |
void ApplyFramebufferAttachmentCMAAINTELResourceManager::CopyTexture( |
GLint source, |
- GLint dest, |
- bool via_fbo) { |
+ GLint dest) { |
+ glBindFramebufferEXT(GL_FRAMEBUFFER, copy_framebuffer_); |
+ glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, |
+ GL_TEXTURE_2D, dest, 0); |
glViewport(0, 0, width_, height_); |
+ |
glActiveTexture(GL_TEXTURE0); |
glBindTexture(GL_TEXTURE_2D, source); |
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
- if (!via_fbo) { |
- glUseProgram(copy_to_image_shader_); |
- if (!is_gles31_compatible_) { |
- glUniform1i(copy_to_image_shader_outTexture_, 0); |
- } |
- glBindImageTextureEXT(0, dest, 0, GL_FALSE, 0, GL_WRITE_ONLY, GL_RGBA8); |
- } else { |
- glDisable(GL_DEPTH_TEST); |
- glDisable(GL_STENCIL_TEST); |
- glDisable(GL_CULL_FACE); |
- glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); |
- glDepthMask(GL_FALSE); |
- glDisable(GL_BLEND); |
- glUseProgram(copy_to_framebuffer_shader_); |
- } |
+ glUseProgram(copy_to_framebuffer_shader_); |
glDrawArrays(GL_TRIANGLES, 0, 3); |
glUseProgram(0); |
@@ -715,6 +692,9 @@ const char ApplyFramebufferAttachmentCMAAINTELResourceManager::cmaa_frag_s1_[] = |
\n#ifndef EDGE_DETECT_THRESHOLD\n |
layout(location = 1) uniform float g_ColorThreshold; |
\n#endif\n |
+ \n#ifdef DETECT_EDGES1\n |
+ layout(location = 2) uniform int g_DoCopy; |
+ \n#endif\n |
\n#ifdef SUPPORTS_USAMPLER2D\n |
\n#define USAMPLER usampler2D\n |
@@ -739,18 +719,18 @@ const char ApplyFramebufferAttachmentCMAAINTELResourceManager::cmaa_frag_s1_[] = |
// bind to image stage 0/1/2 |
\n#ifdef GL_ES\n |
layout(binding = 0, EDGE_READ_FORMAT) restrict writeonly uniform highp |
- image2D g_resultTexture; |
+ image2D g_resultEdgeTexture; |
layout(binding = 1, rgba8) restrict writeonly uniform highp |
- image2D g_resultTextureFlt4Slot1; |
- layout(binding = 2, EDGE_READ_FORMAT) restrict writeonly uniform highp |
- image2D g_resultTextureSlot2; |
+ image2D g_resultRGBATextureSlot1; |
+ layout(binding = 2, rgba8) restrict writeonly uniform highp |
+ image2D g_targetTextureSlot2; |
\n#else\n |
layout(EDGE_READ_FORMAT) restrict writeonly uniform highp |
- image2D g_resultTexture; |
+ image2D g_resultEdgeTexture; |
layout(rgba8) restrict writeonly uniform highp |
- image2D g_resultTextureFlt4Slot1; |
- layout(EDGE_READ_FORMAT) restrict writeonly uniform highp |
- image2D g_resultTextureSlot2; |
+ image2D g_resultRGBATextureSlot1; |
+ layout(rgba8) restrict writeonly uniform highp |
+ image2D g_targetTextureSlot2; |
\n#endif\n |
// Constants |
@@ -1009,7 +989,7 @@ const char ApplyFramebufferAttachmentCMAAINTELResourceManager::cmaa_frag_s1_[] = |
float(pixelPos.y) + 0.5); |
\n#ifdef DEBUG_OUTPUT_AAINFO\n |
- imageStore(g_resultTextureSlot2, pixelPos, |
+ imageStore(g_resultEdgeTexture, pixelPos, |
PackBlurAAInfo(pixelPos, 1u)); |
\n#endif\n |
@@ -1026,7 +1006,7 @@ const char ApplyFramebufferAttachmentCMAAINTELResourceManager::cmaa_frag_s1_[] = |
\n#ifdef IN_GAMMA_CORRECT_MODE\n |
color.rgb = D3DX_FLOAT3_to_SRGB(color.rgb); |
\n#endif\n |
- imageStore(g_resultTextureFlt4Slot1, pixelPos, color); |
+ imageStore(g_resultRGBATextureSlot1, pixelPos, color); |
} |
} |
@@ -1086,6 +1066,13 @@ const char ApplyFramebufferAttachmentCMAAINTELResourceManager::cmaa_frag_s1_[] = |
vec4 pixel12 = |
texelFetchOffset(g_screenTexture, screenPosI.xy, 0, ivec2(1, 2)); |
+ if (g_DoCopy == 1) { |
+ imageStore(g_targetTextureSlot2, screenPosI.xy + ivec2(0, 0), pixel00); |
+ imageStore(g_targetTextureSlot2, screenPosI.xy + ivec2(1, 0), pixel10); |
+ imageStore(g_targetTextureSlot2, screenPosI.xy + ivec2(0, 1), pixel01); |
+ imageStore(g_targetTextureSlot2, screenPosI.xy + ivec2(1, 1), pixel11); |
+ } |
+ |
float storeFlagPixel00 = 0.0; |
float storeFlagPixel10 = 0.0; |
float storeFlagPixel20 = 0.0; |
@@ -1159,28 +1146,28 @@ const char ApplyFramebufferAttachmentCMAAINTELResourceManager::cmaa_frag_s1_[] = |
if (gl_FragDepth != 0.0) { |
if (storeFlagPixel00 != 0.0) |
- imageStore(g_resultTextureFlt4Slot1, screenPosI.xy + ivec2(0, 0), |
+ imageStore(g_resultRGBATextureSlot1, screenPosI.xy + ivec2(0, 0), |
pixel00); |
if (storeFlagPixel10 != 0.0) |
- imageStore(g_resultTextureFlt4Slot1, screenPosI.xy + ivec2(1, 0), |
+ imageStore(g_resultRGBATextureSlot1, screenPosI.xy + ivec2(1, 0), |
pixel10); |
if (storeFlagPixel20 != 0.0) |
- imageStore(g_resultTextureFlt4Slot1, screenPosI.xy + ivec2(2, 0), |
+ imageStore(g_resultRGBATextureSlot1, screenPosI.xy + ivec2(2, 0), |
pixel20); |
if (storeFlagPixel01 != 0.0) |
- imageStore(g_resultTextureFlt4Slot1, screenPosI.xy + ivec2(0, 1), |
+ imageStore(g_resultRGBATextureSlot1, screenPosI.xy + ivec2(0, 1), |
pixel01); |
if (storeFlagPixel02 != 0.0) |
- imageStore(g_resultTextureFlt4Slot1, screenPosI.xy + ivec2(0, 2), |
+ imageStore(g_resultRGBATextureSlot1, screenPosI.xy + ivec2(0, 2), |
pixel02); |
if (storeFlagPixel11 != 0.0) |
- imageStore(g_resultTextureFlt4Slot1, screenPosI.xy + ivec2(1, 1), |
+ imageStore(g_resultRGBATextureSlot1, screenPosI.xy + ivec2(1, 1), |
pixel11); |
if (storeFlagPixel21 != 0.0) |
- imageStore(g_resultTextureFlt4Slot1, screenPosI.xy + ivec2(2, 1), |
+ imageStore(g_resultRGBATextureSlot1, screenPosI.xy + ivec2(2, 1), |
pixel21); |
if (storeFlagPixel12 != 0.0) |
- imageStore(g_resultTextureFlt4Slot1, screenPosI.xy + ivec2(1, 2), |
+ imageStore(g_resultRGBATextureSlot1, screenPosI.xy + ivec2(1, 2), |
pixel12); |
} |
outEdges = STORE_UVEC4(outputEdges); |
@@ -1285,7 +1272,7 @@ const char ApplyFramebufferAttachmentCMAAINTELResourceManager::cmaa_frag_s2_[] = |
CollectEdges(2, 2, edges, packedVals); |
uint pe = PackEdge(PruneNonDominantEdges(edges)); |
if (pe != 0u) { |
- imageStore(g_resultTexture, 2 * screenPosI.xy + ivec2(0, 0), |
+ imageStore(g_resultEdgeTexture, 2 * screenPosI.xy + ivec2(0, 0), |
vec4(float(0x80u | pe) / 255.0, 0, 0, 0)); |
} |
} |
@@ -1314,7 +1301,7 @@ const char ApplyFramebufferAttachmentCMAAINTELResourceManager::cmaa_frag_s2_[] = |
// Note: texelFetch() on out of range gives an undefined value. |
uint pe = PackEdge(dominant_edges * uvec4(notTopRight.x, 1, 1, 1)); |
if (pe != 0u) { |
- imageStore(g_resultTexture, 2 * screenPosI.xy + ivec2(1, 0), |
+ imageStore(g_resultEdgeTexture, 2 * screenPosI.xy + ivec2(1, 0), |
vec4(float(0x80u | pe) / 255.0, 0, 0, 0)); |
} |
} |
@@ -1341,7 +1328,7 @@ const char ApplyFramebufferAttachmentCMAAINTELResourceManager::cmaa_frag_s2_[] = |
uvec4 dominant_edges = PruneNonDominantEdges(edges); |
uint pe = PackEdge(dominant_edges * uvec4(1, notTopRight.y, 1, 1)); |
if (pe != 0u) { |
- imageStore(g_resultTexture, 2 * screenPosI.xy + ivec2(0, 1), |
+ imageStore(g_resultEdgeTexture, 2 * screenPosI.xy + ivec2(0, 1), |
vec4(float(0x80u | pe) / 255.0, 0, 0, 0)); |
} |
} |
@@ -1351,7 +1338,7 @@ const char ApplyFramebufferAttachmentCMAAINTELResourceManager::cmaa_frag_s2_[] = |
uvec4 dominant_edges = PruneNonDominantEdges(edges); |
uint pe = PackEdge(dominant_edges * uvec4(notTopRight, 1, 1)); |
if (pe != 0u) { |
- imageStore(g_resultTexture, 2 * screenPosI.xy + ivec2(1, 1), |
+ imageStore(g_resultEdgeTexture, 2 * screenPosI.xy + ivec2(1, 1), |
vec4(float(0x80u | pe) / 255.0, 0, 0, 0)); |
} |
} |
@@ -1409,13 +1396,13 @@ const char ApplyFramebufferAttachmentCMAAINTELResourceManager::cmaa_frag_s2_[] = |
pixelsC | ((pixelsL & 0x01u) << 2u) | ((pixelsU & 0x02u) << 2u); |
vec4 outEdge4Flt = vec4(outEdge4) / 255.0; |
- imageStore(g_resultTextureSlot2, screenPosIBase.xy + ivec2(0, 0), |
+ imageStore(g_resultEdgeTexture, screenPosIBase.xy + ivec2(0, 0), |
outEdge4Flt.xxxx); |
- imageStore(g_resultTextureSlot2, screenPosIBase.xy + ivec2(1, 0), |
+ imageStore(g_resultEdgeTexture, screenPosIBase.xy + ivec2(1, 0), |
outEdge4Flt.yyyy); |
- imageStore(g_resultTextureSlot2, screenPosIBase.xy + ivec2(0, 1), |
+ imageStore(g_resultEdgeTexture, screenPosIBase.xy + ivec2(0, 1), |
outEdge4Flt.zzzz); |
- imageStore(g_resultTextureSlot2, screenPosIBase.xy + ivec2(1, 1), |
+ imageStore(g_resultEdgeTexture, screenPosIBase.xy + ivec2(1, 1), |
outEdge4Flt.wwww); |
// uvec4 numberOfEdges4 = uvec4(bitCount(outEdge4)); |
@@ -1669,10 +1656,10 @@ const char ApplyFramebufferAttachmentCMAAINTELResourceManager::cmaa_frag_s2_[] = |
\n#endif\n |
\n#ifdef DEBUG_OUTPUT_AAINFO\n |
- imageStore(g_resultTextureSlot2, screenPosI.xy, |
+ imageStore(g_resultEdgeTexture, screenPosI.xy, |
PackBlurAAInfo(screenPosI.xy, numberOfEdges)); |
\n#endif\n |
- imageStore(g_resultTextureFlt4Slot1, screenPosI.xy, color); |
+ imageStore(g_resultRGBATextureSlot1, screenPosI.xy, color); |
if (numberOfEdges == 2u) { |
uint packedEdgesL = packedEdgesArray[(0 + _x) * 4 + (1 + _y)]; |
@@ -1889,21 +1876,11 @@ const char |
precision highp float; |
layout(binding = 0) uniform highp sampler2D inTexture; |
layout(location = 0) out vec4 outColor; |
- \n#ifdef GL_ES\n |
- layout(binding = 0, rgba8) restrict writeonly uniform highp |
- image2D outTexture; |
- \n#else\n |
- layout(rgba8) restrict writeonly uniform highp image2D outTexture; |
- \n#endif\n |
void main() { |
ivec2 screenPosI = ivec2( gl_FragCoord.xy ); |
vec4 pixel = texelFetch(inTexture, screenPosI, 0); |
- \n#ifdef OUT_FBO\n |
outColor = pixel; |
- \n#else\n |
- imageStore(outTexture, screenPosI, pixel); |
- \n#endif\n |
} |
); |
/* clang-format on */ |