D3D11_RASTERIZER_DESC2
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| FillMode | D3D11_FILL_MODE | 4 | +0 | +0 | レンダリング時に使用する塗りつぶしモードを決定する D3D11_FILL_MODE 型の値です。 |
| CullMode | D3D11_CULL_MODE | 4 | +4 | +4 | 指定した方向を向いた三角形を描画しないことを示す D3D11_CULL_MODE 型の値です。 |
| FrontCounterClockwise | BOOL | 4 | +8 | +8 | 三角形が前向きと後ろ向きのどちらであるかを指定します。TRUE の場合、レンダー ターゲット上で頂点が反時計回りに並ぶ三角形は前向きとみなされ、時計回りに並ぶ三角形は後ろ向きとみなされます。FALSE の場合はその逆になります。 |
| DepthBias | INT | 4 | +12 | +12 | 指定されたピクセルに加算される深度値です。深度バイアスについては、深度バイアスを参照してください。 |
| DepthBiasClamp | FLOAT | 4 | +16 | +16 | ピクセルの深度バイアスの最大値です。深度バイアスについては、深度バイアスを参照してください。 |
| SlopeScaledDepthBias | FLOAT | 4 | +20 | +20 | 指定されたピクセルの傾きに対するスカラー値です。深度バイアスについては、深度バイアスを参照してください。 |
| DepthClipEnable | BOOL | 4 | +24 | +24 | 距離に基づくクリッピングを有効にするかどうかを指定します。 ハードウェアは、ラスタライズされた座標の x および y のクリッピングを常に実行します。DepthClipEnable が既定値の TRUE に設定されている場合、ハードウェアは z の値もクリップします (つまり、次のアルゴリズムの最後の手順をハードウェアが実行します)。
DepthClipEnable を FALSE に設定すると、ハードウェアは z のクリッピング (前述のアルゴリズムの最後の手順) をスキップします。ただし、"0 < w" のクリッピングは引き続き実行されます。z のクリッピングを無効にすると、ピクセル レベルで深度の順序が不適切になる可能性があります。一方で、z のクリッピングを無効にすると、ステンシル シャドウの実装は簡素化されます。つまり、後方クリップ面を越えるジオメトリに対する複雑な特殊処理を回避できます。 |
| ScissorEnable | BOOL | 4 | +28 | +28 | シザー矩形によるカリングを有効にするかどうかを指定します。アクティブなシザー矩形の外側にあるピクセルはすべてカリングされます。 |
| MultisampleEnable | BOOL | 4 | +32 | +32 | マルチサンプル アンチエイリアシング (MSAA) レンダー ターゲットで、四角形とアルファ ラインのどちらのアンチエイリアシング アルゴリズムを使用するかを指定します。四角形ラインのアンチエイリアシング アルゴリズムを使用するには TRUE に、アルファ ラインのアンチエイリアシング アルゴリズムを使用するには FALSE に設定します。このメンバーの詳細については、「解説」を参照してください。 |
| AntialiasedLineEnable | BOOL | 4 | +36 | +36 | ラインのアンチエイリアシングを有効にするかどうかを指定します。これは、ラインを描画しており、かつ MultisampleEnable が FALSE の場合にのみ適用されます。このメンバーの詳細については、「解説」を参照してください。 |
| ForcedSampleCount | DWORD | 4 | +40 | +40 | UAV レンダリングまたはラスタライズの際に強制されるサンプル数です。有効な値は 0、1、2、4、8、および必要に応じて 16 です。0 はサンプル数を強制しないことを示します。 Note ForcedSampleCount を 1 以上に設定してレンダリングする場合は、次のガイドラインに従う必要があります。
|
| ConservativeRaster | D3D11_CONSERVATIVE_RASTERIZATION_MODE | 4 | +44 | +44 | コンサバティブ ラスタライゼーションが有効か無効かを示す D3D11_CONSERVATIVE_RASTERIZATION_MODE 型の値です。 |
公式ドキュメント
ラスタライザーの状態を記述します。
解説(Remarks)
ラスタライザーの状態は、ラスタライザー ステージの動作を定義します。ラスタライザー状態オブジェクトを作成するには、ID3D11Device3::CreateRasterizerState2 を呼び出します。ラスタライザーの状態を設定するには、ID3D11DeviceContext::RSSetState を呼び出します。
ラスタライザーの状態の一部を指定しない場合、Direct3D ランタイムはラスタライザーの状態として次の既定値を使用します。
| 状態 | 既定値 |
|---|---|
| FillMode | Solid |
| CullMode | Back |
| FrontCounterClockwise | FALSE |
| DepthBias | 0 |
| SlopeScaledDepthBias | 0.0f |
| DepthBiasClamp | 0.0f |
| DepthClipEnable | TRUE |
| ScissorEnable | FALSE |
| MultisampleEnable | FALSE |
| AntialiasedLineEnable | FALSE |
| ForcedSampleCount | 0 |
| ConservativeRaster | D3D11_CONSERVATIVE_RASTERIZATION_MODE_OFF |
| ライン レンダリング アルゴリズム | MultisampleEnable | AntialiasedLineEnable |
|---|---|---|
| エイリアスあり | FALSE | FALSE |
| アルファ アンチエイリアス | FALSE | TRUE |
| 四角形 | TRUE | FALSE |
| 四角形 | TRUE | TRUE |
MultisampleEnable メンバーと AntialiasedLineEnable メンバーの設定は、マルチサンプル アンチエイリアシング (MSAA) レンダー ターゲット (つまり、サンプル数が 1 より大きいレンダー ターゲット) にのみ適用されます。機能レベルによる動作の違いがあるため、ラインの描画を行わない場合、またはラインが四角形としてレンダリングされても差し支えない場合は、MSAA レンダー ターゲットにレンダリングする際は常に MultisampleEnable を TRUE に設定することをお勧めします。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#include <windows.h>
// D3D11_RASTERIZER_DESC2 (x64 48 / x86 48 バイト)
typedef struct D3D11_RASTERIZER_DESC2 {
D3D11_FILL_MODE FillMode;
D3D11_CULL_MODE CullMode;
BOOL FrontCounterClockwise;
INT DepthBias;
FLOAT DepthBiasClamp;
FLOAT SlopeScaledDepthBias;
BOOL DepthClipEnable;
BOOL ScissorEnable;
BOOL MultisampleEnable;
BOOL AntialiasedLineEnable;
DWORD ForcedSampleCount;
D3D11_CONSERVATIVE_RASTERIZATION_MODE ConservativeRaster;
} D3D11_RASTERIZER_DESC2;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D11_RASTERIZER_DESC2
{
public int FillMode;
public int CullMode;
[MarshalAs(UnmanagedType.Bool)] public bool FrontCounterClockwise;
public int DepthBias;
public float DepthBiasClamp;
public float SlopeScaledDepthBias;
[MarshalAs(UnmanagedType.Bool)] public bool DepthClipEnable;
[MarshalAs(UnmanagedType.Bool)] public bool ScissorEnable;
[MarshalAs(UnmanagedType.Bool)] public bool MultisampleEnable;
[MarshalAs(UnmanagedType.Bool)] public bool AntialiasedLineEnable;
public uint ForcedSampleCount;
public int ConservativeRaster;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D11_RASTERIZER_DESC2
Public FillMode As Integer
Public CullMode As Integer
<MarshalAs(UnmanagedType.Bool)> Public FrontCounterClockwise As Boolean
Public DepthBias As Integer
Public DepthBiasClamp As Single
Public SlopeScaledDepthBias As Single
<MarshalAs(UnmanagedType.Bool)> Public DepthClipEnable As Boolean
<MarshalAs(UnmanagedType.Bool)> Public ScissorEnable As Boolean
<MarshalAs(UnmanagedType.Bool)> Public MultisampleEnable As Boolean
<MarshalAs(UnmanagedType.Bool)> Public AntialiasedLineEnable As Boolean
Public ForcedSampleCount As UInteger
Public ConservativeRaster As Integer
End Structureimport ctypes
from ctypes import wintypes
class D3D11_RASTERIZER_DESC2(ctypes.Structure):
_fields_ = [
("FillMode", ctypes.c_int),
("CullMode", ctypes.c_int),
("FrontCounterClockwise", wintypes.BOOL),
("DepthBias", ctypes.c_int),
("DepthBiasClamp", ctypes.c_float),
("SlopeScaledDepthBias", ctypes.c_float),
("DepthClipEnable", wintypes.BOOL),
("ScissorEnable", wintypes.BOOL),
("MultisampleEnable", wintypes.BOOL),
("AntialiasedLineEnable", wintypes.BOOL),
("ForcedSampleCount", wintypes.DWORD),
("ConservativeRaster", ctypes.c_int),
]#[repr(C)]
pub struct D3D11_RASTERIZER_DESC2 {
pub FillMode: i32,
pub CullMode: i32,
pub FrontCounterClockwise: i32,
pub DepthBias: i32,
pub DepthBiasClamp: f32,
pub SlopeScaledDepthBias: f32,
pub DepthClipEnable: i32,
pub ScissorEnable: i32,
pub MultisampleEnable: i32,
pub AntialiasedLineEnable: i32,
pub ForcedSampleCount: u32,
pub ConservativeRaster: i32,
}import "golang.org/x/sys/windows"
type D3D11_RASTERIZER_DESC2 struct {
FillMode int32
CullMode int32
FrontCounterClockwise int32
DepthBias int32
DepthBiasClamp float32
SlopeScaledDepthBias float32
DepthClipEnable int32
ScissorEnable int32
MultisampleEnable int32
AntialiasedLineEnable int32
ForcedSampleCount uint32
ConservativeRaster int32
}type
D3D11_RASTERIZER_DESC2 = record
FillMode: Integer;
CullMode: Integer;
FrontCounterClockwise: BOOL;
DepthBias: Integer;
DepthBiasClamp: Single;
SlopeScaledDepthBias: Single;
DepthClipEnable: BOOL;
ScissorEnable: BOOL;
MultisampleEnable: BOOL;
AntialiasedLineEnable: BOOL;
ForcedSampleCount: DWORD;
ConservativeRaster: Integer;
end;const D3D11_RASTERIZER_DESC2 = extern struct {
FillMode: i32,
CullMode: i32,
FrontCounterClockwise: i32,
DepthBias: i32,
DepthBiasClamp: f32,
SlopeScaledDepthBias: f32,
DepthClipEnable: i32,
ScissorEnable: i32,
MultisampleEnable: i32,
AntialiasedLineEnable: i32,
ForcedSampleCount: u32,
ConservativeRaster: i32,
};type
D3D11_RASTERIZER_DESC2 {.bycopy.} = object
FillMode: int32
CullMode: int32
FrontCounterClockwise: int32
DepthBias: int32
DepthBiasClamp: float32
SlopeScaledDepthBias: float32
DepthClipEnable: int32
ScissorEnable: int32
MultisampleEnable: int32
AntialiasedLineEnable: int32
ForcedSampleCount: uint32
ConservativeRaster: int32struct D3D11_RASTERIZER_DESC2
{
int FillMode;
int CullMode;
int FrontCounterClockwise;
int DepthBias;
float DepthBiasClamp;
float SlopeScaledDepthBias;
int DepthClipEnable;
int ScissorEnable;
int MultisampleEnable;
int AntialiasedLineEnable;
uint ForcedSampleCount;
int ConservativeRaster;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3D11_RASTERIZER_DESC2 サイズ: 48 バイト(x64)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; FillMode : D3D11_FILL_MODE (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; CullMode : D3D11_CULL_MODE (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; FrontCounterClockwise : BOOL (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; DepthBias : INT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; DepthBiasClamp : FLOAT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; SlopeScaledDepthBias : FLOAT (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; DepthClipEnable : BOOL (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; ScissorEnable : BOOL (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; MultisampleEnable : BOOL (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; AntialiasedLineEnable : BOOL (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; ForcedSampleCount : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; ConservativeRaster : D3D11_CONSERVATIVE_RASTERIZATION_MODE (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global D3D11_RASTERIZER_DESC2
#field int FillMode
#field int CullMode
#field bool FrontCounterClockwise
#field int DepthBias
#field float DepthBiasClamp
#field float SlopeScaledDepthBias
#field bool DepthClipEnable
#field bool ScissorEnable
#field bool MultisampleEnable
#field bool AntialiasedLineEnable
#field int ForcedSampleCount
#field int ConservativeRaster
#endstruct
stdim st, D3D11_RASTERIZER_DESC2 ; NSTRUCT 変数を確保
st->FillMode = 100
mes "FillMode=" + st->FillMode