Trying to fix macos

This commit is contained in:
Dynamitos
2025-06-20 13:06:57 +02:00
parent ad725ba9d9
commit 8499d418e8
11 changed files with 38 additions and 15 deletions
+1 -1
View File
@@ -22,7 +22,7 @@
"lldb.showDisassembly": "auto", "lldb.showDisassembly": "auto",
"lldb.dereferencePointers": true, "lldb.dereferencePointers": true,
"lldb.consoleMode": "commands", "lldb.consoleMode": "commands",
"cmake.generator": "Unix Makefiles", "cmake.generator": "Xcode",
"editor.tabSize": 4, "editor.tabSize": 4,
"slang.additionalSearchPaths": [ "slang.additionalSearchPaths": [
"res/shaders/", "res/shaders/",
+2 -2
View File
@@ -27,8 +27,8 @@ struct MeshData
PoolRange indicesRange; PoolRange indicesRange;
}; };
static const uint32_t MAX_VERTICES = 256; static const uint32_t MAX_VERTICES = 128;
static const uint32_t MAX_PRIMITIVES = 256; static const uint32_t MAX_PRIMITIVES = 128;
struct InstanceData struct InstanceData
{ {
+3 -1
View File
@@ -3,7 +3,7 @@ import VertexData;
import MaterialParameter; import MaterialParameter;
import Scene; import Scene;
struct StaticMeshVertexData : IVertexData struct StaticMeshVertexData
{ {
float uint16ToFloat(uint16_t value) float uint16ToFloat(uint16_t value)
{ {
@@ -34,3 +34,5 @@ struct StaticMeshVertexData : IVertexData
StructuredBuffer<uint16_t> color; StructuredBuffer<uint16_t> color;
StructuredBuffer<uint16_t> texCoords[MAX_TEXCOORDS]; StructuredBuffer<uint16_t> texCoords[MAX_TEXCOORDS];
}; };
layout(set = 1)
ParameterBlock<StaticMeshVertexData> pVertexData;
+6 -6
View File
@@ -6,9 +6,9 @@ struct VertexInput
uint instanceId: SV_InstanceID; uint instanceId: SV_InstanceID;
} }
interface IVertexData //interface IVertexData
{ //{
VertexAttributes getAttributes(uint index); // VertexAttributes getAttributes(uint index);
}; //};
layout(set = 1) //layout(set = 1)
ParameterBlock<IVertexData> pVertexData; //ParameterBlock<IVertexData> pVertexData;
+2
View File
@@ -38,10 +38,12 @@ EnvironmentLoader::EnvironmentLoader(Gfx::PGraphics graphics) : graphics(graphic
cubeRenderLayout->addDescriptorBinding(Gfx::DescriptorBinding{ cubeRenderLayout->addDescriptorBinding(Gfx::DescriptorBinding{
.name = "view", .name = "view",
.uniformLength = sizeof(Matrix4) * 6, .uniformLength = sizeof(Matrix4) * 6,
.descriptorCount = 24,
}); });
cubeRenderLayout->addDescriptorBinding(Gfx::DescriptorBinding{ cubeRenderLayout->addDescriptorBinding(Gfx::DescriptorBinding{
.name = "projection", .name = "projection",
.uniformLength = sizeof(Matrix4), .uniformLength = sizeof(Matrix4),
.descriptorCount = 4,
}); });
cubeRenderLayout->addDescriptorBinding(Gfx::DescriptorBinding{ cubeRenderLayout->addDescriptorBinding(Gfx::DescriptorBinding{
.name = "equirectangularMap", .name = "equirectangularMap",
+2 -2
View File
@@ -159,8 +159,8 @@ static constexpr bool useAsyncCompute = false;
static constexpr bool useMeshShading = true; static constexpr bool useMeshShading = true;
static constexpr uint32 numFramesBuffered = 3; static constexpr uint32 numFramesBuffered = 3;
static constexpr uint32 numVerticesPerMeshlet = 256; static constexpr uint32 numVerticesPerMeshlet = 128;
static constexpr uint32 numPrimitivesPerMeshlet = 256; static constexpr uint32 numPrimitivesPerMeshlet = 128;
static constexpr uint32 numMeshletsPerTask = 256; static constexpr uint32 numMeshletsPerTask = 256;
double getCurrentFrameDelta(); double getCurrentFrameDelta();
double getCurrentFrameTime(); double getCurrentFrameTime();
@@ -195,6 +195,20 @@ PGraphicsPipeline PipelineCache::createPipeline(Gfx::MeshPipelineCreateInfo crea
desc->setBlendingEnabled(false); desc->setBlendingEnabled(false);
pipelineDescriptor->colorAttachments()->setObject(desc, c); 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) { if (createInfo.renderPass->getLayout().depthAttachment.getTexture() != nullptr) {
pipelineDescriptor->setDepthAttachmentPixelFormat( pipelineDescriptor->setDepthAttachmentPixelFormat(
cast(createInfo.renderPass->getLayout().depthAttachment.getTexture().cast<Texture2D>()->getFormat())); 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]->meshFunction = meshFunction;
graphicsPipelines[hash]->fragmentSets = fragmentSets; graphicsPipelines[hash]->fragmentSets = fragmentSets;
graphicsPipelines[hash]->fragmentFunction = fragmentFunction; graphicsPipelines[hash]->fragmentFunction = fragmentFunction;
graphicsPipelines[hash]->depth = depthState;
return graphicsPipelines[hash]; return graphicsPipelines[hash];
} }
+1 -1
View File
@@ -35,7 +35,7 @@ Event::Event(PGraphics graphics) : handle(graphics->getDevice()->newEvent()) {}
Event::~Event() { handle->release(); } 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(); MTL::SamplerDescriptor* desc = MTL::SamplerDescriptor::alloc()->init();
desc->setBorderColor(cast(createInfo.borderColor)); desc->setBorderColor(cast(createInfo.borderColor));
desc->setCompareFunction(cast(createInfo.compareOp)); desc->setCompareFunction(cast(createInfo.compareOp));
+4
View File
@@ -43,6 +43,7 @@ class TextureBase {
uint32 getWidth() const { return handle->width; } uint32 getWidth() const { return handle->width; }
uint32 getHeight() const { return handle->height; } uint32 getHeight() const { return handle->height; }
uint32 getDepth() const { return handle->depth; } uint32 getDepth() const { return handle->depth; }
uint32 getNumLayers() const { return handle->arrayCount; }
PTextureHandle getHandle() const { return handle; } PTextureHandle getHandle() const { return handle; }
MTL::Texture* getImage() const { return handle->texture; }; MTL::Texture* getImage() const { return handle->texture; };
constexpr Gfx::SeImageLayout getLayout() const { return handle->layout; } 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 getWidth() const override { return handle->width; }
virtual uint32 getHeight() const override { return handle->height; } virtual uint32 getHeight() const override { return handle->height; }
virtual uint32 getDepth() const override { return handle->depth; } 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::SeFormat getFormat() const override { return handle->format; }
virtual Gfx::SeSampleCountFlags getNumSamples() const override { return handle->samples; } virtual Gfx::SeSampleCountFlags getNumSamples() const override { return handle->samples; }
virtual uint32 getMipLevels() const override { return handle->mipLevels; } 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 getWidth() const override { return handle->width; }
virtual uint32 getHeight() const override { return handle->height; } virtual uint32 getHeight() const override { return handle->height; }
virtual uint32 getDepth() const override { return handle->depth; } 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::SeFormat getFormat() const override { return handle->format; }
virtual Gfx::SeSampleCountFlags getNumSamples() const override { return handle->samples; } virtual Gfx::SeSampleCountFlags getNumSamples() const override { return handle->samples; }
virtual uint32 getMipLevels() const override { return handle->mipLevels; } 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 getWidth() const override { return handle->width; }
virtual uint32 getHeight() const override { return handle->height; } virtual uint32 getHeight() const override { return handle->height; }
virtual uint32 getDepth() const override { return handle->depth; } 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::SeFormat getFormat() const override { return handle->format; }
virtual Gfx::SeSampleCountFlags getNumSamples() const override { return handle->samples; } virtual Gfx::SeSampleCountFlags getNumSamples() const override { return handle->samples; }
virtual uint32 getMipLevels() const override { return handle->mipLevels; } virtual uint32 getMipLevels() const override { return handle->mipLevels; }
@@ -3,7 +3,7 @@
using namespace Seele; using namespace Seele;
ToneMappingPass::ToneMappingPass(Gfx::PGraphics graphics) : RenderPass(graphics) { ToneMappingPass::ToneMappingPass(Gfx::PGraphics graphics) : RenderPass(graphics) {
tonemappingLayout = graphics->createDescriptorLayout("ToneMappingDescriptor"); tonemappingLayout = graphics->createDescriptorLayout("pToneMappingParams");
tonemappingLayout->addDescriptorBinding(Gfx::DescriptorBinding{ tonemappingLayout->addDescriptorBinding(Gfx::DescriptorBinding{
.name = "offset", .name = "offset",
.uniformLength = sizeof(Vector4), .uniformLength = sizeof(Vector4),
+1 -1
View File
@@ -124,7 +124,7 @@ void ShaderCompiler::createShaders(ShaderPermutation permutation, Gfx::OPipeline
{ {
createInfo.dumpIntermediate = true; createInfo.dumpIntermediate = true;
} }
createInfo.typeParameter.add({Pair<const char*, const char*>("IVertexData", permutation.vertexDataName)}); //createInfo.typeParameter.add({Pair<const char*, const char*>("IVertexData", permutation.vertexDataName)});
createInfo.modules.add(permutation.vertexDataName); createInfo.modules.add(permutation.vertexDataName);
//createInfo.dumpIntermediate = true; //createInfo.dumpIntermediate = true;