Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
0 answers
271 views

Why does Metal slow down when the number of fragment shader arguments increases?

I have a very basic fragment shader that accepts an array of array textures defined like so: fragment float4 shader(RasterizerData in [[ stage_in ]], sampler sampler2d [[ ...
kennyc's user avatar
  • 5,660
8 votes
1 answer
5k views

Passing a float or color into a Metal fragment shader from Swift

I'm trying to write a fragment shader in Metal but can't get my head around how to pass in single values (e.g. float, float4 or half4). My shaders are as follows: #include <metal_stdlib> using ...
Doug's user avatar
  • 3,170
2 votes
1 answer
792 views

How to pass a variable number of MTLTextures to a fragment shader?

What is the correct syntax for passing a variable number of MTLTexture's as an array to a fragment shader? This StackOverflow Question: "How to use texture2d_array array in metal?" mentions the use ...
kennyc's user avatar
  • 5,660
1 vote
0 answers
81 views

Metal fragment shader bound resource acting erratically on macOS

This problem has been stumping me, and I can't figure it out. I've got a few different shaders which use the same resource, a structure with a bunch of lighting values. The first shader to use it ...
bsabiston's user avatar
  • 741