Skip to content

Commit

Permalink
gapis: Split @hidden into @hidden and @Nobox.
Browse files Browse the repository at this point in the history
They're orthogonal.
  • Loading branch information
ben-clayton committed Sep 11, 2017
1 parent c37d89e commit 7d7b760
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
26 changes: 20 additions & 6 deletions gapis/api/templates/api.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -954,13 +954,13 @@
{{Template "ClassFields" $}}
{{/* TODO: Remove this once closure support is in the API language */}}
{{if (eq $.Name "CommandBufferObject")}}
Commands CommandBufferCommands `nobox:"true"`
Commands CommandBufferCommands `hidden:"true" nobox:"true"`
{{end}}
{{if (eq $.Name "QueueObject")}}
PendingCommands CommandBufferCommands `nobox:"true"`
PendingCommands CommandBufferCommands `hidden:"true" nobox:"true"`
{{end}}
{{if (eq $.Name "RecreateCmdUpdateBufferData")}}
Data []uint8 `nobox:"true"`
Data []uint8 `hidden:"true" nobox:"true"`
{{end}}
}

Expand Down Expand Up @@ -989,12 +989,26 @@
{{AssertType $ "Class"}}
{{range $v := $.Fields}}
{{$name := $v.Name | GoPublicName}}
{{$cs := ConstantSetIndex $v}}
{{$name}} {{Template "Go.Type" $v}} {{if ge $cs 0}}`constset:"{{$cs}}"`{{end}}{{if GetAnnotation $v "hidden"}}`nobox:"true"`{{end}}
{{$tags := Macro "ClassFieldTags" $v}}
{{$name}} {{Template "Go.Type" $v}} {{if $tags}}`{{$tags}}`{{end}}
{{end}}
{{end}}


{{/*
-------------------------------------------------------------------------------
Emits a list of tags for the given class field.
-------------------------------------------------------------------------------
*/}}
{{define "ClassFieldTags"}}
{{AssertType $ "Field"}}
{{$cs := ConstantSetIndex $}}
{{if ge $cs 0}}constset:"{{$cs}}" §{{end}}
{{if GetAnnotation $ "hidden"}}hidden:"true" §{{end}}
{{if GetAnnotation $ "nobox"}}nobox:"true" §{{end}}
{{end}}


{{/*
-------------------------------------------------------------------------------
Emits the default value for the specified type.
Expand Down Expand Up @@ -1103,7 +1117,7 @@
{{range $g := $.Globals}}
{{Title $g.Name}} {{Template "Go.Type" $g}}
{{end}}
CustomState `nobox:"true"`
CustomState `hidden:"true" nobox:"true"`
}

func (g *State) Init() {
Expand Down
14 changes: 7 additions & 7 deletions gapis/api/vulkan/vulkan.api
Original file line number Diff line number Diff line change
Expand Up @@ -9406,8 +9406,8 @@ enum RecordingState {
VkDeviceSize MappedSize
void* MappedLocation
u32 MemoryTypeIndex
@hidden @internal u8[] Data
@unused ref!VulkanDebugMarkerInfo DebugInfo
@hidden @nobox @internal u8[] Data
@unused ref!VulkanDebugMarkerInfo DebugInfo
ref!DedicatedAllocationMemoryAllocateInfoNV DedicatedAllocationNV
}

Expand Down Expand Up @@ -9475,11 +9475,11 @@ enum RecordingState {
}

@internal class ImageLevel {
u32 Width
u32 Height
@unused u32 Depth
@hidden @internal u8[] Data
@unused u32 Size
u32 Width
u32 Height
@unused u32 Depth
@hidden @nobox @internal u8[] Data
@unused u32 Size
}

@internal class ImageViewObject {
Expand Down
2 changes: 1 addition & 1 deletion gapis/resolve/state_tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ func (n *stn) service(ctx context.Context, tree *stateTree) *service.StateTreeNo
}

func isFieldVisible(f reflect.StructField) bool {
return f.PkgPath == "" && f.Tag.Get("nobox") != "true"
return f.PkgPath == "" && f.Tag.Get("hidden") != "true"
}

func stateValuePreview(v reflect.Value) (*box.Value, bool) {
Expand Down

0 comments on commit 7d7b760

Please sign in to comment.