Skip to content

Commit

Permalink
Remove offset from constant buffer index for Metal
Browse files Browse the repository at this point in the history
  • Loading branch information
mogemimi committed Aug 7, 2018
1 parent 60caa17 commit 3c4f69f
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ float4 Position [[position]];
float4 DestinationColor;};
vertex VS_OUTPUT LineBatchVS(
VS_INPUT input [[stage_in]],
constant TransformMatrix& uniforms [[ buffer(1)]]){
constant TransformMatrix& uniforms [[buffer(0)]]){
VS_OUTPUT out;
out.Position=float4(input.Position,1.0)*uniforms.ViewProjection;
out.DestinationColor=input.Color;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct VS_OUTPUT {

vertex VS_OUTPUT LineBatchVS(
VS_INPUT input [[stage_in]],
constant TransformMatrix& uniforms [[ buffer(1) ]])
constant TransformMatrix& uniforms [[buffer(0)]])
{
VS_OUTPUT out;
out.Position = float4(input.Position, 1.0) * uniforms.ViewProjection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ float g=diffuseTexture.sample(textureSampler,texCoord+green*amount).g;
float b=diffuseTexture.sample(textureSampler,texCoord+blue*amount).b;
return float3(r,g,b);}}fragment float4 ChromaticAberrationPS(
VS_OUTPUT input [[stage_in]],
constant ImageEffectConstants& uniforms [[ buffer(1)]],
constant ImageEffectConstants& uniforms [[buffer(0)]],
texture2d<float> diffuseTexture [[texture(0)]],
sampler textureSampler [[sampler(0)]]){
float2 inverseScreenSize=uniforms.RcpFrame;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ float2 RenderTargetPixelSize;
float2 RcpFrame;};
vertex VS_OUTPUT FxaaVS(
VS_INPUT input [[stage_in]],
constant ImageEffectConstants& uniforms [[ buffer(1)]]){
constant ImageEffectConstants& uniforms [[buffer(0)]]){
VS_OUTPUT output;
output.Position=float4(input.Position.xyz,1);
const float FxaaSubpixShift=0.25;
Expand Down Expand Up @@ -67,7 +67,7 @@ if((lumaB<lumaMin)||(lumaB>lumaMax)){
rgbB.xyz=rgbA.xyz*0.5;}
return float4(rgbB,1.0);}}fragment float4 FxaaPS(
VS_OUTPUT input [[stage_in]],
constant ImageEffectConstants& uniforms [[ buffer(1)]],
constant ImageEffectConstants& uniforms [[buffer(0)]],
texture2d<float> diffuseTexture [[texture(0)]],
sampler textureSampler [[sampler(0)]]){
FxaaTex fxaaTex={ diffuseTexture,textureSampler };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ uv=p;}
uv.y=uv.y*prop;
return uv;}}fragment float4 FishEyePS(
VS_OUTPUT input [[stage_in]],
constant ImageEffectConstants& uniforms [[ buffer(1)]],
constant FishEyeBlock& fishEyeUniforms [[ buffer(2)]],
constant ImageEffectConstants& uniforms [[buffer(0)]],
constant FishEyeBlock& fishEyeUniforms [[buffer(1)]],
texture2d<float> diffuseTexture [[texture(0)]],
sampler textureSampler [[sampler(0)]]){
float2 uv=FishEye(input.TextureCoord.xy,uniforms.RenderTargetPixelSize.xy,fishEyeUniforms.Strength);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ float artifact=cos(texCoord.y*resolution.y*2.0)*0.5+0.5;
float x=artifact*blendFactor;
return max(color.rgb-float3(x,x,x),float3(0,0,0));}}fragment float4 RetroCrtEffectPS(
VS_OUTPUT input [[stage_in]],
constant ImageEffectConstants& uniforms [[ buffer(1)]],
constant ImageEffectConstants& uniforms [[buffer(0)]],
texture2d<float> diffuseTexture [[texture(0)]],
sampler textureSampler [[sampler(0)]]){
float3 color=RetroCrtEffect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ float2 squaredPos=position*position;
float len=sqrt(length(squaredPos));
return smoothstep(radius,radius-softness,len);}}fragment float4 VignettePS(
VS_OUTPUT input [[stage_in]],
constant VignetteBlock& vignetteUniforms [[ buffer(2)]],
constant VignetteBlock& vignetteUniforms [[buffer(1)]],
texture2d<float> diffuseTexture [[texture(0)]],
sampler textureSampler [[sampler(0)]]){
float radius=0.68-(0.05*vignetteUniforms.Intensity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ float3 ChromaticAberration(

fragment float4 ChromaticAberrationPS(
VS_OUTPUT input [[stage_in]],
constant ImageEffectConstants& uniforms [[ buffer(1) ]],
constant ImageEffectConstants& uniforms [[buffer(0)]],
texture2d<float> diffuseTexture [[texture(0)]],
sampler textureSampler [[sampler(0)]])
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct __attribute__((__aligned__(256))) ImageEffectConstants {

vertex VS_OUTPUT FxaaVS(
VS_INPUT input [[stage_in]],
constant ImageEffectConstants& uniforms [[ buffer(1) ]])
constant ImageEffectConstants& uniforms [[buffer(0)]])
{
VS_OUTPUT output;

Expand Down Expand Up @@ -120,7 +120,7 @@ float4 FxaaPixelShader(FxaaTex tex, float4 posPos, float2 rcpFrame)

fragment float4 FxaaPS(
VS_OUTPUT input [[stage_in]],
constant ImageEffectConstants& uniforms [[ buffer(1) ]],
constant ImageEffectConstants& uniforms [[buffer(0)]],
texture2d<float> diffuseTexture [[texture(0)]],
sampler textureSampler [[sampler(0)]])
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ float2 FishEye(float2 texCoord, float2 resolution, float strength)

fragment float4 FishEyePS(
VS_OUTPUT input [[stage_in]],
constant ImageEffectConstants& uniforms [[ buffer(1) ]],
constant FishEyeBlock& fishEyeUniforms [[ buffer(2) ]],
constant ImageEffectConstants& uniforms [[buffer(0)]],
constant FishEyeBlock& fishEyeUniforms [[buffer(1)]],
texture2d<float> diffuseTexture [[texture(0)]],
sampler textureSampler [[sampler(0)]])
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ float3 RetroCrtEffect(

fragment float4 RetroCrtEffectPS(
VS_OUTPUT input [[stage_in]],
constant ImageEffectConstants& uniforms [[ buffer(1) ]],
constant ImageEffectConstants& uniforms [[buffer(0)]],
texture2d<float> diffuseTexture [[texture(0)]],
sampler textureSampler [[sampler(0)]])
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ float SquaredVignette(float2 textureCoord, float radius, float softness)

fragment float4 VignettePS(
VS_OUTPUT input [[stage_in]],
constant VignetteBlock& vignetteUniforms [[ buffer(2) ]],
constant VignetteBlock& vignetteUniforms [[buffer(1)]],
texture2d<float> diffuseTexture [[texture(0)]],
sampler textureSampler [[sampler(0)]])
{
Expand Down

0 comments on commit 3c4f69f

Please sign in to comment.