brought back functionality from previous builds but now cross-platform
This commit is contained in:
28
.gitignore
vendored
28
.gitignore
vendored
@@ -5,11 +5,31 @@ build
|
|||||||
compile_commands.json
|
compile_commands.json
|
||||||
|
|
||||||
|
|
||||||
# Added by cargo
|
|
||||||
|
|
||||||
/target
|
|
||||||
|
|
||||||
# fpc stuff
|
# fpc stuff
|
||||||
.fpc
|
.fpc
|
||||||
fpc/.fpc
|
fpc/.fpc
|
||||||
fpc/fpc
|
fpc/fpc
|
||||||
|
fpc/fpc.dSYM
|
||||||
|
|
||||||
|
# macOS system files
|
||||||
|
.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
|
||||||
|
# Thumbnails
|
||||||
|
._*
|
||||||
|
|
||||||
|
# Files that might appear on external disks
|
||||||
|
.Spotlight-V100
|
||||||
|
.Trashes
|
||||||
|
*.xcodeproj/xcuserdata/
|
||||||
|
*.xcworkspace/xcuserdata/
|
||||||
|
build/
|
||||||
|
DerivedData/
|
||||||
|
*.xcuserstate
|
||||||
|
|
||||||
|
# Icon files
|
||||||
|
Icon?
|
||||||
|
|
||||||
|
# Added by cargo
|
||||||
|
/target
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#include "build/tools/public/target.h"
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
#include "tier1/utlstring.h"
|
#include "tier1/utlstring.h"
|
||||||
#include "helper.h"
|
#include "helper.h"
|
||||||
@@ -16,7 +17,7 @@ bool bStaticBuild = false;
|
|||||||
|
|
||||||
extern "C" void Preinit()
|
extern "C" void Preinit()
|
||||||
{
|
{
|
||||||
if (Target_t::DefaultTarget().kernel == TARGET_KERNEL_IOS)
|
if (Target_t::DefaultTarget().kernel == TARGET_KERNEL_IOS || Target_t::DefaultTarget().kernel == TARGET_KERNEL_WINDOWS)
|
||||||
{
|
{
|
||||||
bStaticBuild = true;
|
bStaticBuild = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,11 @@ CUtlVector<CUtlString> engine_CompiledFiles = {
|
|||||||
"engine/engine.cpp",
|
"engine/engine.cpp",
|
||||||
"engine/physics.cpp",
|
"engine/physics.cpp",
|
||||||
"engine/gamemode.cpp",
|
"engine/gamemode.cpp",
|
||||||
|
"engine/rendering.cpp",
|
||||||
|
|
||||||
|
/* io */
|
||||||
|
"engine/input.cpp",
|
||||||
|
"engine/net.cpp",
|
||||||
|
|
||||||
|
|
||||||
/* entities */
|
/* entities */
|
||||||
@@ -26,9 +31,6 @@ CUtlVector<CUtlString> engine_CompiledFiles = {
|
|||||||
"engine/cl_worldspawn.cpp",
|
"engine/cl_worldspawn.cpp",
|
||||||
"engine/cl_light.cpp",
|
"engine/cl_light.cpp",
|
||||||
|
|
||||||
/* io */
|
|
||||||
"engine/input.cpp",
|
|
||||||
"engine/net.cpp"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
CUtlVector<CUtlString> engine_Libraries = {
|
CUtlVector<CUtlString> engine_Libraries = {
|
||||||
@@ -42,6 +44,7 @@ int engine_build()
|
|||||||
{
|
{
|
||||||
engine_CompiledFiles.AppendTail("engine/ml_videosdl.cpp");
|
engine_CompiledFiles.AppendTail("engine/ml_videosdl.cpp");
|
||||||
engine_CompiledFiles.AppendTail("engine/ml_video.cpp");
|
engine_CompiledFiles.AppendTail("engine/ml_video.cpp");
|
||||||
|
engine_CompiledFiles.AppendTail("engine/ml_video.mm");
|
||||||
} else {
|
} else {
|
||||||
engine_CompiledFiles.AppendTail("engine/vk_videosdl.cpp");
|
engine_CompiledFiles.AppendTail("engine/vk_videosdl.cpp");
|
||||||
engine_CompiledFiles.AppendTail("engine/vk_video.cpp");
|
engine_CompiledFiles.AppendTail("engine/vk_video.cpp");
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "brush.h"
|
#include "brush.h"
|
||||||
#include "baseentity.h"
|
#include "baseentity.h"
|
||||||
|
#include "cglm/mat4.h"
|
||||||
#include "physics.h"
|
#include "physics.h"
|
||||||
#include "rendering.h"
|
#include "rendering.h"
|
||||||
#include "tier0/platform.h"
|
#include "tier0/platform.h"
|
||||||
@@ -7,6 +8,8 @@
|
|||||||
#include "tier1/utlvector.h"
|
#include "tier1/utlvector.h"
|
||||||
#include "math3d.h"
|
#include "math3d.h"
|
||||||
|
|
||||||
|
CUtlVector<IVertexBuffer*> g_BrushVertices;
|
||||||
|
|
||||||
void CBrushEntity::Precache()
|
void CBrushEntity::Precache()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -66,9 +69,9 @@ void C_BrushEntity::Spawn()
|
|||||||
};
|
};
|
||||||
|
|
||||||
CBrushEntity* pBrushEntity = (CBrushEntity*)pEntity;
|
CBrushEntity* pBrushEntity = (CBrushEntity*)pEntity;
|
||||||
uint32_t numVertices = 15*pBrushEntity->m_mesh.GetSize();
|
uint32_t numVertices = pBrushEntity->m_mesh.GetSize();
|
||||||
|
|
||||||
vertexBuffer = IRenderer::CreateVertexBuffer(numVertices*4);
|
vertexBuffer = IRenderer::CreateVertexBuffer(numVertices*60);
|
||||||
|
|
||||||
Vertex_t *pTriangles = (Vertex_t*)vertexBuffer->Map();
|
Vertex_t *pTriangles = (Vertex_t*)vertexBuffer->Map();
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
@@ -100,15 +103,7 @@ void C_BrushEntity::Destroy()
|
|||||||
}
|
}
|
||||||
void C_BrushEntity::Think( float fDelta )
|
void C_BrushEntity::Think( float fDelta )
|
||||||
{
|
{
|
||||||
mat4 matrix;
|
g_BrushVertices.AppendTail(vertexBuffer);
|
||||||
glm_mat4_zero(matrix);
|
|
||||||
for (int i = 0; i < 9; i++) {
|
|
||||||
matrix[i/3][i%3] = pEntity->m_matrix[i/3][i%3];
|
|
||||||
}
|
|
||||||
matrix[3][3] = 1;
|
|
||||||
matrix[3][0] = pEntity->m_position[0];
|
|
||||||
matrix[3][1] = pEntity->m_position[1];
|
|
||||||
matrix[3][2] = pEntity->m_position[2];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
IGraphicsPipeline *g_BrushPipeline;
|
IGraphicsPipeline *g_BrushPipeline;
|
||||||
@@ -123,33 +118,47 @@ private:
|
|||||||
};
|
};
|
||||||
DECLARE_MESH_RENDERING_STAGE(CBrushRendering, brush_rasterizer);
|
DECLARE_MESH_RENDERING_STAGE(CBrushRendering, brush_rasterizer);
|
||||||
|
|
||||||
CUtlVector<IVertexBuffer*> g_BrushVertices;
|
|
||||||
|
|
||||||
|
ITexture *bricks;
|
||||||
void CBrushRendering::Init()
|
void CBrushRendering::Init()
|
||||||
{
|
{
|
||||||
V_printf("cool\n");
|
g_BrushPipeline = IRenderer::CreateGraphicsPipeline(
|
||||||
IRenderer::CreateGraphicsPipeline(
|
{
|
||||||
{
|
{"gfx/mesh_vert.shader", SHADER_TYPE_VERTEX},
|
||||||
{"shaders/brush_vert.spv", SHADER_TYPE_VERTEX},
|
{"gfx/mesh_frag.shader", SHADER_TYPE_FRAGMENT},
|
||||||
{"shaders/brush_frag.spv", SHADER_TYPE_FRAGMENT},
|
},
|
||||||
},
|
{
|
||||||
{}, 64,
|
{SHADER_INPUT_TYPE_UNIFORM_BUFFER,0},
|
||||||
20,
|
{SHADER_INPUT_TYPE_TEXTURES,1},
|
||||||
{{0,0,EVertexFormat::VERTEX_FORMAT_X32Y32Z32}, {12,1,EVertexFormat::VERTEX_FORMAT_X32Y32}},
|
},
|
||||||
{EImageFormat::IMAGE_FORMAT_R8G8B8A8}
|
80,
|
||||||
);
|
20,
|
||||||
|
{{0,0,EVertexFormat::VERTEX_FORMAT_X32Y32Z32}, {12,1,EVertexFormat::VERTEX_FORMAT_X32Y32}},
|
||||||
|
{EImageFormat::IMAGE_FORMAT_R8G8B8A8},
|
||||||
|
true
|
||||||
|
);
|
||||||
|
bricks = ITextureManager::LoadTexture("textures/bricks.png");
|
||||||
};
|
};
|
||||||
|
|
||||||
void CBrushRendering::Frame( float fDelta )
|
void CBrushRendering::Frame( float fDelta )
|
||||||
{
|
{
|
||||||
V_printf("cooll\n");
|
|
||||||
IRenderer::ResetState();
|
IRenderer::ResetState();
|
||||||
IRenderer::SetDepthMode(DEPTH_MODE_LESS_EQUAL);
|
|
||||||
IRenderer::BindPipeline(g_BrushPipeline);
|
IRenderer::BindPipeline(g_BrushPipeline);
|
||||||
for (auto &vertices: g_BrushVertices)
|
struct {
|
||||||
|
mat4 i;
|
||||||
|
uint32_t a = ITextureManager::GetTextureID(bricks);
|
||||||
|
uint32_t b = 0;
|
||||||
|
uint32_t c = 0;
|
||||||
|
} constants;
|
||||||
|
glm_mat4_identity(constants.i);
|
||||||
|
IRenderer::SetConstants(sizeof(constants), &constants);
|
||||||
|
IRenderer::BindData(0, IRenderer::GetCameraMatrix(), 0);
|
||||||
|
IRenderer::PushBindings();
|
||||||
|
for (auto &v: g_BrushVertices)
|
||||||
{
|
{
|
||||||
IRenderer::Draw(vertices, 0);
|
IRenderer::Draw(v, 0);
|
||||||
}
|
}
|
||||||
|
g_BrushVertices = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
void CBrushRendering::Deinit()
|
void CBrushRendering::Deinit()
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ void IEngine_Signal(int sig)
|
|||||||
void IEngine::Init()
|
void IEngine::Init()
|
||||||
{
|
{
|
||||||
/* trap signals */
|
/* trap signals */
|
||||||
#ifdef __linux
|
#ifdef __linux__
|
||||||
signal(SIGHUP, IEngine_Signal);
|
signal(SIGHUP, IEngine_Signal);
|
||||||
signal(SIGINT, IEngine_Signal);
|
signal(SIGINT, IEngine_Signal);
|
||||||
signal(SIGQUIT, IEngine_Signal);
|
signal(SIGQUIT, IEngine_Signal);
|
||||||
@@ -75,6 +75,13 @@ void IEngine::Init()
|
|||||||
signal(SIGSEGV, IEngine_Signal);
|
signal(SIGSEGV, IEngine_Signal);
|
||||||
signal(SIGTERM, IEngine_Signal);
|
signal(SIGTERM, IEngine_Signal);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef __WIN32__
|
||||||
|
signal(SIGINT, IEngine_Signal);
|
||||||
|
signal(SIGILL, IEngine_Signal);
|
||||||
|
signal(SIGFPE, IEngine_Signal);
|
||||||
|
signal(SIGSEGV, IEngine_Signal);
|
||||||
|
signal(SIGTERM, IEngine_Signal);
|
||||||
|
#endif
|
||||||
|
|
||||||
IFileSystem::InitFilesystem();
|
IFileSystem::InitFilesystem();
|
||||||
px = px_init();
|
px = px_init();
|
||||||
@@ -93,6 +100,8 @@ void IEngine::Init()
|
|||||||
|
|
||||||
IServer::LoadGame("funnygame");
|
IServer::LoadGame("funnygame");
|
||||||
|
|
||||||
|
IVideo::CreatePipelines();
|
||||||
|
|
||||||
IConsole::AddCommand("exec default.cfg;");
|
IConsole::AddCommand("exec default.cfg;");
|
||||||
IConsole::Execute();
|
IConsole::Execute();
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ void CGameMode::RoundBegin( void )
|
|||||||
if (start->m_bIsRunning == false)
|
if (start->m_bIsRunning == false)
|
||||||
pSelectedStart = start;
|
pSelectedStart = start;
|
||||||
};
|
};
|
||||||
pSelectedStart->RoundStart(player);
|
if (pSelectedStart)
|
||||||
|
pSelectedStart->RoundStart(player);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,9 @@
|
|||||||
|
|
||||||
char g_PressedKeys[KEY_NUM_KEYS];
|
char g_PressedKeys[KEY_NUM_KEYS];
|
||||||
float g_fAxisValues[AXIS_NUM_AXIS];
|
float g_fAxisValues[AXIS_NUM_AXIS];
|
||||||
|
float g_fAxisModifiers[AXIS_NUM_AXIS];
|
||||||
CUtlString g_bindings[256];
|
CUtlString g_bindings[256];
|
||||||
|
bool g_bController = false;
|
||||||
|
|
||||||
struct KeyName_t {
|
struct KeyName_t {
|
||||||
const char *szName;
|
const char *szName;
|
||||||
@@ -17,7 +19,22 @@ KeyName_t keys[] = {
|
|||||||
{"TAB",KEY_TAB},
|
{"TAB",KEY_TAB},
|
||||||
{"ENTER",KEY_ENTER},
|
{"ENTER",KEY_ENTER},
|
||||||
{"ESCAPE",KEY_ESCAPE},
|
{"ESCAPE",KEY_ESCAPE},
|
||||||
|
{"ESC",KEY_ESCAPE},
|
||||||
{"SPACE",KEY_SPACE},
|
{"SPACE",KEY_SPACE},
|
||||||
|
|
||||||
|
{"F1",KEY_F1},
|
||||||
|
{"F2",KEY_F2},
|
||||||
|
{"F3",KEY_F3},
|
||||||
|
{"F4",KEY_F4},
|
||||||
|
{"F5",KEY_F5},
|
||||||
|
{"F6",KEY_F6},
|
||||||
|
{"F7",KEY_F7},
|
||||||
|
{"F8",KEY_F8},
|
||||||
|
{"F9",KEY_F9},
|
||||||
|
{"F10",KEY_F10},
|
||||||
|
{"F11",KEY_F11},
|
||||||
|
{"F12",KEY_F12},
|
||||||
|
|
||||||
{"A",KEY_A},
|
{"A",KEY_A},
|
||||||
{"B",KEY_B},
|
{"B",KEY_B},
|
||||||
{"C",KEY_C},
|
{"C",KEY_C},
|
||||||
@@ -105,8 +122,14 @@ void IInput::AxisEvent( EInputAxis axis, float fValue )
|
|||||||
{
|
{
|
||||||
if (axis == AXIS_MOUSE_X || axis == AXIS_MOUSE_Y)
|
if (axis == AXIS_MOUSE_X || axis == AXIS_MOUSE_Y)
|
||||||
{
|
{
|
||||||
|
g_bController = false;
|
||||||
g_fAxisValues[axis] += fValue*3.09;
|
g_fAxisValues[axis] += fValue*3.09;
|
||||||
}
|
}
|
||||||
|
if (axis == AXIS_CONTROLLER_PITCH || axis == AXIS_CONTROLLER_YAW)
|
||||||
|
{
|
||||||
|
g_bController = true;
|
||||||
|
g_fAxisModifiers[axis] = fValue*3.09;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -114,7 +137,8 @@ void IInput::AxisEvent( EInputAxis axis, float fValue )
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void IInput::Frame( void )
|
void IInput::Frame( void )
|
||||||
{
|
{
|
||||||
|
g_fAxisValues[AXIS_MOUSE_X] += g_fAxisModifiers[AXIS_CONTROLLER_PITCH];
|
||||||
|
g_fAxisValues[AXIS_MOUSE_Y] += g_fAxisModifiers[AXIS_CONTROLLER_YAW];
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -1,179 +0,0 @@
|
|||||||
#include "Metal/Metal.hpp"
|
|
||||||
#include "math3d.h"
|
|
||||||
#include "filesystem.h"
|
|
||||||
#include "rendering.h"
|
|
||||||
#include "tier0/lib.h"
|
|
||||||
#include "tier1/utlvector.h"
|
|
||||||
#include "tier0/platform.h"
|
|
||||||
#include "rendering.h"
|
|
||||||
#include "ml_video.h"
|
|
||||||
|
|
||||||
mat4 g_cameraView;
|
|
||||||
|
|
||||||
class CMlBuffer: public IBuffer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void *Map() override;
|
|
||||||
void Unmap() override;
|
|
||||||
MTL::Buffer *m_buffer;
|
|
||||||
};
|
|
||||||
|
|
||||||
void *CMlBuffer::Map()
|
|
||||||
{
|
|
||||||
return m_buffer->contents();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CMlBuffer::Unmap()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
IStorageBuffer *IRenderer::CreateStorageBuffer( uint32_t uSize )
|
|
||||||
{
|
|
||||||
CMlBuffer *pBuffer = new CMlBuffer;
|
|
||||||
pBuffer->m_buffer = g_mlDevice->newBuffer(uSize, MTL::ResourceStorageModeShared);
|
|
||||||
return pBuffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
IUniformBuffer *IRenderer::CreateUniformBuffer( uint32_t uSize )
|
|
||||||
{
|
|
||||||
CMlBuffer *pBuffer = new CMlBuffer;
|
|
||||||
pBuffer->m_buffer = g_mlDevice->newBuffer(uSize, MTL::ResourceStorageModeShared);
|
|
||||||
return pBuffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
IVertexBuffer *IRenderer::CreateVertexBuffer( uint32_t uSize )
|
|
||||||
{
|
|
||||||
CMlBuffer *pBuffer = new CMlBuffer;
|
|
||||||
pBuffer->m_buffer = g_mlDevice->newBuffer(uSize, MTL::ResourceStorageModeShared);
|
|
||||||
return pBuffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
IIndexBuffer *IRenderer::CreateIndexBuffer( uint32_t uSize )
|
|
||||||
{
|
|
||||||
CMlBuffer *pBuffer = new CMlBuffer;
|
|
||||||
pBuffer->m_buffer = g_mlDevice->newBuffer(uSize, MTL::ResourceStorageModeShared);
|
|
||||||
return pBuffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
IImage *IRenderer::CreateImage( EImageFormat format, uint32_t usage, uint32_t nWidth, uint32_t nHeight, uint32_t nSamples )
|
|
||||||
{
|
|
||||||
|
|
||||||
};
|
|
||||||
void IRenderer::DestroyBuffer( IBuffer *pBuffer )
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void IRenderer::DestroyImage( IImage *pImage )
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void IRenderer::SetConstants( uint32_t nSize, uint32_t nOffset, void *pData )
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void IRenderer::Barrier( EBarrierStage stageIn, uint32_t stageOut, CUtlVector<BufferBarrier_t> buffers, CUtlVector<ImageBarrier_t> images )
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void IRenderer::BindData( uint32_t binding, IBuffer *pBuffer, IImage* pImage)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void IRenderer::BindPipeline( IPipeline *pPipeline )
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void IRenderer::Begin( uint32_t nWidth, uint32_t nHeight, CUtlVector<RenderingColorAttachment_t> attachments, RenderingDepthAttachment_t depth )
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void IRenderer::ResetState()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void IRenderer::SetDepthMode( EDepthMode mode )
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void IRenderer::Draw( IVertexBuffer *pVertex, IIndexBuffer *pIndex )
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void IRenderer::End()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
IGraphicsPipeline *IRenderer::CreateGraphicsPipeline(
|
|
||||||
CUtlVector<Shader_t> shaders,
|
|
||||||
CUtlVector<ShaderInput_t> inputs,
|
|
||||||
uint32_t nConstantsSize,
|
|
||||||
uint32_t nVertexSize,
|
|
||||||
CUtlVector<VertexAttribute_t> vertexFormat,
|
|
||||||
CUtlVector<EImageFormat> outputFormats
|
|
||||||
)
|
|
||||||
{
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
CUtlVector<RenderingStep_t> g_StepPrepass;
|
|
||||||
CUtlVector<RenderingStep_t> g_StepMeshRendering;
|
|
||||||
CUtlVector<RenderingStep_t> g_StepShading;
|
|
||||||
CUtlVector<RenderingStep_t> g_StepPostProcessing;
|
|
||||||
CUtlVector<RenderingStep_t> g_StepUI;
|
|
||||||
|
|
||||||
CRenderingStep::CRenderingStep()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
CRenderingStep::CRenderingStep(const char *szStepName, CreateRenderStepFn pfn)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
CPrepassRenderingStep::CPrepassRenderingStep(const char *szStepName, CreateRenderStepFn pfn)
|
|
||||||
{
|
|
||||||
g_StepPrepass.AppendTail({pfn(), szStepName});
|
|
||||||
}
|
|
||||||
|
|
||||||
CMeshRenderingStep::CMeshRenderingStep(const char *szStepName, CreateRenderStepFn pfn)
|
|
||||||
{
|
|
||||||
g_StepMeshRendering.AppendTail({pfn(), szStepName});
|
|
||||||
}
|
|
||||||
|
|
||||||
CShadingRenderingStep::CShadingRenderingStep(const char *szStepName, CreateRenderStepFn pfn)
|
|
||||||
{
|
|
||||||
g_StepShading.AppendTail({pfn(), szStepName});
|
|
||||||
}
|
|
||||||
|
|
||||||
CPostProcessingRenderingStep::CPostProcessingRenderingStep(const char *szStepName, CreateRenderStepFn pfn)
|
|
||||||
{
|
|
||||||
g_StepPostProcessing.AppendTail({pfn(), szStepName});
|
|
||||||
}
|
|
||||||
|
|
||||||
CUIRenderingStep::CUIRenderingStep(const char *szStepName, CreateRenderStepFn pfn)
|
|
||||||
{
|
|
||||||
g_StepUI.AppendTail({pfn(), szStepName});
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,12 +1,31 @@
|
|||||||
#ifndef ML_VIDEO_H
|
#ifndef ML_VIDEO_H
|
||||||
#define ML_VIDEO_H
|
#define ML_VIDEO_H
|
||||||
|
|
||||||
|
#include "tier0/platform.h"
|
||||||
#include "Metal/Metal.hpp"
|
#include "Metal/Metal.hpp"
|
||||||
#include "QuartzCore/QuartzCore.hpp"
|
#include "QuartzCore/QuartzCore.hpp"
|
||||||
|
|
||||||
extern CA::MetalLayer *g_mlLayer;
|
extern CA::MetalLayer *g_mlLayer;
|
||||||
extern MTL::Device *g_mlDevice;
|
extern MTL::Device *g_mlDevice;
|
||||||
extern MTL::CommandQueue *g_mlCommandQueue;
|
extern MTL::CommandQueue *g_mlCommandQueue;
|
||||||
|
extern MTL::CommandBuffer *g_mlCommandBuffer;
|
||||||
extern NS::AutoreleasePool *g_mlPool;
|
extern NS::AutoreleasePool *g_mlPool;
|
||||||
|
|
||||||
|
extern char g_bConfigNotify;
|
||||||
|
extern uint32_t g_nWindowWidth;
|
||||||
|
extern uint32_t g_nWindowHeight;
|
||||||
|
|
||||||
|
extern CUtlVector<MTL::Texture*> g_destroyImageBuffer;
|
||||||
|
extern CUtlVector<MTL::Buffer*> g_destroyBuffersBuffer;
|
||||||
|
extern MTL::Texture *g_mlDrawableTexture;
|
||||||
|
|
||||||
|
interface IMetal
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static void Init();
|
||||||
|
static void CreatePipelines();
|
||||||
|
static void Frame();
|
||||||
|
static void Deinit();
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
13
engine/ml_video.mm
Normal file
13
engine/ml_video.mm
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#import <QuartzCore/CAMetalLayer.h>
|
||||||
|
#import <Metal/Metal.h>
|
||||||
|
|
||||||
|
namespace CA {
|
||||||
|
class MetalLayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
void APPLE_ConfigureLayer(CA::MetalLayer* pMetalLayer)
|
||||||
|
{
|
||||||
|
if (!pMetalLayer) return;
|
||||||
|
|
||||||
|
CAMetalLayer* nsLayer = (__bridge CAMetalLayer*)pMetalLayer;
|
||||||
|
};
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
#include "SDL3/SDL_metal.h"
|
#include "SDL3/SDL_metal.h"
|
||||||
#include "SDL3/SDL_events.h"
|
#include "SDL3/SDL_events.h"
|
||||||
#include "tier0/minmax.h"
|
#include "tier0/minmax.h"
|
||||||
|
#include "ml_video.h"
|
||||||
|
|
||||||
char g_bConfigNotify = 0;
|
char g_bConfigNotify = 0;
|
||||||
uint32_t g_nWindowWidth = 1280;
|
uint32_t g_nWindowWidth = 1280;
|
||||||
@@ -29,7 +30,9 @@ SDL_MetalView g_mlView;
|
|||||||
CA::MetalLayer *g_mlLayer;
|
CA::MetalLayer *g_mlLayer;
|
||||||
MTL::Device *g_mlDevice;
|
MTL::Device *g_mlDevice;
|
||||||
MTL::CommandQueue *g_mlCommandQueue;
|
MTL::CommandQueue *g_mlCommandQueue;
|
||||||
|
MTL::CommandBuffer *g_mlCommandBuffer;
|
||||||
NS::AutoreleasePool *g_mlPool;
|
NS::AutoreleasePool *g_mlPool;
|
||||||
|
MTL::Texture *g_mlDrawableTexture;
|
||||||
|
|
||||||
#if defined(__APPLE__) && defined(__MACH__)
|
#if defined(__APPLE__) && defined(__MACH__)
|
||||||
#include "TargetConditionals.h"
|
#include "TargetConditionals.h"
|
||||||
@@ -114,7 +117,7 @@ void IVideo_HandleEvents()
|
|||||||
SDL_MouseMotionEvent *motion = &event.motion;
|
SDL_MouseMotionEvent *motion = &event.motion;
|
||||||
switch (event.type)
|
switch (event.type)
|
||||||
{
|
{
|
||||||
case SDL_EVENT_WINDOW_RESIZED:
|
case SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED:
|
||||||
g_nWindowWidth = event.window.data1;
|
g_nWindowWidth = event.window.data1;
|
||||||
g_nWindowHeight = event.window.data2;
|
g_nWindowHeight = event.window.data2;
|
||||||
g_bConfigNotify = 2;
|
g_bConfigNotify = 2;
|
||||||
@@ -132,17 +135,51 @@ void IVideo_HandleEvents()
|
|||||||
IInput::AxisEvent(AXIS_MOUSE_X, motion->yrel*0.022);
|
IInput::AxisEvent(AXIS_MOUSE_X, motion->yrel*0.022);
|
||||||
IInput::AxisEvent(AXIS_MOUSE_Y, -motion->xrel*0.022);
|
IInput::AxisEvent(AXIS_MOUSE_Y, -motion->xrel*0.022);
|
||||||
break;
|
break;
|
||||||
|
case SDL_EVENT_GAMEPAD_AXIS_MOTION:
|
||||||
|
{
|
||||||
|
SDL_GamepadAxis axis = (SDL_GamepadAxis)event.gaxis.axis;
|
||||||
|
float value = event.gaxis.value / 32768.0f;
|
||||||
|
if (abs(event.gaxis.value)<1000)
|
||||||
|
value = 0;
|
||||||
|
SDL_JoystickID id = event.gaxis.which;
|
||||||
|
|
||||||
|
if (axis == SDL_GAMEPAD_AXIS_RIGHTY)
|
||||||
|
{
|
||||||
|
IInput::AxisEvent(AXIS_CONTROLLER_PITCH, value);
|
||||||
|
}
|
||||||
|
if (axis == SDL_GAMEPAD_AXIS_RIGHTX)
|
||||||
|
{
|
||||||
|
IInput::AxisEvent(AXIS_CONTROLLER_YAW, -value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SDL_EVENT_GAMEPAD_BUTTON_DOWN:
|
||||||
|
break;
|
||||||
|
case SDL_EVENT_GAMEPAD_BUTTON_UP:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void APPLE_ConfigureLayer(CA::MetalLayer* pMetalLayer);
|
||||||
void IVideo::Init()
|
void IVideo::Init()
|
||||||
{
|
{
|
||||||
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS);
|
SDL_SetHint(SDL_HINT_RENDER_VSYNC, "0");
|
||||||
g_window = SDL_CreateWindow("rtt", 1280, 720, SDL_WINDOW_METAL);
|
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS | SDL_INIT_GAMEPAD);
|
||||||
|
g_window = SDL_CreateWindow("rtt", 1280, 720, SDL_WINDOW_METAL | SDL_WINDOW_HIGH_PIXEL_DENSITY);
|
||||||
|
|
||||||
|
int nNumGamepads = 0;
|
||||||
|
SDL_JoystickID *pGamepads = SDL_GetGamepads(&nNumGamepads);
|
||||||
|
for ( uint32_t i = 0; i < nNumGamepads; i++ )
|
||||||
|
{
|
||||||
|
SDL_OpenGamepad(pGamepads[i]);
|
||||||
|
}
|
||||||
|
|
||||||
g_mlView = SDL_Metal_CreateView(g_window);
|
g_mlView = SDL_Metal_CreateView(g_window);
|
||||||
g_mlLayer = (CA::MetalLayer*)SDL_Metal_GetLayer(g_mlView);
|
g_mlLayer = (CA::MetalLayer*)SDL_Metal_GetLayer(g_mlView);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
g_mlDevice = MTL::CreateSystemDefaultDevice();
|
g_mlDevice = MTL::CreateSystemDefaultDevice();
|
||||||
|
|
||||||
g_mlLayer->setDevice(g_mlDevice);
|
g_mlLayer->setDevice(g_mlDevice);
|
||||||
@@ -151,34 +188,42 @@ void IVideo::Init()
|
|||||||
g_mlCommandQueue = g_mlDevice->newCommandQueue();
|
g_mlCommandQueue = g_mlDevice->newCommandQueue();
|
||||||
|
|
||||||
g_mlLayer->setDrawableSize(CGSizeMake(1280, 720));
|
g_mlLayer->setDrawableSize(CGSizeMake(1280, 720));
|
||||||
|
g_mlLayer->setFramebufferOnly(false);
|
||||||
|
|
||||||
|
IMetal::Init();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IVideo::Frame( float fDelta )
|
void IVideo::Frame( float fDelta )
|
||||||
{
|
{
|
||||||
IVideo_HandleEvents();
|
IVideo_HandleEvents();
|
||||||
|
|
||||||
NS::AutoreleasePool *pool = NS::AutoreleasePool::alloc()->init();
|
NS::AutoreleasePool *pool = NS::AutoreleasePool::alloc()->init();
|
||||||
int w, h;
|
g_mlLayer->setDrawableSize(CGSizeMake(g_nWindowWidth, g_nWindowHeight));
|
||||||
SDL_GetWindowSizeInPixels(g_window, &w, &h);
|
|
||||||
g_mlLayer->setDrawableSize(CGSizeMake(w, h));
|
|
||||||
|
|
||||||
CA::MetalDrawable *drawable = g_mlLayer->nextDrawable();
|
CA::MetalDrawable *drawable = g_mlLayer->nextDrawable();
|
||||||
if (!drawable)
|
if (!drawable)
|
||||||
return;
|
return;
|
||||||
|
g_mlDrawableTexture = drawable->texture();
|
||||||
|
|
||||||
MTL::CommandBuffer *commandBuffer = g_mlCommandQueue->commandBuffer();
|
g_mlCommandBuffer = g_mlCommandQueue->commandBuffer();
|
||||||
|
IMetal::Frame();
|
||||||
MTL::RenderPassDescriptor *renderPass = MTL::RenderPassDescriptor::alloc()->init();
|
|
||||||
renderPass->colorAttachments()->object(0)->setTexture(drawable->texture());
|
g_mlCommandBuffer->presentDrawable(drawable);
|
||||||
renderPass->colorAttachments()->object(0)->setLoadAction(MTL::LoadActionClear);
|
g_mlCommandBuffer->commit();
|
||||||
renderPass->colorAttachments()->object(0)->setStoreAction(MTL::StoreActionStore);
|
g_mlCommandBuffer->waitUntilCompleted();
|
||||||
renderPass->colorAttachments()->object(0)->setClearColor(MTL::ClearColor(0.0, 0, 1.0, 1.0));
|
for (auto &image: g_destroyImageBuffer)
|
||||||
MTL::RenderCommandEncoder *renderEncoder = commandBuffer->renderCommandEncoder(renderPass);
|
{
|
||||||
renderEncoder->endEncoding();
|
image->release();
|
||||||
|
}
|
||||||
commandBuffer->presentDrawable(drawable);
|
for (auto &buffer: g_destroyBuffersBuffer)
|
||||||
commandBuffer->commit();
|
{
|
||||||
|
buffer->release();
|
||||||
|
}
|
||||||
|
g_destroyImageBuffer = {};
|
||||||
|
g_destroyBuffersBuffer = {};
|
||||||
pool->release();
|
pool->release();
|
||||||
|
g_bConfigNotify = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IVideo::Deinit()
|
void IVideo::Deinit()
|
||||||
@@ -186,3 +231,8 @@ void IVideo::Deinit()
|
|||||||
g_mlCommandQueue->release();
|
g_mlCommandQueue->release();
|
||||||
g_mlDevice->release();
|
g_mlDevice->release();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void IVideo::CreatePipelines( )
|
||||||
|
{
|
||||||
|
IMetal::CreatePipelines();
|
||||||
|
}
|
||||||
|
|||||||
43
engine/rendering.cpp
Normal file
43
engine/rendering.cpp
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
#include "rendering.h"
|
||||||
|
|
||||||
|
CUtlVector<RenderingStep_t> g_StepPrepass;
|
||||||
|
CUtlVector<RenderingStep_t> g_StepMeshRendering;
|
||||||
|
CUtlVector<RenderingStep_t> g_StepShading;
|
||||||
|
CUtlVector<RenderingStep_t> g_StepPostProcessing;
|
||||||
|
CUtlVector<RenderingStep_t> g_StepUI;
|
||||||
|
|
||||||
|
CRenderingStep::CRenderingStep()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CRenderingStep::CRenderingStep(const char *szStepName, CreateRenderStepFn pfn)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CPrepassRenderingStep::CPrepassRenderingStep(const char *szStepName, CreateRenderStepFn pfn)
|
||||||
|
{
|
||||||
|
g_StepPrepass.AppendTail({pfn(), szStepName});
|
||||||
|
}
|
||||||
|
|
||||||
|
CMeshRenderingStep::CMeshRenderingStep(const char *szStepName, CreateRenderStepFn pfn)
|
||||||
|
{
|
||||||
|
g_StepMeshRendering.AppendTail({pfn(), szStepName});
|
||||||
|
}
|
||||||
|
|
||||||
|
CShadingRenderingStep::CShadingRenderingStep(const char *szStepName, CreateRenderStepFn pfn)
|
||||||
|
{
|
||||||
|
g_StepShading.AppendTail({pfn(), szStepName});
|
||||||
|
}
|
||||||
|
|
||||||
|
CPostProcessingRenderingStep::CPostProcessingRenderingStep(const char *szStepName, CreateRenderStepFn pfn)
|
||||||
|
{
|
||||||
|
g_StepPostProcessing.AppendTail({pfn(), szStepName});
|
||||||
|
}
|
||||||
|
|
||||||
|
CUIRenderingStep::CUIRenderingStep(const char *szStepName, CreateRenderStepFn pfn)
|
||||||
|
{
|
||||||
|
g_StepUI.AppendTail({pfn(), szStepName});
|
||||||
|
}
|
||||||
|
|
||||||
@@ -21,9 +21,6 @@ extern "C" void IGame_Load(void);
|
|||||||
void IServer::LoadGame( const char *psz )
|
void IServer::LoadGame( const char *psz )
|
||||||
{
|
{
|
||||||
#ifndef STATIC_BUILD
|
#ifndef STATIC_BUILD
|
||||||
#ifdef __WIN32__
|
|
||||||
g_serverdll = Plat_LoadLibrary(CUtlString("%s/bin/server.dll", psz));
|
|
||||||
#endif
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
g_serverdll = Plat_LoadLibrary(CUtlString("%s/bin/libserver.so", psz));
|
g_serverdll = Plat_LoadLibrary(CUtlString("%s/bin/libserver.so", psz));
|
||||||
Plat_LoadLibrary(CUtlString("%s/bin/libclient.so", psz));
|
Plat_LoadLibrary(CUtlString("%s/bin/libclient.so", psz));
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ public:
|
|||||||
class CVkImage: public IImage
|
class CVkImage: public IImage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
vk_image2d_t m_image;
|
vk_image2d_t m_image = {};
|
||||||
|
uint32_t m_usage;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -64,12 +65,7 @@ extern VkSampler g_invalidTextureSampler;
|
|||||||
|
|
||||||
extern CUtlVector<ITexture*> g_textures;
|
extern CUtlVector<ITexture*> g_textures;
|
||||||
|
|
||||||
struct CameraProjection {
|
extern IBuffer *g_cameraProperties;
|
||||||
mat4 viewprojection;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern vk_buffer_t g_cameraProperties;
|
|
||||||
extern CameraProjection *g_cameraDataMap;
|
|
||||||
|
|
||||||
extern IImage *g_meshDepth;
|
extern IImage *g_meshDepth;
|
||||||
extern IImage *g_meshDepthMSAA;
|
extern IImage *g_meshDepthMSAA;
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
#include "rendering.h"
|
#include "rendering.h"
|
||||||
#include "vk_helper.h"
|
#include "vk_helper.h"
|
||||||
#include "vulkan/vulkan_core.h"
|
#include "vulkan/vulkan_core.h"
|
||||||
|
#include "tier0/mem.h"
|
||||||
|
|
||||||
#define STB_IMAGE_IMPLEMENTATION
|
#define STB_IMAGE_IMPLEMENTATION
|
||||||
|
|
||||||
#if defined(__APPLE__) && defined(__MACH__)
|
#if defined(__APPLE__) && defined(__MACH__)
|
||||||
#include "TargetConditionals.h"
|
#include "TargetConditionals.h"
|
||||||
#if TARGET_OS_IPHONE
|
#if TARGET_OS_IPHONE
|
||||||
@@ -27,8 +27,13 @@
|
|||||||
#include "vk_video.h"
|
#include "vk_video.h"
|
||||||
|
|
||||||
VkSampler g_invalidTextureSampler;
|
VkSampler g_invalidTextureSampler;
|
||||||
|
static CVkImage s_SwapchainImage;
|
||||||
|
|
||||||
|
IBuffer *g_cameraProperties;
|
||||||
|
struct CameraProjection {
|
||||||
|
mat4 viewprojection;
|
||||||
|
};
|
||||||
|
|
||||||
vk_buffer_t g_cameraProperties;
|
|
||||||
CameraProjection *g_cameraDataMap;
|
CameraProjection *g_cameraDataMap;
|
||||||
|
|
||||||
mat4 g_cameraView;
|
mat4 g_cameraView;
|
||||||
@@ -41,6 +46,15 @@ class CVkGraphicsPipeline: public IGraphicsPipeline
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
vk_tripipeline_t m_pipeline;
|
vk_tripipeline_t m_pipeline;
|
||||||
|
uint32_t nVertexSize;
|
||||||
|
|
||||||
|
CUtlVector<VkWriteDescriptorSet> m_writes;
|
||||||
|
|
||||||
|
VkDescriptorPool m_descriptorPool;
|
||||||
|
VkDescriptorSet m_descriptorSet;
|
||||||
|
|
||||||
|
CUtlVector<ShaderInput_t> m_inputs;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CVkComputePipeline: public IComputePipeline
|
class CVkComputePipeline: public IComputePipeline
|
||||||
@@ -148,8 +162,8 @@ void IVulkan::Init()
|
|||||||
samplerInfo.maxLod = 0.0f;
|
samplerInfo.maxLod = 0.0f;
|
||||||
vkCreateSampler(g_vkDevice, &samplerInfo, nullptr, &g_invalidTextureSampler);
|
vkCreateSampler(g_vkDevice, &samplerInfo, nullptr, &g_invalidTextureSampler);
|
||||||
|
|
||||||
g_cameraProperties.Create(sizeof(CameraProjection), VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT);
|
g_cameraProperties = IRenderer::CreateUniformBuffer(sizeof(CameraProjection));
|
||||||
g_cameraDataMap = (CameraProjection*)g_cameraProperties.Map(0, 64);
|
g_cameraDataMap = (CameraProjection*)g_cameraProperties->Map();
|
||||||
|
|
||||||
g_meshDepth = IRenderer::CreateImage(IMAGE_FORMAT_DEPTH, IMAGE_USAGE_DEPTH_ATTACHMENT, 1280, 720, 1);
|
g_meshDepth = IRenderer::CreateImage(IMAGE_FORMAT_DEPTH, IMAGE_USAGE_DEPTH_ATTACHMENT, 1280, 720, 1);
|
||||||
g_meshDepthMSAA = IRenderer::CreateImage(IMAGE_FORMAT_DEPTH, IMAGE_USAGE_DEPTH_ATTACHMENT, 1280, 720, 4);
|
g_meshDepthMSAA = IRenderer::CreateImage(IMAGE_FORMAT_DEPTH, IMAGE_USAGE_DEPTH_ATTACHMENT, 1280, 720, 4);
|
||||||
@@ -181,6 +195,12 @@ void IVulkan::Frame()
|
|||||||
glm_rotate(perspective, glm_rad(90), (vec4){0,0,1,0});
|
glm_rotate(perspective, glm_rad(90), (vec4){0,0,1,0});
|
||||||
glm_mat4_mul(perspective,g_cameraDataMap->viewprojection,g_cameraDataMap->viewprojection);
|
glm_mat4_mul(perspective,g_cameraDataMap->viewprojection,g_cameraDataMap->viewprojection);
|
||||||
|
|
||||||
|
s_SwapchainImage.m_image.m_image = g_swapchainImage;
|
||||||
|
s_SwapchainImage.m_image.m_imageView = g_swapchainImageView;
|
||||||
|
s_SwapchainImage.m_image.m_format = g_swapchainFormat;
|
||||||
|
s_SwapchainImage.m_usage = IMAGE_USAGE_COLOR_ATTACHMENT;
|
||||||
|
s_SwapchainImage.format = IMAGE_FORMAT_R8G8B8A8;
|
||||||
|
|
||||||
if (g_bConfigNotify)
|
if (g_bConfigNotify)
|
||||||
{
|
{
|
||||||
IRenderer::DestroyImage(g_meshDepth);
|
IRenderer::DestroyImage(g_meshDepth);
|
||||||
@@ -195,24 +215,82 @@ void IVulkan::Frame()
|
|||||||
|
|
||||||
for (auto &step: g_StepPrepass)
|
for (auto &step: g_StepPrepass)
|
||||||
step.pPipeline->Frame(0);
|
step.pPipeline->Frame(0);
|
||||||
|
IRenderer::Barrier(BARRIER_STAGE_TOP, BARRIER_STAGE_COLOR_OUTPUT, {}, {
|
||||||
|
{
|
||||||
|
.in = BARRIER_MEMORY_PERMISSIONS_NONE,
|
||||||
|
.out = BARRIER_MEMORY_PERMISSIONS_COLOR_WRITE,
|
||||||
|
.pImage = g_meshColor,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.in = BARRIER_MEMORY_PERMISSIONS_NONE,
|
||||||
|
.out = BARRIER_MEMORY_PERMISSIONS_DEPTH_WRITE,
|
||||||
|
.pImage = g_meshDepth,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
IRenderer::Begin(g_nWindowWidth, g_nWindowHeight,
|
IRenderer::Begin(g_nWindowWidth, g_nWindowHeight,
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
0,
|
||||||
g_meshColor,
|
g_meshColor,
|
||||||
g_meshColorMSAA,
|
ATTACHMENT_LOAD_MODE_CLEAR,
|
||||||
ATTACHMENT_LOAD_MODE_DONT_CARE,
|
|
||||||
ATTACHMENT_STORE_MODE_STORE,
|
ATTACHMENT_STORE_MODE_STORE,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
0,
|
||||||
g_meshDepth,
|
g_meshDepth,
|
||||||
g_meshDepthMSAA,
|
ATTACHMENT_LOAD_MODE_CLEAR,
|
||||||
ATTACHMENT_LOAD_MODE_DONT_CARE,
|
|
||||||
ATTACHMENT_STORE_MODE_STORE,
|
ATTACHMENT_STORE_MODE_STORE,
|
||||||
});
|
});
|
||||||
|
|
||||||
for (auto &step: g_StepMeshRendering)
|
for (auto &step: g_StepMeshRendering)
|
||||||
|
{
|
||||||
step.pPipeline->Frame(0);
|
step.pPipeline->Frame(0);
|
||||||
|
}
|
||||||
IRenderer::End();
|
IRenderer::End();
|
||||||
|
IRenderer::Barrier(BARRIER_STAGE_COLOR_OUTPUT, BARRIER_STAGE_BOTTOM, {}, {
|
||||||
|
{
|
||||||
|
.in = BARRIER_MEMORY_PERMISSIONS_COLOR_WRITE,
|
||||||
|
.out = BARRIER_MEMORY_PERMISSIONS_COPY_READ,
|
||||||
|
.pImage = g_meshColor,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.in = BARRIER_MEMORY_PERMISSIONS_DEPTH_WRITE,
|
||||||
|
.out = BARRIER_MEMORY_PERMISSIONS_NONE,
|
||||||
|
.pImage = g_meshDepth,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.in = BARRIER_MEMORY_PERMISSIONS_NONE,
|
||||||
|
.out = BARRIER_MEMORY_PERMISSIONS_COPY_WRITE,
|
||||||
|
.pImage = IRenderer::GetOutputImage(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
VkImageCopy imageCopyRegion = {};
|
||||||
|
imageCopyRegion.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||||
|
imageCopyRegion.srcSubresource.mipLevel = 0;
|
||||||
|
imageCopyRegion.srcSubresource.baseArrayLayer = 0;
|
||||||
|
imageCopyRegion.srcSubresource.layerCount = 1;
|
||||||
|
imageCopyRegion.srcOffset = {0, 0, 0};
|
||||||
|
|
||||||
|
imageCopyRegion.dstSubresource = imageCopyRegion.srcSubresource;
|
||||||
|
imageCopyRegion.dstOffset = {0, 0, 0};
|
||||||
|
|
||||||
|
imageCopyRegion.extent.width = g_nWindowWidth;
|
||||||
|
imageCopyRegion.extent.height = g_nWindowHeight;
|
||||||
|
imageCopyRegion.extent.depth = 1;
|
||||||
|
|
||||||
|
vkCmdCopyImage(
|
||||||
|
g_vkCommandBuffer,
|
||||||
|
((CVkImage*)g_meshColor)->m_image.m_image,
|
||||||
|
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
|
||||||
|
g_swapchainImage,
|
||||||
|
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
|
||||||
|
1,
|
||||||
|
&imageCopyRegion
|
||||||
|
);
|
||||||
for (auto &step: g_StepShading)
|
for (auto &step: g_StepShading)
|
||||||
step.pPipeline->Frame(0);
|
step.pPipeline->Frame(0);
|
||||||
for (auto &step: g_StepPostProcessing)
|
for (auto &step: g_StepPostProcessing)
|
||||||
@@ -289,11 +367,8 @@ void vk_tripipeline_t::Create(
|
|||||||
vkCreatePipelineLayout(g_vkDevice, &pipelineLayoutCreateInfo, NULL, &m_layout);
|
vkCreatePipelineLayout(g_vkDevice, &pipelineLayoutCreateInfo, NULL, &m_layout);
|
||||||
|
|
||||||
VkDynamicState dynamicStates[] = {
|
VkDynamicState dynamicStates[] = {
|
||||||
/* pVertexInputState */
|
|
||||||
VK_DYNAMIC_STATE_VERTEX_INPUT_EXT,
|
|
||||||
/* pInputAssemblyState */
|
/* pInputAssemblyState */
|
||||||
VK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE,
|
VK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE,
|
||||||
VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY,
|
|
||||||
/* pViewportState */
|
/* pViewportState */
|
||||||
VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT,
|
VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT,
|
||||||
VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT,
|
VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT,
|
||||||
@@ -318,12 +393,6 @@ void vk_tripipeline_t::Create(
|
|||||||
VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE,
|
VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE,
|
||||||
VK_DYNAMIC_STATE_STENCIL_OP,
|
VK_DYNAMIC_STATE_STENCIL_OP,
|
||||||
VK_DYNAMIC_STATE_DEPTH_BOUNDS,
|
VK_DYNAMIC_STATE_DEPTH_BOUNDS,
|
||||||
/* pColorBlendState */
|
|
||||||
VK_DYNAMIC_STATE_LOGIC_OP_ENABLE_EXT,
|
|
||||||
VK_DYNAMIC_STATE_COLOR_BLEND_ENABLE_EXT,
|
|
||||||
VK_DYNAMIC_STATE_COLOR_BLEND_EQUATION_EXT,
|
|
||||||
VK_DYNAMIC_STATE_COLOR_WRITE_MASK_EXT,
|
|
||||||
VK_DYNAMIC_STATE_BLEND_CONSTANTS,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
VkVertexInputBindingDescription vibd = {
|
VkVertexInputBindingDescription vibd = {
|
||||||
@@ -340,8 +409,8 @@ void vk_tripipeline_t::Create(
|
|||||||
CUtlVector<VkVertexInputAttributeDescription> viad(vertexFormat.GetSize());
|
CUtlVector<VkVertexInputAttributeDescription> viad(vertexFormat.GetSize());
|
||||||
for ( uint32_t i = 0; i < viad.GetSize(); i++ )
|
for ( uint32_t i = 0; i < viad.GetSize(); i++ )
|
||||||
{
|
{
|
||||||
viad[i].location = 0;
|
viad[i].location = vertexFormat[i].binding;
|
||||||
viad[i].binding = vertexFormat[i].binding;
|
viad[i].binding = 0;
|
||||||
viad[i].format = IRenderer_VertexToVk(vertexFormat[i].format);
|
viad[i].format = IRenderer_VertexToVk(vertexFormat[i].format);
|
||||||
viad[i].offset = vertexFormat[i].offset;
|
viad[i].offset = vertexFormat[i].offset;
|
||||||
}
|
}
|
||||||
@@ -350,7 +419,8 @@ void vk_tripipeline_t::Create(
|
|||||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
|
||||||
.vertexBindingDescriptionCount = 1,
|
.vertexBindingDescriptionCount = 1,
|
||||||
.pVertexBindingDescriptions = &vibd,
|
.pVertexBindingDescriptions = &vibd,
|
||||||
.vertexAttributeDescriptionCount = (uint32_t)vertexFormat.GetSize(),
|
.vertexAttributeDescriptionCount = (uint32_t)viad.GetSize(),
|
||||||
|
.pVertexAttributeDescriptions = viad.GetData()
|
||||||
};
|
};
|
||||||
|
|
||||||
VkPipelineInputAssemblyStateCreateInfo piasci = {
|
VkPipelineInputAssemblyStateCreateInfo piasci = {
|
||||||
@@ -358,7 +428,16 @@ void vk_tripipeline_t::Create(
|
|||||||
.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST,
|
.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST,
|
||||||
.primitiveRestartEnable = VK_TRUE,
|
.primitiveRestartEnable = VK_TRUE,
|
||||||
};
|
};
|
||||||
|
VkPipelineColorBlendAttachmentState pcbas = {
|
||||||
|
.blendEnable = VK_FALSE,
|
||||||
|
.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT,
|
||||||
|
};
|
||||||
|
|
||||||
|
VkPipelineColorBlendStateCreateInfo pcbsci = {};
|
||||||
|
pcbsci.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
|
||||||
|
pcbsci.logicOpEnable = VK_FALSE;
|
||||||
|
pcbsci.attachmentCount = 1;
|
||||||
|
pcbsci.pAttachments = &pcbas;
|
||||||
|
|
||||||
VkPipelineRenderingCreateInfo prci = {
|
VkPipelineRenderingCreateInfo prci = {
|
||||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO,
|
||||||
@@ -372,8 +451,9 @@ void vk_tripipeline_t::Create(
|
|||||||
graphicsPipelineCreateInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
|
graphicsPipelineCreateInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
|
||||||
graphicsPipelineCreateInfo.pVertexInputState = &pvisci;
|
graphicsPipelineCreateInfo.pVertexInputState = &pvisci;
|
||||||
graphicsPipelineCreateInfo.pInputAssemblyState = &piasci;
|
graphicsPipelineCreateInfo.pInputAssemblyState = &piasci;
|
||||||
graphicsPipelineCreateInfo.layout = m_layout;
|
graphicsPipelineCreateInfo.pColorBlendState = &pcbsci;
|
||||||
graphicsPipelineCreateInfo.pDynamicState = &pipelineDynamicStateCreateInfo;
|
graphicsPipelineCreateInfo.pDynamicState = &pipelineDynamicStateCreateInfo;
|
||||||
|
graphicsPipelineCreateInfo.layout = m_layout;
|
||||||
graphicsPipelineCreateInfo.stageCount = shaders.GetSize();
|
graphicsPipelineCreateInfo.stageCount = shaders.GetSize();
|
||||||
CUtlVector<VkPipelineShaderStageCreateInfo> stages(graphicsPipelineCreateInfo.stageCount);
|
CUtlVector<VkPipelineShaderStageCreateInfo> stages(graphicsPipelineCreateInfo.stageCount);
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
@@ -544,6 +624,18 @@ void CVkBuffer::Unmap()
|
|||||||
CUtlVector<ITexture*> g_textures;
|
CUtlVector<ITexture*> g_textures;
|
||||||
CUtlVector<ITexture*> g_newtextures;
|
CUtlVector<ITexture*> g_newtextures;
|
||||||
|
|
||||||
|
uint32_t ITextureManager::GetTextureID(ITexture *pTexture)
|
||||||
|
{
|
||||||
|
uint32_t i = 0;
|
||||||
|
for (auto &t: g_textures)
|
||||||
|
{
|
||||||
|
if (pTexture == t)
|
||||||
|
return i;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
ITexture *ITextureManager::LoadTexture( void *pData, uint32_t X, uint32_t Y, uint32_t numChannels )
|
ITexture *ITextureManager::LoadTexture( void *pData, uint32_t X, uint32_t Y, uint32_t numChannels )
|
||||||
{
|
{
|
||||||
CVkTexture *pTexture = new CVkTexture;
|
CVkTexture *pTexture = new CVkTexture;
|
||||||
@@ -614,13 +706,13 @@ ITexture *ITextureManager::LoadTexture( void *pData, uint32_t X, uint32_t Y, uin
|
|||||||
region.imageOffset = {0, 0, 0};
|
region.imageOffset = {0, 0, 0};
|
||||||
region.imageExtent = {(uint32_t)X, (uint32_t)Y, 1};
|
region.imageExtent = {(uint32_t)X, (uint32_t)Y, 1};
|
||||||
vkCmdCopyBufferToImage(
|
vkCmdCopyBufferToImage(
|
||||||
commandBuffer,
|
commandBuffer,
|
||||||
gpu_buffer.m_buffer,
|
gpu_buffer.m_buffer,
|
||||||
pTexture->image.m_image,
|
pTexture->image.m_image,
|
||||||
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
|
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
|
||||||
1,
|
1,
|
||||||
®ion
|
®ion
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
barrier.oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
|
barrier.oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
|
||||||
@@ -666,7 +758,6 @@ ITexture *ITextureManager::LoadTexture( const char *szName )
|
|||||||
FileHandle_t file = IFileSystem::Open(szName, IFILE_READ);
|
FileHandle_t file = IFileSystem::Open(szName, IFILE_READ);
|
||||||
if (!file)
|
if (!file)
|
||||||
Plat_FatalErrorFunc("Failed to load %s\n", szName);
|
Plat_FatalErrorFunc("Failed to load %s\n", szName);
|
||||||
V_printf("cool %s\n",szName);
|
|
||||||
|
|
||||||
CUtlBuffer<stbi_uc> buffer(IFileSystem::Size(file));
|
CUtlBuffer<stbi_uc> buffer(IFileSystem::Size(file));
|
||||||
IFileSystem::Read(file, buffer.GetMemory(), buffer.GetSize());
|
IFileSystem::Read(file, buffer.GetMemory(), buffer.GetSize());
|
||||||
@@ -713,7 +804,7 @@ IIndexBuffer *IRenderer::CreateIndexBuffer( uint32_t uSize )
|
|||||||
IImage *IRenderer::CreateImage( EImageFormat format, uint32_t usage, uint32_t nWidth, uint32_t nHeight, uint32_t nSamples )
|
IImage *IRenderer::CreateImage( EImageFormat format, uint32_t usage, uint32_t nWidth, uint32_t nHeight, uint32_t nSamples )
|
||||||
{
|
{
|
||||||
VkFormat vkformat;
|
VkFormat vkformat;
|
||||||
VkImageUsageFlags vkusage;
|
VkImageUsageFlags vkusage = 0;
|
||||||
CVkImage *pImage = new CVkImage();
|
CVkImage *pImage = new CVkImage();
|
||||||
VkSampleCountFlagBits samples;
|
VkSampleCountFlagBits samples;
|
||||||
switch (format)
|
switch (format)
|
||||||
@@ -727,6 +818,8 @@ IImage *IRenderer::CreateImage( EImageFormat format, uint32_t usage, uint32_t nW
|
|||||||
if (usage&IMAGE_USAGE_COLOR_ATTACHMENT) vkusage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
if (usage&IMAGE_USAGE_COLOR_ATTACHMENT) vkusage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
||||||
if (usage&IMAGE_USAGE_DEPTH_ATTACHMENT) vkusage |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
|
if (usage&IMAGE_USAGE_DEPTH_ATTACHMENT) vkusage |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
|
||||||
if (usage&IMAGE_USAGE_STORAGE) vkusage |= VK_IMAGE_USAGE_STORAGE_BIT;
|
if (usage&IMAGE_USAGE_STORAGE) vkusage |= VK_IMAGE_USAGE_STORAGE_BIT;
|
||||||
|
vkusage |= VK_IMAGE_USAGE_TRANSFER_DST_BIT;
|
||||||
|
vkusage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
|
||||||
|
|
||||||
switch (nSamples)
|
switch (nSamples)
|
||||||
{
|
{
|
||||||
@@ -734,6 +827,9 @@ IImage *IRenderer::CreateImage( EImageFormat format, uint32_t usage, uint32_t nW
|
|||||||
case 4: samples = VK_SAMPLE_COUNT_4_BIT; break;
|
case 4: samples = VK_SAMPLE_COUNT_4_BIT; break;
|
||||||
default: samples = VK_SAMPLE_COUNT_1_BIT; break;
|
default: samples = VK_SAMPLE_COUNT_1_BIT; break;
|
||||||
}
|
}
|
||||||
|
pImage->m_usage = usage;
|
||||||
|
pImage->m_image = {};
|
||||||
|
pImage->format = format;
|
||||||
pImage->m_image.Create(nWidth, nHeight, vkformat, vkusage, samples);
|
pImage->m_image.Create(nWidth, nHeight, vkformat, vkusage, samples);
|
||||||
return pImage;
|
return pImage;
|
||||||
};
|
};
|
||||||
@@ -751,21 +847,157 @@ void IRenderer::DestroyImage( IImage *pImage )
|
|||||||
pVkImage->m_image.Destroy();
|
pVkImage->m_image.Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IPipeline *g_pCurrentPipeline;
|
||||||
|
|
||||||
|
void IRenderer::SetConstants( uint32_t nSize, void *pData )
|
||||||
void IRenderer::SetConstants( uint32_t nSize, uint32_t nOffset, void *pData )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (!g_pCurrentPipeline)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (g_pCurrentPipeline->type == PIPELINE_TYPE_RASTERIZATION)
|
||||||
|
{
|
||||||
|
CVkGraphicsPipeline *pVkPipeline = (CVkGraphicsPipeline*)g_pCurrentPipeline;
|
||||||
|
vkCmdPushConstants(g_vkCommandBuffer, pVkPipeline->m_pipeline.m_layout, VK_SHADER_STAGE_ALL, 0, nSize, pData);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IRenderer::Barrier( EBarrierStage stageIn, uint32_t stageOut, CUtlVector<BufferBarrier_t> buffers, CUtlVector<ImageBarrier_t> images )
|
void IRenderer::Barrier( uint32_t stageIn, uint32_t stageOut, CUtlVector<BufferBarrier_t> buffers, CUtlVector<ImageBarrier_t> images )
|
||||||
{
|
{
|
||||||
|
VkPipelineStageFlags psfSrc = 0;
|
||||||
|
VkPipelineStageFlags psfDst = 0;
|
||||||
|
if (stageIn & BARRIER_STAGE_TOP) psfSrc |= VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
|
||||||
|
if (stageIn & BARRIER_STAGE_VERTEX_INPUT) psfSrc |= VK_PIPELINE_STAGE_VERTEX_INPUT_BIT;
|
||||||
|
if (stageIn & BARRIER_STAGE_VERTEX_SHADER) psfSrc |= VK_PIPELINE_STAGE_VERTEX_SHADER_BIT;
|
||||||
|
if (stageIn & BARRIER_STAGE_GEOMETRY_SHADER) psfSrc |= VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT;
|
||||||
|
if (stageIn & BARRIER_STAGE_FRAGMENT_SHADER) psfSrc |= VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT;
|
||||||
|
if (stageIn & BARRIER_STAGE_COLOR_OUTPUT) psfSrc |= VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
|
||||||
|
if (stageIn & BARRIER_STAGE_RAY_TRACING_SHADER) psfSrc |= VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR;
|
||||||
|
if (stageIn & BARRIER_STAGE_BOTTOM) psfSrc |= VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT;
|
||||||
|
if (stageOut & BARRIER_STAGE_TOP) psfDst |= VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
|
||||||
|
if (stageOut & BARRIER_STAGE_VERTEX_INPUT) psfDst |= VK_PIPELINE_STAGE_VERTEX_INPUT_BIT;
|
||||||
|
if (stageOut & BARRIER_STAGE_VERTEX_SHADER) psfDst |= VK_PIPELINE_STAGE_VERTEX_SHADER_BIT;
|
||||||
|
if (stageOut & BARRIER_STAGE_GEOMETRY_SHADER) psfDst |= VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT;
|
||||||
|
if (stageOut & BARRIER_STAGE_FRAGMENT_SHADER) psfDst |= VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT;
|
||||||
|
if (stageOut & BARRIER_STAGE_COLOR_OUTPUT) psfDst |= VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
|
||||||
|
if (stageOut & BARRIER_STAGE_RAY_TRACING_SHADER) psfDst |= VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR;
|
||||||
|
if (stageOut & BARRIER_STAGE_BOTTOM) psfDst |= VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT;
|
||||||
|
|
||||||
|
CUtlVector<VkImageMemoryBarrier> imb = {};
|
||||||
|
CUtlVector<VkBufferMemoryBarrier> bmb = {};
|
||||||
|
for (auto &buffer: buffers)
|
||||||
|
{
|
||||||
|
CVkBuffer *pVkBuffer = (CVkBuffer*)buffer.pBuffer;
|
||||||
|
VkBufferMemoryBarrier b = {};
|
||||||
|
b.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER;
|
||||||
|
b.buffer = pVkBuffer->m_buffer.m_buffer;
|
||||||
|
b.size = pVkBuffer->m_buffer.m_nSize;
|
||||||
|
b.srcQueueFamilyIndex = g_drawfamily;
|
||||||
|
b.dstQueueFamilyIndex = g_drawfamily;
|
||||||
|
switch (buffer.in)
|
||||||
|
{
|
||||||
|
case BARRIER_MEMORY_PERMISSIONS_COLOR_READ: b.srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_READ_BIT; break;
|
||||||
|
case BARRIER_MEMORY_PERMISSIONS_COLOR_WRITE: b.srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
switch (buffer.out)
|
||||||
|
{
|
||||||
|
case BARRIER_MEMORY_PERMISSIONS_COLOR_READ: b.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_READ_BIT; break;
|
||||||
|
case BARRIER_MEMORY_PERMISSIONS_COLOR_WRITE: b.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
bmb.AppendTail(b);
|
||||||
|
}
|
||||||
|
for (auto &image: images)
|
||||||
|
{
|
||||||
|
CVkImage *pVkImage = (CVkImage*)image.pImage;
|
||||||
|
VkImageMemoryBarrier b = {};
|
||||||
|
b.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
|
||||||
|
b.image = pVkImage->m_image.m_image;
|
||||||
|
VkImageSubresourceRange isr = {
|
||||||
|
.aspectMask = (pVkImage->format == IMAGE_FORMAT_DEPTH) ? VK_IMAGE_ASPECT_DEPTH_BIT : VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
.levelCount = 1,
|
||||||
|
.layerCount = 1,
|
||||||
|
};
|
||||||
|
b.subresourceRange = isr;
|
||||||
|
if (pVkImage->m_usage == IMAGE_USAGE_COLOR_ATTACHMENT)
|
||||||
|
{
|
||||||
|
b.oldLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||||
|
b.newLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||||
|
}
|
||||||
|
if (pVkImage->m_usage == IMAGE_USAGE_DEPTH_ATTACHMENT)
|
||||||
|
{
|
||||||
|
b.oldLayout = VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL;
|
||||||
|
b.newLayout = VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL;
|
||||||
|
}
|
||||||
|
b.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
||||||
|
b.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
||||||
|
switch (image.in)
|
||||||
|
{
|
||||||
|
case BARRIER_MEMORY_PERMISSIONS_COLOR_READ: b.srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_READ_BIT; break;
|
||||||
|
case BARRIER_MEMORY_PERMISSIONS_COLOR_WRITE: b.srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; break;
|
||||||
|
case BARRIER_MEMORY_PERMISSIONS_DEPTH_READ: b.srcAccessMask = VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT; break;
|
||||||
|
case BARRIER_MEMORY_PERMISSIONS_DEPTH_WRITE: b.srcAccessMask = VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT; break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
switch (image.out)
|
||||||
|
{
|
||||||
|
case BARRIER_MEMORY_PERMISSIONS_COLOR_READ: b.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_READ_BIT; break;
|
||||||
|
case BARRIER_MEMORY_PERMISSIONS_COLOR_WRITE: b.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; break;
|
||||||
|
case BARRIER_MEMORY_PERMISSIONS_DEPTH_READ: b.dstAccessMask = VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT; break;
|
||||||
|
case BARRIER_MEMORY_PERMISSIONS_DEPTH_WRITE: b.dstAccessMask = VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT; break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
imb.AppendTail(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
vkCmdPipelineBarrier(g_vkCommandBuffer, psfSrc, psfDst, 0, 0, 0, bmb.GetSize(), bmb.GetData(), imb.GetSize(), imb.GetData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void IRenderer::BindData( uint32_t binding, IBuffer *pBuffer, IImage* pImage)
|
void IRenderer::BindData( uint32_t binding, IBuffer *pBuffer, IImage* pImage)
|
||||||
{
|
{
|
||||||
|
if (!g_pCurrentPipeline)
|
||||||
|
return;
|
||||||
|
if (g_pCurrentPipeline->type == PIPELINE_TYPE_RASTERIZATION)
|
||||||
|
{
|
||||||
|
CVkGraphicsPipeline *pVkPipeline = (CVkGraphicsPipeline*)g_pCurrentPipeline;
|
||||||
|
CVkBuffer* pVkBuffer = (CVkBuffer*)pBuffer;
|
||||||
|
VkDescriptorBufferInfo dbi;
|
||||||
|
for (auto &input: pVkPipeline->m_inputs)
|
||||||
|
{
|
||||||
|
if (input.binding != binding)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
switch (input.type)
|
||||||
|
{
|
||||||
|
case SHADER_INPUT_TYPE_STORAGE_BUFFER:
|
||||||
|
case SHADER_INPUT_TYPE_UNIFORM_BUFFER:
|
||||||
|
if (!pBuffer)
|
||||||
|
Plat_FatalErrorFunc("pBuffer is NULL\n");
|
||||||
|
if (pVkPipeline->m_writes[binding].pBufferInfo)
|
||||||
|
V_free((void*)pVkPipeline->m_writes[binding].pBufferInfo);
|
||||||
|
dbi = {
|
||||||
|
.buffer = pVkBuffer->m_buffer.m_buffer,
|
||||||
|
.offset = 0,
|
||||||
|
.range = pVkBuffer->m_buffer.m_nSize,
|
||||||
|
};
|
||||||
|
pVkPipeline->m_writes[binding].pBufferInfo = (VkDescriptorBufferInfo*)V_malloc(sizeof(VkDescriptorBufferInfo));
|
||||||
|
V_memcpy((void*)pVkPipeline->m_writes[binding].pBufferInfo, &dbi, sizeof(VkDescriptorBufferInfo));
|
||||||
|
break;
|
||||||
|
case SHADER_INPUT_TYPE_IMAGE:
|
||||||
|
break;
|
||||||
|
case SHADER_INPUT_TYPE_TLAS:
|
||||||
|
break;
|
||||||
|
case SHADER_INPUT_TYPE_TEXTURES:
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -777,8 +1009,45 @@ void IRenderer::BindPipeline( IPipeline *pPipeline )
|
|||||||
if (pPipeline->type == PIPELINE_TYPE_RASTERIZATION)
|
if (pPipeline->type == PIPELINE_TYPE_RASTERIZATION)
|
||||||
{
|
{
|
||||||
CVkGraphicsPipeline *pVkPipeline = (CVkGraphicsPipeline*)pPipeline;
|
CVkGraphicsPipeline *pVkPipeline = (CVkGraphicsPipeline*)pPipeline;
|
||||||
|
|
||||||
vkCmdBindPipeline(g_vkCommandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pVkPipeline->m_pipeline.m_pipeline);
|
vkCmdBindPipeline(g_vkCommandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pVkPipeline->m_pipeline.m_pipeline);
|
||||||
}
|
}
|
||||||
|
g_pCurrentPipeline = pPipeline;
|
||||||
|
}
|
||||||
|
void IRenderer::PushBindings()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!g_pCurrentPipeline)
|
||||||
|
return;
|
||||||
|
if (g_pCurrentPipeline->type == PIPELINE_TYPE_RASTERIZATION)
|
||||||
|
{
|
||||||
|
CVkGraphicsPipeline *pVkPipeline = (CVkGraphicsPipeline*)g_pCurrentPipeline;
|
||||||
|
|
||||||
|
CUtlVector<VkDescriptorImageInfo> textures;
|
||||||
|
textures.Reserve(g_textures.GetSize());
|
||||||
|
for (ITexture *t: g_textures)
|
||||||
|
{
|
||||||
|
CVkTexture *texture = (CVkTexture*)t;
|
||||||
|
VkDescriptorImageInfo image = {};
|
||||||
|
image.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
||||||
|
image.imageView = texture->image.m_imageView;
|
||||||
|
image.sampler = g_invalidTextureSampler;
|
||||||
|
textures.AppendTail(image);
|
||||||
|
};
|
||||||
|
|
||||||
|
for ( int i = 0; i < pVkPipeline->m_inputs.GetSize(); i++ )
|
||||||
|
{
|
||||||
|
if (pVkPipeline->m_inputs[i].type == SHADER_INPUT_TYPE_TEXTURES)
|
||||||
|
{
|
||||||
|
pVkPipeline->m_writes[i].descriptorCount = textures.GetSize();
|
||||||
|
pVkPipeline->m_writes[i].pImageInfo = textures.GetData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
textures[0].sampler = g_invalidTextureSampler;
|
||||||
|
|
||||||
|
vkUpdateDescriptorSets(g_vkDevice, pVkPipeline->m_writes.GetSize(), pVkPipeline->m_writes.GetData(), 0, NULL);
|
||||||
|
vkCmdBindDescriptorSets(g_vkCommandBuffer,VK_PIPELINE_BIND_POINT_GRAPHICS, pVkPipeline->m_pipeline.m_layout, 0, 1, &pVkPipeline->m_descriptorSet, 0, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -823,6 +1092,7 @@ void IRenderer::Begin( uint32_t nWidth, uint32_t nHeight, CUtlVector<RenderingCo
|
|||||||
}
|
}
|
||||||
depthAttachment.loadOp = IRenderer_LoadOpVk(depth.loadMode);
|
depthAttachment.loadOp = IRenderer_LoadOpVk(depth.loadMode);
|
||||||
depthAttachment.storeOp = IRenderer_StoreOpVk(depth.storeMode);
|
depthAttachment.storeOp = IRenderer_StoreOpVk(depth.storeMode);
|
||||||
|
depthAttachment.clearValue = (VkClearValue){.depthStencil = {.depth = 1}};
|
||||||
|
|
||||||
VkRenderingInfo renderInfo = {
|
VkRenderingInfo renderInfo = {
|
||||||
.sType = VK_STRUCTURE_TYPE_RENDERING_INFO,
|
.sType = VK_STRUCTURE_TYPE_RENDERING_INFO,
|
||||||
@@ -838,6 +1108,29 @@ void IRenderer::Begin( uint32_t nWidth, uint32_t nHeight, CUtlVector<RenderingCo
|
|||||||
void IRenderer::ResetState()
|
void IRenderer::ResetState()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
vkCmdSetRasterizerDiscardEnable(g_vkCommandBuffer, VK_FALSE);
|
||||||
|
vkCmdSetDepthBiasEnable(g_vkCommandBuffer, VK_FALSE);
|
||||||
|
vkCmdSetCullMode(g_vkCommandBuffer, VK_CULL_MODE_BACK_BIT);
|
||||||
|
vkCmdSetFrontFace(g_vkCommandBuffer, VK_FRONT_FACE_COUNTER_CLOCKWISE);
|
||||||
|
|
||||||
|
vkCmdSetDepthTestEnable(g_vkCommandBuffer, VK_TRUE);
|
||||||
|
vkCmdSetDepthWriteEnable(g_vkCommandBuffer, VK_TRUE);
|
||||||
|
vkCmdSetDepthCompareOp(g_vkCommandBuffer, VK_COMPARE_OP_LESS);
|
||||||
|
vkCmdSetStencilTestEnable(g_vkCommandBuffer, VK_FALSE);
|
||||||
|
_vkCmdSetPolygonModeEXT(g_vkCommandBuffer, VK_POLYGON_MODE_FILL);
|
||||||
|
|
||||||
|
_vkCmdSetRasterizationSamplesEXT(g_vkCommandBuffer, VK_SAMPLE_COUNT_1_BIT);
|
||||||
|
VkSampleMask sampleMask = 0xFFFFFFFF;
|
||||||
|
_vkCmdSetSampleMaskEXT(g_vkCommandBuffer, VK_SAMPLE_COUNT_1_BIT, &sampleMask);
|
||||||
|
_vkCmdSetAlphaToCoverageEnableEXT(g_vkCommandBuffer, VK_FALSE);
|
||||||
|
|
||||||
|
VkViewport viewport = {0, 0, (float)g_nWindowWidth, (float)g_nWindowHeight, 0.0f, 1.0f};
|
||||||
|
VkRect2D scissor = {{0, 0}, {g_nWindowWidth, g_nWindowHeight}};
|
||||||
|
vkCmdSetViewportWithCount(g_vkCommandBuffer, 1, &viewport);
|
||||||
|
vkCmdSetScissorWithCount(g_vkCommandBuffer, 1, &scissor);
|
||||||
|
|
||||||
|
vkCmdSetPrimitiveTopology(g_vkCommandBuffer, VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST);
|
||||||
|
vkCmdSetPrimitiveRestartEnable(g_vkCommandBuffer, VK_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IRenderer::SetDepthMode( EDepthMode mode )
|
void IRenderer::SetDepthMode( EDepthMode mode )
|
||||||
@@ -847,6 +1140,31 @@ void IRenderer::SetDepthMode( EDepthMode mode )
|
|||||||
|
|
||||||
void IRenderer::Draw( IVertexBuffer *pVertex, IIndexBuffer *pIndex )
|
void IRenderer::Draw( IVertexBuffer *pVertex, IIndexBuffer *pIndex )
|
||||||
{
|
{
|
||||||
|
CVkBuffer *pVkVertex = (CVkBuffer*)pVertex;
|
||||||
|
CVkBuffer *pVkIndex = (CVkBuffer*)pIndex;
|
||||||
|
|
||||||
|
if (!g_pCurrentPipeline)
|
||||||
|
return;
|
||||||
|
if (g_pCurrentPipeline->type == PIPELINE_TYPE_RASTERIZATION)
|
||||||
|
{
|
||||||
|
CVkGraphicsPipeline *pVkPipeline = (CVkGraphicsPipeline*)g_pCurrentPipeline;
|
||||||
|
VkDeviceSize offset = 0;
|
||||||
|
vkCmdBindVertexBuffers(g_vkCommandBuffer, 0, 1, &pVkVertex->m_buffer.m_buffer, &offset);
|
||||||
|
if (pVkIndex)
|
||||||
|
{
|
||||||
|
vkCmdBindIndexBuffer(
|
||||||
|
g_vkCommandBuffer,
|
||||||
|
pVkIndex->m_buffer.m_buffer,
|
||||||
|
0,
|
||||||
|
VK_INDEX_TYPE_UINT32
|
||||||
|
);
|
||||||
|
vkCmdDrawIndexed(g_vkCommandBuffer, pVkIndex->m_buffer.m_nSize/4, 1, 0, 0, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vkCmdDraw(g_vkCommandBuffer, pVkVertex->m_buffer.m_nSize/pVkPipeline->nVertexSize,1,0,0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -855,15 +1173,14 @@ void IRenderer::End()
|
|||||||
vkCmdEndRendering(g_vkCommandBuffer);
|
vkCmdEndRendering(g_vkCommandBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
IGraphicsPipeline *IRenderer::CreateGraphicsPipeline(
|
IGraphicsPipeline *IRenderer::CreateGraphicsPipeline(
|
||||||
CUtlVector<Shader_t> shaders,
|
CUtlVector<Shader_t> shaders,
|
||||||
CUtlVector<ShaderInput_t> inputs,
|
CUtlVector<ShaderInput_t> inputs,
|
||||||
uint32_t nConstantsSize,
|
uint32_t nConstantsSize,
|
||||||
uint32_t nVertexSize,
|
uint32_t nVertexSize,
|
||||||
CUtlVector<VertexAttribute_t> vertexFormats,
|
CUtlVector<VertexAttribute_t> vertexFormats,
|
||||||
CUtlVector<EImageFormat> outputFormats
|
CUtlVector<EImageFormat> outputFormats,
|
||||||
|
bool bDepth
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
CVkGraphicsPipeline *pipeline = new CVkGraphicsPipeline;
|
CVkGraphicsPipeline *pipeline = new CVkGraphicsPipeline;
|
||||||
@@ -884,6 +1201,8 @@ IGraphicsPipeline *IRenderer::CreateGraphicsPipeline(
|
|||||||
{
|
{
|
||||||
vkbindings[i].binding = inputs[i].binding;
|
vkbindings[i].binding = inputs[i].binding;
|
||||||
vkbindings[i].descriptorCount = 1;
|
vkbindings[i].descriptorCount = 1;
|
||||||
|
vkbindings[i].stageFlags = VK_SHADER_STAGE_ALL;
|
||||||
|
|
||||||
if (inputs[i].type == SHADER_INPUT_TYPE_IMAGE) vkbindings[i].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
|
if (inputs[i].type == SHADER_INPUT_TYPE_IMAGE) vkbindings[i].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
|
||||||
if (inputs[i].type == SHADER_INPUT_TYPE_UNIFORM_BUFFER) vkbindings[i].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
|
if (inputs[i].type == SHADER_INPUT_TYPE_UNIFORM_BUFFER) vkbindings[i].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
|
||||||
if (inputs[i].type == SHADER_INPUT_TYPE_STORAGE_BUFFER) vkbindings[i].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
|
if (inputs[i].type == SHADER_INPUT_TYPE_STORAGE_BUFFER) vkbindings[i].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
|
||||||
@@ -898,50 +1217,66 @@ IGraphicsPipeline *IRenderer::CreateGraphicsPipeline(
|
|||||||
{
|
{
|
||||||
vkformats[i] = IRenderer_FormatToVk(outputFormats[i]);
|
vkformats[i] = IRenderer_FormatToVk(outputFormats[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
pipeline->m_pipeline.Create(vkshaders, vkbindings, nConstantsSize, nVertexSize, vertexFormats, vkformats);
|
pipeline->m_pipeline.Create(vkshaders, vkbindings, nConstantsSize, nVertexSize, vertexFormats, vkformats);
|
||||||
|
pipeline->nVertexSize = nVertexSize;
|
||||||
|
|
||||||
|
CUtlVector<VkDescriptorPoolSize> pools = {};
|
||||||
|
for (auto &binding: vkbindings)
|
||||||
|
{
|
||||||
|
VkDescriptorPoolSize dps = {};
|
||||||
|
dps.type = binding.descriptorType;
|
||||||
|
dps.descriptorCount = binding.descriptorCount;
|
||||||
|
pools.AppendTail(dps);
|
||||||
|
}
|
||||||
|
|
||||||
|
VkDescriptorPoolCreateInfo poolInfo = {};
|
||||||
|
poolInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
|
||||||
|
poolInfo.poolSizeCount = pools.GetSize();
|
||||||
|
poolInfo.pPoolSizes = pools.GetData();
|
||||||
|
poolInfo.maxSets = 1;
|
||||||
|
vkCreateDescriptorPool(g_vkDevice, &poolInfo, NULL, &pipeline->m_descriptorPool);
|
||||||
|
|
||||||
|
VkDescriptorSetAllocateInfo allocInfo = {};
|
||||||
|
allocInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
|
||||||
|
allocInfo.descriptorPool = pipeline->m_descriptorPool;
|
||||||
|
allocInfo.descriptorSetCount = 1;
|
||||||
|
allocInfo.pSetLayouts = &pipeline->m_pipeline.m_descriptorSetLayout;
|
||||||
|
vkAllocateDescriptorSets(g_vkDevice, &allocInfo, &pipeline->m_descriptorSet);
|
||||||
|
|
||||||
|
pipeline->m_writes = {};
|
||||||
|
for (auto &input: inputs)
|
||||||
|
{
|
||||||
|
VkWriteDescriptorSet write = {};
|
||||||
|
write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
||||||
|
write.dstSet = pipeline->m_descriptorSet;
|
||||||
|
write.dstArrayElement = 0;
|
||||||
|
write.dstBinding = input.binding;
|
||||||
|
write.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
|
||||||
|
if (input.type == SHADER_INPUT_TYPE_IMAGE) write.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
|
||||||
|
if (input.type == SHADER_INPUT_TYPE_UNIFORM_BUFFER) write.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
|
||||||
|
if (input.type == SHADER_INPUT_TYPE_STORAGE_BUFFER) write.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
|
||||||
|
if (input.type == SHADER_INPUT_TYPE_TLAS) write.descriptorType = VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR;
|
||||||
|
if (input.type == SHADER_INPUT_TYPE_TEXTURES)
|
||||||
|
{
|
||||||
|
write.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
|
||||||
|
write.descriptorCount = 1024;
|
||||||
|
} else
|
||||||
|
write.descriptorCount = 1;
|
||||||
|
pipeline->m_writes.AppendTail(write);
|
||||||
|
}
|
||||||
|
pipeline->m_inputs = inputs;
|
||||||
|
|
||||||
return pipeline;
|
return pipeline;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
IBuffer *IRenderer::GetCameraMatrix()
|
||||||
CUtlVector<RenderingStep_t> g_StepPrepass;
|
|
||||||
CUtlVector<RenderingStep_t> g_StepMeshRendering;
|
|
||||||
CUtlVector<RenderingStep_t> g_StepShading;
|
|
||||||
CUtlVector<RenderingStep_t> g_StepPostProcessing;
|
|
||||||
CUtlVector<RenderingStep_t> g_StepUI;
|
|
||||||
|
|
||||||
CRenderingStep::CRenderingStep()
|
|
||||||
{
|
{
|
||||||
|
return g_cameraProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
CRenderingStep::CRenderingStep(const char *szStepName, CreateRenderStepFn pfn)
|
IImage *IRenderer::GetOutputImage()
|
||||||
{
|
{
|
||||||
|
return &s_SwapchainImage;
|
||||||
}
|
|
||||||
|
|
||||||
CPrepassRenderingStep::CPrepassRenderingStep(const char *szStepName, CreateRenderStepFn pfn)
|
|
||||||
{
|
|
||||||
g_StepPrepass.AppendTail({pfn(), szStepName});
|
|
||||||
}
|
|
||||||
|
|
||||||
CMeshRenderingStep::CMeshRenderingStep(const char *szStepName, CreateRenderStepFn pfn)
|
|
||||||
{
|
|
||||||
g_StepMeshRendering.AppendTail({pfn(), szStepName});
|
|
||||||
}
|
|
||||||
|
|
||||||
CShadingRenderingStep::CShadingRenderingStep(const char *szStepName, CreateRenderStepFn pfn)
|
|
||||||
{
|
|
||||||
g_StepShading.AppendTail({pfn(), szStepName});
|
|
||||||
}
|
|
||||||
|
|
||||||
CPostProcessingRenderingStep::CPostProcessingRenderingStep(const char *szStepName, CreateRenderStepFn pfn)
|
|
||||||
{
|
|
||||||
g_StepPostProcessing.AppendTail({pfn(), szStepName});
|
|
||||||
}
|
|
||||||
|
|
||||||
CUIRenderingStep::CUIRenderingStep(const char *szStepName, CreateRenderStepFn pfn)
|
|
||||||
{
|
|
||||||
g_StepUI.AppendTail({pfn(), szStepName});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#include "SDL3/SDL_gamepad.h"
|
||||||
|
#include "SDL3/SDL_joystick.h"
|
||||||
#include "rendering.h"
|
#include "rendering.h"
|
||||||
#include "tier0/platform.h"
|
#include "tier0/platform.h"
|
||||||
#include "tier1/utlvector.h"
|
#include "tier1/utlvector.h"
|
||||||
@@ -101,7 +103,7 @@ void IVideo_SwapchainInit()
|
|||||||
swapchainCreateInfo.imageFormat = selectedFormat.format;
|
swapchainCreateInfo.imageFormat = selectedFormat.format;
|
||||||
swapchainCreateInfo.imageColorSpace = selectedFormat.colorSpace;
|
swapchainCreateInfo.imageColorSpace = selectedFormat.colorSpace;
|
||||||
swapchainCreateInfo.presentMode = VK_PRESENT_MODE_IMMEDIATE_KHR;
|
swapchainCreateInfo.presentMode = VK_PRESENT_MODE_IMMEDIATE_KHR;
|
||||||
swapchainCreateInfo.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_STORAGE_BIT;
|
swapchainCreateInfo.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT;
|
||||||
swapchainCreateInfo.preTransform = surfaceCapatibilities.currentTransform;
|
swapchainCreateInfo.preTransform = surfaceCapatibilities.currentTransform;
|
||||||
swapchainCreateInfo.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
|
swapchainCreateInfo.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
|
||||||
swapchainCreateInfo.imageArrayLayers = 1;
|
swapchainCreateInfo.imageArrayLayers = 1;
|
||||||
@@ -232,9 +234,16 @@ EInputKey ISDL_KeyName(SDL_Keycode key)
|
|||||||
|
|
||||||
void IVideo::Init()
|
void IVideo::Init()
|
||||||
{
|
{
|
||||||
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS);
|
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS | SDL_INIT_GAMEPAD);
|
||||||
g_window = SDL_CreateWindow("rtt", 1280, 720, SDL_WINDOW_VULKAN);
|
g_window = SDL_CreateWindow("rtt", 1280, 720, SDL_WINDOW_VULKAN);
|
||||||
|
|
||||||
|
int nNumGamepads = 0;
|
||||||
|
SDL_JoystickID *pGamepads = SDL_GetGamepads(&nNumGamepads);
|
||||||
|
for ( uint32_t i = 0; i < nNumGamepads; i++ )
|
||||||
|
{
|
||||||
|
SDL_OpenGamepad(pGamepads[i]);
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int nExtensionCount = 0;
|
unsigned int nExtensionCount = 0;
|
||||||
const char* const* szExtensions = SDL_Vulkan_GetInstanceExtensions(&nExtensionCount);
|
const char* const* szExtensions = SDL_Vulkan_GetInstanceExtensions(&nExtensionCount);
|
||||||
|
|
||||||
@@ -306,23 +315,20 @@ void IVideo::Init()
|
|||||||
queueCreateInfo.queueCount = 1;
|
queueCreateInfo.queueCount = 1;
|
||||||
queueCreateInfo.pQueuePriorities = &queuePriority;
|
queueCreateInfo.pQueuePriorities = &queuePriority;
|
||||||
|
|
||||||
VkPhysicalDeviceVertexInputDynamicStateFeaturesEXT pdvidsfe = {
|
VkPhysicalDeviceShaderObjectFeaturesEXT pdsofe = {
|
||||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_INPUT_DYNAMIC_STATE_FEATURES_EXT,
|
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT,
|
||||||
.vertexInputDynamicState = VK_TRUE,
|
.pNext = 0,
|
||||||
|
.shaderObject = VK_TRUE,
|
||||||
};
|
};
|
||||||
|
|
||||||
VkPhysicalDeviceExtendedDynamicState3FeaturesEXT pdeds3fe = {
|
VkPhysicalDeviceExtendedDynamicState3FeaturesEXT pdeds3fe = {
|
||||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_FEATURES_EXT,
|
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_FEATURES_EXT,
|
||||||
.pNext = &pdvidsfe,
|
.pNext = &pdsofe,
|
||||||
.extendedDynamicState3DepthClampEnable = VK_TRUE,
|
.extendedDynamicState3DepthClampEnable = VK_TRUE,
|
||||||
.extendedDynamicState3PolygonMode = VK_TRUE,
|
.extendedDynamicState3PolygonMode = VK_TRUE,
|
||||||
.extendedDynamicState3RasterizationSamples = VK_TRUE,
|
.extendedDynamicState3RasterizationSamples = VK_TRUE,
|
||||||
.extendedDynamicState3SampleMask = VK_TRUE,
|
.extendedDynamicState3SampleMask = VK_TRUE,
|
||||||
.extendedDynamicState3AlphaToCoverageEnable = VK_TRUE,
|
.extendedDynamicState3AlphaToCoverageEnable = VK_TRUE,
|
||||||
.extendedDynamicState3LogicOpEnable = VK_TRUE,
|
|
||||||
.extendedDynamicState3ColorBlendEnable = VK_TRUE,
|
|
||||||
.extendedDynamicState3ColorBlendEquation = VK_TRUE,
|
|
||||||
.extendedDynamicState3ColorWriteMask = VK_TRUE,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
VkPhysicalDeviceVulkan13Features pdv13f = {
|
VkPhysicalDeviceVulkan13Features pdv13f = {
|
||||||
@@ -344,7 +350,6 @@ void IVideo::Init()
|
|||||||
|
|
||||||
const char *szEnabledGPUExtensions[] = {
|
const char *szEnabledGPUExtensions[] = {
|
||||||
VK_KHR_SWAPCHAIN_EXTENSION_NAME,
|
VK_KHR_SWAPCHAIN_EXTENSION_NAME,
|
||||||
VK_EXT_VERTEX_INPUT_DYNAMIC_STATE_EXTENSION_NAME,
|
|
||||||
VK_EXT_EXTENDED_DYNAMIC_STATE_3_EXTENSION_NAME,
|
VK_EXT_EXTENDED_DYNAMIC_STATE_3_EXTENSION_NAME,
|
||||||
};
|
};
|
||||||
VkDeviceCreateInfo deviceCreateInfo = {};
|
VkDeviceCreateInfo deviceCreateInfo = {};
|
||||||
@@ -395,6 +400,8 @@ void IInput::SetMouseMode( EMouseMode mode )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConVar m_pitch("m_pitch", "0.022", FCVAR_ARCHIVE);
|
||||||
|
ConVar m_yaw("m_yaw", "0.022", FCVAR_ARCHIVE);
|
||||||
void IVideo_HandleEvents()
|
void IVideo_HandleEvents()
|
||||||
{
|
{
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
@@ -419,8 +426,30 @@ void IVideo_HandleEvents()
|
|||||||
IInput::KeyEvent(ISDL_KeyName(key->key),KEY_EVENT_TYPE_UP);
|
IInput::KeyEvent(ISDL_KeyName(key->key),KEY_EVENT_TYPE_UP);
|
||||||
break;
|
break;
|
||||||
case SDL_EVENT_MOUSE_MOTION:
|
case SDL_EVENT_MOUSE_MOTION:
|
||||||
IInput::AxisEvent(AXIS_MOUSE_X, motion->yrel*0.022);
|
IInput::AxisEvent(AXIS_MOUSE_X, motion->yrel*m_pitch.GetFloat());
|
||||||
IInput::AxisEvent(AXIS_MOUSE_Y, -motion->xrel*0.022);
|
IInput::AxisEvent(AXIS_MOUSE_Y, -motion->xrel*m_yaw.GetFloat());
|
||||||
|
break;
|
||||||
|
case SDL_EVENT_GAMEPAD_AXIS_MOTION:
|
||||||
|
{
|
||||||
|
SDL_GamepadAxis axis = (SDL_GamepadAxis)event.gaxis.axis;
|
||||||
|
float value = event.gaxis.value / 32768.0f;
|
||||||
|
if (abs(event.gaxis.value)<1000)
|
||||||
|
value = 0;
|
||||||
|
SDL_JoystickID id = event.gaxis.which;
|
||||||
|
|
||||||
|
if (axis == SDL_GAMEPAD_AXIS_RIGHTY)
|
||||||
|
{
|
||||||
|
IInput::AxisEvent(AXIS_CONTROLLER_PITCH, value);
|
||||||
|
}
|
||||||
|
if (axis == SDL_GAMEPAD_AXIS_RIGHTX)
|
||||||
|
{
|
||||||
|
IInput::AxisEvent(AXIS_CONTROLLER_YAW, -value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SDL_EVENT_GAMEPAD_BUTTON_DOWN:
|
||||||
|
break;
|
||||||
|
case SDL_EVENT_GAMEPAD_BUTTON_UP:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -464,16 +493,6 @@ void IVideo::Frame( float fDelta )
|
|||||||
beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
|
beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
|
||||||
vkBeginCommandBuffer(g_vkCommandBuffer, &beginInfo);
|
vkBeginCommandBuffer(g_vkCommandBuffer, &beginInfo);
|
||||||
IVulkan::Frame();
|
IVulkan::Frame();
|
||||||
VkClearColorValue clear = {
|
|
||||||
.float32 = {
|
|
||||||
1,1,0,1
|
|
||||||
}
|
|
||||||
};
|
|
||||||
VkImageSubresourceRange range = {
|
|
||||||
.levelCount = 1,
|
|
||||||
.layerCount = 1,
|
|
||||||
};
|
|
||||||
vkCmdClearColorImage(g_vkCommandBuffer, g_swapchainImage, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, &clear, 1, &range);
|
|
||||||
vkEndCommandBuffer(g_vkCommandBuffer);
|
vkEndCommandBuffer(g_vkCommandBuffer);
|
||||||
|
|
||||||
VkPipelineStageFlags waitStages[] = {VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT};
|
VkPipelineStageFlags waitStages[] = {VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT};
|
||||||
|
|||||||
2
external/SDL
vendored
2
external/SDL
vendored
Submodule external/SDL updated: b51273512b...7c11a8cb9f
BIN
external/ios/libMoltenVK.a
vendored
BIN
external/ios/libMoltenVK.a
vendored
Binary file not shown.
BIN
external/windows/libSDL3.a
vendored
Normal file
BIN
external/windows/libSDL3.a
vendored
Normal file
Binary file not shown.
BIN
external/windows/libdbghelp.a
vendored
Normal file
BIN
external/windows/libdbghelp.a
vendored
Normal file
Binary file not shown.
BIN
external/windows/libgcc_s_seh-1.dll
vendored
Normal file
BIN
external/windows/libgcc_s_seh-1.dll
vendored
Normal file
Binary file not shown.
BIN
external/windows/libpthread.a
vendored
Normal file
BIN
external/windows/libpthread.a
vendored
Normal file
Binary file not shown.
BIN
external/windows/libstdc++.a
vendored
Normal file
BIN
external/windows/libstdc++.a
vendored
Normal file
Binary file not shown.
BIN
external/windows/libwinpthread-1.dll
vendored
Normal file
BIN
external/windows/libwinpthread-1.dll
vendored
Normal file
Binary file not shown.
BIN
external/windows/libwinpthread.a
vendored
Normal file
BIN
external/windows/libwinpthread.a
vendored
Normal file
Binary file not shown.
BIN
external/windows/vulkan-1.dll
vendored
Normal file
BIN
external/windows/vulkan-1.dll
vendored
Normal file
Binary file not shown.
@@ -22,12 +22,19 @@ CLDProject CCProject::Compile()
|
|||||||
proj.m_szName = m_szName;
|
proj.m_szName = m_szName;
|
||||||
unsigned int hash = GenerateProjectHash();
|
unsigned int hash = GenerateProjectHash();
|
||||||
for (auto &file: files)
|
for (auto &file: files)
|
||||||
|
{
|
||||||
|
CUtlString szTarget = m_target.GetTriplet();
|
||||||
|
CUtlString szOutputFile = CUtlString("%s/%s/cc/%u_%s/%s/%s.o",FPC_TEMPORAL_DIRNAME, szTarget.GetString(), hash, m_szName.GetString(), IFileSystem2::BuildDirectory(), file.GetString());
|
||||||
|
CUtlString szOutputDir = szOutputFile;
|
||||||
|
szOutputDir = dirname(szOutputDir);
|
||||||
|
IFileSystem2::MakeDirectory(szOutputDir);
|
||||||
|
}
|
||||||
|
for (auto &file: files)
|
||||||
{
|
{
|
||||||
CUtlVector<CUtlString> args;
|
CUtlVector<CUtlString> args;
|
||||||
V_printf(" CC %s\n", file.GetString());
|
V_printf(" CC %s\n", file.GetString());
|
||||||
CUtlString szTarget = m_target.GetTriplet();
|
CUtlString szTarget = m_target.GetTriplet();
|
||||||
CUtlString szOutputFile = CUtlString("%s/%s/cc/%u_%s/%s/%s.o",FPC_TEMPORAL_DIRNAME, szTarget.GetString(), hash, m_szName.GetString(), IFileSystem2::BuildDirectory(), file.GetString());
|
CUtlString szOutputFile = CUtlString("%s/%s/cc/%u_%s/%s/%s.o",FPC_TEMPORAL_DIRNAME, szTarget.GetString(), hash, m_szName.GetString(), IFileSystem2::BuildDirectory(), file.GetString());
|
||||||
CUtlString szOutputDir;
|
|
||||||
|
|
||||||
args = {
|
args = {
|
||||||
"-target",
|
"-target",
|
||||||
@@ -40,6 +47,8 @@ CLDProject CCProject::Compile()
|
|||||||
};
|
};
|
||||||
if (!strcmp(Plat_GetExtension(file),"cpp"))
|
if (!strcmp(Plat_GetExtension(file),"cpp"))
|
||||||
args.AppendTail("-std=c++17");
|
args.AppendTail("-std=c++17");
|
||||||
|
else if (!strcmp(Plat_GetExtension(file),"mm"))
|
||||||
|
;
|
||||||
else
|
else
|
||||||
args.AppendTail("-std=c99");
|
args.AppendTail("-std=c99");
|
||||||
|
|
||||||
@@ -76,9 +85,6 @@ CLDProject CCProject::Compile()
|
|||||||
}
|
}
|
||||||
if (!IFileSystem2::ShouldRecompile(file, szOutputFile))
|
if (!IFileSystem2::ShouldRecompile(file, szOutputFile))
|
||||||
goto skipcompile;
|
goto skipcompile;
|
||||||
szOutputDir = szOutputFile;
|
|
||||||
szOutputDir = dirname(szOutputDir);
|
|
||||||
IFileSystem2::MakeDirectory(szOutputDir);
|
|
||||||
IRunner::Run("clang", args);
|
IRunner::Run("clang", args);
|
||||||
|
|
||||||
skipcompile:
|
skipcompile:
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ void IFileSystem2::CopyFile( const char *szDestination, const char *szOrigin )
|
|||||||
CUtlString(szDestination),
|
CUtlString(szDestination),
|
||||||
};
|
};
|
||||||
IRunner::Run("cp", args);
|
IRunner::Run("cp", args);
|
||||||
|
IRunner::Wait();
|
||||||
}
|
}
|
||||||
void IFileSystem2::CopyDirectory( const char *szDestination, const char *szOrigin )
|
void IFileSystem2::CopyDirectory( const char *szDestination, const char *szOrigin )
|
||||||
{
|
{
|
||||||
@@ -60,6 +61,7 @@ void IFileSystem2::CopyDirectory( const char *szDestination, const char *szOrigi
|
|||||||
CUtlString(szDestination),
|
CUtlString(szDestination),
|
||||||
};
|
};
|
||||||
IRunner::Run("cp", args);
|
IRunner::Run("cp", args);
|
||||||
|
IRunner::Wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IFileSystem2::MakeDirectory( const char *psz )
|
void IFileSystem2::MakeDirectory( const char *psz )
|
||||||
@@ -69,6 +71,7 @@ void IFileSystem2::MakeDirectory( const char *psz )
|
|||||||
CUtlString(psz),
|
CUtlString(psz),
|
||||||
};
|
};
|
||||||
IRunner::Run("mkdir", args);
|
IRunner::Run("mkdir", args);
|
||||||
|
IRunner::Wait();
|
||||||
};
|
};
|
||||||
|
|
||||||
bool IFileSystem2::ShouldRecompile(const char *szSource, const char *szOutput)
|
bool IFileSystem2::ShouldRecompile(const char *szSource, const char *szOutput)
|
||||||
|
|||||||
@@ -10,7 +10,10 @@ CUtlString CLDProject::Link( void )
|
|||||||
switch(linkType)
|
switch(linkType)
|
||||||
{
|
{
|
||||||
case ELINK_EXECUTABLE:
|
case ELINK_EXECUTABLE:
|
||||||
szFileName = CUtlString("%s", m_szName.GetString());
|
if (m_target.kernel == TARGET_KERNEL_WINDOWS)
|
||||||
|
szFileName = CUtlString("%s.exe", m_szName.GetString());
|
||||||
|
else
|
||||||
|
szFileName = CUtlString("%s", m_szName.GetString());
|
||||||
break;
|
break;
|
||||||
case ELINK_STATIC_LIBRARY:
|
case ELINK_STATIC_LIBRARY:
|
||||||
szFileName = CUtlString("lib%s.a", m_szName.GetString());
|
szFileName = CUtlString("lib%s.a", m_szName.GetString());
|
||||||
@@ -50,6 +53,7 @@ CUtlString CLDProject::Link( void )
|
|||||||
for (auto object: objects)
|
for (auto object: objects)
|
||||||
args.AppendTail(object.m_szObjectFile);
|
args.AppendTail(object.m_szObjectFile);
|
||||||
IRunner::Run("ar", args);
|
IRunner::Run("ar", args);
|
||||||
|
IRunner::Wait();
|
||||||
} else {
|
} else {
|
||||||
V_printf(" LINK %s\n", m_szName.GetString());
|
V_printf(" LINK %s\n", m_szName.GetString());
|
||||||
bool shouldRecompile = false;
|
bool shouldRecompile = false;
|
||||||
@@ -70,10 +74,18 @@ CUtlString CLDProject::Link( void )
|
|||||||
"-target",
|
"-target",
|
||||||
m_target.GetTriplet(),
|
m_target.GetTriplet(),
|
||||||
};
|
};
|
||||||
|
if (m_target.kernel == TARGET_KERNEL_WINDOWS)
|
||||||
|
{
|
||||||
|
args.AppendTail("-fuse-ld=lld");
|
||||||
|
args.AppendTail("-Wl,--whole-archive");
|
||||||
|
}
|
||||||
if (m_target.kernel == TARGET_KERNEL_DARWIN)
|
if (m_target.kernel == TARGET_KERNEL_DARWIN)
|
||||||
{
|
{
|
||||||
args.AppendTail("-isysroot");
|
args.AppendTail("-isysroot");
|
||||||
args.AppendTail("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk");
|
args.AppendTail("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk");
|
||||||
|
args.AppendTail("-Wl,-export_dynamic");
|
||||||
|
args.AppendTail("-undefined");
|
||||||
|
args.AppendTail("dynamic_lookup");
|
||||||
}
|
}
|
||||||
if (m_target.kernel == TARGET_KERNEL_IOS)
|
if (m_target.kernel == TARGET_KERNEL_IOS)
|
||||||
{
|
{
|
||||||
@@ -89,18 +101,16 @@ CUtlString CLDProject::Link( void )
|
|||||||
{
|
{
|
||||||
args.AppendTail("-rdynamic");
|
args.AppendTail("-rdynamic");
|
||||||
}
|
}
|
||||||
if (m_target.kernel == TARGET_KERNEL_DARWIN)
|
|
||||||
{
|
|
||||||
args.AppendTail("-Wl,-export_dynamic");
|
|
||||||
args.AppendTail("-undefined");
|
|
||||||
args.AppendTail("dynamic_lookup");
|
|
||||||
}
|
|
||||||
if (linkType == ELINK_DYNAMIC_LIBRARY)
|
if (linkType == ELINK_DYNAMIC_LIBRARY)
|
||||||
{
|
{
|
||||||
args.AppendTail("-shared");
|
args.AppendTail("-shared");
|
||||||
}
|
}
|
||||||
for (auto object: objects)
|
for (auto object: objects)
|
||||||
args.AppendTail(object.m_szObjectFile);
|
args.AppendTail(object.m_szObjectFile);
|
||||||
|
if (m_target.kernel == TARGET_KERNEL_WINDOWS)
|
||||||
|
{
|
||||||
|
args.AppendTail("-Wl,--no-whole-archive");
|
||||||
|
}
|
||||||
for (auto lib: libraries)
|
for (auto lib: libraries)
|
||||||
{
|
{
|
||||||
args.AppendTail("-l");
|
args.AppendTail("-l");
|
||||||
@@ -116,7 +126,9 @@ CUtlString CLDProject::Link( void )
|
|||||||
args.AppendTail("-framework");
|
args.AppendTail("-framework");
|
||||||
args.AppendTail(framework);
|
args.AppendTail(framework);
|
||||||
}
|
}
|
||||||
|
|
||||||
IRunner::Run("clang++", args);
|
IRunner::Run("clang++", args);
|
||||||
|
IRunner::Wait();
|
||||||
}
|
}
|
||||||
compiled:
|
compiled:
|
||||||
return szOutputFile;
|
return szOutputFile;
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
#include "unistd.h"
|
#include "unistd.h"
|
||||||
#include "sys/wait.h"
|
#include "sys/wait.h"
|
||||||
#include "tier1/commandline.h"
|
#include "tier1/commandline.h"
|
||||||
|
|
||||||
|
CUtlVector<pid_t> g_processes;
|
||||||
int IRunner::Run(CUtlString szName, CUtlVector<CUtlString>& args)
|
int IRunner::Run(CUtlString szName, CUtlVector<CUtlString>& args)
|
||||||
{
|
{
|
||||||
pid_t pid = fork();
|
pid_t pid = fork();
|
||||||
@@ -26,10 +28,13 @@ int IRunner::Run(CUtlString szName, CUtlVector<CUtlString>& args)
|
|||||||
if (ICommandLine::CheckParam("-fpcdebug"))
|
if (ICommandLine::CheckParam("-fpcdebug"))
|
||||||
V_printf("\n");
|
V_printf("\n");
|
||||||
execargs.AppendTail(0);
|
execargs.AppendTail(0);
|
||||||
execvp(szName, (char *const*)execargs.GetData());
|
if ( execvp(szName, (char *const*)execargs.GetData()) == -1 )
|
||||||
|
{
|
||||||
|
V_printf("Failed to launch %s\n",szName.GetString());
|
||||||
|
_exit(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* parent */
|
g_processes.AppendTail(pid);
|
||||||
wait(NULL);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,10 +54,14 @@ int IRunner::Run(CUtlString szName, CUtlString szDirectory, CUtlVector<CUtlStrin
|
|||||||
}
|
}
|
||||||
execargs.AppendTail(0);
|
execargs.AppendTail(0);
|
||||||
chdir(szDirectory.GetString());
|
chdir(szDirectory.GetString());
|
||||||
execvp(szName, (char *const*)execargs.GetData());
|
if ( execvp(szName, (char *const*)execargs.GetData()) == -1 )
|
||||||
|
{
|
||||||
|
V_printf("Failed to launch %s\n",szName.GetString());
|
||||||
|
_exit(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
g_processes.AppendTail(pid);
|
||||||
/* parent */
|
/* parent */
|
||||||
wait(NULL);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,3 +70,13 @@ int IRunner::Run(CUtlString szName, CUtlString szDirectory, CUtlVector<CUtlStrin
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int IRunner::Wait( void )
|
||||||
|
{
|
||||||
|
for (auto &process: g_processes)
|
||||||
|
{
|
||||||
|
int status;
|
||||||
|
pid_t wpid = waitpid(process, &status, 0);
|
||||||
|
}
|
||||||
|
g_processes = {};
|
||||||
|
return 0;
|
||||||
|
};
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ public:
|
|||||||
static int Run( CUtlString szName, CUtlVector<CUtlString>& args );
|
static int Run( CUtlString szName, CUtlVector<CUtlString>& args );
|
||||||
static int Run( CUtlString szName, CUtlString szDirectory, CUtlVector<CUtlString>& args );
|
static int Run( CUtlString szName, CUtlString szDirectory, CUtlVector<CUtlString>& args );
|
||||||
static int Run( CUtlString szName, CUtlString szDirectory, CUtlVector<CUtlString>& args, CUtlVector<CUtlString>& environment );
|
static int Run( CUtlString szName, CUtlString szDirectory, CUtlVector<CUtlString>& args, CUtlVector<CUtlString>& environment );
|
||||||
|
static int Wait( void );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -2,21 +2,32 @@
|
|||||||
#include "c.h"
|
#include "c.h"
|
||||||
#include "ld.h"
|
#include "ld.h"
|
||||||
#include "runner.h"
|
#include "runner.h"
|
||||||
|
#include "target.h"
|
||||||
#include "tier1/utlstring.h"
|
#include "tier1/utlstring.h"
|
||||||
#include "tier1/commandline.h"
|
#include "tier1/commandline.h"
|
||||||
|
|
||||||
void build_shader( const char *szName )
|
void build_shader( const char *szName )
|
||||||
{
|
{
|
||||||
IFileSystem2::MakeDirectory(CUtlString("build/funnygame/assets/gfx"));
|
IFileSystem2::MakeDirectory(CUtlString("build/funnygame/metal/gfx"));
|
||||||
|
IFileSystem2::MakeDirectory(CUtlString("build/funnygame/vulkan/gfx"));
|
||||||
|
|
||||||
CUtlVector<CUtlString> slang_args = {
|
CUtlVector<CUtlString> slang_args = {
|
||||||
CUtlString("funnyassets/gfx_shaders/%s.slang", szName),
|
CUtlString("funnyassets/gfx_shaders/%s.slang", szName),
|
||||||
|
"-g",
|
||||||
|
"-target",
|
||||||
|
"spirv",
|
||||||
|
"-D",
|
||||||
|
"__SPIRV__=1",
|
||||||
"-o",
|
"-o",
|
||||||
CUtlString("build/funnygame/assets/gfx/%s.spv", szName),
|
CUtlString("build/funnygame/vulkan/gfx/%s.shader", szName),
|
||||||
};
|
};
|
||||||
|
|
||||||
IRunner::Run("slangc", slang_args);
|
IRunner::Run("slangc", slang_args);
|
||||||
|
slang_args[3] = "metal";
|
||||||
|
slang_args[5] = "__METAL__=1";
|
||||||
|
slang_args[7] = CUtlString("build/funnygame/metal/gfx/%s.shader", szName);
|
||||||
|
IRunner::Run("slangc", slang_args);
|
||||||
|
IRunner::Wait();
|
||||||
};
|
};
|
||||||
|
|
||||||
int assets_build()
|
int assets_build()
|
||||||
@@ -29,17 +40,34 @@ int assets_build()
|
|||||||
IFileSystem2::CopyDirectory(CUtlString("build/funnygame/assets"), "funnyassets/materials");
|
IFileSystem2::CopyDirectory(CUtlString("build/funnygame/assets"), "funnyassets/materials");
|
||||||
build_shader("mesh_frag");
|
build_shader("mesh_frag");
|
||||||
build_shader("mesh_vert");
|
build_shader("mesh_vert");
|
||||||
build_shader("agx_comp");
|
|
||||||
build_shader("mesh_edge_detection_comp");
|
|
||||||
CUtlVector<CUtlString> python_args = {
|
CUtlVector<CUtlString> python_args = {
|
||||||
"build/tools/makepak64.py",
|
"build/tools/makepak64.py",
|
||||||
CUtlString("build/funnygame/assets"),
|
CUtlString("build/funnygame/assets"),
|
||||||
bStaticBuild ? CUtlString("%s/bin/%s.pak", szOutputDir.GetString(), "rtt") : CUtlString("%s/funnygame/%s.pak", szOutputDir.GetString(), "rtt"),
|
bStaticBuild ? CUtlString("%s/bin/%s.pak", szOutputDir.GetString(), "rtt") : CUtlString("%s/funnygame/%s.pak", szOutputDir.GetString(), "rtt"),
|
||||||
};
|
};
|
||||||
V_printf("%s\n",
|
|
||||||
bStaticBuild ? CUtlString("%s/bin/%s.pak", szOutputDir.GetString(), "rtt").GetString() : CUtlString("%s/funnygame/%s.pak", szOutputDir.GetString(), "rtt").GetString()
|
|
||||||
);
|
|
||||||
IRunner::Run("python3", python_args);
|
IRunner::Run("python3", python_args);
|
||||||
|
if (Target_t::DefaultTarget().kernel == TARGET_KERNEL_IOS ||Target_t::DefaultTarget().kernel == TARGET_KERNEL_DARWIN)
|
||||||
|
{
|
||||||
|
python_args = {
|
||||||
|
"build/tools/makepak64.py",
|
||||||
|
CUtlString("build/funnygame/metal"),
|
||||||
|
bStaticBuild ? CUtlString("%s/bin/%s.pak", szOutputDir.GetString(), "metal") : CUtlString("%s/funnygame/%s.pak", szOutputDir.GetString(), "metal"),
|
||||||
|
};
|
||||||
|
IRunner::Run("python3", python_args);
|
||||||
|
} else {
|
||||||
|
python_args = {
|
||||||
|
"build/tools/makepak64.py",
|
||||||
|
CUtlString("build/funnygame/vulkan"),
|
||||||
|
bStaticBuild ? CUtlString("%s/bin/%s.pak", szOutputDir.GetString(), "vulkan") : CUtlString("%s/funnygame/%s.pak", szOutputDir.GetString(), "vulkan"),
|
||||||
|
};
|
||||||
|
IRunner::Run("python3", python_args);
|
||||||
|
}
|
||||||
|
IRunner::Wait();
|
||||||
|
|
||||||
|
if (bStaticBuild)
|
||||||
|
IFileSystem2::CopyFile(CUtlString("%s/bin", szOutputDir.GetString()), "funnyassets/default.cfg");
|
||||||
|
else
|
||||||
|
IFileSystem2::CopyFile(szOutputDir.GetString(), "funnyassets/default.cfg");
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
DECLARE_BUILD_STAGE(assets, assets_build);
|
DECLARE_BUILD_STAGE(assets, assets_build);
|
||||||
|
|||||||
5
funnyassets/default.cfg
Normal file
5
funnyassets/default.cfg
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
bind esc exit;
|
||||||
|
bind a +left;
|
||||||
|
bind d +right;
|
||||||
|
bind w +forward;
|
||||||
|
bind s +back;
|
||||||
34
funnyassets/gfx/ml_quad.metal
Normal file
34
funnyassets/gfx/ml_quad.metal
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct VertexOut {
|
||||||
|
float4 position [[position]];
|
||||||
|
float2 texCoord;
|
||||||
|
};
|
||||||
|
|
||||||
|
vertex VertexOut vertex_main(uint vertexID [[vertex_id]]) {
|
||||||
|
float2 pos[] = {
|
||||||
|
{-1.0, -1.0},
|
||||||
|
{ 1.0, -1.0},
|
||||||
|
{-1.0, 1.0},
|
||||||
|
{ 1.0, 1.0},
|
||||||
|
};
|
||||||
|
|
||||||
|
float2 uv[] = {
|
||||||
|
{0.0, 1.0},
|
||||||
|
{1.0, 1.0},
|
||||||
|
{0.0, 0.0},
|
||||||
|
{1.0, 0.0},
|
||||||
|
};
|
||||||
|
|
||||||
|
VertexOut out;
|
||||||
|
out.position = float4(pos[vertexID], 0.0, 1.0);
|
||||||
|
out.texCoord = uv[vertexID];
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
fragment float4 fragment_main(VertexOut in [[stage_in]],
|
||||||
|
texture2d<float> tex [[texture(0)]]) {
|
||||||
|
constexpr sampler s(filter::linear);
|
||||||
|
return pow(tex.sample(s, in.texCoord), 0.45f);
|
||||||
|
}
|
||||||
1
funnyassets/gfx_shaders/mesh_bindings.h
Normal file
1
funnyassets/gfx_shaders/mesh_bindings.h
Normal file
@@ -0,0 +1 @@
|
|||||||
|
#include "shader_base.h"
|
||||||
@@ -1,23 +1,12 @@
|
|||||||
#include "mesh_shared.slang"
|
#include "mesh_shared.slang"
|
||||||
|
|
||||||
uint32_t hash32(uint32_t x) {
|
|
||||||
x = ((x >> 16) ^ x) * 0x45d9f3b;
|
|
||||||
x = ((x >> 16) ^ x) * 0x45d9f3b;
|
|
||||||
x = (x >> 16) ^ x;
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[vk::binding(1)]]
|
|
||||||
uniform Sampler2D textures[];
|
|
||||||
|
|
||||||
[shader("fragment")]
|
[shader("fragment")]
|
||||||
float4 main(
|
float4 _main(
|
||||||
VertexOutput input,
|
VertexOutput input,
|
||||||
uint triid: SV_PrimitiveID,
|
uint triid: SV_PrimitiveID,
|
||||||
uniform PushConstants constants,
|
|
||||||
) : SV_TARGET
|
) : SV_TARGET
|
||||||
{
|
{
|
||||||
return float4(textures[constants.albedoID].Sample(input.uv).xyz, 1);
|
return float4(SampleTexture(albedoID, input.uv).xyz,1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#include "shader_base.h"
|
||||||
|
|
||||||
struct VertexOutput
|
struct VertexOutput
|
||||||
{
|
{
|
||||||
@@ -6,10 +7,17 @@ struct VertexOutput
|
|||||||
float2 uv: TEXCOORD0;
|
float2 uv: TEXCOORD0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PushConstants
|
DECLARE_CONSTANTS()
|
||||||
{
|
{
|
||||||
float4x4 modelMatrix;
|
float4x4 modelMatrix;
|
||||||
uint albedoID;
|
uint albedoID;
|
||||||
uint roughnessID;
|
uint roughnessID;
|
||||||
uint metalnessID;
|
uint metalnessID;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DECLARE_CBUFFER(0)
|
||||||
|
{
|
||||||
|
float4x4 projection;
|
||||||
|
};
|
||||||
|
|
||||||
|
DECLARE_TEXTURES(1)
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#include "shader_base.h"
|
||||||
#include "mesh_shared.slang"
|
#include "mesh_shared.slang"
|
||||||
|
|
||||||
struct VertexInput
|
struct VertexInput
|
||||||
@@ -6,20 +7,13 @@ struct VertexInput
|
|||||||
float2 uv: TEXCOORD0;
|
float2 uv: TEXCOORD0;
|
||||||
};
|
};
|
||||||
|
|
||||||
[[vk::binding(0)]]
|
|
||||||
cbuffer CameraInfo
|
|
||||||
{
|
|
||||||
float4x4 projection;
|
|
||||||
};
|
|
||||||
|
|
||||||
[shader("vertex")]
|
[shader("vertex")]
|
||||||
VertexOutput main(
|
VertexOutput _main(
|
||||||
VertexInput input,
|
VertexInput input,
|
||||||
uniform PushConstants constants,
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
VertexOutput output;
|
VertexOutput output;
|
||||||
output.position = mul(projection, mul(constants.modelMatrix, float4(input.position,1)));
|
output.position = mul(projection, mul(modelMatrix, float4(input.position,1)));
|
||||||
output.uv = input.uv;
|
output.uv = input.uv;
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|||||||
85
funnyassets/gfx_shaders/shader_base.h
Normal file
85
funnyassets/gfx_shaders/shader_base.h
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
#ifndef SHADER_BASE_SLANG
|
||||||
|
#define SHADER_BASE_SLANG
|
||||||
|
|
||||||
|
/*
|
||||||
|
* I hope you are not looking at these war crimes.
|
||||||
|
* They are truly horrible crimes.
|
||||||
|
* Don't even try to understand what the fuck is happening here.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(__METAL__)
|
||||||
|
/* We hijack all the argument buffers, which allows to use a bit more textures at cost of buffers */
|
||||||
|
#define DECLARE_TEXTURES(b) \
|
||||||
|
struct TextureBinding {Texture2D textures[96];}; \
|
||||||
|
[[vk::binding(21)]] ParameterBlock<TextureBinding> g_textures0 : register(t21); \
|
||||||
|
ParameterBlock<TextureBinding> g_textures1 : register(t22); \
|
||||||
|
ParameterBlock<TextureBinding> g_textures2 : register(t23); \
|
||||||
|
ParameterBlock<TextureBinding> g_textures3 : register(t24); \
|
||||||
|
ParameterBlock<TextureBinding> g_textures4 : register(t25); \
|
||||||
|
ParameterBlock<TextureBinding> g_textures5 : register(t26); \
|
||||||
|
ParameterBlock<TextureBinding> g_textures6 : register(t27); \
|
||||||
|
ParameterBlock<TextureBinding> g_textures7 : register(t28);
|
||||||
|
|
||||||
|
void _mlGetSampler()
|
||||||
|
{
|
||||||
|
__intrinsic_asm R"(
|
||||||
|
constexpr sampler s(filter::linear, address::repeat);
|
||||||
|
return s;
|
||||||
|
)";
|
||||||
|
}
|
||||||
|
SamplerState mlGetSampler()
|
||||||
|
{
|
||||||
|
_mlGetSampler();
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 SampleTexture(uint32_t binding, float2 uv)
|
||||||
|
{
|
||||||
|
SamplerState sampler = mlGetSampler();
|
||||||
|
uint8_t textureArray = 0;
|
||||||
|
uint8_t textureSamplerArray = (binding >> 16) & 0xFF;
|
||||||
|
uint8_t textureSampler = (binding >> 8) & 0xFF;
|
||||||
|
uint8_t textureIndex = 1;
|
||||||
|
return g_textures0.textures[1].Sample(sampler, uv);
|
||||||
|
};
|
||||||
|
|
||||||
|
#define DECLARE_CBUFFER(b) \
|
||||||
|
[[vk::binding(b)]] cbuffer cbuffer_##b : register(t##b)
|
||||||
|
|
||||||
|
#define DECLARE_CONSTANTS() \
|
||||||
|
[[vk::push_constant]] \
|
||||||
|
cbuffer cbuffer_constants : register(t29)
|
||||||
|
|
||||||
|
|
||||||
|
#elif defined(__SPIRV__)
|
||||||
|
|
||||||
|
#define DECLARE_TEXTURES(b) \
|
||||||
|
[[vk::binding(b)]] \
|
||||||
|
Sampler2D g_textures[];
|
||||||
|
|
||||||
|
float4 SampleTexture(uint32_t binding, float2 uv)
|
||||||
|
{
|
||||||
|
return g_textures[binding].Sample(uv);
|
||||||
|
};
|
||||||
|
|
||||||
|
#define DECLARE_CBUFFER(b) \
|
||||||
|
[[vk::binding(b)]] \
|
||||||
|
cbuffer cbuffer_##b
|
||||||
|
|
||||||
|
|
||||||
|
#define DECLARE_DATA(b,r) \
|
||||||
|
[[vk::binding(b)]] \
|
||||||
|
r
|
||||||
|
|
||||||
|
#define DECLARE_CONSTANTS() \
|
||||||
|
[[vk::push_constant]] \
|
||||||
|
cbuffer cbuffer_constants
|
||||||
|
|
||||||
|
#else
|
||||||
|
#define DECLARE_TEXTURES()
|
||||||
|
float4 SampleTexture(uint32_t binding, float2 uv);
|
||||||
|
#define DECLARE_CBUFFER() cbuffer cbuffer_constats
|
||||||
|
#define DECLARE_DATA() cbuffer cbuffer_constats
|
||||||
|
#define DECLARE_CONSTANTS() cbuffer cbuffer_constats
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -7,16 +7,20 @@
|
|||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
2493459A2E1089D600369580 /* SDL3.framework in Resources */ = {isa = PBXBuildFile; fileRef = 249345992E1089D600369580 /* SDL3.framework */; };
|
24417C492E15D4C9002CF759 /* default.cfg in Resources */ = {isa = PBXBuildFile; fileRef = 24417C482E15D4C9002CF759 /* default.cfg */; };
|
||||||
|
2444C86E2E13363000CC1EFA /* metal.pak in Resources */ = {isa = PBXBuildFile; fileRef = 2444C86D2E13363000CC1EFA /* metal.pak */; };
|
||||||
249345AB2E109B8A00369580 /* funnygame in Resources */ = {isa = PBXBuildFile; fileRef = 249345A92E109B8A00369580 /* funnygame */; };
|
249345AB2E109B8A00369580 /* funnygame in Resources */ = {isa = PBXBuildFile; fileRef = 249345A92E109B8A00369580 /* funnygame */; };
|
||||||
249345AC2E109B8A00369580 /* rtt.pak in Resources */ = {isa = PBXBuildFile; fileRef = 249345AA2E109B8A00369580 /* rtt.pak */; };
|
249345AC2E109B8A00369580 /* rtt.pak in Resources */ = {isa = PBXBuildFile; fileRef = 249345AA2E109B8A00369580 /* rtt.pak */; };
|
||||||
|
2493BB3F2E19384900828D56 /* SDL3.framework in Resources */ = {isa = PBXBuildFile; fileRef = 2493BB3E2E19384900828D56 /* SDL3.framework */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
249345992E1089D600369580 /* SDL3.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL3.framework; path = ../../external/ios/SDL3.framework; sourceTree = "<group>"; };
|
24417C482E15D4C9002CF759 /* default.cfg */ = {isa = PBXFileReference; lastKnownFileType = text; name = default.cfg; path = "../../build/funnygame/aarch64-apple-ios/game/bin/default.cfg"; sourceTree = "<group>"; };
|
||||||
|
2444C86D2E13363000CC1EFA /* metal.pak */ = {isa = PBXFileReference; lastKnownFileType = file; name = metal.pak; path = "../../build/funnygame/aarch64-apple-ios/game/bin/metal.pak"; sourceTree = "<group>"; };
|
||||||
249345A72E10997500369580 /* funnygame */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; name = funnygame; path = "../../build/funnygame/aarch64-apple-ios/game/bin/funnygame"; sourceTree = "<group>"; };
|
249345A72E10997500369580 /* funnygame */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; name = funnygame; path = "../../build/funnygame/aarch64-apple-ios/game/bin/funnygame"; sourceTree = "<group>"; };
|
||||||
249345A92E109B8A00369580 /* funnygame */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; name = funnygame; path = "../../build/funnygame/aarch64-apple-ios/game/bin/funnygame"; sourceTree = "<group>"; };
|
249345A92E109B8A00369580 /* funnygame */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; name = funnygame; path = "../../build/funnygame/aarch64-apple-ios/game/bin/funnygame"; sourceTree = "<group>"; };
|
||||||
249345AA2E109B8A00369580 /* rtt.pak */ = {isa = PBXFileReference; lastKnownFileType = file; name = rtt.pak; path = "../../build/funnygame/aarch64-apple-ios/game/bin/rtt.pak"; sourceTree = "<group>"; };
|
249345AA2E109B8A00369580 /* rtt.pak */ = {isa = PBXFileReference; lastKnownFileType = file; name = rtt.pak; path = "../../build/funnygame/aarch64-apple-ios/game/bin/rtt.pak"; sourceTree = "<group>"; };
|
||||||
|
2493BB3E2E19384900828D56 /* SDL3.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL3.framework; path = "../../build/funnygame/aarch64-apple-ios/game/bin/SDL3.framework"; sourceTree = "<group>"; };
|
||||||
24CCF9852E1065A100A06964 /* funnygame.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = funnygame.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
24CCF9852E1065A100A06964 /* funnygame.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = funnygame.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
@@ -31,11 +35,6 @@
|
|||||||
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
|
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
|
||||||
|
|
||||||
/* Begin PBXFileSystemSynchronizedRootGroup section */
|
/* Begin PBXFileSystemSynchronizedRootGroup section */
|
||||||
249345332E10870100369580 /* Frameworks */ = {
|
|
||||||
isa = PBXFileSystemSynchronizedRootGroup;
|
|
||||||
path = Frameworks;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
24CCF9872E1065A100A06964 /* funnygame */ = {
|
24CCF9872E1065A100A06964 /* funnygame */ = {
|
||||||
isa = PBXFileSystemSynchronizedRootGroup;
|
isa = PBXFileSystemSynchronizedRootGroup;
|
||||||
exceptions = (
|
exceptions = (
|
||||||
@@ -50,11 +49,12 @@
|
|||||||
24CCF97C2E1065A100A06964 = {
|
24CCF97C2E1065A100A06964 = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
2493BB3E2E19384900828D56 /* SDL3.framework */,
|
||||||
|
24417C482E15D4C9002CF759 /* default.cfg */,
|
||||||
|
2444C86D2E13363000CC1EFA /* metal.pak */,
|
||||||
249345A72E10997500369580 /* funnygame */,
|
249345A72E10997500369580 /* funnygame */,
|
||||||
249345A92E109B8A00369580 /* funnygame */,
|
249345A92E109B8A00369580 /* funnygame */,
|
||||||
249345AA2E109B8A00369580 /* rtt.pak */,
|
249345AA2E109B8A00369580 /* rtt.pak */,
|
||||||
249345992E1089D600369580 /* SDL3.framework */,
|
|
||||||
249345332E10870100369580 /* Frameworks */,
|
|
||||||
24CCF9872E1065A100A06964 /* funnygame */,
|
24CCF9872E1065A100A06964 /* funnygame */,
|
||||||
24CCF9862E1065A100A06964 /* Products */,
|
24CCF9862E1065A100A06964 /* Products */,
|
||||||
);
|
);
|
||||||
@@ -83,7 +83,6 @@
|
|||||||
dependencies = (
|
dependencies = (
|
||||||
);
|
);
|
||||||
fileSystemSynchronizedGroups = (
|
fileSystemSynchronizedGroups = (
|
||||||
249345332E10870100369580 /* Frameworks */,
|
|
||||||
24CCF9872E1065A100A06964 /* funnygame */,
|
24CCF9872E1065A100A06964 /* funnygame */,
|
||||||
);
|
);
|
||||||
name = funnygame;
|
name = funnygame;
|
||||||
@@ -100,7 +99,7 @@
|
|||||||
isa = PBXProject;
|
isa = PBXProject;
|
||||||
attributes = {
|
attributes = {
|
||||||
BuildIndependentTargetsInParallel = 1;
|
BuildIndependentTargetsInParallel = 1;
|
||||||
LastUpgradeCheck = 1620;
|
LastUpgradeCheck = 1640;
|
||||||
TargetAttributes = {
|
TargetAttributes = {
|
||||||
24CCF9842E1065A100A06964 = {
|
24CCF9842E1065A100A06964 = {
|
||||||
CreatedOnToolsVersion = 16.2;
|
CreatedOnToolsVersion = 16.2;
|
||||||
@@ -131,9 +130,11 @@
|
|||||||
isa = PBXResourcesBuildPhase;
|
isa = PBXResourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
2493BB3F2E19384900828D56 /* SDL3.framework in Resources */,
|
||||||
|
24417C492E15D4C9002CF759 /* default.cfg in Resources */,
|
||||||
|
2444C86E2E13363000CC1EFA /* metal.pak in Resources */,
|
||||||
249345AB2E109B8A00369580 /* funnygame in Resources */,
|
249345AB2E109B8A00369580 /* funnygame in Resources */,
|
||||||
249345AC2E109B8A00369580 /* rtt.pak in Resources */,
|
249345AC2E109B8A00369580 /* rtt.pak in Resources */,
|
||||||
2493459A2E1089D600369580 /* SDL3.framework in Resources */,
|
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@@ -142,6 +143,7 @@
|
|||||||
/* Begin PBXShellScriptBuildPhase section */
|
/* Begin PBXShellScriptBuildPhase section */
|
||||||
24CCF9A22E1065F500A06964 /* Run Script */ = {
|
24CCF9A22E1065F500A06964 /* Run Script */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
alwaysOutOfDate = 1;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
);
|
);
|
||||||
@@ -156,8 +158,7 @@
|
|||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
shellPath = /bin/sh;
|
shellPath = /bin/sh;
|
||||||
shellScript = "
|
shellScript = "export CODE_SIGN_IDENTITY=$(security find-identity -v -p codesigning | grep \"Apple Development\" | grep -o '\".*\"' | tr -d '\"')\ncd ../../\nbuild/tools/fpc build -os ios -arch aarch64\ncodesign -s \"$CODE_SIGN_IDENTITY\" --timestamp=none --force build/funnygame/aarch64-apple-ios/game/bin/funnygame\ncodesign -s \"$CODE_SIGN_IDENTITY\" --timestamp=none --force build/funnygame/aarch64-apple-ios/game/bin/SDL3.framework\n";
|
||||||
";
|
|
||||||
};
|
};
|
||||||
/* End PBXShellScriptBuildPhase section */
|
/* End PBXShellScriptBuildPhase section */
|
||||||
|
|
||||||
@@ -167,15 +168,20 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||||
|
CODE_SIGN_ENTITLEMENTS = funnygame/funnygame.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEVELOPMENT_TEAM = QU3M3RV4XD;
|
DEVELOPMENT_TEAM = QU3M3RV4XD;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
INFOPLIST_FILE = funnygame/Info.plist;
|
INFOPLIST_FILE = funnygame/Info.plist;
|
||||||
|
INFOPLIST_KEY_GCSupportsControllerUserInteraction = YES;
|
||||||
|
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.games";
|
||||||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
||||||
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
|
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
|
||||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
INFOPLIST_KEY_UIRequiresFullScreen = YES;
|
||||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
INFOPLIST_KEY_UIStatusBarStyle = "";
|
||||||
|
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||||
|
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
@@ -198,15 +204,20 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||||
|
CODE_SIGN_ENTITLEMENTS = funnygame/funnygame.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEVELOPMENT_TEAM = QU3M3RV4XD;
|
DEVELOPMENT_TEAM = QU3M3RV4XD;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
INFOPLIST_FILE = funnygame/Info.plist;
|
INFOPLIST_FILE = funnygame/Info.plist;
|
||||||
|
INFOPLIST_KEY_GCSupportsControllerUserInteraction = YES;
|
||||||
|
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.games";
|
||||||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
||||||
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
|
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
|
||||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
INFOPLIST_KEY_UIRequiresFullScreen = YES;
|
||||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
INFOPLIST_KEY_UIStatusBarStyle = "";
|
||||||
|
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||||
|
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
@@ -259,6 +270,7 @@
|
|||||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
COPY_PHASE_STRIP = NO;
|
COPY_PHASE_STRIP = NO;
|
||||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||||
|
DEVELOPMENT_TEAM = QU3M3RV4XD;
|
||||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
ENABLE_TESTABILITY = YES;
|
ENABLE_TESTABILITY = YES;
|
||||||
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||||
@@ -320,6 +332,7 @@
|
|||||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
COPY_PHASE_STRIP = NO;
|
COPY_PHASE_STRIP = NO;
|
||||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
|
DEVELOPMENT_TEAM = QU3M3RV4XD;
|
||||||
ENABLE_NS_ASSERTIONS = NO;
|
ENABLE_NS_ASSERTIONS = NO;
|
||||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||||
|
|||||||
Binary file not shown.
@@ -0,0 +1,80 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Scheme
|
||||||
|
LastUpgradeVersion = "1640"
|
||||||
|
version = "1.7">
|
||||||
|
<BuildAction
|
||||||
|
parallelizeBuildables = "YES"
|
||||||
|
buildImplicitDependencies = "YES"
|
||||||
|
buildArchitectures = "Automatic">
|
||||||
|
<BuildActionEntries>
|
||||||
|
<BuildActionEntry
|
||||||
|
buildForTesting = "YES"
|
||||||
|
buildForRunning = "YES"
|
||||||
|
buildForProfiling = "YES"
|
||||||
|
buildForArchiving = "YES"
|
||||||
|
buildForAnalyzing = "YES">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "24CCF9842E1065A100A06964"
|
||||||
|
BuildableName = "funnygame.app"
|
||||||
|
BlueprintName = "funnygame"
|
||||||
|
ReferencedContainer = "container:funnygame.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildActionEntry>
|
||||||
|
</BuildActionEntries>
|
||||||
|
</BuildAction>
|
||||||
|
<TestAction
|
||||||
|
buildConfiguration = "Debug"
|
||||||
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
|
shouldAutocreateTestPlan = "YES">
|
||||||
|
</TestAction>
|
||||||
|
<LaunchAction
|
||||||
|
buildConfiguration = "Debug"
|
||||||
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
|
launchStyle = "0"
|
||||||
|
useCustomWorkingDirectory = "NO"
|
||||||
|
ignoresPersistentStateOnLaunch = "NO"
|
||||||
|
debugDocumentVersioning = "YES"
|
||||||
|
debugServiceExtension = "internal"
|
||||||
|
enableGPUShaderValidationMode = "2"
|
||||||
|
showGraphicsOverview = "Yes"
|
||||||
|
allowLocationSimulation = "YES">
|
||||||
|
<BuildableProductRunnable
|
||||||
|
runnableDebuggingMode = "0">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "24CCF9842E1065A100A06964"
|
||||||
|
BuildableName = "funnygame.app"
|
||||||
|
BlueprintName = "funnygame"
|
||||||
|
ReferencedContainer = "container:funnygame.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildableProductRunnable>
|
||||||
|
</LaunchAction>
|
||||||
|
<ProfileAction
|
||||||
|
buildConfiguration = "Release"
|
||||||
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
|
savedToolIdentifier = ""
|
||||||
|
useCustomWorkingDirectory = "NO"
|
||||||
|
debugDocumentVersioning = "YES">
|
||||||
|
<BuildableProductRunnable
|
||||||
|
runnableDebuggingMode = "0">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "24CCF9842E1065A100A06964"
|
||||||
|
BuildableName = "funnygame.app"
|
||||||
|
BlueprintName = "funnygame"
|
||||||
|
ReferencedContainer = "container:funnygame.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildableProductRunnable>
|
||||||
|
</ProfileAction>
|
||||||
|
<AnalyzeAction
|
||||||
|
buildConfiguration = "Debug">
|
||||||
|
</AnalyzeAction>
|
||||||
|
<ArchiveAction
|
||||||
|
buildConfiguration = "Release"
|
||||||
|
revealArchiveInOrganizer = "YES">
|
||||||
|
</ArchiveAction>
|
||||||
|
</Scheme>
|
||||||
@@ -3,150 +3,4 @@
|
|||||||
uuid = "EDF5B860-98F6-4431-91A7-5DEA7965C560"
|
uuid = "EDF5B860-98F6-4431-91A7-5DEA7965C560"
|
||||||
type = "1"
|
type = "1"
|
||||||
version = "2.0">
|
version = "2.0">
|
||||||
<Breakpoints>
|
|
||||||
<BreakpointProxy
|
|
||||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
|
||||||
<BreakpointContent
|
|
||||||
uuid = "68034548-4CDD-4A60-97CC-A6350DA312A8"
|
|
||||||
shouldBeEnabled = "No"
|
|
||||||
ignoreCount = "0"
|
|
||||||
continueAfterRunningActions = "No"
|
|
||||||
filePath = "../../game/server/game.cpp"
|
|
||||||
startingColumnNumber = "9223372036854775807"
|
|
||||||
endingColumnNumber = "9223372036854775807"
|
|
||||||
startingLineNumber = "14"
|
|
||||||
endingLineNumber = "14"
|
|
||||||
landmarkName = "IGame_Load()"
|
|
||||||
landmarkType = "9">
|
|
||||||
</BreakpointContent>
|
|
||||||
</BreakpointProxy>
|
|
||||||
<BreakpointProxy
|
|
||||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
|
||||||
<BreakpointContent
|
|
||||||
uuid = "9CD4CFDC-F438-44E9-8503-A7BD5623A3F5"
|
|
||||||
shouldBeEnabled = "No"
|
|
||||||
ignoreCount = "0"
|
|
||||||
continueAfterRunningActions = "No"
|
|
||||||
filePath = "../../engine/gamemode.cpp"
|
|
||||||
startingColumnNumber = "9223372036854775807"
|
|
||||||
endingColumnNumber = "9223372036854775807"
|
|
||||||
startingLineNumber = "20"
|
|
||||||
endingLineNumber = "20"
|
|
||||||
landmarkName = "CGameMode::RoundBegin()"
|
|
||||||
landmarkType = "7">
|
|
||||||
</BreakpointContent>
|
|
||||||
</BreakpointProxy>
|
|
||||||
<BreakpointProxy
|
|
||||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
|
||||||
<BreakpointContent
|
|
||||||
uuid = "2AA185EC-C7B8-4BD8-9B0E-B1C6F946E8C5"
|
|
||||||
shouldBeEnabled = "No"
|
|
||||||
ignoreCount = "0"
|
|
||||||
continueAfterRunningActions = "No"
|
|
||||||
filePath = "../../engine/baseentity.cpp"
|
|
||||||
startingColumnNumber = "9223372036854775807"
|
|
||||||
endingColumnNumber = "9223372036854775807"
|
|
||||||
startingLineNumber = "54"
|
|
||||||
endingLineNumber = "54"
|
|
||||||
landmarkName = "C_EntityRegistry::C_EntityRegistry(szName, pfn)"
|
|
||||||
landmarkType = "7">
|
|
||||||
</BreakpointContent>
|
|
||||||
</BreakpointProxy>
|
|
||||||
<BreakpointProxy
|
|
||||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
|
||||||
<BreakpointContent
|
|
||||||
uuid = "33DC256B-91FF-44A9-8152-0739B1D3DB03"
|
|
||||||
shouldBeEnabled = "No"
|
|
||||||
ignoreCount = "0"
|
|
||||||
continueAfterRunningActions = "No"
|
|
||||||
filePath = "../../engine/baseentity.cpp"
|
|
||||||
startingColumnNumber = "9223372036854775807"
|
|
||||||
endingColumnNumber = "9223372036854775807"
|
|
||||||
startingLineNumber = "50"
|
|
||||||
endingLineNumber = "50"
|
|
||||||
landmarkName = "CEntityRegistry::CEntityRegistry(szName, szClass, pfn)"
|
|
||||||
landmarkType = "7">
|
|
||||||
</BreakpointContent>
|
|
||||||
</BreakpointProxy>
|
|
||||||
<BreakpointProxy
|
|
||||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
|
||||||
<BreakpointContent
|
|
||||||
uuid = "32FF3D75-FFC8-4059-B75A-EFB25EE55B9C"
|
|
||||||
shouldBeEnabled = "No"
|
|
||||||
ignoreCount = "0"
|
|
||||||
continueAfterRunningActions = "No"
|
|
||||||
filePath = "../../engine/baseentity.cpp"
|
|
||||||
startingColumnNumber = "9223372036854775807"
|
|
||||||
endingColumnNumber = "9223372036854775807"
|
|
||||||
startingLineNumber = "47"
|
|
||||||
endingLineNumber = "47"
|
|
||||||
landmarkName = "CEntityRegistry::CEntityRegistry(szName, szClass, pfn)"
|
|
||||||
landmarkType = "7">
|
|
||||||
</BreakpointContent>
|
|
||||||
</BreakpointProxy>
|
|
||||||
<BreakpointProxy
|
|
||||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
|
||||||
<BreakpointContent
|
|
||||||
uuid = "67C9C104-691D-4C4F-AD25-E9BE4D27C52B"
|
|
||||||
shouldBeEnabled = "No"
|
|
||||||
ignoreCount = "0"
|
|
||||||
continueAfterRunningActions = "No"
|
|
||||||
filePath = "../../engine/brush.cpp"
|
|
||||||
startingColumnNumber = "9223372036854775807"
|
|
||||||
endingColumnNumber = "9223372036854775807"
|
|
||||||
startingLineNumber = "71"
|
|
||||||
endingLineNumber = "71"
|
|
||||||
landmarkName = "C_BrushEntity::Spawn()"
|
|
||||||
landmarkType = "7">
|
|
||||||
</BreakpointContent>
|
|
||||||
</BreakpointProxy>
|
|
||||||
<BreakpointProxy
|
|
||||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
|
||||||
<BreakpointContent
|
|
||||||
uuid = "40630BDD-5F3C-4E0E-AD60-ABC4EF82B34C"
|
|
||||||
shouldBeEnabled = "No"
|
|
||||||
ignoreCount = "0"
|
|
||||||
continueAfterRunningActions = "No"
|
|
||||||
filePath = "../../engine/ml_videosdl.cpp"
|
|
||||||
startingColumnNumber = "9223372036854775807"
|
|
||||||
endingColumnNumber = "9223372036854775807"
|
|
||||||
startingLineNumber = "181"
|
|
||||||
endingLineNumber = "181"
|
|
||||||
landmarkName = "IVideo::Frame(fDelta)"
|
|
||||||
landmarkType = "7">
|
|
||||||
</BreakpointContent>
|
|
||||||
</BreakpointProxy>
|
|
||||||
<BreakpointProxy
|
|
||||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
|
||||||
<BreakpointContent
|
|
||||||
uuid = "FD1CB9BC-5B2B-497E-850D-3D7F470630D6"
|
|
||||||
shouldBeEnabled = "No"
|
|
||||||
ignoreCount = "0"
|
|
||||||
continueAfterRunningActions = "No"
|
|
||||||
filePath = "../../engine/ml_videosdl.cpp"
|
|
||||||
startingColumnNumber = "9223372036854775807"
|
|
||||||
endingColumnNumber = "9223372036854775807"
|
|
||||||
startingLineNumber = "172"
|
|
||||||
endingLineNumber = "172"
|
|
||||||
landmarkName = "IVideo::Frame(fDelta)"
|
|
||||||
landmarkType = "7">
|
|
||||||
</BreakpointContent>
|
|
||||||
</BreakpointProxy>
|
|
||||||
<BreakpointProxy
|
|
||||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
|
||||||
<BreakpointContent
|
|
||||||
uuid = "777258DC-D4C8-44B4-9F5F-7F2B4DEEEA26"
|
|
||||||
shouldBeEnabled = "No"
|
|
||||||
ignoreCount = "0"
|
|
||||||
continueAfterRunningActions = "No"
|
|
||||||
filePath = "../../engine/ml_videosdl.cpp"
|
|
||||||
startingColumnNumber = "9223372036854775807"
|
|
||||||
endingColumnNumber = "9223372036854775807"
|
|
||||||
startingLineNumber = "173"
|
|
||||||
endingLineNumber = "173"
|
|
||||||
landmarkName = "IVideo::Frame(fDelta)"
|
|
||||||
landmarkType = "7">
|
|
||||||
</BreakpointContent>
|
|
||||||
</BreakpointProxy>
|
|
||||||
</Breakpoints>
|
|
||||||
</Bucket>
|
</Bucket>
|
||||||
|
|||||||
@@ -10,5 +10,13 @@
|
|||||||
<integer>0</integer>
|
<integer>0</integer>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
|
<key>SuppressBuildableAutocreation</key>
|
||||||
|
<dict>
|
||||||
|
<key>24CCF9842E1065A100A06964</key>
|
||||||
|
<dict>
|
||||||
|
<key>primary</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@@ -2,7 +2,17 @@
|
|||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleDocumentTypes</key>
|
||||||
<string>funnygame</string>
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>LSHandlerRank</key>
|
||||||
|
<string>Default</string>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
<key>NSAppTransportSecurity</key>
|
||||||
|
<dict>
|
||||||
|
<key>NSExceptionDomains</key>
|
||||||
|
<dict/>
|
||||||
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
8
ios_deploy/funnygame/funnygame/funnygame.entitlements
Normal file
8
ios_deploy/funnygame/funnygame/funnygame.entitlements
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>com.apple.developer.game-center</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
@@ -33,7 +33,6 @@ int launcher_build()
|
|||||||
ldProject.objects.AppendTail((CObject){client_lib});
|
ldProject.objects.AppendTail((CObject){client_lib});
|
||||||
if (Target_t::DefaultTarget().kernel == TARGET_KERNEL_IOS)
|
if (Target_t::DefaultTarget().kernel == TARGET_KERNEL_IOS)
|
||||||
{
|
{
|
||||||
ldProject.objects.AppendTail((CObject){"external/ios/libMoltenVK.a"});
|
|
||||||
ldProject.frameworks.AppendTail("SDL3");
|
ldProject.frameworks.AppendTail("SDL3");
|
||||||
ldProject.frameworks.AppendTail("CoreFoundation");
|
ldProject.frameworks.AppendTail("CoreFoundation");
|
||||||
ldProject.frameworks.AppendTail("CoreGraphics");
|
ldProject.frameworks.AppendTail("CoreGraphics");
|
||||||
@@ -43,7 +42,30 @@ int launcher_build()
|
|||||||
ldProject.frameworks.AppendTail("QuartzCore");
|
ldProject.frameworks.AppendTail("QuartzCore");
|
||||||
ldProject.frameworks.AppendTail("UIKit");
|
ldProject.frameworks.AppendTail("UIKit");
|
||||||
ldProject.frameworkDirectories.AppendTail("external/ios");
|
ldProject.frameworkDirectories.AppendTail("external/ios");
|
||||||
|
IFileSystem2::CopyDirectory(CUtlString("%s/bin", szOutputDir.GetString()), "external/ios/SDL3.framework");
|
||||||
};
|
};
|
||||||
|
if (Target_t::DefaultTarget().kernel == TARGET_KERNEL_WINDOWS)
|
||||||
|
{
|
||||||
|
ldProject.objects.AppendTail((CObject){"external/windows/vulkan-1.dll"});
|
||||||
|
ldProject.objects.AppendTail((CObject){"external/windows/libSDL3.a"});
|
||||||
|
ldProject.objects.AppendTail((CObject){"external/windows/libdbghelp.a"});
|
||||||
|
ldProject.objects.AppendTail((CObject){"external/windows/libpthread.a"});
|
||||||
|
ldProject.objects.AppendTail((CObject){"external/windows/libstdc++.a"});
|
||||||
|
ldProject.libraries.AppendTail("ws2_32");
|
||||||
|
ldProject.libraries.AppendTail("ntdll");
|
||||||
|
ldProject.libraries.AppendTail("userenv");
|
||||||
|
ldProject.libraries.AppendTail("winmm");
|
||||||
|
ldProject.libraries.AppendTail("ole32");
|
||||||
|
ldProject.libraries.AppendTail("setupapi");
|
||||||
|
ldProject.libraries.AppendTail("gdi32");
|
||||||
|
ldProject.libraries.AppendTail("cfgmgr32");
|
||||||
|
ldProject.libraries.AppendTail("uuid");
|
||||||
|
ldProject.libraries.AppendTail("imm32");
|
||||||
|
ldProject.libraries.AppendTail("version");
|
||||||
|
ldProject.libraries.AppendTail("oleaut32");
|
||||||
|
IFileSystem2::CopyFile(CUtlString("%s/bin", szOutputDir.GetString()), "external/windows/libgcc_s_seh-1.dll");
|
||||||
|
IFileSystem2::CopyFile(CUtlString("%s/bin", szOutputDir.GetString()), "external/windows/libwinpthread-1.dll");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
CUtlString outputProject = ldProject.Link();
|
CUtlString outputProject = ldProject.Link();
|
||||||
|
|||||||
@@ -6,6 +6,9 @@
|
|||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include <mach-o/dyld.h>
|
#include <mach-o/dyld.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef __WIN32__
|
||||||
|
#include "windows.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__APPLE__) && defined(__MACH__)
|
#if defined(__APPLE__) && defined(__MACH__)
|
||||||
#include "TargetConditionals.h"
|
#include "TargetConditionals.h"
|
||||||
@@ -19,7 +22,9 @@
|
|||||||
// Other platforms
|
// Other platforms
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef MAX_PATH
|
||||||
#define MAX_PATH 4096
|
#define MAX_PATH 4096
|
||||||
|
#endif
|
||||||
|
|
||||||
static char szLauncherPath[MAX_PATH];
|
static char szLauncherPath[MAX_PATH];
|
||||||
static char szEnginePath[MAX_PATH];
|
static char szEnginePath[MAX_PATH];
|
||||||
@@ -72,6 +77,11 @@ int main( int argc, char **argv ) {
|
|||||||
pEngineMain(argc, argv);
|
pEngineMain(argc, argv);
|
||||||
dlclose(pEngineLib);
|
dlclose(pEngineLib);
|
||||||
#else
|
#else
|
||||||
|
#ifdef __WIN32__
|
||||||
|
GetModuleFileNameA(NULL, szLauncherPath, MAX_PATH);
|
||||||
|
dirname(szLauncherPath);
|
||||||
|
SetCurrentDirectoryA(szLauncherPath);
|
||||||
|
#endif
|
||||||
FunnyMain(argc, argv);
|
FunnyMain(argc, argv);
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public:
|
|||||||
virtual void Spawn( void ) override;
|
virtual void Spawn( void ) override;
|
||||||
virtual void Destroy( void ) override;
|
virtual void Destroy( void ) override;
|
||||||
virtual void Think( float fDelta ) override;
|
virtual void Think( float fDelta ) override;
|
||||||
private:
|
|
||||||
IVertexBuffer *vertexBuffer;
|
IVertexBuffer *vertexBuffer;
|
||||||
IIndexBuffer *indexBuffer;
|
IIndexBuffer *indexBuffer;
|
||||||
IMesh *mesh;
|
IMesh *mesh;
|
||||||
|
|||||||
@@ -96,8 +96,10 @@ enum EInputAxis
|
|||||||
AXIS_MOUSE_X,
|
AXIS_MOUSE_X,
|
||||||
AXIS_MOUSE_Y,
|
AXIS_MOUSE_Y,
|
||||||
AXIS_MOUSE_SCROLL,
|
AXIS_MOUSE_SCROLL,
|
||||||
|
AXIS_CONTROLLER_PITCH,
|
||||||
|
AXIS_CONTROLLER_YAW,
|
||||||
AXIS_MAX,
|
AXIS_MAX,
|
||||||
AXIS_NUM_AXIS = AXIS_MAX - 1,
|
AXIS_NUM_AXIS = AXIS_MAX,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum EMouseMode
|
enum EMouseMode
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ enum EShaderType
|
|||||||
|
|
||||||
enum EBarrierMemoryPermissions
|
enum EBarrierMemoryPermissions
|
||||||
{
|
{
|
||||||
|
BARRIER_MEMORY_PERMISSIONS_NONE = 0x0,
|
||||||
BARRIER_MEMORY_PERMISSIONS_VERTEX_BUFFER_READ = 0x1,
|
BARRIER_MEMORY_PERMISSIONS_VERTEX_BUFFER_READ = 0x1,
|
||||||
BARRIER_MEMORY_PERMISSIONS_INDEX_BUFFER_READ = 0x2,
|
BARRIER_MEMORY_PERMISSIONS_INDEX_BUFFER_READ = 0x2,
|
||||||
BARRIER_MEMORY_PERMISSIONS_UNIFORM_BUFFER_READ = 0x4,
|
BARRIER_MEMORY_PERMISSIONS_UNIFORM_BUFFER_READ = 0x4,
|
||||||
@@ -108,14 +109,15 @@ enum EBarrierMemoryPermissions
|
|||||||
};
|
};
|
||||||
enum EBarrierStage
|
enum EBarrierStage
|
||||||
{
|
{
|
||||||
BARRIER_STAGE_TOP,
|
BARRIER_STAGE_TOP = 0x1,
|
||||||
BARRIER_STAGE_VERTEX_INPUT,
|
BARRIER_STAGE_VERTEX_INPUT = 0x2,
|
||||||
BARRIER_STAGE_VERTEX_SHADER,
|
BARRIER_STAGE_VERTEX_SHADER = 0x4,
|
||||||
BARRIER_STAGE_GEOMETRY_SHADER,
|
BARRIER_STAGE_GEOMETRY_SHADER = 0x8,
|
||||||
BARRIER_STAGE_FRAGMENT_SHADER,
|
BARRIER_STAGE_FRAGMENT_SHADER = 0x10,
|
||||||
BARRIER_STAGE_COMPUTE_SHADER,
|
BARRIER_STAGE_COLOR_OUTPUT = 0x20,
|
||||||
BARRIER_STAGE_RAY_TRACING_SHADER,
|
BARRIER_STAGE_COMPUTE_SHADER = 0x40,
|
||||||
BARRIER_STAGE_BOTTOM,
|
BARRIER_STAGE_RAY_TRACING_SHADER = 0x80,
|
||||||
|
BARRIER_STAGE_BOTTOM = 0x100,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum EAttachmentLoadMode
|
enum EAttachmentLoadMode
|
||||||
@@ -216,7 +218,7 @@ struct ShaderInput_t
|
|||||||
|
|
||||||
struct Shader_t
|
struct Shader_t
|
||||||
{
|
{
|
||||||
const char *szPath;
|
CUtlString szPath;
|
||||||
EShaderType type;
|
EShaderType type;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -262,7 +264,7 @@ struct ImageBarrier_t
|
|||||||
{
|
{
|
||||||
EBarrierMemoryPermissions in;
|
EBarrierMemoryPermissions in;
|
||||||
EBarrierMemoryPermissions out;
|
EBarrierMemoryPermissions out;
|
||||||
IBuffer *pBuffer;
|
IImage *pImage;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct VertexAttribute_t
|
struct VertexAttribute_t
|
||||||
@@ -278,8 +280,8 @@ struct RenderingColorAttachment_t
|
|||||||
IImage *pTemporary;
|
IImage *pTemporary;
|
||||||
EAttachmentLoadMode loadMode;
|
EAttachmentLoadMode loadMode;
|
||||||
EAttachmentStoreMode storeMode;
|
EAttachmentStoreMode storeMode;
|
||||||
EMSAAMode msaaMode;
|
|
||||||
vec4 clearColor;
|
vec4 clearColor;
|
||||||
|
EMSAAMode msaaMode;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RenderingDepthAttachment_t
|
struct RenderingDepthAttachment_t
|
||||||
@@ -288,8 +290,8 @@ struct RenderingDepthAttachment_t
|
|||||||
IImage *pTemporary;
|
IImage *pTemporary;
|
||||||
EAttachmentLoadMode loadMode;
|
EAttachmentLoadMode loadMode;
|
||||||
EAttachmentStoreMode storeMode;
|
EAttachmentStoreMode storeMode;
|
||||||
EMSAAMode msaaMode;
|
|
||||||
float clearValue;
|
float clearValue;
|
||||||
|
EMSAAMode msaaMode;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -310,10 +312,11 @@ public:
|
|||||||
static void DestroyBuffer( IBuffer *pBuffer );
|
static void DestroyBuffer( IBuffer *pBuffer );
|
||||||
static void DestroyImage( IImage *pImage );
|
static void DestroyImage( IImage *pImage );
|
||||||
|
|
||||||
static void SetConstants( uint32_t nSize, uint32_t nOffset, void *pData );
|
static void SetConstants( uint32_t nSize, void *pData );
|
||||||
static void Barrier( EBarrierStage stageIn, uint32_t stageOut, CUtlVector<BufferBarrier_t> buffers, CUtlVector<ImageBarrier_t> images );
|
static void Barrier( uint32_t stageIn, uint32_t stageOut, CUtlVector<BufferBarrier_t> buffers, CUtlVector<ImageBarrier_t> images );
|
||||||
static void BindData( uint32_t binding, IBuffer *pBuffer, IImage* pImage);
|
static void BindData( uint32_t binding, IBuffer *pBuffer, IImage* pImage);
|
||||||
static void BindPipeline( IPipeline *pPipeline );
|
static void BindPipeline( IPipeline *pPipeline );
|
||||||
|
static void PushBindings();
|
||||||
|
|
||||||
|
|
||||||
static void Begin( uint32_t nWidth, uint32_t nHeight, CUtlVector<RenderingColorAttachment_t> attachments, RenderingDepthAttachment_t depth );
|
static void Begin( uint32_t nWidth, uint32_t nHeight, CUtlVector<RenderingColorAttachment_t> attachments, RenderingDepthAttachment_t depth );
|
||||||
@@ -330,7 +333,8 @@ public:
|
|||||||
uint32_t nConstantsSize,
|
uint32_t nConstantsSize,
|
||||||
uint32_t nVertexSize,
|
uint32_t nVertexSize,
|
||||||
CUtlVector<VertexAttribute_t> vertexFormat,
|
CUtlVector<VertexAttribute_t> vertexFormat,
|
||||||
CUtlVector<EImageFormat> outputFormats
|
CUtlVector<EImageFormat> outputFormats,
|
||||||
|
bool bDepth
|
||||||
);
|
);
|
||||||
static IComputePipeline *CreateComputePipeline(
|
static IComputePipeline *CreateComputePipeline(
|
||||||
Shader_t szShader,
|
Shader_t szShader,
|
||||||
@@ -343,6 +347,9 @@ public:
|
|||||||
CUtlVector<ShaderInput_t> inputs,
|
CUtlVector<ShaderInput_t> inputs,
|
||||||
uint32_t nConstantsSize
|
uint32_t nConstantsSize
|
||||||
);
|
);
|
||||||
|
|
||||||
|
static IBuffer *GetCameraMatrix();
|
||||||
|
static IImage *GetOutputImage();
|
||||||
};
|
};
|
||||||
|
|
||||||
abstract_class IRenderingPipelineStep
|
abstract_class IRenderingPipelineStep
|
||||||
|
|||||||
@@ -5,14 +5,14 @@
|
|||||||
#include "stddef.h"
|
#include "stddef.h"
|
||||||
|
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
#define DLL_EXPORT extern "C" __declspec(dllexport)
|
#define DLL_EXPORT extern "C"
|
||||||
#define DLL_IMPORT extern "C" __declspec(dllimport)
|
#define DLL_IMPORT extern "C"
|
||||||
|
|
||||||
#define DLL_CLASS_EXPORT __declspec(dllexport)
|
#define DLL_CLASS_EXPORT
|
||||||
#define DLL_CLASS_IMPORT __declspec(dllimport)
|
#define DLL_CLASS_IMPORT
|
||||||
|
|
||||||
#define DLL_GLOBAL_EXPORT extern __declspec(dllexport)
|
#define DLL_GLOBAL_EXPORT extern
|
||||||
#define DLL_GLOBAL_IMPORT extern __declspec(dllimport)
|
#define DLL_GLOBAL_IMPORT extern
|
||||||
#else
|
#else
|
||||||
#define DLL_EXPORT extern "C" __attribute__ ((visibility("default")))
|
#define DLL_EXPORT extern "C" __attribute__ ((visibility("default")))
|
||||||
#define DLL_IMPORT extern "C"
|
#define DLL_IMPORT extern "C"
|
||||||
|
|||||||
21
public/tier1/utlmutex.h
Normal file
21
public/tier1/utlmutex.h
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#ifndef TIER1_UTL_MUTEX_H
|
||||||
|
#define TIER1_UTL_MUTEX_H
|
||||||
|
|
||||||
|
#include "pthread.h"
|
||||||
|
|
||||||
|
class CUtlLock
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CUtlLock();
|
||||||
|
~CUtlLock();
|
||||||
|
|
||||||
|
CUtlLock(const CUtlLock&) = delete;
|
||||||
|
CUtlLock& operator=(const CUtlLock&) = delete;
|
||||||
|
|
||||||
|
void Lock();
|
||||||
|
void Unlock();
|
||||||
|
private:
|
||||||
|
pthread_mutex_t m_lock;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -16,6 +16,7 @@ int rapier_build()
|
|||||||
szTarget
|
szTarget
|
||||||
};
|
};
|
||||||
IRunner::Run("cargo", "rapier", cargo_args);
|
IRunner::Run("cargo", "rapier", cargo_args);
|
||||||
|
IRunner::Wait();
|
||||||
|
|
||||||
CUtlVector<CUtlString> cbindgen_args = {
|
CUtlVector<CUtlString> cbindgen_args = {
|
||||||
"--config",
|
"--config",
|
||||||
@@ -26,6 +27,7 @@ int rapier_build()
|
|||||||
"../public/physics_gen.h",
|
"../public/physics_gen.h",
|
||||||
};
|
};
|
||||||
IRunner::Run("cbindgen", "rapier", cbindgen_args);
|
IRunner::Run("cbindgen", "rapier", cbindgen_args);
|
||||||
|
IRunner::Wait();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -24,7 +24,11 @@ PLATFORM_INTERFACE void Plat_FatalErrorFunc(const char* szFormat, ...)
|
|||||||
V_vprintf(szFormat, list);
|
V_vprintf(szFormat, list);
|
||||||
va_end(list);
|
va_end(list);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
#ifdef __WIN32__
|
||||||
|
__debugbreak();
|
||||||
|
#else
|
||||||
raise(SIGTRAP);
|
raise(SIGTRAP);
|
||||||
|
#endif
|
||||||
Plat_Exit(1);
|
Plat_Exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,11 +204,29 @@ PLATFORM_INTERFACE void Plat_UnloadLibrary( void *lib )
|
|||||||
|
|
||||||
PLATFORM_INTERFACE double Plat_GetTime( void )
|
PLATFORM_INTERFACE double Plat_GetTime( void )
|
||||||
{
|
{
|
||||||
|
#ifndef __WIN32__
|
||||||
struct timespec tp;
|
struct timespec tp;
|
||||||
clock_gettime(CLOCK_MONOTONIC, &tp);
|
clock_gettime(CLOCK_MONOTONIC, &tp);
|
||||||
static time_t s_starttime = tp.tv_sec;
|
static time_t s_starttime = tp.tv_sec;
|
||||||
|
|
||||||
return (tp.tv_sec-s_starttime)+tp.tv_nsec/1e9;
|
return (tp.tv_sec-s_starttime)+tp.tv_nsec/1e9;
|
||||||
|
#else
|
||||||
|
static LARGE_INTEGER s_startcount;
|
||||||
|
static LARGE_INTEGER s_frequency;
|
||||||
|
static int s_initialized = 0;
|
||||||
|
|
||||||
|
LARGE_INTEGER tp;
|
||||||
|
|
||||||
|
if (!s_initialized) {
|
||||||
|
QueryPerformanceFrequency(&s_frequency);
|
||||||
|
QueryPerformanceCounter(&s_startcount);
|
||||||
|
s_initialized = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
QueryPerformanceCounter(&tp);
|
||||||
|
|
||||||
|
return (double)(tp.QuadPart - s_startcount.QuadPart) / s_frequency.QuadPart;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
PLATFORM_INTERFACE void Plat_Exit( int status )
|
PLATFORM_INTERFACE void Plat_Exit( int status )
|
||||||
@@ -215,4 +237,7 @@ PLATFORM_INTERFACE void Plat_Exit( int status )
|
|||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
_exit(status);
|
_exit(status);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef __WIN32__
|
||||||
|
_exit(status);
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|||||||
22
tier1/utlmutex.cpp
Normal file
22
tier1/utlmutex.cpp
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#include "tier1/utlmutex.h"
|
||||||
|
#include "pthread.h"
|
||||||
|
|
||||||
|
CUtlLock::CUtlLock()
|
||||||
|
{
|
||||||
|
pthread_mutex_init(&m_lock);
|
||||||
|
};
|
||||||
|
|
||||||
|
CUtlLock::~CUtlLock()
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
void CUtlLock::Lock()
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
void CUtlLock::Unlock()
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user