ホーム › Graphics.Direct3D12 › D3D12_STATIC_SAMPLER_DESC
D3D12_STATIC_SAMPLER_DESC
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Filter | D3D12_FILTER | 4 | +0 | +0 | テクスチャーをサンプリングするときに使用するフィルタリング方法を、D3D12_FILTER 列挙型の定数で指定します。 |
| AddressU | D3D12_TEXTURE_ADDRESS_MODE | 4 | +4 | +4 | 0 から 1 の範囲外にある u テクスチャー座標を解決するために使用する D3D12_TEXTURE_ADDRESS_MODE モードを指定します。 |
| AddressV | D3D12_TEXTURE_ADDRESS_MODE | 4 | +8 | +8 | 0 から 1 の範囲外にある v テクスチャー座標を解決するために使用する D3D12_TEXTURE_ADDRESS_MODE モードを指定します。 |
| AddressW | D3D12_TEXTURE_ADDRESS_MODE | 4 | +12 | +12 | 0 から 1 の範囲外にある w テクスチャー座標を解決するために使用する D3D12_TEXTURE_ADDRESS_MODE モードを指定します。 |
| MipLODBias | FLOAT | 4 | +16 | +16 | 計算されたミップマップレベルからのオフセットです。たとえば、Direct3D がテクスチャーをミップマップレベル 3 でサンプリングすると計算し、MipLODBias が 2 の場合、テクスチャーはミップマップレベル 5 でサンプリングされます。 |
| MaxAnisotropy | DWORD | 4 | +20 | +20 | フィルターとして D3D12_FILTER_ANISOTROPIC または D3D12_FILTER_COMPARISON_ANISOTROPIC が指定されている場合に使用されるクランプ値です。有効な値は 1 から 16 です。 |
| ComparisonFunc | D3D12_COMPARISON_FUNC | 4 | +24 | +24 | サンプリングしたデータを既存のサンプリング済みデータと比較する関数です。 関数の選択肢は D3D12_COMPARISON_FUNC に一覧があります。 |
| BorderColor | D3D12_STATIC_BORDER_COLOR | 4 | +28 | +28 | AddressU、AddressV、または AddressW に D3D12_TEXTURE_ADDRESS_MODE_BORDER が指定されている場合に使用する境界色で、D3D12_STATIC_BORDER_COLOR のいずれかのメンバーです。 範囲は 0.0 以上 1.0 以下でなければなりません。 |
| MinLOD | FLOAT | 4 | +32 | +32 | アクセスをクランプするミップマップ範囲の下限です。0 が最も大きく詳細なミップマップレベルであり、それより大きいレベルほど詳細度が低くなります。 |
| MaxLOD | FLOAT | 4 | +36 | +36 | アクセスをクランプするミップマップ範囲の上限です。0 が最も大きく詳細なミップマップレベルであり、それより大きいレベルほど詳細度が低くなります。この値は MinLOD 以上でなければなりません。LOD に上限を設けない場合は、D3D12_FLOAT32_MAX のような大きな値を設定します。 |
| ShaderRegister | DWORD | 4 | +40 | +40 | ShaderRegister パラメーターと RegisterSpace パラメーターは、HLSL のバインド構文に対応します。たとえば HLSL では次のようになります。
これは ShaderRegister が 2 (型が SRV であることを示します)、RegisterSpace が 3 であることに対応します。 ShaderRegister と RegisterSpace の組み合わせは、ルート署名データ構造を使用して、シェーダーリソースと実行時のヒープ記述子との対応付けを確立するために必要です。 |
| RegisterSpace | DWORD | 4 | +44 | +44 | ShaderRegister の説明を参照してください。 レジスター空間の指定は省略可能で、既定のレジスター空間は 0 です。 |
| ShaderVisibility | D3D12_SHADER_VISIBILITY | 4 | +48 | +48 | パイプラインシェーダーに対するサンプラーの可視性を、D3D12_SHADER_VISIBILITY のいずれかのメンバーで指定します。 |
公式ドキュメント
静的サンプラーを記述します。
解説(Remarks)
この構造体は D3D12_ROOT_SIGNATURE_DESC 構造体と共に使用します。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#include <windows.h>
// D3D12_STATIC_SAMPLER_DESC (x64 52 / x86 52 バイト)
typedef struct D3D12_STATIC_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;
D3D12_STATIC_BORDER_COLOR BorderColor;
FLOAT MinLOD;
FLOAT MaxLOD;
DWORD ShaderRegister;
DWORD RegisterSpace;
D3D12_SHADER_VISIBILITY ShaderVisibility;
} D3D12_STATIC_SAMPLER_DESC;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_STATIC_SAMPLER_DESC
{
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;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_STATIC_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
Public BorderColor As Integer
Public MinLOD As Single
Public MaxLOD As Single
Public ShaderRegister As UInteger
Public RegisterSpace As UInteger
Public ShaderVisibility As Integer
End Structureimport ctypes
from ctypes import wintypes
class D3D12_STATIC_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_int),
("MinLOD", ctypes.c_float),
("MaxLOD", ctypes.c_float),
("ShaderRegister", wintypes.DWORD),
("RegisterSpace", wintypes.DWORD),
("ShaderVisibility", ctypes.c_int),
]#[repr(C)]
pub struct D3D12_STATIC_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: i32,
pub MinLOD: f32,
pub MaxLOD: f32,
pub ShaderRegister: u32,
pub RegisterSpace: u32,
pub ShaderVisibility: i32,
}import "golang.org/x/sys/windows"
type D3D12_STATIC_SAMPLER_DESC 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
}type
D3D12_STATIC_SAMPLER_DESC = 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;
end;const D3D12_STATIC_SAMPLER_DESC = 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,
};type
D3D12_STATIC_SAMPLER_DESC {.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: int32struct D3D12_STATIC_SAMPLER_DESC
{
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;
}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_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 : 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 も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global D3D12_STATIC_SAMPLER_DESC
#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
#endstruct
stdim st, D3D12_STATIC_SAMPLER_DESC ; NSTRUCT 変数を確保
st->Filter = 100
mes "Filter=" + st->Filter