ホーム › Graphics.Direct3D11 › D3D11_SHADER_BUFFER_DESC
D3D11_SHADER_BUFFER_DESC
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Name | LPSTR | 8/4 | +0 | +0 | 定数バッファの名前。 |
| Type | D3D_CBUFFER_TYPE | 4 | +8 | +4 | バッファの種類を示すD3D_CBUFFER_TYPE列挙値。 |
| Variables | DWORD | 4 | +12 | +8 | バッファに含まれる変数の数。 |
| Size | DWORD | 4 | +16 | +12 | バッファのサイズ(バイト)。 |
| uFlags | DWORD | 4 | +20 | +16 | バッファの属性を示すD3D_SHADER_CBUFFER_FLAGSビットフラグ。 |
各言語での定義
#include <windows.h>
// D3D11_SHADER_BUFFER_DESC (x64 24 / x86 20 バイト)
typedef struct D3D11_SHADER_BUFFER_DESC {
LPSTR Name;
D3D_CBUFFER_TYPE Type;
DWORD Variables;
DWORD Size;
DWORD uFlags;
} D3D11_SHADER_BUFFER_DESC;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D11_SHADER_BUFFER_DESC
{
public IntPtr Name;
public int Type;
public uint Variables;
public uint Size;
public uint uFlags;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D11_SHADER_BUFFER_DESC
Public Name As IntPtr
Public Type As Integer
Public Variables As UInteger
Public Size As UInteger
Public uFlags As UInteger
End Structureimport ctypes
from ctypes import wintypes
class D3D11_SHADER_BUFFER_DESC(ctypes.Structure):
_fields_ = [
("Name", ctypes.c_void_p),
("Type", ctypes.c_int),
("Variables", wintypes.DWORD),
("Size", wintypes.DWORD),
("uFlags", wintypes.DWORD),
]#[repr(C)]
pub struct D3D11_SHADER_BUFFER_DESC {
pub Name: *mut core::ffi::c_void,
pub Type: i32,
pub Variables: u32,
pub Size: u32,
pub uFlags: u32,
}import "golang.org/x/sys/windows"
type D3D11_SHADER_BUFFER_DESC struct {
Name uintptr
Type int32
Variables uint32
Size uint32
uFlags uint32
}type
D3D11_SHADER_BUFFER_DESC = record
Name: Pointer;
Type: Integer;
Variables: DWORD;
Size: DWORD;
uFlags: DWORD;
end;const D3D11_SHADER_BUFFER_DESC = extern struct {
Name: ?*anyopaque,
Type: i32,
Variables: u32,
Size: u32,
uFlags: u32,
};type
D3D11_SHADER_BUFFER_DESC {.bycopy.} = object
Name: pointer
Type: int32
Variables: uint32
Size: uint32
uFlags: uint32struct D3D11_SHADER_BUFFER_DESC
{
void* Name;
int Type;
uint Variables;
uint Size;
uint uFlags;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; D3D11_SHADER_BUFFER_DESC サイズ: 20 バイト(x86)
dim st, 5 ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; Name : LPSTR (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Type : D3D_CBUFFER_TYPE (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; Variables : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; Size : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; uFlags : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3D11_SHADER_BUFFER_DESC サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; Name : LPSTR (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; Type : D3D_CBUFFER_TYPE (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; Variables : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; Size : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; uFlags : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global D3D11_SHADER_BUFFER_DESC
#field intptr Name
#field int Type
#field int Variables
#field int Size
#field int uFlags
#endstruct
stdim st, D3D11_SHADER_BUFFER_DESC ; NSTRUCT 変数を確保
st->Type = 100
mes "Type=" + st->Type