| //////////////////////////////////////////////////////////////////////////////// |
| // Do not modify! |
| // Generated by codergen |
| //////////////////////////////////////////////////////////////////////////////// |
| |
| package gfxapi |
| |
| import ( |
| "android.googlesource.com/platform/tools/gpu/framework/binary" |
| "android.googlesource.com/platform/tools/gpu/framework/binary/registry" |
| "android.googlesource.com/platform/tools/gpu/framework/binary/schema" |
| "android.googlesource.com/platform/tools/gpu/framework/id" |
| "android.googlesource.com/platform/tools/gpu/gapid/image" |
| "android.googlesource.com/platform/tools/gpu/gapid/service/path" |
| "android.googlesource.com/platform/tools/gpu/gapid/vertex" |
| ) |
| |
| // Make sure schema init() runs first |
| import _ "android.googlesource.com/platform/tools/gpu/framework/binary/schema" |
| |
| // force use the id package, because our imports handling is wrong |
| var _ id.ID |
| |
| const ( |
| ixǁCubemapLevel = iota |
| ixǁCubemap |
| ixǁIndexBuffer |
| ixǁMesh |
| ixǁUniform |
| ixǁProgram |
| ixǁShader |
| ixǁTexture2D |
| ) |
| |
| var entities [8]binary.Entity |
| |
| var Namespace = registry.NewNamespace() |
| |
| func init() { |
| registry.Global.AddFallbacks(Namespace) |
| Namespace.AddClassOf((*CubemapLevel)(nil)) |
| Namespace.AddClassOf((*Cubemap)(nil)) |
| Namespace.AddClassOf((*IndexBuffer)(nil)) |
| Namespace.AddClassOf((*Mesh)(nil)) |
| Namespace.AddClassOf((*Uniform)(nil)) |
| Namespace.AddClassOf((*Program)(nil)) |
| Namespace.AddClassOf((*Shader)(nil)) |
| Namespace.AddClassOf((*Texture2D)(nil)) |
| } |
| |
| type binaryClassCubemapLevel struct{} |
| |
| func (*CubemapLevel) Class() binary.Class { |
| return (*binaryClassCubemapLevel)(nil) |
| } |
| func doEncodeCubemapLevel(e binary.Encoder, o *CubemapLevel) { |
| e.Struct(&o.NegativeX) |
| e.Struct(&o.PositiveX) |
| e.Struct(&o.NegativeY) |
| e.Struct(&o.PositiveY) |
| e.Struct(&o.NegativeZ) |
| e.Struct(&o.PositiveZ) |
| } |
| func doDecodeCubemapLevel(d binary.Decoder, o *CubemapLevel) { |
| d.Struct(&o.NegativeX) |
| d.Struct(&o.PositiveX) |
| d.Struct(&o.NegativeY) |
| d.Struct(&o.PositiveY) |
| d.Struct(&o.NegativeZ) |
| d.Struct(&o.PositiveZ) |
| } |
| func doDecodeRawCubemapLevel(d binary.Decoder, o *CubemapLevel) { |
| d.Struct(&o.NegativeX) |
| d.Struct(&o.PositiveX) |
| d.Struct(&o.NegativeY) |
| d.Struct(&o.PositiveY) |
| d.Struct(&o.NegativeZ) |
| d.Struct(&o.PositiveZ) |
| } |
| func (*binaryClassCubemapLevel) Encode(e binary.Encoder, obj binary.Object) { |
| doEncodeCubemapLevel(e, obj.(*CubemapLevel)) |
| } |
| func (*binaryClassCubemapLevel) New() binary.Object { |
| return &CubemapLevel{} |
| } |
| func (*binaryClassCubemapLevel) DecodeTo(d binary.Decoder, obj binary.Object) { |
| doDecodeCubemapLevel(d, obj.(*CubemapLevel)) |
| } |
| func (c *binaryClassCubemapLevel) Schema() *binary.Entity { |
| return &entities[ixǁCubemapLevel] |
| } |
| |
| type binaryClassCubemap struct{} |
| |
| func (*Cubemap) Class() binary.Class { |
| return (*binaryClassCubemap)(nil) |
| } |
| func doEncodeCubemap(e binary.Encoder, o *Cubemap) { |
| e.Uint32(uint32(len(o.Levels))) |
| for i := range o.Levels { |
| curr := &o.Levels[i] |
| e.Struct(&(*curr)) |
| } |
| } |
| func doDecodeCubemap(d binary.Decoder, o *Cubemap) { |
| if count := d.Count(); count > 0 { |
| o.Levels = make([]CubemapLevel, count) |
| for i := range o.Levels { |
| curr := &o.Levels[i] |
| d.Struct(&(*curr)) |
| } |
| } |
| } |
| func doDecodeRawCubemap(d binary.Decoder, o *Cubemap) { |
| if count := d.Count(); count > 0 { |
| o.Levels = make([]CubemapLevel, count) |
| for i := range o.Levels { |
| curr := &o.Levels[i] |
| d.Struct(&(*curr)) |
| } |
| } |
| } |
| func (*binaryClassCubemap) Encode(e binary.Encoder, obj binary.Object) { |
| doEncodeCubemap(e, obj.(*Cubemap)) |
| } |
| func (*binaryClassCubemap) New() binary.Object { |
| return &Cubemap{} |
| } |
| func (*binaryClassCubemap) DecodeTo(d binary.Decoder, obj binary.Object) { |
| doDecodeCubemap(d, obj.(*Cubemap)) |
| } |
| func (c *binaryClassCubemap) Schema() *binary.Entity { |
| return &entities[ixǁCubemap] |
| } |
| |
| type binaryClassIndexBuffer struct{} |
| |
| func (*IndexBuffer) Class() binary.Class { |
| return (*binaryClassIndexBuffer)(nil) |
| } |
| func doEncodeIndexBuffer(e binary.Writer, o *IndexBuffer) { |
| e.Uint32(uint32(len(o.Indices))) |
| for i := range o.Indices { |
| curr := &o.Indices[i] |
| e.Uint32(*curr) |
| } |
| } |
| func doDecodeIndexBuffer(d binary.Reader, o *IndexBuffer) { |
| if count := d.Count(); count > 0 { |
| o.Indices = make([]uint32, count) |
| for i := range o.Indices { |
| curr := &o.Indices[i] |
| *curr = uint32(d.Uint32()) |
| } |
| } |
| } |
| func doDecodeRawIndexBuffer(d binary.Reader, o *IndexBuffer) { |
| if count := d.Count(); count > 0 { |
| o.Indices = make([]uint32, count) |
| for i := range o.Indices { |
| curr := &o.Indices[i] |
| *curr = uint32(d.Uint32()) |
| } |
| } |
| } |
| func (*binaryClassIndexBuffer) Encode(e binary.Encoder, obj binary.Object) { |
| doEncodeIndexBuffer(e, obj.(*IndexBuffer)) |
| } |
| func (*binaryClassIndexBuffer) New() binary.Object { |
| return &IndexBuffer{} |
| } |
| func (*binaryClassIndexBuffer) DecodeTo(d binary.Decoder, obj binary.Object) { |
| doDecodeIndexBuffer(d, obj.(*IndexBuffer)) |
| } |
| func (o *IndexBuffer) WriteSimple(w binary.Writer) { |
| doEncodeIndexBuffer(w, o) |
| } |
| func (o *IndexBuffer) ReadSimple(r binary.Reader) { |
| doDecodeIndexBuffer(r, o) |
| } |
| func (c *binaryClassIndexBuffer) Schema() *binary.Entity { |
| return &entities[ixǁIndexBuffer] |
| } |
| |
| type binaryClassMesh struct{} |
| |
| func (*Mesh) Class() binary.Class { |
| return (*binaryClassMesh)(nil) |
| } |
| func doEncodeMesh(e binary.Encoder, o *Mesh) { |
| e.Int32(int32(o.DrawPrimitive)) |
| if o.VertexBuffer != nil { |
| e.Object(o.VertexBuffer) |
| } else { |
| e.Object(nil) |
| } |
| if o.IndexBuffer != nil { |
| e.Object(o.IndexBuffer) |
| } else { |
| e.Object(nil) |
| } |
| } |
| func doDecodeMesh(d binary.Decoder, o *Mesh) { |
| o.DrawPrimitive = DrawPrimitive(d.Int32()) |
| if obj := d.Object(); obj != nil { |
| o.VertexBuffer = obj.(*vertex.Buffer) |
| } else { |
| o.VertexBuffer = nil |
| } |
| if obj := d.Object(); obj != nil { |
| o.IndexBuffer = obj.(*IndexBuffer) |
| } else { |
| o.IndexBuffer = nil |
| } |
| } |
| func doDecodeRawMesh(d binary.Decoder, o *Mesh) { |
| o.DrawPrimitive = DrawPrimitive(d.Int32()) |
| if obj := d.Object(); obj != nil { |
| o.VertexBuffer = obj.(*vertex.Buffer) |
| } else { |
| o.VertexBuffer = nil |
| } |
| if obj := d.Object(); obj != nil { |
| o.IndexBuffer = obj.(*IndexBuffer) |
| } else { |
| o.IndexBuffer = nil |
| } |
| } |
| func (*binaryClassMesh) Encode(e binary.Encoder, obj binary.Object) { |
| doEncodeMesh(e, obj.(*Mesh)) |
| } |
| func (*binaryClassMesh) New() binary.Object { |
| return &Mesh{} |
| } |
| func (*binaryClassMesh) DecodeTo(d binary.Decoder, obj binary.Object) { |
| doDecodeMesh(d, obj.(*Mesh)) |
| } |
| func (c *binaryClassMesh) Schema() *binary.Entity { |
| return &entities[ixǁMesh] |
| } |
| |
| type binaryClassUniform struct{} |
| |
| func (*Uniform) Class() binary.Class { |
| return (*binaryClassUniform)(nil) |
| } |
| func doEncodeUniform(e binary.Encoder, o *Uniform) { |
| e.Uint32(o.UniformLocation) |
| e.String(o.Name) |
| e.Int32(int32(o.Format)) |
| e.Int32(int32(o.Type)) |
| schema.Any{}.EncodeValue(e, o.Value) |
| } |
| func doDecodeUniform(d binary.Decoder, o *Uniform) { |
| o.UniformLocation = uint32(d.Uint32()) |
| o.Name = string(d.String()) |
| o.Format = UniformFormat(d.Int32()) |
| o.Type = UniformType(d.Int32()) |
| o.Value = schema.Any{}.DecodeValue(d) |
| } |
| func doDecodeRawUniform(d binary.Decoder, o *Uniform) { |
| o.UniformLocation = uint32(d.Uint32()) |
| o.Name = string(d.String()) |
| o.Format = UniformFormat(d.Int32()) |
| o.Type = UniformType(d.Int32()) |
| o.Value = schema.Any{}.DecodeValue(d) |
| } |
| func (*binaryClassUniform) Encode(e binary.Encoder, obj binary.Object) { |
| doEncodeUniform(e, obj.(*Uniform)) |
| } |
| func (*binaryClassUniform) New() binary.Object { |
| return &Uniform{} |
| } |
| func (*binaryClassUniform) DecodeTo(d binary.Decoder, obj binary.Object) { |
| doDecodeUniform(d, obj.(*Uniform)) |
| } |
| func (c *binaryClassUniform) Schema() *binary.Entity { |
| return &entities[ixǁUniform] |
| } |
| |
| type binaryClassProgram struct{} |
| |
| func (*Program) Class() binary.Class { |
| return (*binaryClassProgram)(nil) |
| } |
| func doEncodeProgram(e binary.Encoder, o *Program) { |
| e.Uint32(uint32(len(o.Shaders))) |
| for _, k := range (o.Shaders).KeysSorted() { |
| v := (o.Shaders)[k] |
| e.Int32(int32(k)) |
| e.Data(v[:20]) |
| } |
| e.Uint32(uint32(len(o.Uniforms))) |
| for i := range o.Uniforms { |
| curr := &o.Uniforms[i] |
| e.Struct(&(*curr)) |
| } |
| } |
| func doDecodeProgram(d binary.Decoder, o *Program) { |
| if count := d.Count(); count > 0 { |
| o.Shaders = make(ShaderTypeMap, count) |
| m := o.Shaders |
| for i := uint32(0); i < count; i++ { |
| var k ShaderType |
| var v path.ResourceID |
| k = ShaderType(d.Int32()) |
| d.Data(v[:20]) |
| m[k] = v |
| } |
| } |
| if count := d.Count(); count > 0 { |
| o.Uniforms = make([]Uniform, count) |
| for i := range o.Uniforms { |
| curr := &o.Uniforms[i] |
| d.Struct(&(*curr)) |
| } |
| } |
| } |
| func doDecodeRawProgram(d binary.Decoder, o *Program) { |
| if count := d.Count(); count > 0 { |
| o.Shaders = make(ShaderTypeMap, count) |
| m := o.Shaders |
| for i := uint32(0); i < count; i++ { |
| var k ShaderType |
| var v path.ResourceID |
| k = ShaderType(d.Int32()) |
| d.Data(v[:20]) |
| m[k] = v |
| } |
| } |
| if count := d.Count(); count > 0 { |
| o.Uniforms = make([]Uniform, count) |
| for i := range o.Uniforms { |
| curr := &o.Uniforms[i] |
| d.Struct(&(*curr)) |
| } |
| } |
| } |
| func (*binaryClassProgram) Encode(e binary.Encoder, obj binary.Object) { |
| doEncodeProgram(e, obj.(*Program)) |
| } |
| func (*binaryClassProgram) New() binary.Object { |
| return &Program{} |
| } |
| func (*binaryClassProgram) DecodeTo(d binary.Decoder, obj binary.Object) { |
| doDecodeProgram(d, obj.(*Program)) |
| } |
| func (c *binaryClassProgram) Schema() *binary.Entity { |
| return &entities[ixǁProgram] |
| } |
| |
| type binaryClassShader struct{} |
| |
| func (*Shader) Class() binary.Class { |
| return (*binaryClassShader)(nil) |
| } |
| func doEncodeShader(e binary.Writer, o *Shader) { |
| e.Int32(int32(o.ShaderType)) |
| e.String(o.Source) |
| } |
| func doDecodeShader(d binary.Reader, o *Shader) { |
| o.ShaderType = ShaderType(d.Int32()) |
| o.Source = string(d.String()) |
| } |
| func doDecodeRawShader(d binary.Reader, o *Shader) { |
| o.ShaderType = ShaderType(d.Int32()) |
| o.Source = string(d.String()) |
| } |
| func (*binaryClassShader) Encode(e binary.Encoder, obj binary.Object) { |
| doEncodeShader(e, obj.(*Shader)) |
| } |
| func (*binaryClassShader) New() binary.Object { |
| return &Shader{} |
| } |
| func (*binaryClassShader) DecodeTo(d binary.Decoder, obj binary.Object) { |
| doDecodeShader(d, obj.(*Shader)) |
| } |
| func (o *Shader) WriteSimple(w binary.Writer) { |
| doEncodeShader(w, o) |
| } |
| func (o *Shader) ReadSimple(r binary.Reader) { |
| doDecodeShader(r, o) |
| } |
| func (c *binaryClassShader) Schema() *binary.Entity { |
| return &entities[ixǁShader] |
| } |
| |
| type binaryClassTexture2D struct{} |
| |
| func (*Texture2D) Class() binary.Class { |
| return (*binaryClassTexture2D)(nil) |
| } |
| func doEncodeTexture2D(e binary.Encoder, o *Texture2D) { |
| e.Uint32(uint32(len(o.Levels))) |
| for i := range o.Levels { |
| curr := &o.Levels[i] |
| e.Struct(&(*curr)) |
| } |
| } |
| func doDecodeTexture2D(d binary.Decoder, o *Texture2D) { |
| if count := d.Count(); count > 0 { |
| o.Levels = make([]image.Info, count) |
| for i := range o.Levels { |
| curr := &o.Levels[i] |
| d.Struct(&(*curr)) |
| } |
| } |
| } |
| func doDecodeRawTexture2D(d binary.Decoder, o *Texture2D) { |
| if count := d.Count(); count > 0 { |
| o.Levels = make([]image.Info, count) |
| for i := range o.Levels { |
| curr := &o.Levels[i] |
| d.Struct(&(*curr)) |
| } |
| } |
| } |
| func (*binaryClassTexture2D) Encode(e binary.Encoder, obj binary.Object) { |
| doEncodeTexture2D(e, obj.(*Texture2D)) |
| } |
| func (*binaryClassTexture2D) New() binary.Object { |
| return &Texture2D{} |
| } |
| func (*binaryClassTexture2D) DecodeTo(d binary.Decoder, obj binary.Object) { |
| doDecodeTexture2D(d, obj.(*Texture2D)) |
| } |
| func (c *binaryClassTexture2D) Schema() *binary.Entity { |
| return &entities[ixǁTexture2D] |
| } |