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

D3D12_SHADER_INPUT_BIND_DESC

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

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

フィールド

フィールドサイズx64x86説明
NameLPSTR8/4+0+0バインドされるリソース名(NULL終端ANSI文字列)。
TypeD3D_SHADER_INPUT_TYPE4+8+4リソースの種別を示すD3D_SHADER_INPUT_TYPE(テクスチャ/サンプラ/CB等)。
BindPointDWORD4+12+8リソースがバインドされる開始レジスタ番号。
BindCountDWORD4+16+12連続してバインドされるレジスタ数(配列の場合)。
uFlagsDWORD4+20+16入力フラグ群。
ReturnTypeD3D_RESOURCE_RETURN_TYPE4+24+20リソースの戻り値型を示すD3D_RESOURCE_RETURN_TYPE。
DimensionD3D_SRV_DIMENSION4+28+24リソースの次元を示すD3D_SRV_DIMENSION(1D/2D/Cube等)。
NumSamplesDWORD4+32+28マルチサンプルテクスチャのサンプル数。非適用時は特殊値。
SpaceDWORD4+36+32リソースが属するレジスタスペース番号。
uIDDWORD4+40+36リソースを識別する一意のID。

各言語での定義

#include <windows.h>

// D3D12_SHADER_INPUT_BIND_DESC  (x64 48 / x86 40 バイト)
typedef struct D3D12_SHADER_INPUT_BIND_DESC {
    LPSTR Name;
    D3D_SHADER_INPUT_TYPE Type;
    DWORD BindPoint;
    DWORD BindCount;
    DWORD uFlags;
    D3D_RESOURCE_RETURN_TYPE ReturnType;
    D3D_SRV_DIMENSION Dimension;
    DWORD NumSamples;
    DWORD Space;
    DWORD uID;
} D3D12_SHADER_INPUT_BIND_DESC;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_SHADER_INPUT_BIND_DESC
{
    public IntPtr Name;
    public int Type;
    public uint BindPoint;
    public uint BindCount;
    public uint uFlags;
    public int ReturnType;
    public int Dimension;
    public uint NumSamples;
    public uint Space;
    public uint uID;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_SHADER_INPUT_BIND_DESC
    Public Name As IntPtr
    Public Type As Integer
    Public BindPoint As UInteger
    Public BindCount As UInteger
    Public uFlags As UInteger
    Public ReturnType As Integer
    Public Dimension As Integer
    Public NumSamples As UInteger
    Public Space As UInteger
    Public uID As UInteger
End Structure
import ctypes
from ctypes import wintypes

class D3D12_SHADER_INPUT_BIND_DESC(ctypes.Structure):
    _fields_ = [
        ("Name", ctypes.c_void_p),
        ("Type", ctypes.c_int),
        ("BindPoint", wintypes.DWORD),
        ("BindCount", wintypes.DWORD),
        ("uFlags", wintypes.DWORD),
        ("ReturnType", ctypes.c_int),
        ("Dimension", ctypes.c_int),
        ("NumSamples", wintypes.DWORD),
        ("Space", wintypes.DWORD),
        ("uID", wintypes.DWORD),
    ]
#[repr(C)]
pub struct D3D12_SHADER_INPUT_BIND_DESC {
    pub Name: *mut core::ffi::c_void,
    pub Type: i32,
    pub BindPoint: u32,
    pub BindCount: u32,
    pub uFlags: u32,
    pub ReturnType: i32,
    pub Dimension: i32,
    pub NumSamples: u32,
    pub Space: u32,
    pub uID: u32,
}
import "golang.org/x/sys/windows"

type D3D12_SHADER_INPUT_BIND_DESC struct {
	Name uintptr
	Type int32
	BindPoint uint32
	BindCount uint32
	uFlags uint32
	ReturnType int32
	Dimension int32
	NumSamples uint32
	Space uint32
	uID uint32
}
type
  D3D12_SHADER_INPUT_BIND_DESC = record
    Name: Pointer;
    Type: Integer;
    BindPoint: DWORD;
    BindCount: DWORD;
    uFlags: DWORD;
    ReturnType: Integer;
    Dimension: Integer;
    NumSamples: DWORD;
    Space: DWORD;
    uID: DWORD;
  end;
const D3D12_SHADER_INPUT_BIND_DESC = extern struct {
    Name: ?*anyopaque,
    Type: i32,
    BindPoint: u32,
    BindCount: u32,
    uFlags: u32,
    ReturnType: i32,
    Dimension: i32,
    NumSamples: u32,
    Space: u32,
    uID: u32,
};
type
  D3D12_SHADER_INPUT_BIND_DESC {.bycopy.} = object
    Name: pointer
    Type: int32
    BindPoint: uint32
    BindCount: uint32
    uFlags: uint32
    ReturnType: int32
    Dimension: int32
    NumSamples: uint32
    Space: uint32
    uID: uint32
struct D3D12_SHADER_INPUT_BIND_DESC
{
    void* Name;
    int Type;
    uint BindPoint;
    uint BindCount;
    uint uFlags;
    int ReturnType;
    int Dimension;
    uint NumSamples;
    uint Space;
    uint uID;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; D3D12_SHADER_INPUT_BIND_DESC サイズ: 40 バイト(x86)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; Name : LPSTR (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Type : D3D_SHADER_INPUT_TYPE (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; BindPoint : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; BindCount : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; uFlags : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; ReturnType : D3D_RESOURCE_RETURN_TYPE (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; Dimension : D3D_SRV_DIMENSION (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; NumSamples : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; Space : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; uID : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3D12_SHADER_INPUT_BIND_DESC サイズ: 48 バイト(x64)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; Name : LPSTR (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; Type : D3D_SHADER_INPUT_TYPE (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; BindPoint : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; BindCount : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; uFlags : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; ReturnType : D3D_RESOURCE_RETURN_TYPE (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; Dimension : D3D_SRV_DIMENSION (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; NumSamples : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; Space : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; uID : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global D3D12_SHADER_INPUT_BIND_DESC
    #field intptr Name
    #field int Type
    #field int BindPoint
    #field int BindCount
    #field int uFlags
    #field int ReturnType
    #field int Dimension
    #field int NumSamples
    #field int Space
    #field int uID
#endstruct

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