uniform float4x4 u_Projection; uniform float4x4 u_View; uniform float4x4 u_Model; uniform float4 u_Color; uniform bool u_HasTexture; uniform Sampler2D u_Texture; struct AssembledVertex { float3 position : POSITION; float2 texcoord : TEXCOORD; }; struct Fragment { float4 color; }; struct VertexStageOutput { float2 uv : UV; float4 sv_position : SV_Position; }; float4 someFunction(float4 color) { return color * float4(0.5, 0.5, 0.5, 1.0); } [shader("vertex")] VertexStageOutput vertexMain( AssembledVertex assembledVertex ) { VertexStageOutput output; float3 position = assembledVertex.position; output.uv = assembledVertex.texcoord; output.sv_position = mul( float4(position, 1.0), mul(u_Model, mul(u_View, u_Projection)) ); return output; } [shader("fragment")] Fragment fragmentMain( float2 uv: UV ) : SV_Target { Fragment output; if(u_HasTexture) { output.color = u_Texture.Sample(uv) * u_Color; } else { output.color = someFunction(u_Color); } return output; }