ホーム › Graphics.Direct3D12 › D3D12_SAMPLER_DESC2
D3D12_SAMPLER_DESC2
構造体サイズ=各フィールドのバイト数(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 | 比較サンプリング時の比較関数。 |
| Anonymous | _Anonymous_e__Union | 16 | +28 | +28 | 境界色の共用体。FLOAT配列またはUINT配列のいずれか。 |
| MinLOD | FLOAT | 4 | +44 | +44 | アクセス可能な最小ミップLOD。 |
| MaxLOD | FLOAT | 4 | +48 | +48 | アクセス可能な最大ミップLOD。FLT_MAXで上限なし。 |
| Flags | D3D12_SAMPLER_FLAGS | 4 | +52 | +52 | サンプラーのフラグ。非正規化座標などのオプションを指定する。 |
共用体: _Anonymous_e__Union x64 16B / x86 16B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| FloatBorderColor | FLOAT | 16 | +0 | +0 |
| UintBorderColor | DWORD | 16 | +0 | +0 |
各言語での定義
#include <windows.h>
// D3D12_SAMPLER_DESC2 (x64 56 / x86 56 バイト)
typedef struct D3D12_SAMPLER_DESC2 {
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;
_Anonymous_e__Union Anonymous;
FLOAT MinLOD;
FLOAT MaxLOD;
D3D12_SAMPLER_FLAGS Flags;
} D3D12_SAMPLER_DESC2;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_SAMPLER_DESC2
{
public int Filter;
public int AddressU;
public int AddressV;
public int AddressW;
public float MipLODBias;
public uint MaxAnisotropy;
public int ComparisonFunc;
public _Anonymous_e__Union Anonymous;
public float MinLOD;
public float MaxLOD;
public int Flags;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_SAMPLER_DESC2
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 Anonymous As _Anonymous_e__Union
Public MinLOD As Single
Public MaxLOD As Single
Public Flags As Integer
End Structureimport ctypes
from ctypes import wintypes
class D3D12_SAMPLER_DESC2(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),
("Anonymous", _Anonymous_e__Union),
("MinLOD", ctypes.c_float),
("MaxLOD", ctypes.c_float),
("Flags", ctypes.c_int),
]#[repr(C)]
pub struct D3D12_SAMPLER_DESC2 {
pub Filter: i32,
pub AddressU: i32,
pub AddressV: i32,
pub AddressW: i32,
pub MipLODBias: f32,
pub MaxAnisotropy: u32,
pub ComparisonFunc: i32,
pub Anonymous: _Anonymous_e__Union,
pub MinLOD: f32,
pub MaxLOD: f32,
pub Flags: i32,
}import "golang.org/x/sys/windows"
type D3D12_SAMPLER_DESC2 struct {
Filter int32
AddressU int32
AddressV int32
AddressW int32
MipLODBias float32
MaxAnisotropy uint32
ComparisonFunc int32
Anonymous _Anonymous_e__Union
MinLOD float32
MaxLOD float32
Flags int32
}type
D3D12_SAMPLER_DESC2 = record
Filter: Integer;
AddressU: Integer;
AddressV: Integer;
AddressW: Integer;
MipLODBias: Single;
MaxAnisotropy: DWORD;
ComparisonFunc: Integer;
Anonymous: _Anonymous_e__Union;
MinLOD: Single;
MaxLOD: Single;
Flags: Integer;
end;const D3D12_SAMPLER_DESC2 = extern struct {
Filter: i32,
AddressU: i32,
AddressV: i32,
AddressW: i32,
MipLODBias: f32,
MaxAnisotropy: u32,
ComparisonFunc: i32,
Anonymous: _Anonymous_e__Union,
MinLOD: f32,
MaxLOD: f32,
Flags: i32,
};type
D3D12_SAMPLER_DESC2 {.bycopy.} = object
Filter: int32
AddressU: int32
AddressV: int32
AddressW: int32
MipLODBias: float32
MaxAnisotropy: uint32
ComparisonFunc: int32
Anonymous: _Anonymous_e__Union
MinLOD: float32
MaxLOD: float32
Flags: int32struct D3D12_SAMPLER_DESC2
{
int Filter;
int AddressU;
int AddressV;
int AddressW;
float MipLODBias;
uint MaxAnisotropy;
int ComparisonFunc;
_Anonymous_e__Union Anonymous;
float MinLOD;
float MaxLOD;
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_SAMPLER_DESC2 サイズ: 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 も可)
; Anonymous : _Anonymous_e__Union (+28, 16byte) varptr(st)+28 を基点に操作(16byte:入れ子/配列)
; MinLOD : FLOAT (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; MaxLOD : FLOAT (+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_SAMPLER_DESC2
#field int Filter
#field int AddressU
#field int AddressV
#field int AddressW
#field float MipLODBias
#field int MaxAnisotropy
#field int ComparisonFunc
#field byte Anonymous 16
#field float MinLOD
#field float MaxLOD
#field int Flags
#endstruct
stdim st, D3D12_SAMPLER_DESC2 ; NSTRUCT 変数を確保
st->Filter = 100
mes "Filter=" + st->Filter
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。