ホーム › Graphics.Direct3D12 › D3D12_DEPTH_STENCIL_DESC
D3D12_DEPTH_STENCIL_DESC
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| DepthEnable | BOOL | 4 | +0 | +0 | 深度テストを有効にするか。TRUEで有効。 |
| DepthWriteMask | D3D12_DEPTH_WRITE_MASK | 4 | +4 | +4 | 深度書き込みの可否を示すD3D12_DEPTH_WRITE_MASK列挙値。 |
| DepthFunc | D3D12_COMPARISON_FUNC | 4 | +8 | +8 | 深度テストの比較関数を示すD3D12_COMPARISON_FUNC列挙値。 |
| StencilEnable | BOOL | 4 | +12 | +12 | ステンシルテストを有効にするか。TRUEで有効。 |
| StencilReadMask | BYTE | 1 | +16 | +16 | ステンシル読み取り時に適用するビットマスク。 |
| StencilWriteMask | BYTE | 1 | +17 | +17 | ステンシル書き込み時に適用するビットマスク。 |
| FrontFace | D3D12_DEPTH_STENCILOP_DESC | 16 | +20 | +20 | 表向きポリゴンに適用するステンシル処理を示すD3D12_DEPTH_STENCILOP_DESC。 |
| BackFace | D3D12_DEPTH_STENCILOP_DESC | 16 | +36 | +36 | 裏向きポリゴンに適用するステンシル処理を示すD3D12_DEPTH_STENCILOP_DESC。 |
各言語での定義
#include <windows.h>
// D3D12_DEPTH_STENCILOP_DESC (x64 16 / x86 16 バイト)
typedef struct D3D12_DEPTH_STENCILOP_DESC {
D3D12_STENCIL_OP StencilFailOp;
D3D12_STENCIL_OP StencilDepthFailOp;
D3D12_STENCIL_OP StencilPassOp;
D3D12_COMPARISON_FUNC StencilFunc;
} D3D12_DEPTH_STENCILOP_DESC;
// D3D12_DEPTH_STENCIL_DESC (x64 52 / x86 52 バイト)
typedef struct D3D12_DEPTH_STENCIL_DESC {
BOOL DepthEnable;
D3D12_DEPTH_WRITE_MASK DepthWriteMask;
D3D12_COMPARISON_FUNC DepthFunc;
BOOL StencilEnable;
BYTE StencilReadMask;
BYTE StencilWriteMask;
D3D12_DEPTH_STENCILOP_DESC FrontFace;
D3D12_DEPTH_STENCILOP_DESC BackFace;
} D3D12_DEPTH_STENCIL_DESC;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_DEPTH_STENCILOP_DESC
{
public int StencilFailOp;
public int StencilDepthFailOp;
public int StencilPassOp;
public int StencilFunc;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_DEPTH_STENCIL_DESC
{
[MarshalAs(UnmanagedType.Bool)] public bool DepthEnable;
public int DepthWriteMask;
public int DepthFunc;
[MarshalAs(UnmanagedType.Bool)] public bool StencilEnable;
public byte StencilReadMask;
public byte StencilWriteMask;
public D3D12_DEPTH_STENCILOP_DESC FrontFace;
public D3D12_DEPTH_STENCILOP_DESC BackFace;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_DEPTH_STENCILOP_DESC
Public StencilFailOp As Integer
Public StencilDepthFailOp As Integer
Public StencilPassOp As Integer
Public StencilFunc As Integer
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_DEPTH_STENCIL_DESC
<MarshalAs(UnmanagedType.Bool)> Public DepthEnable As Boolean
Public DepthWriteMask As Integer
Public DepthFunc As Integer
<MarshalAs(UnmanagedType.Bool)> Public StencilEnable As Boolean
Public StencilReadMask As Byte
Public StencilWriteMask As Byte
Public FrontFace As D3D12_DEPTH_STENCILOP_DESC
Public BackFace As D3D12_DEPTH_STENCILOP_DESC
End Structureimport ctypes
from ctypes import wintypes
class D3D12_DEPTH_STENCILOP_DESC(ctypes.Structure):
_fields_ = [
("StencilFailOp", ctypes.c_int),
("StencilDepthFailOp", ctypes.c_int),
("StencilPassOp", ctypes.c_int),
("StencilFunc", ctypes.c_int),
]
class D3D12_DEPTH_STENCIL_DESC(ctypes.Structure):
_fields_ = [
("DepthEnable", wintypes.BOOL),
("DepthWriteMask", ctypes.c_int),
("DepthFunc", ctypes.c_int),
("StencilEnable", wintypes.BOOL),
("StencilReadMask", ctypes.c_ubyte),
("StencilWriteMask", ctypes.c_ubyte),
("FrontFace", D3D12_DEPTH_STENCILOP_DESC),
("BackFace", D3D12_DEPTH_STENCILOP_DESC),
]#[repr(C)]
pub struct D3D12_DEPTH_STENCILOP_DESC {
pub StencilFailOp: i32,
pub StencilDepthFailOp: i32,
pub StencilPassOp: i32,
pub StencilFunc: i32,
}
#[repr(C)]
pub struct D3D12_DEPTH_STENCIL_DESC {
pub DepthEnable: i32,
pub DepthWriteMask: i32,
pub DepthFunc: i32,
pub StencilEnable: i32,
pub StencilReadMask: u8,
pub StencilWriteMask: u8,
pub FrontFace: D3D12_DEPTH_STENCILOP_DESC,
pub BackFace: D3D12_DEPTH_STENCILOP_DESC,
}import "golang.org/x/sys/windows"
type D3D12_DEPTH_STENCILOP_DESC struct {
StencilFailOp int32
StencilDepthFailOp int32
StencilPassOp int32
StencilFunc int32
}
type D3D12_DEPTH_STENCIL_DESC struct {
DepthEnable int32
DepthWriteMask int32
DepthFunc int32
StencilEnable int32
StencilReadMask byte
StencilWriteMask byte
FrontFace D3D12_DEPTH_STENCILOP_DESC
BackFace D3D12_DEPTH_STENCILOP_DESC
}type
D3D12_DEPTH_STENCILOP_DESC = record
StencilFailOp: Integer;
StencilDepthFailOp: Integer;
StencilPassOp: Integer;
StencilFunc: Integer;
end;
D3D12_DEPTH_STENCIL_DESC = record
DepthEnable: BOOL;
DepthWriteMask: Integer;
DepthFunc: Integer;
StencilEnable: BOOL;
StencilReadMask: Byte;
StencilWriteMask: Byte;
FrontFace: D3D12_DEPTH_STENCILOP_DESC;
BackFace: D3D12_DEPTH_STENCILOP_DESC;
end;const D3D12_DEPTH_STENCILOP_DESC = extern struct {
StencilFailOp: i32,
StencilDepthFailOp: i32,
StencilPassOp: i32,
StencilFunc: i32,
};
const D3D12_DEPTH_STENCIL_DESC = extern struct {
DepthEnable: i32,
DepthWriteMask: i32,
DepthFunc: i32,
StencilEnable: i32,
StencilReadMask: u8,
StencilWriteMask: u8,
FrontFace: D3D12_DEPTH_STENCILOP_DESC,
BackFace: D3D12_DEPTH_STENCILOP_DESC,
};type
D3D12_DEPTH_STENCILOP_DESC {.bycopy.} = object
StencilFailOp: int32
StencilDepthFailOp: int32
StencilPassOp: int32
StencilFunc: int32
D3D12_DEPTH_STENCIL_DESC {.bycopy.} = object
DepthEnable: int32
DepthWriteMask: int32
DepthFunc: int32
StencilEnable: int32
StencilReadMask: uint8
StencilWriteMask: uint8
FrontFace: D3D12_DEPTH_STENCILOP_DESC
BackFace: D3D12_DEPTH_STENCILOP_DESCstruct D3D12_DEPTH_STENCILOP_DESC
{
int StencilFailOp;
int StencilDepthFailOp;
int StencilPassOp;
int StencilFunc;
}
struct D3D12_DEPTH_STENCIL_DESC
{
int DepthEnable;
int DepthWriteMask;
int DepthFunc;
int StencilEnable;
ubyte StencilReadMask;
ubyte StencilWriteMask;
D3D12_DEPTH_STENCILOP_DESC FrontFace;
D3D12_DEPTH_STENCILOP_DESC BackFace;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3D12_DEPTH_STENCIL_DESC サイズ: 52 バイト(x64)
dim st, 13 ; 4byte整数×13(構造体サイズ 52 / 4 切り上げ)
; DepthEnable : BOOL (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; DepthWriteMask : D3D12_DEPTH_WRITE_MASK (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; DepthFunc : D3D12_COMPARISON_FUNC (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; StencilEnable : BOOL (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; StencilReadMask : BYTE (+16, 1byte) poke st,16,値 / 値 = peek(st,16)
; StencilWriteMask : BYTE (+17, 1byte) poke st,17,値 / 値 = peek(st,17)
; FrontFace : D3D12_DEPTH_STENCILOP_DESC (+20, 16byte) varptr(st)+20 を基点に操作(16byte:入れ子/配列)
; BackFace : D3D12_DEPTH_STENCILOP_DESC (+36, 16byte) varptr(st)+36 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global D3D12_DEPTH_STENCILOP_DESC
#field int StencilFailOp
#field int StencilDepthFailOp
#field int StencilPassOp
#field int StencilFunc
#endstruct
#defstruct global D3D12_DEPTH_STENCIL_DESC
#field bool DepthEnable
#field int DepthWriteMask
#field int DepthFunc
#field bool StencilEnable
#field byte StencilReadMask
#field byte StencilWriteMask
#field D3D12_DEPTH_STENCILOP_DESC FrontFace
#field D3D12_DEPTH_STENCILOP_DESC BackFace
#endstruct
stdim st, D3D12_DEPTH_STENCIL_DESC ; NSTRUCT 変数を確保
st->DepthEnable = 100
mes "DepthEnable=" + st->DepthEnable