Home

Resume

Blog

Teikitu


/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
/*  »Project«   Teikitu Gaming System (TgS) (∂)
    »File«      TgS Kernel - Type.h
    »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".                                                   */
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
#if !defined(TGS_KERNEL_TYPE_H)
#define TGS_KERNEL_TYPE_H
#pragma once

#if !defined(TGS_KERNEL_H)
#error This file should not be included directly - use the correct platform include wrapper
#endif

#include "TgS Ring 2 - Type.h"


/* == Kernel ============================================================================================================================================================ */

/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  Public Types                                                                                                                                                          */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

typedef TgVOID(*TgKN_FCN_NOTIFY_CALLBACK)( C_TgUINTPTR, C_TgUINT32, C_TgUINT32 );
typedef P_TgVOID(*TgFCN_KN_FILE_ALLOCATOR)( C_TgSIZE );

TgTYPE_STRUCT(STg2_KN_File_Open_Command,) /* #IMPLEMENT */
{
    TgKN_FS_MOUNT_ID                            m_tiFS_Mount;      /*« File system mount point to use for opening the file */
    TgUINTXX                                    m_uiPath;          /*« Hash of the file location (path) */
    TgUINTXX                                    m_uiFile;          /*« Hash of the file name */
    TgSINT32                                    m_enMode;          /*« Access mode to use to open the file */
    TgSINT32                                    m_iCache;          /*« Size of the write-combine cache */
    CP_TgCHAR                                   m_pszFile_Name;    /*« Used when creating a new file, m_uiFile must be the empty hash */
};

TgTYPE_STRUCT(STg2_KN_File_Cache_Command,) /* #IMPLEMENT */
{
    TgKN_FILE_ID                                m_tiFile;
};

TgTYPE_STRUCT(STg2_KN_File_Read_Command, typedef TgVOID (*TgKN_FILE_READ_CALLBACK)( PCU_STg2_KN_File_Read_Command );) /* #IMPLEMENT */
{
    TgKN_FILE_ID                                m_tiFile;
    TgFCN_KN_FILE_ALLOCATOR                     m_pfnAllocator;    /*« Used to allocate memory if buffer is nullptr. */
    P_TgVOID                                    m_pBuffer;         /*« Buffer for the data request.  Can be nullptr. */
    TgSIZE                                      m_nuiBuffer;       /*« Size to be read (ignored if buffer is nullptr) */
    TgSIZE                                      m_nuiResult;       /*« Size that was read */
    TgKN_FILE_READ_CALLBACK                     m_pfnFinish;       /*« Finish call back function */
    TgUINTPTR                                   m_uiParam;         /*« Finish parameter for call back */
};

TgTYPE_STRUCT(STg2_KN_File_Write_Command, typedef TgVOID (*TgKN_FILE_WRITE_CALLBACK)( PCU_STg2_KN_File_Write_Command );) /* #IMPLEMENT */
{
    TgKN_FILE_ID                                m_tiFile;
    CP_TgVOID                                   m_pBuffer;         /*« Buffer for the data request.  Can be nullptr. */
    TgSIZE                                      m_nuiBuffer;       /*« Size to be written */
    TgSIZE                                      m_nuiResult;       /*« Size that was written */
    TgKN_FILE_WRITE_CALLBACK                    m_pfnFinish;       /*« Finish call back function */
    TgUINTPTR                                   m_uiParam;         /*« Finish parameter for call back */
};

TgTYPE_STRUCT(STg2_KN_File_Cancel_Command, typedef TgVOID (*TgKN_FILE_CANCEL_CALLBACK)( PCU_STg2_KN_File_Cancel_Command );) /* #IMPLEMENT */
{
    TgKN_FILE_JOB_ID                            m_tiFile_Job;
    TgKN_FILE_CANCEL_CALLBACK                   m_pfnFinish;       /*« Finish call back function */
    TgUINTPTR                                   m_uiParam;         /*« Finish parameter for call back */
};

TgTYPE_STRUCT(STg2_Input_File,) /* #IMPLEMENT */
{
    STg2_Input                                  m_sInput;
    TgKN_FILE_ID                                m_tiFile;
};

TgTYPE_STRUCT(STg2_Output_File,) /* #IMPLEMENT */
{
    STg2_Output                                 m_sOutput;
    TgKN_FILE_ID                                m_tiFile;
};


/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  Public GPU Types                                                                                                                                                      */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
#if defined(TgCOMPILE_GPU_SUPPORT)

typedef TgBOOL(*TgKN_GPU_FCN_TX_CBE_LOADER)( C_TgKN_TX_CBE_ID, C_TgKN_FILE_ID, C_TgSIZE );
TgTYPE_PREFIX(TgKN_GPU_FCN_TX_CBE_LOADER);

typedef TgBOOL(*TgKN_GPU_FCN_TX_IMG_LOADER)( C_TgKN_TX_IMG_ID, C_TgKN_FILE_ID, C_TgSIZE );
TgTYPE_PREFIX(TgKN_GPU_FCN_TX_IMG_LOADER);

typedef TgBOOL(*TgKN_GPU_FCN_TX_VOL_LOADER)( C_TgKN_TX_VOL_ID, C_TgKN_FILE_ID, C_TgSIZE );
TgTYPE_PREFIX(TgKN_GPU_FCN_TX_VOL_LOADER);

TgTYPE_STRUCT(STg2_KN_GPU_Output,) /* #IMPLEMENT */
{
    TgCHAR                                      m_szName[KTgKN_GPU_MAX_OUTPUT_NAME];
    TgUINT64                                    m_uiFlags;
};

TgTYPE_STRUCT(STg2_KN_GPU_Adapter,) /* #IMPLEMENT */
{
    TgCHAR                                      m_szAdapter[KTgKN_GPU_MAX_ADAPTER_NAME];
    STg2_KN_GPU_Output                          m_asOutput[KTgKN_GPU_MAX_OUTPUT];
    TgSINT32                                    m_niOutput;
    TgSINT32                                    m_iPad;
};

TgTYPE_STRUCT(STg2_KN_GPU_Mode,) /* #IMPLEMENT */
{
    TgUINT32                                    m_uiWidth, m_uiHeight, m_uiRefresh_Rate;
    ETgKN_GPU_TARGET                            m_enFormat;
};

TgTYPE_STRUCT(STg2_KN_GPU_Select,) /* #IMPLEMENT */
{
    TgSINT32                                    m_iAdapter;
    TgSINT32                                    m_iOutput;
    STg2_KN_GPU_Mode                            m_sMode;
    TgSINT32                                    m_niSample;
    TgUINT32                                    m_uiStereo : 1;
    TgUINT32                                    m_uiGraphics : 1;
    TgUINT32                                    m_uiVSync : 2;
    TgUINT32                                    m_uiPad0 : 28;
    TgUINT32                                    m_uiPad1;
    ETgKN_GPU_FORMAT                            m_enFormat_DS;
    TgKN_GPU_CXT_DEVC_ID                        m_tiCXT_DEVC; /* Normally set to an invalid ID - exists to allow sharing between Contexts */
    TgKN_GPU_CXT_DATA_ID                        m_tiCXT_DATA; /* Normally set to an invalid ID - exists to allow sharing between Contexts */
    TgKN_GPU_CXT_EXTN_ID                        m_tiCXT_EXTN; /* Normally set to an invalid ID - exists to allow sharing between Contexts */
};

TgTYPE_STRUCT(STg2_KN_GPU_Shader_Sampler_State,) /* #IMPLEMENT */
{
    ETgKN_GPU_TX_FILTER                         m_enMin, m_enMax, m_enMip;
    ETgKN_GPU_TX_ADDRESS                        m_enAddress_U;
    ETgKN_GPU_TX_ADDRESS                        m_enAddress_V;
    ETgKN_GPU_TX_ADDRESS                        m_enAddress_W;
    TgFLOAT32                                   m_fBias_MIP_LOD;
    TgFLOAT32                                   m_afBorder[4];
    TgFLOAT32                                   m_fMin_LOD, m_fMax_LOD;
    TgUINT32                                    m_uiMax_Anisotropy;
};

TgTYPE_STRUCT(STg2_KN_GPU_TX_Surface,) /* #IMPLEMENT */
{
    TgSINT32                                    m_iW, m_iH;
    TgSINT32                                    m_iPitch; /* NOTE: Large format textures easily exceed 16-bit limit */
    TgUINT32                                    m_iPad0;
    P_TgUINT08                                  m_pData;
    P_TgVOID                                    m_pPM_Texture, m_pPM_Data;
};

TgTYPE_STRUCT(STg2_KN_GPU_Viewport,) /* #IMPLEMENT */
{
    TgSINT32                                    m_iPosX, m_iPosY, m_iWidth, m_iHeight;
    TgFLOAT32                                   m_fMinZ, m_fMaxZ;
};

TgTYPE_STRUCT(STg2_KN_GPU_VT_Element,)
{
    ETgKN_GPU_VSA                               m_enVSA;
    ETgKN_GPU_FORMAT                            m_enFMT;
    TgSINT32                                    m_iInput_Slot;
    TgSINT32                                    m_iInput_Stride;
    TgBOOL                                      m_bInstance_Slot;
    TgSINT32                                    m_iInstance_Step;
};

TgTYPE_STRUCT(STg2_KN_GPU_Context__External,) /* #IMPLEMENT */
{
    TgKN_GPU_CXT_EXTN_ID                        m_tiID;
    TgSINT32                                    m_iRef;
    TgSINT32                                    m_iPad;
    TgKN_GPU_RSI_ID                             m_tiTX_IMG_Black;
    TgKN_GPU_RSI_ID                             m_tiTX_IMG_White;
    TgKN_GPU_RSI_ID                             m_tiTX_IMG_Red;
    TgKN_GPU_RSI_ID                             m_tiTX_IMG_Green;
    TgKN_GPU_RSI_ID                             m_tiTX_IMG_Blue;
    TgKN_GPU_RSI_ID                             m_tiTX_IMG_Yellow;
    TgKN_GPU_RSI_ID                             m_tiTX_IMG_Magenta;
    TgKN_GPU_RSI_ID                             m_tiTX_IMG_Cyan;

    TgKN_GPU_RSI_ID                             m_tiTX_VOL_Black;
    TgKN_GPU_RSI_ID                             m_tiTX_VOL_White;

    TgKN_GPU_RSI_ID                             m_tiTX_CBE_Black;
    TgKN_GPU_RSI_ID                             m_tiTX_CBE_White;
};

/*# defined(TgCOMPILE_GPU_SUPPORT) */
#endif


/* ====================================================================================================================================================================== */
#endif