1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
  147
  148
  149
  150
  151
  152
  153
  154
  155
  156
  157
  158
  159
  160
  161
  162
  163
  164
  165
  166
  167
  168
  169
  170
  171
  172
  173
  174
  175
  176
  177
  178
  179
  180
  181
  182
  183
  184
  185
  186
  187
  188
  189
  190
  191
  192
  193
  194
  195
  196
  197
  198
  199
  200
  201
  202
  203
  204
  205
  206
  207
  208
  209
  210
  211
  212
  213
  214
  215
  216
  217
  218
  219
  220
  221
  222
  223
  224
  225
  226
  227
  228
  229
  230
  231
  232
  233
  234
  235
  236
  237
  238
  239
  240
  241
  242
  243
  244
  245
  246
  247
  248
  249
  250
  251
  252
  253
  254
  255
  256
  257
  258
  259
  260
  261
  262
  263
  264
  265
  266
  267
  268
  269
  270
  271
  272
  273
  274
  275
  276
  277
  278
  279
  280
  281
  282
  283
  284
  285
  286
  287
  288
  289
  290
  291
  292
  293
  294
  295
  296
  297
  298
  299
  300
  301
  302
  303
  304
  305
  306
  307
  308
  309
  310
  311
  312
  313
  314
  315
  316
  317
  318
  319
  320
  321
  322
  323
  324
  325
  326
  327
  328
  329
  330
  331
  332
  333
  334
  335
  336
  337
  338
  339
  340
  341
  342
  343
  344
  345
  346
  347
  348
  349
  350
  351
  352
  353
  354
  355
  356
  357
  358
  359
  360
  361
  362
  363
  364
  365
  366
  367
  368
  369
  370
  371
  372
  373
  374
  375
  376
  377
  378
  379
  380
  381
  382
  383
  384
  385
  386
  387
  388
  389
  390
  391
  392
  393
  394
  395
  396
  397
  398
  399
  400
  401
  402
  403
  404
  405
  406
  407
  408
  409
  410
  411
  412
  413
  414
  415
  416
  417
  418
  419
  420
  421
  422
  423
  424
  425
  426
  427
  428
  429
  430
  431
  432
  433
  434
  435

gpu / command_buffer / common / webgpu_cmd_format_autogen.h [blame]

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// This file is auto-generated from
// gpu/command_buffer/build_webgpu_cmd_buffer.py
// It's formatted by clang-format using chromium coding style:
//    clang-format -i -style=chromium filename
// DO NOT EDIT!

#ifndef GPU_COMMAND_BUFFER_COMMON_WEBGPU_CMD_FORMAT_AUTOGEN_H_
#define GPU_COMMAND_BUFFER_COMMON_WEBGPU_CMD_FORMAT_AUTOGEN_H_

struct DawnCommands {
  typedef DawnCommands ValueType;
  static const CommandId kCmdId = kDawnCommands;
  static const cmd::ArgFlags kArgFlags = cmd::kFixed;
  static const uint8_t cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3);

  static uint32_t ComputeSize() {
    return static_cast<uint32_t>(sizeof(ValueType));  // NOLINT
  }

  void SetHeader() { header.SetCmd<ValueType>(); }

  void Init(uint32_t _trace_id_high,
            uint32_t _trace_id_low,
            uint32_t _commands_shm_id,
            uint32_t _commands_shm_offset,
            uint32_t _size) {
    SetHeader();
    trace_id_high = _trace_id_high;
    trace_id_low = _trace_id_low;
    commands_shm_id = _commands_shm_id;
    commands_shm_offset = _commands_shm_offset;
    size = _size;
  }

  void* Set(void* cmd,
            uint32_t _trace_id_high,
            uint32_t _trace_id_low,
            uint32_t _commands_shm_id,
            uint32_t _commands_shm_offset,
            uint32_t _size) {
    static_cast<ValueType*>(cmd)->Init(_trace_id_high, _trace_id_low,
                                       _commands_shm_id, _commands_shm_offset,
                                       _size);
    return NextCmdAddress<ValueType>(cmd);
  }

  gpu::CommandHeader header;
  uint32_t trace_id_high;
  uint32_t trace_id_low;
  uint32_t commands_shm_id;
  uint32_t commands_shm_offset;
  uint32_t size;
};

static_assert(sizeof(DawnCommands) == 24, "size of DawnCommands should be 24");
static_assert(offsetof(DawnCommands, header) == 0,
              "offset of DawnCommands header should be 0");
static_assert(offsetof(DawnCommands, trace_id_high) == 4,
              "offset of DawnCommands trace_id_high should be 4");
static_assert(offsetof(DawnCommands, trace_id_low) == 8,
              "offset of DawnCommands trace_id_low should be 8");
static_assert(offsetof(DawnCommands, commands_shm_id) == 12,
              "offset of DawnCommands commands_shm_id should be 12");
static_assert(offsetof(DawnCommands, commands_shm_offset) == 16,
              "offset of DawnCommands commands_shm_offset should be 16");
static_assert(offsetof(DawnCommands, size) == 20,
              "offset of DawnCommands size should be 20");

struct AssociateMailboxImmediate {
  typedef AssociateMailboxImmediate ValueType;
  static const CommandId kCmdId = kAssociateMailboxImmediate;
  static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN;
  static const uint8_t cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3);

  static uint32_t ComputeDataSize(GLsizei _n) {
    return static_cast<uint32_t>(sizeof(GLuint) * 1 * _n);  // NOLINT
  }

  static uint32_t ComputeSize(GLsizei _n) {
    return static_cast<uint32_t>(sizeof(ValueType) +
                                 ComputeDataSize(_n));  // NOLINT
  }

  void SetHeader(GLsizei _n) {
    header.SetCmdByTotalSize<ValueType>(ComputeSize(_n));
  }

  void Init(GLuint _device_id,
            GLuint _device_generation,
            GLuint _id,
            GLuint _generation,
            uint64_t _usage,
            uint64_t _internal_usage,
            MailboxFlags _flags,
            GLuint _view_format_count,
            GLuint _count,
            const GLuint* _mailbox_and_view_formats) {
    SetHeader(_count);
    device_id = _device_id;
    device_generation = _device_generation;
    id = _id;
    generation = _generation;
    usage = _usage;
    internal_usage = _internal_usage;
    flags = _flags;
    view_format_count = _view_format_count;
    count = _count;
    memcpy(ImmediateDataAddress(this), _mailbox_and_view_formats,
           ComputeDataSize(_count));
  }

  void* Set(void* cmd,
            GLuint _device_id,
            GLuint _device_generation,
            GLuint _id,
            GLuint _generation,
            uint64_t _usage,
            uint64_t _internal_usage,
            MailboxFlags _flags,
            GLuint _view_format_count,
            GLuint _count,
            const GLuint* _mailbox_and_view_formats) {
    static_cast<ValueType*>(cmd)->Init(_device_id, _device_generation, _id,
                                       _generation, _usage, _internal_usage,
                                       _flags, _view_format_count, _count,
                                       _mailbox_and_view_formats);
    const uint32_t size = ComputeSize(_count);
    return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size);
  }

  gpu::CommandHeader header;
  uint32_t device_id;
  uint32_t device_generation;
  uint32_t id;
  uint32_t generation;
  uint32_t usage;
  uint32_t internal_usage;
  uint32_t flags;
  uint32_t view_format_count;
  uint32_t count;
};

static_assert(sizeof(AssociateMailboxImmediate) == 40,
              "size of AssociateMailboxImmediate should be 40");
static_assert(offsetof(AssociateMailboxImmediate, header) == 0,
              "offset of AssociateMailboxImmediate header should be 0");
static_assert(offsetof(AssociateMailboxImmediate, device_id) == 4,
              "offset of AssociateMailboxImmediate device_id should be 4");
static_assert(
    offsetof(AssociateMailboxImmediate, device_generation) == 8,
    "offset of AssociateMailboxImmediate device_generation should be 8");
static_assert(offsetof(AssociateMailboxImmediate, id) == 12,
              "offset of AssociateMailboxImmediate id should be 12");
static_assert(offsetof(AssociateMailboxImmediate, generation) == 16,
              "offset of AssociateMailboxImmediate generation should be 16");
static_assert(offsetof(AssociateMailboxImmediate, usage) == 20,
              "offset of AssociateMailboxImmediate usage should be 20");
static_assert(
    offsetof(AssociateMailboxImmediate, internal_usage) == 24,
    "offset of AssociateMailboxImmediate internal_usage should be 24");
static_assert(offsetof(AssociateMailboxImmediate, flags) == 28,
              "offset of AssociateMailboxImmediate flags should be 28");
static_assert(
    offsetof(AssociateMailboxImmediate, view_format_count) == 32,
    "offset of AssociateMailboxImmediate view_format_count should be 32");
static_assert(offsetof(AssociateMailboxImmediate, count) == 36,
              "offset of AssociateMailboxImmediate count should be 36");

struct AssociateMailboxForBufferImmediate {
  typedef AssociateMailboxForBufferImmediate ValueType;
  static const CommandId kCmdId = kAssociateMailboxForBufferImmediate;
  static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN;
  static const uint8_t cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3);

  static uint32_t ComputeDataSize() {
    return static_cast<uint32_t>(sizeof(GLuint) * 4);
  }

  static uint32_t ComputeSize() {
    return static_cast<uint32_t>(sizeof(ValueType) + ComputeDataSize());
  }

  void SetHeader() { header.SetCmdByTotalSize<ValueType>(ComputeSize()); }

  void Init(GLuint _device_id,
            GLuint _device_generation,
            GLuint _id,
            GLuint _generation,
            uint64_t _usage,
            const GLuint* _mailbox) {
    SetHeader();
    device_id = _device_id;
    device_generation = _device_generation;
    id = _id;
    generation = _generation;
    usage = _usage;
    memcpy(ImmediateDataAddress(this), _mailbox, ComputeDataSize());
  }

  void* Set(void* cmd,
            GLuint _device_id,
            GLuint _device_generation,
            GLuint _id,
            GLuint _generation,
            uint64_t _usage,
            const GLuint* _mailbox) {
    static_cast<ValueType*>(cmd)->Init(_device_id, _device_generation, _id,
                                       _generation, _usage, _mailbox);
    const uint32_t size = ComputeSize();
    return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size);
  }

  gpu::CommandHeader header;
  uint32_t device_id;
  uint32_t device_generation;
  uint32_t id;
  uint32_t generation;
  uint32_t usage;
};

static_assert(sizeof(AssociateMailboxForBufferImmediate) == 24,
              "size of AssociateMailboxForBufferImmediate should be 24");
static_assert(
    offsetof(AssociateMailboxForBufferImmediate, header) == 0,
    "offset of AssociateMailboxForBufferImmediate header should be 0");
static_assert(
    offsetof(AssociateMailboxForBufferImmediate, device_id) == 4,
    "offset of AssociateMailboxForBufferImmediate device_id should be 4");
static_assert(offsetof(AssociateMailboxForBufferImmediate, device_generation) ==
                  8,
              "offset of AssociateMailboxForBufferImmediate device_generation "
              "should be 8");
static_assert(offsetof(AssociateMailboxForBufferImmediate, id) == 12,
              "offset of AssociateMailboxForBufferImmediate id should be 12");
static_assert(
    offsetof(AssociateMailboxForBufferImmediate, generation) == 16,
    "offset of AssociateMailboxForBufferImmediate generation should be 16");
static_assert(
    offsetof(AssociateMailboxForBufferImmediate, usage) == 20,
    "offset of AssociateMailboxForBufferImmediate usage should be 20");

struct DissociateMailbox {
  typedef DissociateMailbox ValueType;
  static const CommandId kCmdId = kDissociateMailbox;
  static const cmd::ArgFlags kArgFlags = cmd::kFixed;
  static const uint8_t cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3);

  static uint32_t ComputeSize() {
    return static_cast<uint32_t>(sizeof(ValueType));  // NOLINT
  }

  void SetHeader() { header.SetCmd<ValueType>(); }

  void Init(GLuint _texture_id, GLuint _texture_generation) {
    SetHeader();
    texture_id = _texture_id;
    texture_generation = _texture_generation;
  }

  void* Set(void* cmd, GLuint _texture_id, GLuint _texture_generation) {
    static_cast<ValueType*>(cmd)->Init(_texture_id, _texture_generation);
    return NextCmdAddress<ValueType>(cmd);
  }

  gpu::CommandHeader header;
  uint32_t texture_id;
  uint32_t texture_generation;
};

static_assert(sizeof(DissociateMailbox) == 12,
              "size of DissociateMailbox should be 12");
static_assert(offsetof(DissociateMailbox, header) == 0,
              "offset of DissociateMailbox header should be 0");
static_assert(offsetof(DissociateMailbox, texture_id) == 4,
              "offset of DissociateMailbox texture_id should be 4");
static_assert(offsetof(DissociateMailbox, texture_generation) == 8,
              "offset of DissociateMailbox texture_generation should be 8");

struct DissociateMailboxForBuffer {
  typedef DissociateMailboxForBuffer ValueType;
  static const CommandId kCmdId = kDissociateMailboxForBuffer;
  static const cmd::ArgFlags kArgFlags = cmd::kFixed;
  static const uint8_t cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3);

  static uint32_t ComputeSize() {
    return static_cast<uint32_t>(sizeof(ValueType));  // NOLINT
  }

  void SetHeader() { header.SetCmd<ValueType>(); }

  void Init(GLuint _buffer_id, GLuint _buffer_generation) {
    SetHeader();
    buffer_id = _buffer_id;
    buffer_generation = _buffer_generation;
  }

  void* Set(void* cmd, GLuint _buffer_id, GLuint _buffer_generation) {
    static_cast<ValueType*>(cmd)->Init(_buffer_id, _buffer_generation);
    return NextCmdAddress<ValueType>(cmd);
  }

  gpu::CommandHeader header;
  uint32_t buffer_id;
  uint32_t buffer_generation;
};

static_assert(sizeof(DissociateMailboxForBuffer) == 12,
              "size of DissociateMailboxForBuffer should be 12");
static_assert(offsetof(DissociateMailboxForBuffer, header) == 0,
              "offset of DissociateMailboxForBuffer header should be 0");
static_assert(offsetof(DissociateMailboxForBuffer, buffer_id) == 4,
              "offset of DissociateMailboxForBuffer buffer_id should be 4");
static_assert(
    offsetof(DissociateMailboxForBuffer, buffer_generation) == 8,
    "offset of DissociateMailboxForBuffer buffer_generation should be 8");

struct DissociateMailboxForPresent {
  typedef DissociateMailboxForPresent ValueType;
  static const CommandId kCmdId = kDissociateMailboxForPresent;
  static const cmd::ArgFlags kArgFlags = cmd::kFixed;
  static const uint8_t cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3);

  static uint32_t ComputeSize() {
    return static_cast<uint32_t>(sizeof(ValueType));  // NOLINT
  }

  void SetHeader() { header.SetCmd<ValueType>(); }

  void Init(GLuint _device_id,
            GLuint _device_generation,
            GLuint _texture_id,
            GLuint _texture_generation) {
    SetHeader();
    device_id = _device_id;
    device_generation = _device_generation;
    texture_id = _texture_id;
    texture_generation = _texture_generation;
  }

  void* Set(void* cmd,
            GLuint _device_id,
            GLuint _device_generation,
            GLuint _texture_id,
            GLuint _texture_generation) {
    static_cast<ValueType*>(cmd)->Init(_device_id, _device_generation,
                                       _texture_id, _texture_generation);
    return NextCmdAddress<ValueType>(cmd);
  }

  gpu::CommandHeader header;
  uint32_t device_id;
  uint32_t device_generation;
  uint32_t texture_id;
  uint32_t texture_generation;
};

static_assert(sizeof(DissociateMailboxForPresent) == 20,
              "size of DissociateMailboxForPresent should be 20");
static_assert(offsetof(DissociateMailboxForPresent, header) == 0,
              "offset of DissociateMailboxForPresent header should be 0");
static_assert(offsetof(DissociateMailboxForPresent, device_id) == 4,
              "offset of DissociateMailboxForPresent device_id should be 4");
static_assert(
    offsetof(DissociateMailboxForPresent, device_generation) == 8,
    "offset of DissociateMailboxForPresent device_generation should be 8");
static_assert(offsetof(DissociateMailboxForPresent, texture_id) == 12,
              "offset of DissociateMailboxForPresent texture_id should be 12");
static_assert(
    offsetof(DissociateMailboxForPresent, texture_generation) == 16,
    "offset of DissociateMailboxForPresent texture_generation should be 16");

struct SetWebGPUExecutionContextToken {
  typedef SetWebGPUExecutionContextToken ValueType;
  static const CommandId kCmdId = kSetWebGPUExecutionContextToken;
  static const cmd::ArgFlags kArgFlags = cmd::kFixed;
  static const uint8_t cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3);

  static uint32_t ComputeSize() {
    return static_cast<uint32_t>(sizeof(ValueType));  // NOLINT
  }

  void SetHeader() { header.SetCmd<ValueType>(); }

  void Init(uint32_t _type,
            uint32_t _high_high,
            uint32_t _high_low,
            uint32_t _low_high,
            uint32_t _low_low) {
    SetHeader();
    type = _type;
    high_high = _high_high;
    high_low = _high_low;
    low_high = _low_high;
    low_low = _low_low;
  }

  void* Set(void* cmd,
            uint32_t _type,
            uint32_t _high_high,
            uint32_t _high_low,
            uint32_t _low_high,
            uint32_t _low_low) {
    static_cast<ValueType*>(cmd)->Init(_type, _high_high, _high_low, _low_high,
                                       _low_low);
    return NextCmdAddress<ValueType>(cmd);
  }

  gpu::CommandHeader header;
  uint32_t type;
  uint32_t high_high;
  uint32_t high_low;
  uint32_t low_high;
  uint32_t low_low;
};

static_assert(sizeof(SetWebGPUExecutionContextToken) == 24,
              "size of SetWebGPUExecutionContextToken should be 24");
static_assert(offsetof(SetWebGPUExecutionContextToken, header) == 0,
              "offset of SetWebGPUExecutionContextToken header should be 0");
static_assert(offsetof(SetWebGPUExecutionContextToken, type) == 4,
              "offset of SetWebGPUExecutionContextToken type should be 4");
static_assert(offsetof(SetWebGPUExecutionContextToken, high_high) == 8,
              "offset of SetWebGPUExecutionContextToken high_high should be 8");
static_assert(offsetof(SetWebGPUExecutionContextToken, high_low) == 12,
              "offset of SetWebGPUExecutionContextToken high_low should be 12");
static_assert(offsetof(SetWebGPUExecutionContextToken, low_high) == 16,
              "offset of SetWebGPUExecutionContextToken low_high should be 16");
static_assert(offsetof(SetWebGPUExecutionContextToken, low_low) == 20,
              "offset of SetWebGPUExecutionContextToken low_low should be 20");

#endif  // GPU_COMMAND_BUFFER_COMMON_WEBGPU_CMD_FORMAT_AUTOGEN_H_