fix some multisampling stuff

This commit is contained in:
Gregory Wells
2025-07-24 08:34:31 -04:00
parent 1d23dd0b80
commit 6c09d2806d
2 changed files with 3 additions and 4 deletions

View File

@@ -45,8 +45,7 @@ MTLCompareFunction mtlGrypnCompareOperation(gnCompareOperation operation) {
gnReturnCode createMetalGraphicsPipeline(gnGraphicsPipeline graphicsPipeline, gnOutputDevice device, gnGraphicsPipelineInfo info) { gnReturnCode createMetalGraphicsPipeline(gnGraphicsPipeline graphicsPipeline, gnOutputDevice device, gnGraphicsPipelineInfo info) {
graphicsPipeline->graphicsPipeline = malloc(sizeof(struct gnPlatformGraphicsPipeline_t)); graphicsPipeline->graphicsPipeline = malloc(sizeof(struct gnPlatformGraphicsPipeline_t));
MTLRenderPipelineDescriptor* descriptor = [[MTLRenderPipelineDescriptor alloc] init]; MTLRenderPipelineDescriptor* descriptor = [[MTLRenderPipelineDescriptor alloc] init];
// descriptor.rasterSampleCount = mtlSampleCount(info.multisample.samples); descriptor.rasterSampleCount = mtlSampleCount(info.multisample.samples);
descriptor.rasterSampleCount = 1;
descriptor.rasterizationEnabled = YES; descriptor.rasterizationEnabled = YES;
mtlSubpass subpass = info.renderPassDescriptor->renderPassDescriptor->subpasses[info.subpassIndex]; mtlSubpass subpass = info.renderPassDescriptor->renderPassDescriptor->subpasses[info.subpassIndex];
mtlSubpassCopyInfo copyInfo = info.renderPassDescriptor->renderPassDescriptor->copyInfos[info.subpassIndex]; mtlSubpassCopyInfo copyInfo = info.renderPassDescriptor->renderPassDescriptor->copyInfos[info.subpassIndex];

View File

@@ -10,7 +10,7 @@ NSUInteger mtlSampleCount(gnMultisampleCountFlags flags) {
if ((flags & GN_SAMPLE_BIT_4) == GN_SAMPLE_BIT_4) { return 4; } if ((flags & GN_SAMPLE_BIT_4) == GN_SAMPLE_BIT_4) { return 4; }
if ((flags & GN_SAMPLE_BIT_2) == GN_SAMPLE_BIT_2) { return 2; } if ((flags & GN_SAMPLE_BIT_2) == GN_SAMPLE_BIT_2) { return 2; }
if ((flags & GN_SAMPLE_BIT_1) == GN_SAMPLE_BIT_1) { return 1; } if ((flags & GN_SAMPLE_BIT_1) == GN_SAMPLE_BIT_1) { return 1; }
return 0; return 1;
} }
gnReturnCode createMetalTexture(gnTexture texture, gnDevice device, const gnTextureInfo info) { gnReturnCode createMetalTexture(gnTexture texture, gnDevice device, const gnTextureInfo info) {
@@ -24,7 +24,7 @@ gnReturnCode createMetalTexture(gnTexture texture, gnDevice device, const gnText
textureDescriptor.height = info.extent.height; textureDescriptor.height = info.extent.height;
textureDescriptor.pixelFormat = mtlGryphnFormatToMetalFormat(info.format); textureDescriptor.pixelFormat = mtlGryphnFormatToMetalFormat(info.format);
if (textureDescriptor.sampleCount >= 2) if (textureDescriptor.sampleCount > 1)
textureDescriptor.textureType = MTLTextureType2DMultisample; textureDescriptor.textureType = MTLTextureType2DMultisample;
else else
textureDescriptor.textureType = MTLTextureType2D; textureDescriptor.textureType = MTLTextureType2D;