Home

Resume

Blog

Teikitu


/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
/*  »Project«   Teikitu Gaming System (TgS) (∂)
    »File«      TgS Kernel - Constants.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_CONSTANTS_H)
#define TGS_KERNEL_CONSTANTS_H
#pragma once

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


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

/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  Configuration                                                                                                                                                         */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

enum { KTgKN_MAX_JOB_THREAD                 =     8 };
enum { KTgKN_MAX_NOTIFY_ENTRIES             =  1024 };
enum { KTgKN_MAX_FILE_SYSTEM                =     4 };
enum { KTgKN_MAX_FILE_SYSTEM_MOUNT          =    16 };
enum { KTgKN_MAX_FILE_OPEN                  =  1024 }; /*« Maximum number of requests */
enum { KTgKN_MAX_FILE_JOB                   =   256 }; /*« Maximum number of requests */
enum { KTgKN_MAX_FILE_DIRECTORY             =   256 }; /*« Maximum number of requests */
enum { KTgKN_MAX_FILE_PER_DIRECTORY         =  2048 }; /*« Maximum number of requests */
enum { KTgKN_GPU_MAX_RENDER_STATES          =   512 };
enum { KTgKN_GPU_MAX_RESOURCE_CONTEXT       =     2 }; /* Number of GPU resource contexts allowed in the system - normally this is one per video card */
enum { KTgKN_GPU_MAX_DEVC_CONTEXT           =     2 }; /* Number of GPU execution context allowed in the system - normally this is one (single GPU video card) */
enum { KTgKN_GPU_MAX_CONTEXT                =     2 }; /* Number of GPU contexts allowed in the system - normally this is one (one single GPU video card) */
enum { KTgKN_GPU_MAX_ADAPTER                =     8 }; /* Number of GPU adapters that can be enumerated */
enum { KTgKN_GPU_MAX_ADAPTER_NODE           =     2 }; /* Number of GPU adapters that can be enumerated */
enum { KTgKN_GPU_MAX_ADAPTER_NAME           =   128 }; /* Max length of adapter name | description */
enum { KTgKN_GPU_MAX_OUTPUT                 =     8 }; /* Number of GPU output (scan-out) devices per adapter than can be enumerated */
enum { KTgKN_GPU_MAX_OUTPUT_NAME            =    32 }; /* Max name stored for each output device */
enum { KTgKN_GPU_MAX_VT                     =    32 };
enum { KTgKN_GPU_MAX_VT_ELEMENT             =    16 };
enum { KTgKN_GPU_MAX_VS                     =    32 };
enum { KTgKN_GPU_MAX_DS                     =    32 };
enum { KTgKN_GPU_MAX_GS                     =    32 };
enum { KTgKN_GPU_MAX_HS                     =    32 };
enum { KTgKN_GPU_MAX_PS                     =    64 };
enum { KTgKN_GPU_MAX_CS                     =    64 };
enum { KTgKN_GPU_MAX_IL                     =    32 };
enum { KTgKN_GPU_MAX_TX_CBE                 =    64 };
enum { KTgKN_GPU_MAX_TX_IMG                 =  4096 };
enum { KTgKN_GPU_MAX_TX_VOL                 =    64 };
enum { KTgKN_GPU_MS__MAX                    =    32 };
enum { KTgKN_RESOURCE_NAME_MAX              =    64 };

TgCOMPILER_ASSERT( KTgKN_MAX_FILE_SYSTEM < 0xFFFF, 0 );


/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  Public Constants                                                                                                                                                      */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

TgTYPE_ENUM(ETgKN_IO_STATUS, TgSINT32,

    ETgKN_IO_STATUS__ERROR = -1,    ETgKN_IO_STATUS__INVALID = 0,   ETgKN_IO_STATUS__QUEUED,        ETgKN_IO_STATUS__EXECUTE,       ETgKN_IO_STATUS__DONE,
    ETgKN_IO_STATUS__CANCEL,        ETgKN_IO_STATUS__MAX,
);


/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  Public GPU Constants                                                                                                                                                  */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

/* List of memory locations and cache status */
TgTYPE_ENUM(ETgKN_GPU_ALLOCATOR,TgSINT32,

    ETgKN_GPU_ALLOCATOR__VIDEO_MEMORY = (0 << 7) + (0 << 0),
    ETgKN_GPU_ALLOCATOR__VIDEO_MEMORY_WRITEONLY = (0 << 7) + (1 << 0), /*« Standard GPU resource, supports CPU-wo and GPU-rm (worm) */
    ETgKN_GPU_ALLOCATOR__VIDEO_MEMORY_DYNAMIC = (0 << 7) + (2 << 0), /*« Per frame CPU write and GPU read */
    ETgKN_GPU_ALLOCATOR__VIDEO_MEMORY_STAGING = (0 << 7) + (3 << 0), /*« Supports transfer from GPU to CPU */
    ETgKN_GPU_ALLOCATOR__VIDEO_MEMORY_INPLACE = (0 << 7) + (4 << 0), /*« Function should do fixup only (load inplace) */

    ETgKN_GPU_ALLOCATOR__MAIN_MEMORY = (1 << 8) + (0 << 0),
    ETgKN_GPU_ALLOCATOR__MAIN_MEMORY_WRITEONLY = (1 << 8) + (1 << 0),
    ETgKN_GPU_ALLOCATOR__MAIN_MEMORY_DYNAMIC = (1 << 8) + (2 << 0),
    ETgKN_GPU_ALLOCATOR__MAIN_MEMORY_STAGING = (1 << 8) + (3 << 0),
    ETgKN_GPU_ALLOCATOR__MAIN_MEMORY_INPLACE = (0 << 8) + (4 << 0), /*« Function should do fixup only (load inplace) */

    ETgKN_GPU_ALLOCATOR__IGNORE_REF_COUNT = (1 << 9),

    ETgKN_GPU_ALLOCATOR__INVALID = (1 << 10),
);

TgTYPE_ENUM(ETgKN_GPU_TARGET, TgSINT32,

    ETgKN_GPU_TARGET__R16G16B16A16_FLOAT,                           ETgKN_GPU_TARGET__R10G10B10A2_UNORM,
    ETgKN_GPU_TARGET__R8G8B8A8_UNORM,                               ETgKN_GPU_TARGET__R8G8B8A8_UNORM_SRGB,
    ETgKN_GPU_TARGET__B8G8R8A8_UNORM,                               ETgKN_GPU_TARGET__B8G8R8A8_UNORM_SRGB,
    ETgKN_GPU_TARGET__MAX
);

TgTYPE_ENUM(ETgKN_GPU_MS, TgSINT32,

    ETgKN_GPU_MS__00,               ETgKN_GPU_MS__02,               ETgKN_GPU_MS__03,               ETgKN_GPU_MS__04,               ETgKN_GPU_MS__05,
    ETgKN_GPU_MS__06,               ETgKN_GPU_MS__07,               ETgKN_GPU_MS__08,               ETgKN_GPU_MS__09,               ETgKN_GPU_MS__10,
    ETgKN_GPU_MS__11,               ETgKN_GPU_MS__12,               ETgKN_GPU_MS__13,               ETgKN_GPU_MS__14,               ETgKN_GPU_MS__15,
    ETgKN_GPU_MS__16,
);

TgTYPE_ENUM(ETgKN_GPU_DEVICE_SETTINGS_FLAGS, TgSINT32,

    ETgKN_GPU_DEVICE_SETTINGS_FLAGS__MAX
);

TgTYPE_ENUM(ETgKN_GPU_ADAPTER_OUTPUT_FLAGS, TgSINT32,

    ETgKN_GPU_ADAPTER_OUTPUT_FLAGS__TARGET__START,
    ETgKN_GPU_ADAPTER_OUTPUT_FLAGS__TARGET__R16G16B16A16_FLOAT = ETgKN_GPU_ADAPTER_OUTPUT_FLAGS__TARGET__START,
    ETgKN_GPU_ADAPTER_OUTPUT_FLAGS__TARGET__R10G10B10A2_UNORM,
    ETgKN_GPU_ADAPTER_OUTPUT_FLAGS__TARGET__R8G8B8A8_UNORM,
    ETgKN_GPU_ADAPTER_OUTPUT_FLAGS__TARGET__R8G8B8A8_UNORM_SRGB,
    ETgKN_GPU_ADAPTER_OUTPUT_FLAGS__TARGET__B8G8R8A8_UNORM,
    ETgKN_GPU_ADAPTER_OUTPUT_FLAGS__TARGET__B8G8R8A8_UNORM_SRGB,
    ETgKN_GPU_ADAPTER_OUTPUT_FLAGS__TARGET__END,
    ETgKN_GPU_ADAPTER_OUTPUT_FLAGS__TARGET__COUNT = ETgKN_GPU_ADAPTER_OUTPUT_FLAGS__TARGET__END - ETgKN_GPU_ADAPTER_OUTPUT_FLAGS__TARGET__START,

    ETgKN_GPU_ADAPTER_OUTPUT_FLAGS__MAX
);


/* -- Resource Constants ------------------------------------------------------------------------------------------------------------------------------------------------ */

TgTYPE_ENUM( ETgKN_GPU_SHADER, TgSINT32,

    ETgKN_GPU_SHADER__VS = 0,       ETgKN_GPU_SHADER__GS,           ETgKN_GPU_SHADER__PS,           ETgKN_GPU_SHADER__CS,           ETgKN_GPU_SHADER__MAX
);

TgTYPE_ENUM(ETgKN_GPU_FORMAT, TgSINT32,

    ETgKN_GPU_FORMAT__UNKNNOWN,

    /* Vertex Formats */
    ETgKN_GPU_FORMAT__F32_04,

    /* Texture Formats */
    ETgKN_GPU_FORMAT__R16G16B16A16_FLOAT,                           ETgKN_GPU_FORMAT__R10G10B10A2_UNORM,
    ETgKN_GPU_FORMAT__R8G8B8A8_UNORM,                               ETgKN_GPU_FORMAT__R8G8B8A8_UNORM_SRGB,
    ETgKN_GPU_FORMAT__B8G8R8A8_UNORM,                               ETgKN_GPU_FORMAT__B8G8R8A8_UNORM_SRGB,

    /* Depth Formats */
    ETgKN_GPU_FORMAT__DS_F32_U08,   ETgKN_GPU_FORMAT__DS_F32,

    /* Index Values */
    ETgKN_GPU_FORMAT__MAX,
    ETgKN_GPU_FORMAT__DS_START = ETgKN_GPU_FORMAT__DS_F32_U08,
    ETgKN_GPU_FORMAT__DS_END = ETgKN_GPU_FORMAT__DS_F32,
    ETgKN_GPU_FORMAT__DS_RANGE = ETgKN_GPU_FORMAT__DS_END - ETgKN_GPU_FORMAT__DS_START + 1,
);

TgTYPE_ENUM(ETgKN_GPU_TX_AM, TgSINT32,

    ETgKN_GPU_TX_AM__INVALID,       ETgKN_GPU_TX_AM__LINEAR,        ETgKN_GPU_TX_AM__JITTER,        ETgKN_GPU_TX_AM__SINUSOID,      ETgKN_GPU_TX_AM__FLIP_BOOK,
    ETgKN_GPU_TX_AM__SCALE,         ETgKN_GPU_TX_AM__ROTATE,        ETgKN_GPU_TX_AM__MAX
);

TgTYPE_ENUM(ETgKN_GPU_TX_ADDRESS, TgSINT32,

    ETgKN_GPU_TX_ADDRESS__WRAP,     ETgKN_GPU_TX_ADDRESS__MIRROR,   ETgKN_GPU_TX_ADDRESS__CLAMP,    ETgKN_GPU_TX_ADDRESS__BORDER,   ETgKN_GPU_TX_ADDRESS__MAX,
);

TgTYPE_ENUM(ETgKN_GPU_TX_FILTER, TgSINT32,

    ETgKN_GPU_TX_FILTER__POINT,     ETgKN_GPU_TX_FILTER__LINEAR,    ETgKN_GPU_TX_FILTER__MAX,
);

TgTYPE_ENUM(ETgKN_GPU_TX_CUBE_FACE, TgSINT32,

    ETgKN_GPU_TX_CUBE_FACE__PX,     ETgKN_GPU_TX_CUBE_FACE__NX,     ETgKN_GPU_TX_CUBE_FACE__PY,     ETgKN_GPU_TX_CUBE_FACE__NY,     ETgKN_GPU_TX_CUBE_FACE__PZ,
    ETgKN_GPU_TX_CUBE_FACE__NZ,     ETgKN_GPU_TX_CUBE_FACE__MAX,
);

TgTYPE_ENUM(ETgKN_GPU_VSA, TgSINT32,

    ETgKN_GPU_VSA__INVALID,         ETgKN_GPU_VSA__POSITION_0,      ETgKN_GPU_VSA__POSITION_1,      ETgKN_GPU_VSA__NORMAL_0,        ETgKN_GPU_VSA__NORMAL_1,
    ETgKN_GPU_VSA__NORMAL_2,        ETgKN_GPU_VSA__NORMAL_3,        ETgKN_GPU_VSA__TANGENT_0,       ETgKN_GPU_VSA__TANGENT_1,       ETgKN_GPU_VSA__TANGENT_2,
    ETgKN_GPU_VSA__TANGENT_3,       ETgKN_GPU_VSA__TEXCOORD_00,     ETgKN_GPU_VSA__TEXCOORD_01,     ETgKN_GPU_VSA__TEXCOORD_02,     ETgKN_GPU_VSA__TEXCOORD_03,
    ETgKN_GPU_VSA__TEXCOORD_04,     ETgKN_GPU_VSA__TEXCOORD_05,     ETgKN_GPU_VSA__TEXCOORD_06,     ETgKN_GPU_VSA__TEXCOORD_07,     ETgKN_GPU_VSA__TEXCOORD_08,
    ETgKN_GPU_VSA__TEXCOORD_09,     ETgKN_GPU_VSA__TEXCOORD_10,     ETgKN_GPU_VSA__TEXCOORD_11,     ETgKN_GPU_VSA__TEXCOORD_12,     ETgKN_GPU_VSA__TEXCOORD_13,
    ETgKN_GPU_VSA__TEXCOORD_14,     ETgKN_GPU_VSA__TEXCOORD_15,     ETgKN_GPU_VSA__COLOR_0,         ETgKN_GPU_VSA__COLOR_1,         ETgKN_GPU_VSA__BLENDWEIGHT_0,
    ETgKN_GPU_VSA__BLENDINDICES_0,  ETgKN_GPU_VSA__MAX
);


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