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 Nov 1, 2018
1 parent 347e2e8 commit f57fdc9
Showing 1 changed file with 28 additions and 8 deletions.
36 changes: 28 additions & 8 deletions gapis/api/gles/dependency_graph_behaviour_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,24 +198,44 @@ 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)
b.Read(g, data)
b.Read(g, size)
for layer := GLsizei(0); layer < cmd.SrcDepth(); layer++ {
data, size := c.Objects().Textures().Get(TextureId(cmd.SrcName())).dataAndSize(cmd.SrcLevel(), GLint(layer)+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)
b.Write(g, data)
b.Write(g, size)
for layer := GLsizei(0); layer < cmd.SrcDepth(); layer++ {
data, size := c.Objects().Textures().Get(TextureId(cmd.DstName())).dataAndSize(cmd.DstLevel(), GLint(layer)+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 f57fdc9

Please sign in to comment.