• babelchips

    Thanks, I'll take a look. Does it work with Vulkan then?

    posted in Kode read more
  • babelchips

    I’m trying to work out how to get buffer data back out of a compute shader once it has been run.

    I think i’m doing the basics right. I’m using Kha’s Shader Storage Buffer Object (SSBO) to modify some data in the compute shader, then after the compute call has completed I’m wondering how to access the changed value(s)…

    	ssbo = new ShaderStorageBuffer(100,VertexData.Float1);
    	Compute.setShader(Shaders.test_comp);
    	Compute.setBuffer(ssbo,0);
    	Compute.compute(1,1,1);
    

    and the computer shader:

    
    layout(binding=0) buffer Pos{
        float Position[];
    };
    
    layout (local_size_x = 1, local_size_y = 1) in;
    
    void main() {
        Position[0] = 42.0;
    }
    

    Debugging the buffer in Xcode's frame capture show's the value 42.0 has been set. I then tried locking the SSBO to get a reference to the array but the value seems to be unchanged.

    I believe in OpenGL there’d be something like glMapBuffer or glBufferData/subBufferData to get the data back out, but looking at the Kha API (and the underlying code) it doesn’t seem to use those functions for retrieval. The API for SSBOs supports lock and unlock but I assume that is only for putting the data onto the GPU?

    Also, i’m working on a Mac so we’re really talking about Metal (graphics4 on top of graphics5) so those OpenGL calls wouldn't apply everywhere anyway, a whole other implementation of course…

    I know I could write a results to a texture but i’m actually interested in modifying data buffers or using them like OpenGL’s Transform Feedback or generally poking around...

    So the question is, how should I deal with SSBOs in the CPU side? How do I read data back out after the Compute Shader has manipulated it?

    Also, I know the term SSBO is not really applicable when it comes to Metal, but for Kha’s purposes the name is used for consistency across implementations. Ideally what i’d like to be able to do is use an SSBO as a VertexBuffer in a subsequent render call - so what would be the correct (most efficient) way of dealing with the two buffer types interchangeably?

    Any help is greatly appreciated.

    posted in Kode read more
  • babelchips

    I see you have dispatched the villain. Good work. Thank you!

    Any idea where the rogue character came from - is there an origin story?....

    posted in Kode read more
  • babelchips

    I'm trying to run the OSX build of the ComputeShader sample using the latest version of Kha/Kore

    It is failing in /usr/local/lib/Kha/Kore/Backends/Graphics5/Metal/Sources/Kore/ComputeImpl.mm

    Line 86: _function = [library newFunctionWithName:[NSString stringWithCString:name encoding:NSUTF8StringEncoding]];

    It is returning nil

    Debugging shows the problem is the name of string being passed into the function, it contains a rogue character at the start: >test_comp_main (note the '>' symbol). If I hardcode the name without the symbol the sample project runs fine.

    Can someone please confirm if this is reproducible or if there's something I'm missing?

    posted in Kode read more
  • babelchips

    Sorry I wasn't very clear. I guess what I'm asking is can I use g5 (Metal/Vulkan features) when targeting Krom?

    I'd like to know more about Krom. For example was it designed solely as a target to aid with Kha development workflows - patching code at runtime?

    posted in Kode read more
  • babelchips

    Thanks for your reply, Robert. I'm looking forward to the fix.

    Judging by the info in your Krom repo it seems like I can treat Krom as a native build target with the added benefit of live reloading. If that's the case it will make a huge difference to my productivity. I think anything that can remove the long and repeated delays during development is invaluable.

    posted in Kode read more
  • babelchips

    I'm starting a new project and using Kode and Kha for the first time. I've created an empty project (Init Kha Project), built it for iOS and launched the resulting Xcode project. Building and running the app in Xcode on a device seems to work fine (black screen).

    So of course my next step is to add some code and do another build from Kode. But this seems to modify the existing Xcode project. Is this the expected behaviour?

    Also, what is the best build cycle to adopt to reduce build times? What is the hot reload story for Kode and Kha?

    posted in Kode read more

Looks like your connection to Kode Forum was lost, please wait while we try to reconnect.