-
Notifications
You must be signed in to change notification settings - Fork 575
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MSL: Use unpacked arguments in texture arguments.
If sourcing arguments directly from std140 UBO arrays or something, we generated broken code.
- Loading branch information
1 parent
42c2136
commit 56d0aa4
Showing
3 changed files
with
52 additions
and
15 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
reference/shaders-msl-no-opt/frag/explicit-lod-unpack-arguments.frag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include <metal_stdlib> | ||
#include <simd/simd.h> | ||
|
||
using namespace metal; | ||
|
||
struct MaterialParams | ||
{ | ||
float4 myLod[6]; | ||
}; | ||
|
||
struct main0_out | ||
{ | ||
float4 fragColor [[color(0)]]; | ||
}; | ||
|
||
fragment main0_out main0(constant MaterialParams& materialParams [[buffer(0)]], texture2d<float> mySampler [[texture(0)]], sampler mySamplerSmplr [[sampler(0)]]) | ||
{ | ||
main0_out out = {}; | ||
out.fragColor = mySampler.sample(mySamplerSmplr, float2(0.0), level(materialParams.myLod[0].x)); | ||
return out; | ||
} | ||
|
15 changes: 15 additions & 0 deletions
15
shaders-msl-no-opt/frag/explicit-lod-unpack-arguments.frag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#version 310 es | ||
|
||
precision mediump float; | ||
|
||
layout(set = 2, binding = 0, std140) uniform MaterialParams { | ||
float myLod[6]; | ||
} materialParams; | ||
|
||
layout(binding = 1, set = 2) uniform sampler2D mySampler; | ||
|
||
layout(location = 0) out vec4 fragColor; | ||
|
||
void main() { | ||
fragColor = textureLod(mySampler, vec2(0.0), materialParams.myLod[0]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters