Commands.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. * Copyright (c) 2022, Stephan Unverwerth <s.unverwerth@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/Types.h>
  8. #include <LibVirtGPU/VirGLProtocol.h>
  9. namespace VirtGPU {
  10. struct CreateBlendCommand {
  11. union S0Flags {
  12. struct {
  13. u32 independent_blend_enable : 1;
  14. u32 logicop_enable : 1;
  15. u32 dither : 1;
  16. u32 alpha_to_coverage : 1;
  17. u32 alpha_to_one : 1;
  18. u32 unused : 27;
  19. };
  20. u32 u32_value;
  21. };
  22. union S1Flags {
  23. struct {
  24. u32 logicop_func : 4;
  25. u32 unused : 28;
  26. };
  27. u32 u32_value;
  28. };
  29. union S2Flags {
  30. struct {
  31. u32 blend_enable : 1;
  32. u32 rgb_func : 3;
  33. u32 rgb_src_factor : 5;
  34. u32 rgb_dst_factor : 5;
  35. u32 alpha_func : 3;
  36. u32 alpha_src_factor : 5;
  37. u32 alpha_dst_factor : 5;
  38. u32 colormask : 4;
  39. u32 unused : 1;
  40. };
  41. u32 u32_value;
  42. };
  43. };
  44. struct CreateVertexElementsCommand {
  45. struct ElementBinding {
  46. u32 offset;
  47. u32 divisor;
  48. u32 vertex_buffer_index;
  49. Gallium::PipeFormat format;
  50. };
  51. };
  52. struct CreateRasterizerCommand {
  53. union S0Flags {
  54. struct {
  55. u32 flatshade : 1;
  56. u32 depth_clip : 1;
  57. u32 clip_halfz : 1;
  58. u32 rasterizer_discard : 1;
  59. u32 flatshade_first : 1;
  60. u32 light_twoside : 1;
  61. u32 sprite_coord_mode : 1;
  62. u32 point_quad_rasterization : 1;
  63. u32 cull_face : 2;
  64. u32 fill_front : 2;
  65. u32 fill_back : 2;
  66. u32 scissor : 1;
  67. u32 front_ccw : 1;
  68. u32 clamp_vertex_color : 1;
  69. u32 clamp_fragment_color : 1;
  70. u32 offset_line : 1;
  71. u32 offset_point : 1;
  72. u32 offset_tri : 1;
  73. u32 poly_smooth : 1;
  74. u32 poly_stipple_enable : 1;
  75. u32 point_smooth : 1;
  76. u32 point_size_per_vertex : 1;
  77. u32 multisample : 1;
  78. u32 line_smooth : 1;
  79. u32 line_stipple_enable : 1;
  80. u32 line_last_pixel : 1;
  81. u32 half_pixel_center : 1;
  82. u32 bottom_edge_rule : 1;
  83. u32 force_persample_interp : 1;
  84. };
  85. u32 u32_value;
  86. };
  87. union S3Flags {
  88. struct {
  89. u32 line_stipple_pattern : 16;
  90. u32 line_stipple_factor : 8;
  91. u32 clip_plane_enable : 8;
  92. };
  93. u32 u32_value;
  94. };
  95. };
  96. struct CreateDSACommand {
  97. union S0Flags {
  98. struct {
  99. u32 depth_enabled : 1;
  100. u32 depth_writemask : 1;
  101. u32 depth_func : 3;
  102. u32 unused : 27;
  103. };
  104. u32 u32_value;
  105. };
  106. union S1Flags {
  107. struct {
  108. u32 stencil_enabled : 1;
  109. u32 stencil_func : 3;
  110. u32 stencil_fail_op : 3;
  111. u32 stencil_zpass_op : 3;
  112. u32 stencil_zfail_op : 3;
  113. u32 stencil_valuemask : 8;
  114. u32 stencil_writemask : 8;
  115. u32 unused : 3;
  116. };
  117. u32 u32_value;
  118. };
  119. };
  120. }