Skip to content

Commit

Permalink
uniforms in render bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
gadirom committed Sep 19, 2022
1 parent b4d26ab commit 873ccb1
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,21 @@ public extension Render{
var r = self
r.uniforms.append(uniforms)
var argument = MetalBytesArgument(uniformsContainer: uniforms, name: name)
//Add to vertex shader
argument.index = checkVertexBufferIndex(r: &r, index: nil)
r.vertexArguments.append(.bytes(argument))
let vertexBytes = RawBytes(binding: uniforms.pointerBinding,
length: uniforms.length,
index: argument.index!)
r.vertexBytes.append(vertexBytes)
//add to fragment shader
argument.index = checkFragmentBufferIndex(r: &r, index: nil)
r.fragmentArguments.append(.bytes(argument))
let bytes = RawBytes(binding: uniforms.pointerBinding,
let fragBytes = RawBytes(binding: uniforms.pointerBinding,
length: uniforms.length,
index: argument.index!)
r.fragBytes.append(bytes)
r.vertexBytes.append(bytes)
r.fragBytes.append(fragBytes)

return r
}
func vertexTexture(_ container: MTLTextureContainer, index: Int)->Render{
Expand Down

0 comments on commit 873ccb1

Please sign in to comment.