ホーム › Graphics.Direct3D12 › D3D12_SAMPLER_DESC
D3D12_SAMPLER_DESC
構造体サイズ=各フィールドのバイト数(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 | FLOAT | 16 | +28 | +28 | 境界アドレスモード時の境界色(RGBA)。 |
| MinLOD | FLOAT | 4 | +44 | +44 | アクセス可能な最小ミップLOD。 |
| MaxLOD | FLOAT | 4 | +48 | +48 | アクセス可能な最大ミップLOD。FLT_MAXで上限なし。 |
各言語での定義
#include <windows.h>
// D3D12_SAMPLER_DESC (x64 52 / x86 52 バイト)
typedef struct D3D12_SAMPLER_DESC {
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;
FLOAT BorderColor[4];
FLOAT MinLOD;
FLOAT MaxLOD;
} D3D12_SAMPLER_DESC;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_SAMPLER_DESC
{
public int Filter;
public int AddressU;
public int AddressV;
public int AddressW;
public float MipLODBias;
public uint MaxAnisotropy;
public int ComparisonFunc;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public float[] BorderColor;
public float MinLOD;
public float MaxLOD;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_SAMPLER_DESC
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
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Public BorderColor() As Single
Public MinLOD As Single
Public MaxLOD As Single
End Structureimport ctypes
from ctypes import wintypes
class D3D12_SAMPLER_DESC(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_float * 4),
("MinLOD", ctypes.c_float),
("MaxLOD", ctypes.c_float),
]#[repr(C)]
pub struct D3D12_SAMPLER_DESC {
pub Filter: i32,
pub AddressU: i32,
pub AddressV: i32,
pub AddressW: i32,
pub MipLODBias: f32,
pub MaxAnisotropy: u32,
pub ComparisonFunc: i32,
pub BorderColor: [f32; 4],
pub MinLOD: f32,
pub MaxLOD: f32,
}import "golang.org/x/sys/windows"
type D3D12_SAMPLER_DESC struct {
Filter int32
AddressU int32
AddressV int32
AddressW int32
MipLODBias float32
MaxAnisotropy uint32
ComparisonFunc int32
BorderColor [4]float32
MinLOD float32
MaxLOD float32
}type
D3D12_SAMPLER_DESC = record
Filter: Integer;
AddressU: Integer;
AddressV: Integer;
AddressW: Integer;
MipLODBias: Single;
MaxAnisotropy: DWORD;
ComparisonFunc: Integer;
BorderColor: array[0..3] of Single;
MinLOD: Single;
MaxLOD: Single;
end;const D3D12_SAMPLER_DESC = extern struct {
Filter: i32,
AddressU: i32,
AddressV: i32,
AddressW: i32,
MipLODBias: f32,
MaxAnisotropy: u32,
ComparisonFunc: i32,
BorderColor: [4]f32,
MinLOD: f32,
MaxLOD: f32,
};type
D3D12_SAMPLER_DESC {.bycopy.} = object
Filter: int32
AddressU: int32
AddressV: int32
AddressW: int32
MipLODBias: float32
MaxAnisotropy: uint32
ComparisonFunc: int32
BorderColor: array[4, float32]
MinLOD: float32
MaxLOD: float32struct D3D12_SAMPLER_DESC
{
int Filter;
int AddressU;
int AddressV;
int AddressW;
float MipLODBias;
uint MaxAnisotropy;
int ComparisonFunc;
float[4] BorderColor;
float MinLOD;
float MaxLOD;
}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_DESC サイズ: 52 バイト(x64)
dim st, 13 ; 4byte整数×13(構造体サイズ 52 / 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 : FLOAT (+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 も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global D3D12_SAMPLER_DESC
#field int Filter
#field int AddressU
#field int AddressV
#field int AddressW
#field float MipLODBias
#field int MaxAnisotropy
#field int ComparisonFunc
#field float BorderColor 4
#field float MinLOD
#field float MaxLOD
#endstruct
stdim st, D3D12_SAMPLER_DESC ; NSTRUCT 変数を確保
st->Filter = 100
mes "Filter=" + st->Filter