Skip to content

Commit

Permalink
Catch up HLSL/Metal fragment shaders with their Vulkan corresponding
Browse files Browse the repository at this point in the history
  • Loading branch information
TaaTT4 authored and darksylinc committed Nov 27, 2020
1 parent 7fc32ae commit 0f53bdb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
7 changes: 5 additions & 2 deletions Samples/Media/Hlms/Terra/HLSL/PixelShader_ps.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ struct PS_INPUT
@insertpiece( Terra_VStoPS_block )
};

@pset( currSampler, samplerStateStart )

@property( !hlms_render_depth_only )
@property( hlms_gen_normals_gbuffer )
#define outPs_normals outPs.normals
Expand Down Expand Up @@ -66,7 +68,7 @@ SamplerState samplerStateTerra : register(s@value(terrainNormals));
@property( !hlms_cubemaps_use_dpm )
TextureCubeArray texEnvProbeMap : register(t@value(texEnvProbeMap));
@else
@property( use_envprobe_map )Texture2DArray texEnvProbeMap : register(t@value(texEnvProbeMap));@end
Texture2DArray texEnvProbeMap : register(t@value(texEnvProbeMap));
@insertpiece( DeclDualParaboloidFunc )
@end
@end
Expand All @@ -76,7 +78,7 @@ SamplerState samplerStateTerra : register(s@value(terrainNormals));
@end

@foreach( num_samplers, n )
SamplerState samplerState@value(samplerStateStart) : register(s@counter(samplerStateStart));@end
SamplerState samplerState@value(currSampler) : register(s@counter(currSampler));@end

@property( use_parallax_correct_cubemaps )
@insertpiece( DeclParallaxLocalCorrect )
Expand All @@ -92,6 +94,7 @@ SamplerState samplerStateTerra : register(s@value(terrainNormals));
@insertpiece( DeclAreaLtcLightFuncs )

@insertpiece( DeclVctTextures )
@insertpiece( DeclIrradianceFieldTextures )

@insertpiece( DeclOutputType )

Expand Down
11 changes: 6 additions & 5 deletions Samples/Media/Hlms/Terra/Metal/PixelShader_ps.metal
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ struct PS_INPUT
@insertpiece( Terra_VStoPS_block )
};

@pset( currSampler, samplerStateStart )

@property( !hlms_render_depth_only )
@property( hlms_gen_normals_gbuffer )
#define outPs_normals outPs.normals
Expand Down Expand Up @@ -111,12 +113,10 @@ fragment @insertpiece( output_type ) main_metal
@property( use_envprobe_map )
@property( !hlms_enable_cubemaps_auto )
, texturecube<float> texEnvProbeMap [[texture(@value(texEnvProbeMap))]]
@end
@property( hlms_enable_cubemaps_auto )
@else
@property( !hlms_cubemaps_use_dpm )
, texturecube_array<float> texEnvProbeMap [[texture(@value(texEnvProbeMap))]]
@end
@property( hlms_cubemaps_use_dpm )
@else
, texture2d_array<float> texEnvProbeMap [[texture(@value(texEnvProbeMap))]]
@end
@end
Expand All @@ -125,11 +125,12 @@ fragment @insertpiece( output_type ) main_metal
@end
@end
@foreach( num_samplers, n )
, sampler samplerState@value(samplerStateStart) [[sampler(@counter(samplerStateStart))]]@end
, sampler samplerState@value(currSampler) [[sampler(@counter(currSampler))]]@end
@insertpiece( DeclDecalsSamplers )
@insertpiece( DeclShadowSamplers )
@insertpiece( DeclAreaLtcTextures )
@insertpiece( DeclVctTextures )
@insertpiece( DeclIrradianceFieldTextures )
)
{
PS_OUTPUT outPs;
Expand Down

0 comments on commit 0f53bdb

Please sign in to comment.