Skip to content

Commit

Permalink
Vulkan: Do not allow incomplete texture data
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 committed Oct 27, 2018
1 parent bb688bb commit 58fd0cc
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 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 Expand Up @@ -1238,11 +1238,11 @@ func pipelineResourceData(ctx context.Context,
return &api.ResourceData{
Data: &api.ResourceData_Pipeline{
Pipeline: &api.Pipeline{
API: path.NewAPI(id.ID(ID)),
Type: pipeType,
Stages: stages,
Bindings: bindingSlice,
Bound: bound,
API: path.NewAPI(id.ID(ID)),
Type: pipeType,
Stages: stages,
Bindings: bindingSlice,
Bound: bound,
BindingTypeConstantsIndex: int32(VkDescriptorTypeConstants()),
ImageLayoutConstantsIndex: int32(VkImageLayoutConstants()),
},
Expand Down

0 comments on commit 58fd0cc

Please sign in to comment.