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

D3D10_SAMPLER_DESC

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

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

フィールド

フィールドサイズx64x86説明
FilterD3D10_FILTER4+0+0テクスチャサンプリング時のフィルタリング方法(線形/点/異方性など)。
AddressUD3D10_TEXTURE_ADDRESS_MODE4+4+4U座標が0〜1範囲外の場合のアドレッシングモード(ラップ等)。
AddressVD3D10_TEXTURE_ADDRESS_MODE4+8+8V座標が0〜1範囲外の場合のアドレッシングモード(ラップ等)。
AddressWD3D10_TEXTURE_ADDRESS_MODE4+12+12W座標が0〜1範囲外の場合のアドレッシングモード(ラップ等)。
MipLODBiasFLOAT4+16+16計算されたミップレベルに加算するバイアス値。
MaxAnisotropyDWORD4+20+20異方性フィルタリング使用時の最大値。1〜16の範囲で指定する。
ComparisonFuncD3D10_COMPARISON_FUNC4+24+24比較サンプリング時にサンプルデータと既存値を比較する関数。
BorderColorFLOAT16+28+28アドレッシングモードがボーダーの場合に使う境界色(RGBA4要素)。
MinLODFLOAT4+44+44アクセス可能な最小ミップレベル。0が最大解像度を表す。
MaxLODFLOAT4+48+48アクセス可能な最大ミップレベル。制限なしはFLT_MAXを指定する。

各言語での定義

#include <windows.h>

// D3D10_SAMPLER_DESC  (x64 52 / x86 52 バイト)
typedef struct D3D10_SAMPLER_DESC {
    D3D10_FILTER Filter;
    D3D10_TEXTURE_ADDRESS_MODE AddressU;
    D3D10_TEXTURE_ADDRESS_MODE AddressV;
    D3D10_TEXTURE_ADDRESS_MODE AddressW;
    FLOAT MipLODBias;
    DWORD MaxAnisotropy;
    D3D10_COMPARISON_FUNC ComparisonFunc;
    FLOAT BorderColor[4];
    FLOAT MinLOD;
    FLOAT MaxLOD;
} D3D10_SAMPLER_DESC;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D10_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 D3D10_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 Structure
import ctypes
from ctypes import wintypes

class D3D10_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 D3D10_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 D3D10_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
  D3D10_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 D3D10_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
  D3D10_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: float32
struct D3D10_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 レイアウト)
; D3D10_SAMPLER_DESC サイズ: 52 バイト(x64)
dim st, 13    ; 4byte整数×13(構造体サイズ 52 / 4 切り上げ)
; Filter : D3D10_FILTER (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; AddressU : D3D10_TEXTURE_ADDRESS_MODE (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; AddressV : D3D10_TEXTURE_ADDRESS_MODE (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; AddressW : D3D10_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 : D3D10_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 D3D10_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, D3D10_SAMPLER_DESC        ; NSTRUCT 変数を確保
st->Filter = 100
mes "Filter=" + st->Filter