GithubHelp home page GithubHelp logo

ayoubkhammassi / customcomputeshaders Goto Github PK

View Code? Open in Web Editor NEW
155.0 155.0 39.0 521 KB

The minimal source code for adding and using a custom compute shader in Unreal Engine 4

License: MIT License

C# 14.00% C++ 85.34% C 0.65%

customcomputeshaders's People

Contributors

ayoubkhammassi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

customcomputeshaders's Issues

RDG and a structured buffer with an array of custom structs

This is not an issue :-)

I'm trying to learn more about RDG in Unreal and HLSL, so far so good, with one exception: I'm trying to pass an array of a custom struct from C++ to HLSL via a structured buffer, and I currently don't know how to tell the C++ buffer: hey, this is your data so you can pass it to the GPU.

it is possible that I don't fully comprehend the role and scope of a structured buffer...

In C++ my shader has
SHADER_PARAMETER_RDG_BUFFER_UAV(RWStructuredBuffer<FMyStuff>, MyStuffBuffer)
Then at some point I create it
FRDGBufferRef MyStuffBuffer = GraphBuilder.CreateBuffer(MyStuffBufferDesc, TEXT("MyStuffBuffer"));
here I was expecting to be able to do something like
MyStuffBuffer.SetData(some TArray<FMyStuff>)
then I assign it to the parameters
PassParameters.MyStuffBuffer = GraphBuilder.CreateUAV(MyStuffBuffer);
And then I pass everything to the GPU via
FComputeShaderUtils::AddPass

I was hoping there is a way, after I create the RDG buffer in C++, to set its data/payload as some TArray<FMyStuff> that I previously created and populated in C++

I poked around the source code, but to no avail, this specific aspect of RDG still eludes me ๐Ÿ˜„
do you happen to have any idea, by any chance? Thanks!

4.26: Error: illegal indirection; Solution: Remove deference

FComputeShaderUtils::Dispatch(RHICmdList, *whiteNoiseCS, PassParameters,

Removing * from *whiteNoiseCS solved the issue for me.

4.26 has a signature for FComputeShaderUtils::Dispatch that doesn't require a deference:

static void Dispatch(FRHIComputeCommandList& RHICmdList, const TShaderRef<TShaderClass>& ComputeShader,

Disclaimer: I'm using a custom 4.26 build. Haven't checked the official build.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.