Starting metal backend

This commit is contained in:
Dynamitos
2024-04-09 16:41:12 +02:00
parent fdb43626bb
commit 2359b1e984
24 changed files with 1116 additions and 93 deletions
+50
View File
@@ -0,0 +1,50 @@
#include "Texture.h"
#include "Graphics/Enums.h"
#include "Graphics/Initializer.h"
#include "Graphics/Metal/Graphics.h"
#include "Metal/MTLTexture.hpp"
#include "Enums.h"
using namespace Seele;
using namespace Seele::Metal;
TextureBase::TextureBase(PGraphics graphics, MTL::TextureType type, const TextureCreateInfo& createInfo, Gfx::QueueType& owner, MTL::Texture* existingImage)
: currentOwner(owner)
, graphics(graphics)
, width(createInfo.width)
, height(createInfo.height)
, depth(createInfo.depth)
, arrayCount(createInfo.elements)
, layerCount(createInfo.layers)
, mipLevels(createInfo.mipLevels)
, samples(createInfo.samples)
, format(createInfo.format)
, usage(createInfo.usage)
, texture(existingImage)
, type(type)
, layout(Gfx::SE_IMAGE_LAYOUT_UNDEFINED)
, ownsImage(existingImage == nullptr)
{
if(existingImage == nullptr)
{
MTL::TextureDescriptor* descriptor = MTL::TextureDescriptor::alloc()->init();
descriptor->setPixelFormat(cast(format));
descriptor->setWidth(width);
descriptor->setHeight(height);
descriptor->setDepth(depth);
descriptor->setArrayLength(arrayCount);
descriptor->setMipmapLevelCount(mipLevels);
descriptor->setTextureType(type);
descriptor->setSampleCount(samples);
descriptor->setUsage(cast(usage));
descriptor->release();
}
}
Texture::~Texture()
{
}