Home

Resume

Blog

Teikitu


/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
/*  »Project«   Teikitu Gaming System (TgS) (∂)
    »File«      TgS Kernel - Data.c
    »Author«    Andrew Aye (EMail: mailto:andrew.aye@gmail.com, Web: http://www.andrewaye.com)
    »Version«   4.51 / »GUID« A9981407-3EC9-42AF-8B6F-8BE6DD919615                                                                                                        */
/*   -------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
/*  Copyright: © 2002-2017, Andrew Aye.  All Rights Reserved.
    This software is free for non-commercial use.  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
      following conditions are met:
        Redistribution of source code must retain this copyright notice, this list of conditions and the following disclaimers.
        Redistribution in binary form must reproduce this copyright notice, this list of conditions and the following disclaimers in the documentation and other materials
          provided with the distribution.
    The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
    The intellectual property rights of the algorithms used reside with Andrew Aye.
    You may not use this software, in whole or in part, in support of any commercial product without the express written consent of the author.
    There is no warranty or other guarantee of fitness of this software for any purpose. It is provided solely "as is".                                                   */
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
/* == Kernel ============================================================================================================================================================ */

/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  System ID                                                                                                                                                             */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

TgKI_DEFINE(KN_NOTIFY_ID);
TgKI_DEFINE(KN_FILE_SYSTEM_ID);
TgKI_DEFINE(KN_FS_MOUNT_ID);
TgKI_DEFINE(KN_FILE_ID);
TgKI_DEFINE(KN_FILE_JOB_ID);

#if defined(TgCOMPILE_GPU_SUPPORT)
TgKI_DEFINE(KN_GPU_CXT_DEVC_ID); /* GPU Device Context ID */
TgKI_DEFINE(KN_GPU_CXT_SWAP_ID); /* GPU Output Context ID */
TgKI_DEFINE(KN_GPU_CXT_DATA_ID); /* GPU Resource Context ID */
TgKI_DEFINE(KN_GPU_CXT_EXTN_ID); /* GPU External Context ID */
TgKI_DEFINE(KN_GPU_CXT_ID); /* GPU Render Context ID */
TgKI_DEFINE(KN_GPU_RS_ID); /* GPU Resource ID */ /* #IMPLEMENT */
TgKI_DEFINE(KN_GPU_RSI_ID); /* GPU Resource Instance ID */ /* #IMPLEMENT */
TgKI_DEFINE(KN_TX_CBE_ID); /* #IMPLEMENT */
TgKI_DEFINE(KN_TX_IMG_ID); /* #IMPLEMENT */
TgKI_DEFINE(KN_TX_VOL_ID); /* #IMPLEMENT */
TgKI_DEFINE(KN_SH_ID); /* #IMPLEMENT */ /* Shader */
TgKI_DEFINE(KN_VX_ID); /* #IMPLEMENT */ /* Vertex Stream */
TgKI_DEFINE(KN_IX_ID); /* #IMPLEMENT */ /* Index Stream */
/*# defined(TgCOMPILE_GPU_SUPPORT) */
#endif



/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  Public Data                                                                                                                                                           */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

TgJOB_QUEUE_ID                              g_sJob_Stack__JiT;
TgJOB_QUEUE_ID                              g_sJob_Queue__Render_High;
TgJOB_QUEUE_ID                              g_sJob_Queue__Render_Normal;
TgJOB_QUEUE_ID                              g_sJob_Queue__GPU;
TgJOB_QUEUE_ID                              g_sJob_Queue__Client_High;
TgJOB_QUEUE_ID                              g_sJob_Queue__Client_Normal;
TgJOB_QUEUE_ID                              g_sJob_Queue__Client_Low;

TgKN_FS_MOUNT_ID                            g_tiKN_FS_HDD__Mount_APP;




/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  Private Data                                                                                                                                                          */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

STg2_KN_Notify                              g_asKN_Notify_Data[KTgKN_MAX_NOTIFY_ENTRIES];
TgUINT32                                    g_auiKN_Notify_MSG[KTgKN_MAX_NOTIFY_ENTRIES];
TgSINT32                                    g_aiKN_Notify_Next[KTgKN_MAX_NOTIFY_ENTRIES];
TgKN_NOTIFY_ID                              g_atiKN_Notify[KTgKN_MAX_NOTIFY_ENTRIES];
TgSINT32                                    g_aiKN_Notify_List[KTgHASH_MD_SIZE];
STg2_UTM_SN_ISO                             g_sKN_Notfiy_Lock;
TgSINT32                                    g_iKN_Notfiy_Free_Index;

STg2_KN_File_System                         g_asKN_FS[KTgKN_MAX_FILE_SYSTEM];
TgSINT32                                    g_niKN_FS;
STg2_KN_FS_Mount                            g_asKN_FS_Mount[KTgKN_MAX_FILE_SYSTEM_MOUNT];
STg2_UTM_AM_ST_ISO                          g_sKN_FS_Mount__Free_Stack; /* Atomic Stack to acquire a new file */
STg2_KN_File_Info                           g_asKN_File_Info[KTgKN_MAX_FILE_OPEN];
STg2_UTM_AM_ST_ISO                          g_sKN_File_Info__Free_Stack; /* Atomic Stack to acquire a new file */
STg2_KN_File_Job                            g_asKN_File_Job[KTgKN_MAX_FILE_JOB];
STg2_UTM_AM_ST_ISO                          g_sKN_File_Job__Free_Stack; /* Atomic Stack to acquire a new job */

TgKN_FILE_SYSTEM_ID                         g_tiKN_FS_HDD;




/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  Private GPU Data                                                                                                                                                      */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
#if defined(TgCOMPILE_GPU_SUPPORT)
STg2_KN_GPU_Adapter                         g_asKN_GPU_Adapter[KTgKN_GPU_MAX_ADAPTER];
TgSINT32                                    g_niKN_GPU_Adapter;
STg2_KN_GPU_Context__Device                 g_asKN_GPU_Context_Device[KTgKN_GPU_MAX_DEVC_CONTEXT];
STg2_UTM_AM_ST_ISO                          g_sKN_GPU_Context_Device__Free_Stack;
STg2_KN_GPU_Context__Output                 g_asKN_GPU_Context_Output[KTgKN_GPU_MAX_OUTPUT];
STg2_UTM_AM_ST_ISO                          g_sKN_GPU_Context_Output__Free_Stack;
STg2_KN_GPU_Context__Resource               g_asKN_GPU_Context_Resource[KTgKN_GPU_MAX_RESOURCE_CONTEXT];
STg2_UTM_AM_ST_ISO                          g_sKN_GPU_Context_Resource__Free_Stack;
STg2_KN_GPU_Context__External               g_asKN_GPU_Context_External[KTgKN_GPU_MAX_RESOURCE_CONTEXT];
STg2_UTM_AM_ST_ISO                          g_sKN_GPU_Context_External__Free_Stack;
STg2_KN_GPU_Context                         g_asKN_GPU_Context[KTgKN_GPU_MAX_CONTEXT];
STg2_UTM_AM_ST_ISO                          g_sKN_GPU_Context__Free_Stack;
/*# defined(TgCOMPILE_GPU_SUPPORT) */
#endif


/* ---- GPU Resource - Shader ------------------------------------------------------------------------------------------------------------------------------------------- */
#if defined(TgCOMPILE_GPU_SUPPORT)

TgUINTXX                                    g_asKN_Lib_CS_Hash[KTgKN_GPU_MAX_CS];
TgKN_GPU_RS_ID                              g_atiKN_Lib_CS_RS[KTgKN_GPU_MAX_CS];
volatile TgSINT32                           g_aiKN_Lib_CS_Ref[KTgKN_GPU_MAX_CS];
STg2_KN_GPU_CS_DATA                         g_asKN_Lib_CS_Data[KTgKN_GPU_MAX_CS];
STg2_UTM_AM_ST_ISO                          g_sKN_Lib_CS;
STg2_UTM_SN_ISO                             g_sKN_Lib_CS_Lock;
STg2_KN_GPU_RS_LIB_DESC                     g_sKN_Lib_CS_DESC;

TgKN_GPU_RSI_ID                             g_atiCXT_CS_Inst[KTgKN_GPU_MAX_RESOURCE_CONTEXT][KTgKN_GPU_MAX_CS];
TgKN_GPU_RS_ID                              g_atiCXT_CS[KTgKN_GPU_MAX_RESOURCE_CONTEXT][KTgKN_GPU_MAX_CS];
volatile TgSINT32                           g_aiCXT_CS_Inst_Ref[KTgKN_GPU_MAX_RESOURCE_CONTEXT][KTgKN_GPU_MAX_CS];
STg2_UTM_AM_ST_ISO                          g_sCXT_CS_Inst[KTgKN_GPU_MAX_RESOURCE_CONTEXT];
STg2_UTM_SN_ISO                             g_sCXT_CS_Inst_Lock[KTgKN_GPU_MAX_RESOURCE_CONTEXT];

TgUINTXX                                    g_asKN_Lib_HS_Hash[KTgKN_GPU_MAX_HS];
TgKN_GPU_RS_ID                              g_atiKN_Lib_HS_RS[KTgKN_GPU_MAX_HS];
volatile TgSINT32                           g_aiKN_Lib_HS_Ref[KTgKN_GPU_MAX_HS];
STg2_KN_GPU_HS_DATA                         g_asKN_Lib_HS_Data[KTgKN_GPU_MAX_HS];
STg2_UTM_AM_ST_ISO                          g_sKN_Lib_HS;
STg2_UTM_SN_ISO                             g_sKN_Lib_HS_Lock;
STg2_KN_GPU_RS_LIB_DESC                     g_sKN_Lib_HS_DESC;

TgKN_GPU_RSI_ID                             g_atiCXT_HS_Inst[KTgKN_GPU_MAX_RESOURCE_CONTEXT][KTgKN_GPU_MAX_HS];
TgKN_GPU_RS_ID                              g_atiCXT_HS[KTgKN_GPU_MAX_RESOURCE_CONTEXT][KTgKN_GPU_MAX_HS];
volatile TgSINT32                           g_aiCXT_HS_Inst_Ref[KTgKN_GPU_MAX_RESOURCE_CONTEXT][KTgKN_GPU_MAX_HS];
STg2_UTM_AM_ST_ISO                          g_sCXT_HS_Inst[KTgKN_GPU_MAX_RESOURCE_CONTEXT];
STg2_UTM_SN_ISO                             g_sCXT_HS_Inst_Lock[KTgKN_GPU_MAX_RESOURCE_CONTEXT];

TgUINTXX                                    g_asKN_Lib_DS_Hash[KTgKN_GPU_MAX_DS];
TgKN_GPU_RS_ID                              g_atiKN_Lib_DS_RS[KTgKN_GPU_MAX_DS];
volatile TgSINT32                           g_aiKN_Lib_DS_Ref[KTgKN_GPU_MAX_DS];
STg2_KN_GPU_DS_DATA                         g_asKN_Lib_DS_Data[KTgKN_GPU_MAX_DS];
STg2_UTM_AM_ST_ISO                          g_sKN_Lib_DS;
STg2_UTM_SN_ISO                             g_sKN_Lib_DS_Lock;
STg2_KN_GPU_RS_LIB_DESC                     g_sKN_Lib_DS_DESC;

TgKN_GPU_RSI_ID                             g_atiCXT_DS_Inst[KTgKN_GPU_MAX_RESOURCE_CONTEXT][KTgKN_GPU_MAX_DS];
TgKN_GPU_RS_ID                              g_atiCXT_DS[KTgKN_GPU_MAX_RESOURCE_CONTEXT][KTgKN_GPU_MAX_DS];
volatile TgSINT32                           g_aiCXT_DS_Inst_Ref[KTgKN_GPU_MAX_RESOURCE_CONTEXT][KTgKN_GPU_MAX_DS];
STg2_UTM_AM_ST_ISO                          g_sCXT_DS_Inst[KTgKN_GPU_MAX_RESOURCE_CONTEXT];
STg2_UTM_SN_ISO                             g_sCXT_DS_Inst_Lock[KTgKN_GPU_MAX_RESOURCE_CONTEXT];

TgUINTXX                                    g_asKN_Lib_VS_Hash[KTgKN_GPU_MAX_VS];
TgKN_GPU_RS_ID                              g_atiKN_Lib_VS_RS[KTgKN_GPU_MAX_VS];
volatile TgSINT32                           g_aiKN_Lib_VS_Ref[KTgKN_GPU_MAX_VS];
STg2_KN_GPU_VS_DATA                         g_asKN_Lib_VS_Data[KTgKN_GPU_MAX_VS];
STg2_UTM_AM_ST_ISO                          g_sKN_Lib_VS;
STg2_UTM_SN_ISO                             g_sKN_Lib_VS_Lock;
STg2_KN_GPU_RS_LIB_DESC                     g_sKN_Lib_VS_DESC;

TgUINTXX                                    g_asKN_Lib_GS_Hash[KTgKN_GPU_MAX_GS];
TgKN_GPU_RS_ID                              g_atiKN_Lib_GS_RS[KTgKN_GPU_MAX_GS];
volatile TgSINT32                           g_aiKN_Lib_GS_Ref[KTgKN_GPU_MAX_GS];
STg2_KN_GPU_GS_DATA                         g_asKN_Lib_GS_Data[KTgKN_GPU_MAX_GS];
STg2_UTM_AM_ST_ISO                          g_sKN_Lib_GS;
STg2_UTM_SN_ISO                             g_sKN_Lib_GS_Lock;
STg2_KN_GPU_RS_LIB_DESC                     g_sKN_Lib_GS_DESC;

TgKN_GPU_RSI_ID                             g_atiCXT_GS_Inst[KTgKN_GPU_MAX_RESOURCE_CONTEXT][KTgKN_GPU_MAX_GS];
TgKN_GPU_RS_ID                              g_atiCXT_GS[KTgKN_GPU_MAX_RESOURCE_CONTEXT][KTgKN_GPU_MAX_GS];
volatile TgSINT32                           g_aiCXT_GS_Inst_Ref[KTgKN_GPU_MAX_RESOURCE_CONTEXT][KTgKN_GPU_MAX_GS];
STg2_UTM_AM_ST_ISO                          g_sCXT_GS_Inst[KTgKN_GPU_MAX_RESOURCE_CONTEXT];
STg2_UTM_SN_ISO                             g_sCXT_GS_Inst_Lock[KTgKN_GPU_MAX_RESOURCE_CONTEXT];

TgUINTXX                                    g_asKN_Lib_PS_Hash[KTgKN_GPU_MAX_PS];
TgKN_GPU_RS_ID                              g_atiKN_Lib_PS_RS[KTgKN_GPU_MAX_PS];
volatile TgSINT32                           g_aiKN_Lib_PS_Ref[KTgKN_GPU_MAX_PS];
STg2_KN_GPU_PS_DATA                         g_asKN_Lib_PS_Data[KTgKN_GPU_MAX_PS];
STg2_UTM_AM_ST_ISO                          g_sKN_Lib_PS;
STg2_UTM_SN_ISO                             g_sKN_Lib_PS_Lock;
STg2_KN_GPU_RS_LIB_DESC                     g_sKN_Lib_PS_DESC;

TgKN_GPU_RSI_ID                             g_atiCXT_PS_Inst[KTgKN_GPU_MAX_RESOURCE_CONTEXT][KTgKN_GPU_MAX_PS];
TgKN_GPU_RS_ID                              g_atiCXT_PS[KTgKN_GPU_MAX_RESOURCE_CONTEXT][KTgKN_GPU_MAX_PS];
volatile TgSINT32                           g_aiCXT_PS_Inst_Ref[KTgKN_GPU_MAX_RESOURCE_CONTEXT][KTgKN_GPU_MAX_PS];
STg2_UTM_AM_ST_ISO                          g_sCXT_PS_Inst[KTgKN_GPU_MAX_RESOURCE_CONTEXT];
STg2_UTM_SN_ISO                             g_sCXT_PS_Inst_Lock[KTgKN_GPU_MAX_RESOURCE_CONTEXT];

/*# defined(TgCOMPILE_GPU_SUPPORT) */
#endif


/* ---- GPU Resource - Input -------------------------------------------------------------------------------------------------------------------------------------------- */
#if defined(TgCOMPILE_GPU_SUPPORT)

TgUINTXX                                    g_asKN_Lib_VT_Hash[KTgKN_GPU_MAX_VT];
TgKN_GPU_RS_ID                              g_aniKN_Lib_VT_RS[KTgKN_GPU_MAX_VT];
volatile TgSINT32                           g_aiKN_Lib_VT_Ref[KTgKN_GPU_MAX_VT];
STg2_KN_GPU_VT_Element                      g_asKN_Lib_VT_Data[KTgKN_GPU_MAX_VT][KTgKN_GPU_MAX_VT_ELEMENT];
STg2_UTM_AM_ST_ISO                          g_sKN_Lib_VT;
STg2_UTM_SN_ISO                             g_sKN_Lib_VT_Lock;
STg2_KN_GPU_RS_LIB_DESC                     g_sKN_Lib_VT_DESC;

TgKN_GPU_RSI_ID                             g_atiCXT_IL[KTgKN_GPU_MAX_RESOURCE_CONTEXT][KTgKN_GPU_MAX_IL];
TgKN_GPU_RS_ID                              g_atiCXT_IL_VS[KTgKN_GPU_MAX_RESOURCE_CONTEXT][KTgKN_GPU_MAX_IL];
volatile TgSINT32                           g_aiCXT_IL_Ref[KTgKN_GPU_MAX_RESOURCE_CONTEXT][KTgKN_GPU_MAX_IL];
STg2_UTM_AM_ST_ISO                          g_sCXT_IL[KTgKN_GPU_MAX_RESOURCE_CONTEXT];
STg2_UTM_SN_ISO                             g_sCXT_IL_Lock[KTgKN_GPU_MAX_RESOURCE_CONTEXT];

/*# defined(TgCOMPILE_GPU_SUPPORT) */
#endif


/* ---- GPU Resource - Texture ------------------------------------------------------------------------------------------------------------------------------------------ */
#if defined(TgCOMPILE_GPU_SUPPORT)

TgUINTXX                                    g_asKN_Lib_TX_IMG_Hash[KTgKN_GPU_MAX_TX_IMG];
TgKN_GPU_RS_ID                              g_atiKN_Lib_TX_IMG_RS[KTgKN_GPU_MAX_TX_IMG];
volatile TgSINT32                           g_aiKN_Lib_TX_IMG_Ref[KTgKN_GPU_MAX_TX_IMG];
STg2_KN_GPU_TX_IMG_DATA                     g_asKN_Lib_TX_IMG_Data[KTgKN_GPU_MAX_TX_IMG];
STg2_UTM_AM_ST_ISO                          g_sKN_Lib_TX_IMG;
STg2_UTM_SN_ISO                             g_sKN_Lib_TX_IMG_Lock;
STg2_KN_GPU_RS_LIB_DESC                     g_sKN_Lib_TX_IMG_DESC;

TgKN_GPU_RSI_ID                             g_atiCXT_TX_IMG_Inst[KTgKN_GPU_MAX_RESOURCE_CONTEXT][KTgKN_GPU_MAX_TX_IMG];
TgKN_GPU_RS_ID                              g_atiCXT_TX_IMG[KTgKN_GPU_MAX_RESOURCE_CONTEXT][KTgKN_GPU_MAX_TX_IMG];
volatile TgSINT32                           g_aiCXT_TX_IMG_Inst_Ref[KTgKN_GPU_MAX_RESOURCE_CONTEXT][KTgKN_GPU_MAX_TX_IMG];
STg2_UTM_AM_ST_ISO                          g_sCXT_TX_IMG_Inst[KTgKN_GPU_MAX_RESOURCE_CONTEXT];
STg2_UTM_SN_ISO                             g_sCXT_TX_IMG_Inst_Lock[KTgKN_GPU_MAX_RESOURCE_CONTEXT];

TgUINTXX                                    g_asKN_Lib_TX_CBE_Hash[KTgKN_GPU_MAX_TX_CBE];
TgKN_GPU_RS_ID                              g_atiKN_Lib_TX_CBE_RS[KTgKN_GPU_MAX_TX_CBE];
volatile TgSINT32                           g_aiKN_Lib_TX_CBE_Ref[KTgKN_GPU_MAX_TX_CBE];
STg2_KN_GPU_TX_CBE_DATA                     g_asKN_Lib_TX_CBE_Data[KTgKN_GPU_MAX_TX_CBE];
STg2_UTM_AM_ST_ISO                          g_sKN_Lib_TX_CBE;
STg2_UTM_SN_ISO                             g_sKN_Lib_TX_CBE_Lock;
STg2_KN_GPU_RS_LIB_DESC                     g_sKN_Lib_TX_CBE_DESC;

TgKN_GPU_RSI_ID                             g_atiCXT_TX_CBE_Inst[KTgKN_GPU_MAX_RESOURCE_CONTEXT][KTgKN_GPU_MAX_TX_CBE];
TgKN_GPU_RS_ID                              g_atiCXT_TX_CBE[KTgKN_GPU_MAX_RESOURCE_CONTEXT][KTgKN_GPU_MAX_TX_CBE];
volatile TgSINT32                           g_aiCXT_TX_CBE_Inst_Ref[KTgKN_GPU_MAX_RESOURCE_CONTEXT][KTgKN_GPU_MAX_TX_CBE];
STg2_UTM_AM_ST_ISO                          g_sCXT_TX_CBE_Inst[KTgKN_GPU_MAX_RESOURCE_CONTEXT];
STg2_UTM_SN_ISO                             g_sCXT_TX_CBE_Inst_Lock[KTgKN_GPU_MAX_RESOURCE_CONTEXT];

TgUINTXX                                    g_asKN_Lib_TX_VOL_Hash[KTgKN_GPU_MAX_TX_VOL];
TgKN_GPU_RS_ID                              g_atiKN_Lib_TX_VOL_RS[KTgKN_GPU_MAX_TX_VOL];
volatile TgSINT32                           g_aiKN_Lib_TX_VOL_Ref[KTgKN_GPU_MAX_TX_VOL];
STg2_KN_GPU_TX_VOL_DATA                     g_asKN_Lib_TX_VOL_Data[KTgKN_GPU_MAX_TX_VOL];
STg2_UTM_AM_ST_ISO                          g_sKN_Lib_TX_VOL;
STg2_UTM_SN_ISO                             g_sKN_Lib_TX_VOL_Lock;
STg2_KN_GPU_RS_LIB_DESC                     g_sKN_Lib_TX_VOL_DESC;

TgKN_GPU_RSI_ID                             g_atiCXT_TX_VOL_Inst[KTgKN_GPU_MAX_RESOURCE_CONTEXT][KTgKN_GPU_MAX_TX_VOL];
TgKN_GPU_RS_ID                              g_atiCXT_TX_VOL[KTgKN_GPU_MAX_RESOURCE_CONTEXT][KTgKN_GPU_MAX_TX_VOL];
volatile TgSINT32                           g_aiCXT_TX_VOL_Inst_Ref[KTgKN_GPU_MAX_RESOURCE_CONTEXT][KTgKN_GPU_MAX_TX_VOL];
STg2_UTM_AM_ST_ISO                          g_sCXT_TX_VOL_Inst[KTgKN_GPU_MAX_RESOURCE_CONTEXT];
STg2_UTM_SN_ISO                             g_sCXT_TX_VOL_Inst_Lock[KTgKN_GPU_MAX_RESOURCE_CONTEXT];

/*# defined(TgCOMPILE_GPU_SUPPORT) */
#endif




/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  Private State | Debug Data                                                                                                                                            */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

/* ---- Stat ------------------------------------------------------------------------------------------------------------------------------------------------------------ */
#if TgS_STAT_KERNEL || TgS_DEBUG_KERNEL

#if defined(TgCOMPILE_GPU_SUPPORT)
TgUINT32                                    g_uiKN_Stats_Loaded_Mesh_Vertex; /* #IMPLEMENT */
TgUINT32                                    g_uiKN_Stats_Loaded_Mesh_Face; /* #IMPLEMENT */
TgSIZE                                      g_uiKN_Stats_Memory_Buffer; /* #IMPLEMENT */
TgSIZE                                      g_uiKN_Stats_Memory_Mesh; /* #IMPLEMENT */
TgSIZE                                      g_uiKN_Stats_Memory_Mesh_Collision; /* #IMPLEMENT */

TgSIZE                                      g_uiKN_Size_GPU_CS[KTgKN_GPU_MAX_CS];
TgSIZE                                      g_uiKN_Size_GPU_HS[KTgKN_GPU_MAX_HS];
TgSIZE                                      g_uiKN_Size_GPU_DS[KTgKN_GPU_MAX_DS];
TgSIZE                                      g_uiKN_Size_GPU_VS[KTgKN_GPU_MAX_VS];
TgSIZE                                      g_uiKN_Size_GPU_GS[KTgKN_GPU_MAX_GS];
TgSIZE                                      g_uiKN_Size_GPU_PS[KTgKN_GPU_MAX_PS];

TgSIZE                                      g_uiKN_Size_GPU_TX_IMG[KTgKN_GPU_MAX_TX_IMG];
TgSIZE                                      g_uiKN_Size_GPU_TX_CBE[KTgKN_GPU_MAX_TX_CBE];
TgSIZE                                      g_uiKN_Size_GPU_TX_VOL[KTgKN_GPU_MAX_TX_VOL];
/*# defined(TgCOMPILE_GPU_SUPPORT) */
#endif
/*# TgS_STAT_KERNEL || TgS_DEBUG_KERNEL */
#endif


/* ---- Debug ----------------------------------------------------------------------------------------------------------------------------------------------------------- */
#if TgS_DEBUG_KERNEL

#if defined(TgCOMPILE_GPU_SUPPORT)
TgCHAR                                      g_szKN_GPU_CS[KTgKN_GPU_MAX_CS][KTgMAX_FILE_NAME];
TgCHAR                                      g_szKN_GPU_HS[KTgKN_GPU_MAX_HS][KTgMAX_FILE_NAME];
TgCHAR                                      g_szKN_GPU_DS[KTgKN_GPU_MAX_DS][KTgMAX_FILE_NAME];
TgCHAR                                      g_szKN_GPU_VS[KTgKN_GPU_MAX_VS][KTgMAX_FILE_NAME];
TgCHAR                                      g_szKN_GPU_GS[KTgKN_GPU_MAX_GS][KTgMAX_FILE_NAME];
TgCHAR                                      g_szKN_GPU_PS[KTgKN_GPU_MAX_PS][KTgMAX_FILE_NAME];

TgCHAR                                      g_szKN_GPU_VT[KTgKN_GPU_MAX_VT][KTgMAX_FILE_NAME];

TgCHAR                                      g_szKN_GPU_TX_IMG[KTgKN_GPU_MAX_TX_IMG][KTgMAX_FILE_NAME];
TgCHAR                                      g_szKN_GPU_TX_CBE[KTgKN_GPU_MAX_TX_CBE][KTgMAX_FILE_NAME];
TgCHAR                                      g_szKN_GPU_TX_VOL[KTgKN_GPU_MAX_TX_VOL][KTgMAX_FILE_NAME];
/*# defined(TgCOMPILE_GPU_SUPPORT) */
#endif

/*# TgS_DEBUG_KERNEL */
#endif




/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  Public Functions                                                                                                                                                      */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

/* ---- tgKN_Query_Fixed_Memory ----------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgSIZE tgKN_Query_Fixed_Memory( TgVOID )
{
    return ( 0
             + sizeof( g_sJob_Stack__JiT )
             + sizeof( g_sJob_Queue__Render_High )
             + sizeof( g_sJob_Queue__Render_Normal )
             + sizeof( g_sJob_Queue__GPU )
             + sizeof( g_sJob_Queue__Client_High )
             + sizeof( g_sJob_Queue__Client_Normal )
             + sizeof( g_sJob_Queue__Client_Low )
             + sizeof( g_tiKN_FS_HDD__Mount_APP )
             + sizeof( g_asKN_Notify_Data )
             + sizeof( g_auiKN_Notify_MSG )
             + sizeof( g_aiKN_Notify_Next )
             + sizeof( g_atiKN_Notify )
             + sizeof( g_aiKN_Notify_List )
             + sizeof( g_sKN_Notfiy_Lock )
             + sizeof( g_iKN_Notfiy_Free_Index )
             + sizeof( g_asKN_FS )
             + sizeof( g_niKN_FS )
             + sizeof( g_asKN_FS_Mount )
             + sizeof( g_sKN_FS_Mount__Free_Stack ) /* Atomic Stack to acquire a new file */
             + sizeof( g_asKN_File_Info )
             + sizeof( g_sKN_File_Info__Free_Stack ) /* Atomic Stack to acquire a new file */
             + sizeof( g_asKN_File_Job )
             + sizeof( g_sKN_File_Job__Free_Stack ) /* Atomic Stack to acquire a new job */
             + sizeof( g_tiKN_FS_HDD )

         #if defined(TgCOMPILE_GPU_SUPPORT)
             + sizeof( g_asKN_GPU_Adapter )
             + sizeof( g_niKN_GPU_Adapter )
             + sizeof( g_asKN_GPU_Context_Device )
             + sizeof( g_sKN_GPU_Context_Device__Free_Stack )
             + sizeof( g_asKN_GPU_Context_Output )
             + sizeof( g_sKN_GPU_Context_Output__Free_Stack )
             + sizeof( g_asKN_GPU_Context_Resource )
             + sizeof( g_sKN_GPU_Context_Resource__Free_Stack )
             + sizeof( g_asKN_GPU_Context_External )
             + sizeof( g_sKN_GPU_Context_External__Free_Stack )
             + sizeof( g_asKN_GPU_Context )
             + sizeof( g_sKN_GPU_Context__Free_Stack )
             + sizeof( g_asKN_Lib_CS_Hash )
             + sizeof( g_atiKN_Lib_CS_RS )
             + sizeof( g_aiKN_Lib_CS_Ref )
             + sizeof( g_asKN_Lib_CS_Data )
             + sizeof( g_sKN_Lib_CS )
             + sizeof( g_sKN_Lib_CS_Lock )
             + sizeof( g_sKN_Lib_CS_DESC )
             + sizeof( g_atiCXT_CS_Inst )
             + sizeof( g_atiCXT_CS )
             + sizeof( g_aiCXT_CS_Inst_Ref )
             + sizeof( g_sCXT_CS_Inst )
             + sizeof( g_sCXT_CS_Inst_Lock )
             + sizeof( g_asKN_Lib_HS_Hash )
             + sizeof( g_atiKN_Lib_HS_RS )
             + sizeof( g_aiKN_Lib_HS_Ref )
             + sizeof( g_asKN_Lib_HS_Data )
             + sizeof( g_sKN_Lib_HS )
             + sizeof( g_sKN_Lib_HS_Lock )
             + sizeof( g_sKN_Lib_HS_DESC )
             + sizeof( g_atiCXT_HS_Inst )
             + sizeof( g_atiCXT_HS )
             + sizeof( g_aiCXT_HS_Inst_Ref )
             + sizeof( g_sCXT_HS_Inst )
             + sizeof( g_sCXT_HS_Inst_Lock )
             + sizeof( g_asKN_Lib_DS_Hash )
             + sizeof( g_atiKN_Lib_DS_RS )
             + sizeof( g_aiKN_Lib_DS_Ref )
             + sizeof( g_asKN_Lib_DS_Data )
             + sizeof( g_sKN_Lib_DS )
             + sizeof( g_sKN_Lib_DS_Lock )
             + sizeof( g_sKN_Lib_DS_DESC )
             + sizeof( g_atiCXT_DS_Inst )
             + sizeof( g_atiCXT_DS )
             + sizeof( g_aiCXT_DS_Inst_Ref )
             + sizeof( g_sCXT_DS_Inst )
             + sizeof( g_sCXT_DS_Inst_Lock )
             + sizeof( g_asKN_Lib_VS_Hash )
             + sizeof( g_atiKN_Lib_VS_RS )
             + sizeof( g_aiKN_Lib_VS_Ref )
             + sizeof( g_asKN_Lib_VS_Data )
             + sizeof( g_sKN_Lib_VS )
             + sizeof( g_sKN_Lib_VS_Lock )
             + sizeof( g_sKN_Lib_VS_DESC )
             + sizeof( g_asKN_Lib_GS_Hash )
             + sizeof( g_atiKN_Lib_GS_RS )
             + sizeof( g_aiKN_Lib_GS_Ref )
             + sizeof( g_asKN_Lib_GS_Data )
             + sizeof( g_sKN_Lib_GS )
             + sizeof( g_sKN_Lib_GS_Lock )
             + sizeof( g_sKN_Lib_GS_DESC )
             + sizeof( g_atiCXT_GS_Inst )
             + sizeof( g_atiCXT_GS )
             + sizeof( g_aiCXT_GS_Inst_Ref )
             + sizeof( g_sCXT_GS_Inst )
             + sizeof( g_sCXT_GS_Inst_Lock )
             + sizeof( g_asKN_Lib_PS_Hash )
             + sizeof( g_atiKN_Lib_PS_RS )
             + sizeof( g_aiKN_Lib_PS_Ref )
             + sizeof( g_asKN_Lib_PS_Data )
             + sizeof( g_sKN_Lib_PS )
             + sizeof( g_sKN_Lib_PS_Lock )
             + sizeof( g_sKN_Lib_PS_DESC )
             + sizeof( g_atiCXT_PS_Inst )
             + sizeof( g_atiCXT_PS )
             + sizeof( g_aiCXT_PS_Inst_Ref )
             + sizeof( g_sCXT_PS_Inst )
             + sizeof( g_sCXT_PS_Inst_Lock )
             + sizeof( g_asKN_Lib_VT_Hash )
             + sizeof( g_aniKN_Lib_VT_RS )
             + sizeof( g_aiKN_Lib_VT_Ref )
             + sizeof( g_asKN_Lib_VT_Data )
             + sizeof( g_sKN_Lib_VT )
             + sizeof( g_sKN_Lib_VT_Lock )
             + sizeof( g_sKN_Lib_VT_DESC )
             + sizeof( g_atiCXT_IL )
             + sizeof( g_atiCXT_IL_VS )
             + sizeof( g_aiCXT_IL_Ref )
             + sizeof( g_sCXT_IL )
             + sizeof( g_sCXT_IL_Lock )
             + sizeof( g_asKN_Lib_TX_IMG_Hash )
             + sizeof( g_atiKN_Lib_TX_IMG_RS )
             + sizeof( g_aiKN_Lib_TX_IMG_Ref )
             + sizeof( g_asKN_Lib_TX_IMG_Data )
             + sizeof( g_sKN_Lib_TX_IMG )
             + sizeof( g_sKN_Lib_TX_IMG_Lock )
             + sizeof( g_sKN_Lib_TX_IMG_DESC )
             + sizeof( g_atiCXT_TX_IMG_Inst )
             + sizeof( g_atiCXT_TX_IMG )
             + sizeof( g_aiCXT_TX_IMG_Inst_Ref )
             + sizeof( g_sCXT_TX_IMG_Inst )
             + sizeof( g_sCXT_TX_IMG_Inst_Lock )
             + sizeof( g_asKN_Lib_TX_CBE_Hash )
             + sizeof( g_atiKN_Lib_TX_CBE_RS )
             + sizeof( g_aiKN_Lib_TX_CBE_Ref )
             + sizeof( g_asKN_Lib_TX_CBE_Data )
             + sizeof( g_sKN_Lib_TX_CBE )
             + sizeof( g_sKN_Lib_TX_CBE_Lock )
             + sizeof( g_sKN_Lib_TX_CBE_DESC )
             + sizeof( g_atiCXT_TX_CBE_Inst )
             + sizeof( g_atiCXT_TX_CBE )
             + sizeof( g_aiCXT_TX_CBE_Inst_Ref )
             + sizeof( g_sCXT_TX_CBE_Inst )
             + sizeof( g_sCXT_TX_CBE_Inst_Lock )
             + sizeof( g_asKN_Lib_TX_VOL_Hash )
             + sizeof( g_atiKN_Lib_TX_VOL_RS )
             + sizeof( g_aiKN_Lib_TX_VOL_Ref )
             + sizeof( g_asKN_Lib_TX_VOL_Data )
             + sizeof( g_sKN_Lib_TX_VOL )
             + sizeof( g_sKN_Lib_TX_VOL_Lock )
             + sizeof( g_sKN_Lib_TX_VOL_DESC )
             + sizeof( g_atiCXT_TX_VOL_Inst )
             + sizeof( g_atiCXT_TX_VOL )
             + sizeof( g_aiCXT_TX_VOL_Inst_Ref )
             + sizeof( g_sCXT_TX_VOL_Inst )
             + sizeof( g_sCXT_TX_VOL_Inst_Lock )
             + sizeof( g_auiKN_PM_TX_AM )
             + sizeof( g_auiKN_PM_TX_Filter )
             + sizeof( g_auiKN_PM_TX_MIP_Filter )
         /*# defined(TgCOMPILE_GPU_SUPPORT) */
         #endif

         #if TgS_STAT_KERNEL || TgS_DEBUG_KERNEL
         #if defined(TgCOMPILE_GPU_SUPPORT)
             +sizeof( g_uiKN_Stats_Loaded_Mesh_Vertex ) /* #IMPLEMENT */
             + sizeof( g_uiKN_Stats_Loaded_Mesh_Face ) /* #IMPLEMENT */
             + sizeof( g_uiKN_Stats_Memory_Buffer ) /* #IMPLEMENT */
             + sizeof( g_uiKN_Stats_Memory_Mesh ) /* #IMPLEMENT */
             + sizeof( g_uiKN_Stats_Memory_Mesh_Collision ) /* #IMPLEMENT */
             + sizeof( g_uiKN_Size_GPU_CS )
             + sizeof( g_uiKN_Size_GPU_HS )
             + sizeof( g_uiKN_Size_GPU_DS )
             + sizeof( g_uiKN_Size_GPU_VS )
             + sizeof( g_uiKN_Size_GPU_GS )
             + sizeof( g_uiKN_Size_GPU_PS )
             + sizeof( g_uiKN_Size_GPU_TX_IMG )
             + sizeof( g_uiKN_Size_GPU_TX_CBE )
             + sizeof( g_uiKN_Size_GPU_TX_VOL )
         /*# defined(TgCOMPILE_GPU_SUPPORT) */
         #endif
         /*# TgS_STAT_KERNEL || TgS_DEBUG_KERNEL */
         #endif

         #if TgS_DEBUG_KERNEL
         #if defined(TgCOMPILE_GPU_SUPPORT)
             +sizeof( g_szKN_GPU_CS )
             + sizeof( g_szKN_GPU_HS )
             + sizeof( g_szKN_GPU_DS )
             + sizeof( g_szKN_GPU_VS )
             + sizeof( g_szKN_GPU_GS )
             + sizeof( g_szKN_GPU_PS )
             + sizeof( g_szKN_GPU_VT )
             + sizeof( g_szKN_GPU_TX_IMG )
             + sizeof( g_szKN_GPU_TX_CBE )
             + sizeof( g_szKN_GPU_TX_VOL )
         /*# defined(TgCOMPILE_GPU_SUPPORT) */
         #endif
         /*# TgS_DEBUG_KERNEL */
         #endif

         #if !defined(TgCOMPILE_FORCE_ANSI)
             +tgKN_PM_Query_Fixed_Memory()
         #endif
    );
}