Skip to content

Commit

Permalink
Correctly handle texture layer FB attachemnts in DCE.
Browse files Browse the repository at this point in the history
 - in `glCopyImageSubData` the `srcZ` and `dstZ` attribute signal the
   texture layers read and written.
 - in the various framebuffer texture attachment calls, which layer is
   attached to the framebuffer is well defined.
  • Loading branch information
pmuetschard committed Oct 31, 2018
1 parent 4f067f2 commit 979eb20
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions gapis/api/gles/dependency_graph_behaviour_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,24 +198,40 @@ func (*GlesDependencyGraphBehaviourProvider) GetBehaviourForCommand(
switch cmd := cmd.(type) {
case *GlCopyImageSubData:
// TODO: This assumes whole-image copy. Handle sub-range copies.
// TODO: This does not handle multiple layers well.
if cmd.SrcTarget() == GLenum_GL_RENDERBUFFER {
b.Read(g, renderbufferDataKey{c.Objects().Renderbuffers().Get(RenderbufferId(cmd.SrcName()))})
} else {
data, size := c.Objects().Textures().Get(TextureId(cmd.SrcName())).dataAndSize(cmd.SrcLevel(), 0)
data, size := c.Objects().Textures().Get(TextureId(cmd.SrcName())).dataAndSize(cmd.SrcLevel(), cmd.SrcZ())
b.Read(g, data)
b.Read(g, size)
}
if cmd.DstTarget() == GLenum_GL_RENDERBUFFER {
b.Write(g,
renderbufferDataKey{c.Objects().Renderbuffers().Get(RenderbufferId(cmd.DstName()))})
} else {
data, size := c.Objects().Textures().Get(TextureId(cmd.DstName())).dataAndSize(cmd.DstLevel(), 0)
data, size := c.Objects().Textures().Get(TextureId(cmd.DstName())).dataAndSize(cmd.DstLevel(), cmd.DstZ())
b.Write(g, data)
b.Write(g, size)
}
case *GlFramebufferTexture2D:
b.Read(g, textureSizeKey{c.Objects().Textures().Get(cmd.Texture()), cmd.Texture(), cmd.Level(), 0})
var layer GLint
switch target := cmd.TextureTarget(); target {
case GLenum_GL_TEXTURE_CUBE_MAP_POSITIVE_X, GLenum_GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
GLenum_GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GLenum_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
GLenum_GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GLenum_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
layer = GLint(target - GLenum_GL_TEXTURE_CUBE_MAP_POSITIVE_X)
}
b.Read(g, textureSizeKey{c.Objects().Textures().Get(cmd.Texture()), cmd.Texture(), cmd.Level(), layer})
b.KeepAlive = true // Changes untracked state
case *GlFramebufferTexture:
if t := c.Objects().Textures().Get(cmd.Texture()); !t.IsNil() {
for layer := range t.Levels().Get(cmd.Level()).Layers().All() {
b.Read(g, textureSizeKey{t, cmd.Texture(), cmd.Level(), layer})
}
}
b.KeepAlive = true // Changes untracked state
case *GlFramebufferTextureLayer:
b.Read(g, textureSizeKey{c.Objects().Textures().Get(cmd.Texture()), cmd.Texture(), cmd.Level(), cmd.Layer()})
b.KeepAlive = true // Changes untracked state
case *GlCompressedTexImage2D:
texData, texSize := getTextureDataAndSize(ctx, cmd, id, s, c.Bound().TextureUnit(), cmd.Target(), cmd.Level())
Expand Down

0 comments on commit 979eb20

Please sign in to comment.