ホーム › Graphics.Direct3D12 › D3D12_TEXTURE_BARRIER
D3D12_TEXTURE_BARRIER
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| SyncBefore | D3D12_BARRIER_SYNC | 4 | +0 | +0 | バリア前に完了すべき同期スコープを示すフラグ。 |
| SyncAfter | D3D12_BARRIER_SYNC | 4 | +4 | +4 | バリア後に開始する同期スコープを示すフラグ。 |
| AccessBefore | D3D12_BARRIER_ACCESS | 4 | +8 | +8 | バリア前のアクセス種別を示すフラグ。 |
| AccessAfter | D3D12_BARRIER_ACCESS | 4 | +12 | +12 | バリア後のアクセス種別を示すフラグ。 |
| LayoutBefore | D3D12_BARRIER_LAYOUT | 4 | +16 | +16 | バリア前のテクスチャレイアウト。 |
| LayoutAfter | D3D12_BARRIER_LAYOUT | 4 | +20 | +20 | バリア後のテクスチャレイアウト。 |
| pResource | ID3D12Resource* | 8/4 | +24 | +24 | バリア対象のテクスチャリソースへのポインター。 |
| Subresources | D3D12_BARRIER_SUBRESOURCE_RANGE | 24 | +32 | +28 | バリアを適用するサブリソース範囲。 |
| Flags | D3D12_TEXTURE_BARRIER_FLAGS | 4 | +56 | +52 | テクスチャバリアの動作を制御するフラグ。 |
各言語での定義
#include <windows.h>
// D3D12_BARRIER_SUBRESOURCE_RANGE (x64 24 / x86 24 バイト)
typedef struct D3D12_BARRIER_SUBRESOURCE_RANGE {
DWORD IndexOrFirstMipLevel;
DWORD NumMipLevels;
DWORD FirstArraySlice;
DWORD NumArraySlices;
DWORD FirstPlane;
DWORD NumPlanes;
} D3D12_BARRIER_SUBRESOURCE_RANGE;
// D3D12_TEXTURE_BARRIER (x64 64 / x86 56 バイト)
typedef struct D3D12_TEXTURE_BARRIER {
D3D12_BARRIER_SYNC SyncBefore;
D3D12_BARRIER_SYNC SyncAfter;
D3D12_BARRIER_ACCESS AccessBefore;
D3D12_BARRIER_ACCESS AccessAfter;
D3D12_BARRIER_LAYOUT LayoutBefore;
D3D12_BARRIER_LAYOUT LayoutAfter;
ID3D12Resource* pResource;
D3D12_BARRIER_SUBRESOURCE_RANGE Subresources;
D3D12_TEXTURE_BARRIER_FLAGS Flags;
} D3D12_TEXTURE_BARRIER;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_BARRIER_SUBRESOURCE_RANGE
{
public uint IndexOrFirstMipLevel;
public uint NumMipLevels;
public uint FirstArraySlice;
public uint NumArraySlices;
public uint FirstPlane;
public uint NumPlanes;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_TEXTURE_BARRIER
{
public int SyncBefore;
public int SyncAfter;
public int AccessBefore;
public int AccessAfter;
public int LayoutBefore;
public int LayoutAfter;
public IntPtr pResource;
public D3D12_BARRIER_SUBRESOURCE_RANGE Subresources;
public int Flags;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_BARRIER_SUBRESOURCE_RANGE
Public IndexOrFirstMipLevel As UInteger
Public NumMipLevels As UInteger
Public FirstArraySlice As UInteger
Public NumArraySlices As UInteger
Public FirstPlane As UInteger
Public NumPlanes As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_TEXTURE_BARRIER
Public SyncBefore As Integer
Public SyncAfter As Integer
Public AccessBefore As Integer
Public AccessAfter As Integer
Public LayoutBefore As Integer
Public LayoutAfter As Integer
Public pResource As IntPtr
Public Subresources As D3D12_BARRIER_SUBRESOURCE_RANGE
Public Flags As Integer
End Structureimport ctypes
from ctypes import wintypes
class D3D12_BARRIER_SUBRESOURCE_RANGE(ctypes.Structure):
_fields_ = [
("IndexOrFirstMipLevel", wintypes.DWORD),
("NumMipLevels", wintypes.DWORD),
("FirstArraySlice", wintypes.DWORD),
("NumArraySlices", wintypes.DWORD),
("FirstPlane", wintypes.DWORD),
("NumPlanes", wintypes.DWORD),
]
class D3D12_TEXTURE_BARRIER(ctypes.Structure):
_fields_ = [
("SyncBefore", ctypes.c_int),
("SyncAfter", ctypes.c_int),
("AccessBefore", ctypes.c_int),
("AccessAfter", ctypes.c_int),
("LayoutBefore", ctypes.c_int),
("LayoutAfter", ctypes.c_int),
("pResource", ctypes.c_void_p),
("Subresources", D3D12_BARRIER_SUBRESOURCE_RANGE),
("Flags", ctypes.c_int),
]#[repr(C)]
pub struct D3D12_BARRIER_SUBRESOURCE_RANGE {
pub IndexOrFirstMipLevel: u32,
pub NumMipLevels: u32,
pub FirstArraySlice: u32,
pub NumArraySlices: u32,
pub FirstPlane: u32,
pub NumPlanes: u32,
}
#[repr(C)]
pub struct D3D12_TEXTURE_BARRIER {
pub SyncBefore: i32,
pub SyncAfter: i32,
pub AccessBefore: i32,
pub AccessAfter: i32,
pub LayoutBefore: i32,
pub LayoutAfter: i32,
pub pResource: *mut core::ffi::c_void,
pub Subresources: D3D12_BARRIER_SUBRESOURCE_RANGE,
pub Flags: i32,
}import "golang.org/x/sys/windows"
type D3D12_BARRIER_SUBRESOURCE_RANGE struct {
IndexOrFirstMipLevel uint32
NumMipLevels uint32
FirstArraySlice uint32
NumArraySlices uint32
FirstPlane uint32
NumPlanes uint32
}
type D3D12_TEXTURE_BARRIER struct {
SyncBefore int32
SyncAfter int32
AccessBefore int32
AccessAfter int32
LayoutBefore int32
LayoutAfter int32
pResource uintptr
Subresources D3D12_BARRIER_SUBRESOURCE_RANGE
Flags int32
}type
D3D12_BARRIER_SUBRESOURCE_RANGE = record
IndexOrFirstMipLevel: DWORD;
NumMipLevels: DWORD;
FirstArraySlice: DWORD;
NumArraySlices: DWORD;
FirstPlane: DWORD;
NumPlanes: DWORD;
end;
D3D12_TEXTURE_BARRIER = record
SyncBefore: Integer;
SyncAfter: Integer;
AccessBefore: Integer;
AccessAfter: Integer;
LayoutBefore: Integer;
LayoutAfter: Integer;
pResource: Pointer;
Subresources: D3D12_BARRIER_SUBRESOURCE_RANGE;
Flags: Integer;
end;const D3D12_BARRIER_SUBRESOURCE_RANGE = extern struct {
IndexOrFirstMipLevel: u32,
NumMipLevels: u32,
FirstArraySlice: u32,
NumArraySlices: u32,
FirstPlane: u32,
NumPlanes: u32,
};
const D3D12_TEXTURE_BARRIER = extern struct {
SyncBefore: i32,
SyncAfter: i32,
AccessBefore: i32,
AccessAfter: i32,
LayoutBefore: i32,
LayoutAfter: i32,
pResource: ?*anyopaque,
Subresources: D3D12_BARRIER_SUBRESOURCE_RANGE,
Flags: i32,
};type
D3D12_BARRIER_SUBRESOURCE_RANGE {.bycopy.} = object
IndexOrFirstMipLevel: uint32
NumMipLevels: uint32
FirstArraySlice: uint32
NumArraySlices: uint32
FirstPlane: uint32
NumPlanes: uint32
D3D12_TEXTURE_BARRIER {.bycopy.} = object
SyncBefore: int32
SyncAfter: int32
AccessBefore: int32
AccessAfter: int32
LayoutBefore: int32
LayoutAfter: int32
pResource: pointer
Subresources: D3D12_BARRIER_SUBRESOURCE_RANGE
Flags: int32struct D3D12_BARRIER_SUBRESOURCE_RANGE
{
uint IndexOrFirstMipLevel;
uint NumMipLevels;
uint FirstArraySlice;
uint NumArraySlices;
uint FirstPlane;
uint NumPlanes;
}
struct D3D12_TEXTURE_BARRIER
{
int SyncBefore;
int SyncAfter;
int AccessBefore;
int AccessAfter;
int LayoutBefore;
int LayoutAfter;
void* pResource;
D3D12_BARRIER_SUBRESOURCE_RANGE Subresources;
int Flags;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; D3D12_TEXTURE_BARRIER サイズ: 56 バイト(x86)
dim st, 14 ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; SyncBefore : D3D12_BARRIER_SYNC (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; SyncAfter : D3D12_BARRIER_SYNC (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; AccessBefore : D3D12_BARRIER_ACCESS (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; AccessAfter : D3D12_BARRIER_ACCESS (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; LayoutBefore : D3D12_BARRIER_LAYOUT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; LayoutAfter : D3D12_BARRIER_LAYOUT (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; pResource : ID3D12Resource* (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; Subresources : D3D12_BARRIER_SUBRESOURCE_RANGE (+28, 24byte) varptr(st)+28 を基点に操作(24byte:入れ子/配列)
; Flags : D3D12_TEXTURE_BARRIER_FLAGS (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3D12_TEXTURE_BARRIER サイズ: 64 バイト(x64)
dim st, 16 ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; SyncBefore : D3D12_BARRIER_SYNC (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; SyncAfter : D3D12_BARRIER_SYNC (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; AccessBefore : D3D12_BARRIER_ACCESS (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; AccessAfter : D3D12_BARRIER_ACCESS (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; LayoutBefore : D3D12_BARRIER_LAYOUT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; LayoutAfter : D3D12_BARRIER_LAYOUT (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; pResource : ID3D12Resource* (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; Subresources : D3D12_BARRIER_SUBRESOURCE_RANGE (+32, 24byte) varptr(st)+32 を基点に操作(24byte:入れ子/配列)
; Flags : D3D12_TEXTURE_BARRIER_FLAGS (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global D3D12_BARRIER_SUBRESOURCE_RANGE
#field int IndexOrFirstMipLevel
#field int NumMipLevels
#field int FirstArraySlice
#field int NumArraySlices
#field int FirstPlane
#field int NumPlanes
#endstruct
#defstruct global D3D12_TEXTURE_BARRIER
#field int SyncBefore
#field int SyncAfter
#field int AccessBefore
#field int AccessAfter
#field int LayoutBefore
#field int LayoutAfter
#field intptr pResource
#field D3D12_BARRIER_SUBRESOURCE_RANGE Subresources
#field int Flags
#endstruct
stdim st, D3D12_TEXTURE_BARRIER ; NSTRUCT 変数を確保
st->SyncBefore = 100
mes "SyncBefore=" + st->SyncBefore