metal-cpp

RSS for tag

C++ games and apps can tap into the power of Metal by bridging with metal-cpp.

Posts under metal-cpp tag

71 Posts

Post

Replies

Boosts

Views

Activity

NS::Array of MTL::Device objects question
Hi all. I'm trying to get C++ code working with Metal. I get the array of MTL:Device by calling NS::Array *device_array = MTL::CopyAllDevices(); Next, I want to get the only element of the MTL::Device array by calling MTL::Device *device = device_array->object(0); I get an error: Cannot initialize a variable of type 'MTL::Device *' with an rvalue of type 'NS::Object *' Question: how to get an MTL::Device object from NS::Array?
1
0
1k
Nov ’22
Why use dispatch_semaphore to explicitly synchronize MTLbuffer updates?
Hi. I'm new to Metal(actually any type of software development run on apple products). I have many questions about using MTL::Buffer and dispatch_semaphore, and drawInMTKView(). I read README.md, but I need some more help understanding it. Full code of 03-animation in metal-cpp sample This is sample code in metal-cpp sample code by apple(I downloaded here). In this code, _pFrameData is an array of MTLBuffer, and kMaxFramesInFlight is the size of this array. Its type is static const int, and the value is 3. When Renderer is created, _pFrameData are initialized like that. void Renderer::buildFrameData() {     for ( int i = 0; i < Renderer::kMaxFramesInFlight; ++i )     {         _pFrameData[ i ]= _pDevice->newBuffer( sizeof( FrameData ), MTL::ResourceStorageModeManaged );     } } draw method, call by drawInMTKView. void Renderer::draw( MTK::View* pView ) {     NS::AutoreleasePool* pPool = NS::AutoreleasePool::alloc()->init();     _frame = (_frame + 1) % Renderer::kMaxFramesInFlight; MTL::Buffer* pFrameDataBuffer = _pFrameData[ _frame ];     MTL::CommandBuffer* pCmd = _pCommandQueue->commandBuffer();     dispatch_semaphore_wait( _semaphore, DISPATCH_TIME_FOREVER );     Renderer* pRenderer = this;     pCmd->addCompletedHandler( ^void( MTL::CommandBuffer* pCmd ){         dispatch_semaphore_signal( pRenderer->_semaphore );     });     reinterpret_cast< FrameData * >( pFrameDataBuffer->contents() )->angle = (_angle += 0.01f);     pFrameDataBuffer->didModifyRange( NS::Range::Make( 0, sizeof( FrameData ) ) );     MTL::RenderPassDescriptor* pRpd = pView->currentRenderPassDescriptor();     MTL::RenderCommandEncoder* pEnc = pCmd->renderCommandEncoder( pRpd );     pEnc->setRenderPipelineState( _pPSO );     pEnc->setVertexBuffer( _pArgBuffer, 0, 0 );     pEnc->useResource( _pVertexPositionsBuffer, MTL::ResourceUsageRead );     pEnc->useResource( _pVertexColorsBuffer, MTL::ResourceUsageRead );     pEnc->setVertexBuffer( pFrameDataBuffer, 0, 1 );     pEnc->drawPrimitives( MTL::PrimitiveType::PrimitiveTypeTriangle, NS::UInteger(0), NS::UInteger(3) );     pEnc->endEncoding();     pCmd->presentDrawable( pView->currentDrawable() );     pCmd->commit();     pPool->release(); } Q1. what is the meaning of kMaxFramesInFlight's name and value? Q2. how are dispatch_semaphore_wait() and drawInMTKView() working? At first, I guess if the count of dispatch_semaphore change 0, the Renderer::draw are blocked by dispatch_semaphore_wait() until GPU read the buffer and execute dispatch_semaphore_signal. But now I think it's not a correct understanding because I don't know about drawInMTKView. How much drawInMTKView is called in 1 second and when? Q3. and.... why use dispatch_semaphore for here? I try to change my code to use a single MTLBuffer for the same work. Just changing some code(add a single buffer, remove code for dispatch_semaphore), the changed code works same.
1
0
1.2k
Oct ’22
Metal-cpp link errors
Not quite understanding these. As far as I can tell the Foundation, QuartzCore and Metal frameworks are included in the link line: -framework Metal -framework QuartzCore -framework Foundation Technically they are in there a few times. Not familiar enough with our project to know why. Getting a ton of undefined symbols. Metal-cpp is a header only library and so doesn't have any additional libraries of it's own right? Undefined symbols for architecture arm64: "MTL::Private::Selector::s_knewTextureViewWithPixelFormat_textureType_levels_slices_swizzle_", referenced from: "MTL::Private::Selector::s_knewTextureWithDescriptor_", referenced from: "NS::Private::Selector::s_kinit", referenced from: "NS::Private::Selector::s_kautorelease", referenced from: This is while compiling for iOS (thus the arm64).
3
0
3.4k
Oct ’22
GPU trace metal Unable to create shader debug session on MacBook Pro (16-inch, 2021) M1 max
When trying to debug my compute shaders by pressing the ladyBird button inside of GPU trace, the error "Unable to create shader debug session" occurs. This only happens on my M1 MAX mbp, the exact same project does not have this error on my old intel mbp. I have tried reinstalling the past 3 generations of Xcode yet I cannot fix this error. It is making it impossible for me to develop my program as there is no information online about how to fix this error.
2
1
1.2k
Sep ’22
Metal-cpp iOS examples/frame capture
I'm at the point where I seem to be running a very simple render loop (inside of a very complex project) and having fun trying to figure out what isn't actually functioning. It seems like the documentation online might be slightly out of date as when I try to look for a way to do a frame capture I am only presented with "Capture GPU Workload" and a little "M" icon instead of the documented "Capture GPU Frame" and a "camera" icon. My assumption is it was just renamed as it could potentially include other GPU work not directly related to rendering. I've changed my project settings to explicitly capture Metal rather than Automatic, but that didn't really seem to change anything. I've verified the broad strokes of my rendering which roughly matches the Mac example of drawing a simple triangle. The only significant difference is that I immediately reclaim the MTL::CommandBuffer with an autoRelease after the commit. Does that seem fine? When I capture I am told that: "No GPU commands have been captured. At least one command buffer must be created and committed within the boundaries of a GPU Capture." Not sure if there is some sort of implicit frame tracking that I am somehow violating. In terms of the rough order of things being done for the rendering: renderCommandEncoder() setRenderPipelineState() drawIndexedPrimitives() endEncoding() presentDrawable() commit() Oops, almost forgot to mention the reason for my title which is that metal-cpp only seems to come with Mac examples. Are there any iOS examples for metal-cpp?
2
0
2.1k
Aug ’22
NSBundle Redeclaration Error for Multiple Functions In Metal CPP
Hi I am trying to get started using Metal CPP after viewing the documentation and defining the constants below: #ifndef MTL_PRIVATE_IMPLEMENTATION #define NS_PRIVATE_IMPLEMENTATION #define MTL_PRIVATE_IMPLEMENTATION //#define MTK_PRIVATE_IMPLEMENTATION #define CA_PRIVATE_IMPLEMENTATION #endif I commented out the MTK macro since it was not in the getting started video although it was in the fundamentals projects for metal cpp. I am defining this in a Objective C++ header along with including: #import <Foundation/Foundation.hpp> #import <Metal/Metal.hpp> #import <QuartzCore/QuartzCore.hpp> #import <MetalKit/MetalKit.h> #import <simd/simd.h> I get the error: redeclaration of 'NSPOSIXErrorDomain' with a different type: 'const NSErrorDomain  _Nonnull __strong' (aka 'NSString *const __strong') vs 'const NS::ErrorDomain' (aka 'NS::String *const') along with other errors similar to that one. These errors all seem to do with <Foundation/Foundation.h>. I can see that the NS prefix is being declared rather than the C++ version of NS:: but I am sure I implemented this correctly. I have a header set up in Objective C for this file along with things being @implementation rather than pure C++: #pragma once #include "../../../src/state/config.h" #ifdef __PEN_IOS__ //#import <cassert> #ifndef MTL_PRIVATE_IMPLEMENTATION #define NS_PRIVATE_IMPLEMENTATION #define MTL_PRIVATE_IMPLEMENTATION //#define MTK_PRIVATE_IMPLEMENTATION #define CA_PRIVATE_IMPLEMENTATION #endif #ifdef TARGET_IPHONE_SIMULATOR //#import <UIKit/UIKit.h> #elifdef TARGET_OS_IPHONE //#import <UIKit/UIKit.hpp> #elifdef TARGET_OS_IOS //#import <UIKit/UIKit.hpp> #elifdef TARGET_OS_MAC //#import <AppKit/AppKit.hpp> #endif #import <Foundation/Foundation.hpp> #import <Metal/Metal.hpp> //#import <CoreFoundation/CoreFoundation.h> #import <QuartzCore/QuartzCore.hpp> #import <MetalKit/MetalKit.h> #import <simd/simd.h> #import "ios_cpp_objective_c_mapping.h" @class IOSState; @interface IOSState : NSObject @property MTK::View* iosMtkView;     @property MTL::Device* iosDevice;     @property MTL::CommandQueue* iosCommandQueue;     @property MTL::RenderPipelineState* iosPipelineState;     @property NS::Notification* iosLaunchNotification;     @property MTL::ArgumentEncoder* iosArgEncoder;     @property MTL::DepthStencilState* iosDepthStencilState;     @property MTL::Texture* iosPixelBuffer;     @property MTL::Buffer* iosUniformBuffer;     @property MTL::Buffer* iosInstanceBuffer;     @property MTL::RenderCommandEncoder* iosCommandEncoder;     @property MTL::CommandBuffer* iosCommandBuffer;     @property NS::AutoreleasePool* iosAutoReleasePool;     @property dispatch_semaphore_t dispatchSemaphore; + (IOSState*) Get; + (void) Destroy; @end #endif I include this file in multiple places although the headers should be able to be included more than once.
3
0
1.3k
Aug ’22
MetalKit's drawInMTKView function not called if app is built using cmake/make?
I ran into a strange issue testing Metal cpp. The following project is almost the same as Apple's official Metal Cpp example project (https://developer.apple.com/videos/play/wwdc2022/10160/). https://github.com/shi-yan/testmetal The apple official example contains an Xcode project, whereas my modified version tries to use cmake. My cmake project builds and runs, but the window is empty. I debugged it, the root cause is that the drawInMTKView function never gets called. If I generate an Xcode project using cmake, then build and run my code in Xcode, the resulting app can render to its window just fine. However, if I run the same app binary through the terminal, it will show an empty window again. Any idea what might cause this? Thanks.
1
0
1k
Aug ’22
Offline ability to understand texture alignment requirements?
We are trying to develop an offline tool for creating sets of textures on the Mac for iOS, but mirroring our existing stuff for other platforms. One thing we ran into is that our current stuff stores the alignments as part of the texture set data, but it appears like there is not way to, say, ask Metal to give us the texture alignment on a given family of iOS GPU without actually running on that hardware. Does that seem like an accurate assessment? I feel like we will probably need to rejigger our stuff to instead query the alignment after we have created the MTLTextureDescriptor objects (currently it happens in the opposite order). Or maybe it's fairly straight-forward to just understand all of the alignment restrictions that we can expect on iOS to begin with? Since these are offline texture assets they will mostly just be a combination of 2D static textures, although there will probably be some cubemaps and 3D textures.
0
0
763
Jul ’22
NS::SharedPtr/TransferPtr/RetainPtr
I was watching the Metal-cpp video which mentions a C++ smart pointer wrapper to handle reference counting in Metal objects. I've been trying to write my own and the realization that this already existed made me want to try it, but it doesn't actually seem to exist. I can't remember if I installed the beta version or not. It wasn't immediately clear to me if I can identify which version of Metal-cpp I am using by looking inside the folders. Should this exist? On a somewhat related note I am having some issues trying to call retain on an MTL::TextureDescriptor object that was originally created with MTL::TextureDescriptor::alloc()->init(). This could just be my own bug, but I was wondering if I am misunderstanding how it works. In this case we have a mid level texture class that may want to recreate itself by altering the TextureDescriptor afterwards, but in some cases that texture was also created by a higher level texture class that also may want to do it's own version of the same thing and so it seemed prudent to just share the same TextureDescriptor object.
4
0
1.8k
Jul ’22
What happened with default.metallib not found!
Hello … i can not imagine what i do wrong … NSString *libPath = [[NSBundle mainBundle] pathForResource:@"./default" ofType:@"metallib"]; id<MTLLibrary> library = [device newLibraryWithFile:libPath error:&error]; Same dir like the binary default.metallib prog To run wit options like prog —option My prog say always if i run lib not found … Hard&Software : Xcode 13.4.1 (13F100) mbp M1 max
0
0
1.3k
Jul ’22
ICB Support for Object/Mesh Shaders
Hello! I am starting to dig into the docs on object and mesh shaders. I see that the Metal API on the CPU side has new functions for setting object and mesh buffers in the new programable stage. But I don't see corresponding changes to the API for MTLIndirectCommandBuffer. Will we be able to use the GPU to encode draw commands using a pipeline that leverages the new shader types? Thanks,
0
0
1.2k
Jun ’22
NS::Array of MTL::Device objects question
Hi all. I'm trying to get C++ code working with Metal. I get the array of MTL:Device by calling NS::Array *device_array = MTL::CopyAllDevices(); Next, I want to get the only element of the MTL::Device array by calling MTL::Device *device = device_array->object(0); I get an error: Cannot initialize a variable of type 'MTL::Device *' with an rvalue of type 'NS::Object *' Question: how to get an MTL::Device object from NS::Array?
Replies
1
Boosts
0
Views
1k
Activity
Nov ’22
Why use dispatch_semaphore to explicitly synchronize MTLbuffer updates?
Hi. I'm new to Metal(actually any type of software development run on apple products). I have many questions about using MTL::Buffer and dispatch_semaphore, and drawInMTKView(). I read README.md, but I need some more help understanding it. Full code of 03-animation in metal-cpp sample This is sample code in metal-cpp sample code by apple(I downloaded here). In this code, _pFrameData is an array of MTLBuffer, and kMaxFramesInFlight is the size of this array. Its type is static const int, and the value is 3. When Renderer is created, _pFrameData are initialized like that. void Renderer::buildFrameData() {     for ( int i = 0; i < Renderer::kMaxFramesInFlight; ++i )     {         _pFrameData[ i ]= _pDevice->newBuffer( sizeof( FrameData ), MTL::ResourceStorageModeManaged );     } } draw method, call by drawInMTKView. void Renderer::draw( MTK::View* pView ) {     NS::AutoreleasePool* pPool = NS::AutoreleasePool::alloc()->init();     _frame = (_frame + 1) % Renderer::kMaxFramesInFlight; MTL::Buffer* pFrameDataBuffer = _pFrameData[ _frame ];     MTL::CommandBuffer* pCmd = _pCommandQueue->commandBuffer();     dispatch_semaphore_wait( _semaphore, DISPATCH_TIME_FOREVER );     Renderer* pRenderer = this;     pCmd->addCompletedHandler( ^void( MTL::CommandBuffer* pCmd ){         dispatch_semaphore_signal( pRenderer->_semaphore );     });     reinterpret_cast< FrameData * >( pFrameDataBuffer->contents() )->angle = (_angle += 0.01f);     pFrameDataBuffer->didModifyRange( NS::Range::Make( 0, sizeof( FrameData ) ) );     MTL::RenderPassDescriptor* pRpd = pView->currentRenderPassDescriptor();     MTL::RenderCommandEncoder* pEnc = pCmd->renderCommandEncoder( pRpd );     pEnc->setRenderPipelineState( _pPSO );     pEnc->setVertexBuffer( _pArgBuffer, 0, 0 );     pEnc->useResource( _pVertexPositionsBuffer, MTL::ResourceUsageRead );     pEnc->useResource( _pVertexColorsBuffer, MTL::ResourceUsageRead );     pEnc->setVertexBuffer( pFrameDataBuffer, 0, 1 );     pEnc->drawPrimitives( MTL::PrimitiveType::PrimitiveTypeTriangle, NS::UInteger(0), NS::UInteger(3) );     pEnc->endEncoding();     pCmd->presentDrawable( pView->currentDrawable() );     pCmd->commit();     pPool->release(); } Q1. what is the meaning of kMaxFramesInFlight's name and value? Q2. how are dispatch_semaphore_wait() and drawInMTKView() working? At first, I guess if the count of dispatch_semaphore change 0, the Renderer::draw are blocked by dispatch_semaphore_wait() until GPU read the buffer and execute dispatch_semaphore_signal. But now I think it's not a correct understanding because I don't know about drawInMTKView. How much drawInMTKView is called in 1 second and when? Q3. and.... why use dispatch_semaphore for here? I try to change my code to use a single MTLBuffer for the same work. Just changing some code(add a single buffer, remove code for dispatch_semaphore), the changed code works same.
Replies
1
Boosts
0
Views
1.2k
Activity
Oct ’22
Metal-cpp link errors
Not quite understanding these. As far as I can tell the Foundation, QuartzCore and Metal frameworks are included in the link line: -framework Metal -framework QuartzCore -framework Foundation Technically they are in there a few times. Not familiar enough with our project to know why. Getting a ton of undefined symbols. Metal-cpp is a header only library and so doesn't have any additional libraries of it's own right? Undefined symbols for architecture arm64: "MTL::Private::Selector::s_knewTextureViewWithPixelFormat_textureType_levels_slices_swizzle_", referenced from: "MTL::Private::Selector::s_knewTextureWithDescriptor_", referenced from: "NS::Private::Selector::s_kinit", referenced from: "NS::Private::Selector::s_kautorelease", referenced from: This is while compiling for iOS (thus the arm64).
Replies
3
Boosts
0
Views
3.4k
Activity
Oct ’22
GPU trace metal Unable to create shader debug session on MacBook Pro (16-inch, 2021) M1 max
When trying to debug my compute shaders by pressing the ladyBird button inside of GPU trace, the error "Unable to create shader debug session" occurs. This only happens on my M1 MAX mbp, the exact same project does not have this error on my old intel mbp. I have tried reinstalling the past 3 generations of Xcode yet I cannot fix this error. It is making it impossible for me to develop my program as there is no information online about how to fix this error.
Replies
2
Boosts
1
Views
1.2k
Activity
Sep ’22
Metal-cpp iOS examples/frame capture
I'm at the point where I seem to be running a very simple render loop (inside of a very complex project) and having fun trying to figure out what isn't actually functioning. It seems like the documentation online might be slightly out of date as when I try to look for a way to do a frame capture I am only presented with "Capture GPU Workload" and a little "M" icon instead of the documented "Capture GPU Frame" and a "camera" icon. My assumption is it was just renamed as it could potentially include other GPU work not directly related to rendering. I've changed my project settings to explicitly capture Metal rather than Automatic, but that didn't really seem to change anything. I've verified the broad strokes of my rendering which roughly matches the Mac example of drawing a simple triangle. The only significant difference is that I immediately reclaim the MTL::CommandBuffer with an autoRelease after the commit. Does that seem fine? When I capture I am told that: "No GPU commands have been captured. At least one command buffer must be created and committed within the boundaries of a GPU Capture." Not sure if there is some sort of implicit frame tracking that I am somehow violating. In terms of the rough order of things being done for the rendering: renderCommandEncoder() setRenderPipelineState() drawIndexedPrimitives() endEncoding() presentDrawable() commit() Oops, almost forgot to mention the reason for my title which is that metal-cpp only seems to come with Mac examples. Are there any iOS examples for metal-cpp?
Replies
2
Boosts
0
Views
2.1k
Activity
Aug ’22
NSBundle Redeclaration Error for Multiple Functions In Metal CPP
Hi I am trying to get started using Metal CPP after viewing the documentation and defining the constants below: #ifndef MTL_PRIVATE_IMPLEMENTATION #define NS_PRIVATE_IMPLEMENTATION #define MTL_PRIVATE_IMPLEMENTATION //#define MTK_PRIVATE_IMPLEMENTATION #define CA_PRIVATE_IMPLEMENTATION #endif I commented out the MTK macro since it was not in the getting started video although it was in the fundamentals projects for metal cpp. I am defining this in a Objective C++ header along with including: #import <Foundation/Foundation.hpp> #import <Metal/Metal.hpp> #import <QuartzCore/QuartzCore.hpp> #import <MetalKit/MetalKit.h> #import <simd/simd.h> I get the error: redeclaration of 'NSPOSIXErrorDomain' with a different type: 'const NSErrorDomain  _Nonnull __strong' (aka 'NSString *const __strong') vs 'const NS::ErrorDomain' (aka 'NS::String *const') along with other errors similar to that one. These errors all seem to do with <Foundation/Foundation.h>. I can see that the NS prefix is being declared rather than the C++ version of NS:: but I am sure I implemented this correctly. I have a header set up in Objective C for this file along with things being @implementation rather than pure C++: #pragma once #include "../../../src/state/config.h" #ifdef __PEN_IOS__ //#import <cassert> #ifndef MTL_PRIVATE_IMPLEMENTATION #define NS_PRIVATE_IMPLEMENTATION #define MTL_PRIVATE_IMPLEMENTATION //#define MTK_PRIVATE_IMPLEMENTATION #define CA_PRIVATE_IMPLEMENTATION #endif #ifdef TARGET_IPHONE_SIMULATOR //#import <UIKit/UIKit.h> #elifdef TARGET_OS_IPHONE //#import <UIKit/UIKit.hpp> #elifdef TARGET_OS_IOS //#import <UIKit/UIKit.hpp> #elifdef TARGET_OS_MAC //#import <AppKit/AppKit.hpp> #endif #import <Foundation/Foundation.hpp> #import <Metal/Metal.hpp> //#import <CoreFoundation/CoreFoundation.h> #import <QuartzCore/QuartzCore.hpp> #import <MetalKit/MetalKit.h> #import <simd/simd.h> #import "ios_cpp_objective_c_mapping.h" @class IOSState; @interface IOSState : NSObject @property MTK::View* iosMtkView;     @property MTL::Device* iosDevice;     @property MTL::CommandQueue* iosCommandQueue;     @property MTL::RenderPipelineState* iosPipelineState;     @property NS::Notification* iosLaunchNotification;     @property MTL::ArgumentEncoder* iosArgEncoder;     @property MTL::DepthStencilState* iosDepthStencilState;     @property MTL::Texture* iosPixelBuffer;     @property MTL::Buffer* iosUniformBuffer;     @property MTL::Buffer* iosInstanceBuffer;     @property MTL::RenderCommandEncoder* iosCommandEncoder;     @property MTL::CommandBuffer* iosCommandBuffer;     @property NS::AutoreleasePool* iosAutoReleasePool;     @property dispatch_semaphore_t dispatchSemaphore; + (IOSState*) Get; + (void) Destroy; @end #endif I include this file in multiple places although the headers should be able to be included more than once.
Replies
3
Boosts
0
Views
1.3k
Activity
Aug ’22
MetalKit's drawInMTKView function not called if app is built using cmake/make?
I ran into a strange issue testing Metal cpp. The following project is almost the same as Apple's official Metal Cpp example project (https://developer.apple.com/videos/play/wwdc2022/10160/). https://github.com/shi-yan/testmetal The apple official example contains an Xcode project, whereas my modified version tries to use cmake. My cmake project builds and runs, but the window is empty. I debugged it, the root cause is that the drawInMTKView function never gets called. If I generate an Xcode project using cmake, then build and run my code in Xcode, the resulting app can render to its window just fine. However, if I run the same app binary through the terminal, it will show an empty window again. Any idea what might cause this? Thanks.
Replies
1
Boosts
0
Views
1k
Activity
Aug ’22
Offline ability to understand texture alignment requirements?
We are trying to develop an offline tool for creating sets of textures on the Mac for iOS, but mirroring our existing stuff for other platforms. One thing we ran into is that our current stuff stores the alignments as part of the texture set data, but it appears like there is not way to, say, ask Metal to give us the texture alignment on a given family of iOS GPU without actually running on that hardware. Does that seem like an accurate assessment? I feel like we will probably need to rejigger our stuff to instead query the alignment after we have created the MTLTextureDescriptor objects (currently it happens in the opposite order). Or maybe it's fairly straight-forward to just understand all of the alignment restrictions that we can expect on iOS to begin with? Since these are offline texture assets they will mostly just be a combination of 2D static textures, although there will probably be some cubemaps and 3D textures.
Replies
0
Boosts
0
Views
763
Activity
Jul ’22
NS::SharedPtr/TransferPtr/RetainPtr
I was watching the Metal-cpp video which mentions a C++ smart pointer wrapper to handle reference counting in Metal objects. I've been trying to write my own and the realization that this already existed made me want to try it, but it doesn't actually seem to exist. I can't remember if I installed the beta version or not. It wasn't immediately clear to me if I can identify which version of Metal-cpp I am using by looking inside the folders. Should this exist? On a somewhat related note I am having some issues trying to call retain on an MTL::TextureDescriptor object that was originally created with MTL::TextureDescriptor::alloc()->init(). This could just be my own bug, but I was wondering if I am misunderstanding how it works. In this case we have a mid level texture class that may want to recreate itself by altering the TextureDescriptor afterwards, but in some cases that texture was also created by a higher level texture class that also may want to do it's own version of the same thing and so it seemed prudent to just share the same TextureDescriptor object.
Replies
4
Boosts
0
Views
1.8k
Activity
Jul ’22
What happened with default.metallib not found!
Hello … i can not imagine what i do wrong … NSString *libPath = [[NSBundle mainBundle] pathForResource:@"./default" ofType:@"metallib"]; id<MTLLibrary> library = [device newLibraryWithFile:libPath error:&error]; Same dir like the binary default.metallib prog To run wit options like prog —option My prog say always if i run lib not found … Hard&Software : Xcode 13.4.1 (13F100) mbp M1 max
Replies
0
Boosts
0
Views
1.3k
Activity
Jul ’22
ICB Support for Object/Mesh Shaders
Hello! I am starting to dig into the docs on object and mesh shaders. I see that the Metal API on the CPU side has new functions for setting object and mesh buffers in the new programable stage. But I don't see corresponding changes to the API for MTLIndirectCommandBuffer. Will we be able to use the GPU to encode draw commands using a pipeline that leverages the new shader types? Thanks,
Replies
0
Boosts
0
Views
1.2k
Activity
Jun ’22