Win32 API 日本語リファレンス
ホームGraphics.Direct3D10 › D3D10_SHADER_TYPE_DESC

D3D10_SHADER_TYPE_DESC

構造体
サイズx64: 28 バイト / x86: 28 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
ClassD3D_SHADER_VARIABLE_CLASS4+0+0変数のクラス(スカラ/ベクトル/行列等)を示す列挙値。
TypeD3D_SHADER_VARIABLE_TYPE4+4+4変数の基本データ型を示す列挙値。
RowsDWORD4+8+8行列型の行数。
ColumnsDWORD4+12+12行列型の列数またはベクトルの要素数。
ElementsDWORD4+16+16配列要素の数。非配列なら0。
MembersDWORD4+20+20構造体型のメンバ数。
OffsetDWORD4+24+24親構造体先頭からのこの型のオフセット(バイト単位)。

各言語での定義

#include <windows.h>

// D3D10_SHADER_TYPE_DESC  (x64 28 / x86 28 バイト)
typedef struct D3D10_SHADER_TYPE_DESC {
    D3D_SHADER_VARIABLE_CLASS Class;
    D3D_SHADER_VARIABLE_TYPE Type;
    DWORD Rows;
    DWORD Columns;
    DWORD Elements;
    DWORD Members;
    DWORD Offset;
} D3D10_SHADER_TYPE_DESC;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D10_SHADER_TYPE_DESC
{
    public int Class;
    public int Type;
    public uint Rows;
    public uint Columns;
    public uint Elements;
    public uint Members;
    public uint Offset;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D10_SHADER_TYPE_DESC
    Public Class As Integer
    Public Type As Integer
    Public Rows As UInteger
    Public Columns As UInteger
    Public Elements As UInteger
    Public Members As UInteger
    Public Offset As UInteger
End Structure
import ctypes
from ctypes import wintypes

class D3D10_SHADER_TYPE_DESC(ctypes.Structure):
    _fields_ = [
        ("Class", ctypes.c_int),
        ("Type", ctypes.c_int),
        ("Rows", wintypes.DWORD),
        ("Columns", wintypes.DWORD),
        ("Elements", wintypes.DWORD),
        ("Members", wintypes.DWORD),
        ("Offset", wintypes.DWORD),
    ]
#[repr(C)]
pub struct D3D10_SHADER_TYPE_DESC {
    pub Class: i32,
    pub Type: i32,
    pub Rows: u32,
    pub Columns: u32,
    pub Elements: u32,
    pub Members: u32,
    pub Offset: u32,
}
import "golang.org/x/sys/windows"

type D3D10_SHADER_TYPE_DESC struct {
	Class int32
	Type int32
	Rows uint32
	Columns uint32
	Elements uint32
	Members uint32
	Offset uint32
}
type
  D3D10_SHADER_TYPE_DESC = record
    Class: Integer;
    Type: Integer;
    Rows: DWORD;
    Columns: DWORD;
    Elements: DWORD;
    Members: DWORD;
    Offset: DWORD;
  end;
const D3D10_SHADER_TYPE_DESC = extern struct {
    Class: i32,
    Type: i32,
    Rows: u32,
    Columns: u32,
    Elements: u32,
    Members: u32,
    Offset: u32,
};
type
  D3D10_SHADER_TYPE_DESC {.bycopy.} = object
    Class: int32
    Type: int32
    Rows: uint32
    Columns: uint32
    Elements: uint32
    Members: uint32
    Offset: uint32
struct D3D10_SHADER_TYPE_DESC
{
    int Class;
    int Type;
    uint Rows;
    uint Columns;
    uint Elements;
    uint Members;
    uint Offset;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3D10_SHADER_TYPE_DESC サイズ: 28 バイト(x64)
dim st, 7    ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; Class : D3D_SHADER_VARIABLE_CLASS (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Type : D3D_SHADER_VARIABLE_TYPE (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Rows : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; Columns : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; Elements : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; Members : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; Offset : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global D3D10_SHADER_TYPE_DESC
    #field int Class
    #field int Type
    #field int Rows
    #field int Columns
    #field int Elements
    #field int Members
    #field int Offset
#endstruct

stdim st, D3D10_SHADER_TYPE_DESC        ; NSTRUCT 変数を確保
st->Class = 100
mes "Class=" + st->Class