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

D3D12_SHADER_CACHE_SESSION_DESC

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

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

フィールド

フィールドサイズx64x86説明
IdentifierGUID16+0+0シェーダーキャッシュセッションを識別するGUID。
ModeD3D12_SHADER_CACHE_MODE4+16+16キャッシュの動作モードを示す列挙値。メモリかディスクかを指定する。
FlagsD3D12_SHADER_CACHE_FLAGS4+20+20シェーダーキャッシュの動作を制御するフラグ。
MaximumInMemoryCacheSizeBytesDWORD4+24+24メモリ内キャッシュの最大サイズ(バイト単位)。
MaximumInMemoryCacheEntriesDWORD4+28+28メモリ内キャッシュの最大エントリ数。
MaximumValueFileSizeBytesDWORD4+32+32値ファイルの最大サイズ(バイト単位)。
VersionULONGLONG8+40+40アプリケーションが指定するキャッシュバージョン。

各言語での定義

#include <windows.h>

// D3D12_SHADER_CACHE_SESSION_DESC  (x64 48 / x86 48 バイト)
typedef struct D3D12_SHADER_CACHE_SESSION_DESC {
    GUID Identifier;
    D3D12_SHADER_CACHE_MODE Mode;
    D3D12_SHADER_CACHE_FLAGS Flags;
    DWORD MaximumInMemoryCacheSizeBytes;
    DWORD MaximumInMemoryCacheEntries;
    DWORD MaximumValueFileSizeBytes;
    ULONGLONG Version;
} D3D12_SHADER_CACHE_SESSION_DESC;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_SHADER_CACHE_SESSION_DESC
{
    public Guid Identifier;
    public int Mode;
    public int Flags;
    public uint MaximumInMemoryCacheSizeBytes;
    public uint MaximumInMemoryCacheEntries;
    public uint MaximumValueFileSizeBytes;
    public ulong Version;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_SHADER_CACHE_SESSION_DESC
    Public Identifier As Guid
    Public Mode As Integer
    Public Flags As Integer
    Public MaximumInMemoryCacheSizeBytes As UInteger
    Public MaximumInMemoryCacheEntries As UInteger
    Public MaximumValueFileSizeBytes As UInteger
    Public Version As ULong
End Structure
import ctypes
from ctypes import wintypes

class D3D12_SHADER_CACHE_SESSION_DESC(ctypes.Structure):
    _fields_ = [
        ("Identifier", GUID),
        ("Mode", ctypes.c_int),
        ("Flags", ctypes.c_int),
        ("MaximumInMemoryCacheSizeBytes", wintypes.DWORD),
        ("MaximumInMemoryCacheEntries", wintypes.DWORD),
        ("MaximumValueFileSizeBytes", wintypes.DWORD),
        ("Version", ctypes.c_ulonglong),
    ]
#[repr(C)]
pub struct D3D12_SHADER_CACHE_SESSION_DESC {
    pub Identifier: GUID,
    pub Mode: i32,
    pub Flags: i32,
    pub MaximumInMemoryCacheSizeBytes: u32,
    pub MaximumInMemoryCacheEntries: u32,
    pub MaximumValueFileSizeBytes: u32,
    pub Version: u64,
}
import "golang.org/x/sys/windows"

type D3D12_SHADER_CACHE_SESSION_DESC struct {
	Identifier windows.GUID
	Mode int32
	Flags int32
	MaximumInMemoryCacheSizeBytes uint32
	MaximumInMemoryCacheEntries uint32
	MaximumValueFileSizeBytes uint32
	Version uint64
}
type
  D3D12_SHADER_CACHE_SESSION_DESC = record
    Identifier: TGUID;
    Mode: Integer;
    Flags: Integer;
    MaximumInMemoryCacheSizeBytes: DWORD;
    MaximumInMemoryCacheEntries: DWORD;
    MaximumValueFileSizeBytes: DWORD;
    Version: UInt64;
  end;
const D3D12_SHADER_CACHE_SESSION_DESC = extern struct {
    Identifier: GUID,
    Mode: i32,
    Flags: i32,
    MaximumInMemoryCacheSizeBytes: u32,
    MaximumInMemoryCacheEntries: u32,
    MaximumValueFileSizeBytes: u32,
    Version: u64,
};
type
  D3D12_SHADER_CACHE_SESSION_DESC {.bycopy.} = object
    Identifier: GUID
    Mode: int32
    Flags: int32
    MaximumInMemoryCacheSizeBytes: uint32
    MaximumInMemoryCacheEntries: uint32
    MaximumValueFileSizeBytes: uint32
    Version: uint64
struct D3D12_SHADER_CACHE_SESSION_DESC
{
    GUID Identifier;
    int Mode;
    int Flags;
    uint MaximumInMemoryCacheSizeBytes;
    uint MaximumInMemoryCacheEntries;
    uint MaximumValueFileSizeBytes;
    ulong Version;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3D12_SHADER_CACHE_SESSION_DESC サイズ: 48 バイト(x64)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; Identifier : GUID (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; Mode : D3D12_SHADER_CACHE_MODE (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; Flags : D3D12_SHADER_CACHE_FLAGS (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; MaximumInMemoryCacheSizeBytes : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; MaximumInMemoryCacheEntries : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; MaximumValueFileSizeBytes : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; Version : ULONGLONG (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
    #field int Data1
    #field short Data2
    #field short Data3
    #field byte Data4 8
#endstruct

#defstruct global D3D12_SHADER_CACHE_SESSION_DESC
    #field GUID Identifier
    #field int Mode
    #field int Flags
    #field int MaximumInMemoryCacheSizeBytes
    #field int MaximumInMemoryCacheEntries
    #field int MaximumValueFileSizeBytes
    #field int64 Version
#endstruct

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