metal clear swapchain with blue
This commit is contained in:
@@ -134,6 +134,8 @@ void CBrushRendering::Init()
|
|||||||
{"shaders/brush_frag.spv", SHADER_TYPE_FRAGMENT},
|
{"shaders/brush_frag.spv", SHADER_TYPE_FRAGMENT},
|
||||||
},
|
},
|
||||||
{}, 64,
|
{}, 64,
|
||||||
|
20,
|
||||||
|
{{0,0,EVertexFormat::VERTEX_FORMAT_X32Y32Z32}, {12,1,EVertexFormat::VERTEX_FORMAT_X32Y32}},
|
||||||
{EImageFormat::IMAGE_FORMAT_R8G8B8A8}
|
{EImageFormat::IMAGE_FORMAT_R8G8B8A8}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,24 +6,55 @@
|
|||||||
#include "tier1/utlvector.h"
|
#include "tier1/utlvector.h"
|
||||||
#include "tier0/platform.h"
|
#include "tier0/platform.h"
|
||||||
#include "rendering.h"
|
#include "rendering.h"
|
||||||
|
#include "ml_video.h"
|
||||||
|
|
||||||
mat4 g_cameraView;
|
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 )
|
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 )
|
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 )
|
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 )
|
IIndexBuffer *IRenderer::CreateIndexBuffer( uint32_t uSize )
|
||||||
{
|
{
|
||||||
|
CMlBuffer *pBuffer = new CMlBuffer;
|
||||||
|
pBuffer->m_buffer = g_mlDevice->newBuffer(uSize, MTL::ResourceStorageModeShared);
|
||||||
|
return pBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -96,6 +127,8 @@ 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,
|
||||||
|
CUtlVector<VertexAttribute_t> vertexFormat,
|
||||||
CUtlVector<EImageFormat> outputFormats
|
CUtlVector<EImageFormat> outputFormats
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|||||||
12
engine/ml_video.h
Normal file
12
engine/ml_video.h
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#ifndef ML_VIDEO_H
|
||||||
|
#define ML_VIDEO_H
|
||||||
|
|
||||||
|
#include "Metal/Metal.hpp"
|
||||||
|
#include "QuartzCore/QuartzCore.hpp"
|
||||||
|
|
||||||
|
extern CA::MetalLayer *g_mlLayer;
|
||||||
|
extern MTL::Device *g_mlDevice;
|
||||||
|
extern MTL::CommandQueue *g_mlCommandQueue;
|
||||||
|
extern NS::AutoreleasePool *g_mlPool;
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -11,6 +11,7 @@
|
|||||||
#define CA_PRIVATE_IMPLEMENTATION
|
#define CA_PRIVATE_IMPLEMENTATION
|
||||||
|
|
||||||
#include "tier0/minmax_off.h"
|
#include "tier0/minmax_off.h"
|
||||||
|
#include "QuartzCore/CAMetalLayer.hpp"
|
||||||
#include "Metal/Metal.hpp"
|
#include "Metal/Metal.hpp"
|
||||||
|
|
||||||
#include "SDL3/SDL.h"
|
#include "SDL3/SDL.h"
|
||||||
@@ -19,7 +20,30 @@
|
|||||||
#include "SDL3/SDL_events.h"
|
#include "SDL3/SDL_events.h"
|
||||||
#include "tier0/minmax.h"
|
#include "tier0/minmax.h"
|
||||||
|
|
||||||
|
char g_bConfigNotify = 0;
|
||||||
|
uint32_t g_nWindowWidth = 1280;
|
||||||
|
uint32_t g_nWindowHeight = 720;
|
||||||
|
|
||||||
SDL_Window *g_window;
|
SDL_Window *g_window;
|
||||||
|
SDL_MetalView g_mlView;
|
||||||
|
CA::MetalLayer *g_mlLayer;
|
||||||
|
MTL::Device *g_mlDevice;
|
||||||
|
MTL::CommandQueue *g_mlCommandQueue;
|
||||||
|
NS::AutoreleasePool *g_mlPool;
|
||||||
|
|
||||||
|
#if defined(__APPLE__) && defined(__MACH__)
|
||||||
|
#include "TargetConditionals.h"
|
||||||
|
#if TARGET_OS_IPHONE
|
||||||
|
// iOS
|
||||||
|
#define SDL_METAL_VIEW UI::View
|
||||||
|
#define STBI_NO_THREAD_LOCALS
|
||||||
|
#else
|
||||||
|
// macOS
|
||||||
|
#define SDL_METAL_VIEW NS::View
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
// Other platforms
|
||||||
|
#endif
|
||||||
|
|
||||||
void IInput::SetMouseMode( EMouseMode mode )
|
void IInput::SetMouseMode( EMouseMode mode )
|
||||||
{
|
{
|
||||||
@@ -34,12 +58,131 @@ void IInput::SetMouseMode( EMouseMode mode )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EInputKey ISDL_KeyName(SDL_Keycode key)
|
||||||
|
{
|
||||||
|
switch(key)
|
||||||
|
{
|
||||||
|
case SDLK_ESCAPE: return KEY_ESCAPE;
|
||||||
|
|
||||||
|
case SDLK_1: return KEY_1;
|
||||||
|
case SDLK_2: return KEY_2;
|
||||||
|
case SDLK_3: return KEY_3;
|
||||||
|
case SDLK_4: return KEY_4;
|
||||||
|
case SDLK_5: return KEY_5;
|
||||||
|
case SDLK_6: return KEY_6;
|
||||||
|
case SDLK_7: return KEY_7;
|
||||||
|
case SDLK_8: return KEY_8;
|
||||||
|
case SDLK_9: return KEY_9;
|
||||||
|
case SDLK_0: return KEY_0;
|
||||||
|
|
||||||
|
case SDLK_A: return KEY_A;
|
||||||
|
case SDLK_B: return KEY_B;
|
||||||
|
case SDLK_C: return KEY_C;
|
||||||
|
case SDLK_D: return KEY_D;
|
||||||
|
case SDLK_E: return KEY_E;
|
||||||
|
case SDLK_F: return KEY_F;
|
||||||
|
case SDLK_G: return KEY_G;
|
||||||
|
case SDLK_H: return KEY_H;
|
||||||
|
case SDLK_I: return KEY_I;
|
||||||
|
case SDLK_J: return KEY_J;
|
||||||
|
case SDLK_K: return KEY_K;
|
||||||
|
case SDLK_L: return KEY_L;
|
||||||
|
case SDLK_M: return KEY_M;
|
||||||
|
case SDLK_N: return KEY_N;
|
||||||
|
case SDLK_O: return KEY_O;
|
||||||
|
case SDLK_P: return KEY_P;
|
||||||
|
case SDLK_Q: return KEY_Q;
|
||||||
|
case SDLK_R: return KEY_R;
|
||||||
|
case SDLK_S: return KEY_S;
|
||||||
|
case SDLK_T: return KEY_T;
|
||||||
|
case SDLK_U: return KEY_U;
|
||||||
|
case SDLK_V: return KEY_V;
|
||||||
|
case SDLK_W: return KEY_W;
|
||||||
|
case SDLK_X: return KEY_X;
|
||||||
|
case SDLK_Y: return KEY_Y;
|
||||||
|
case SDLK_Z: return KEY_Z;
|
||||||
|
}
|
||||||
|
return KEY_NONE;
|
||||||
|
};
|
||||||
|
|
||||||
|
void IVideo_HandleEvents()
|
||||||
|
{
|
||||||
|
SDL_Event event;
|
||||||
|
while (SDL_PollEvent(&event))
|
||||||
|
{
|
||||||
|
SDL_KeyboardEvent *key = &event.key;
|
||||||
|
SDL_MouseMotionEvent *motion = &event.motion;
|
||||||
|
switch (event.type)
|
||||||
|
{
|
||||||
|
case SDL_EVENT_WINDOW_RESIZED:
|
||||||
|
g_nWindowWidth = event.window.data1;
|
||||||
|
g_nWindowHeight = event.window.data2;
|
||||||
|
g_bConfigNotify = 2;
|
||||||
|
break;
|
||||||
|
case SDL_EVENT_KEY_DOWN:
|
||||||
|
if (!key->repeat)
|
||||||
|
IInput::KeyEvent(ISDL_KeyName(key->key),KEY_EVENT_TYPE_DOWN);
|
||||||
|
break;
|
||||||
|
case SDL_EVENT_KEY_UP:
|
||||||
|
key = &event.key;
|
||||||
|
if (!key->repeat)
|
||||||
|
IInput::KeyEvent(ISDL_KeyName(key->key),KEY_EVENT_TYPE_UP);
|
||||||
|
break;
|
||||||
|
case SDL_EVENT_MOUSE_MOTION:
|
||||||
|
IInput::AxisEvent(AXIS_MOUSE_X, motion->yrel*0.022);
|
||||||
|
IInput::AxisEvent(AXIS_MOUSE_Y, -motion->xrel*0.022);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
void IVideo::Init()
|
void IVideo::Init()
|
||||||
{
|
{
|
||||||
if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS))
|
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS);
|
||||||
V_printf("%s\n",SDL_GetError());
|
g_window = SDL_CreateWindow("rtt", 1280, 720, SDL_WINDOW_METAL);
|
||||||
g_window = SDL_CreateWindow("rtt", 1280, 720, SDL_WINDOW_VULKAN);
|
g_mlView = SDL_Metal_CreateView(g_window);
|
||||||
|
g_mlLayer = (CA::MetalLayer*)SDL_Metal_GetLayer(g_mlView);
|
||||||
|
|
||||||
|
g_mlDevice = MTL::CreateSystemDefaultDevice();
|
||||||
|
|
||||||
|
g_mlLayer->setDevice(g_mlDevice);
|
||||||
|
g_mlLayer->setPixelFormat(MTL::PixelFormatBGRA8Unorm);
|
||||||
|
|
||||||
|
g_mlCommandQueue = g_mlDevice->newCommandQueue();
|
||||||
|
|
||||||
|
g_mlLayer->setDrawableSize(CGSizeMake(1280, 720));
|
||||||
|
|
||||||
}
|
}
|
||||||
void IVideo::Frame( float fDelta )
|
void IVideo::Frame( float fDelta )
|
||||||
{
|
{
|
||||||
|
IVideo_HandleEvents();
|
||||||
|
|
||||||
|
NS::AutoreleasePool *pool = NS::AutoreleasePool::alloc()->init();
|
||||||
|
int w, h;
|
||||||
|
SDL_GetWindowSizeInPixels(g_window, &w, &h);
|
||||||
|
g_mlLayer->setDrawableSize(CGSizeMake(w, h));
|
||||||
|
|
||||||
|
CA::MetalDrawable *drawable = g_mlLayer->nextDrawable();
|
||||||
|
if (!drawable)
|
||||||
|
return;
|
||||||
|
|
||||||
|
MTL::CommandBuffer *commandBuffer = g_mlCommandQueue->commandBuffer();
|
||||||
|
|
||||||
|
MTL::RenderPassDescriptor *renderPass = MTL::RenderPassDescriptor::alloc()->init();
|
||||||
|
renderPass->colorAttachments()->object(0)->setTexture(drawable->texture());
|
||||||
|
renderPass->colorAttachments()->object(0)->setLoadAction(MTL::LoadActionClear);
|
||||||
|
renderPass->colorAttachments()->object(0)->setStoreAction(MTL::StoreActionStore);
|
||||||
|
renderPass->colorAttachments()->object(0)->setClearColor(MTL::ClearColor(0.0, 0, 1.0, 1.0));
|
||||||
|
MTL::RenderCommandEncoder *renderEncoder = commandBuffer->renderCommandEncoder(renderPass);
|
||||||
|
renderEncoder->endEncoding();
|
||||||
|
|
||||||
|
commandBuffer->presentDrawable(drawable);
|
||||||
|
commandBuffer->commit();
|
||||||
|
pool->release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IVideo::Deinit()
|
||||||
|
{
|
||||||
|
g_mlCommandQueue->release();
|
||||||
|
g_mlDevice->release();
|
||||||
|
};
|
||||||
|
|||||||
@@ -65,6 +65,35 @@ VkFormat IRenderer_FormatToVk( EImageFormat format )
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
VkFormat IRenderer_VertexToVk( EVertexFormat format )
|
||||||
|
{
|
||||||
|
switch (format)
|
||||||
|
{
|
||||||
|
case VERTEX_FORMAT_X16: return VK_FORMAT_R16_SFLOAT;
|
||||||
|
case VERTEX_FORMAT_X16Y16: return VK_FORMAT_R16G16_SFLOAT;
|
||||||
|
case VERTEX_FORMAT_X16Y16Z16: return VK_FORMAT_R16G16B16_SFLOAT;
|
||||||
|
case VERTEX_FORMAT_X16Y16Z16W16: return VK_FORMAT_R16G16B16A16_SFLOAT;
|
||||||
|
case VERTEX_FORMAT_X32: return VK_FORMAT_R32_SFLOAT;
|
||||||
|
case VERTEX_FORMAT_X32Y32: return VK_FORMAT_R32G32_SFLOAT;
|
||||||
|
case VERTEX_FORMAT_X32Y32Z32: return VK_FORMAT_R32G32B32_SFLOAT;
|
||||||
|
case VERTEX_FORMAT_X32Y32Z32W32: return VK_FORMAT_R32G32B32A32_SFLOAT;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
uint32_t IRenderer_VertexToSize( EVertexFormat format )
|
||||||
|
{
|
||||||
|
switch (format)
|
||||||
|
{
|
||||||
|
case VERTEX_FORMAT_X16: return 2;
|
||||||
|
case VERTEX_FORMAT_X16Y16: return 4;
|
||||||
|
case VERTEX_FORMAT_X16Y16Z16: return 6;
|
||||||
|
case VERTEX_FORMAT_X16Y16Z16W16: return 8;
|
||||||
|
case VERTEX_FORMAT_X32: return 4;
|
||||||
|
case VERTEX_FORMAT_X32Y32: return 8;
|
||||||
|
case VERTEX_FORMAT_X32Y32Z32: return 12;
|
||||||
|
case VERTEX_FORMAT_X32Y32Z32W32: return 16;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
VkAttachmentLoadOp IRenderer_LoadOpVk( EAttachmentLoadMode mode )
|
VkAttachmentLoadOp IRenderer_LoadOpVk( EAttachmentLoadMode mode )
|
||||||
{
|
{
|
||||||
switch (mode)
|
switch (mode)
|
||||||
@@ -228,11 +257,13 @@ void vk_shader_t::Destroy( void )
|
|||||||
|
|
||||||
|
|
||||||
void vk_tripipeline_t::Create(
|
void vk_tripipeline_t::Create(
|
||||||
CUtlVector<vk_shader_t> &shaders,
|
CUtlVector<vk_shader_t> &shaders,
|
||||||
CUtlVector<VkDescriptorSetLayoutBinding> &bindings,
|
CUtlVector<VkDescriptorSetLayoutBinding> &bindings,
|
||||||
uint32_t pushConstantSize,
|
uint32_t pushConstantSize,
|
||||||
CUtlVector<VkFormat> formats
|
uint32_t nVertexSize,
|
||||||
)
|
CUtlVector<VertexAttribute_t> vertexFormat,
|
||||||
|
CUtlVector<VkFormat> formats
|
||||||
|
)
|
||||||
{
|
{
|
||||||
VkPushConstantRange pushConstantRange = {};
|
VkPushConstantRange pushConstantRange = {};
|
||||||
pushConstantRange.stageFlags = VK_SHADER_STAGE_ALL;
|
pushConstantRange.stageFlags = VK_SHADER_STAGE_ALL;
|
||||||
@@ -295,11 +326,32 @@ void vk_tripipeline_t::Create(
|
|||||||
VK_DYNAMIC_STATE_BLEND_CONSTANTS,
|
VK_DYNAMIC_STATE_BLEND_CONSTANTS,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
VkVertexInputBindingDescription vibd = {
|
||||||
|
.binding = 0,
|
||||||
|
.stride = nVertexSize,
|
||||||
|
.inputRate = VK_VERTEX_INPUT_RATE_VERTEX,
|
||||||
|
};
|
||||||
|
|
||||||
VkPipelineDynamicStateCreateInfo pipelineDynamicStateCreateInfo = {
|
VkPipelineDynamicStateCreateInfo pipelineDynamicStateCreateInfo = {
|
||||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO,
|
||||||
.dynamicStateCount = sizeof(dynamicStates)/sizeof(VkDynamicState),
|
.dynamicStateCount = sizeof(dynamicStates)/sizeof(VkDynamicState),
|
||||||
.pDynamicStates = dynamicStates,
|
.pDynamicStates = dynamicStates,
|
||||||
};
|
};
|
||||||
|
CUtlVector<VkVertexInputAttributeDescription> viad(vertexFormat.GetSize());
|
||||||
|
for ( uint32_t i = 0; i < viad.GetSize(); i++ )
|
||||||
|
{
|
||||||
|
viad[i].location = 0;
|
||||||
|
viad[i].binding = vertexFormat[i].binding;
|
||||||
|
viad[i].format = IRenderer_VertexToVk(vertexFormat[i].format);
|
||||||
|
viad[i].offset = vertexFormat[i].offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
VkPipelineVertexInputStateCreateInfo pvisci = {
|
||||||
|
.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
|
||||||
|
.vertexBindingDescriptionCount = 1,
|
||||||
|
.pVertexBindingDescriptions = &vibd,
|
||||||
|
.vertexAttributeDescriptionCount = (uint32_t)vertexFormat.GetSize(),
|
||||||
|
};
|
||||||
|
|
||||||
VkPipelineInputAssemblyStateCreateInfo piasci = {
|
VkPipelineInputAssemblyStateCreateInfo piasci = {
|
||||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO,
|
||||||
@@ -318,6 +370,7 @@ void vk_tripipeline_t::Create(
|
|||||||
|
|
||||||
VkGraphicsPipelineCreateInfo graphicsPipelineCreateInfo = {};
|
VkGraphicsPipelineCreateInfo graphicsPipelineCreateInfo = {};
|
||||||
graphicsPipelineCreateInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
|
graphicsPipelineCreateInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
|
||||||
|
graphicsPipelineCreateInfo.pVertexInputState = &pvisci;
|
||||||
graphicsPipelineCreateInfo.pInputAssemblyState = &piasci;
|
graphicsPipelineCreateInfo.pInputAssemblyState = &piasci;
|
||||||
graphicsPipelineCreateInfo.layout = m_layout;
|
graphicsPipelineCreateInfo.layout = m_layout;
|
||||||
graphicsPipelineCreateInfo.pDynamicState = &pipelineDynamicStateCreateInfo;
|
graphicsPipelineCreateInfo.pDynamicState = &pipelineDynamicStateCreateInfo;
|
||||||
@@ -808,6 +861,8 @@ 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,
|
||||||
|
CUtlVector<VertexAttribute_t> vertexFormats,
|
||||||
CUtlVector<EImageFormat> outputFormats
|
CUtlVector<EImageFormat> outputFormats
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -816,6 +871,7 @@ IGraphicsPipeline *IRenderer::CreateGraphicsPipeline(
|
|||||||
CUtlVector<vk_shader_t> vkshaders(shaders.GetSize());
|
CUtlVector<vk_shader_t> vkshaders(shaders.GetSize());
|
||||||
CUtlVector<VkDescriptorSetLayoutBinding> vkbindings(inputs.GetSize());
|
CUtlVector<VkDescriptorSetLayoutBinding> vkbindings(inputs.GetSize());
|
||||||
CUtlVector<VkFormat> vkformats(outputFormats.GetSize());
|
CUtlVector<VkFormat> vkformats(outputFormats.GetSize());
|
||||||
|
CUtlVector<VkVertexInputAttributeDescription> vkVertexFormats(vertexFormats.GetSize());
|
||||||
|
|
||||||
for ( uint32_t i = 0; i < vkshaders.GetSize(); i++ )
|
for ( uint32_t i = 0; i < vkshaders.GetSize(); i++ )
|
||||||
{
|
{
|
||||||
@@ -842,8 +898,9 @@ IGraphicsPipeline *IRenderer::CreateGraphicsPipeline(
|
|||||||
{
|
{
|
||||||
vkformats[i] = IRenderer_FormatToVk(outputFormats[i]);
|
vkformats[i] = IRenderer_FormatToVk(outputFormats[i]);
|
||||||
}
|
}
|
||||||
pipeline->m_pipeline.Create(vkshaders, vkbindings, nConstantsSize, vkformats);
|
|
||||||
return 0;
|
pipeline->m_pipeline.Create(vkshaders, vkbindings, nConstantsSize, nVertexSize, vertexFormats, vkformats);
|
||||||
|
return pipeline;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ struct vk_tripipeline_t
|
|||||||
CUtlVector<vk_shader_t> &shaders,
|
CUtlVector<vk_shader_t> &shaders,
|
||||||
CUtlVector<VkDescriptorSetLayoutBinding> &bindings,
|
CUtlVector<VkDescriptorSetLayoutBinding> &bindings,
|
||||||
uint32_t pushConstantsSize,
|
uint32_t pushConstantsSize,
|
||||||
|
uint32_t nVertexSize,
|
||||||
|
CUtlVector<VertexAttribute_t> vertexFormat,
|
||||||
CUtlVector<VkFormat> formats
|
CUtlVector<VkFormat> formats
|
||||||
/* the rest of the stuff is set by the dynamic state */
|
/* the rest of the stuff is set by the dynamic state */
|
||||||
/* literally */
|
/* literally */
|
||||||
|
|||||||
@@ -232,8 +232,7 @@ EInputKey ISDL_KeyName(SDL_Keycode key)
|
|||||||
|
|
||||||
void IVideo::Init()
|
void IVideo::Init()
|
||||||
{
|
{
|
||||||
if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS))
|
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS);
|
||||||
V_printf("%s\n",SDL_GetError());
|
|
||||||
g_window = SDL_CreateWindow("rtt", 1280, 720, SDL_WINDOW_VULKAN);
|
g_window = SDL_CreateWindow("rtt", 1280, 720, SDL_WINDOW_VULKAN);
|
||||||
|
|
||||||
unsigned int nExtensionCount = 0;
|
unsigned int nExtensionCount = 0;
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ CUtlString CLDProject::Link( void )
|
|||||||
args.AppendTail("-fembed-bitcode");
|
args.AppendTail("-fembed-bitcode");
|
||||||
args.AppendTail("-Wl,-rpath,@executable_path");
|
args.AppendTail("-Wl,-rpath,@executable_path");
|
||||||
args.AppendTail("-Wl,-all_load");
|
args.AppendTail("-Wl,-all_load");
|
||||||
|
args.AppendTail("-w");
|
||||||
}
|
}
|
||||||
if (m_target.kernel == TARGET_KERNEL_LINUX)
|
if (m_target.kernel == TARGET_KERNEL_LINUX)
|
||||||
{
|
{
|
||||||
|
|||||||
Binary file not shown.
@@ -24,7 +24,7 @@
|
|||||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
<BreakpointContent
|
<BreakpointContent
|
||||||
uuid = "9CD4CFDC-F438-44E9-8503-A7BD5623A3F5"
|
uuid = "9CD4CFDC-F438-44E9-8503-A7BD5623A3F5"
|
||||||
shouldBeEnabled = "Yes"
|
shouldBeEnabled = "No"
|
||||||
ignoreCount = "0"
|
ignoreCount = "0"
|
||||||
continueAfterRunningActions = "No"
|
continueAfterRunningActions = "No"
|
||||||
filePath = "../../engine/gamemode.cpp"
|
filePath = "../../engine/gamemode.cpp"
|
||||||
@@ -34,36 +34,6 @@
|
|||||||
endingLineNumber = "20"
|
endingLineNumber = "20"
|
||||||
landmarkName = "CGameMode::RoundBegin()"
|
landmarkName = "CGameMode::RoundBegin()"
|
||||||
landmarkType = "7">
|
landmarkType = "7">
|
||||||
<Locations>
|
|
||||||
<Location
|
|
||||||
uuid = "9CD4CFDC-F438-44E9-8503-A7BD5623A3F5 - 70fde1d2ef5893c5"
|
|
||||||
shouldBeEnabled = "Yes"
|
|
||||||
ignoreCount = "0"
|
|
||||||
continueAfterRunningActions = "No"
|
|
||||||
symbolName = "CGameMode::RoundBegin()"
|
|
||||||
moduleName = "funnygame"
|
|
||||||
usesParentBreakpointCondition = "Yes"
|
|
||||||
urlString = "file:///Volumes/mnt/rtt/funny_engine/engine/gamemode.cpp"
|
|
||||||
startingColumnNumber = "9223372036854775807"
|
|
||||||
endingColumnNumber = "9223372036854775807"
|
|
||||||
startingLineNumber = "20"
|
|
||||||
endingLineNumber = "20">
|
|
||||||
</Location>
|
|
||||||
<Location
|
|
||||||
uuid = "9CD4CFDC-F438-44E9-8503-A7BD5623A3F5 - 70fde1d2ef5893c5"
|
|
||||||
shouldBeEnabled = "Yes"
|
|
||||||
ignoreCount = "0"
|
|
||||||
continueAfterRunningActions = "No"
|
|
||||||
symbolName = "CGameMode::RoundBegin()"
|
|
||||||
moduleName = "funnygame"
|
|
||||||
usesParentBreakpointCondition = "Yes"
|
|
||||||
urlString = "file:///Volumes/mnt/rtt/funny_engine/engine/gamemode.cpp"
|
|
||||||
startingColumnNumber = "9223372036854775807"
|
|
||||||
endingColumnNumber = "9223372036854775807"
|
|
||||||
startingLineNumber = "20"
|
|
||||||
endingLineNumber = "20">
|
|
||||||
</Location>
|
|
||||||
</Locations>
|
|
||||||
</BreakpointContent>
|
</BreakpointContent>
|
||||||
</BreakpointProxy>
|
</BreakpointProxy>
|
||||||
<BreakpointProxy
|
<BreakpointProxy
|
||||||
@@ -80,36 +50,6 @@
|
|||||||
endingLineNumber = "54"
|
endingLineNumber = "54"
|
||||||
landmarkName = "C_EntityRegistry::C_EntityRegistry(szName, pfn)"
|
landmarkName = "C_EntityRegistry::C_EntityRegistry(szName, pfn)"
|
||||||
landmarkType = "7">
|
landmarkType = "7">
|
||||||
<Locations>
|
|
||||||
<Location
|
|
||||||
uuid = "2AA185EC-C7B8-4BD8-9B0E-B1C6F946E8C5 - f7b66ca66b0509eb"
|
|
||||||
shouldBeEnabled = "Yes"
|
|
||||||
ignoreCount = "0"
|
|
||||||
continueAfterRunningActions = "No"
|
|
||||||
symbolName = "C_EntityRegistry::C_EntityRegistry(char const*, C_BaseEntity* (*)())"
|
|
||||||
moduleName = "funnygame"
|
|
||||||
usesParentBreakpointCondition = "Yes"
|
|
||||||
urlString = "file:///Volumes/mnt/rtt/funny_engine/engine/baseentity.cpp"
|
|
||||||
startingColumnNumber = "9223372036854775807"
|
|
||||||
endingColumnNumber = "9223372036854775807"
|
|
||||||
startingLineNumber = "56"
|
|
||||||
endingLineNumber = "56">
|
|
||||||
</Location>
|
|
||||||
<Location
|
|
||||||
uuid = "2AA185EC-C7B8-4BD8-9B0E-B1C6F946E8C5 - f7b66ca66b0509cc"
|
|
||||||
shouldBeEnabled = "Yes"
|
|
||||||
ignoreCount = "0"
|
|
||||||
continueAfterRunningActions = "No"
|
|
||||||
symbolName = "C_EntityRegistry::C_EntityRegistry(char const*, C_BaseEntity* (*)())"
|
|
||||||
moduleName = "funnygame"
|
|
||||||
usesParentBreakpointCondition = "Yes"
|
|
||||||
urlString = "file:///Volumes/mnt/rtt/funny_engine/engine/baseentity.cpp"
|
|
||||||
startingColumnNumber = "9223372036854775807"
|
|
||||||
endingColumnNumber = "9223372036854775807"
|
|
||||||
startingLineNumber = "55"
|
|
||||||
endingLineNumber = "55">
|
|
||||||
</Location>
|
|
||||||
</Locations>
|
|
||||||
</BreakpointContent>
|
</BreakpointContent>
|
||||||
</BreakpointProxy>
|
</BreakpointProxy>
|
||||||
<BreakpointProxy
|
<BreakpointProxy
|
||||||
@@ -144,5 +84,69 @@
|
|||||||
landmarkType = "7">
|
landmarkType = "7">
|
||||||
</BreakpointContent>
|
</BreakpointContent>
|
||||||
</BreakpointProxy>
|
</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>
|
</Breakpoints>
|
||||||
</Bucket>
|
</Bucket>
|
||||||
|
|||||||
@@ -4,24 +4,5 @@
|
|||||||
<dict>
|
<dict>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>funnygame</string>
|
<string>funnygame</string>
|
||||||
<key>UIApplicationSceneManifest</key>
|
|
||||||
<dict>
|
|
||||||
<key>UIApplicationSupportsMultipleScenes</key>
|
|
||||||
<false/>
|
|
||||||
<key>UISceneConfigurations</key>
|
|
||||||
<dict>
|
|
||||||
<key>UIWindowSceneSessionRoleApplication</key>
|
|
||||||
<array>
|
|
||||||
<dict>
|
|
||||||
<key>UISceneConfigurationName</key>
|
|
||||||
<string>Default Configuration</string>
|
|
||||||
<key>UISceneDelegateClassName</key>
|
|
||||||
<string>SceneDelegate</string>
|
|
||||||
<key>UISceneStoryboardFile</key>
|
|
||||||
<string>Main</string>
|
|
||||||
</dict>
|
|
||||||
</array>
|
|
||||||
</dict>
|
|
||||||
</dict>
|
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17150" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
|
||||||
<dependencies>
|
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17122"/>
|
|
||||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
|
||||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
|
||||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
|
||||||
</dependencies>
|
|
||||||
<scenes>
|
|
||||||
<!--View Controller-->
|
|
||||||
<scene sceneID="s0d-6b-0kx">
|
|
||||||
<objects>
|
|
||||||
<viewController id="Y6W-OH-hqX" sceneMemberID="viewController">
|
|
||||||
<view key="view" contentMode="scaleToFill" id="5EZ-qb-Rvc">
|
|
||||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
|
||||||
<viewLayoutGuide key="safeArea" id="vDu-zF-Fre"/>
|
|
||||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
|
||||||
</view>
|
|
||||||
</viewController>
|
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="Ief-a0-LHa" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
|
|
||||||
</objects>
|
|
||||||
</scene>
|
|
||||||
</scenes>
|
|
||||||
<resources>
|
|
||||||
<systemColor name="systemBackgroundColor">
|
|
||||||
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
|
||||||
</systemColor>
|
|
||||||
</resources>
|
|
||||||
</document>
|
|
||||||
@@ -144,6 +144,7 @@ interface IVideo
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void Init();
|
static void Init();
|
||||||
|
static void Deinit();
|
||||||
static void CreatePipelines( void );
|
static void CreatePipelines( void );
|
||||||
static void Frame( float fDelta );
|
static void Frame( float fDelta );
|
||||||
};
|
};
|
||||||
@@ -324,22 +325,24 @@ public:
|
|||||||
static void End();
|
static void End();
|
||||||
|
|
||||||
static IGraphicsPipeline *CreateGraphicsPipeline(
|
static IGraphicsPipeline *CreateGraphicsPipeline(
|
||||||
CUtlVector<Shader_t> shaders,
|
CUtlVector<Shader_t> shaders,
|
||||||
CUtlVector<ShaderInput_t> inputs,
|
CUtlVector<ShaderInput_t> inputs,
|
||||||
uint32_t nConstantsSize,
|
uint32_t nConstantsSize,
|
||||||
CUtlVector<EImageFormat> outputFormats
|
uint32_t nVertexSize,
|
||||||
);
|
CUtlVector<VertexAttribute_t> vertexFormat,
|
||||||
|
CUtlVector<EImageFormat> outputFormats
|
||||||
|
);
|
||||||
static IComputePipeline *CreateComputePipeline(
|
static IComputePipeline *CreateComputePipeline(
|
||||||
Shader_t szShader,
|
Shader_t szShader,
|
||||||
CUtlVector<ShaderInput_t> inputs,
|
CUtlVector<ShaderInput_t> inputs,
|
||||||
uint32_t nConstantsSize
|
uint32_t nConstantsSize
|
||||||
);
|
);
|
||||||
|
|
||||||
static IRayTracingPipeline *CreateRayTracingPipeline(
|
static IRayTracingPipeline *CreateRayTracingPipeline(
|
||||||
CUtlVector<Shader_t> shaders,
|
CUtlVector<Shader_t> shaders,
|
||||||
CUtlVector<ShaderInput_t> inputs,
|
CUtlVector<ShaderInput_t> inputs,
|
||||||
uint32_t nConstantsSize
|
uint32_t nConstantsSize
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
abstract_class IRenderingPipelineStep
|
abstract_class IRenderingPipelineStep
|
||||||
|
|||||||
Reference in New Issue
Block a user