45 lines
958 B
HLSL
45 lines
958 B
HLSL
#include "bindless_structs.hlsli"
|
|
|
|
struct FS_Input
|
|
{
|
|
float2 inUV : TEXCOORD0;
|
|
};
|
|
|
|
struct FS_Output
|
|
{
|
|
float4 outColor : SV_Target0;
|
|
};
|
|
|
|
struct Float4
|
|
{
|
|
float4 value;
|
|
};
|
|
|
|
float4 GetAlbedo(uint materialBufferId, int materialId, float2 uv0)
|
|
{
|
|
if (materialId < 0)
|
|
{
|
|
return float4(1.0f, 0.0f, 1.0f, 1.0f); // Magenta
|
|
}
|
|
else
|
|
{
|
|
float4 albedoFactor = materialsBuffer[materialBufferId][materialId].m_AlbedoFactor;
|
|
uint albedoTexId = materialsBuffer[materialBufferId][materialId].m_AlbedoTex;
|
|
if (albedoTexId == INVALID_HANDLE)
|
|
{
|
|
return albedoFactor;
|
|
}
|
|
else
|
|
{
|
|
return textures[albedoTexId].Sample(immutableSamplers[albedoTexId], uv0);
|
|
}
|
|
}
|
|
}
|
|
|
|
FS_Output main(FS_Input stage_input)
|
|
{
|
|
FS_Output stage_output;
|
|
stage_output.outColor = GetAlbedo(pcb.materialBufferHandle, pcb.m_MaterialIdx, stage_input.inUV);
|
|
return stage_output;
|
|
}
|