Posts

Post not yet marked as solved
3 Replies
I have come accross the exact problem you are describing. If I remap A to B, and nothing else. So pressing A sets "extendedGamepad.buttonB.pressed" to 1.0 I can detect when the B button is pressed. But the B button retuns the icon for the B button. I need to show the user the A button icon. We wrote a function that takes in the sfSymbolsName and tries to reverse engineer the button that symbol will normally correspond to. This usually works, as long as all the buttons are mapped. However because (in my example) button A has no mapping to activate it our function fails. But this seems the only way to work out the button mappings.
Post marked as solved
3 Replies
Hello.We have a similar setup as you describe for our shaders.I got the reflection thing working by setting up dummy vertex attributes (see lines 7 to 12).I am able to read all the uniforms, structures and offsets with this code. { MTLRenderPipelineReflection* reflection; // Make fake descriptor MTLVertexDescriptor *vd = [MTLVertexDescriptor new]; for ( int i = 0; i < 10; ++i ) { vd.attributes[i].format = MTLVertexFormatFloat; vd.attributes[i].bufferIndex = 0; vd.attributes[i].offset = i*4; } vd.layouts[0].stride = (int)10*4; vd.layouts[0].stepFunction = MTLVertexStepFunctionPerVertex; // Create pipeline to get refelction info MTLRenderPipelineDescriptor *descriptor = [MTLRenderPipelineDescriptor new]; descriptor.vertexDescriptor = vd; descriptor.vertexFunction = functionVertex; descriptor.fragmentFunction = functionFragment; descriptor.colorAttachments[0].pixelFormat = MTLPixelFormatRGBA8Unorm; // Create a pipeline, only interested in the reflection information id renderPS = [r->getMetalDevice() newRenderPipelineStateWithDescriptor:descriptor options:MTLPipelineOptionArgumentInfo|MTLPipelineOptionBufferTypeInfo reflection:&reflection error:&error]; if ( error != nil ) { zDbgLogInternal("ERROR: Shader Reflection on [" + getName() + "]" ); NSLog(@"ERROR: %@", [error localizedDescription] ); return; } for (MTLArgument *arg in reflection.vertexArguments) { processUniform(arg,0); } for (MTLArgument *arg in reflection.fragmentArguments) { processUniform(arg,1); } }