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

D3D12_RASTERIZER_DESC2

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

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

フィールド

フィールドサイズx64x86説明
FillModeD3D12_FILL_MODE4+0+0三角形の塗りつぶし方法。ソリッドまたはワイヤフレームを指定する。
CullModeD3D12_CULL_MODE4+4+4カリング対象の面方向。前面・背面・なしを指定する。
FrontCounterClockwiseBOOL4+8+8反時計回りの頂点順を前面とみなすか。TRUEで反時計回りが前面。
DepthBiasFLOAT4+12+12深度値に加算する固定バイアス値。FLOAT型で指定する。
DepthBiasClampFLOAT4+16+16適用する深度バイアスの最大絶対値。0で制限なし。
SlopeScaledDepthBiasFLOAT4+20+20ポリゴンの傾きに比例して加算する深度バイアス係数。
DepthClipEnableBOOL4+24+24深度に基づくクリッピングを有効にするか。FALSEで近遠面クリップ無効。
LineRasterizationModeD3D12_LINE_RASTERIZATION_MODE4+28+28ラインのラスタライズ方式。アンチエイリアスや矩形ラインの種別を指定する。
ForcedSampleCountDWORD4+32+32UAVレンダリング時に強制するサンプル数。0で強制なし。
ConservativeRasterD3D12_CONSERVATIVE_RASTERIZATION_MODE4+36+36コンサバティブラスタライゼーションのモード。ONで保守的描画を行う。

各言語での定義

#include <windows.h>

// D3D12_RASTERIZER_DESC2  (x64 40 / x86 40 バイト)
typedef struct D3D12_RASTERIZER_DESC2 {
    D3D12_FILL_MODE FillMode;
    D3D12_CULL_MODE CullMode;
    BOOL FrontCounterClockwise;
    FLOAT DepthBias;
    FLOAT DepthBiasClamp;
    FLOAT SlopeScaledDepthBias;
    BOOL DepthClipEnable;
    D3D12_LINE_RASTERIZATION_MODE LineRasterizationMode;
    DWORD ForcedSampleCount;
    D3D12_CONSERVATIVE_RASTERIZATION_MODE ConservativeRaster;
} D3D12_RASTERIZER_DESC2;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_RASTERIZER_DESC2
{
    public int FillMode;
    public int CullMode;
    [MarshalAs(UnmanagedType.Bool)] public bool FrontCounterClockwise;
    public float DepthBias;
    public float DepthBiasClamp;
    public float SlopeScaledDepthBias;
    [MarshalAs(UnmanagedType.Bool)] public bool DepthClipEnable;
    public int LineRasterizationMode;
    public uint ForcedSampleCount;
    public int ConservativeRaster;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_RASTERIZER_DESC2
    Public FillMode As Integer
    Public CullMode As Integer
    <MarshalAs(UnmanagedType.Bool)> Public FrontCounterClockwise As Boolean
    Public DepthBias As Single
    Public DepthBiasClamp As Single
    Public SlopeScaledDepthBias As Single
    <MarshalAs(UnmanagedType.Bool)> Public DepthClipEnable As Boolean
    Public LineRasterizationMode As Integer
    Public ForcedSampleCount As UInteger
    Public ConservativeRaster As Integer
End Structure
import ctypes
from ctypes import wintypes

class D3D12_RASTERIZER_DESC2(ctypes.Structure):
    _fields_ = [
        ("FillMode", ctypes.c_int),
        ("CullMode", ctypes.c_int),
        ("FrontCounterClockwise", wintypes.BOOL),
        ("DepthBias", ctypes.c_float),
        ("DepthBiasClamp", ctypes.c_float),
        ("SlopeScaledDepthBias", ctypes.c_float),
        ("DepthClipEnable", wintypes.BOOL),
        ("LineRasterizationMode", ctypes.c_int),
        ("ForcedSampleCount", wintypes.DWORD),
        ("ConservativeRaster", ctypes.c_int),
    ]
#[repr(C)]
pub struct D3D12_RASTERIZER_DESC2 {
    pub FillMode: i32,
    pub CullMode: i32,
    pub FrontCounterClockwise: i32,
    pub DepthBias: f32,
    pub DepthBiasClamp: f32,
    pub SlopeScaledDepthBias: f32,
    pub DepthClipEnable: i32,
    pub LineRasterizationMode: i32,
    pub ForcedSampleCount: u32,
    pub ConservativeRaster: i32,
}
import "golang.org/x/sys/windows"

type D3D12_RASTERIZER_DESC2 struct {
	FillMode int32
	CullMode int32
	FrontCounterClockwise int32
	DepthBias float32
	DepthBiasClamp float32
	SlopeScaledDepthBias float32
	DepthClipEnable int32
	LineRasterizationMode int32
	ForcedSampleCount uint32
	ConservativeRaster int32
}
type
  D3D12_RASTERIZER_DESC2 = record
    FillMode: Integer;
    CullMode: Integer;
    FrontCounterClockwise: BOOL;
    DepthBias: Single;
    DepthBiasClamp: Single;
    SlopeScaledDepthBias: Single;
    DepthClipEnable: BOOL;
    LineRasterizationMode: Integer;
    ForcedSampleCount: DWORD;
    ConservativeRaster: Integer;
  end;
const D3D12_RASTERIZER_DESC2 = extern struct {
    FillMode: i32,
    CullMode: i32,
    FrontCounterClockwise: i32,
    DepthBias: f32,
    DepthBiasClamp: f32,
    SlopeScaledDepthBias: f32,
    DepthClipEnable: i32,
    LineRasterizationMode: i32,
    ForcedSampleCount: u32,
    ConservativeRaster: i32,
};
type
  D3D12_RASTERIZER_DESC2 {.bycopy.} = object
    FillMode: int32
    CullMode: int32
    FrontCounterClockwise: int32
    DepthBias: float32
    DepthBiasClamp: float32
    SlopeScaledDepthBias: float32
    DepthClipEnable: int32
    LineRasterizationMode: int32
    ForcedSampleCount: uint32
    ConservativeRaster: int32
struct D3D12_RASTERIZER_DESC2
{
    int FillMode;
    int CullMode;
    int FrontCounterClockwise;
    float DepthBias;
    float DepthBiasClamp;
    float SlopeScaledDepthBias;
    int DepthClipEnable;
    int LineRasterizationMode;
    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 レイアウト)
; D3D12_RASTERIZER_DESC2 サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; FillMode : D3D12_FILL_MODE (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; CullMode : D3D12_CULL_MODE (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; FrontCounterClockwise : BOOL (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; DepthBias : FLOAT (+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 も可)
; LineRasterizationMode : D3D12_LINE_RASTERIZATION_MODE (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; ForcedSampleCount : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; ConservativeRaster : D3D12_CONSERVATIVE_RASTERIZATION_MODE (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global D3D12_RASTERIZER_DESC2
    #field int FillMode
    #field int CullMode
    #field bool FrontCounterClockwise
    #field float DepthBias
    #field float DepthBiasClamp
    #field float SlopeScaledDepthBias
    #field bool DepthClipEnable
    #field int LineRasterizationMode
    #field int ForcedSampleCount
    #field int ConservativeRaster
#endstruct

stdim st, D3D12_RASTERIZER_DESC2        ; NSTRUCT 変数を確保
st->FillMode = 100
mes "FillMode=" + st->FillMode