diff --git a/data/shaders/common_vertex_processing.hlsl b/data/shaders/common_vertex_processing.hlsl index 0664ef071..99ff02fda 100644 --- a/data/shaders/common_vertex_processing.hlsl +++ b/data/shaders/common_vertex_processing.hlsl @@ -376,7 +376,7 @@ gbuffer_vertex transform_to_world_space(Vertex_PosUvNorTan input, uint instance_ // compute uv Material material = GetMaterial(); - vertex.uv = float2(input.uv.x * material.tiling.x + material.offset.x, input.uv.y * material.tiling.y + material.offset.y); + vertex.uv = float2(input.uv.x * material.tiling.x + material.offset.x, input.uv.y * material.tiling.y + material.offset.y); // compute the final world transform bool is_instanced = instance_id != 0; // not ideal as you can have instancing with instance_id = 0, however it's very performant branching due to predictability diff --git a/data/shaders/depth_light.hlsl b/data/shaders/depth_light.hlsl index c25f04f9d..d14e8fca7 100644 --- a/data/shaders/depth_light.hlsl +++ b/data/shaders/depth_light.hlsl @@ -23,37 +23,27 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "common.hlsl" //==================== -struct vertex +gbuffer_vertex main_vs(Vertex_PosUvNorTan input, uint instance_id : SV_InstanceID) { - float4 position : SV_POSITION; - float2 uv : TEXCOORD; -}; - -vertex main_vs(Vertex_PosUvNorTan input, uint instance_id : SV_InstanceID) -{ - vertex output; - output.uv = input.uv; - float3 f3_value_2 = pass_get_f3_value2(); uint index_array = (uint)f3_value_2.y; - Light light; light.Build(); gbuffer_vertex vertex = transform_to_world_space(input, instance_id, buffer_pass.transform); - output.position = mul(float4(vertex.position, 1.0f), light.transform[index_array]); + vertex.position_clip = mul(float4(vertex.position, 1.0f), light.transform[index_array]); // for point lights, output.position is in view space this because we do the paraboloid projection here if (light.is_point()) { - float3 ndc = project_onto_paraboloid(output.position.xyz, light.near, light.far); - output.position = float4(ndc, 1.0); + float3 ndc = project_onto_paraboloid(vertex.position.xyz, light.near, light.far); + vertex.position_clip = float4(ndc, 1.0f); } - return output; + return vertex; } -float4 main_ps(vertex input) : SV_Target0 +float4 main_ps(gbuffer_vertex input) : SV_Target0 { // alpha test const float3 f3_value = pass_get_f3_value(); diff --git a/runtime/RHI/RHI_DepthStencilState.h b/runtime/RHI/RHI_DepthStencilState.h index d1665184f..297b9d14a 100644 --- a/runtime/RHI/RHI_DepthStencilState.h +++ b/runtime/RHI/RHI_DepthStencilState.h @@ -38,10 +38,10 @@ namespace Spartan const RHI_Comparison_Function depth_comparison_function = RHI_Comparison_Function::LessEqual, const bool stencil_test = false, const bool stencil_write = false, - const RHI_Comparison_Function stencil_comparison_function = RHI_Comparison_Function::Always, - const RHI_Stencil_Operation stencil_fail_op = RHI_Stencil_Operation::Keep, - const RHI_Stencil_Operation stencil_depth_fail_op = RHI_Stencil_Operation::Keep, - const RHI_Stencil_Operation stencil_pass_op = RHI_Stencil_Operation::Replace + const RHI_Comparison_Function stencil_comparison_function = RHI_Comparison_Function::Never, + const RHI_Stencil_Operation stencil_fail_op = RHI_Stencil_Operation::Zero, + const RHI_Stencil_Operation stencil_depth_fail_op = RHI_Stencil_Operation::Zero, + const RHI_Stencil_Operation stencil_pass_op = RHI_Stencil_Operation::Zero ); ~RHI_DepthStencilState();