pub mod gen45 {
use crate::*;
#[derive(Clone, Copy)]
pub enum _3dColorBufferBlendFactor {
_3dColorBufferBlendFactorOne,
_3dColorBufferBlendFactorSrcColor,
_3dColorBufferBlendFactorSrcAlpha,
_3dColorBufferBlendFactorDstAlpha,
_3dColorBufferBlendFactorDstColor,
_3dColorBufferBlendFactorSrcAlphaSaturate,
_3dColorBufferBlendFactorConstColor,
_3dColorBufferBlendFactorConstAlpha,
_3dColorBufferBlendFactorSrc1Color,
_3dColorBufferBlendFactorSrc1Alpha,
_3dColorBufferBlendFactorZero,
_3dColorBufferBlendFactorInvSrcColor,
_3dColorBufferBlendFactorInvSrcAlpha,
_3dColorBufferBlendFactorInvDstAlpha,
_3dColorBufferBlendFactorInvDstColor,
_3dColorBufferBlendFactorInvConstColor,
_3dColorBufferBlendFactorInvConstAlpha,
_3dColorBufferBlendFactorInvSrc1Color,
_3dColorBufferBlendFactorInvSrc1Alpha,
Unknown(u32),
}
impl Into<u32> for _3dColorBufferBlendFactor {
fn into(self) -> u32 {
type E = _3dColorBufferBlendFactor;
match self {
E::_3dColorBufferBlendFactorOne => 1,
E::_3dColorBufferBlendFactorSrcColor => 2,
E::_3dColorBufferBlendFactorSrcAlpha => 3,
E::_3dColorBufferBlendFactorDstAlpha => 4,
E::_3dColorBufferBlendFactorDstColor => 5,
E::_3dColorBufferBlendFactorSrcAlphaSaturate => 6,
E::_3dColorBufferBlendFactorConstColor => 7,
E::_3dColorBufferBlendFactorConstAlpha => 8,
E::_3dColorBufferBlendFactorSrc1Color => 9,
E::_3dColorBufferBlendFactorSrc1Alpha => 10,
E::_3dColorBufferBlendFactorZero => 17,
E::_3dColorBufferBlendFactorInvSrcColor => 18,
E::_3dColorBufferBlendFactorInvSrcAlpha => 19,
E::_3dColorBufferBlendFactorInvDstAlpha => 20,
E::_3dColorBufferBlendFactorInvDstColor => 21,
E::_3dColorBufferBlendFactorInvConstColor => 23,
E::_3dColorBufferBlendFactorInvConstAlpha => 24,
E::_3dColorBufferBlendFactorInvSrc1Color => 25,
E::_3dColorBufferBlendFactorInvSrc1Alpha => 26,
E::Unknown(val) => val,
}
}
}
impl From<u32> for _3dColorBufferBlendFactor {
fn from(val: u32) -> Self {
match val {
1 => Self::_3dColorBufferBlendFactorOne,
2 => Self::_3dColorBufferBlendFactorSrcColor,
3 => Self::_3dColorBufferBlendFactorSrcAlpha,
4 => Self::_3dColorBufferBlendFactorDstAlpha,
5 => Self::_3dColorBufferBlendFactorDstColor,
6 => Self::_3dColorBufferBlendFactorSrcAlphaSaturate,
7 => Self::_3dColorBufferBlendFactorConstColor,
8 => Self::_3dColorBufferBlendFactorConstAlpha,
9 => Self::_3dColorBufferBlendFactorSrc1Color,
10 => Self::_3dColorBufferBlendFactorSrc1Alpha,
17 => Self::_3dColorBufferBlendFactorZero,
18 => Self::_3dColorBufferBlendFactorInvSrcColor,
19 => Self::_3dColorBufferBlendFactorInvSrcAlpha,
20 => Self::_3dColorBufferBlendFactorInvDstAlpha,
21 => Self::_3dColorBufferBlendFactorInvDstColor,
23 => Self::_3dColorBufferBlendFactorInvConstColor,
24 => Self::_3dColorBufferBlendFactorInvConstAlpha,
25 => Self::_3dColorBufferBlendFactorInvSrc1Color,
26 => Self::_3dColorBufferBlendFactorInvSrc1Alpha,
_ => Self::Unknown(val),
}
}
}
impl Default for _3dColorBufferBlendFactor {
fn default() -> Self {
0u32.into()
}
}
#[derive(Clone, Copy)]
pub enum _3dColorBufferBlendFunction {
_3dColorBufferBlendFunctionAdd,
_3dColorBufferBlendFunctionSubtract,
_3dColorBufferBlendFunctionReverseSubtract,
_3dColorBufferBlendFunctionMin,
_3dColorBufferBlendFunctionMax,
Unknown(u32),
}
impl Into<u32> for _3dColorBufferBlendFunction {
fn into(self) -> u32 {
type E = _3dColorBufferBlendFunction;
match self {
E::_3dColorBufferBlendFunctionAdd => 0,
E::_3dColorBufferBlendFunctionSubtract => 1,
E::_3dColorBufferBlendFunctionReverseSubtract => 2,
E::_3dColorBufferBlendFunctionMin => 3,
E::_3dColorBufferBlendFunctionMax => 4,
E::Unknown(val) => val,
}
}
}
impl From<u32> for _3dColorBufferBlendFunction {
fn from(val: u32) -> Self {
match val {
0 => Self::_3dColorBufferBlendFunctionAdd,
1 => Self::_3dColorBufferBlendFunctionSubtract,
2 => Self::_3dColorBufferBlendFunctionReverseSubtract,
3 => Self::_3dColorBufferBlendFunctionMin,
4 => Self::_3dColorBufferBlendFunctionMax,
_ => Self::Unknown(val),
}
}
}
impl Default for _3dColorBufferBlendFunction {
fn default() -> Self {
0u32.into()
}
}
#[derive(Clone, Copy)]
pub enum _3dCompareFunction {
_3dCompareFunctionAlways,
_3dCompareFunctionNever,
_3dCompareFunctionLess,
_3dCompareFunctionEqual,
_3dCompareFunctionLequal,
_3dCompareFunctionGreater,
_3dCompareFunctionNotequal,
_3dCompareFunctionGequal,
Unknown(u32),
}
impl Into<u32> for _3dCompareFunction {
fn into(self) -> u32 {
type E = _3dCompareFunction;
match self {
E::_3dCompareFunctionAlways => 0,
E::_3dCompareFunctionNever => 1,
E::_3dCompareFunctionLess => 2,
E::_3dCompareFunctionEqual => 3,
E::_3dCompareFunctionLequal => 4,
E::_3dCompareFunctionGreater => 5,
E::_3dCompareFunctionNotequal => 6,
E::_3dCompareFunctionGequal => 7,
E::Unknown(val) => val,
}
}
}
impl From<u32> for _3dCompareFunction {
fn from(val: u32) -> Self {
match val {
0 => Self::_3dCompareFunctionAlways,
1 => Self::_3dCompareFunctionNever,
2 => Self::_3dCompareFunctionLess,
3 => Self::_3dCompareFunctionEqual,
4 => Self::_3dCompareFunctionLequal,
5 => Self::_3dCompareFunctionGreater,
6 => Self::_3dCompareFunctionNotequal,
7 => Self::_3dCompareFunctionGequal,
_ => Self::Unknown(val),
}
}
}
impl Default for _3dCompareFunction {
fn default() -> Self {
0u32.into()
}
}
#[derive(Clone, Copy)]
pub enum _3dLogicOpFunction {
_3dLogicOpFunctionClear,
_3dLogicOpFunctionNor,
_3dLogicOpFunctionAndInverted,
_3dLogicOpFunctionCopyInverted,
_3dLogicOpFunctionAndReverse,
_3dLogicOpFunctionInvert,
_3dLogicOpFunctionXor,
_3dLogicOpFunctionNand,
_3dLogicOpFunctionAnd,
_3dLogicOpFunctionEquiv,
_3dLogicOpFunctionNoop,
_3dLogicOpFunctionOrInverted,
_3dLogicOpFunctionCopy,
_3dLogicOpFunctionOrReverse,
_3dLogicOpFunctionOr,
_3dLogicOpFunctionSet,
Unknown(u32),
}
impl Into<u32> for _3dLogicOpFunction {
fn into(self) -> u32 {
type E = _3dLogicOpFunction;
match self {
E::_3dLogicOpFunctionClear => 0,
E::_3dLogicOpFunctionNor => 1,
E::_3dLogicOpFunctionAndInverted => 2,
E::_3dLogicOpFunctionCopyInverted => 3,
E::_3dLogicOpFunctionAndReverse => 4,
E::_3dLogicOpFunctionInvert => 5,
E::_3dLogicOpFunctionXor => 6,
E::_3dLogicOpFunctionNand => 7,
E::_3dLogicOpFunctionAnd => 8,
E::_3dLogicOpFunctionEquiv => 9,
E::_3dLogicOpFunctionNoop => 10,
E::_3dLogicOpFunctionOrInverted => 11,
E::_3dLogicOpFunctionCopy => 12,
E::_3dLogicOpFunctionOrReverse => 13,
E::_3dLogicOpFunctionOr => 14,
E::_3dLogicOpFunctionSet => 15,
E::Unknown(val) => val,
}
}
}
impl From<u32> for _3dLogicOpFunction {
fn from(val: u32) -> Self {
match val {
0 => Self::_3dLogicOpFunctionClear,
1 => Self::_3dLogicOpFunctionNor,
2 => Self::_3dLogicOpFunctionAndInverted,
3 => Self::_3dLogicOpFunctionCopyInverted,
4 => Self::_3dLogicOpFunctionAndReverse,
5 => Self::_3dLogicOpFunctionInvert,
6 => Self::_3dLogicOpFunctionXor,
7 => Self::_3dLogicOpFunctionNand,
8 => Self::_3dLogicOpFunctionAnd,
9 => Self::_3dLogicOpFunctionEquiv,
10 => Self::_3dLogicOpFunctionNoop,
11 => Self::_3dLogicOpFunctionOrInverted,
12 => Self::_3dLogicOpFunctionCopy,
13 => Self::_3dLogicOpFunctionOrReverse,
14 => Self::_3dLogicOpFunctionOr,
15 => Self::_3dLogicOpFunctionSet,
_ => Self::Unknown(val),
}
}
}
impl Default for _3dLogicOpFunction {
fn default() -> Self {
0u32.into()
}
}
#[derive(Clone, Copy)]
pub enum _3dPrimTopoType {
_3dPrimTopoTypePointlist,
_3dPrimTopoTypeLinelist,
_3dPrimTopoTypeLinestrip,
_3dPrimTopoTypeTrilist,
_3dPrimTopoTypeTristrip,
_3dPrimTopoTypeTrifan,
_3dPrimTopoTypeQuadlist,
_3dPrimTopoTypeQuadstrip,
_3dPrimTopoTypeLinelistAdj,
_3dPrimTopoTypeLinestripAdj,
_3dPrimTopoTypeTrilistAdj,
_3dPrimTopoTypeTristripAdj,
_3dPrimTopoTypeTristripReverse,
_3dPrimTopoTypePolygon,
_3dPrimTopoTypeRectlist,
_3dPrimTopoTypeLineloop,
_3dPrimTopoTypePointlistBf,
_3dPrimTopoTypeLinestripCont,
_3dPrimTopoTypeLinestripBf,
_3dPrimTopoTypeLinestripContBf,
_3dPrimTopoTypeTrifanNostipple,
Unknown(u32),
}
impl Into<u32> for _3dPrimTopoType {
fn into(self) -> u32 {
type E = _3dPrimTopoType;
match self {
E::_3dPrimTopoTypePointlist => 1,
E::_3dPrimTopoTypeLinelist => 2,
E::_3dPrimTopoTypeLinestrip => 3,
E::_3dPrimTopoTypeTrilist => 4,
E::_3dPrimTopoTypeTristrip => 5,
E::_3dPrimTopoTypeTrifan => 6,
E::_3dPrimTopoTypeQuadlist => 7,
E::_3dPrimTopoTypeQuadstrip => 8,
E::_3dPrimTopoTypeLinelistAdj => 9,
E::_3dPrimTopoTypeLinestripAdj => 10,
E::_3dPrimTopoTypeTrilistAdj => 11,
E::_3dPrimTopoTypeTristripAdj => 12,
E::_3dPrimTopoTypeTristripReverse => 13,
E::_3dPrimTopoTypePolygon => 14,
E::_3dPrimTopoTypeRectlist => 15,
E::_3dPrimTopoTypeLineloop => 16,
E::_3dPrimTopoTypePointlistBf => 17,
E::_3dPrimTopoTypeLinestripCont => 18,
E::_3dPrimTopoTypeLinestripBf => 19,
E::_3dPrimTopoTypeLinestripContBf => 20,
E::_3dPrimTopoTypeTrifanNostipple => 22,
E::Unknown(val) => val,
}
}
}
impl From<u32> for _3dPrimTopoType {
fn from(val: u32) -> Self {
match val {
1 => Self::_3dPrimTopoTypePointlist,
2 => Self::_3dPrimTopoTypeLinelist,
3 => Self::_3dPrimTopoTypeLinestrip,
4 => Self::_3dPrimTopoTypeTrilist,
5 => Self::_3dPrimTopoTypeTristrip,
6 => Self::_3dPrimTopoTypeTrifan,
7 => Self::_3dPrimTopoTypeQuadlist,
8 => Self::_3dPrimTopoTypeQuadstrip,
9 => Self::_3dPrimTopoTypeLinelistAdj,
10 => Self::_3dPrimTopoTypeLinestripAdj,
11 => Self::_3dPrimTopoTypeTrilistAdj,
12 => Self::_3dPrimTopoTypeTristripAdj,
13 => Self::_3dPrimTopoTypeTristripReverse,
14 => Self::_3dPrimTopoTypePolygon,
15 => Self::_3dPrimTopoTypeRectlist,
16 => Self::_3dPrimTopoTypeLineloop,
17 => Self::_3dPrimTopoTypePointlistBf,
18 => Self::_3dPrimTopoTypeLinestripCont,
19 => Self::_3dPrimTopoTypeLinestripBf,
20 => Self::_3dPrimTopoTypeLinestripContBf,
22 => Self::_3dPrimTopoTypeTrifanNostipple,
_ => Self::Unknown(val),
}
}
}
impl Default for _3dPrimTopoType {
fn default() -> Self {
0u32.into()
}
}
#[derive(Clone, Copy)]
pub enum _3dStencilOperation {
_3dStencilOperationKeep,
_3dStencilOperationZero,
_3dStencilOperationReplace,
_3dStencilOperationIncrsat,
_3dStencilOperationDecrsat,
_3dStencilOperationIncr,
_3dStencilOperationDecr,
_3dStencilOperationInvert,
Unknown(u32),
}
impl Into<u32> for _3dStencilOperation {
fn into(self) -> u32 {
type E = _3dStencilOperation;
match self {
E::_3dStencilOperationKeep => 0,
E::_3dStencilOperationZero => 1,
E::_3dStencilOperationReplace => 2,
E::_3dStencilOperationIncrsat => 3,
E::_3dStencilOperationDecrsat => 4,
E::_3dStencilOperationIncr => 5,
E::_3dStencilOperationDecr => 6,
E::_3dStencilOperationInvert => 7,
E::Unknown(val) => val,
}
}
}
impl From<u32> for _3dStencilOperation {
fn from(val: u32) -> Self {
match val {
0 => Self::_3dStencilOperationKeep,
1 => Self::_3dStencilOperationZero,
2 => Self::_3dStencilOperationReplace,
3 => Self::_3dStencilOperationIncrsat,
4 => Self::_3dStencilOperationDecrsat,
5 => Self::_3dStencilOperationIncr,
6 => Self::_3dStencilOperationDecr,
7 => Self::_3dStencilOperationInvert,
_ => Self::Unknown(val),
}
}
}
impl Default for _3dStencilOperation {
fn default() -> Self {
0u32.into()
}
}
#[derive(Clone, Copy)]
pub enum _3dVertexComponentControl {
_3dVertexComponentControlNostore,
_3dVertexComponentControlStoreSrc,
_3dVertexComponentControlStore0,
_3dVertexComponentControlStore1Fp,
_3dVertexComponentControlStore1Int,
_3dVertexComponentControlStoreVid,
_3dVertexComponentControlStoreIid,
_3dVertexComponentControlStorePid,
Unknown(u32),
}
impl Into<u32> for _3dVertexComponentControl {
fn into(self) -> u32 {
type E = _3dVertexComponentControl;
match self {
E::_3dVertexComponentControlNostore => 0,
E::_3dVertexComponentControlStoreSrc => 1,
E::_3dVertexComponentControlStore0 => 2,
E::_3dVertexComponentControlStore1Fp => 3,
E::_3dVertexComponentControlStore1Int => 4,
E::_3dVertexComponentControlStoreVid => 5,
E::_3dVertexComponentControlStoreIid => 6,
E::_3dVertexComponentControlStorePid => 7,
E::Unknown(val) => val,
}
}
}
impl From<u32> for _3dVertexComponentControl {
fn from(val: u32) -> Self {
match val {
0 => Self::_3dVertexComponentControlNostore,
1 => Self::_3dVertexComponentControlStoreSrc,
2 => Self::_3dVertexComponentControlStore0,
3 => Self::_3dVertexComponentControlStore1Fp,
4 => Self::_3dVertexComponentControlStore1Int,
5 => Self::_3dVertexComponentControlStoreVid,
6 => Self::_3dVertexComponentControlStoreIid,
7 => Self::_3dVertexComponentControlStorePid,
_ => Self::Unknown(val),
}
}
}
impl Default for _3dVertexComponentControl {
fn default() -> Self {
0u32.into()
}
}
#[derive(Clone, Copy)]
pub enum TextureCoordinateMode {
TextureCoordinateModeWrap,
TextureCoordinateModeMirror,
TextureCoordinateModeClamp,
TextureCoordinateModeCube,
TextureCoordinateModeClampBorder,
TextureCoordinateModeMirrorOnce,
Unknown(u32),
}
impl Into<u32> for TextureCoordinateMode {
fn into(self) -> u32 {
type E = TextureCoordinateMode;
match self {
E::TextureCoordinateModeWrap => 0,
E::TextureCoordinateModeMirror => 1,
E::TextureCoordinateModeClamp => 2,
E::TextureCoordinateModeCube => 3,
E::TextureCoordinateModeClampBorder => 4,
E::TextureCoordinateModeMirrorOnce => 5,
E::Unknown(val) => val,
}
}
}
impl From<u32> for TextureCoordinateMode {
fn from(val: u32) -> Self {
match val {
0 => Self::TextureCoordinateModeWrap,
1 => Self::TextureCoordinateModeMirror,
2 => Self::TextureCoordinateModeClamp,
3 => Self::TextureCoordinateModeCube,
4 => Self::TextureCoordinateModeClampBorder,
5 => Self::TextureCoordinateModeMirrorOnce,
_ => Self::Unknown(val),
}
}
}
impl Default for TextureCoordinateMode {
fn default() -> Self {
0u32.into()
}
}
pub struct CcViewport {
pub minimum_depth: f32,
pub maximum_depth: f32,
}
impl CcViewport {
pub const DWORD_LENGTH: u32 = 2;
}
impl Default for CcViewport {
fn default() -> Self {
CcViewport {
minimum_depth: Default::default(),
maximum_depth: Default::default(),
}
}
}
impl Serialize for CcViewport {
type Out = [u32; 2];
fn pack_into(&self, out: &mut [u32; 2]) {
out[0] = self.minimum_depth.to_bits();
out[1] = self.maximum_depth.to_bits();
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 2];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 2] as *const [u8; 8]) })
}
}
impl From<&[u32; 2]> for CcViewport {
fn from(input: &[u32; 2]) -> Self {
CcViewport {
minimum_depth: f32::from_bits(input[0]),
maximum_depth: f32::from_bits(input[1]),
}
}
}
impl Deserialize for CcViewport {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 2];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 2] as *mut [u8; 8]) })?;
Ok((&input).into())
}
}
pub struct ClipState<A: Addr + Default> {
pub grf_register_count: u32,
pub kernel_start_pointer: A,
pub software_exception_enable: bool,
pub mask_stack_exception_enable: bool,
pub illegal_opcode_exception_enable: bool,
pub floating_point_mode: u32,
pub thread_priority: u32,
pub binding_table_entry_count: u32,
pub single_program_flow: bool,
pub per_thread_scratch_space: u32,
pub scratch_space_base_pointer: A,
pub dispatch_grf_start_register_for_urb_data: u32,
pub vertex_urb_entry_read_offset: u32,
pub vertex_urb_entry_read_length: u32,
pub constant_urb_entry_read_offset: u32,
pub constant_urb_entry_read_length: u32,
pub clipper_statistics_enable: bool,
pub gs_output_object_statistics_enable: bool,
pub number_of_urb_entries: u32,
pub urb_entry_allocation_size: u32,
pub maximum_number_of_threads: u32,
pub clip_mode: u32,
pub userclipdistance_cliptest_enable_bitmask: u32,
pub userclipflags_mustclip_enable: bool,
pub negative_w_cliptest_enable: bool,
pub guardband_cliptest_enable: bool,
pub viewport_z_cliptest_enable: bool,
pub viewport_xy_cliptest_enable: bool,
pub vertex_position_space: u32,
pub api_mode: u32,
pub clipper_viewport_state_pointer: A,
pub screen_space_viewport_x_min: f32,
pub screen_space_viewport_x_max: f32,
pub screen_space_viewport_y_min: f32,
pub screen_space_viewport_y_max: f32,
}
impl<A: Addr + Default> ClipState<A> {
pub const DWORD_LENGTH: u32 = 11;
pub const ACCEPT_ALL: u32 = 4;
pub const ALL: u32 = 1;
pub const ALTERNATE: u32 = 1;
pub const CLIP_NON_REJECTED: u32 = 2;
pub const D3D: u32 = 1;
pub const HIGH_PRIORITY: u32 = 1;
pub const IEEE_754: u32 = 0;
pub const NDCSPACE: u32 = 0;
pub const NORMAL: u32 = 0;
pub const NORMAL_PRIORITY: u32 = 0;
pub const OGL: u32 = 0;
pub const REJECT_ALL: u32 = 3;
pub const SCREENSPACE: u32 = 1;
}
impl<A: Addr + Default> Default for ClipState<A> {
fn default() -> Self {
ClipState {
grf_register_count: Default::default(),
kernel_start_pointer: Default::default(),
software_exception_enable: Default::default(),
mask_stack_exception_enable: Default::default(),
illegal_opcode_exception_enable: Default::default(),
floating_point_mode: Default::default(),
thread_priority: Default::default(),
binding_table_entry_count: Default::default(),
single_program_flow: Default::default(),
per_thread_scratch_space: Default::default(),
scratch_space_base_pointer: Default::default(),
dispatch_grf_start_register_for_urb_data: Default::default(),
vertex_urb_entry_read_offset: Default::default(),
vertex_urb_entry_read_length: Default::default(),
constant_urb_entry_read_offset: Default::default(),
constant_urb_entry_read_length: Default::default(),
clipper_statistics_enable: Default::default(),
gs_output_object_statistics_enable: Default::default(),
number_of_urb_entries: Default::default(),
urb_entry_allocation_size: Default::default(),
maximum_number_of_threads: Default::default(),
clip_mode: Default::default(),
userclipdistance_cliptest_enable_bitmask: Default::default(),
userclipflags_mustclip_enable: Default::default(),
negative_w_cliptest_enable: Default::default(),
guardband_cliptest_enable: Default::default(),
viewport_z_cliptest_enable: Default::default(),
viewport_xy_cliptest_enable: Default::default(),
vertex_position_space: Default::default(),
api_mode: Default::default(),
clipper_viewport_state_pointer: Default::default(),
screen_space_viewport_x_min: Default::default(),
screen_space_viewport_x_max: Default::default(),
screen_space_viewport_y_min: Default::default(),
screen_space_viewport_y_max: Default::default(),
}
}
}
impl<A: Addr + Default> Serialize for ClipState<A> {
type Out = [u32; 11];
fn pack_into(&self, out: &mut [u32; 11]) {
let v0 = __gen_uint(self.grf_register_count, 1, 3);
let v0_address = self.kernel_start_pointer.combine(v0);
out[0] = v0_address as u32;
out[1] = (v0_address >> 32) as u32;
out[1] = __gen_uint(self.software_exception_enable.into(), 7, 7) |
__gen_uint(self.mask_stack_exception_enable.into(), 11, 11) |
__gen_uint(self.illegal_opcode_exception_enable.into(), 13, 13) |
__gen_uint(self.floating_point_mode, 16, 16) |
__gen_uint(self.thread_priority, 17, 17) |
__gen_uint(self.binding_table_entry_count, 18, 25) |
__gen_uint(self.single_program_flow.into(), 31, 31);
let v2 = __gen_uint(self.per_thread_scratch_space, 0, 3);
let v2_address = self.scratch_space_base_pointer.combine(v2);
out[2] = v2_address as u32;
out[3] = (v2_address >> 32) as u32;
out[3] = __gen_uint(self.dispatch_grf_start_register_for_urb_data, 0, 3) |
__gen_uint(self.vertex_urb_entry_read_offset, 4, 9) |
__gen_uint(self.vertex_urb_entry_read_length, 11, 16) |
__gen_uint(self.constant_urb_entry_read_offset, 18, 23) |
__gen_uint(self.constant_urb_entry_read_length, 25, 30);
out[4] = __gen_uint(self.gs_output_object_statistics_enable.into(), 10, 10) |
__gen_uint(self.number_of_urb_entries, 11, 18) |
__gen_uint(self.urb_entry_allocation_size, 19, 23) |
__gen_uint(self.maximum_number_of_threads, 25, 30);
out[5] = __gen_uint(self.clip_mode, 13, 15) |
__gen_uint(self.userclipdistance_cliptest_enable_bitmask, 16, 23) |
__gen_uint(self.userclipflags_mustclip_enable.into(), 24, 24) |
__gen_uint(self.negative_w_cliptest_enable.into(), 25, 25) |
__gen_uint(self.guardband_cliptest_enable.into(), 26, 26) |
__gen_uint(self.viewport_z_cliptest_enable.into(), 27, 27) |
__gen_uint(self.viewport_xy_cliptest_enable.into(), 28, 28) |
__gen_uint(self.vertex_position_space, 29, 29) |
__gen_uint(self.api_mode, 30, 30);
let v6_address = self.clipper_viewport_state_pointer.combine(0);
out[6] = v6_address as u32;
out[7] = (v6_address >> 32) as u32;
out[7] = self.screen_space_viewport_x_min.to_bits();
out[8] = self.screen_space_viewport_x_max.to_bits();
out[9] = self.screen_space_viewport_y_min.to_bits();
out[10] = self.screen_space_viewport_y_max.to_bits();
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 11];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 11] as *const [u8; 44]) })
}
}
impl From<&[u32; 11]> for ClipState<u64> {
fn from(input: &[u32; 11]) -> Self {
ClipState {
grf_register_count: __gen_unuint(input[0], 1, 3),
kernel_start_pointer: (__gen_unuint(input[0], 6, 31) as u64) << 6,
software_exception_enable: __gen_unuint(input[1], 7, 7) != 0,
mask_stack_exception_enable: __gen_unuint(input[1], 11, 11) != 0,
illegal_opcode_exception_enable: __gen_unuint(input[1], 13, 13) != 0,
floating_point_mode: __gen_unuint(input[1], 16, 16),
thread_priority: __gen_unuint(input[1], 17, 17),
binding_table_entry_count: __gen_unuint(input[1], 18, 25),
single_program_flow: __gen_unuint(input[1], 31, 31) != 0,
per_thread_scratch_space: __gen_unuint(input[2], 0, 3),
scratch_space_base_pointer: (__gen_unuint(input[2], 10, 31) as u64) << 10,
dispatch_grf_start_register_for_urb_data: __gen_unuint(input[3], 0, 3),
vertex_urb_entry_read_offset: __gen_unuint(input[3], 4, 9),
vertex_urb_entry_read_length: __gen_unuint(input[3], 11, 16),
constant_urb_entry_read_offset: __gen_unuint(input[3], 18, 23),
constant_urb_entry_read_length: __gen_unuint(input[3], 25, 30),
clipper_statistics_enable: __gen_unuint(input[4], 10, 10) != 0,
gs_output_object_statistics_enable: __gen_unuint(input[4], 10, 10) != 0,
number_of_urb_entries: __gen_unuint(input[4], 11, 18),
urb_entry_allocation_size: __gen_unuint(input[4], 19, 23),
maximum_number_of_threads: __gen_unuint(input[4], 25, 30),
clip_mode: __gen_unuint(input[5], 13, 15),
userclipdistance_cliptest_enable_bitmask: __gen_unuint(input[5], 16, 23),
userclipflags_mustclip_enable: __gen_unuint(input[5], 24, 24) != 0,
negative_w_cliptest_enable: __gen_unuint(input[5], 25, 25) != 0,
guardband_cliptest_enable: __gen_unuint(input[5], 26, 26) != 0,
viewport_z_cliptest_enable: __gen_unuint(input[5], 27, 27) != 0,
viewport_xy_cliptest_enable: __gen_unuint(input[5], 28, 28) != 0,
vertex_position_space: __gen_unuint(input[5], 29, 29),
api_mode: __gen_unuint(input[5], 30, 30),
clipper_viewport_state_pointer: (__gen_unuint(input[6], 5, 31) as u64) << 5,
screen_space_viewport_x_min: f32::from_bits(input[7]),
screen_space_viewport_x_max: f32::from_bits(input[8]),
screen_space_viewport_y_min: f32::from_bits(input[9]),
screen_space_viewport_y_max: f32::from_bits(input[10]),
}
}
}
impl Deserialize for ClipState<u64> {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 11];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 11] as *mut [u8; 44]) })?;
Ok((&input).into())
}
}
pub struct ClipViewport {
pub xmin_clip_guardband: f32,
pub xmax_clip_guardband: f32,
pub ymin_clip_guardband: f32,
pub ymax_clip_guardband: f32,
}
impl ClipViewport {
pub const DWORD_LENGTH: u32 = 4;
}
impl Default for ClipViewport {
fn default() -> Self {
ClipViewport {
xmin_clip_guardband: Default::default(),
xmax_clip_guardband: Default::default(),
ymin_clip_guardband: Default::default(),
ymax_clip_guardband: Default::default(),
}
}
}
impl Serialize for ClipViewport {
type Out = [u32; 4];
fn pack_into(&self, out: &mut [u32; 4]) {
out[0] = self.xmin_clip_guardband.to_bits();
out[1] = self.xmax_clip_guardband.to_bits();
out[2] = self.ymin_clip_guardband.to_bits();
out[3] = self.ymax_clip_guardband.to_bits();
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 4];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 4] as *const [u8; 16]) })
}
}
impl From<&[u32; 4]> for ClipViewport {
fn from(input: &[u32; 4]) -> Self {
ClipViewport {
xmin_clip_guardband: f32::from_bits(input[0]),
xmax_clip_guardband: f32::from_bits(input[1]),
ymin_clip_guardband: f32::from_bits(input[2]),
ymax_clip_guardband: f32::from_bits(input[3]),
}
}
}
impl Deserialize for ClipViewport {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 4];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 4] as *mut [u8; 16]) })?;
Ok((&input).into())
}
}
pub struct ColorCalcState<A: Addr + Default> {
pub backface_stencil_pass_depth_pass_op: _3dStencilOperation,
pub backface_stencil_pass_depth_fail_op: _3dStencilOperation,
pub backface_stencil_fail_op: _3dStencilOperation,
pub backface_stencil_test_function: _3dCompareFunction,
pub double_sided_stencil_enable: bool,
pub stencil_buffer_write_enable: bool,
pub stencil_pass_depth_pass_op: _3dStencilOperation,
pub stencil_pass_depth_fail_op: _3dStencilOperation,
pub stencil_fail_op: _3dStencilOperation,
pub stencil_test_function: _3dCompareFunction,
pub stencil_test_enable: bool,
pub backface_stencil_reference_value: u32,
pub stencil_write_mask: u32,
pub stencil_test_mask: u32,
pub stencil_reference_value: u32,
pub logic_op_enable: bool,
pub depth_buffer_write_enable: bool,
pub depth_test_function: _3dCompareFunction,
pub depth_test_enable: bool,
pub backface_stencil_write_mask: u32,
pub backface_stencil_test_mask: u32,
pub alpha_test_function: _3dCompareFunction,
pub alpha_test_enable: bool,
pub color_buffer_blend_enable: bool,
pub independent_alpha_blend_enable: bool,
pub alpha_test_format: u32,
pub cc_viewport_state_pointer: A,
pub destination_alpha_blend_factor: _3dColorBufferBlendFactor,
pub source_alpha_blend_factor: _3dColorBufferBlendFactor,
pub alpha_blend_function: _3dColorBufferBlendFunction,
pub statistics_enable: bool,
pub logic_op_function: _3dLogicOpFunction,
pub round_disable_function_disable: bool,
pub color_dither_enable: bool,
pub post_blend_color_clamp_enable: bool,
pub pre_blend_color_clamp_enable: bool,
pub color_clamp_range: u32,
pub y_dither_offset: u32,
pub x_dither_offset: u32,
pub destination_blend_factor: _3dColorBufferBlendFactor,
pub source_blend_factor: _3dColorBufferBlendFactor,
pub color_blend_function: _3dColorBufferBlendFunction,
pub alpha_reference_value_as_unorm8: u32,
pub alpha_reference_value_as_float32: f32,
}
impl<A: Addr + Default> ColorCalcState<A> {
pub const DWORD_LENGTH: u32 = 8;
pub const ALPHATEST_FLOAT32: u32 = 1;
pub const ALPHATEST_UNORM8: u32 = 0;
pub const COLORCLAMP_RTFORMAT: u32 = 2;
pub const COLORCLAMP_SNORM: u32 = 1;
pub const COLORCLAMP_UNORM: u32 = 0;
}
impl<A: Addr + Default> Default for ColorCalcState<A> {
fn default() -> Self {
ColorCalcState {
backface_stencil_pass_depth_pass_op: Default::default(),
backface_stencil_pass_depth_fail_op: Default::default(),
backface_stencil_fail_op: Default::default(),
backface_stencil_test_function: Default::default(),
double_sided_stencil_enable: Default::default(),
stencil_buffer_write_enable: Default::default(),
stencil_pass_depth_pass_op: Default::default(),
stencil_pass_depth_fail_op: Default::default(),
stencil_fail_op: Default::default(),
stencil_test_function: Default::default(),
stencil_test_enable: Default::default(),
backface_stencil_reference_value: Default::default(),
stencil_write_mask: Default::default(),
stencil_test_mask: Default::default(),
stencil_reference_value: Default::default(),
logic_op_enable: Default::default(),
depth_buffer_write_enable: Default::default(),
depth_test_function: Default::default(),
depth_test_enable: Default::default(),
backface_stencil_write_mask: Default::default(),
backface_stencil_test_mask: Default::default(),
alpha_test_function: Default::default(),
alpha_test_enable: Default::default(),
color_buffer_blend_enable: Default::default(),
independent_alpha_blend_enable: Default::default(),
alpha_test_format: Default::default(),
cc_viewport_state_pointer: Default::default(),
destination_alpha_blend_factor: Default::default(),
source_alpha_blend_factor: Default::default(),
alpha_blend_function: Default::default(),
statistics_enable: Default::default(),
logic_op_function: Default::default(),
round_disable_function_disable: Default::default(),
color_dither_enable: Default::default(),
post_blend_color_clamp_enable: Default::default(),
pre_blend_color_clamp_enable: Default::default(),
color_clamp_range: Default::default(),
y_dither_offset: Default::default(),
x_dither_offset: Default::default(),
destination_blend_factor: Default::default(),
source_blend_factor: Default::default(),
color_blend_function: Default::default(),
alpha_reference_value_as_unorm8: Default::default(),
alpha_reference_value_as_float32: Default::default(),
}
}
}
impl<A: Addr + Default> Serialize for ColorCalcState<A> {
type Out = [u32; 8];
fn pack_into(&self, out: &mut [u32; 8]) {
out[0] = __gen_uint(self.backface_stencil_pass_depth_pass_op.into(), 3, 5) |
__gen_uint(self.backface_stencil_pass_depth_fail_op.into(), 6, 8) |
__gen_uint(self.backface_stencil_fail_op.into(), 9, 11) |
__gen_uint(self.backface_stencil_test_function.into(), 12, 14) |
__gen_uint(self.double_sided_stencil_enable.into(), 15, 15) |
__gen_uint(self.stencil_buffer_write_enable.into(), 18, 18) |
__gen_uint(self.stencil_pass_depth_pass_op.into(), 19, 21) |
__gen_uint(self.stencil_pass_depth_fail_op.into(), 22, 24) |
__gen_uint(self.stencil_fail_op.into(), 25, 27) |
__gen_uint(self.stencil_test_function.into(), 28, 30) |
__gen_uint(self.stencil_test_enable.into(), 31, 31);
out[1] = __gen_uint(self.backface_stencil_reference_value, 0, 7) |
__gen_uint(self.stencil_write_mask, 8, 15) |
__gen_uint(self.stencil_test_mask, 16, 23) |
__gen_uint(self.stencil_reference_value, 24, 31);
out[2] = __gen_uint(self.logic_op_enable.into(), 0, 0) |
__gen_uint(self.depth_buffer_write_enable.into(), 11, 11) |
__gen_uint(self.depth_test_function.into(), 12, 14) |
__gen_uint(self.depth_test_enable.into(), 15, 15) |
__gen_uint(self.backface_stencil_write_mask, 16, 23) |
__gen_uint(self.backface_stencil_test_mask, 24, 31);
out[3] = __gen_uint(self.alpha_test_function.into(), 8, 10) |
__gen_uint(self.alpha_test_enable.into(), 11, 11) |
__gen_uint(self.color_buffer_blend_enable.into(), 12, 12) |
__gen_uint(self.independent_alpha_blend_enable.into(), 13, 13) |
__gen_uint(self.alpha_test_format, 15, 15);
let v4_address = self.cc_viewport_state_pointer.combine(0);
out[4] = v4_address as u32;
out[5] = (v4_address >> 32) as u32;
out[5] = __gen_uint(self.destination_alpha_blend_factor.into(), 2, 6) |
__gen_uint(self.source_alpha_blend_factor.into(), 7, 11) |
__gen_uint(self.alpha_blend_function.into(), 12, 14) |
__gen_uint(self.statistics_enable.into(), 15, 15) |
__gen_uint(self.logic_op_function.into(), 16, 19) |
__gen_uint(self.round_disable_function_disable.into(), 30, 30) |
__gen_uint(self.color_dither_enable.into(), 31, 31);
out[6] = __gen_uint(self.post_blend_color_clamp_enable.into(), 0, 0) |
__gen_uint(self.pre_blend_color_clamp_enable.into(), 1, 1) |
__gen_uint(self.color_clamp_range, 2, 3) |
__gen_uint(self.y_dither_offset, 15, 16) |
__gen_uint(self.x_dither_offset, 17, 18) |
__gen_uint(self.destination_blend_factor.into(), 19, 23) |
__gen_uint(self.source_blend_factor.into(), 24, 28) |
__gen_uint(self.color_blend_function.into(), 29, 31);
out[7] = self.alpha_reference_value_as_float32.to_bits();
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 8];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 8] as *const [u8; 32]) })
}
}
impl From<&[u32; 8]> for ColorCalcState<u64> {
fn from(input: &[u32; 8]) -> Self {
ColorCalcState {
backface_stencil_pass_depth_pass_op: (__gen_unuint(input[0], 3, 5)).into(),
backface_stencil_pass_depth_fail_op: (__gen_unuint(input[0], 6, 8)).into(),
backface_stencil_fail_op: (__gen_unuint(input[0], 9, 11)).into(),
backface_stencil_test_function: (__gen_unuint(input[0], 12, 14)).into(),
double_sided_stencil_enable: __gen_unuint(input[0], 15, 15) != 0,
stencil_buffer_write_enable: __gen_unuint(input[0], 18, 18) != 0,
stencil_pass_depth_pass_op: (__gen_unuint(input[0], 19, 21)).into(),
stencil_pass_depth_fail_op: (__gen_unuint(input[0], 22, 24)).into(),
stencil_fail_op: (__gen_unuint(input[0], 25, 27)).into(),
stencil_test_function: (__gen_unuint(input[0], 28, 30)).into(),
stencil_test_enable: __gen_unuint(input[0], 31, 31) != 0,
backface_stencil_reference_value: __gen_unuint(input[1], 0, 7),
stencil_write_mask: __gen_unuint(input[1], 8, 15),
stencil_test_mask: __gen_unuint(input[1], 16, 23),
stencil_reference_value: __gen_unuint(input[1], 24, 31),
logic_op_enable: __gen_unuint(input[2], 0, 0) != 0,
depth_buffer_write_enable: __gen_unuint(input[2], 11, 11) != 0,
depth_test_function: (__gen_unuint(input[2], 12, 14)).into(),
depth_test_enable: __gen_unuint(input[2], 15, 15) != 0,
backface_stencil_write_mask: __gen_unuint(input[2], 16, 23),
backface_stencil_test_mask: __gen_unuint(input[2], 24, 31),
alpha_test_function: (__gen_unuint(input[3], 8, 10)).into(),
alpha_test_enable: __gen_unuint(input[3], 11, 11) != 0,
color_buffer_blend_enable: __gen_unuint(input[3], 12, 12) != 0,
independent_alpha_blend_enable: __gen_unuint(input[3], 13, 13) != 0,
alpha_test_format: __gen_unuint(input[3], 15, 15),
cc_viewport_state_pointer: (__gen_unuint(input[4], 5, 31) as u64) << 5,
destination_alpha_blend_factor: (__gen_unuint(input[5], 2, 6)).into(),
source_alpha_blend_factor: (__gen_unuint(input[5], 7, 11)).into(),
alpha_blend_function: (__gen_unuint(input[5], 12, 14)).into(),
statistics_enable: __gen_unuint(input[5], 15, 15) != 0,
logic_op_function: (__gen_unuint(input[5], 16, 19)).into(),
round_disable_function_disable: __gen_unuint(input[5], 30, 30) != 0,
color_dither_enable: __gen_unuint(input[5], 31, 31) != 0,
post_blend_color_clamp_enable: __gen_unuint(input[6], 0, 0) != 0,
pre_blend_color_clamp_enable: __gen_unuint(input[6], 1, 1) != 0,
color_clamp_range: __gen_unuint(input[6], 2, 3),
y_dither_offset: __gen_unuint(input[6], 15, 16),
x_dither_offset: __gen_unuint(input[6], 17, 18),
destination_blend_factor: (__gen_unuint(input[6], 19, 23)).into(),
source_blend_factor: (__gen_unuint(input[6], 24, 28)).into(),
color_blend_function: (__gen_unuint(input[6], 29, 31)).into(),
alpha_reference_value_as_unorm8: __gen_unuint(input[7], 0, 31),
alpha_reference_value_as_float32: f32::from_bits(input[7]),
}
}
}
impl Deserialize for ColorCalcState<u64> {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 8];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 8] as *mut [u8; 32]) })?;
Ok((&input).into())
}
}
pub struct ConstantBuffer<A: Addr + Default> {
pub dword_length: u32,
pub valid: bool,
pub _3d_command_sub_opcode: u32,
pub _3d_command_opcode: u32,
pub command_subtype: u32,
pub command_type: u32,
pub buffer_length: u32,
pub buffer_starting_address: A,
}
impl<A: Addr + Default> ConstantBuffer<A> {
pub const DWORD_LENGTH: u32 = 2;
}
impl<A: Addr + Default> Default for ConstantBuffer<A> {
fn default() -> Self {
ConstantBuffer {
dword_length: 0,
valid: false,
_3d_command_sub_opcode: 2,
_3d_command_opcode: 0,
command_subtype: 0,
command_type: 3,
buffer_length: Default::default(),
buffer_starting_address: Default::default(),
}
}
}
impl<A: Addr + Default> Serialize for ConstantBuffer<A> {
type Out = [u32; 2];
fn pack_into(&self, out: &mut [u32; 2]) {
out[0] = __gen_uint(self.dword_length, 0, 7) |
__gen_uint(self.valid.into(), 8, 8) |
__gen_uint(self._3d_command_sub_opcode, 16, 23) |
__gen_uint(self._3d_command_opcode, 24, 26) |
__gen_uint(self.command_subtype, 27, 28) |
__gen_uint(self.command_type, 29, 31);
let v1 = __gen_uint(self.buffer_length, 0, 5);
let v1_address = self.buffer_starting_address.combine(v1);
out[1] = v1_address as u32;
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 2];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 2] as *const [u8; 8]) })
}
}
impl From<&[u32; 2]> for ConstantBuffer<u64> {
fn from(input: &[u32; 2]) -> Self {
ConstantBuffer {
dword_length: __gen_unuint(input[0], 0, 7),
valid: __gen_unuint(input[0], 8, 8) != 0,
_3d_command_sub_opcode: __gen_unuint(input[0], 16, 23),
_3d_command_opcode: __gen_unuint(input[0], 24, 26),
command_subtype: __gen_unuint(input[0], 27, 28),
command_type: __gen_unuint(input[0], 29, 31),
buffer_length: __gen_unuint(input[1], 0, 5),
buffer_starting_address: (__gen_unuint(input[1], 6, 31) as u64) << 6,
}
}
}
impl Deserialize for ConstantBuffer<u64> {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 2];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 2] as *mut [u8; 8]) })?;
Ok((&input).into())
}
}
pub struct CsUrbState {
pub dword_length: u32,
pub _3d_command_sub_opcode: u32,
pub _3d_command_opcode: u32,
pub command_subtype: u32,
pub command_type: u32,
pub number_of_urb_entries: u32,
pub urb_entry_allocation_size: u32,
}
impl CsUrbState {
pub const DWORD_LENGTH: u32 = 2;
}
impl Default for CsUrbState {
fn default() -> Self {
CsUrbState {
dword_length: 0,
_3d_command_sub_opcode: 1,
_3d_command_opcode: 0,
command_subtype: 0,
command_type: 3,
number_of_urb_entries: Default::default(),
urb_entry_allocation_size: Default::default(),
}
}
}
impl Serialize for CsUrbState {
type Out = [u32; 2];
fn pack_into(&self, out: &mut [u32; 2]) {
out[0] = __gen_uint(self.dword_length, 0, 7) |
__gen_uint(self._3d_command_sub_opcode, 16, 23) |
__gen_uint(self._3d_command_opcode, 24, 26) |
__gen_uint(self.command_subtype, 27, 28) |
__gen_uint(self.command_type, 29, 31);
out[1] = __gen_uint(self.number_of_urb_entries, 0, 2) |
__gen_uint(self.urb_entry_allocation_size, 4, 8);
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 2];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 2] as *const [u8; 8]) })
}
}
impl From<&[u32; 2]> for CsUrbState {
fn from(input: &[u32; 2]) -> Self {
CsUrbState {
dword_length: __gen_unuint(input[0], 0, 7),
_3d_command_sub_opcode: __gen_unuint(input[0], 16, 23),
_3d_command_opcode: __gen_unuint(input[0], 24, 26),
command_subtype: __gen_unuint(input[0], 27, 28),
command_type: __gen_unuint(input[0], 29, 31),
number_of_urb_entries: __gen_unuint(input[1], 0, 2),
urb_entry_allocation_size: __gen_unuint(input[1], 4, 8),
}
}
}
impl Deserialize for CsUrbState {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 2];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 2] as *mut [u8; 8]) })?;
Ok((&input).into())
}
}
pub struct GsState<A: Addr + Default> {
pub grf_register_count: u32,
pub kernel_start_pointer: A,
pub software_exception_enable: bool,
pub mask_stack_exception_enable: bool,
pub illegal_opcode_exception_enable: bool,
pub floating_point_mode: u32,
pub binding_table_entry_count: u32,
pub single_program_flow: bool,
pub per_thread_scratch_space: u32,
pub scratch_space_base_pointer: A,
pub dispatch_grf_start_register_for_urb_data: u32,
pub vertex_urb_entry_read_offset: u32,
pub vertex_urb_entry_read_length: u32,
pub constant_urb_entry_read_offset: u32,
pub constant_urb_entry_read_length: u32,
pub rendering_enable: bool,
pub gs_statistics_enable: bool,
pub number_of_urb_entries: u32,
pub urb_entry_allocation_size: u32,
pub maximum_number_of_threads: u32,
pub sampler_count: u32,
pub sampler_state_pointer: A,
pub maximum_vpindex: u32,
pub discard_adjacency: bool,
pub reorder_enable: bool,
}
impl<A: Addr + Default> GsState<A> {
pub const DWORD_LENGTH: u32 = 7;
pub const ALTERNATE: u32 = 1;
pub const IEEE_754: u32 = 0;
}
impl<A: Addr + Default> Default for GsState<A> {
fn default() -> Self {
GsState {
grf_register_count: Default::default(),
kernel_start_pointer: Default::default(),
software_exception_enable: Default::default(),
mask_stack_exception_enable: Default::default(),
illegal_opcode_exception_enable: Default::default(),
floating_point_mode: Default::default(),
binding_table_entry_count: Default::default(),
single_program_flow: Default::default(),
per_thread_scratch_space: Default::default(),
scratch_space_base_pointer: Default::default(),
dispatch_grf_start_register_for_urb_data: Default::default(),
vertex_urb_entry_read_offset: Default::default(),
vertex_urb_entry_read_length: Default::default(),
constant_urb_entry_read_offset: Default::default(),
constant_urb_entry_read_length: Default::default(),
rendering_enable: Default::default(),
gs_statistics_enable: Default::default(),
number_of_urb_entries: Default::default(),
urb_entry_allocation_size: Default::default(),
maximum_number_of_threads: Default::default(),
sampler_count: Default::default(),
sampler_state_pointer: Default::default(),
maximum_vpindex: Default::default(),
discard_adjacency: Default::default(),
reorder_enable: Default::default(),
}
}
}
impl<A: Addr + Default> Serialize for GsState<A> {
type Out = [u32; 7];
fn pack_into(&self, out: &mut [u32; 7]) {
let v0 = __gen_uint(self.grf_register_count, 1, 3);
let v0_address = self.kernel_start_pointer.combine(v0);
out[0] = v0_address as u32;
out[1] = (v0_address >> 32) as u32;
out[1] = __gen_uint(self.software_exception_enable.into(), 7, 7) |
__gen_uint(self.mask_stack_exception_enable.into(), 11, 11) |
__gen_uint(self.illegal_opcode_exception_enable.into(), 13, 13) |
__gen_uint(self.floating_point_mode, 16, 16) |
__gen_uint(self.binding_table_entry_count, 18, 25) |
__gen_uint(self.single_program_flow.into(), 31, 31);
let v2 = __gen_uint(self.per_thread_scratch_space, 0, 3);
let v2_address = self.scratch_space_base_pointer.combine(v2);
out[2] = v2_address as u32;
out[3] = (v2_address >> 32) as u32;
out[3] = __gen_uint(self.dispatch_grf_start_register_for_urb_data, 0, 3) |
__gen_uint(self.vertex_urb_entry_read_offset, 4, 9) |
__gen_uint(self.vertex_urb_entry_read_length, 11, 16) |
__gen_uint(self.constant_urb_entry_read_offset, 18, 23) |
__gen_uint(self.constant_urb_entry_read_length, 25, 30);
out[4] = __gen_uint(self.rendering_enable.into(), 8, 8) |
__gen_uint(self.gs_statistics_enable.into(), 10, 10) |
__gen_uint(self.number_of_urb_entries, 11, 18) |
__gen_uint(self.urb_entry_allocation_size, 19, 23) |
__gen_uint(self.maximum_number_of_threads, 25, 30);
let v5 = __gen_uint(self.sampler_count, 0, 2);
let v5_address = self.sampler_state_pointer.combine(v5);
out[5] = v5_address as u32;
out[6] = (v5_address >> 32) as u32;
out[6] = __gen_uint(self.maximum_vpindex, 0, 3) |
__gen_uint(self.discard_adjacency.into(), 29, 29) |
__gen_uint(self.reorder_enable.into(), 30, 30);
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 7];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 7] as *const [u8; 28]) })
}
}
impl From<&[u32; 7]> for GsState<u64> {
fn from(input: &[u32; 7]) -> Self {
GsState {
grf_register_count: __gen_unuint(input[0], 1, 3),
kernel_start_pointer: (__gen_unuint(input[0], 6, 31) as u64) << 6,
software_exception_enable: __gen_unuint(input[1], 7, 7) != 0,
mask_stack_exception_enable: __gen_unuint(input[1], 11, 11) != 0,
illegal_opcode_exception_enable: __gen_unuint(input[1], 13, 13) != 0,
floating_point_mode: __gen_unuint(input[1], 16, 16),
binding_table_entry_count: __gen_unuint(input[1], 18, 25),
single_program_flow: __gen_unuint(input[1], 31, 31) != 0,
per_thread_scratch_space: __gen_unuint(input[2], 0, 3),
scratch_space_base_pointer: (__gen_unuint(input[2], 10, 31) as u64) << 10,
dispatch_grf_start_register_for_urb_data: __gen_unuint(input[3], 0, 3),
vertex_urb_entry_read_offset: __gen_unuint(input[3], 4, 9),
vertex_urb_entry_read_length: __gen_unuint(input[3], 11, 16),
constant_urb_entry_read_offset: __gen_unuint(input[3], 18, 23),
constant_urb_entry_read_length: __gen_unuint(input[3], 25, 30),
rendering_enable: __gen_unuint(input[4], 8, 8) != 0,
gs_statistics_enable: __gen_unuint(input[4], 10, 10) != 0,
number_of_urb_entries: __gen_unuint(input[4], 11, 18),
urb_entry_allocation_size: __gen_unuint(input[4], 19, 23),
maximum_number_of_threads: __gen_unuint(input[4], 25, 30),
sampler_count: __gen_unuint(input[5], 0, 2),
sampler_state_pointer: (__gen_unuint(input[5], 5, 31) as u64) << 5,
maximum_vpindex: __gen_unuint(input[6], 0, 3),
discard_adjacency: __gen_unuint(input[6], 29, 29) != 0,
reorder_enable: __gen_unuint(input[6], 30, 30) != 0,
}
}
}
impl Deserialize for GsState<u64> {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 7];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 7] as *mut [u8; 28]) })?;
Ok((&input).into())
}
}
pub struct MiFlush {
pub state_instruction_cache_invalidate: u32,
pub render_cache_flush_inhibit: u32,
pub global_snapshot_count_reset: u32,
pub mi_command_opcode: u32,
pub command_type: u32,
}
impl MiFlush {
pub const DWORD_LENGTH: u32 = 1;
pub const DON_T_FLUSH: u32 = 1;
pub const DON_T_INVALIDATE: u32 = 0;
pub const DON_T_RESET: u32 = 0;
pub const FLUSH: u32 = 0;
pub const INVALIDATE: u32 = 1;
pub const RESET: u32 = 1;
}
impl Default for MiFlush {
fn default() -> Self {
MiFlush {
state_instruction_cache_invalidate: Default::default(),
render_cache_flush_inhibit: Default::default(),
global_snapshot_count_reset: Default::default(),
mi_command_opcode: 4,
command_type: 0,
}
}
}
impl Serialize for MiFlush {
type Out = [u32; 1];
fn pack_into(&self, out: &mut [u32; 1]) {
out[0] = __gen_uint(self.state_instruction_cache_invalidate, 1, 1) |
__gen_uint(self.render_cache_flush_inhibit, 2, 2) |
__gen_uint(self.global_snapshot_count_reset, 3, 3) |
__gen_uint(self.mi_command_opcode, 23, 28) |
__gen_uint(self.command_type, 29, 31);
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 1];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 1] as *const [u8; 4]) })
}
}
impl From<&[u32; 1]> for MiFlush {
fn from(input: &[u32; 1]) -> Self {
MiFlush {
state_instruction_cache_invalidate: __gen_unuint(input[0], 1, 1),
render_cache_flush_inhibit: __gen_unuint(input[0], 2, 2),
global_snapshot_count_reset: __gen_unuint(input[0], 3, 3),
mi_command_opcode: __gen_unuint(input[0], 23, 28),
command_type: __gen_unuint(input[0], 29, 31),
}
}
}
impl Deserialize for MiFlush {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 1];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 1] as *mut [u8; 4]) })?;
Ok((&input).into())
}
}
pub struct MiLoadRegisterImm {
pub dword_length: u32,
pub byte_write_disables: u32,
pub mi_command_opcode: u32,
pub command_type: u32,
pub register_offset: u64,
pub data_dword: u32,
}
impl MiLoadRegisterImm {
pub const DWORD_LENGTH: u32 = 3;
}
impl Default for MiLoadRegisterImm {
fn default() -> Self {
MiLoadRegisterImm {
dword_length: 1,
byte_write_disables: Default::default(),
mi_command_opcode: 34,
command_type: 0,
register_offset: Default::default(),
data_dword: Default::default(),
}
}
}
impl Serialize for MiLoadRegisterImm {
type Out = [u32; 3];
fn pack_into(&self, out: &mut [u32; 3]) {
out[0] = __gen_uint(self.dword_length, 0, 5) |
__gen_uint(self.byte_write_disables, 8, 11) |
__gen_uint(self.mi_command_opcode, 23, 28) |
__gen_uint(self.command_type, 29, 31);
out[1] = __gen_offset(self.register_offset as u32, 2, 31);
out[2] = __gen_uint(self.data_dword, 0, 31);
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 3];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 3] as *const [u8; 12]) })
}
}
impl From<&[u32; 3]> for MiLoadRegisterImm {
fn from(input: &[u32; 3]) -> Self {
MiLoadRegisterImm {
dword_length: __gen_unuint(input[0], 0, 5),
byte_write_disables: __gen_unuint(input[0], 8, 11),
mi_command_opcode: __gen_unuint(input[0], 23, 28),
command_type: __gen_unuint(input[0], 29, 31),
register_offset: (__gen_unuint(input[1], 2, 31) as u64) << 2,
data_dword: __gen_unuint(input[2], 0, 31),
}
}
}
impl Deserialize for MiLoadRegisterImm {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 3];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 3] as *mut [u8; 12]) })?;
Ok((&input).into())
}
}
pub struct MiStoreDataImm<A: Addr + Default> {
pub dword_length: u32,
pub bitfieldname: u32,
pub memory_address_type: bool,
pub mi_command_opcode: u32,
pub command_type: u32,
pub physical_start_address_extension: A,
pub address: A,
pub data_dword_0: u32,
pub data_dword_1: u32,
}
impl<A: Addr + Default> MiStoreDataImm<A> {
pub const DWORD_LENGTH: u32 = 5;
}
impl<A: Addr + Default> Default for MiStoreDataImm<A> {
fn default() -> Self {
MiStoreDataImm {
dword_length: 2,
bitfieldname: Default::default(),
memory_address_type: Default::default(),
mi_command_opcode: 32,
command_type: 0,
physical_start_address_extension: Default::default(),
address: Default::default(),
data_dword_0: Default::default(),
data_dword_1: Default::default(),
}
}
}
impl<A: Addr + Default> Serialize for MiStoreDataImm<A> {
type Out = [u32; 5];
fn pack_into(&self, out: &mut [u32; 5]) {
out[0] = __gen_uint(self.dword_length, 0, 5) |
__gen_uint(self.bitfieldname, 21, 21) |
__gen_uint(self.memory_address_type.into(), 22, 22) |
__gen_uint(self.mi_command_opcode, 23, 28) |
__gen_uint(self.command_type, 29, 31);
let v1_address = self.physical_start_address_extension.combine(0);
out[1] = v1_address as u32;
out[2] = (v1_address >> 32) as u32;
let v2_address = self.address.combine(0);
out[2] = v2_address as u32;
out[3] = (v2_address >> 32) as u32;
out[3] = __gen_uint(self.data_dword_0, 0, 31);
out[4] = __gen_uint(self.data_dword_1, 0, 31);
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 5];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 5] as *const [u8; 20]) })
}
}
impl From<&[u32; 5]> for MiStoreDataImm<u64> {
fn from(input: &[u32; 5]) -> Self {
MiStoreDataImm {
dword_length: __gen_unuint(input[0], 0, 5),
bitfieldname: __gen_unuint(input[0], 21, 21),
memory_address_type: __gen_unuint(input[0], 22, 22) != 0,
mi_command_opcode: __gen_unuint(input[0], 23, 28),
command_type: __gen_unuint(input[0], 29, 31),
physical_start_address_extension: (__gen_unuint(input[1], 0, 3) as u64),
address: (__gen_unuint(input[2], 2, 31) as u64) << 2,
data_dword_0: __gen_unuint(input[3], 0, 31),
data_dword_1: __gen_unuint(input[4], 0, 31),
}
}
}
impl Deserialize for MiStoreDataImm<u64> {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 5];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 5] as *mut [u8; 20]) })?;
Ok((&input).into())
}
}
pub struct MiStoreRegisterMem<A: Addr + Default> {
pub dword_length: u32,
pub use_global_gtt: bool,
pub mi_command_opcode: u32,
pub command_type: u32,
pub register_address: u64,
pub physical_start_address_extension: A,
pub memory_address: A,
}
impl<A: Addr + Default> MiStoreRegisterMem<A> {
pub const DWORD_LENGTH: u32 = 3;
}
impl<A: Addr + Default> Default for MiStoreRegisterMem<A> {
fn default() -> Self {
MiStoreRegisterMem {
dword_length: 1,
use_global_gtt: Default::default(),
mi_command_opcode: 36,
command_type: 0,
register_address: Default::default(),
physical_start_address_extension: Default::default(),
memory_address: Default::default(),
}
}
}
impl<A: Addr + Default> Serialize for MiStoreRegisterMem<A> {
type Out = [u32; 3];
fn pack_into(&self, out: &mut [u32; 3]) {
out[0] = __gen_uint(self.dword_length, 0, 7) |
__gen_uint(self.use_global_gtt.into(), 22, 22) |
__gen_uint(self.mi_command_opcode, 23, 28) |
__gen_uint(self.command_type, 29, 31);
let v1 = __gen_offset(self.register_address as u32, 2, 22);
let v1_address = self.physical_start_address_extension.combine(v1);
out[1] = v1_address as u32;
out[2] = (v1_address >> 32) as u32;
let v2_address = self.memory_address.combine(0);
out[2] = v2_address as u32;
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 3];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 3] as *const [u8; 12]) })
}
}
impl From<&[u32; 3]> for MiStoreRegisterMem<u64> {
fn from(input: &[u32; 3]) -> Self {
MiStoreRegisterMem {
dword_length: __gen_unuint(input[0], 0, 7),
use_global_gtt: __gen_unuint(input[0], 22, 22) != 0,
mi_command_opcode: __gen_unuint(input[0], 23, 28),
command_type: __gen_unuint(input[0], 29, 31),
register_address: (__gen_unuint(input[1], 2, 22) as u64) << 2,
physical_start_address_extension: (__gen_unuint(input[1], 28, 31) as u64) << 28,
memory_address: (__gen_unuint(input[2], 2, 31) as u64) << 2,
}
}
}
impl Deserialize for MiStoreRegisterMem<u64> {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 3];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 3] as *mut [u8; 12]) })?;
Ok((&input).into())
}
}
pub struct PipeControl<A: Addr + Default> {
pub dword_length: u32,
pub notify_enable: bool,
pub indirect_state_pointers_disable: bool,
pub texture_cache_flush_enable: bool,
pub instruction_cache_invalidate_enable: bool,
pub write_cache_flush: bool,
pub depth_stall_enable: bool,
pub post_sync_operation: u32,
pub _3d_command_sub_opcode: u32,
pub _3d_command_opcode: u32,
pub command_subtype: u32,
pub command_type: u32,
pub destination_address_type: u32,
pub address: A,
pub immediate_data: u64,
}
impl<A: Addr + Default> PipeControl<A> {
pub const DWORD_LENGTH: u32 = 4;
pub const GGTT: u32 = 1;
pub const NO_WRITE: u32 = 0;
pub const PGTT: u32 = 0;
pub const WRITE_IMMEDIATE_DATA: u32 = 1;
pub const WRITE_PS_DEPTH_COUNT: u32 = 2;
pub const WRITE_TIMESTAMP: u32 = 3;
}
impl<A: Addr + Default> Default for PipeControl<A> {
fn default() -> Self {
PipeControl {
dword_length: 2,
notify_enable: Default::default(),
indirect_state_pointers_disable: Default::default(),
texture_cache_flush_enable: Default::default(),
instruction_cache_invalidate_enable: Default::default(),
write_cache_flush: Default::default(),
depth_stall_enable: Default::default(),
post_sync_operation: Default::default(),
_3d_command_sub_opcode: 0,
_3d_command_opcode: 2,
command_subtype: 3,
command_type: 3,
destination_address_type: Default::default(),
address: Default::default(),
immediate_data: Default::default(),
}
}
}
impl<A: Addr + Default> Serialize for PipeControl<A> {
type Out = [u32; 4];
fn pack_into(&self, out: &mut [u32; 4]) {
out[0] = __gen_uint(self.dword_length, 0, 7) |
__gen_uint(self.notify_enable.into(), 8, 8) |
__gen_uint(self.indirect_state_pointers_disable.into(), 9, 9) |
__gen_uint(self.texture_cache_flush_enable.into(), 10, 10) |
__gen_uint(self.instruction_cache_invalidate_enable.into(), 11, 11) |
__gen_uint(self.write_cache_flush.into(), 12, 12) |
__gen_uint(self.depth_stall_enable.into(), 13, 13) |
__gen_uint(self.post_sync_operation, 14, 15) |
__gen_uint(self._3d_command_sub_opcode, 16, 23) |
__gen_uint(self._3d_command_opcode, 24, 26) |
__gen_uint(self.command_subtype, 27, 28) |
__gen_uint(self.command_type, 29, 31);
let v1 = __gen_uint(self.destination_address_type, 2, 2);
let v1_address = self.address.combine(v1);
out[1] = v1_address as u32;
out[2] = (v1_address >> 32) as u32;
out[2] = __gen_uint(self.immediate_data as u32, 0, 31);
out[3] = __gen_uint((self.immediate_data >> 32) as u32, 0, 31);
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 4];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 4] as *const [u8; 16]) })
}
}
impl From<&[u32; 4]> for PipeControl<u64> {
fn from(input: &[u32; 4]) -> Self {
PipeControl {
dword_length: __gen_unuint(input[0], 0, 7),
notify_enable: __gen_unuint(input[0], 8, 8) != 0,
indirect_state_pointers_disable: __gen_unuint(input[0], 9, 9) != 0,
texture_cache_flush_enable: __gen_unuint(input[0], 10, 10) != 0,
instruction_cache_invalidate_enable: __gen_unuint(input[0], 11, 11) != 0,
write_cache_flush: __gen_unuint(input[0], 12, 12) != 0,
depth_stall_enable: __gen_unuint(input[0], 13, 13) != 0,
post_sync_operation: __gen_unuint(input[0], 14, 15),
_3d_command_sub_opcode: __gen_unuint(input[0], 16, 23),
_3d_command_opcode: __gen_unuint(input[0], 24, 26),
command_subtype: __gen_unuint(input[0], 27, 28),
command_type: __gen_unuint(input[0], 29, 31),
destination_address_type: __gen_unuint(input[1], 2, 2),
address: (__gen_unuint(input[1], 3, 31) as u64) << 3,
immediate_data: (__gen_unuint(input[2], 0, 31) as u64) |
(__gen_unuint(input[3], 0, 31) as u64) << 32,
}
}
}
impl Deserialize for PipeControl<u64> {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 4];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 4] as *mut [u8; 16]) })?;
Ok((&input).into())
}
}
pub struct PipelineSelect {
pub pipeline_selection: u32,
pub _3d_command_sub_opcode: u32,
pub _3d_command_opcode: u32,
pub command_subtype: u32,
pub command_type: u32,
}
impl PipelineSelect {
pub const DWORD_LENGTH: u32 = 1;
pub const MEDIA: u32 = 1;
pub const _3D: u32 = 0;
}
impl Default for PipelineSelect {
fn default() -> Self {
PipelineSelect {
pipeline_selection: Default::default(),
_3d_command_sub_opcode: 4,
_3d_command_opcode: 1,
command_subtype: 1,
command_type: 3,
}
}
}
impl Serialize for PipelineSelect {
type Out = [u32; 1];
fn pack_into(&self, out: &mut [u32; 1]) {
out[0] = __gen_uint(self.pipeline_selection, 0, 1) |
__gen_uint(self._3d_command_sub_opcode, 16, 23) |
__gen_uint(self._3d_command_opcode, 24, 26) |
__gen_uint(self.command_subtype, 27, 28) |
__gen_uint(self.command_type, 29, 31);
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 1];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 1] as *const [u8; 4]) })
}
}
impl From<&[u32; 1]> for PipelineSelect {
fn from(input: &[u32; 1]) -> Self {
PipelineSelect {
pipeline_selection: __gen_unuint(input[0], 0, 1),
_3d_command_sub_opcode: __gen_unuint(input[0], 16, 23),
_3d_command_opcode: __gen_unuint(input[0], 24, 26),
command_subtype: __gen_unuint(input[0], 27, 28),
command_type: __gen_unuint(input[0], 29, 31),
}
}
}
impl Deserialize for PipelineSelect {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 1];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 1] as *mut [u8; 4]) })?;
Ok((&input).into())
}
}
pub struct RenderSurfaceState<A: Addr + Default> {
pub cube_face_enable_positive_z: bool,
pub cube_face_enable_negative_z: bool,
pub cube_face_enable_positive_y: bool,
pub cube_face_enable_negative_y: bool,
pub cube_face_enable_positive_x: bool,
pub cube_face_enable_negative_x: bool,
pub media_boundary_pixel_mode: u32,
pub render_cache_read_write_mode: u32,
pub mip_map_layout_mode: u32,
pub vertical_line_stride_offset: u32,
pub vertical_line_stride: u32,
pub color_blend_enable: bool,
pub color_buffer_component_write_disables: u32,
pub surface_format: u32,
pub data_return_format: u32,
pub surface_type: u32,
pub surface_base_address: A,
pub mip_count_lod: u32,
pub width: u32,
pub height: u32,
pub tile_walk: u32,
pub tiled_surface: u32,
pub surface_pitch: u32,
pub depth: u32,
pub render_target_view_extent: u32,
pub minimum_array_element: u32,
pub surface_min_lod: u32,
pub y_offset: u32,
pub x_offset: u32,
}
impl<A: Addr + Default> RenderSurfaceState<A> {
pub const DWORD_LENGTH: u32 = 6;
pub const DATA_RETURN_FLOAT32: u32 = 0;
pub const DATA_RETURN_S1_14: u32 = 1;
pub const INTERLACED_FRAME: u32 = 3;
pub const MIPLAYOUT_BELOW: u32 = 0;
pub const MIPLAYOUT_RIGHT: u32 = 1;
pub const NORMAL_MODE: u32 = 0;
pub const PROGRESSIVE_FRAME: u32 = 2;
pub const READ_WRITE: u32 = 1;
pub const SURFTYPE_1D: u32 = 0;
pub const SURFTYPE_2D: u32 = 1;
pub const SURFTYPE_3D: u32 = 2;
pub const SURFTYPE_BUFFER: u32 = 4;
pub const SURFTYPE_CUBE: u32 = 3;
pub const SURFTYPE_NULL: u32 = 7;
pub const TILEWALK_XMAJOR: u32 = 0;
pub const TILEWALK_YMAJOR: u32 = 1;
pub const WRITEDISABLE_ALPHA: u32 = 8;
pub const WRITEDISABLE_BLUE: u32 = 1;
pub const WRITEDISABLE_GREEN: u32 = 2;
pub const WRITEDISABLE_RED: u32 = 4;
pub const WRITE_ONLY: u32 = 0;
}
impl<A: Addr + Default> Default for RenderSurfaceState<A> {
fn default() -> Self {
RenderSurfaceState {
cube_face_enable_positive_z: Default::default(),
cube_face_enable_negative_z: Default::default(),
cube_face_enable_positive_y: Default::default(),
cube_face_enable_negative_y: Default::default(),
cube_face_enable_positive_x: Default::default(),
cube_face_enable_negative_x: Default::default(),
media_boundary_pixel_mode: Default::default(),
render_cache_read_write_mode: Default::default(),
mip_map_layout_mode: Default::default(),
vertical_line_stride_offset: Default::default(),
vertical_line_stride: Default::default(),
color_blend_enable: Default::default(),
color_buffer_component_write_disables: Default::default(),
surface_format: Default::default(),
data_return_format: Default::default(),
surface_type: Default::default(),
surface_base_address: Default::default(),
mip_count_lod: Default::default(),
width: Default::default(),
height: Default::default(),
tile_walk: Default::default(),
tiled_surface: Default::default(),
surface_pitch: Default::default(),
depth: Default::default(),
render_target_view_extent: Default::default(),
minimum_array_element: Default::default(),
surface_min_lod: Default::default(),
y_offset: Default::default(),
x_offset: Default::default(),
}
}
}
impl<A: Addr + Default> Serialize for RenderSurfaceState<A> {
type Out = [u32; 6];
fn pack_into(&self, out: &mut [u32; 6]) {
out[0] = __gen_uint(self.cube_face_enable_positive_z.into(), 0, 0) |
__gen_uint(self.cube_face_enable_negative_z.into(), 1, 1) |
__gen_uint(self.cube_face_enable_positive_y.into(), 2, 2) |
__gen_uint(self.cube_face_enable_negative_y.into(), 3, 3) |
__gen_uint(self.cube_face_enable_positive_x.into(), 4, 4) |
__gen_uint(self.cube_face_enable_negative_x.into(), 5, 5) |
__gen_uint(self.media_boundary_pixel_mode, 6, 7) |
__gen_uint(self.render_cache_read_write_mode, 8, 8) |
__gen_uint(self.mip_map_layout_mode, 10, 10) |
__gen_uint(self.vertical_line_stride_offset, 11, 11) |
__gen_uint(self.vertical_line_stride, 12, 12) |
__gen_uint(self.color_blend_enable.into(), 13, 13) |
__gen_uint(self.color_buffer_component_write_disables, 14, 17) |
__gen_uint(self.surface_format, 18, 26) |
__gen_uint(self.data_return_format, 27, 27) |
__gen_uint(self.surface_type, 29, 31);
let v1_address = self.surface_base_address.combine(0);
out[1] = v1_address as u32;
out[2] = (v1_address >> 32) as u32;
out[2] = __gen_uint(self.mip_count_lod, 2, 5) |
__gen_uint(self.width, 6, 18) |
__gen_uint(self.height, 19, 31);
out[3] = __gen_uint(self.tile_walk, 0, 0) |
__gen_uint(self.tiled_surface, 1, 1) |
__gen_uint(self.surface_pitch, 3, 19) |
__gen_uint(self.depth, 21, 31);
out[4] = __gen_uint(self.render_target_view_extent, 8, 16) |
__gen_uint(self.minimum_array_element, 17, 27) |
__gen_uint(self.surface_min_lod, 28, 31);
out[5] = __gen_uint(self.y_offset, 20, 23) |
__gen_uint(self.x_offset, 25, 31);
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 6];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 6] as *const [u8; 24]) })
}
}
impl From<&[u32; 6]> for RenderSurfaceState<u64> {
fn from(input: &[u32; 6]) -> Self {
RenderSurfaceState {
cube_face_enable_positive_z: __gen_unuint(input[0], 0, 0) != 0,
cube_face_enable_negative_z: __gen_unuint(input[0], 1, 1) != 0,
cube_face_enable_positive_y: __gen_unuint(input[0], 2, 2) != 0,
cube_face_enable_negative_y: __gen_unuint(input[0], 3, 3) != 0,
cube_face_enable_positive_x: __gen_unuint(input[0], 4, 4) != 0,
cube_face_enable_negative_x: __gen_unuint(input[0], 5, 5) != 0,
media_boundary_pixel_mode: __gen_unuint(input[0], 6, 7),
render_cache_read_write_mode: __gen_unuint(input[0], 8, 8),
mip_map_layout_mode: __gen_unuint(input[0], 10, 10),
vertical_line_stride_offset: __gen_unuint(input[0], 11, 11),
vertical_line_stride: __gen_unuint(input[0], 12, 12),
color_blend_enable: __gen_unuint(input[0], 13, 13) != 0,
color_buffer_component_write_disables: __gen_unuint(input[0], 14, 17),
surface_format: __gen_unuint(input[0], 18, 26),
data_return_format: __gen_unuint(input[0], 27, 27),
surface_type: __gen_unuint(input[0], 29, 31),
surface_base_address: (__gen_unuint(input[1], 0, 31) as u64),
mip_count_lod: __gen_unuint(input[2], 2, 5),
width: __gen_unuint(input[2], 6, 18),
height: __gen_unuint(input[2], 19, 31),
tile_walk: __gen_unuint(input[3], 0, 0),
tiled_surface: __gen_unuint(input[3], 1, 1),
surface_pitch: __gen_unuint(input[3], 3, 19),
depth: __gen_unuint(input[3], 21, 31),
render_target_view_extent: __gen_unuint(input[4], 8, 16),
minimum_array_element: __gen_unuint(input[4], 17, 27),
surface_min_lod: __gen_unuint(input[4], 28, 31),
y_offset: __gen_unuint(input[5], 20, 23),
x_offset: __gen_unuint(input[5], 25, 31),
}
}
}
impl Deserialize for RenderSurfaceState<u64> {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 6];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 6] as *mut [u8; 24]) })?;
Ok((&input).into())
}
}
pub struct SamplerBorderColorState {
pub border_color_red: f32,
pub border_color_green: f32,
pub border_color_blue: f32,
pub border_color_alpha: f32,
}
impl SamplerBorderColorState {
pub const DWORD_LENGTH: u32 = 12;
}
impl Default for SamplerBorderColorState {
fn default() -> Self {
SamplerBorderColorState {
border_color_red: Default::default(),
border_color_green: Default::default(),
border_color_blue: Default::default(),
border_color_alpha: Default::default(),
}
}
}
impl Serialize for SamplerBorderColorState {
type Out = [u32; 12];
fn pack_into(&self, out: &mut [u32; 12]) {
out[0] = self.border_color_red.to_bits();
out[1] = self.border_color_green.to_bits();
out[2] = self.border_color_blue.to_bits();
out[3] = self.border_color_alpha.to_bits();
out[4] = 0;
out[5] = 0;
out[6] = 0;
out[7] = 0;
out[8] = 0;
out[9] = 0;
out[10] = 0;
out[11] = 0;
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 12];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 12] as *const [u8; 48]) })
}
}
impl From<&[u32; 12]> for SamplerBorderColorState {
fn from(input: &[u32; 12]) -> Self {
SamplerBorderColorState {
border_color_red: f32::from_bits(input[0]),
border_color_green: f32::from_bits(input[1]),
border_color_blue: f32::from_bits(input[2]),
border_color_alpha: f32::from_bits(input[3]),
}
}
}
impl Deserialize for SamplerBorderColorState {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 12];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 12] as *mut [u8; 48]) })?;
Ok((&input).into())
}
}
pub struct SamplerState<A: Addr + Default> {
pub shadow_function: u32,
pub texture_lod_bias: f32,
pub min_mode_filter: u32,
pub mag_mode_filter: u32,
pub mip_mode_filter: u32,
pub base_mip_level: f32,
pub lod_preclamp_enable: bool,
pub sampler_disable: bool,
pub tcz_address_control_mode: TextureCoordinateMode,
pub tcy_address_control_mode: TextureCoordinateMode,
pub tcx_address_control_mode: TextureCoordinateMode,
pub cube_surface_control_mode: u32,
pub max_lod: f32,
pub min_lod: f32,
pub border_color_pointer: A,
pub r_address_min_filter_rounding_enable: bool,
pub r_address_mag_filter_rounding_enable: bool,
pub v_address_min_filter_rounding_enable: bool,
pub v_address_mag_filter_rounding_enable: bool,
pub u_address_min_filter_rounding_enable: bool,
pub u_address_mag_filter_rounding_enable: bool,
pub maximum_anisotropy: u32,
pub chromakey_mode: u32,
pub chromakey_index: u32,
pub chromakey_enable: bool,
pub monochrome_filter_width: u32,
pub monochrome_filter_height: u32,
}
impl<A: Addr + Default> SamplerState<A> {
pub const DWORD_LENGTH: u32 = 4;
pub const ANISOTROPIC: u32 = 2;
pub const CUBECTRLMODE_OVERRIDE: u32 = 1;
pub const CUBECTRLMODE_PROGRAMMED: u32 = 0;
pub const KILL_ON_ANY_MATCH: u32 = 0;
pub const MONO: u32 = 6;
pub const NONE: u32 = 0;
pub const PREFILTEROP_ALWAYS: u32 = 0;
pub const PREFILTEROP_EQUAL: u32 = 3;
pub const PREFILTEROP_GEQUAL: u32 = 7;
pub const PREFILTEROP_GREATER: u32 = 5;
pub const PREFILTEROP_LEQUAL: u32 = 4;
pub const PREFILTEROP_LESS: u32 = 2;
pub const PREFILTEROP_NEVER: u32 = 1;
pub const PREFILTEROP_NOTEQUAL: u32 = 6;
pub const RATIO_10_1: u32 = 4;
pub const RATIO_12_1: u32 = 5;
pub const RATIO_14_1: u32 = 6;
pub const RATIO_16_1: u32 = 7;
pub const RATIO_2_1: u32 = 0;
pub const RATIO_4_1: u32 = 1;
pub const RATIO_6_1: u32 = 2;
pub const RATIO_8_1: u32 = 3;
pub const REPLACE_BLACK: u32 = 1;
}
impl<A: Addr + Default> Default for SamplerState<A> {
fn default() -> Self {
SamplerState {
shadow_function: Default::default(),
texture_lod_bias: Default::default(),
min_mode_filter: Default::default(),
mag_mode_filter: Default::default(),
mip_mode_filter: Default::default(),
base_mip_level: Default::default(),
lod_preclamp_enable: Default::default(),
sampler_disable: Default::default(),
tcz_address_control_mode: Default::default(),
tcy_address_control_mode: Default::default(),
tcx_address_control_mode: Default::default(),
cube_surface_control_mode: Default::default(),
max_lod: Default::default(),
min_lod: Default::default(),
border_color_pointer: Default::default(),
r_address_min_filter_rounding_enable: Default::default(),
r_address_mag_filter_rounding_enable: Default::default(),
v_address_min_filter_rounding_enable: Default::default(),
v_address_mag_filter_rounding_enable: Default::default(),
u_address_min_filter_rounding_enable: Default::default(),
u_address_mag_filter_rounding_enable: Default::default(),
maximum_anisotropy: Default::default(),
chromakey_mode: Default::default(),
chromakey_index: Default::default(),
chromakey_enable: Default::default(),
monochrome_filter_width: Default::default(),
monochrome_filter_height: Default::default(),
}
}
}
impl<A: Addr + Default> Serialize for SamplerState<A> {
type Out = [u32; 4];
fn pack_into(&self, out: &mut [u32; 4]) {
out[0] = __gen_uint(self.shadow_function, 0, 2) |
__gen_sfixed(self.texture_lod_bias, 3, 13, 6) |
__gen_uint(self.min_mode_filter, 14, 16) |
__gen_uint(self.mag_mode_filter, 17, 19) |
__gen_uint(self.mip_mode_filter, 20, 21) |
__gen_ufixed(self.base_mip_level, 22, 26, 1) |
__gen_uint(self.lod_preclamp_enable.into(), 28, 28) |
__gen_uint(self.sampler_disable.into(), 31, 31);
out[1] = __gen_uint(self.tcz_address_control_mode.into(), 0, 2) |
__gen_uint(self.tcy_address_control_mode.into(), 3, 5) |
__gen_uint(self.tcx_address_control_mode.into(), 6, 8) |
__gen_uint(self.cube_surface_control_mode, 9, 9) |
__gen_ufixed(self.max_lod, 12, 21, 6) |
__gen_ufixed(self.min_lod, 22, 31, 6);
let v2_address = self.border_color_pointer.combine(0);
out[2] = v2_address as u32;
out[3] = (v2_address >> 32) as u32;
out[3] = __gen_uint(self.r_address_min_filter_rounding_enable.into(), 13, 13) |
__gen_uint(self.r_address_mag_filter_rounding_enable.into(), 14, 14) |
__gen_uint(self.v_address_min_filter_rounding_enable.into(), 15, 15) |
__gen_uint(self.v_address_mag_filter_rounding_enable.into(), 16, 16) |
__gen_uint(self.u_address_min_filter_rounding_enable.into(), 17, 17) |
__gen_uint(self.u_address_mag_filter_rounding_enable.into(), 18, 18) |
__gen_uint(self.maximum_anisotropy, 19, 21) |
__gen_uint(self.chromakey_mode, 22, 22) |
__gen_uint(self.chromakey_index, 23, 24) |
__gen_uint(self.chromakey_enable.into(), 25, 25) |
__gen_uint(self.monochrome_filter_width, 26, 28) |
__gen_uint(self.monochrome_filter_height, 29, 31);
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 4];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 4] as *const [u8; 16]) })
}
}
impl From<&[u32; 4]> for SamplerState<u64> {
fn from(input: &[u32; 4]) -> Self {
SamplerState {
shadow_function: __gen_unuint(input[0], 0, 2),
texture_lod_bias: __gen_unsfixed(input[0], 3, 13, 6),
min_mode_filter: __gen_unuint(input[0], 14, 16),
mag_mode_filter: __gen_unuint(input[0], 17, 19),
mip_mode_filter: __gen_unuint(input[0], 20, 21),
base_mip_level: __gen_unufixed(input[0], 22, 26, 1),
lod_preclamp_enable: __gen_unuint(input[0], 28, 28) != 0,
sampler_disable: __gen_unuint(input[0], 31, 31) != 0,
tcz_address_control_mode: (__gen_unuint(input[1], 0, 2)).into(),
tcy_address_control_mode: (__gen_unuint(input[1], 3, 5)).into(),
tcx_address_control_mode: (__gen_unuint(input[1], 6, 8)).into(),
cube_surface_control_mode: __gen_unuint(input[1], 9, 9),
max_lod: __gen_unufixed(input[1], 12, 21, 6),
min_lod: __gen_unufixed(input[1], 22, 31, 6),
border_color_pointer: (__gen_unuint(input[2], 5, 31) as u64) << 5,
r_address_min_filter_rounding_enable: __gen_unuint(input[3], 13, 13) != 0,
r_address_mag_filter_rounding_enable: __gen_unuint(input[3], 14, 14) != 0,
v_address_min_filter_rounding_enable: __gen_unuint(input[3], 15, 15) != 0,
v_address_mag_filter_rounding_enable: __gen_unuint(input[3], 16, 16) != 0,
u_address_min_filter_rounding_enable: __gen_unuint(input[3], 17, 17) != 0,
u_address_mag_filter_rounding_enable: __gen_unuint(input[3], 18, 18) != 0,
maximum_anisotropy: __gen_unuint(input[3], 19, 21),
chromakey_mode: __gen_unuint(input[3], 22, 22),
chromakey_index: __gen_unuint(input[3], 23, 24),
chromakey_enable: __gen_unuint(input[3], 25, 25) != 0,
monochrome_filter_width: __gen_unuint(input[3], 26, 28),
monochrome_filter_height: __gen_unuint(input[3], 29, 31),
}
}
}
impl Deserialize for SamplerState<u64> {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 4];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 4] as *mut [u8; 16]) })?;
Ok((&input).into())
}
}
pub struct ScissorRect {
pub scissor_rectangle_x_min: u32,
pub scissor_rectangle_y_min: u32,
pub scissor_rectangle_x_max: u32,
pub scissor_rectangle_y_max: u32,
}
impl ScissorRect {
pub const DWORD_LENGTH: u32 = 2;
}
impl Default for ScissorRect {
fn default() -> Self {
ScissorRect {
scissor_rectangle_x_min: Default::default(),
scissor_rectangle_y_min: Default::default(),
scissor_rectangle_x_max: Default::default(),
scissor_rectangle_y_max: Default::default(),
}
}
}
impl Serialize for ScissorRect {
type Out = [u32; 2];
fn pack_into(&self, out: &mut [u32; 2]) {
out[0] = __gen_uint(self.scissor_rectangle_x_min, 0, 15) |
__gen_uint(self.scissor_rectangle_y_min, 16, 31);
out[1] = __gen_uint(self.scissor_rectangle_x_max, 0, 15) |
__gen_uint(self.scissor_rectangle_y_max, 16, 31);
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 2];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 2] as *const [u8; 8]) })
}
}
impl From<&[u32; 2]> for ScissorRect {
fn from(input: &[u32; 2]) -> Self {
ScissorRect {
scissor_rectangle_x_min: __gen_unuint(input[0], 0, 15),
scissor_rectangle_y_min: __gen_unuint(input[0], 16, 31),
scissor_rectangle_x_max: __gen_unuint(input[1], 0, 15),
scissor_rectangle_y_max: __gen_unuint(input[1], 16, 31),
}
}
}
impl Deserialize for ScissorRect {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 2];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 2] as *mut [u8; 8]) })?;
Ok((&input).into())
}
}
pub struct SfState<A: Addr + Default> {
pub grf_register_count: u32,
pub kernel_start_pointer: A,
pub software_exception_enable: bool,
pub mask_stack_exception_enable: bool,
pub illegal_opcode_exception_enable: bool,
pub floating_point_mode: u32,
pub thread_priority: u32,
pub binding_table_entry_count: u32,
pub single_program_flow: bool,
pub per_thread_scratch_space: u32,
pub scratch_space_base_pointer: A,
pub dispatch_grf_start_register_for_urb_data: u32,
pub vertex_urb_entry_read_offset: u32,
pub vertex_urb_entry_read_length: u32,
pub constant_urb_entry_read_offset: u32,
pub constant_urb_entry_read_length: u32,
pub statistics_enable: bool,
pub number_of_urb_entries: u32,
pub urb_entry_allocation_size: u32,
pub maximum_number_of_threads: u32,
pub front_winding: u32,
pub viewport_transform_enable: bool,
pub setup_viewport_state_offset: A,
pub destination_origin_vertical_bias: f32,
pub destination_origin_horizontal_bias: f32,
pub scissor_rectangle_enable: bool,
pub _2x2_pixel_triangle_filter_disable: bool,
pub zero_pixel_triangle_filter_disable: bool,
pub point_rasterization_rule: u32,
pub line_end_cap_antialiasing_region_width: u32,
pub line_width: f32,
pub fast_scissor_clip_disable: bool,
pub cull_mode: u32,
pub antialiasing_enable: bool,
pub point_width: f32,
pub point_width_source: u32,
pub vertex_sub_pixel_precision_select: u32,
pub sprite_point_enable: bool,
pub aa_line_distance_mode: u32,
pub triangle_fan_provoking_vertex_select: u32,
pub line_strip_list_provoking_vertex_select: u32,
pub triangle_strip_list_provoking_vertex_select: u32,
pub last_pixel_enable: bool,
}
impl<A: Addr + Default> SfState<A> {
pub const DWORD_LENGTH: u32 = 8;
pub const ALTERNATE: u32 = 1;
pub const BACK: u32 = 3;
pub const BOTH: u32 = 0;
pub const FRONT: u32 = 2;
pub const FRONTWINDING_CCW: u32 = 1;
pub const FRONTWINDING_CW: u32 = 0;
pub const HIGH_PRIORITY: u32 = 1;
pub const IEEE_754: u32 = 0;
pub const MANHATTAN: u32 = 0;
pub const NONE: u32 = 1;
pub const NORMAL_PRIORITY: u32 = 0;
pub const RASTRULE_UPPER_LEFT: u32 = 0;
pub const RASTRULE_UPPER_RIGHT: u32 = 1;
pub const STATE: u32 = 1;
pub const TRUE: u32 = 1;
pub const VERTEX: u32 = 0;
pub const VERTEX_0: u32 = 0;
pub const VERTEX_1: u32 = 1;
pub const VERTEX_2: u32 = 2;
pub const _0_5_PIXELS: u32 = 0;
pub const _1_0_PIXELS: u32 = 1;
pub const _2_0_PIXELS: u32 = 2;
pub const _4_0_PIXELS: u32 = 3;
pub const _4_SUB_PIXEL_PRECISION_BITS: u32 = 1;
pub const _8_SUB_PIXEL_PRECISION_BITS: u32 = 0;
}
impl<A: Addr + Default> Default for SfState<A> {
fn default() -> Self {
SfState {
grf_register_count: Default::default(),
kernel_start_pointer: Default::default(),
software_exception_enable: Default::default(),
mask_stack_exception_enable: Default::default(),
illegal_opcode_exception_enable: Default::default(),
floating_point_mode: Default::default(),
thread_priority: Default::default(),
binding_table_entry_count: Default::default(),
single_program_flow: Default::default(),
per_thread_scratch_space: Default::default(),
scratch_space_base_pointer: Default::default(),
dispatch_grf_start_register_for_urb_data: Default::default(),
vertex_urb_entry_read_offset: Default::default(),
vertex_urb_entry_read_length: Default::default(),
constant_urb_entry_read_offset: Default::default(),
constant_urb_entry_read_length: Default::default(),
statistics_enable: Default::default(),
number_of_urb_entries: Default::default(),
urb_entry_allocation_size: Default::default(),
maximum_number_of_threads: Default::default(),
front_winding: Default::default(),
viewport_transform_enable: Default::default(),
setup_viewport_state_offset: Default::default(),
destination_origin_vertical_bias: Default::default(),
destination_origin_horizontal_bias: Default::default(),
scissor_rectangle_enable: Default::default(),
_2x2_pixel_triangle_filter_disable: Default::default(),
zero_pixel_triangle_filter_disable: Default::default(),
point_rasterization_rule: Default::default(),
line_end_cap_antialiasing_region_width: Default::default(),
line_width: Default::default(),
fast_scissor_clip_disable: Default::default(),
cull_mode: Default::default(),
antialiasing_enable: Default::default(),
point_width: Default::default(),
point_width_source: Default::default(),
vertex_sub_pixel_precision_select: Default::default(),
sprite_point_enable: Default::default(),
aa_line_distance_mode: Default::default(),
triangle_fan_provoking_vertex_select: Default::default(),
line_strip_list_provoking_vertex_select: Default::default(),
triangle_strip_list_provoking_vertex_select: Default::default(),
last_pixel_enable: Default::default(),
}
}
}
impl<A: Addr + Default> Serialize for SfState<A> {
type Out = [u32; 8];
fn pack_into(&self, out: &mut [u32; 8]) {
let v0 = __gen_uint(self.grf_register_count, 1, 3);
let v0_address = self.kernel_start_pointer.combine(v0);
out[0] = v0_address as u32;
out[1] = (v0_address >> 32) as u32;
out[1] = __gen_uint(self.software_exception_enable.into(), 7, 7) |
__gen_uint(self.mask_stack_exception_enable.into(), 11, 11) |
__gen_uint(self.illegal_opcode_exception_enable.into(), 13, 13) |
__gen_uint(self.floating_point_mode, 16, 16) |
__gen_uint(self.thread_priority, 17, 17) |
__gen_uint(self.binding_table_entry_count, 18, 25) |
__gen_uint(self.single_program_flow.into(), 31, 31);
let v2 = __gen_uint(self.per_thread_scratch_space, 0, 3);
let v2_address = self.scratch_space_base_pointer.combine(v2);
out[2] = v2_address as u32;
out[3] = (v2_address >> 32) as u32;
out[3] = __gen_uint(self.dispatch_grf_start_register_for_urb_data, 0, 3) |
__gen_uint(self.vertex_urb_entry_read_offset, 4, 9) |
__gen_uint(self.vertex_urb_entry_read_length, 11, 16) |
__gen_uint(self.constant_urb_entry_read_offset, 18, 23) |
__gen_uint(self.constant_urb_entry_read_length, 25, 30);
out[4] = __gen_uint(self.statistics_enable.into(), 10, 10) |
__gen_uint(self.number_of_urb_entries, 11, 18) |
__gen_uint(self.urb_entry_allocation_size, 19, 23) |
__gen_uint(self.maximum_number_of_threads, 25, 30);
let v5 = __gen_uint(self.front_winding, 0, 0) |
__gen_uint(self.viewport_transform_enable.into(), 1, 1);
let v5_address = self.setup_viewport_state_offset.combine(v5);
out[5] = v5_address as u32;
out[6] = (v5_address >> 32) as u32;
out[6] = __gen_ufixed(self.destination_origin_vertical_bias, 9, 12, 4) |
__gen_ufixed(self.destination_origin_horizontal_bias, 13, 16, 4) |
__gen_uint(self.scissor_rectangle_enable.into(), 17, 17) |
__gen_uint(self._2x2_pixel_triangle_filter_disable.into(), 18, 18) |
__gen_uint(self.zero_pixel_triangle_filter_disable.into(), 19, 19) |
__gen_uint(self.point_rasterization_rule, 20, 21) |
__gen_uint(self.line_end_cap_antialiasing_region_width, 22, 23) |
__gen_ufixed(self.line_width, 24, 27, 1) |
__gen_uint(self.fast_scissor_clip_disable.into(), 28, 28) |
__gen_uint(self.cull_mode, 29, 30) |
__gen_uint(self.antialiasing_enable.into(), 31, 31);
out[7] = __gen_ufixed(self.point_width, 0, 10, 3) |
__gen_uint(self.point_width_source, 11, 11) |
__gen_uint(self.vertex_sub_pixel_precision_select, 12, 12) |
__gen_uint(self.sprite_point_enable.into(), 13, 13) |
__gen_uint(self.aa_line_distance_mode, 14, 14) |
__gen_uint(self.triangle_fan_provoking_vertex_select, 25, 26) |
__gen_uint(self.line_strip_list_provoking_vertex_select, 27, 28) |
__gen_uint(self.triangle_strip_list_provoking_vertex_select, 29, 30) |
__gen_uint(self.last_pixel_enable.into(), 31, 31);
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 8];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 8] as *const [u8; 32]) })
}
}
impl From<&[u32; 8]> for SfState<u64> {
fn from(input: &[u32; 8]) -> Self {
SfState {
grf_register_count: __gen_unuint(input[0], 1, 3),
kernel_start_pointer: (__gen_unuint(input[0], 6, 31) as u64) << 6,
software_exception_enable: __gen_unuint(input[1], 7, 7) != 0,
mask_stack_exception_enable: __gen_unuint(input[1], 11, 11) != 0,
illegal_opcode_exception_enable: __gen_unuint(input[1], 13, 13) != 0,
floating_point_mode: __gen_unuint(input[1], 16, 16),
thread_priority: __gen_unuint(input[1], 17, 17),
binding_table_entry_count: __gen_unuint(input[1], 18, 25),
single_program_flow: __gen_unuint(input[1], 31, 31) != 0,
per_thread_scratch_space: __gen_unuint(input[2], 0, 3),
scratch_space_base_pointer: (__gen_unuint(input[2], 10, 31) as u64) << 10,
dispatch_grf_start_register_for_urb_data: __gen_unuint(input[3], 0, 3),
vertex_urb_entry_read_offset: __gen_unuint(input[3], 4, 9),
vertex_urb_entry_read_length: __gen_unuint(input[3], 11, 16),
constant_urb_entry_read_offset: __gen_unuint(input[3], 18, 23),
constant_urb_entry_read_length: __gen_unuint(input[3], 25, 30),
statistics_enable: __gen_unuint(input[4], 10, 10) != 0,
number_of_urb_entries: __gen_unuint(input[4], 11, 18),
urb_entry_allocation_size: __gen_unuint(input[4], 19, 23),
maximum_number_of_threads: __gen_unuint(input[4], 25, 30),
front_winding: __gen_unuint(input[5], 0, 0),
viewport_transform_enable: __gen_unuint(input[5], 1, 1) != 0,
setup_viewport_state_offset: (__gen_unuint(input[5], 5, 31) as u64) << 5,
destination_origin_vertical_bias: __gen_unufixed(input[6], 9, 12, 4),
destination_origin_horizontal_bias: __gen_unufixed(input[6], 13, 16, 4),
scissor_rectangle_enable: __gen_unuint(input[6], 17, 17) != 0,
_2x2_pixel_triangle_filter_disable: __gen_unuint(input[6], 18, 18) != 0,
zero_pixel_triangle_filter_disable: __gen_unuint(input[6], 19, 19) != 0,
point_rasterization_rule: __gen_unuint(input[6], 20, 21),
line_end_cap_antialiasing_region_width: __gen_unuint(input[6], 22, 23),
line_width: __gen_unufixed(input[6], 24, 27, 1),
fast_scissor_clip_disable: __gen_unuint(input[6], 28, 28) != 0,
cull_mode: __gen_unuint(input[6], 29, 30),
antialiasing_enable: __gen_unuint(input[6], 31, 31) != 0,
point_width: __gen_unufixed(input[7], 0, 10, 3),
point_width_source: __gen_unuint(input[7], 11, 11),
vertex_sub_pixel_precision_select: __gen_unuint(input[7], 12, 12),
sprite_point_enable: __gen_unuint(input[7], 13, 13) != 0,
aa_line_distance_mode: __gen_unuint(input[7], 14, 14),
triangle_fan_provoking_vertex_select: __gen_unuint(input[7], 25, 26),
line_strip_list_provoking_vertex_select: __gen_unuint(input[7], 27, 28),
triangle_strip_list_provoking_vertex_select: __gen_unuint(input[7], 29, 30),
last_pixel_enable: __gen_unuint(input[7], 31, 31) != 0,
}
}
}
impl Deserialize for SfState<u64> {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 8];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 8] as *mut [u8; 32]) })?;
Ok((&input).into())
}
}
pub struct SfViewport {
pub viewport_matrix_element_m00: f32,
pub viewport_matrix_element_m11: f32,
pub viewport_matrix_element_m22: f32,
pub viewport_matrix_element_m30: f32,
pub viewport_matrix_element_m31: f32,
pub viewport_matrix_element_m32: f32,
pub scissor_rectangle: ScissorRect,
}
impl SfViewport {
pub const DWORD_LENGTH: u32 = 8;
}
impl Default for SfViewport {
fn default() -> Self {
SfViewport {
viewport_matrix_element_m00: Default::default(),
viewport_matrix_element_m11: Default::default(),
viewport_matrix_element_m22: Default::default(),
viewport_matrix_element_m30: Default::default(),
viewport_matrix_element_m31: Default::default(),
viewport_matrix_element_m32: Default::default(),
scissor_rectangle: Default::default(),
}
}
}
impl Serialize for SfViewport {
type Out = [u32; 8];
fn pack_into(&self, out: &mut [u32; 8]) {
out[0] = self.viewport_matrix_element_m00.to_bits();
out[1] = self.viewport_matrix_element_m11.to_bits();
out[2] = self.viewport_matrix_element_m22.to_bits();
out[3] = self.viewport_matrix_element_m30.to_bits();
out[4] = self.viewport_matrix_element_m31.to_bits();
out[5] = self.viewport_matrix_element_m32.to_bits();
{
let [_, _, _, _, _, _, ref mut out6_7 @ ..] = out;
self.scissor_rectangle.pack_into(out6_7);
}
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 8];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 8] as *const [u8; 32]) })
}
}
impl From<&[u32; 8]> for SfViewport {
fn from(input: &[u32; 8]) -> Self {
SfViewport {
viewport_matrix_element_m00: f32::from_bits(input[0]),
viewport_matrix_element_m11: f32::from_bits(input[1]),
viewport_matrix_element_m22: f32::from_bits(input[2]),
viewport_matrix_element_m30: f32::from_bits(input[3]),
viewport_matrix_element_m31: f32::from_bits(input[4]),
viewport_matrix_element_m32: f32::from_bits(input[5]),
scissor_rectangle: {{
let [_, _, _, _, _, _, ref in6_7 @ ..] = input;
in6_7.into()
}},
}
}
}
impl Deserialize for SfViewport {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 8];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 8] as *mut [u8; 32]) })?;
Ok((&input).into())
}
}
pub struct StateBaseAddress<A: Addr + Default> {
pub dword_length: u32,
pub _3d_command_sub_opcode: u32,
pub _3d_command_opcode: u32,
pub command_subtype: u32,
pub command_type: u32,
pub general_state_base_address_modify_enable: bool,
pub general_state_base_address: A,
pub surface_state_base_address_modify_enable: bool,
pub surface_state_base_address: A,
pub indirect_object_base_address_modify_enable: bool,
pub indirect_object_base_address: A,
pub general_state_access_upper_bound_modify_enable: bool,
pub general_state_access_upper_bound: A,
pub indirect_object_access_upper_bound_modify_enable: bool,
pub indirect_object_access_upper_bound: A,
}
impl<A: Addr + Default> StateBaseAddress<A> {
pub const DWORD_LENGTH: u32 = 6;
}
impl<A: Addr + Default> Default for StateBaseAddress<A> {
fn default() -> Self {
StateBaseAddress {
dword_length: 4,
_3d_command_sub_opcode: 1,
_3d_command_opcode: 1,
command_subtype: 0,
command_type: 3,
general_state_base_address_modify_enable: Default::default(),
general_state_base_address: Default::default(),
surface_state_base_address_modify_enable: Default::default(),
surface_state_base_address: Default::default(),
indirect_object_base_address_modify_enable: Default::default(),
indirect_object_base_address: Default::default(),
general_state_access_upper_bound_modify_enable: Default::default(),
general_state_access_upper_bound: Default::default(),
indirect_object_access_upper_bound_modify_enable: Default::default(),
indirect_object_access_upper_bound: Default::default(),
}
}
}
impl<A: Addr + Default> Serialize for StateBaseAddress<A> {
type Out = [u32; 6];
fn pack_into(&self, out: &mut [u32; 6]) {
out[0] = __gen_uint(self.dword_length, 0, 7) |
__gen_uint(self._3d_command_sub_opcode, 16, 23) |
__gen_uint(self._3d_command_opcode, 24, 26) |
__gen_uint(self.command_subtype, 27, 28) |
__gen_uint(self.command_type, 29, 31);
let v1 = __gen_uint(self.general_state_base_address_modify_enable.into(), 0, 0);
let v1_address = self.general_state_base_address.combine(v1);
out[1] = v1_address as u32;
out[2] = (v1_address >> 32) as u32;
let v2 = __gen_uint(self.surface_state_base_address_modify_enable.into(), 0, 0);
let v2_address = self.surface_state_base_address.combine(v2);
out[2] = v2_address as u32;
out[3] = (v2_address >> 32) as u32;
let v3 = __gen_uint(self.indirect_object_base_address_modify_enable.into(), 0, 0);
let v3_address = self.indirect_object_base_address.combine(v3);
out[3] = v3_address as u32;
out[4] = (v3_address >> 32) as u32;
let v4 = __gen_uint(self.general_state_access_upper_bound_modify_enable.into(), 0, 0);
let v4_address = self.general_state_access_upper_bound.combine(v4);
out[4] = v4_address as u32;
out[5] = (v4_address >> 32) as u32;
let v5 = __gen_uint(self.indirect_object_access_upper_bound_modify_enable.into(), 0, 0);
let v5_address = self.indirect_object_access_upper_bound.combine(v5);
out[5] = v5_address as u32;
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 6];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 6] as *const [u8; 24]) })
}
}
impl From<&[u32; 6]> for StateBaseAddress<u64> {
fn from(input: &[u32; 6]) -> Self {
StateBaseAddress {
dword_length: __gen_unuint(input[0], 0, 7),
_3d_command_sub_opcode: __gen_unuint(input[0], 16, 23),
_3d_command_opcode: __gen_unuint(input[0], 24, 26),
command_subtype: __gen_unuint(input[0], 27, 28),
command_type: __gen_unuint(input[0], 29, 31),
general_state_base_address_modify_enable: __gen_unuint(input[1], 0, 0) != 0,
general_state_base_address: (__gen_unuint(input[1], 12, 31) as u64) << 12,
surface_state_base_address_modify_enable: __gen_unuint(input[2], 0, 0) != 0,
surface_state_base_address: (__gen_unuint(input[2], 12, 31) as u64) << 12,
indirect_object_base_address_modify_enable: __gen_unuint(input[3], 0, 0) != 0,
indirect_object_base_address: (__gen_unuint(input[3], 12, 31) as u64) << 12,
general_state_access_upper_bound_modify_enable: __gen_unuint(input[4], 0, 0) != 0,
general_state_access_upper_bound: (__gen_unuint(input[4], 12, 31) as u64) << 12,
indirect_object_access_upper_bound_modify_enable: __gen_unuint(input[5], 0, 0) != 0,
indirect_object_access_upper_bound: (__gen_unuint(input[5], 12, 31) as u64) << 12,
}
}
}
impl Deserialize for StateBaseAddress<u64> {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 6];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 6] as *mut [u8; 24]) })?;
Ok((&input).into())
}
}
pub struct StateSip {
pub dword_length: u32,
pub _3d_command_sub_opcode: u32,
pub _3d_command_opcode: u32,
pub command_subtype: u32,
pub command_type: u32,
pub system_instruction_pointer: u64,
}
impl StateSip {
pub const DWORD_LENGTH: u32 = 2;
}
impl Default for StateSip {
fn default() -> Self {
StateSip {
dword_length: 0,
_3d_command_sub_opcode: 2,
_3d_command_opcode: 1,
command_subtype: 0,
command_type: 3,
system_instruction_pointer: Default::default(),
}
}
}
impl Serialize for StateSip {
type Out = [u32; 2];
fn pack_into(&self, out: &mut [u32; 2]) {
out[0] = __gen_uint(self.dword_length, 0, 7) |
__gen_uint(self._3d_command_sub_opcode, 16, 23) |
__gen_uint(self._3d_command_opcode, 24, 26) |
__gen_uint(self.command_subtype, 27, 28) |
__gen_uint(self.command_type, 29, 31);
out[1] = __gen_offset(self.system_instruction_pointer as u32, 4, 31);
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 2];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 2] as *const [u8; 8]) })
}
}
impl From<&[u32; 2]> for StateSip {
fn from(input: &[u32; 2]) -> Self {
StateSip {
dword_length: __gen_unuint(input[0], 0, 7),
_3d_command_sub_opcode: __gen_unuint(input[0], 16, 23),
_3d_command_opcode: __gen_unuint(input[0], 24, 26),
command_subtype: __gen_unuint(input[0], 27, 28),
command_type: __gen_unuint(input[0], 29, 31),
system_instruction_pointer: (__gen_unuint(input[1], 4, 31) as u64) << 4,
}
}
}
impl Deserialize for StateSip {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 2];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 2] as *mut [u8; 8]) })?;
Ok((&input).into())
}
}
pub struct UrbFence {
pub dword_length: u32,
pub vs_unit_urb_reallocation_request: bool,
pub gs_unit_urb_reallocation_request: bool,
pub clip_unit_urb_reallocation_request: bool,
pub sf_unit_urb_reallocation_request: bool,
pub vfe_unit_urb_reallocation_request: bool,
pub cs_unit_urb_reallocation_request: bool,
pub _3d_command_sub_opcode: u32,
pub _3d_command_opcode: u32,
pub command_subtype: u32,
pub command_type: u32,
pub vs_fence: u32,
pub gs_fence: u32,
pub clip_fence: u32,
pub sf_fence: u32,
pub vfe_fence: u32,
pub cs_fence: u32,
}
impl UrbFence {
pub const DWORD_LENGTH: u32 = 3;
}
impl Default for UrbFence {
fn default() -> Self {
UrbFence {
dword_length: 1,
vs_unit_urb_reallocation_request: Default::default(),
gs_unit_urb_reallocation_request: Default::default(),
clip_unit_urb_reallocation_request: Default::default(),
sf_unit_urb_reallocation_request: Default::default(),
vfe_unit_urb_reallocation_request: Default::default(),
cs_unit_urb_reallocation_request: Default::default(),
_3d_command_sub_opcode: 0,
_3d_command_opcode: 0,
command_subtype: 0,
command_type: 3,
vs_fence: Default::default(),
gs_fence: Default::default(),
clip_fence: Default::default(),
sf_fence: Default::default(),
vfe_fence: Default::default(),
cs_fence: Default::default(),
}
}
}
impl Serialize for UrbFence {
type Out = [u32; 3];
fn pack_into(&self, out: &mut [u32; 3]) {
out[0] = __gen_uint(self.dword_length, 0, 7) |
__gen_uint(self.vs_unit_urb_reallocation_request.into(), 8, 8) |
__gen_uint(self.gs_unit_urb_reallocation_request.into(), 9, 9) |
__gen_uint(self.clip_unit_urb_reallocation_request.into(), 10, 10) |
__gen_uint(self.sf_unit_urb_reallocation_request.into(), 11, 11) |
__gen_uint(self.vfe_unit_urb_reallocation_request.into(), 12, 12) |
__gen_uint(self.cs_unit_urb_reallocation_request.into(), 13, 13) |
__gen_uint(self._3d_command_sub_opcode, 16, 23) |
__gen_uint(self._3d_command_opcode, 24, 26) |
__gen_uint(self.command_subtype, 27, 28) |
__gen_uint(self.command_type, 29, 31);
out[1] = __gen_uint(self.vs_fence, 0, 9) |
__gen_uint(self.gs_fence, 10, 19) |
__gen_uint(self.clip_fence, 20, 29);
out[2] = __gen_uint(self.sf_fence, 0, 9) |
__gen_uint(self.vfe_fence, 10, 19) |
__gen_uint(self.cs_fence, 20, 30);
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 3];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 3] as *const [u8; 12]) })
}
}
impl From<&[u32; 3]> for UrbFence {
fn from(input: &[u32; 3]) -> Self {
UrbFence {
dword_length: __gen_unuint(input[0], 0, 7),
vs_unit_urb_reallocation_request: __gen_unuint(input[0], 8, 8) != 0,
gs_unit_urb_reallocation_request: __gen_unuint(input[0], 9, 9) != 0,
clip_unit_urb_reallocation_request: __gen_unuint(input[0], 10, 10) != 0,
sf_unit_urb_reallocation_request: __gen_unuint(input[0], 11, 11) != 0,
vfe_unit_urb_reallocation_request: __gen_unuint(input[0], 12, 12) != 0,
cs_unit_urb_reallocation_request: __gen_unuint(input[0], 13, 13) != 0,
_3d_command_sub_opcode: __gen_unuint(input[0], 16, 23),
_3d_command_opcode: __gen_unuint(input[0], 24, 26),
command_subtype: __gen_unuint(input[0], 27, 28),
command_type: __gen_unuint(input[0], 29, 31),
vs_fence: __gen_unuint(input[1], 0, 9),
gs_fence: __gen_unuint(input[1], 10, 19),
clip_fence: __gen_unuint(input[1], 20, 29),
sf_fence: __gen_unuint(input[2], 0, 9),
vfe_fence: __gen_unuint(input[2], 10, 19),
cs_fence: __gen_unuint(input[2], 20, 30),
}
}
}
impl Deserialize for UrbFence {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 3];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 3] as *mut [u8; 12]) })?;
Ok((&input).into())
}
}
pub struct VertexBufferState<A: Addr + Default> {
pub buffer_pitch: u32,
pub buffer_access_type: u32,
pub vertex_buffer_index: u32,
pub buffer_starting_address: A,
pub max_index: u32,
pub instance_data_step_rate: u32,
}
impl<A: Addr + Default> VertexBufferState<A> {
pub const DWORD_LENGTH: u32 = 4;
pub const INSTANCEDATA: u32 = 1;
pub const VERTEXDATA: u32 = 0;
}
impl<A: Addr + Default> Default for VertexBufferState<A> {
fn default() -> Self {
VertexBufferState {
buffer_pitch: Default::default(),
buffer_access_type: Default::default(),
vertex_buffer_index: Default::default(),
buffer_starting_address: Default::default(),
max_index: Default::default(),
instance_data_step_rate: Default::default(),
}
}
}
impl<A: Addr + Default> Serialize for VertexBufferState<A> {
type Out = [u32; 4];
fn pack_into(&self, out: &mut [u32; 4]) {
out[0] = __gen_uint(self.buffer_pitch, 0, 10) |
__gen_uint(self.buffer_access_type, 26, 26) |
__gen_uint(self.vertex_buffer_index, 27, 31);
let v1_address = self.buffer_starting_address.combine(0);
out[1] = v1_address as u32;
out[2] = (v1_address >> 32) as u32;
out[2] = __gen_uint(self.max_index, 0, 31);
out[3] = __gen_uint(self.instance_data_step_rate, 0, 31);
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 4];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 4] as *const [u8; 16]) })
}
}
impl From<&[u32; 4]> for VertexBufferState<u64> {
fn from(input: &[u32; 4]) -> Self {
VertexBufferState {
buffer_pitch: __gen_unuint(input[0], 0, 10),
buffer_access_type: __gen_unuint(input[0], 26, 26),
vertex_buffer_index: __gen_unuint(input[0], 27, 31),
buffer_starting_address: (__gen_unuint(input[1], 0, 31) as u64),
max_index: __gen_unuint(input[2], 0, 31),
instance_data_step_rate: __gen_unuint(input[3], 0, 31),
}
}
}
impl Deserialize for VertexBufferState<u64> {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 4];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 4] as *mut [u8; 16]) })?;
Ok((&input).into())
}
}
pub struct VertexElementState {
pub source_element_offset: u32,
pub source_element_format: u32,
pub valid: bool,
pub vertex_buffer_index: u32,
pub destination_element_offset: u32,
pub component_3_control: _3dVertexComponentControl,
pub component_2_control: _3dVertexComponentControl,
pub component_1_control: _3dVertexComponentControl,
pub component_0_control: _3dVertexComponentControl,
}
impl VertexElementState {
pub const DWORD_LENGTH: u32 = 2;
}
impl Default for VertexElementState {
fn default() -> Self {
VertexElementState {
source_element_offset: Default::default(),
source_element_format: Default::default(),
valid: Default::default(),
vertex_buffer_index: Default::default(),
destination_element_offset: Default::default(),
component_3_control: Default::default(),
component_2_control: Default::default(),
component_1_control: Default::default(),
component_0_control: Default::default(),
}
}
}
impl Serialize for VertexElementState {
type Out = [u32; 2];
fn pack_into(&self, out: &mut [u32; 2]) {
out[0] = __gen_uint(self.source_element_offset, 0, 10) |
__gen_uint(self.source_element_format, 16, 24) |
__gen_uint(self.valid.into(), 26, 26) |
__gen_uint(self.vertex_buffer_index, 27, 31);
out[1] = __gen_uint(self.destination_element_offset, 0, 7) |
__gen_uint(self.component_3_control.into(), 16, 18) |
__gen_uint(self.component_2_control.into(), 20, 22) |
__gen_uint(self.component_1_control.into(), 24, 26) |
__gen_uint(self.component_0_control.into(), 28, 30);
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 2];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 2] as *const [u8; 8]) })
}
}
impl From<&[u32; 2]> for VertexElementState {
fn from(input: &[u32; 2]) -> Self {
VertexElementState {
source_element_offset: __gen_unuint(input[0], 0, 10),
source_element_format: __gen_unuint(input[0], 16, 24),
valid: __gen_unuint(input[0], 26, 26) != 0,
vertex_buffer_index: __gen_unuint(input[0], 27, 31),
destination_element_offset: __gen_unuint(input[1], 0, 7),
component_3_control: (__gen_unuint(input[1], 16, 18)).into(),
component_2_control: (__gen_unuint(input[1], 20, 22)).into(),
component_1_control: (__gen_unuint(input[1], 24, 26)).into(),
component_0_control: (__gen_unuint(input[1], 28, 30)).into(),
}
}
}
impl Deserialize for VertexElementState {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 2];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 2] as *mut [u8; 8]) })?;
Ok((&input).into())
}
}
pub struct VsState<A: Addr + Default> {
pub grf_register_count: u32,
pub kernel_start_pointer: A,
pub software_exception_enable: bool,
pub mask_stack_exception_enable: bool,
pub illegal_opcode_exception_enable: bool,
pub floating_point_mode: u32,
pub thread_priority: u32,
pub binding_table_entry_count: u32,
pub single_program_flow: bool,
pub per_thread_scratch_space: u32,
pub scratch_space_base_pointer: A,
pub dispatch_grf_start_register_for_urb_data: u32,
pub vertex_urb_entry_read_offset: u32,
pub vertex_urb_entry_read_length: u32,
pub constant_urb_entry_read_offset: u32,
pub constant_urb_entry_read_length: u32,
pub statistics_enable: bool,
pub number_of_urb_entries: u32,
pub urb_entry_allocation_size: u32,
pub maximum_number_of_threads: u32,
pub sampler_count: u32,
pub sampler_state_pointer: A,
pub enable: bool,
pub vertex_cache_disable: bool,
}
impl<A: Addr + Default> VsState<A> {
pub const DWORD_LENGTH: u32 = 7;
pub const ALTERNATE: u32 = 1;
pub const HIGH_PRIORITY: u32 = 1;
pub const IEEE_754: u32 = 0;
pub const NORMAL_PRIORITY: u32 = 0;
}
impl<A: Addr + Default> Default for VsState<A> {
fn default() -> Self {
VsState {
grf_register_count: Default::default(),
kernel_start_pointer: Default::default(),
software_exception_enable: Default::default(),
mask_stack_exception_enable: Default::default(),
illegal_opcode_exception_enable: Default::default(),
floating_point_mode: Default::default(),
thread_priority: Default::default(),
binding_table_entry_count: Default::default(),
single_program_flow: Default::default(),
per_thread_scratch_space: Default::default(),
scratch_space_base_pointer: Default::default(),
dispatch_grf_start_register_for_urb_data: Default::default(),
vertex_urb_entry_read_offset: Default::default(),
vertex_urb_entry_read_length: Default::default(),
constant_urb_entry_read_offset: Default::default(),
constant_urb_entry_read_length: Default::default(),
statistics_enable: Default::default(),
number_of_urb_entries: Default::default(),
urb_entry_allocation_size: Default::default(),
maximum_number_of_threads: Default::default(),
sampler_count: Default::default(),
sampler_state_pointer: Default::default(),
enable: Default::default(),
vertex_cache_disable: Default::default(),
}
}
}
impl<A: Addr + Default> Serialize for VsState<A> {
type Out = [u32; 7];
fn pack_into(&self, out: &mut [u32; 7]) {
let v0 = __gen_uint(self.grf_register_count, 1, 3);
let v0_address = self.kernel_start_pointer.combine(v0);
out[0] = v0_address as u32;
out[1] = (v0_address >> 32) as u32;
out[1] = __gen_uint(self.software_exception_enable.into(), 7, 7) |
__gen_uint(self.mask_stack_exception_enable.into(), 11, 11) |
__gen_uint(self.illegal_opcode_exception_enable.into(), 13, 13) |
__gen_uint(self.floating_point_mode, 16, 16) |
__gen_uint(self.thread_priority, 17, 17) |
__gen_uint(self.binding_table_entry_count, 18, 25) |
__gen_uint(self.single_program_flow.into(), 31, 31);
let v2 = __gen_uint(self.per_thread_scratch_space, 0, 3);
let v2_address = self.scratch_space_base_pointer.combine(v2);
out[2] = v2_address as u32;
out[3] = (v2_address >> 32) as u32;
out[3] = __gen_uint(self.dispatch_grf_start_register_for_urb_data, 0, 3) |
__gen_uint(self.vertex_urb_entry_read_offset, 4, 9) |
__gen_uint(self.vertex_urb_entry_read_length, 11, 16) |
__gen_uint(self.constant_urb_entry_read_offset, 18, 23) |
__gen_uint(self.constant_urb_entry_read_length, 25, 30);
out[4] = __gen_uint(self.statistics_enable.into(), 10, 10) |
__gen_uint(self.number_of_urb_entries, 11, 18) |
__gen_uint(self.urb_entry_allocation_size, 19, 23) |
__gen_uint(self.maximum_number_of_threads, 25, 30);
let v5 = __gen_uint(self.sampler_count, 0, 2);
let v5_address = self.sampler_state_pointer.combine(v5);
out[5] = v5_address as u32;
out[6] = (v5_address >> 32) as u32;
out[6] = __gen_uint(self.enable.into(), 0, 0) |
__gen_uint(self.vertex_cache_disable.into(), 1, 1);
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 7];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 7] as *const [u8; 28]) })
}
}
impl From<&[u32; 7]> for VsState<u64> {
fn from(input: &[u32; 7]) -> Self {
VsState {
grf_register_count: __gen_unuint(input[0], 1, 3),
kernel_start_pointer: (__gen_unuint(input[0], 6, 31) as u64) << 6,
software_exception_enable: __gen_unuint(input[1], 7, 7) != 0,
mask_stack_exception_enable: __gen_unuint(input[1], 11, 11) != 0,
illegal_opcode_exception_enable: __gen_unuint(input[1], 13, 13) != 0,
floating_point_mode: __gen_unuint(input[1], 16, 16),
thread_priority: __gen_unuint(input[1], 17, 17),
binding_table_entry_count: __gen_unuint(input[1], 18, 25),
single_program_flow: __gen_unuint(input[1], 31, 31) != 0,
per_thread_scratch_space: __gen_unuint(input[2], 0, 3),
scratch_space_base_pointer: (__gen_unuint(input[2], 10, 31) as u64) << 10,
dispatch_grf_start_register_for_urb_data: __gen_unuint(input[3], 0, 3),
vertex_urb_entry_read_offset: __gen_unuint(input[3], 4, 9),
vertex_urb_entry_read_length: __gen_unuint(input[3], 11, 16),
constant_urb_entry_read_offset: __gen_unuint(input[3], 18, 23),
constant_urb_entry_read_length: __gen_unuint(input[3], 25, 30),
statistics_enable: __gen_unuint(input[4], 10, 10) != 0,
number_of_urb_entries: __gen_unuint(input[4], 11, 18),
urb_entry_allocation_size: __gen_unuint(input[4], 19, 23),
maximum_number_of_threads: __gen_unuint(input[4], 25, 30),
sampler_count: __gen_unuint(input[5], 0, 2),
sampler_state_pointer: (__gen_unuint(input[5], 5, 31) as u64) << 5,
enable: __gen_unuint(input[6], 0, 0) != 0,
vertex_cache_disable: __gen_unuint(input[6], 1, 1) != 0,
}
}
}
impl Deserialize for VsState<u64> {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 7];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 7] as *mut [u8; 28]) })?;
Ok((&input).into())
}
}
pub struct WmState<A: Addr + Default> {
pub grf_register_count_0: u32,
pub kernel_start_pointer_0: A,
pub software_exception_enable: bool,
pub mask_stack_exception_enable: bool,
pub illegal_opcode_exception_enable: bool,
pub depth_coefficient_urb_read_offset: u32,
pub floating_point_mode: u32,
pub thread_priority: u32,
pub binding_table_entry_count: u32,
pub single_program_flow: bool,
pub per_thread_scratch_space: u32,
pub scratch_space_base_pointer: A,
pub dispatch_grf_start_register_for_constant_setup_data_0: u32,
pub setup_urb_entry_read_offset: u32,
pub setup_urb_entry_read_length: u32,
pub constant_urb_entry_read_offset: u32,
pub constant_urb_entry_read_length: u32,
pub statistics_enable: bool,
pub sampler_count: u32,
pub sampler_state_pointer: A,
pub _8_pixel_dispatch_enable: bool,
pub _16_pixel_dispatch_enable: bool,
pub _32_pixel_dispatch_enable: bool,
pub contiguous_32_pixel_dispatch_enable: bool,
pub contiguous_64_pixel_dispatch_enable: bool,
pub legacy_global_depth_bias_enable: bool,
pub line_stipple_enable: bool,
pub global_depth_offset_enable: bool,
pub polygon_stipple_enable: bool,
pub line_antialiasing_region_width: u32,
pub line_end_cap_antialiasing_region_width: u32,
pub early_depth_test_enable: bool,
pub thread_dispatch_enable: bool,
pub pixel_shader_uses_source_depth: bool,
pub pixel_shader_computed_depth: bool,
pub pixel_shader_kills_pixel: bool,
pub legacy_diamond_line_rasterization: bool,
pub maximum_number_of_threads: u32,
pub global_depth_offset_constant: f32,
pub global_depth_offset_scale: f32,
}
impl<A: Addr + Default> WmState<A> {
pub const DWORD_LENGTH: u32 = 8;
pub const ALTERNATE: u32 = 1;
pub const HIGH: u32 = 1;
pub const IEEE_754: u32 = 0;
pub const NORMAL: u32 = 0;
pub const _0_5_PIXELS: u32 = 0;
pub const _1_0_PIXELS: u32 = 1;
pub const _2_0_PIXELS: u32 = 2;
pub const _4_0_PIXELS: u32 = 3;
}
impl<A: Addr + Default> Default for WmState<A> {
fn default() -> Self {
WmState {
grf_register_count_0: Default::default(),
kernel_start_pointer_0: Default::default(),
software_exception_enable: Default::default(),
mask_stack_exception_enable: Default::default(),
illegal_opcode_exception_enable: Default::default(),
depth_coefficient_urb_read_offset: Default::default(),
floating_point_mode: Default::default(),
thread_priority: Default::default(),
binding_table_entry_count: Default::default(),
single_program_flow: Default::default(),
per_thread_scratch_space: Default::default(),
scratch_space_base_pointer: Default::default(),
dispatch_grf_start_register_for_constant_setup_data_0: Default::default(),
setup_urb_entry_read_offset: Default::default(),
setup_urb_entry_read_length: Default::default(),
constant_urb_entry_read_offset: Default::default(),
constant_urb_entry_read_length: Default::default(),
statistics_enable: Default::default(),
sampler_count: Default::default(),
sampler_state_pointer: Default::default(),
_8_pixel_dispatch_enable: Default::default(),
_16_pixel_dispatch_enable: Default::default(),
_32_pixel_dispatch_enable: Default::default(),
contiguous_32_pixel_dispatch_enable: Default::default(),
contiguous_64_pixel_dispatch_enable: Default::default(),
legacy_global_depth_bias_enable: Default::default(),
line_stipple_enable: Default::default(),
global_depth_offset_enable: Default::default(),
polygon_stipple_enable: Default::default(),
line_antialiasing_region_width: Default::default(),
line_end_cap_antialiasing_region_width: Default::default(),
early_depth_test_enable: Default::default(),
thread_dispatch_enable: Default::default(),
pixel_shader_uses_source_depth: Default::default(),
pixel_shader_computed_depth: Default::default(),
pixel_shader_kills_pixel: Default::default(),
legacy_diamond_line_rasterization: Default::default(),
maximum_number_of_threads: Default::default(),
global_depth_offset_constant: Default::default(),
global_depth_offset_scale: Default::default(),
}
}
}
impl<A: Addr + Default> Serialize for WmState<A> {
type Out = [u32; 8];
fn pack_into(&self, out: &mut [u32; 8]) {
let v0 = __gen_uint(self.grf_register_count_0, 1, 3);
let v0_address = self.kernel_start_pointer_0.combine(v0);
out[0] = v0_address as u32;
out[1] = (v0_address >> 32) as u32;
out[1] = __gen_uint(self.software_exception_enable.into(), 1, 1) |
__gen_uint(self.mask_stack_exception_enable.into(), 2, 2) |
__gen_uint(self.illegal_opcode_exception_enable.into(), 4, 4) |
__gen_uint(self.depth_coefficient_urb_read_offset, 8, 13) |
__gen_uint(self.floating_point_mode, 16, 16) |
__gen_uint(self.thread_priority, 17, 17) |
__gen_uint(self.binding_table_entry_count, 18, 25) |
__gen_uint(self.single_program_flow.into(), 31, 31);
let v2 = __gen_uint(self.per_thread_scratch_space, 0, 3);
let v2_address = self.scratch_space_base_pointer.combine(v2);
out[2] = v2_address as u32;
out[3] = (v2_address >> 32) as u32;
out[3] = __gen_uint(self.dispatch_grf_start_register_for_constant_setup_data_0, 0, 3) |
__gen_uint(self.setup_urb_entry_read_offset, 4, 9) |
__gen_uint(self.setup_urb_entry_read_length, 11, 16) |
__gen_uint(self.constant_urb_entry_read_offset, 18, 23) |
__gen_uint(self.constant_urb_entry_read_length, 25, 30);
let v4 = __gen_uint(self.statistics_enable.into(), 0, 0) |
__gen_uint(self.sampler_count, 2, 4);
let v4_address = self.sampler_state_pointer.combine(v4);
out[4] = v4_address as u32;
out[5] = (v4_address >> 32) as u32;
out[5] = __gen_uint(self._8_pixel_dispatch_enable.into(), 0, 0) |
__gen_uint(self._16_pixel_dispatch_enable.into(), 1, 1) |
__gen_uint(self._32_pixel_dispatch_enable.into(), 2, 2) |
__gen_uint(self.contiguous_32_pixel_dispatch_enable.into(), 3, 3) |
__gen_uint(self.contiguous_64_pixel_dispatch_enable.into(), 4, 4) |
__gen_uint(self.legacy_global_depth_bias_enable.into(), 10, 10) |
__gen_uint(self.line_stipple_enable.into(), 11, 11) |
__gen_uint(self.global_depth_offset_enable.into(), 12, 12) |
__gen_uint(self.polygon_stipple_enable.into(), 13, 13) |
__gen_uint(self.line_antialiasing_region_width, 14, 15) |
__gen_uint(self.line_end_cap_antialiasing_region_width, 16, 17) |
__gen_uint(self.early_depth_test_enable.into(), 18, 18) |
__gen_uint(self.thread_dispatch_enable.into(), 19, 19) |
__gen_uint(self.pixel_shader_uses_source_depth.into(), 20, 20) |
__gen_uint(self.pixel_shader_computed_depth.into(), 21, 21) |
__gen_uint(self.pixel_shader_kills_pixel.into(), 22, 22) |
__gen_uint(self.legacy_diamond_line_rasterization.into(), 23, 23) |
__gen_uint(self.maximum_number_of_threads, 25, 31);
out[6] = self.global_depth_offset_constant.to_bits();
out[7] = self.global_depth_offset_scale.to_bits();
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 8];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 8] as *const [u8; 32]) })
}
}
impl From<&[u32; 8]> for WmState<u64> {
fn from(input: &[u32; 8]) -> Self {
WmState {
grf_register_count_0: __gen_unuint(input[0], 1, 3),
kernel_start_pointer_0: (__gen_unuint(input[0], 6, 31) as u64) << 6,
software_exception_enable: __gen_unuint(input[1], 1, 1) != 0,
mask_stack_exception_enable: __gen_unuint(input[1], 2, 2) != 0,
illegal_opcode_exception_enable: __gen_unuint(input[1], 4, 4) != 0,
depth_coefficient_urb_read_offset: __gen_unuint(input[1], 8, 13),
floating_point_mode: __gen_unuint(input[1], 16, 16),
thread_priority: __gen_unuint(input[1], 17, 17),
binding_table_entry_count: __gen_unuint(input[1], 18, 25),
single_program_flow: __gen_unuint(input[1], 31, 31) != 0,
per_thread_scratch_space: __gen_unuint(input[2], 0, 3),
scratch_space_base_pointer: (__gen_unuint(input[2], 10, 31) as u64) << 10,
dispatch_grf_start_register_for_constant_setup_data_0: __gen_unuint(input[3], 0, 3),
setup_urb_entry_read_offset: __gen_unuint(input[3], 4, 9),
setup_urb_entry_read_length: __gen_unuint(input[3], 11, 16),
constant_urb_entry_read_offset: __gen_unuint(input[3], 18, 23),
constant_urb_entry_read_length: __gen_unuint(input[3], 25, 30),
statistics_enable: __gen_unuint(input[4], 0, 0) != 0,
sampler_count: __gen_unuint(input[4], 2, 4),
sampler_state_pointer: (__gen_unuint(input[4], 5, 31) as u64) << 5,
_8_pixel_dispatch_enable: __gen_unuint(input[5], 0, 0) != 0,
_16_pixel_dispatch_enable: __gen_unuint(input[5], 1, 1) != 0,
_32_pixel_dispatch_enable: __gen_unuint(input[5], 2, 2) != 0,
contiguous_32_pixel_dispatch_enable: __gen_unuint(input[5], 3, 3) != 0,
contiguous_64_pixel_dispatch_enable: __gen_unuint(input[5], 4, 4) != 0,
legacy_global_depth_bias_enable: __gen_unuint(input[5], 10, 10) != 0,
line_stipple_enable: __gen_unuint(input[5], 11, 11) != 0,
global_depth_offset_enable: __gen_unuint(input[5], 12, 12) != 0,
polygon_stipple_enable: __gen_unuint(input[5], 13, 13) != 0,
line_antialiasing_region_width: __gen_unuint(input[5], 14, 15),
line_end_cap_antialiasing_region_width: __gen_unuint(input[5], 16, 17),
early_depth_test_enable: __gen_unuint(input[5], 18, 18) != 0,
thread_dispatch_enable: __gen_unuint(input[5], 19, 19) != 0,
pixel_shader_uses_source_depth: __gen_unuint(input[5], 20, 20) != 0,
pixel_shader_computed_depth: __gen_unuint(input[5], 21, 21) != 0,
pixel_shader_kills_pixel: __gen_unuint(input[5], 22, 22) != 0,
legacy_diamond_line_rasterization: __gen_unuint(input[5], 23, 23) != 0,
maximum_number_of_threads: __gen_unuint(input[5], 25, 31),
global_depth_offset_constant: f32::from_bits(input[6]),
global_depth_offset_scale: f32::from_bits(input[7]),
}
}
}
impl Deserialize for WmState<u64> {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 8];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 8] as *mut [u8; 32]) })?;
Ok((&input).into())
}
}
pub struct XyColorBlt<A: Addr + Default> {
pub dword_length: u32,
pub tiling_enable: bool,
pub _32bpp_byte_mask: u32,
pub _2d_command_opcode: u32,
pub command_type: u32,
pub destination_pitch: i32,
pub raster_operation: i32,
pub color_depth: u32,
pub clipping_enabled: bool,
pub destination_x1_coordinate: i32,
pub destination_y1_coordinate: i32,
pub destination_x2_coordinate: i32,
pub destination_y2_coordinate: i32,
pub destination_base_address: A,
pub solid_pattern_color: i32,
}
impl<A: Addr + Default> XyColorBlt<A> {
pub const DWORD_LENGTH: u32 = 6;
pub const _1555: u32 = 2;
pub const _32_BIT: u32 = 3;
pub const _565: u32 = 1;
pub const _8_BIT: u32 = 0;
}
impl<A: Addr + Default> Default for XyColorBlt<A> {
fn default() -> Self {
XyColorBlt {
dword_length: 4,
tiling_enable: Default::default(),
_32bpp_byte_mask: Default::default(),
_2d_command_opcode: 80,
command_type: 2,
destination_pitch: Default::default(),
raster_operation: Default::default(),
color_depth: Default::default(),
clipping_enabled: Default::default(),
destination_x1_coordinate: Default::default(),
destination_y1_coordinate: Default::default(),
destination_x2_coordinate: Default::default(),
destination_y2_coordinate: Default::default(),
destination_base_address: Default::default(),
solid_pattern_color: Default::default(),
}
}
}
impl<A: Addr + Default> Serialize for XyColorBlt<A> {
type Out = [u32; 6];
fn pack_into(&self, out: &mut [u32; 6]) {
out[0] = __gen_uint(self.dword_length, 0, 7) |
__gen_uint(self.tiling_enable.into(), 11, 11) |
__gen_uint(self._32bpp_byte_mask, 20, 21) |
__gen_uint(self._2d_command_opcode, 22, 28) |
__gen_uint(self.command_type, 29, 31);
out[1] = __gen_uint(self.destination_pitch as u32, 0, 15) |
__gen_uint(self.raster_operation as u32, 16, 23) |
__gen_uint(self.color_depth, 24, 25) |
__gen_uint(self.clipping_enabled.into(), 30, 30);
out[2] = __gen_uint(self.destination_x1_coordinate as u32, 0, 15) |
__gen_uint(self.destination_y1_coordinate as u32, 16, 31);
out[3] = __gen_uint(self.destination_x2_coordinate as u32, 0, 15) |
__gen_uint(self.destination_y2_coordinate as u32, 16, 31);
let v4_address = self.destination_base_address.combine(0);
out[4] = v4_address as u32;
out[5] = (v4_address >> 32) as u32;
out[5] = __gen_uint(self.solid_pattern_color as u32, 0, 31);
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 6];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 6] as *const [u8; 24]) })
}
}
impl From<&[u32; 6]> for XyColorBlt<u64> {
fn from(input: &[u32; 6]) -> Self {
XyColorBlt {
dword_length: __gen_unuint(input[0], 0, 7),
tiling_enable: __gen_unuint(input[0], 11, 11) != 0,
_32bpp_byte_mask: __gen_unuint(input[0], 20, 21),
_2d_command_opcode: __gen_unuint(input[0], 22, 28),
command_type: __gen_unuint(input[0], 29, 31),
destination_pitch: (__gen_unuint(input[1], 0, 15)) as i32,
raster_operation: (__gen_unuint(input[1], 16, 23)) as i32,
color_depth: __gen_unuint(input[1], 24, 25),
clipping_enabled: __gen_unuint(input[1], 30, 30) != 0,
destination_x1_coordinate: (__gen_unuint(input[2], 0, 15)) as i32,
destination_y1_coordinate: (__gen_unuint(input[2], 16, 31)) as i32,
destination_x2_coordinate: (__gen_unuint(input[3], 0, 15)) as i32,
destination_y2_coordinate: (__gen_unuint(input[3], 16, 31)) as i32,
destination_base_address: (__gen_unuint(input[4], 0, 31) as u64),
solid_pattern_color: (__gen_unuint(input[5], 0, 31)) as i32,
}
}
}
impl Deserialize for XyColorBlt<u64> {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 6];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 6] as *mut [u8; 24]) })?;
Ok((&input).into())
}
}
pub struct XySetupBlt<A: Addr + Default> {
pub dword_length: u32,
pub tiling_enable: bool,
pub _32bpp_byte_mask: u32,
pub _2d_command_opcode: u32,
pub command_type: u32,
pub destination_pitch: i32,
pub raster_operation: i32,
pub color_depth: u32,
pub mono_source_transparency_mode: bool,
pub clipping_enabled: bool,
pub cliprect_x1_coordinate: i32,
pub cliprect_y1_coordinate: i32,
pub cliprect_x2_coordinate: i32,
pub cliprect_y2_coordinate: i32,
pub destination_base_address: A,
pub background_color: u32,
pub foreground_color: u32,
pub pattern_base_address: u32,
}
impl<A: Addr + Default> XySetupBlt<A> {
pub const DWORD_LENGTH: u32 = 8;
pub const _1555: u32 = 2;
pub const _32_BIT: u32 = 3;
pub const _565: u32 = 1;
pub const _8_BIT: u32 = 0;
}
impl<A: Addr + Default> Default for XySetupBlt<A> {
fn default() -> Self {
XySetupBlt {
dword_length: 6,
tiling_enable: Default::default(),
_32bpp_byte_mask: Default::default(),
_2d_command_opcode: 1,
command_type: 2,
destination_pitch: Default::default(),
raster_operation: Default::default(),
color_depth: Default::default(),
mono_source_transparency_mode: Default::default(),
clipping_enabled: Default::default(),
cliprect_x1_coordinate: Default::default(),
cliprect_y1_coordinate: Default::default(),
cliprect_x2_coordinate: Default::default(),
cliprect_y2_coordinate: Default::default(),
destination_base_address: Default::default(),
background_color: Default::default(),
foreground_color: Default::default(),
pattern_base_address: Default::default(),
}
}
}
impl<A: Addr + Default> Serialize for XySetupBlt<A> {
type Out = [u32; 8];
fn pack_into(&self, out: &mut [u32; 8]) {
out[0] = __gen_uint(self.dword_length, 0, 7) |
__gen_uint(self.tiling_enable.into(), 11, 11) |
__gen_uint(self._32bpp_byte_mask, 20, 21) |
__gen_uint(self._2d_command_opcode, 22, 28) |
__gen_uint(self.command_type, 29, 31);
out[1] = __gen_uint(self.destination_pitch as u32, 0, 15) |
__gen_uint(self.raster_operation as u32, 16, 23) |
__gen_uint(self.color_depth, 24, 25) |
__gen_uint(self.mono_source_transparency_mode.into(), 29, 29) |
__gen_uint(self.clipping_enabled.into(), 30, 30);
out[2] = __gen_uint(self.cliprect_x1_coordinate as u32, 0, 15) |
__gen_uint(self.cliprect_y1_coordinate as u32, 16, 31);
out[3] = __gen_uint(self.cliprect_x2_coordinate as u32, 0, 15) |
__gen_uint(self.cliprect_y2_coordinate as u32, 16, 31);
let v4_address = self.destination_base_address.combine(0);
out[4] = v4_address as u32;
out[5] = (v4_address >> 32) as u32;
out[5] = __gen_uint(self.background_color, 0, 31);
out[6] = __gen_uint(self.foreground_color, 0, 31);
out[7] = __gen_uint(self.pattern_base_address, 0, 31);
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 8];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 8] as *const [u8; 32]) })
}
}
impl From<&[u32; 8]> for XySetupBlt<u64> {
fn from(input: &[u32; 8]) -> Self {
XySetupBlt {
dword_length: __gen_unuint(input[0], 0, 7),
tiling_enable: __gen_unuint(input[0], 11, 11) != 0,
_32bpp_byte_mask: __gen_unuint(input[0], 20, 21),
_2d_command_opcode: __gen_unuint(input[0], 22, 28),
command_type: __gen_unuint(input[0], 29, 31),
destination_pitch: (__gen_unuint(input[1], 0, 15)) as i32,
raster_operation: (__gen_unuint(input[1], 16, 23)) as i32,
color_depth: __gen_unuint(input[1], 24, 25),
mono_source_transparency_mode: __gen_unuint(input[1], 29, 29) != 0,
clipping_enabled: __gen_unuint(input[1], 30, 30) != 0,
cliprect_x1_coordinate: (__gen_unuint(input[2], 0, 15)) as i32,
cliprect_y1_coordinate: (__gen_unuint(input[2], 16, 31)) as i32,
cliprect_x2_coordinate: (__gen_unuint(input[3], 0, 15)) as i32,
cliprect_y2_coordinate: (__gen_unuint(input[3], 16, 31)) as i32,
destination_base_address: (__gen_unuint(input[4], 0, 31) as u64),
background_color: __gen_unuint(input[5], 0, 31),
foreground_color: __gen_unuint(input[6], 0, 31),
pattern_base_address: __gen_unuint(input[7], 0, 31),
}
}
}
impl Deserialize for XySetupBlt<u64> {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 8];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 8] as *mut [u8; 32]) })?;
Ok((&input).into())
}
}
pub struct XySrcCopyBlt<A: Addr + Default> {
pub dword_length: u32,
pub destination_tiling_enable: bool,
pub source_tiling_enable: bool,
pub _32bpp_byte_mask: u32,
pub _2d_command_opcode: u32,
pub command_type: u32,
pub destination_pitch: i32,
pub raster_operation: i32,
pub color_depth: u32,
pub clipping_enabled: bool,
pub destination_x1_coordinate: i32,
pub destination_y1_coordinate: i32,
pub destination_x2_coordinate: i32,
pub destination_y2_coordinate: i32,
pub destination_base_address: A,
pub source_x1_coordinate: i32,
pub source_y1_coordinate: i32,
pub source_pitch: i32,
pub source_base_address: A,
}
impl<A: Addr + Default> XySrcCopyBlt<A> {
pub const DWORD_LENGTH: u32 = 8;
pub const _1555: u32 = 2;
pub const _32_BIT: u32 = 3;
pub const _565: u32 = 1;
pub const _8_BIT: u32 = 0;
}
impl<A: Addr + Default> Default for XySrcCopyBlt<A> {
fn default() -> Self {
XySrcCopyBlt {
dword_length: 6,
destination_tiling_enable: Default::default(),
source_tiling_enable: Default::default(),
_32bpp_byte_mask: Default::default(),
_2d_command_opcode: 83,
command_type: 2,
destination_pitch: Default::default(),
raster_operation: Default::default(),
color_depth: Default::default(),
clipping_enabled: Default::default(),
destination_x1_coordinate: Default::default(),
destination_y1_coordinate: Default::default(),
destination_x2_coordinate: Default::default(),
destination_y2_coordinate: Default::default(),
destination_base_address: Default::default(),
source_x1_coordinate: Default::default(),
source_y1_coordinate: Default::default(),
source_pitch: Default::default(),
source_base_address: Default::default(),
}
}
}
impl<A: Addr + Default> Serialize for XySrcCopyBlt<A> {
type Out = [u32; 8];
fn pack_into(&self, out: &mut [u32; 8]) {
out[0] = __gen_uint(self.dword_length, 0, 7) |
__gen_uint(self.destination_tiling_enable.into(), 11, 11) |
__gen_uint(self.source_tiling_enable.into(), 15, 15) |
__gen_uint(self._32bpp_byte_mask, 20, 21) |
__gen_uint(self._2d_command_opcode, 22, 28) |
__gen_uint(self.command_type, 29, 31);
out[1] = __gen_uint(self.destination_pitch as u32, 0, 15) |
__gen_uint(self.raster_operation as u32, 16, 23) |
__gen_uint(self.color_depth, 24, 25) |
__gen_uint(self.clipping_enabled.into(), 30, 30);
out[2] = __gen_uint(self.destination_x1_coordinate as u32, 0, 15) |
__gen_uint(self.destination_y1_coordinate as u32, 16, 31);
out[3] = __gen_uint(self.destination_x2_coordinate as u32, 0, 15) |
__gen_uint(self.destination_y2_coordinate as u32, 16, 31);
let v4_address = self.destination_base_address.combine(0);
out[4] = v4_address as u32;
out[5] = (v4_address >> 32) as u32;
out[5] = __gen_uint(self.source_x1_coordinate as u32, 0, 15) |
__gen_uint(self.source_y1_coordinate as u32, 16, 31);
out[6] = __gen_uint(self.source_pitch as u32, 0, 15);
let v7_address = self.source_base_address.combine(0);
out[7] = v7_address as u32;
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 8];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 8] as *const [u8; 32]) })
}
}
impl From<&[u32; 8]> for XySrcCopyBlt<u64> {
fn from(input: &[u32; 8]) -> Self {
XySrcCopyBlt {
dword_length: __gen_unuint(input[0], 0, 7),
destination_tiling_enable: __gen_unuint(input[0], 11, 11) != 0,
source_tiling_enable: __gen_unuint(input[0], 15, 15) != 0,
_32bpp_byte_mask: __gen_unuint(input[0], 20, 21),
_2d_command_opcode: __gen_unuint(input[0], 22, 28),
command_type: __gen_unuint(input[0], 29, 31),
destination_pitch: (__gen_unuint(input[1], 0, 15)) as i32,
raster_operation: (__gen_unuint(input[1], 16, 23)) as i32,
color_depth: __gen_unuint(input[1], 24, 25),
clipping_enabled: __gen_unuint(input[1], 30, 30) != 0,
destination_x1_coordinate: (__gen_unuint(input[2], 0, 15)) as i32,
destination_y1_coordinate: (__gen_unuint(input[2], 16, 31)) as i32,
destination_x2_coordinate: (__gen_unuint(input[3], 0, 15)) as i32,
destination_y2_coordinate: (__gen_unuint(input[3], 16, 31)) as i32,
destination_base_address: (__gen_unuint(input[4], 0, 31) as u64),
source_x1_coordinate: (__gen_unuint(input[5], 0, 15)) as i32,
source_y1_coordinate: (__gen_unuint(input[5], 16, 31)) as i32,
source_pitch: (__gen_unuint(input[6], 0, 15)) as i32,
source_base_address: (__gen_unuint(input[7], 0, 31) as u64),
}
}
}
impl Deserialize for XySrcCopyBlt<u64> {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 8];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 8] as *mut [u8; 32]) })?;
Ok((&input).into())
}
}
pub struct XyTextImmediateBlt {
pub dword_length: u32,
pub tiling_enable: bool,
pub packing: u32,
pub _32bpp_byte_mask: u32,
pub _2d_command_opcode: u32,
pub command_type: u32,
pub destination_pitch: i32,
pub destination_x1_coordinate: i32,
pub destination_y1_coordinate: i32,
pub destination_x2_coordinate: i32,
pub destination_y2_coordinate: i32,
}
impl XyTextImmediateBlt {
pub const DWORD_LENGTH: u32 = 3;
pub const BIT_PACKED: u32 = 0;
pub const BYTE_PACKED: u32 = 1;
}
impl Default for XyTextImmediateBlt {
fn default() -> Self {
XyTextImmediateBlt {
dword_length: 1,
tiling_enable: Default::default(),
packing: Default::default(),
_32bpp_byte_mask: Default::default(),
_2d_command_opcode: 49,
command_type: 2,
destination_pitch: Default::default(),
destination_x1_coordinate: Default::default(),
destination_y1_coordinate: Default::default(),
destination_x2_coordinate: Default::default(),
destination_y2_coordinate: Default::default(),
}
}
}
impl Serialize for XyTextImmediateBlt {
type Out = [u32; 3];
fn pack_into(&self, out: &mut [u32; 3]) {
out[0] = __gen_uint(self.dword_length, 0, 7) |
__gen_uint(self.tiling_enable.into(), 11, 11) |
__gen_uint(self.packing, 16, 16) |
__gen_uint(self._32bpp_byte_mask, 20, 21) |
__gen_uint(self._2d_command_opcode, 22, 28) |
__gen_uint(self.command_type, 29, 31);
out[1] = __gen_uint(self.destination_x1_coordinate as u32, 0, 15) |
__gen_uint(self.destination_y1_coordinate as u32, 16, 31);
out[2] = __gen_uint(self.destination_x2_coordinate as u32, 0, 15) |
__gen_uint(self.destination_y2_coordinate as u32, 16, 31);
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 3];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 3] as *const [u8; 12]) })
}
}
impl From<&[u32; 3]> for XyTextImmediateBlt {
fn from(input: &[u32; 3]) -> Self {
XyTextImmediateBlt {
dword_length: __gen_unuint(input[0], 0, 7),
tiling_enable: __gen_unuint(input[0], 11, 11) != 0,
packing: __gen_unuint(input[0], 16, 16),
_32bpp_byte_mask: __gen_unuint(input[0], 20, 21),
_2d_command_opcode: __gen_unuint(input[0], 22, 28),
command_type: __gen_unuint(input[0], 29, 31),
destination_pitch: (__gen_unuint(input[1], 0, 15)) as i32,
destination_x1_coordinate: (__gen_unuint(input[1], 0, 15)) as i32,
destination_y1_coordinate: (__gen_unuint(input[1], 16, 31)) as i32,
destination_x2_coordinate: (__gen_unuint(input[2], 0, 15)) as i32,
destination_y2_coordinate: (__gen_unuint(input[2], 16, 31)) as i32,
}
}
}
impl Deserialize for XyTextImmediateBlt {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 3];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 3] as *mut [u8; 12]) })?;
Ok((&input).into())
}
}
pub struct _3dPrimitive {
pub dword_length: u32,
pub indirect_vertex_count: u32,
pub primitive_topology_type: _3dPrimTopoType,
pub vertex_access_type: u32,
pub _3d_command_sub_opcode: u32,
pub _3d_command_opcode: u32,
pub command_subtype: u32,
pub command_type: u32,
pub vertex_count_per_instance: u32,
pub start_vertex_location: u32,
pub instance_count: u32,
pub start_instance_location: u32,
pub base_vertex_location: i32,
}
impl _3dPrimitive {
pub const DWORD_LENGTH: u32 = 6;
pub const RANDOM: u32 = 1;
pub const SEQUENTIAL: u32 = 0;
}
impl Default for _3dPrimitive {
fn default() -> Self {
_3dPrimitive {
dword_length: 4,
indirect_vertex_count: Default::default(),
primitive_topology_type: Default::default(),
vertex_access_type: Default::default(),
_3d_command_sub_opcode: 0,
_3d_command_opcode: 3,
command_subtype: 3,
command_type: 3,
vertex_count_per_instance: Default::default(),
start_vertex_location: Default::default(),
instance_count: Default::default(),
start_instance_location: Default::default(),
base_vertex_location: Default::default(),
}
}
}
impl Serialize for _3dPrimitive {
type Out = [u32; 6];
fn pack_into(&self, out: &mut [u32; 6]) {
out[0] = __gen_uint(self.dword_length, 0, 7) |
__gen_uint(self.indirect_vertex_count, 9, 9) |
__gen_uint(self.primitive_topology_type.into(), 10, 14) |
__gen_uint(self.vertex_access_type, 15, 15) |
__gen_uint(self._3d_command_sub_opcode, 16, 23) |
__gen_uint(self._3d_command_opcode, 24, 26) |
__gen_uint(self.command_subtype, 27, 28) |
__gen_uint(self.command_type, 29, 31);
out[1] = __gen_uint(self.vertex_count_per_instance, 0, 31);
out[2] = __gen_uint(self.start_vertex_location, 0, 31);
out[3] = __gen_uint(self.instance_count, 0, 31);
out[4] = __gen_uint(self.start_instance_location, 0, 31);
out[5] = __gen_uint(self.base_vertex_location as u32, 0, 31);
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 6];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 6] as *const [u8; 24]) })
}
}
impl From<&[u32; 6]> for _3dPrimitive {
fn from(input: &[u32; 6]) -> Self {
_3dPrimitive {
dword_length: __gen_unuint(input[0], 0, 7),
indirect_vertex_count: __gen_unuint(input[0], 9, 9),
primitive_topology_type: (__gen_unuint(input[0], 10, 14)).into(),
vertex_access_type: __gen_unuint(input[0], 15, 15),
_3d_command_sub_opcode: __gen_unuint(input[0], 16, 23),
_3d_command_opcode: __gen_unuint(input[0], 24, 26),
command_subtype: __gen_unuint(input[0], 27, 28),
command_type: __gen_unuint(input[0], 29, 31),
vertex_count_per_instance: __gen_unuint(input[1], 0, 31),
start_vertex_location: __gen_unuint(input[2], 0, 31),
instance_count: __gen_unuint(input[3], 0, 31),
start_instance_location: __gen_unuint(input[4], 0, 31),
base_vertex_location: (__gen_unuint(input[5], 0, 31)) as i32,
}
}
}
impl Deserialize for _3dPrimitive {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 6];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 6] as *mut [u8; 24]) })?;
Ok((&input).into())
}
}
pub struct _3dStateAaLineParameters {
pub dword_length: u32,
pub _3d_command_sub_opcode: u32,
pub _3d_command_opcode: u32,
pub command_subtype: u32,
pub command_type: u32,
pub aa_coverage_slope: f32,
pub aa_coverage_bias: f32,
pub aa_coverage_endcap_slope: f32,
pub aa_coverage_endcap_bias: f32,
}
impl _3dStateAaLineParameters {
pub const DWORD_LENGTH: u32 = 3;
}
impl Default for _3dStateAaLineParameters {
fn default() -> Self {
_3dStateAaLineParameters {
dword_length: 1,
_3d_command_sub_opcode: 10,
_3d_command_opcode: 1,
command_subtype: 3,
command_type: 3,
aa_coverage_slope: Default::default(),
aa_coverage_bias: Default::default(),
aa_coverage_endcap_slope: Default::default(),
aa_coverage_endcap_bias: Default::default(),
}
}
}
impl Serialize for _3dStateAaLineParameters {
type Out = [u32; 3];
fn pack_into(&self, out: &mut [u32; 3]) {
out[0] = __gen_uint(self.dword_length, 0, 7) |
__gen_uint(self._3d_command_sub_opcode, 16, 23) |
__gen_uint(self._3d_command_opcode, 24, 26) |
__gen_uint(self.command_subtype, 27, 28) |
__gen_uint(self.command_type, 29, 31);
out[1] = __gen_ufixed(self.aa_coverage_slope, 0, 7, 8) |
__gen_ufixed(self.aa_coverage_bias, 16, 23, 8);
out[2] = __gen_ufixed(self.aa_coverage_endcap_slope, 0, 7, 8) |
__gen_ufixed(self.aa_coverage_endcap_bias, 16, 23, 8);
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 3];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 3] as *const [u8; 12]) })
}
}
impl From<&[u32; 3]> for _3dStateAaLineParameters {
fn from(input: &[u32; 3]) -> Self {
_3dStateAaLineParameters {
dword_length: __gen_unuint(input[0], 0, 7),
_3d_command_sub_opcode: __gen_unuint(input[0], 16, 23),
_3d_command_opcode: __gen_unuint(input[0], 24, 26),
command_subtype: __gen_unuint(input[0], 27, 28),
command_type: __gen_unuint(input[0], 29, 31),
aa_coverage_slope: __gen_unufixed(input[1], 0, 7, 8),
aa_coverage_bias: __gen_unufixed(input[1], 16, 23, 8),
aa_coverage_endcap_slope: __gen_unufixed(input[2], 0, 7, 8),
aa_coverage_endcap_bias: __gen_unufixed(input[2], 16, 23, 8),
}
}
}
impl Deserialize for _3dStateAaLineParameters {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 3];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 3] as *mut [u8; 12]) })?;
Ok((&input).into())
}
}
pub struct _3dStateBindingTablePointers {
pub dword_length: u32,
pub _3d_command_sub_opcode: u32,
pub _3d_command_opcode: u32,
pub command_subtype: u32,
pub command_type: u32,
pub pointer_to_vs_binding_table: u64,
pub pointer_to_gs_binding_table: u64,
pub pointer_to_clip_binding_table: u64,
pub pointer_to_sf_binding_table: u64,
pub pointer_to_ps_binding_table: u64,
}
impl _3dStateBindingTablePointers {
pub const DWORD_LENGTH: u32 = 6;
}
impl Default for _3dStateBindingTablePointers {
fn default() -> Self {
_3dStateBindingTablePointers {
dword_length: 4,
_3d_command_sub_opcode: 1,
_3d_command_opcode: 0,
command_subtype: 3,
command_type: 3,
pointer_to_vs_binding_table: Default::default(),
pointer_to_gs_binding_table: Default::default(),
pointer_to_clip_binding_table: Default::default(),
pointer_to_sf_binding_table: Default::default(),
pointer_to_ps_binding_table: Default::default(),
}
}
}
impl Serialize for _3dStateBindingTablePointers {
type Out = [u32; 6];
fn pack_into(&self, out: &mut [u32; 6]) {
out[0] = __gen_uint(self.dword_length, 0, 7) |
__gen_uint(self._3d_command_sub_opcode, 16, 23) |
__gen_uint(self._3d_command_opcode, 24, 26) |
__gen_uint(self.command_subtype, 27, 28) |
__gen_uint(self.command_type, 29, 31);
out[1] = __gen_offset(self.pointer_to_vs_binding_table as u32, 5, 31);
out[2] = __gen_offset(self.pointer_to_gs_binding_table as u32, 5, 31);
out[3] = __gen_offset(self.pointer_to_clip_binding_table as u32, 5, 31);
out[4] = __gen_offset(self.pointer_to_sf_binding_table as u32, 5, 31);
out[5] = __gen_offset(self.pointer_to_ps_binding_table as u32, 5, 31);
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 6];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 6] as *const [u8; 24]) })
}
}
impl From<&[u32; 6]> for _3dStateBindingTablePointers {
fn from(input: &[u32; 6]) -> Self {
_3dStateBindingTablePointers {
dword_length: __gen_unuint(input[0], 0, 7),
_3d_command_sub_opcode: __gen_unuint(input[0], 16, 23),
_3d_command_opcode: __gen_unuint(input[0], 24, 26),
command_subtype: __gen_unuint(input[0], 27, 28),
command_type: __gen_unuint(input[0], 29, 31),
pointer_to_vs_binding_table: (__gen_unuint(input[1], 5, 31) as u64) << 5,
pointer_to_gs_binding_table: (__gen_unuint(input[2], 5, 31) as u64) << 5,
pointer_to_clip_binding_table: (__gen_unuint(input[3], 5, 31) as u64) << 5,
pointer_to_sf_binding_table: (__gen_unuint(input[4], 5, 31) as u64) << 5,
pointer_to_ps_binding_table: (__gen_unuint(input[5], 5, 31) as u64) << 5,
}
}
}
impl Deserialize for _3dStateBindingTablePointers {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 6];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 6] as *mut [u8; 24]) })?;
Ok((&input).into())
}
}
pub struct _3dStateConstantColor {
pub dword_length: u32,
pub _3d_command_sub_opcode: u32,
pub _3d_command_opcode: u32,
pub command_subtype: u32,
pub command_type: u32,
pub blend_constant_color_red: f32,
pub blend_constant_color_green: f32,
pub blend_constant_color_blue: f32,
pub blend_constant_color_alpha: f32,
}
impl _3dStateConstantColor {
pub const DWORD_LENGTH: u32 = 5;
}
impl Default for _3dStateConstantColor {
fn default() -> Self {
_3dStateConstantColor {
dword_length: 3,
_3d_command_sub_opcode: 1,
_3d_command_opcode: 1,
command_subtype: 3,
command_type: 3,
blend_constant_color_red: Default::default(),
blend_constant_color_green: Default::default(),
blend_constant_color_blue: Default::default(),
blend_constant_color_alpha: Default::default(),
}
}
}
impl Serialize for _3dStateConstantColor {
type Out = [u32; 5];
fn pack_into(&self, out: &mut [u32; 5]) {
out[0] = __gen_uint(self.dword_length, 0, 7) |
__gen_uint(self._3d_command_sub_opcode, 16, 23) |
__gen_uint(self._3d_command_opcode, 24, 26) |
__gen_uint(self.command_subtype, 27, 28) |
__gen_uint(self.command_type, 29, 31);
out[1] = self.blend_constant_color_red.to_bits();
out[2] = self.blend_constant_color_green.to_bits();
out[3] = self.blend_constant_color_blue.to_bits();
out[4] = self.blend_constant_color_alpha.to_bits();
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 5];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 5] as *const [u8; 20]) })
}
}
impl From<&[u32; 5]> for _3dStateConstantColor {
fn from(input: &[u32; 5]) -> Self {
_3dStateConstantColor {
dword_length: __gen_unuint(input[0], 0, 7),
_3d_command_sub_opcode: __gen_unuint(input[0], 16, 23),
_3d_command_opcode: __gen_unuint(input[0], 24, 26),
command_subtype: __gen_unuint(input[0], 27, 28),
command_type: __gen_unuint(input[0], 29, 31),
blend_constant_color_red: f32::from_bits(input[1]),
blend_constant_color_green: f32::from_bits(input[2]),
blend_constant_color_blue: f32::from_bits(input[3]),
blend_constant_color_alpha: f32::from_bits(input[4]),
}
}
}
impl Deserialize for _3dStateConstantColor {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 5];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 5] as *mut [u8; 20]) })?;
Ok((&input).into())
}
}
pub struct _3dStateDepthBuffer<A: Addr + Default> {
pub dword_length: u32,
pub _3d_command_sub_opcode: u32,
pub _3d_command_opcode: u32,
pub command_subtype: u32,
pub command_type: u32,
pub surface_pitch: u32,
pub surface_format: u32,
pub software_tiled_rendering_mode: u32,
pub depth_buffer_coordinate_offset_disable: bool,
pub tile_walk: u32,
pub tiled_surface: bool,
pub surface_type: u32,
pub surface_base_address: A,
pub mip_map_layout_mode: u32,
pub lod: u32,
pub width: u32,
pub height: u32,
pub render_target_view_extent: u32,
pub minimum_array_element: u32,
pub depth: u32,
pub depth_coordinate_offset_x: i32,
pub depth_coordinate_offset_y: i32,
}
impl<A: Addr + Default> _3dStateDepthBuffer<A> {
pub const DWORD_LENGTH: u32 = 6;
pub const D16_UNORM: u32 = 5;
pub const D24_UNORM_S8_UINT: u32 = 2;
pub const D24_UNORM_X8_UINT: u32 = 3;
pub const D32_FLOAT: u32 = 1;
pub const D32_FLOAT_S8X24_UINT: u32 = 0;
pub const MIPLAYOUT_BELOW: u32 = 0;
pub const MIPLAYOUT_RIGHT: u32 = 1;
pub const NORMAL: u32 = 0;
pub const STR1: u32 = 1;
pub const STR2: u32 = 3;
pub const SURFTYPE_1D: u32 = 0;
pub const SURFTYPE_1D_MUST_BE_ZERO: u32 = 0;
pub const SURFTYPE_2D: u32 = 1;
pub const SURFTYPE_3D: u32 = 2;
pub const SURFTYPE_CUBE: u32 = 3;
pub const SURFTYPE_CUBE_MUST_BE_ZERO: u32 = 0;
pub const SURFTYPE_NULL: u32 = 7;
pub const TILEWALK_YMAJOR: u32 = 1;
}
impl<A: Addr + Default> Default for _3dStateDepthBuffer<A> {
fn default() -> Self {
_3dStateDepthBuffer {
dword_length: 4,
_3d_command_sub_opcode: 5,
_3d_command_opcode: 1,
command_subtype: 3,
command_type: 3,
surface_pitch: Default::default(),
surface_format: Default::default(),
software_tiled_rendering_mode: Default::default(),
depth_buffer_coordinate_offset_disable: Default::default(),
tile_walk: Default::default(),
tiled_surface: Default::default(),
surface_type: Default::default(),
surface_base_address: Default::default(),
mip_map_layout_mode: Default::default(),
lod: Default::default(),
width: Default::default(),
height: Default::default(),
render_target_view_extent: Default::default(),
minimum_array_element: Default::default(),
depth: Default::default(),
depth_coordinate_offset_x: Default::default(),
depth_coordinate_offset_y: Default::default(),
}
}
}
impl<A: Addr + Default> Serialize for _3dStateDepthBuffer<A> {
type Out = [u32; 6];
fn pack_into(&self, out: &mut [u32; 6]) {
out[0] = __gen_uint(self.dword_length, 0, 7) |
__gen_uint(self._3d_command_sub_opcode, 16, 23) |
__gen_uint(self._3d_command_opcode, 24, 26) |
__gen_uint(self.command_subtype, 27, 28) |
__gen_uint(self.command_type, 29, 31);
out[1] = __gen_uint(self.surface_pitch, 0, 16) |
__gen_uint(self.surface_format, 18, 20) |
__gen_uint(self.software_tiled_rendering_mode, 23, 24) |
__gen_uint(self.depth_buffer_coordinate_offset_disable.into(), 25, 25) |
__gen_uint(self.tile_walk, 26, 26) |
__gen_uint(self.tiled_surface.into(), 27, 27) |
__gen_uint(self.surface_type, 29, 31);
let v2_address = self.surface_base_address.combine(0);
out[2] = v2_address as u32;
out[3] = (v2_address >> 32) as u32;
out[3] = __gen_uint(self.mip_map_layout_mode, 1, 1) |
__gen_uint(self.lod, 2, 5) |
__gen_uint(self.width, 6, 18) |
__gen_uint(self.height, 19, 31);
out[4] = __gen_uint(self.render_target_view_extent, 1, 9) |
__gen_uint(self.minimum_array_element, 10, 20) |
__gen_uint(self.depth, 21, 31);
out[5] = __gen_uint(self.depth_coordinate_offset_x as u32, 0, 15) |
__gen_uint(self.depth_coordinate_offset_y as u32, 16, 31);
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 6];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 6] as *const [u8; 24]) })
}
}
impl From<&[u32; 6]> for _3dStateDepthBuffer<u64> {
fn from(input: &[u32; 6]) -> Self {
_3dStateDepthBuffer {
dword_length: __gen_unuint(input[0], 0, 7),
_3d_command_sub_opcode: __gen_unuint(input[0], 16, 23),
_3d_command_opcode: __gen_unuint(input[0], 24, 26),
command_subtype: __gen_unuint(input[0], 27, 28),
command_type: __gen_unuint(input[0], 29, 31),
surface_pitch: __gen_unuint(input[1], 0, 16),
surface_format: __gen_unuint(input[1], 18, 20),
software_tiled_rendering_mode: __gen_unuint(input[1], 23, 24),
depth_buffer_coordinate_offset_disable: __gen_unuint(input[1], 25, 25) != 0,
tile_walk: __gen_unuint(input[1], 26, 26),
tiled_surface: __gen_unuint(input[1], 27, 27) != 0,
surface_type: __gen_unuint(input[1], 29, 31),
surface_base_address: (__gen_unuint(input[2], 0, 31) as u64),
mip_map_layout_mode: __gen_unuint(input[3], 1, 1),
lod: __gen_unuint(input[3], 2, 5),
width: __gen_unuint(input[3], 6, 18),
height: __gen_unuint(input[3], 19, 31),
render_target_view_extent: __gen_unuint(input[4], 1, 9),
minimum_array_element: __gen_unuint(input[4], 10, 20),
depth: __gen_unuint(input[4], 21, 31),
depth_coordinate_offset_x: (__gen_unuint(input[5], 0, 15)) as i32,
depth_coordinate_offset_y: (__gen_unuint(input[5], 16, 31)) as i32,
}
}
}
impl Deserialize for _3dStateDepthBuffer<u64> {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 6];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 6] as *mut [u8; 24]) })?;
Ok((&input).into())
}
}
pub struct _3dStateDrawingRectangle {
pub dword_length: u32,
pub _3d_command_sub_opcode: u32,
pub _3d_command_opcode: u32,
pub command_subtype: u32,
pub command_type: u32,
pub clipped_drawing_rectangle_x_min: u32,
pub clipped_drawing_rectangle_y_min: u32,
pub clipped_drawing_rectangle_x_max: u32,
pub clipped_drawing_rectangle_y_max: u32,
pub drawing_rectangle_origin_x: i32,
pub drawing_rectangle_origin_y: i32,
}
impl _3dStateDrawingRectangle {
pub const DWORD_LENGTH: u32 = 4;
}
impl Default for _3dStateDrawingRectangle {
fn default() -> Self {
_3dStateDrawingRectangle {
dword_length: 2,
_3d_command_sub_opcode: 0,
_3d_command_opcode: 1,
command_subtype: 3,
command_type: 3,
clipped_drawing_rectangle_x_min: Default::default(),
clipped_drawing_rectangle_y_min: Default::default(),
clipped_drawing_rectangle_x_max: Default::default(),
clipped_drawing_rectangle_y_max: Default::default(),
drawing_rectangle_origin_x: Default::default(),
drawing_rectangle_origin_y: Default::default(),
}
}
}
impl Serialize for _3dStateDrawingRectangle {
type Out = [u32; 4];
fn pack_into(&self, out: &mut [u32; 4]) {
out[0] = __gen_uint(self.dword_length, 0, 7) |
__gen_uint(self._3d_command_sub_opcode, 16, 23) |
__gen_uint(self._3d_command_opcode, 24, 26) |
__gen_uint(self.command_subtype, 27, 28) |
__gen_uint(self.command_type, 29, 31);
out[1] = __gen_uint(self.clipped_drawing_rectangle_x_min, 0, 15) |
__gen_uint(self.clipped_drawing_rectangle_y_min, 16, 31);
out[2] = __gen_uint(self.clipped_drawing_rectangle_x_max, 0, 15) |
__gen_uint(self.clipped_drawing_rectangle_y_max, 16, 31);
out[3] = __gen_uint(self.drawing_rectangle_origin_x as u32, 0, 15) |
__gen_uint(self.drawing_rectangle_origin_y as u32, 16, 31);
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 4];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 4] as *const [u8; 16]) })
}
}
impl From<&[u32; 4]> for _3dStateDrawingRectangle {
fn from(input: &[u32; 4]) -> Self {
_3dStateDrawingRectangle {
dword_length: __gen_unuint(input[0], 0, 7),
_3d_command_sub_opcode: __gen_unuint(input[0], 16, 23),
_3d_command_opcode: __gen_unuint(input[0], 24, 26),
command_subtype: __gen_unuint(input[0], 27, 28),
command_type: __gen_unuint(input[0], 29, 31),
clipped_drawing_rectangle_x_min: __gen_unuint(input[1], 0, 15),
clipped_drawing_rectangle_y_min: __gen_unuint(input[1], 16, 31),
clipped_drawing_rectangle_x_max: __gen_unuint(input[2], 0, 15),
clipped_drawing_rectangle_y_max: __gen_unuint(input[2], 16, 31),
drawing_rectangle_origin_x: (__gen_unuint(input[3], 0, 15)) as i32,
drawing_rectangle_origin_y: (__gen_unuint(input[3], 16, 31)) as i32,
}
}
}
impl Deserialize for _3dStateDrawingRectangle {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 4];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 4] as *mut [u8; 16]) })?;
Ok((&input).into())
}
}
pub struct _3dStateGlobalDepthOffsetClamp {
pub dword_length: u32,
pub _3d_command_sub_opcode: u32,
pub _3d_command_opcode: u32,
pub command_subtype: u32,
pub command_type: u32,
pub global_depth_offset_clamp: f32,
}
impl _3dStateGlobalDepthOffsetClamp {
pub const DWORD_LENGTH: u32 = 2;
}
impl Default for _3dStateGlobalDepthOffsetClamp {
fn default() -> Self {
_3dStateGlobalDepthOffsetClamp {
dword_length: 0,
_3d_command_sub_opcode: 9,
_3d_command_opcode: 1,
command_subtype: 3,
command_type: 3,
global_depth_offset_clamp: Default::default(),
}
}
}
impl Serialize for _3dStateGlobalDepthOffsetClamp {
type Out = [u32; 2];
fn pack_into(&self, out: &mut [u32; 2]) {
out[0] = __gen_uint(self.dword_length, 0, 7) |
__gen_uint(self._3d_command_sub_opcode, 16, 23) |
__gen_uint(self._3d_command_opcode, 24, 26) |
__gen_uint(self.command_subtype, 27, 28) |
__gen_uint(self.command_type, 29, 31);
out[1] = self.global_depth_offset_clamp.to_bits();
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 2];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 2] as *const [u8; 8]) })
}
}
impl From<&[u32; 2]> for _3dStateGlobalDepthOffsetClamp {
fn from(input: &[u32; 2]) -> Self {
_3dStateGlobalDepthOffsetClamp {
dword_length: __gen_unuint(input[0], 0, 7),
_3d_command_sub_opcode: __gen_unuint(input[0], 16, 23),
_3d_command_opcode: __gen_unuint(input[0], 24, 26),
command_subtype: __gen_unuint(input[0], 27, 28),
command_type: __gen_unuint(input[0], 29, 31),
global_depth_offset_clamp: f32::from_bits(input[1]),
}
}
}
impl Deserialize for _3dStateGlobalDepthOffsetClamp {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 2];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 2] as *mut [u8; 8]) })?;
Ok((&input).into())
}
}
pub struct _3dStateIndexBuffer<A: Addr + Default> {
pub dword_length: u32,
pub index_format: u32,
pub cut_index_enable: bool,
pub _3d_command_sub_opcode: u32,
pub _3d_command_opcode: u32,
pub command_subtype: u32,
pub command_type: u32,
pub buffer_starting_address: A,
pub buffer_ending_address: A,
}
impl<A: Addr + Default> _3dStateIndexBuffer<A> {
pub const DWORD_LENGTH: u32 = 3;
pub const BYTE: u32 = 0;
pub const DWORD: u32 = 2;
pub const WORD: u32 = 1;
}
impl<A: Addr + Default> Default for _3dStateIndexBuffer<A> {
fn default() -> Self {
_3dStateIndexBuffer {
dword_length: 1,
index_format: Default::default(),
cut_index_enable: Default::default(),
_3d_command_sub_opcode: 10,
_3d_command_opcode: 0,
command_subtype: 3,
command_type: 3,
buffer_starting_address: Default::default(),
buffer_ending_address: Default::default(),
}
}
}
impl<A: Addr + Default> Serialize for _3dStateIndexBuffer<A> {
type Out = [u32; 3];
fn pack_into(&self, out: &mut [u32; 3]) {
out[0] = __gen_uint(self.dword_length, 0, 7) |
__gen_uint(self.index_format, 8, 9) |
__gen_uint(self.cut_index_enable.into(), 10, 10) |
__gen_uint(self._3d_command_sub_opcode, 16, 23) |
__gen_uint(self._3d_command_opcode, 24, 26) |
__gen_uint(self.command_subtype, 27, 28) |
__gen_uint(self.command_type, 29, 31);
let v1_address = self.buffer_starting_address.combine(0);
out[1] = v1_address as u32;
out[2] = (v1_address >> 32) as u32;
let v2_address = self.buffer_ending_address.combine(0);
out[2] = v2_address as u32;
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 3];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 3] as *const [u8; 12]) })
}
}
impl From<&[u32; 3]> for _3dStateIndexBuffer<u64> {
fn from(input: &[u32; 3]) -> Self {
_3dStateIndexBuffer {
dword_length: __gen_unuint(input[0], 0, 7),
index_format: __gen_unuint(input[0], 8, 9),
cut_index_enable: __gen_unuint(input[0], 10, 10) != 0,
_3d_command_sub_opcode: __gen_unuint(input[0], 16, 23),
_3d_command_opcode: __gen_unuint(input[0], 24, 26),
command_subtype: __gen_unuint(input[0], 27, 28),
command_type: __gen_unuint(input[0], 29, 31),
buffer_starting_address: (__gen_unuint(input[1], 0, 31) as u64),
buffer_ending_address: (__gen_unuint(input[2], 0, 31) as u64),
}
}
}
impl Deserialize for _3dStateIndexBuffer<u64> {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 3];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 3] as *mut [u8; 12]) })?;
Ok((&input).into())
}
}
pub struct _3dStateLineStipple {
pub dword_length: u32,
pub _3d_command_sub_opcode: u32,
pub _3d_command_opcode: u32,
pub command_subtype: u32,
pub command_type: u32,
pub line_stipple_pattern: u32,
pub current_stipple_index: u32,
pub current_repeat_counter: u32,
pub modify_enable_current_repeat_counter_current_stipple_index: bool,
pub line_stipple_repeat_count: u32,
pub line_stipple_inverse_repeat_count: f32,
}
impl _3dStateLineStipple {
pub const DWORD_LENGTH: u32 = 3;
}
impl Default for _3dStateLineStipple {
fn default() -> Self {
_3dStateLineStipple {
dword_length: 1,
_3d_command_sub_opcode: 8,
_3d_command_opcode: 1,
command_subtype: 3,
command_type: 3,
line_stipple_pattern: Default::default(),
current_stipple_index: Default::default(),
current_repeat_counter: Default::default(),
modify_enable_current_repeat_counter_current_stipple_index: Default::default(),
line_stipple_repeat_count: Default::default(),
line_stipple_inverse_repeat_count: Default::default(),
}
}
}
impl Serialize for _3dStateLineStipple {
type Out = [u32; 3];
fn pack_into(&self, out: &mut [u32; 3]) {
out[0] = __gen_uint(self.dword_length, 0, 7) |
__gen_uint(self._3d_command_sub_opcode, 16, 23) |
__gen_uint(self._3d_command_opcode, 24, 26) |
__gen_uint(self.command_subtype, 27, 28) |
__gen_uint(self.command_type, 29, 31);
out[1] = __gen_uint(self.line_stipple_pattern, 0, 15) |
__gen_uint(self.current_stipple_index, 16, 19) |
__gen_uint(self.current_repeat_counter, 21, 29) |
__gen_uint(self.modify_enable_current_repeat_counter_current_stipple_index.into(), 31, 31);
out[2] = __gen_uint(self.line_stipple_repeat_count, 0, 8) |
__gen_ufixed(self.line_stipple_inverse_repeat_count, 16, 31, 13);
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 3];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 3] as *const [u8; 12]) })
}
}
impl From<&[u32; 3]> for _3dStateLineStipple {
fn from(input: &[u32; 3]) -> Self {
_3dStateLineStipple {
dword_length: __gen_unuint(input[0], 0, 7),
_3d_command_sub_opcode: __gen_unuint(input[0], 16, 23),
_3d_command_opcode: __gen_unuint(input[0], 24, 26),
command_subtype: __gen_unuint(input[0], 27, 28),
command_type: __gen_unuint(input[0], 29, 31),
line_stipple_pattern: __gen_unuint(input[1], 0, 15),
current_stipple_index: __gen_unuint(input[1], 16, 19),
current_repeat_counter: __gen_unuint(input[1], 21, 29),
modify_enable_current_repeat_counter_current_stipple_index: __gen_unuint(input[1], 31, 31) != 0,
line_stipple_repeat_count: __gen_unuint(input[2], 0, 8),
line_stipple_inverse_repeat_count: __gen_unufixed(input[2], 16, 31, 13),
}
}
}
impl Deserialize for _3dStateLineStipple {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 3];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 3] as *mut [u8; 12]) })?;
Ok((&input).into())
}
}
pub struct _3dStatePipelinedPointers<A: Addr + Default> {
pub dword_length: u32,
pub _3d_command_sub_opcode: u32,
pub _3d_command_opcode: u32,
pub command_subtype: u32,
pub command_type: u32,
pub pointer_to_vs_state: A,
pub gs_enable: bool,
pub pointer_to_gs_state: A,
pub clip_enable: bool,
pub pointer_to_clip_state: A,
pub pointer_to_sf_state: A,
pub pointer_to_wm_state: A,
pub pointer_to_color_calc_state: A,
}
impl<A: Addr + Default> _3dStatePipelinedPointers<A> {
pub const DWORD_LENGTH: u32 = 7;
}
impl<A: Addr + Default> Default for _3dStatePipelinedPointers<A> {
fn default() -> Self {
_3dStatePipelinedPointers {
dword_length: 5,
_3d_command_sub_opcode: 0,
_3d_command_opcode: 0,
command_subtype: 3,
command_type: 3,
pointer_to_vs_state: Default::default(),
gs_enable: Default::default(),
pointer_to_gs_state: Default::default(),
clip_enable: Default::default(),
pointer_to_clip_state: Default::default(),
pointer_to_sf_state: Default::default(),
pointer_to_wm_state: Default::default(),
pointer_to_color_calc_state: Default::default(),
}
}
}
impl<A: Addr + Default> Serialize for _3dStatePipelinedPointers<A> {
type Out = [u32; 7];
fn pack_into(&self, out: &mut [u32; 7]) {
out[0] = __gen_uint(self.dword_length, 0, 7) |
__gen_uint(self._3d_command_sub_opcode, 16, 23) |
__gen_uint(self._3d_command_opcode, 24, 26) |
__gen_uint(self.command_subtype, 27, 28) |
__gen_uint(self.command_type, 29, 31);
let v1_address = self.pointer_to_vs_state.combine(0);
out[1] = v1_address as u32;
out[2] = (v1_address >> 32) as u32;
let v2 = __gen_uint(self.gs_enable.into(), 0, 0);
let v2_address = self.pointer_to_gs_state.combine(v2);
out[2] = v2_address as u32;
out[3] = (v2_address >> 32) as u32;
let v3 = __gen_uint(self.clip_enable.into(), 0, 0);
let v3_address = self.pointer_to_clip_state.combine(v3);
out[3] = v3_address as u32;
out[4] = (v3_address >> 32) as u32;
let v4_address = self.pointer_to_sf_state.combine(0);
out[4] = v4_address as u32;
out[5] = (v4_address >> 32) as u32;
let v5_address = self.pointer_to_wm_state.combine(0);
out[5] = v5_address as u32;
out[6] = (v5_address >> 32) as u32;
let v6_address = self.pointer_to_color_calc_state.combine(0);
out[6] = v6_address as u32;
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 7];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 7] as *const [u8; 28]) })
}
}
impl From<&[u32; 7]> for _3dStatePipelinedPointers<u64> {
fn from(input: &[u32; 7]) -> Self {
_3dStatePipelinedPointers {
dword_length: __gen_unuint(input[0], 0, 7),
_3d_command_sub_opcode: __gen_unuint(input[0], 16, 23),
_3d_command_opcode: __gen_unuint(input[0], 24, 26),
command_subtype: __gen_unuint(input[0], 27, 28),
command_type: __gen_unuint(input[0], 29, 31),
pointer_to_vs_state: (__gen_unuint(input[1], 5, 31) as u64) << 5,
gs_enable: __gen_unuint(input[2], 0, 0) != 0,
pointer_to_gs_state: (__gen_unuint(input[2], 5, 31) as u64) << 5,
clip_enable: __gen_unuint(input[3], 0, 0) != 0,
pointer_to_clip_state: (__gen_unuint(input[3], 5, 31) as u64) << 5,
pointer_to_sf_state: (__gen_unuint(input[4], 5, 31) as u64) << 5,
pointer_to_wm_state: (__gen_unuint(input[5], 5, 31) as u64) << 5,
pointer_to_color_calc_state: (__gen_unuint(input[6], 5, 31) as u64) << 5,
}
}
}
impl Deserialize for _3dStatePipelinedPointers<u64> {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 7];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 7] as *mut [u8; 28]) })?;
Ok((&input).into())
}
}
pub struct _3dStatePolyStippleOffset {
pub dword_length: u32,
pub _3d_command_sub_opcode: u32,
pub _3d_command_opcode: u32,
pub command_subtype: u32,
pub command_type: u32,
pub polygon_stipple_y_offset: u32,
pub polygon_stipple_x_offset: u32,
}
impl _3dStatePolyStippleOffset {
pub const DWORD_LENGTH: u32 = 2;
}
impl Default for _3dStatePolyStippleOffset {
fn default() -> Self {
_3dStatePolyStippleOffset {
dword_length: 0,
_3d_command_sub_opcode: 6,
_3d_command_opcode: 1,
command_subtype: 3,
command_type: 3,
polygon_stipple_y_offset: Default::default(),
polygon_stipple_x_offset: Default::default(),
}
}
}
impl Serialize for _3dStatePolyStippleOffset {
type Out = [u32; 2];
fn pack_into(&self, out: &mut [u32; 2]) {
out[0] = __gen_uint(self.dword_length, 0, 7) |
__gen_uint(self._3d_command_sub_opcode, 16, 23) |
__gen_uint(self._3d_command_opcode, 24, 26) |
__gen_uint(self.command_subtype, 27, 28) |
__gen_uint(self.command_type, 29, 31);
out[1] = __gen_uint(self.polygon_stipple_y_offset, 0, 4) |
__gen_uint(self.polygon_stipple_x_offset, 8, 12);
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 2];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 2] as *const [u8; 8]) })
}
}
impl From<&[u32; 2]> for _3dStatePolyStippleOffset {
fn from(input: &[u32; 2]) -> Self {
_3dStatePolyStippleOffset {
dword_length: __gen_unuint(input[0], 0, 7),
_3d_command_sub_opcode: __gen_unuint(input[0], 16, 23),
_3d_command_opcode: __gen_unuint(input[0], 24, 26),
command_subtype: __gen_unuint(input[0], 27, 28),
command_type: __gen_unuint(input[0], 29, 31),
polygon_stipple_y_offset: __gen_unuint(input[1], 0, 4),
polygon_stipple_x_offset: __gen_unuint(input[1], 8, 12),
}
}
}
impl Deserialize for _3dStatePolyStippleOffset {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 2];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 2] as *mut [u8; 8]) })?;
Ok((&input).into())
}
}
pub struct _3dStatePolyStipplePattern {
pub dword_length: u32,
pub _3d_command_sub_opcode: u32,
pub _3d_command_opcode: u32,
pub command_subtype: u32,
pub command_type: u32,
pub pattern_row: [u32; 32],
}
impl _3dStatePolyStipplePattern {
pub const DWORD_LENGTH: u32 = 33;
}
impl Default for _3dStatePolyStipplePattern {
fn default() -> Self {
_3dStatePolyStipplePattern {
dword_length: 31,
_3d_command_sub_opcode: 7,
_3d_command_opcode: 1,
command_subtype: 3,
command_type: 3,
pattern_row: Default::default(),
}
}
}
impl Serialize for _3dStatePolyStipplePattern {
type Out = [u32; 33];
fn pack_into(&self, out: &mut [u32; 33]) {
out[0] = __gen_uint(self.dword_length, 0, 7) |
__gen_uint(self._3d_command_sub_opcode, 16, 23) |
__gen_uint(self._3d_command_opcode, 24, 26) |
__gen_uint(self.command_subtype, 27, 28) |
__gen_uint(self.command_type, 29, 31);
out[1] = __gen_uint(self.pattern_row[0], 0, 31);
out[2] = __gen_uint(self.pattern_row[1], 0, 31);
out[3] = __gen_uint(self.pattern_row[2], 0, 31);
out[4] = __gen_uint(self.pattern_row[3], 0, 31);
out[5] = __gen_uint(self.pattern_row[4], 0, 31);
out[6] = __gen_uint(self.pattern_row[5], 0, 31);
out[7] = __gen_uint(self.pattern_row[6], 0, 31);
out[8] = __gen_uint(self.pattern_row[7], 0, 31);
out[9] = __gen_uint(self.pattern_row[8], 0, 31);
out[10] = __gen_uint(self.pattern_row[9], 0, 31);
out[11] = __gen_uint(self.pattern_row[10], 0, 31);
out[12] = __gen_uint(self.pattern_row[11], 0, 31);
out[13] = __gen_uint(self.pattern_row[12], 0, 31);
out[14] = __gen_uint(self.pattern_row[13], 0, 31);
out[15] = __gen_uint(self.pattern_row[14], 0, 31);
out[16] = __gen_uint(self.pattern_row[15], 0, 31);
out[17] = __gen_uint(self.pattern_row[16], 0, 31);
out[18] = __gen_uint(self.pattern_row[17], 0, 31);
out[19] = __gen_uint(self.pattern_row[18], 0, 31);
out[20] = __gen_uint(self.pattern_row[19], 0, 31);
out[21] = __gen_uint(self.pattern_row[20], 0, 31);
out[22] = __gen_uint(self.pattern_row[21], 0, 31);
out[23] = __gen_uint(self.pattern_row[22], 0, 31);
out[24] = __gen_uint(self.pattern_row[23], 0, 31);
out[25] = __gen_uint(self.pattern_row[24], 0, 31);
out[26] = __gen_uint(self.pattern_row[25], 0, 31);
out[27] = __gen_uint(self.pattern_row[26], 0, 31);
out[28] = __gen_uint(self.pattern_row[27], 0, 31);
out[29] = __gen_uint(self.pattern_row[28], 0, 31);
out[30] = __gen_uint(self.pattern_row[29], 0, 31);
out[31] = __gen_uint(self.pattern_row[30], 0, 31);
out[32] = __gen_uint(self.pattern_row[31], 0, 31);
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 33];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 33] as *const [u8; 132]) })
}
}
impl From<&[u32; 33]> for _3dStatePolyStipplePattern {
fn from(input: &[u32; 33]) -> Self {
_3dStatePolyStipplePattern {
dword_length: __gen_unuint(input[0], 0, 7),
_3d_command_sub_opcode: __gen_unuint(input[0], 16, 23),
_3d_command_opcode: __gen_unuint(input[0], 24, 26),
command_subtype: __gen_unuint(input[0], 27, 28),
command_type: __gen_unuint(input[0], 29, 31),
pattern_row: [
__gen_unuint(input[1], 0, 31),
__gen_unuint(input[2], 0, 31),
__gen_unuint(input[3], 0, 31),
__gen_unuint(input[4], 0, 31),
__gen_unuint(input[5], 0, 31),
__gen_unuint(input[6], 0, 31),
__gen_unuint(input[7], 0, 31),
__gen_unuint(input[8], 0, 31),
__gen_unuint(input[9], 0, 31),
__gen_unuint(input[10], 0, 31),
__gen_unuint(input[11], 0, 31),
__gen_unuint(input[12], 0, 31),
__gen_unuint(input[13], 0, 31),
__gen_unuint(input[14], 0, 31),
__gen_unuint(input[15], 0, 31),
__gen_unuint(input[16], 0, 31),
__gen_unuint(input[17], 0, 31),
__gen_unuint(input[18], 0, 31),
__gen_unuint(input[19], 0, 31),
__gen_unuint(input[20], 0, 31),
__gen_unuint(input[21], 0, 31),
__gen_unuint(input[22], 0, 31),
__gen_unuint(input[23], 0, 31),
__gen_unuint(input[24], 0, 31),
__gen_unuint(input[25], 0, 31),
__gen_unuint(input[26], 0, 31),
__gen_unuint(input[27], 0, 31),
__gen_unuint(input[28], 0, 31),
__gen_unuint(input[29], 0, 31),
__gen_unuint(input[30], 0, 31),
__gen_unuint(input[31], 0, 31),
__gen_unuint(input[32], 0, 31)
],
}
}
}
impl Deserialize for _3dStatePolyStipplePattern {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 33];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 33] as *mut [u8; 132]) })?;
Ok((&input).into())
}
}
pub struct _3dStateVertexBuffers {
pub dword_length: u32,
pub _3d_command_sub_opcode: u32,
pub _3d_command_opcode: u32,
pub command_subtype: u32,
pub command_type: u32,
}
impl _3dStateVertexBuffers {
pub const DWORD_LENGTH: u32 = 1;
}
impl Default for _3dStateVertexBuffers {
fn default() -> Self {
_3dStateVertexBuffers {
dword_length: 3,
_3d_command_sub_opcode: 8,
_3d_command_opcode: 0,
command_subtype: 3,
command_type: 3,
}
}
}
impl Serialize for _3dStateVertexBuffers {
type Out = [u32; 1];
fn pack_into(&self, out: &mut [u32; 1]) {
out[0] = __gen_uint(self.dword_length, 0, 7) |
__gen_uint(self._3d_command_sub_opcode, 16, 23) |
__gen_uint(self._3d_command_opcode, 24, 26) |
__gen_uint(self.command_subtype, 27, 28) |
__gen_uint(self.command_type, 29, 31);
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 1];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 1] as *const [u8; 4]) })
}
}
impl From<&[u32; 1]> for _3dStateVertexBuffers {
fn from(input: &[u32; 1]) -> Self {
_3dStateVertexBuffers {
dword_length: __gen_unuint(input[0], 0, 7),
_3d_command_sub_opcode: __gen_unuint(input[0], 16, 23),
_3d_command_opcode: __gen_unuint(input[0], 24, 26),
command_subtype: __gen_unuint(input[0], 27, 28),
command_type: __gen_unuint(input[0], 29, 31),
}
}
}
impl Deserialize for _3dStateVertexBuffers {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 1];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 1] as *mut [u8; 4]) })?;
Ok((&input).into())
}
}
pub struct _3dStateVertexElements {
pub dword_length: u32,
pub _3d_command_sub_opcode: u32,
pub _3d_command_opcode: u32,
pub command_subtype: u32,
pub command_type: u32,
}
impl _3dStateVertexElements {
pub const DWORD_LENGTH: u32 = 1;
}
impl Default for _3dStateVertexElements {
fn default() -> Self {
_3dStateVertexElements {
dword_length: 1,
_3d_command_sub_opcode: 9,
_3d_command_opcode: 0,
command_subtype: 3,
command_type: 3,
}
}
}
impl Serialize for _3dStateVertexElements {
type Out = [u32; 1];
fn pack_into(&self, out: &mut [u32; 1]) {
out[0] = __gen_uint(self.dword_length, 0, 7) |
__gen_uint(self._3d_command_sub_opcode, 16, 23) |
__gen_uint(self._3d_command_opcode, 24, 26) |
__gen_uint(self.command_subtype, 27, 28) |
__gen_uint(self.command_type, 29, 31);
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 1];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 1] as *const [u8; 4]) })
}
}
impl From<&[u32; 1]> for _3dStateVertexElements {
fn from(input: &[u32; 1]) -> Self {
_3dStateVertexElements {
dword_length: __gen_unuint(input[0], 0, 7),
_3d_command_sub_opcode: __gen_unuint(input[0], 16, 23),
_3d_command_opcode: __gen_unuint(input[0], 24, 26),
command_subtype: __gen_unuint(input[0], 27, 28),
command_type: __gen_unuint(input[0], 29, 31),
}
}
}
impl Deserialize for _3dStateVertexElements {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 1];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 1] as *mut [u8; 4]) })?;
Ok((&input).into())
}
}
pub struct _3dStateVfStatistics {
pub statistics_enable: bool,
pub _3d_command_sub_opcode: u32,
pub _3d_command_opcode: u32,
pub command_subtype: u32,
pub command_type: u32,
}
impl _3dStateVfStatistics {
pub const DWORD_LENGTH: u32 = 1;
}
impl Default for _3dStateVfStatistics {
fn default() -> Self {
_3dStateVfStatistics {
statistics_enable: Default::default(),
_3d_command_sub_opcode: 11,
_3d_command_opcode: 0,
command_subtype: 1,
command_type: 3,
}
}
}
impl Serialize for _3dStateVfStatistics {
type Out = [u32; 1];
fn pack_into(&self, out: &mut [u32; 1]) {
out[0] = __gen_uint(self.statistics_enable.into(), 0, 0) |
__gen_uint(self._3d_command_sub_opcode, 16, 23) |
__gen_uint(self._3d_command_opcode, 24, 26) |
__gen_uint(self.command_subtype, 27, 28) |
__gen_uint(self.command_type, 29, 31);
}
fn write_to<W: std::io::Write>(&self, write: &mut W) -> std::io::Result<()> {
let mut out = [0_u32; 1];
self.pack_into(&mut out);
write.write_all(unsafe { &*(&out as *const [u32; 1] as *const [u8; 4]) })
}
}
impl From<&[u32; 1]> for _3dStateVfStatistics {
fn from(input: &[u32; 1]) -> Self {
_3dStateVfStatistics {
statistics_enable: __gen_unuint(input[0], 0, 0) != 0,
_3d_command_sub_opcode: __gen_unuint(input[0], 16, 23),
_3d_command_opcode: __gen_unuint(input[0], 24, 26),
command_subtype: __gen_unuint(input[0], 27, 28),
command_type: __gen_unuint(input[0], 29, 31),
}
}
}
impl Deserialize for _3dStateVfStatistics {
fn read_from<R: std::io::Read>(read: &mut R) -> std::io::Result<Self> {
let mut input = [0_u32; 1];
read.read_exact(unsafe { &mut *(&mut input as *mut [u32; 1] as *mut [u8; 4]) })?;
Ok((&input).into())
}
}
}