ホーム › Graphics.Direct3D12 › D3D12_DEPTH_STENCIL_DESC2
D3D12_DEPTH_STENCIL_DESC2
構造体サイズ=各フィールドのバイト数(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で有効。 |
| FrontFace | D3D12_DEPTH_STENCILOP_DESC1 | 20 | +16 | +16 | 表向きポリゴンに適用するステンシル処理を示すD3D12_DEPTH_STENCILOP_DESC1。 |
| BackFace | D3D12_DEPTH_STENCILOP_DESC1 | 20 | +36 | +36 | 裏向きポリゴンに適用するステンシル処理を示すD3D12_DEPTH_STENCILOP_DESC1。 |
| DepthBoundsTestEnable | BOOL | 4 | +56 | +56 | 深度境界テストを有効にするか。TRUEで有効。 |
各言語での定義
#include <windows.h>
// D3D12_DEPTH_STENCILOP_DESC1 (x64 20 / x86 20 バイト)
typedef struct D3D12_DEPTH_STENCILOP_DESC1 {
D3D12_STENCIL_OP StencilFailOp;
D3D12_STENCIL_OP StencilDepthFailOp;
D3D12_STENCIL_OP StencilPassOp;
D3D12_COMPARISON_FUNC StencilFunc;
BYTE StencilReadMask;
BYTE StencilWriteMask;
} D3D12_DEPTH_STENCILOP_DESC1;
// D3D12_DEPTH_STENCIL_DESC2 (x64 60 / x86 60 バイト)
typedef struct D3D12_DEPTH_STENCIL_DESC2 {
BOOL DepthEnable;
D3D12_DEPTH_WRITE_MASK DepthWriteMask;
D3D12_COMPARISON_FUNC DepthFunc;
BOOL StencilEnable;
D3D12_DEPTH_STENCILOP_DESC1 FrontFace;
D3D12_DEPTH_STENCILOP_DESC1 BackFace;
BOOL DepthBoundsTestEnable;
} D3D12_DEPTH_STENCIL_DESC2;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_DEPTH_STENCILOP_DESC1
{
public int StencilFailOp;
public int StencilDepthFailOp;
public int StencilPassOp;
public int StencilFunc;
public byte StencilReadMask;
public byte StencilWriteMask;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_DEPTH_STENCIL_DESC2
{
[MarshalAs(UnmanagedType.Bool)] public bool DepthEnable;
public int DepthWriteMask;
public int DepthFunc;
[MarshalAs(UnmanagedType.Bool)] public bool StencilEnable;
public D3D12_DEPTH_STENCILOP_DESC1 FrontFace;
public D3D12_DEPTH_STENCILOP_DESC1 BackFace;
[MarshalAs(UnmanagedType.Bool)] public bool DepthBoundsTestEnable;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_DEPTH_STENCILOP_DESC1
Public StencilFailOp As Integer
Public StencilDepthFailOp As Integer
Public StencilPassOp As Integer
Public StencilFunc As Integer
Public StencilReadMask As Byte
Public StencilWriteMask As Byte
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_DEPTH_STENCIL_DESC2
<MarshalAs(UnmanagedType.Bool)> Public DepthEnable As Boolean
Public DepthWriteMask As Integer
Public DepthFunc As Integer
<MarshalAs(UnmanagedType.Bool)> Public StencilEnable As Boolean
Public FrontFace As D3D12_DEPTH_STENCILOP_DESC1
Public BackFace As D3D12_DEPTH_STENCILOP_DESC1
<MarshalAs(UnmanagedType.Bool)> Public DepthBoundsTestEnable As Boolean
End Structureimport ctypes
from ctypes import wintypes
class D3D12_DEPTH_STENCILOP_DESC1(ctypes.Structure):
_fields_ = [
("StencilFailOp", ctypes.c_int),
("StencilDepthFailOp", ctypes.c_int),
("StencilPassOp", ctypes.c_int),
("StencilFunc", ctypes.c_int),
("StencilReadMask", ctypes.c_ubyte),
("StencilWriteMask", ctypes.c_ubyte),
]
class D3D12_DEPTH_STENCIL_DESC2(ctypes.Structure):
_fields_ = [
("DepthEnable", wintypes.BOOL),
("DepthWriteMask", ctypes.c_int),
("DepthFunc", ctypes.c_int),
("StencilEnable", wintypes.BOOL),
("FrontFace", D3D12_DEPTH_STENCILOP_DESC1),
("BackFace", D3D12_DEPTH_STENCILOP_DESC1),
("DepthBoundsTestEnable", wintypes.BOOL),
]#[repr(C)]
pub struct D3D12_DEPTH_STENCILOP_DESC1 {
pub StencilFailOp: i32,
pub StencilDepthFailOp: i32,
pub StencilPassOp: i32,
pub StencilFunc: i32,
pub StencilReadMask: u8,
pub StencilWriteMask: u8,
}
#[repr(C)]
pub struct D3D12_DEPTH_STENCIL_DESC2 {
pub DepthEnable: i32,
pub DepthWriteMask: i32,
pub DepthFunc: i32,
pub StencilEnable: i32,
pub FrontFace: D3D12_DEPTH_STENCILOP_DESC1,
pub BackFace: D3D12_DEPTH_STENCILOP_DESC1,
pub DepthBoundsTestEnable: i32,
}import "golang.org/x/sys/windows"
type D3D12_DEPTH_STENCILOP_DESC1 struct {
StencilFailOp int32
StencilDepthFailOp int32
StencilPassOp int32
StencilFunc int32
StencilReadMask byte
StencilWriteMask byte
}
type D3D12_DEPTH_STENCIL_DESC2 struct {
DepthEnable int32
DepthWriteMask int32
DepthFunc int32
StencilEnable int32
FrontFace D3D12_DEPTH_STENCILOP_DESC1
BackFace D3D12_DEPTH_STENCILOP_DESC1
DepthBoundsTestEnable int32
}type
D3D12_DEPTH_STENCILOP_DESC1 = record
StencilFailOp: Integer;
StencilDepthFailOp: Integer;
StencilPassOp: Integer;
StencilFunc: Integer;
StencilReadMask: Byte;
StencilWriteMask: Byte;
end;
D3D12_DEPTH_STENCIL_DESC2 = record
DepthEnable: BOOL;
DepthWriteMask: Integer;
DepthFunc: Integer;
StencilEnable: BOOL;
FrontFace: D3D12_DEPTH_STENCILOP_DESC1;
BackFace: D3D12_DEPTH_STENCILOP_DESC1;
DepthBoundsTestEnable: BOOL;
end;const D3D12_DEPTH_STENCILOP_DESC1 = extern struct {
StencilFailOp: i32,
StencilDepthFailOp: i32,
StencilPassOp: i32,
StencilFunc: i32,
StencilReadMask: u8,
StencilWriteMask: u8,
};
const D3D12_DEPTH_STENCIL_DESC2 = extern struct {
DepthEnable: i32,
DepthWriteMask: i32,
DepthFunc: i32,
StencilEnable: i32,
FrontFace: D3D12_DEPTH_STENCILOP_DESC1,
BackFace: D3D12_DEPTH_STENCILOP_DESC1,
DepthBoundsTestEnable: i32,
};type
D3D12_DEPTH_STENCILOP_DESC1 {.bycopy.} = object
StencilFailOp: int32
StencilDepthFailOp: int32
StencilPassOp: int32
StencilFunc: int32
StencilReadMask: uint8
StencilWriteMask: uint8
D3D12_DEPTH_STENCIL_DESC2 {.bycopy.} = object
DepthEnable: int32
DepthWriteMask: int32
DepthFunc: int32
StencilEnable: int32
FrontFace: D3D12_DEPTH_STENCILOP_DESC1
BackFace: D3D12_DEPTH_STENCILOP_DESC1
DepthBoundsTestEnable: int32struct D3D12_DEPTH_STENCILOP_DESC1
{
int StencilFailOp;
int StencilDepthFailOp;
int StencilPassOp;
int StencilFunc;
ubyte StencilReadMask;
ubyte StencilWriteMask;
}
struct D3D12_DEPTH_STENCIL_DESC2
{
int DepthEnable;
int DepthWriteMask;
int DepthFunc;
int StencilEnable;
D3D12_DEPTH_STENCILOP_DESC1 FrontFace;
D3D12_DEPTH_STENCILOP_DESC1 BackFace;
int DepthBoundsTestEnable;
}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_DESC2 サイズ: 60 バイト(x64)
dim st, 15 ; 4byte整数×15(構造体サイズ 60 / 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 も可)
; FrontFace : D3D12_DEPTH_STENCILOP_DESC1 (+16, 20byte) varptr(st)+16 を基点に操作(20byte:入れ子/配列)
; BackFace : D3D12_DEPTH_STENCILOP_DESC1 (+36, 20byte) varptr(st)+36 を基点に操作(20byte:入れ子/配列)
; DepthBoundsTestEnable : BOOL (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global D3D12_DEPTH_STENCILOP_DESC1
#field int StencilFailOp
#field int StencilDepthFailOp
#field int StencilPassOp
#field int StencilFunc
#field byte StencilReadMask
#field byte StencilWriteMask
#endstruct
#defstruct global D3D12_DEPTH_STENCIL_DESC2
#field bool DepthEnable
#field int DepthWriteMask
#field int DepthFunc
#field bool StencilEnable
#field D3D12_DEPTH_STENCILOP_DESC1 FrontFace
#field D3D12_DEPTH_STENCILOP_DESC1 BackFace
#field bool DepthBoundsTestEnable
#endstruct
stdim st, D3D12_DEPTH_STENCIL_DESC2 ; NSTRUCT 変数を確保
st->DepthEnable = 100
mes "DepthEnable=" + st->DepthEnable