Index: gpu/command_buffer/service/framebuffer_manager.cc |
diff --git a/gpu/command_buffer/service/framebuffer_manager.cc b/gpu/command_buffer/service/framebuffer_manager.cc |
index b78a5dcb6bc8976fdda9da4eb4c7e02aa6cd0887..45dc4ef44104da2b0ff994c06d997b14f6ca2b26 100644 |
--- a/gpu/command_buffer/service/framebuffer_manager.cc |
+++ b/gpu/command_buffer/service/framebuffer_manager.cc |
@@ -107,11 +107,13 @@ class TextureAttachment |
: public Framebuffer::Attachment { |
public: |
TextureAttachment( |
- TextureRef* texture_ref, GLenum target, GLint level, GLsizei samples) |
+ TextureRef* texture_ref, GLenum target, GLint level, |
+ GLsizei samples, GLint layer) |
: texture_ref_(texture_ref), |
target_(target), |
level_(level), |
- samples_(samples) { |
+ samples_(samples), |
+ layer_(layer) { |
} |
GLsizei width() const override { |
@@ -148,6 +150,8 @@ class TextureAttachment |
GLsizei samples() const override { return samples_; } |
+ GLint layer() const { return layer_; } |
+ |
GLuint object_name() const override { return texture_ref_->client_id(); } |
bool cleared() const override { |
@@ -234,6 +238,7 @@ class TextureAttachment |
GLenum target_; |
GLint level_; |
GLsizei samples_; |
+ GLint layer_; |
DISALLOW_COPY_AND_ASSIGN(TextureAttachment); |
}; |
@@ -689,7 +694,23 @@ void Framebuffer::AttachTexture( |
a->DetachFromFramebuffer(this); |
if (texture_ref) { |
attachments_[attachment] = scoped_refptr<Attachment>( |
- new TextureAttachment(texture_ref, target, level, samples)); |
+ new TextureAttachment(texture_ref, target, level, samples, 0)); |
+ texture_ref->texture()->AttachToFramebuffer(); |
+ } else { |
+ attachments_.erase(attachment); |
+ } |
+ framebuffer_complete_state_count_id_ = 0; |
+} |
+ |
+void Framebuffer::AttachTextureLayer( |
+ GLenum attachment, TextureRef* texture_ref, GLenum target, |
+ GLint level, GLint layer) { |
+ const Attachment* a = GetAttachment(attachment); |
+ if (a) |
+ a->DetachFromFramebuffer(this); |
+ if (texture_ref) { |
+ attachments_[attachment] = scoped_refptr<Attachment>( |
+ new TextureAttachment(texture_ref, target, level, 0, layer)); |
texture_ref->texture()->AttachToFramebuffer(); |
} else { |
attachments_.erase(attachment); |