| Index: gpu/command_buffer/service/gles2_cmd_decoder.cc
|
| diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
|
| index c032dff22ae14ad9a95fdad3815abc464779af5b..f35c5770937a899b218ed24c83616d3e6c85c1d0 100644
|
| --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
|
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
|
| @@ -1321,6 +1321,11 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient {
|
| // of the draw operation are the same.
|
| bool CheckDrawingFeedbackLoops();
|
|
|
| + // Helper for CheckDrawingFeedbackLoops. Returns true if the attachment is
|
| + // the same one where it samples from during drawing.
|
| + bool CheckDrawingFeedbackLoopsHelper(
|
| + const Framebuffer::Attachment* attachment);
|
| +
|
| bool SupportsDrawBuffers() const;
|
|
|
| // Checks if a draw buffer's format and its corresponding fragment shader
|
| @@ -8645,15 +8650,8 @@ bool GLES2DecoderImpl::CheckCurrentProgramForUniform(
|
| location);
|
| }
|
|
|
| -bool GLES2DecoderImpl::CheckDrawingFeedbackLoops() {
|
| - Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_FRAMEBUFFER);
|
| - if (!framebuffer)
|
| - return false;
|
| - const Framebuffer::Attachment* attachment =
|
| - framebuffer->GetAttachment(GL_COLOR_ATTACHMENT0);
|
| - if (!attachment)
|
| - return false;
|
| -
|
| +bool GLES2DecoderImpl::CheckDrawingFeedbackLoopsHelper(
|
| + const Framebuffer::Attachment* attachment) {
|
| DCHECK(state_.current_program.get());
|
| const Program::SamplerIndices& sampler_indices =
|
| state_.current_program->sampler_indices();
|
| @@ -8675,6 +8673,36 @@ bool GLES2DecoderImpl::CheckDrawingFeedbackLoops() {
|
| return false;
|
| }
|
|
|
| +bool GLES2DecoderImpl::CheckDrawingFeedbackLoops() {
|
| + if (!SupportsDrawBuffers()) {
|
| + Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_FRAMEBUFFER);
|
| + if (!framebuffer)
|
| + return false;
|
| + const Framebuffer::Attachment* attachment =
|
| + framebuffer->GetAttachment(GL_COLOR_ATTACHMENT0);
|
| + if (!attachment)
|
| + return false;
|
| + return CheckDrawingFeedbackLoopsHelper(attachment);
|
| + } else {
|
| + Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER);
|
| + if (!framebuffer)
|
| + return false;
|
| + for (uint32_t ii = 0; ii < group_->max_draw_buffers(); ++ii) {
|
| + GLenum drawbuffer = static_cast<GLenum>(GL_DRAW_BUFFER0 + ii);
|
| + if (framebuffer->GetDrawBuffer(drawbuffer) == GL_NONE)
|
| + continue;
|
| + GLenum attachment = static_cast<GLenum>(GL_COLOR_ATTACHMENT0 + ii);
|
| + const Framebuffer::Attachment* draw_buffer =
|
| + framebuffer->GetAttachment(attachment);
|
| + if (!draw_buffer)
|
| + continue;
|
| + if (CheckDrawingFeedbackLoopsHelper(draw_buffer))
|
| + return true;
|
| + }
|
| + return false;
|
| + }
|
| +}
|
| +
|
| bool GLES2DecoderImpl::SupportsDrawBuffers() const {
|
| return feature_info_->IsWebGL1OrES2Context() ?
|
| feature_info_->feature_flags().ext_draw_buffers : true;
|
|
|