Skip to content

Commit

Permalink
Vulkan: Do not allow incomplete texture data (#2321)
Browse files Browse the repository at this point in the history
Transfering incomplete texture data may crash the grpc.
E.g.: ResourceData: Texture2D<Levels: nil> crashes grpc.
  • Loading branch information
Qining authored Oct 29, 2018
1 parent bb688bb commit 4b81800
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions gapis/api/vulkan/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -657,10 +657,10 @@ func (t ImageObjectʳ) ResourceData(ctx context.Context, s *api.GlobalState) (*a
for level := uint32(0); level < t.Info().MipLevels(); level++ {
info := t.imageInfo(ctx, s, vkFmt, layer, level)
if info == nil {
continue
return nil, &service.ErrDataUnavailable{Reason: messages.ErrNoTextureData(t.ResourceHandle())}
}
if !setCubemapFace(info, cubeMapLevels[level], layer) {
continue
return nil, &service.ErrDataUnavailable{Reason: messages.ErrNoTextureData(t.ResourceHandle())}
}
}
}
Expand All @@ -676,7 +676,7 @@ func (t ImageObjectʳ) ResourceData(ctx context.Context, s *api.GlobalState) (*a
for level := uint32(0); level < t.Info().MipLevels(); level++ {
info := t.imageInfo(ctx, s, vkFmt, layer, level)
if info == nil {
continue
return nil, &service.ErrDataUnavailable{Reason: messages.ErrNoTextureData(t.ResourceHandle())}
}
levels[level] = info
}
Expand All @@ -690,7 +690,7 @@ func (t ImageObjectʳ) ResourceData(ctx context.Context, s *api.GlobalState) (*a
for level := uint32(0); level < t.Info().MipLevels(); level++ {
info := t.imageInfo(ctx, s, vkFmt, 0, level)
if info == nil {
continue
return nil, &service.ErrDataUnavailable{Reason: messages.ErrNoTextureData(t.ResourceHandle())}
}
levels[level] = info
}
Expand All @@ -702,7 +702,7 @@ func (t ImageObjectʳ) ResourceData(ctx context.Context, s *api.GlobalState) (*a
for level := uint32(0); level < t.Info().MipLevels(); level++ {
info := t.imageInfo(ctx, s, vkFmt, 0, level)
if info == nil {
continue
return nil, &service.ErrDataUnavailable{Reason: messages.ErrNoTextureData(t.ResourceHandle())}
}
levels[level] = info
}
Expand All @@ -717,7 +717,7 @@ func (t ImageObjectʳ) ResourceData(ctx context.Context, s *api.GlobalState) (*a
for level := uint32(0); level < t.Info().MipLevels(); level++ {
info := t.imageInfo(ctx, s, vkFmt, layer, level)
if info == nil {
continue
return nil, &service.ErrDataUnavailable{Reason: messages.ErrNoTextureData(t.ResourceHandle())}
}
levels[level] = info
}
Expand All @@ -730,7 +730,7 @@ func (t ImageObjectʳ) ResourceData(ctx context.Context, s *api.GlobalState) (*a
for level := uint32(0); level < t.Info().MipLevels(); level++ {
info := t.imageInfo(ctx, s, vkFmt, 0, level)
if info == nil {
continue
return nil, &service.ErrDataUnavailable{Reason: messages.ErrNoTextureData(t.ResourceHandle())}
}
levels[level] = info
}
Expand Down

0 comments on commit 4b81800

Please sign in to comment.