ホーム › Graphics.Direct3D12 › D3D12_STATIC_SAMPLER_DESC1
D3D12_STATIC_SAMPLER_DESC1
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Filter | D3D12_FILTER | 4 | +0 | +0 | サンプリングフィルタの種別。ポイント・リニア・異方性等を指定する。 |
| AddressU | D3D12_TEXTURE_ADDRESS_MODE | 4 | +4 | +4 | U(横)方向のテクスチャアドレスモード。 |
| AddressV | D3D12_TEXTURE_ADDRESS_MODE | 4 | +8 | +8 | V(縦)方向のテクスチャアドレスモード。 |
| AddressW | D3D12_TEXTURE_ADDRESS_MODE | 4 | +12 | +12 | W(奥行)方向のテクスチャアドレスモード。 |
| MipLODBias | FLOAT | 4 | +16 | +16 | ミップLODに加算するバイアス値。 |
| MaxAnisotropy | DWORD | 4 | +20 | +20 | 異方性フィルタの最大異方度。1〜16。 |
| ComparisonFunc | D3D12_COMPARISON_FUNC | 4 | +24 | +24 | 比較サンプリング時の比較関数。 |
| BorderColor | D3D12_STATIC_BORDER_COLOR | 4 | +28 | +28 | 境界アドレスモード時の境界色。事前定義色から選ぶ列挙値。 |
| MinLOD | FLOAT | 4 | +32 | +32 | アクセス可能な最小ミップLOD。 |
| MaxLOD | FLOAT | 4 | +36 | +36 | アクセス可能な最大ミップLOD。FLT_MAXで上限なし。 |
| ShaderRegister | DWORD | 4 | +40 | +40 | サンプラーが対応するシェーダーレジスタ番号。 |
| RegisterSpace | DWORD | 4 | +44 | +44 | シェーダーレジスタ空間の番号。 |
| ShaderVisibility | D3D12_SHADER_VISIBILITY | 4 | +48 | +48 | このサンプラーが可視となるシェーダーステージ。 |
| Flags | D3D12_SAMPLER_FLAGS | 4 | +52 | +52 | サンプラーのフラグ。非正規化座標などのオプションを指定する。 |
各言語での定義
#include <windows.h>
// D3D12_STATIC_SAMPLER_DESC1 (x64 56 / x86 56 バイト)
typedef struct D3D12_STATIC_SAMPLER_DESC1 {
D3D12_FILTER Filter;
D3D12_TEXTURE_ADDRESS_MODE AddressU;
D3D12_TEXTURE_ADDRESS_MODE AddressV;
D3D12_TEXTURE_ADDRESS_MODE AddressW;
FLOAT MipLODBias;
DWORD MaxAnisotropy;
D3D12_COMPARISON_FUNC ComparisonFunc;
D3D12_STATIC_BORDER_COLOR BorderColor;
FLOAT MinLOD;
FLOAT MaxLOD;
DWORD ShaderRegister;
DWORD RegisterSpace;
D3D12_SHADER_VISIBILITY ShaderVisibility;
D3D12_SAMPLER_FLAGS Flags;
} D3D12_STATIC_SAMPLER_DESC1;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_STATIC_SAMPLER_DESC1
{
public int Filter;
public int AddressU;
public int AddressV;
public int AddressW;
public float MipLODBias;
public uint MaxAnisotropy;
public int ComparisonFunc;
public int BorderColor;
public float MinLOD;
public float MaxLOD;
public uint ShaderRegister;
public uint RegisterSpace;
public int ShaderVisibility;
public int Flags;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_STATIC_SAMPLER_DESC1
Public Filter As Integer
Public AddressU As Integer
Public AddressV As Integer
Public AddressW As Integer
Public MipLODBias As Single
Public MaxAnisotropy As UInteger
Public ComparisonFunc As Integer
Public BorderColor As Integer
Public MinLOD As Single
Public MaxLOD As Single
Public ShaderRegister As UInteger
Public RegisterSpace As UInteger
Public ShaderVisibility As Integer
Public Flags As Integer
End Structureimport ctypes
from ctypes import wintypes
class D3D12_STATIC_SAMPLER_DESC1(ctypes.Structure):
_fields_ = [
("Filter", ctypes.c_int),
("AddressU", ctypes.c_int),
("AddressV", ctypes.c_int),
("AddressW", ctypes.c_int),
("MipLODBias", ctypes.c_float),
("MaxAnisotropy", wintypes.DWORD),
("ComparisonFunc", ctypes.c_int),
("BorderColor", ctypes.c_int),
("MinLOD", ctypes.c_float),
("MaxLOD", ctypes.c_float),
("ShaderRegister", wintypes.DWORD),
("RegisterSpace", wintypes.DWORD),
("ShaderVisibility", ctypes.c_int),
("Flags", ctypes.c_int),
]#[repr(C)]
pub struct D3D12_STATIC_SAMPLER_DESC1 {
pub Filter: i32,
pub AddressU: i32,
pub AddressV: i32,
pub AddressW: i32,
pub MipLODBias: f32,
pub MaxAnisotropy: u32,
pub ComparisonFunc: i32,
pub BorderColor: i32,
pub MinLOD: f32,
pub MaxLOD: f32,
pub ShaderRegister: u32,
pub RegisterSpace: u32,
pub ShaderVisibility: i32,
pub Flags: i32,
}import "golang.org/x/sys/windows"
type D3D12_STATIC_SAMPLER_DESC1 struct {
Filter int32
AddressU int32
AddressV int32
AddressW int32
MipLODBias float32
MaxAnisotropy uint32
ComparisonFunc int32
BorderColor int32
MinLOD float32
MaxLOD float32
ShaderRegister uint32
RegisterSpace uint32
ShaderVisibility int32
Flags int32
}type
D3D12_STATIC_SAMPLER_DESC1 = record
Filter: Integer;
AddressU: Integer;
AddressV: Integer;
AddressW: Integer;
MipLODBias: Single;
MaxAnisotropy: DWORD;
ComparisonFunc: Integer;
BorderColor: Integer;
MinLOD: Single;
MaxLOD: Single;
ShaderRegister: DWORD;
RegisterSpace: DWORD;
ShaderVisibility: Integer;
Flags: Integer;
end;const D3D12_STATIC_SAMPLER_DESC1 = extern struct {
Filter: i32,
AddressU: i32,
AddressV: i32,
AddressW: i32,
MipLODBias: f32,
MaxAnisotropy: u32,
ComparisonFunc: i32,
BorderColor: i32,
MinLOD: f32,
MaxLOD: f32,
ShaderRegister: u32,
RegisterSpace: u32,
ShaderVisibility: i32,
Flags: i32,
};type
D3D12_STATIC_SAMPLER_DESC1 {.bycopy.} = object
Filter: int32
AddressU: int32
AddressV: int32
AddressW: int32
MipLODBias: float32
MaxAnisotropy: uint32
ComparisonFunc: int32
BorderColor: int32
MinLOD: float32
MaxLOD: float32
ShaderRegister: uint32
RegisterSpace: uint32
ShaderVisibility: int32
Flags: int32struct D3D12_STATIC_SAMPLER_DESC1
{
int Filter;
int AddressU;
int AddressV;
int AddressW;
float MipLODBias;
uint MaxAnisotropy;
int ComparisonFunc;
int BorderColor;
float MinLOD;
float MaxLOD;
uint ShaderRegister;
uint RegisterSpace;
int ShaderVisibility;
int Flags;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3D12_STATIC_SAMPLER_DESC1 サイズ: 56 バイト(x64)
dim st, 14 ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; Filter : D3D12_FILTER (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; AddressU : D3D12_TEXTURE_ADDRESS_MODE (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; AddressV : D3D12_TEXTURE_ADDRESS_MODE (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; AddressW : D3D12_TEXTURE_ADDRESS_MODE (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; MipLODBias : FLOAT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; MaxAnisotropy : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ComparisonFunc : D3D12_COMPARISON_FUNC (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; BorderColor : D3D12_STATIC_BORDER_COLOR (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; MinLOD : FLOAT (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; MaxLOD : FLOAT (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; ShaderRegister : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; RegisterSpace : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; ShaderVisibility : D3D12_SHADER_VISIBILITY (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; Flags : D3D12_SAMPLER_FLAGS (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global D3D12_STATIC_SAMPLER_DESC1
#field int Filter
#field int AddressU
#field int AddressV
#field int AddressW
#field float MipLODBias
#field int MaxAnisotropy
#field int ComparisonFunc
#field int BorderColor
#field float MinLOD
#field float MaxLOD
#field int ShaderRegister
#field int RegisterSpace
#field int ShaderVisibility
#field int Flags
#endstruct
stdim st, D3D12_STATIC_SAMPLER_DESC1 ; NSTRUCT 変数を確保
st->Filter = 100
mes "Filter=" + st->Filter