Trying to fix macos

This commit is contained in:
Dynamitos committed 2025-06-20 13:06:57 +02:00
1 parent ad725ba9d9
commit 8499d418e8
11 files changed
+38 -15

No files matched your search

@@ -195,6 +195,20 @@ PGraphicsPipeline PipelineCache::createPipeline(Gfx::MeshPipelineCreateInfo crea
desc->setBlendingEnabled(false);
pipelineDescriptor->colorAttachments()->setObject(desc, c);
}
MTL::DepthStencilDescriptor* depthDescriptor = MTL::DepthStencilDescriptor::alloc()->init();
if (createInfo.renderPass->getLayout().depthAttachment.getTexture() != nullptr) {
depthDescriptor->setDepthWriteEnabled(createInfo.depthStencilState.depthWriteEnable);
depthDescriptor->setDepthCompareFunction(cast(createInfo.depthStencilState.depthCompareOp));
pipelineDescriptor->setDepthAttachmentPixelFormat(
cast(createInfo.renderPass->getLayout().depthAttachment.getTexture().cast<Texture2D>()->getFormat()));
}
pipelineDescriptor->setAlphaToCoverageEnabled(createInfo.multisampleState.alphaCoverageEnable);
pipelineDescriptor->setAlphaToOneEnabled(createInfo.multisampleState.alphaToOneEnable);
pipelineDescriptor->setRasterSampleCount(createInfo.multisampleState.samples);
pipelineDescriptor->setRasterizationEnabled(!createInfo.rasterizationState.rasterizerDiscardEnable);
MTL::DepthStencilState* depthState = graphics->getDevice()->newDepthStencilState(depthDescriptor);
depthDescriptor->release();
if (createInfo.renderPass->getLayout().depthAttachment.getTexture() != nullptr) {
pipelineDescriptor->setDepthAttachmentPixelFormat(
cast(createInfo.renderPass->getLayout().depthAttachment.getTexture().cast<Texture2D>()->getFormat()));
@@ -228,6 +242,7 @@ PGraphicsPipeline PipelineCache::createPipeline(Gfx::MeshPipelineCreateInfo crea
graphicsPipelines[hash]->meshFunction = meshFunction;
graphicsPipelines[hash]->fragmentSets = fragmentSets;
graphicsPipelines[hash]->fragmentFunction = fragmentFunction;
graphicsPipelines[hash]->depth = depthState;
return graphicsPipelines[hash];
}
+1 -1
View File
@@ -35,7 +35,7 @@ Event::Event(PGraphics graphics) : handle(graphics->getDevice()->newEvent()) {}
Event::~Event() { handle->release(); }
Sampler::Sampler(PGraphics graphics, const SamplerCreateInfo& createInfo) {
Sampler::Sampler(PGraphics graphics, const SamplerCreateInfo& createInfo) : Gfx::Sampler(createInfo) {
MTL::SamplerDescriptor* desc = MTL::SamplerDescriptor::alloc()->init();
desc->setBorderColor(cast(createInfo.borderColor));
desc->setCompareFunction(cast(createInfo.compareOp));
+4
View File
@@ -43,6 +43,7 @@ class TextureBase {
uint32 getWidth() const { return handle->width; }
uint32 getHeight() const { return handle->height; }
uint32 getDepth() const { return handle->depth; }
uint32 getNumLayers() const { return handle->arrayCount; }
PTextureHandle getHandle() const { return handle; }
MTL::Texture* getImage() const { return handle->texture; };
constexpr Gfx::SeImageLayout getLayout() const { return handle->layout; }
@@ -78,6 +79,7 @@ class Texture2D : public Gfx::Texture2D, public TextureBase {
virtual uint32 getWidth() const override { return handle->width; }
virtual uint32 getHeight() const override { return handle->height; }
virtual uint32 getDepth() const override { return handle->depth; }
virtual uint32 getNumLayers() const override { return handle->arrayCount; }
virtual Gfx::SeFormat getFormat() const override { return handle->format; }
virtual Gfx::SeSampleCountFlags getNumSamples() const override { return handle->samples; }
virtual uint32 getMipLevels() const override { return handle->mipLevels; }
@@ -101,6 +103,7 @@ class Texture3D : public Gfx::Texture3D, public TextureBase {
virtual uint32 getWidth() const override { return handle->width; }
virtual uint32 getHeight() const override { return handle->height; }
virtual uint32 getDepth() const override { return handle->depth; }
virtual uint32 getNumLayers() const override { return handle->arrayCount; }
virtual Gfx::SeFormat getFormat() const override { return handle->format; }
virtual Gfx::SeSampleCountFlags getNumSamples() const override { return handle->samples; }
virtual uint32 getMipLevels() const override { return handle->mipLevels; }
@@ -124,6 +127,7 @@ class TextureCube : public Gfx::TextureCube, public TextureBase {
virtual uint32 getWidth() const override { return handle->width; }
virtual uint32 getHeight() const override { return handle->height; }
virtual uint32 getDepth() const override { return handle->depth; }
virtual uint32 getNumLayers() const override { return handle->arrayCount; }
virtual Gfx::SeFormat getFormat() const override { return handle->format; }
virtual Gfx::SeSampleCountFlags getNumSamples() const override { return handle->samples; }
virtual uint32 getMipLevels() const override { return handle->mipLevels; }