diff --git a/neo/extern/nvrhi b/neo/extern/nvrhi index 2caca768..6cd06881 160000 --- a/neo/extern/nvrhi +++ b/neo/extern/nvrhi @@ -1 +1 @@ -Subproject commit 2caca768dc9598cd8e46f3d2257270a1db1981ce +Subproject commit 6cd068816ca7b6348196129285c76008960eb93f diff --git a/neo/framework/Console.cpp b/neo/framework/Console.cpp index 3d2869aa..1e856cbf 100644 --- a/neo/framework/Console.cpp +++ b/neo/framework/Console.cpp @@ -33,6 +33,11 @@ If you have questions concerning this license or the applicable additional terms #include "Common_local.h" #include "../imgui/BFGimgui.h" +#if defined( USE_NVRHI ) + #include + extern DeviceManager* deviceManager; +#endif + #define CON_TEXTSIZE 0x30000 #define NUM_CON_TIMES 4 #define CONSOLE_FIRSTREPEAT 200 @@ -346,7 +351,17 @@ float idConsoleLocal::DrawFPS( float y ) ImGui::Begin( "Performance Stats" ); #if defined( USE_NVRHI ) - const char* API = "DX12"; + static const int gfxNumValues = 3; + + static const char* gfxValues[gfxNumValues] = + { + "DX11", + "DX12", + "Vulkan", + }; + + const char* API = gfxValues[ int( deviceManager->GetGraphicsAPI() ) ]; + #elif defined( USE_VULKAN ) const char* API = "Vulkan"; #else diff --git a/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp b/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp index 68c44f33..0c2bbc30 100644 --- a/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp +++ b/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp @@ -40,6 +40,7 @@ If you have questions concerning this license or the applicable additional terms #include "nvrhi/utils.h" #include +extern DeviceManager* deviceManager; idCVar r_drawFlickerBox( "r_drawFlickerBox", "0", CVAR_RENDERER | CVAR_BOOL, "visual test for dropping frames" ); idCVar stereoRender_warp( "stereoRender_warp", "0", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_BOOL, "use the optical warping renderprog instead of stereoDeGhost" ); @@ -70,8 +71,6 @@ public: static NvrhiContext context; -extern DeviceManager* deviceManager; - /* @@ -1434,12 +1433,20 @@ idRenderBackend::GL_EndFrame */ void idRenderBackend::GL_EndFrame() { + if( deviceManager->GetGraphicsAPI() == nvrhi::GraphicsAPI::VULKAN ) + { + tr.SetReadyToPresent(); + } + renderLog.CloseMainBlock( MRB_GPU_TIME ); commandList->close(); deviceManager->GetDevice()->executeCommandList( commandList ); + // required for Vulkan: transition our swap image to present + deviceManager->EndFrame(); + // update jitter for perspective matrix taaPass->AdvanceFrame(); } @@ -1463,6 +1470,11 @@ void idRenderBackend::GL_BlockingSwapBuffers() deviceManager->Present(); renderLog.EndFrame(); + + if( deviceManager->GetGraphicsAPI() == nvrhi::GraphicsAPI::VULKAN ) + { + tr.InvalidateSwapBuffers(); + } } /* diff --git a/neo/renderer/RenderBackend.cpp b/neo/renderer/RenderBackend.cpp index b4e0113c..fa484109 100644 --- a/neo/renderer/RenderBackend.cpp +++ b/neo/renderer/RenderBackend.cpp @@ -6599,7 +6599,15 @@ void idRenderBackend::ExecuteBackEndCommands( const emptyCommand_t* cmds ) { delete hiZGenPass; } - hiZGenPass = new MipMapGenPass( deviceManager->GetDevice(), globalImages->hierarchicalZbufferImage->GetTextureHandle() ); + + if( deviceManager->GetGraphicsAPI() == nvrhi::GraphicsAPI::VULKAN ) + { + hiZGenPass = NULL; + } + else + { + hiZGenPass = new MipMapGenPass( deviceManager->GetDevice(), globalImages->hierarchicalZbufferImage->GetTextureHandle() ); + } } diff --git a/neo/renderer/RenderCommon.h b/neo/renderer/RenderCommon.h index ac9115b0..77e54899 100644 --- a/neo/renderer/RenderCommon.h +++ b/neo/renderer/RenderCommon.h @@ -994,6 +994,16 @@ public: bInitialized = true; } + void InvalidateSwapBuffers() + { + omitSwapBuffers = true; + } + + void SetReadyToPresent() + { + omitSwapBuffers = false; + } + public: // internal functions idRenderSystemLocal(); @@ -1095,6 +1105,7 @@ public: private: bool bInitialized; + bool omitSwapBuffers; }; extern idRenderSystemLocal tr; diff --git a/neo/renderer/RenderProgs.cpp b/neo/renderer/RenderProgs.cpp index 50991353..cee76ad3 100644 --- a/neo/renderer/RenderProgs.cpp +++ b/neo/renderer/RenderProgs.cpp @@ -39,6 +39,8 @@ If you have questions concerning this license or the applicable additional terms #include #include + extern DeviceManager* deviceManager; + #elif defined(USE_VULKAN) extern idUniformBuffer emptyUBO; @@ -100,10 +102,20 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) uniforms.SetNum( RENDERPARM_TOTAL, vec4_zero ); uniformsChanged = false; - constantBuffer = device->createBuffer( - nvrhi::utils::CreateVolatileConstantBufferDesc( uniforms.Allocated(), - "RenderParams", - c_MaxRenderPassConstantBufferVersions ) ); + if( deviceManager->GetGraphicsAPI() == nvrhi::GraphicsAPI::VULKAN ) + { + // RB: FIXME this is ugly - DOUBLECHECK this + constantBuffer = device->createBuffer( + nvrhi::utils::CreateVolatileConstantBufferDesc( uniforms.Allocated(), + "RenderParams", 1024 ) ); + } + else + { + constantBuffer = device->createBuffer( + nvrhi::utils::CreateVolatileConstantBufferDesc( uniforms.Allocated(), + "RenderParams", + c_MaxRenderPassConstantBufferVersions ) ); + } // === Main draw vertex layout === vertexLayoutDescs.SetNum( NUM_VERTEX_LAYOUTS, {} ); @@ -442,10 +454,10 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) } builtins[] = { { BUILTIN_GUI, "builtin/gui", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, - { BUILTIN_COLOR, "builtin/color", "", { {"USE_GPU_SKINNING", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, + { BUILTIN_COLOR, "builtin/color", "", { {"USE_GPU_SKINNING", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_CONSTANT_BUFFER_ONLY }, // RB begin - { BUILTIN_COLOR_SKINNED, "builtin/color", "_skinned", { {"USE_GPU_SKINNING", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT_SKINNED }, - { BUILTIN_VERTEX_COLOR, "builtin/vertex_color", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, + { BUILTIN_COLOR_SKINNED, "builtin/color", "_skinned", { {"USE_GPU_SKINNING", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_CONSTANT_BUFFER_ONLY_SKINNED }, + { BUILTIN_VERTEX_COLOR, "builtin/vertex_color", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_CONSTANT_BUFFER_ONLY }, { BUILTIN_AMBIENT_LIGHTING_IBL, "builtin/lighting/ambient_lighting_IBL", "", { { "USE_GPU_SKINNING", "0" }, { "USE_PBR", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_AMBIENT_LIGHTING_IBL }, { BUILTIN_AMBIENT_LIGHTING_IBL_SKINNED, "builtin/lighting/ambient_lighting_IBL", "_skinned", { { "USE_GPU_SKINNING", "1" }, { "USE_PBR", "0" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_AMBIENT_LIGHTING_IBL_SKINNED }, @@ -538,8 +550,8 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) { BUILTIN_SHADOW, "builtin/lighting/shadow", "", { {"USE_GPU_SKINNING", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_SHADOW_VERT, BINDING_LAYOUT_CONSTANT_BUFFER_ONLY }, { BUILTIN_SHADOW_SKINNED, "builtin/lighting/shadow", "_skinned", { {"USE_GPU_SKINNING", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_SHADOW_VERT_SKINNED, BINDING_LAYOUT_CONSTANT_BUFFER_ONLY_SKINNED }, - { BUILTIN_SHADOW_DEBUG, "builtin/debug/shadowDebug", "", { {"USE_GPU_SKINNING", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, - { BUILTIN_SHADOW_DEBUG_SKINNED, "builtin/debug/shadowDebug", "_skinned", { {"USE_GPU_SKINNING", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT_SKINNED }, + { BUILTIN_SHADOW_DEBUG, "builtin/debug/shadowDebug", "", { {"USE_GPU_SKINNING", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_CONSTANT_BUFFER_ONLY }, + { BUILTIN_SHADOW_DEBUG_SKINNED, "builtin/debug/shadowDebug", "_skinned", { {"USE_GPU_SKINNING", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_CONSTANT_BUFFER_ONLY_SKINNED }, { BUILTIN_BLENDLIGHT, "builtin/fog/blendlight", "", { {"USE_GPU_SKINNING", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_BLENDLIGHT }, { BUILTIN_BLENDLIGHT_SKINNED, "builtin/fog/blendlight", "_skinned", { {"USE_GPU_SKINNING", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_BLENDLIGHT_SKINNED }, diff --git a/neo/renderer/RenderSystem.cpp b/neo/renderer/RenderSystem.cpp index f9d9aa8b..ed6c66f7 100644 --- a/neo/renderer/RenderSystem.cpp +++ b/neo/renderer/RenderSystem.cpp @@ -257,7 +257,8 @@ idRenderSystemLocal::idRenderSystemLocal() : zeroOneCubeTriangles( NULL ), zeroOneSphereTriangles( NULL ), testImageTriangles( NULL ), - bInitialized( false ) + bInitialized( false ), + omitSwapBuffers( false ) { Clear(); } @@ -676,10 +677,13 @@ void idRenderSystemLocal::SwapCommandBuffers_FinishRendering( // keep capturing envprobes completely in the background // and only update the screen when we update the progress bar in the console -#if !defined( USE_NVRHI ) +#if defined( USE_NVRHI ) + if( !omitSwapBuffers ) +#else if( !takingEnvprobe ) #endif { + #if !IMGUI_BFGUI ImGuiHook::Render(); #endif diff --git a/neo/renderer/RenderSystem.h b/neo/renderer/RenderSystem.h index 3e0dd944..8a033930 100644 --- a/neo/renderer/RenderSystem.h +++ b/neo/renderer/RenderSystem.h @@ -98,7 +98,10 @@ enum graphicsDriverType_t GLDRV_OPENGL_MESA, // fear this, it is probably the best to disable GPU skinning and run shaders in GLSL ES 1.0 GLDRV_OPENGL_MESA_CORE_PROFILE, - GLDRV_VULKAN + GLDRV_VULKAN, + + GLDRV_NVRHI_DX12, + GLDRV_NVRHI_VULKAN, }; #define ID_MSAA 0 diff --git a/neo/renderer/RenderSystem_init.cpp b/neo/renderer/RenderSystem_init.cpp index bd63ae85..88dbe257 100644 --- a/neo/renderer/RenderSystem_init.cpp +++ b/neo/renderer/RenderSystem_init.cpp @@ -67,9 +67,9 @@ idCVar r_requestStereoPixelFormat( "r_requestStereoPixelFormat", "1", CVAR_RENDE idCVar r_debugContext( "r_debugContext", "0", CVAR_RENDERER, "Enable various levels of context debug." ); #if defined( USE_NVRHI ) #if defined( _WIN32 ) - idCVar r_graphicsAPI( "r_graphicsAPI", "dx12", CVAR_RENDERER, "Specifies the graphics api to use (dx12, vulkan)" ); + idCVar r_graphicsAPI( "r_graphicsAPI", "dx12", CVAR_RENDERER | CVAR_INIT | CVAR_ARCHIVE, "Specifies the graphics api to use (dx12, vulkan)" ); #else - idCVar r_graphicsAPI( "r_graphicsAPI", "vulkan", CVAR_RENDERER, "Specifies the graphics api to use (vulkan)" ); + idCVar r_graphicsAPI( "r_graphicsAPI", "vulkan", CVAR_RENDERER | CVAR_ROM | CVAR_STATIC, "Specifies the graphics api to use (vulkan)" ); #endif idCVar r_useValidationLayers( "r_useValidationLayers", "1", CVAR_INTEGER | CVAR_INIT, "1 is just the NVRHI and 2 will turn on additional DX12, VK validation layers" ); @@ -2225,7 +2225,11 @@ void idRenderSystemLocal::Init() frontEndJobList = parallelJobManager->AllocJobList( JOBLIST_RENDERER_FRONTEND, JOBLIST_PRIORITY_MEDIUM, 2048, 0, NULL ); envprobeJobList = parallelJobManager->AllocJobList( JOBLIST_UTILITY, JOBLIST_PRIORITY_MEDIUM, 2048, 0, NULL ); // RB - bInitialized = true; + if( deviceManager->GetGraphicsAPI() == nvrhi::GraphicsAPI::VULKAN ) + { + // avoid GL_BlockingSwapBuffers + omitSwapBuffers = true; + } // make sure the command buffers are ready to accept the first screen update SwapCommandBuffers( NULL, NULL, NULL, NULL, NULL, NULL ); diff --git a/neo/shaders/bloodorb1_capture.ps.hlsl b/neo/shaders/bloodorb1_capture.ps.hlsl index 81e4fd4f..068be867 100644 --- a/neo/shaders/bloodorb1_capture.ps.hlsl +++ b/neo/shaders/bloodorb1_capture.ps.hlsl @@ -30,19 +30,21 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -Texture2D t_Accum : register( t0 ); -Texture2D t_CurrentRender : register( t1 ); -Texture2D t_Mask : register( t2 ); +Texture2D t_Accum : register( t0 VK_DESCRIPTOR_SET( 0 ) ); +Texture2D t_CurrentRender : register( t1 VK_DESCRIPTOR_SET( 0 ) ); +Texture2D t_Mask : register( t2 VK_DESCRIPTOR_SET( 0 ) ); -SamplerState LinearSampler : register( s0 ); +SamplerState LinearSampler : register( s0 VK_DESCRIPTOR_SET( 1 ) ); -struct PS_IN { +struct PS_IN +{ float4 position : SV_Position; float2 texcoord0 : TEXCOORD0_centroid; float2 texcoord1 : TEXCOORD1_centroid; }; -struct PS_OUT { +struct PS_OUT +{ float4 color : SV_Target; }; // *INDENT-ON* diff --git a/neo/shaders/bloodorb1_capture.vs.hlsl b/neo/shaders/bloodorb1_capture.vs.hlsl index ad81c5e3..0d7577c1 100644 --- a/neo/shaders/bloodorb1_capture.vs.hlsl +++ b/neo/shaders/bloodorb1_capture.vs.hlsl @@ -31,12 +31,14 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; +struct VS_IN +{ + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT { diff --git a/neo/shaders/bloodorb2_capture.ps.hlsl b/neo/shaders/bloodorb2_capture.ps.hlsl index bc6e399e..68f04db3 100644 --- a/neo/shaders/bloodorb2_capture.ps.hlsl +++ b/neo/shaders/bloodorb2_capture.ps.hlsl @@ -30,13 +30,14 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -Texture2D t_Accum : register( t0 ); -Texture2D t_CurrentRender : register( t1 ); -Texture2D t_Mask : register( t2 ); +Texture2D t_Accum : register( t0 VK_DESCRIPTOR_SET( 0 ) ); +Texture2D t_CurrentRender : register( t1 VK_DESCRIPTOR_SET( 0 ) ); +Texture2D t_Mask : register( t2 VK_DESCRIPTOR_SET( 0 ) ); -SamplerState LinearSampler : register( s0 ); +SamplerState LinearSampler : register( s0 VK_DESCRIPTOR_SET( 1 ) ); -struct PS_IN { +struct PS_IN +{ float4 position : SV_Position; float2 texcoord0 : TEXCOORD0_centroid; float2 texcoord1 : TEXCOORD1_centroid; @@ -44,7 +45,8 @@ struct PS_IN { //float4 color : COLOR0; }; -struct PS_OUT { +struct PS_OUT +{ float4 color : SV_Target; }; // *INDENT-ON* diff --git a/neo/shaders/bloodorb2_capture.vs.hlsl b/neo/shaders/bloodorb2_capture.vs.hlsl index dfe512b0..7f21d355 100644 --- a/neo/shaders/bloodorb2_capture.vs.hlsl +++ b/neo/shaders/bloodorb2_capture.vs.hlsl @@ -30,12 +30,14 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; +struct VS_IN +{ + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT { diff --git a/neo/shaders/bloodorb3_capture.ps.hlsl b/neo/shaders/bloodorb3_capture.ps.hlsl index 8e4b64fc..5426a539 100644 --- a/neo/shaders/bloodorb3_capture.ps.hlsl +++ b/neo/shaders/bloodorb3_capture.ps.hlsl @@ -30,13 +30,14 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -Texture2D t_Accum : register( t0 ); -Texture2D t_CurrentRender : register( t1 ); -Texture2D t_Mask : register( t2 ); +Texture2D t_Accum : register( t0 VK_DESCRIPTOR_SET( 0 ) ); +Texture2D t_CurrentRender : register( t1 VK_DESCRIPTOR_SET( 0 ) ); +Texture2D t_Mask : register( t2 VK_DESCRIPTOR_SET( 0 ) ); -SamplerState LinearSampler : register( s0 ); +SamplerState LinearSampler : register( s0 VK_DESCRIPTOR_SET( 1 ) ); -struct PS_IN { +struct PS_IN +{ float4 position : SV_Position; float2 texcoord0 : TEXCOORD0_centroid; float2 texcoord1 : TEXCOORD1_centroid; diff --git a/neo/shaders/bloodorb3_capture.vs.hlsl b/neo/shaders/bloodorb3_capture.vs.hlsl index 22b2820f..86a7474d 100644 --- a/neo/shaders/bloodorb3_capture.vs.hlsl +++ b/neo/shaders/bloodorb3_capture.vs.hlsl @@ -30,12 +30,14 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; +struct VS_IN +{ + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT { diff --git a/neo/shaders/bloodorb_draw.ps.hlsl b/neo/shaders/bloodorb_draw.ps.hlsl index ff183dc3..da221fe7 100644 --- a/neo/shaders/bloodorb_draw.ps.hlsl +++ b/neo/shaders/bloodorb_draw.ps.hlsl @@ -30,18 +30,20 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -Texture2D t_Accum : register( t0 ); -Texture2D t_CurrentRender : register( t1 ); -Texture2D t_Mask : register( t2 ); +Texture2D t_Accum : register( t0 VK_DESCRIPTOR_SET( 0 ) ); +Texture2D t_CurrentRender : register( t1 VK_DESCRIPTOR_SET( 0 ) ); +Texture2D t_Mask : register( t2 VK_DESCRIPTOR_SET( 0 ) ); -SamplerState LinearSampler : register( s0 ); +SamplerState LinearSampler : register( s0 VK_DESCRIPTOR_SET( 1 ) ); -struct PS_IN { +struct PS_IN +{ float4 position : SV_Position; float2 texcoord0 : TEXCOORD0_centroid; }; -struct PS_OUT { +struct PS_OUT +{ float4 color : SV_Target; }; // *INDENT-ON* diff --git a/neo/shaders/bloodorb_draw.vs.hlsl b/neo/shaders/bloodorb_draw.vs.hlsl index 50b594d5..46ddc417 100644 --- a/neo/shaders/bloodorb_draw.vs.hlsl +++ b/neo/shaders/bloodorb_draw.vs.hlsl @@ -30,15 +30,18 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; +struct VS_IN +{ + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; -struct VS_OUT { +struct VS_OUT +{ float4 position : SV_Position; float2 texcoord0 : TEXCOORD0_centroid; }; diff --git a/neo/shaders/builtin/SSAO/AmbientOcclusion_AO.ps.hlsl b/neo/shaders/builtin/SSAO/AmbientOcclusion_AO.ps.hlsl index 5d6afbf3..ea847563 100644 --- a/neo/shaders/builtin/SSAO/AmbientOcclusion_AO.ps.hlsl +++ b/neo/shaders/builtin/SSAO/AmbientOcclusion_AO.ps.hlsl @@ -93,11 +93,11 @@ static const float projScale = 500.0; #define VALUE_TYPE float -Texture2D t_NormalRoughness : register( t0 VK_DESCRIPTOR_SET( 0 ) ); -Texture2D t_ViewDepth : register( t1 VK_DESCRIPTOR_SET( 0 ) ); -Texture2D t_BlueNoise : register( t2 VK_DESCRIPTOR_SET( 0 ) ); +Texture2D t_NormalRoughness : register( t0 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_ViewDepth : register( t1 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_BlueNoise : register( t2 VK_DESCRIPTOR_SET( 1 ) ); -SamplerState blueNoiseSampler : register( s0 VK_DESCRIPTOR_SET( 1 ) ); +SamplerState blueNoiseSampler : register( s0 VK_DESCRIPTOR_SET( 2 ) ); #define CS_Z_buffer t_ViewDepth diff --git a/neo/shaders/builtin/SSAO/AmbientOcclusion_AO.vs.hlsl b/neo/shaders/builtin/SSAO/AmbientOcclusion_AO.vs.hlsl index 95b21e78..fab2def0 100644 --- a/neo/shaders/builtin/SSAO/AmbientOcclusion_AO.vs.hlsl +++ b/neo/shaders/builtin/SSAO/AmbientOcclusion_AO.vs.hlsl @@ -30,10 +30,14 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -struct VS_IN +struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT diff --git a/neo/shaders/builtin/SSAO/AmbientOcclusion_blur.ps.hlsl b/neo/shaders/builtin/SSAO/AmbientOcclusion_blur.ps.hlsl index 0dde511e..b178d296 100644 --- a/neo/shaders/builtin/SSAO/AmbientOcclusion_blur.ps.hlsl +++ b/neo/shaders/builtin/SSAO/AmbientOcclusion_blur.ps.hlsl @@ -22,9 +22,9 @@ // *INDENT-OFF* #define VALUE_TYPE float -Texture2D t_NormalRoughness : register( t0 VK_DESCRIPTOR_SET( 0 ) ); -Texture2D t_ViewDepth : register( t1 VK_DESCRIPTOR_SET( 0 ) ); -Texture2D t_Ao : register( t2 VK_DESCRIPTOR_SET( 0 ) ); +Texture2D t_NormalRoughness : register( t0 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_ViewDepth : register( t1 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_Ao : register( t2 VK_DESCRIPTOR_SET( 1 ) ); #define normal_buffer t_NormalRoughness #define cszBuffer t_ViewDepth diff --git a/neo/shaders/builtin/SSAO/AmbientOcclusion_blur.vs.hlsl b/neo/shaders/builtin/SSAO/AmbientOcclusion_blur.vs.hlsl index 247448b4..f0fbdf38 100644 --- a/neo/shaders/builtin/SSAO/AmbientOcclusion_blur.vs.hlsl +++ b/neo/shaders/builtin/SSAO/AmbientOcclusion_blur.vs.hlsl @@ -30,10 +30,14 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -struct VS_IN +struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT diff --git a/neo/shaders/builtin/SSAO/AmbientOcclusion_minify.ps.hlsl b/neo/shaders/builtin/SSAO/AmbientOcclusion_minify.ps.hlsl index 041ba4d3..56de4d33 100644 --- a/neo/shaders/builtin/SSAO/AmbientOcclusion_minify.ps.hlsl +++ b/neo/shaders/builtin/SSAO/AmbientOcclusion_minify.ps.hlsl @@ -19,9 +19,9 @@ // *INDENT-OFF* -Texture2D t_ViewDepth : register( t0 ); +Texture2D t_ViewDepth : register( t0 VK_DESCRIPTOR_SET( 1 ) ); -SamplerState LinearSampler : register( s0 ); +SamplerState LinearSampler : register( s0 VK_DESCRIPTOR_SET( 2 ) ); struct PS_IN { diff --git a/neo/shaders/builtin/SSAO/AmbientOcclusion_minify.vs.hlsl b/neo/shaders/builtin/SSAO/AmbientOcclusion_minify.vs.hlsl index 247448b4..f0fbdf38 100644 --- a/neo/shaders/builtin/SSAO/AmbientOcclusion_minify.vs.hlsl +++ b/neo/shaders/builtin/SSAO/AmbientOcclusion_minify.vs.hlsl @@ -30,10 +30,14 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -struct VS_IN +struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT diff --git a/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_blur.ps.hlsl b/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_blur.ps.hlsl index 91f4682a..ee379ec0 100644 --- a/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_blur.ps.hlsl +++ b/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_blur.ps.hlsl @@ -20,11 +20,11 @@ // *INDENT-OFF* -Texture2D t_ViewNormal : register( t0 ); -Texture2D t_ViewDepth : register( t1 ); -Texture2D t_ViewAo : register( t2 ); +Texture2D t_ViewNormal : register( t0 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_ViewDepth : register( t1 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_ViewAo : register( t2 VK_DESCRIPTOR_SET( 1 ) ); -SamplerState LinearSampler : register( s0 ); +SamplerState LinearSampler : register( s0 VK_DESCRIPTOR_SET( 2 ) ); #define normal_buffer t_ViewNormal #define cszBuffer t_ViewDepth diff --git a/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_blur.vs.hlsl b/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_blur.vs.hlsl index d45beb9f..bf39a0bd 100644 --- a/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_blur.vs.hlsl +++ b/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_blur.vs.hlsl @@ -30,10 +30,14 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -struct VS_IN +struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT diff --git a/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_radiosity.ps.hlsl b/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_radiosity.ps.hlsl index c24d4302..178d5c1d 100644 --- a/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_radiosity.ps.hlsl +++ b/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_radiosity.ps.hlsl @@ -77,11 +77,11 @@ static const float projScale = 500.0; // #endif // *INDENT-OFF* -Texture2D t_ViewNormals : register( t0 ); -Texture2D t_ViewDepth : register( t1 ); -Texture2D t_Colors : register( t2 ); +Texture2D t_ViewNormals : register( t0 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_ViewDepth : register( t1 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_Colors : register( t2 VK_DESCRIPTOR_SET( 1 ) ); -SamplerState LinearSampler : register( s0 ); +SamplerState LinearSampler : register( s0 VK_DESCRIPTOR_SET( 2 ) ); #define normal_buffer t_ViewNormals #define CS_Z_buffer t_ViewDepth diff --git a/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_radiosity.vs.hlsl b/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_radiosity.vs.hlsl index d45beb9f..bf39a0bd 100644 --- a/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_radiosity.vs.hlsl +++ b/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_radiosity.vs.hlsl @@ -30,10 +30,14 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -struct VS_IN +struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT diff --git a/neo/shaders/builtin/VR/stereoDeGhost.ps.hlsl b/neo/shaders/builtin/VR/stereoDeGhost.ps.hlsl index 3a829b88..36fc735a 100644 --- a/neo/shaders/builtin/VR/stereoDeGhost.ps.hlsl +++ b/neo/shaders/builtin/VR/stereoDeGhost.ps.hlsl @@ -30,10 +30,11 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -Texture2D t_t1 : register( t0 ); -SamplerState LinearSampler : register( s0 ); +Texture2D t_t1 : register( t0 VK_DESCRIPTOR_SET( 1 ) ); +SamplerState LinearSampler : register( s0 VK_DESCRIPTOR_SET( 2 ) ); -struct PS_OUT { +struct PS_OUT +{ float4 color : SV_Target0; }; // *INDENT-ON* diff --git a/neo/shaders/builtin/VR/stereoDeGhost.vs.hlsl b/neo/shaders/builtin/VR/stereoDeGhost.vs.hlsl index 187dcf51..f11dc4f8 100644 --- a/neo/shaders/builtin/VR/stereoDeGhost.vs.hlsl +++ b/neo/shaders/builtin/VR/stereoDeGhost.vs.hlsl @@ -30,12 +30,14 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; +struct VS_IN +{ + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT { diff --git a/neo/shaders/builtin/VR/stereoInterlace.ps.hlsl b/neo/shaders/builtin/VR/stereoInterlace.ps.hlsl index bf5736dd..65d03566 100644 --- a/neo/shaders/builtin/VR/stereoInterlace.ps.hlsl +++ b/neo/shaders/builtin/VR/stereoInterlace.ps.hlsl @@ -30,17 +30,19 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -Texture2D t_t1 : register( t0 ); -Texture2D t_t2 : register( t1 ); +Texture2D t_t1 : register( t0 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_t2 : register( t1 VK_DESCRIPTOR_SET( 1 ) ); -SamplerState LinearSampler : register( s0 ); +SamplerState LinearSampler : register( s0 VK_DESCRIPTOR_SET( 2 ) ); -struct PS_IN { +struct PS_IN +{ float4 position : POSITION; float2 texcoord0 : TEXCOORD0_centroid; }; -struct PS_OUT { +struct PS_OUT +{ float4 color : SV_Target0; }; // *INDENT-ON* diff --git a/neo/shaders/builtin/VR/stereoInterlace.vs.hlsl b/neo/shaders/builtin/VR/stereoInterlace.vs.hlsl index 869e79a4..14b2fcd8 100644 --- a/neo/shaders/builtin/VR/stereoInterlace.vs.hlsl +++ b/neo/shaders/builtin/VR/stereoInterlace.vs.hlsl @@ -30,9 +30,14 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; +struct VS_IN +{ + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT { diff --git a/neo/shaders/builtin/VR/stereoWarp.ps.hlsl b/neo/shaders/builtin/VR/stereoWarp.ps.hlsl index 32c7ab57..22e4f628 100644 --- a/neo/shaders/builtin/VR/stereoWarp.ps.hlsl +++ b/neo/shaders/builtin/VR/stereoWarp.ps.hlsl @@ -38,14 +38,16 @@ the optics. */ // *INDENT-OFF* -Texture2D t_t1 : register( t0 ); -SamplerState LinearSampler : register( s0 ); +Texture2D t_t1 : register( t0 VK_DESCRIPTOR_SET( 1 ) ); +SamplerState LinearSampler : register( s0 VK_DESCRIPTOR_SET( 2 ) ); -struct PS_IN { - vec4 texcoord0 : TEXCOORD0_centroid; +struct PS_IN +{ + float2 texcoord0 : TEXCOORD0_centroid; }; -struct PS_OUT { +struct PS_OUT +{ float4 color : SV_Target; }; // *INDENT-ON* diff --git a/neo/shaders/builtin/VR/stereoWarp.vs.hlsl b/neo/shaders/builtin/VR/stereoWarp.vs.hlsl index ed3df7fe..8cb14b9c 100644 --- a/neo/shaders/builtin/VR/stereoWarp.vs.hlsl +++ b/neo/shaders/builtin/VR/stereoWarp.vs.hlsl @@ -30,14 +30,19 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -struct VS_IN { - float4 position : POSITION; - float4 texcoord : TEXCOORD0; +struct VS_IN +{ + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT { float4 position : POSITION; - float4 texcoord0: TEXCOORD0; // 0 to 1 box + float2 texcoord0: TEXCOORD0; // 0 to 1 box }; // *INDENT-ON* diff --git a/neo/shaders/builtin/color.ps.hlsl b/neo/shaders/builtin/color.ps.hlsl index 15948590..a3fdcc0b 100644 --- a/neo/shaders/builtin/color.ps.hlsl +++ b/neo/shaders/builtin/color.ps.hlsl @@ -29,9 +29,10 @@ If you have questions concerning this license or the applicable additional terms #include "global_inc.hlsl" // *INDENT-OFF* -sampler samp0 : register(s0); +//sampler samp0 : register( s0 VK_DESCRIPTOR_SET( 1 ) ); -struct PS_OUT { +struct PS_OUT +{ float4 color : SV_Target0; }; // *INDENT-ON* diff --git a/neo/shaders/builtin/debug/debug_shadowmap.ps.hlsl b/neo/shaders/builtin/debug/debug_shadowmap.ps.hlsl index 7de09496..8c6d094d 100644 --- a/neo/shaders/builtin/debug/debug_shadowmap.ps.hlsl +++ b/neo/shaders/builtin/debug/debug_shadowmap.ps.hlsl @@ -32,9 +32,9 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* // TODO(Stephen): I think this should be an array? -Texture2D t_t1 : register( t0 ); +Texture2D t_t1 : register( t0 VK_DESCRIPTOR_SET( 1 ) ); -SamplerState LinearSampler : register( s0 ); +SamplerState LinearSampler : register( s0 VK_DESCRIPTOR_SET( 2 ) ); struct PS_IN { diff --git a/neo/shaders/builtin/debug/debug_shadowmap.vs.hlsl b/neo/shaders/builtin/debug/debug_shadowmap.vs.hlsl index 06d7c153..38ecabbc 100644 --- a/neo/shaders/builtin/debug/debug_shadowmap.vs.hlsl +++ b/neo/shaders/builtin/debug/debug_shadowmap.vs.hlsl @@ -30,12 +30,14 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; +struct VS_IN +{ + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT { diff --git a/neo/shaders/builtin/debug/lightgrid.ps.hlsl b/neo/shaders/builtin/debug/lightgrid.ps.hlsl index 9cbab4e1..337971bc 100644 --- a/neo/shaders/builtin/debug/lightgrid.ps.hlsl +++ b/neo/shaders/builtin/debug/lightgrid.ps.hlsl @@ -31,17 +31,19 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -Texture2D t_Atlas : register( t0 ); -SamplerState samp0 : register( s0 ); // texture 0 is octahedron cube map atlas +Texture2D t_Atlas : register( t0 VK_DESCRIPTOR_SET( 1 ) ); +SamplerState samp0 : register( s0 VK_DESCRIPTOR_SET( 2 ) ); // texture 0 is octahedron cube map atlas -struct PS_IN { +struct PS_IN +{ float4 position : SV_Position; float3 texcoord0 : TEXCOORD0_centroid; float3 texcoord1 : TEXCOORD1_centroid; float4 color : COLOR0; }; -struct PS_OUT { +struct PS_OUT +{ float4 color : SV_Target0; }; // *INDENT-ON* diff --git a/neo/shaders/builtin/debug/lightgrid.vs.hlsl b/neo/shaders/builtin/debug/lightgrid.vs.hlsl index df778083..f5d49902 100644 --- a/neo/shaders/builtin/debug/lightgrid.vs.hlsl +++ b/neo/shaders/builtin/debug/lightgrid.vs.hlsl @@ -35,14 +35,14 @@ If you have questions concerning this license or the applicable additional terms StructuredBuffer matrices: register(t11); #endif -struct VS_IN +struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; - float4 color2 : COLOR1; + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT diff --git a/neo/shaders/builtin/debug/octahedron.ps.hlsl b/neo/shaders/builtin/debug/octahedron.ps.hlsl index e63d6256..93dff5f3 100644 --- a/neo/shaders/builtin/debug/octahedron.ps.hlsl +++ b/neo/shaders/builtin/debug/octahedron.ps.hlsl @@ -31,8 +31,8 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -Texture2D t_CubeMap : register( t0 ); -SamplerState samp0 : register( s0 ); // texture 0 is octahedron cube map +Texture2D t_CubeMap : register( t0 VK_DESCRIPTOR_SET( 1 ) ); +SamplerState samp0 : register( s0 VK_DESCRIPTOR_SET( 2 ) ); // texture 0 is octahedron cube map struct PS_IN { diff --git a/neo/shaders/builtin/debug/octahedron.vs.hlsl b/neo/shaders/builtin/debug/octahedron.vs.hlsl index a85b38e7..09bf5159 100644 --- a/neo/shaders/builtin/debug/octahedron.vs.hlsl +++ b/neo/shaders/builtin/debug/octahedron.vs.hlsl @@ -35,14 +35,14 @@ If you have questions concerning this license or the applicable additional terms StructuredBuffer matrices: register(t11); #endif -struct VS_IN +struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; - float4 color2 : COLOR1; + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT diff --git a/neo/shaders/builtin/debug/shadowDebug.ps.hlsl b/neo/shaders/builtin/debug/shadowDebug.ps.hlsl index 841bbd9a..a1ee4c44 100644 --- a/neo/shaders/builtin/debug/shadowDebug.ps.hlsl +++ b/neo/shaders/builtin/debug/shadowDebug.ps.hlsl @@ -30,13 +30,15 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -SamplerState samp0 : register(s0 VK_DESCRIPTOR_SET( 0 )); +//SamplerState samp0 : register(s0 VK_DESCRIPTOR_SET( 0 ) ); -struct VS_IN { +struct VS_IN +{ float4 position : SV_Position; }; -struct PS_OUT { +struct PS_OUT +{ float4 color : SV_Target0; }; // *INDENT-ON* diff --git a/neo/shaders/builtin/debug/shadowDebug_skinned.ps.hlsl b/neo/shaders/builtin/debug/shadowDebug_skinned.ps.hlsl deleted file mode 100644 index 8a9f8f68..00000000 --- a/neo/shaders/builtin/debug/shadowDebug_skinned.ps.hlsl +++ /dev/null @@ -1,43 +0,0 @@ -/* -=========================================================================== - -Doom 3 BFG Edition GPL Source Code -Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. - -This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). - -Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Doom 3 BFG Edition Source Code. If not, see . - -In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. - -If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - -=========================================================================== -*/ - -#include "global_inc.hlsl" - - -// *INDENT-OFF* -uniform sampler2D samp0 : register(s0); - -struct PS_OUT { - float4 color : COLOR; -}; -// *INDENT-ON* - -void main( out PS_OUT result ) -{ - result.color = rpColor; -} \ No newline at end of file diff --git a/neo/shaders/builtin/debug/shadowDebug_skinned.vs.hlsl b/neo/shaders/builtin/debug/shadowDebug_skinned.vs.hlsl deleted file mode 100644 index dfb85b05..00000000 --- a/neo/shaders/builtin/debug/shadowDebug_skinned.vs.hlsl +++ /dev/null @@ -1,96 +0,0 @@ -/* -=========================================================================== - -Doom 3 BFG Edition GPL Source Code -Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. -Copyright (C) 2014 Robert Beckebans - -This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). - -Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Doom 3 BFG Edition Source Code. If not, see . - -In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. - -If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - -=========================================================================== -*/ - -#include "global_inc.hlsl" - - -uniform matrices_ubo { float4 matrices[408]; }; - -// *INDENT-OFF* -struct VS_IN { - float4 position : POSITION; - float4 color : COLOR0; - float4 color2 : COLOR1; -}; - -struct VS_OUT { - float4 position : POSITION; -}; -// *INDENT-ON* - -void main( VS_IN vertex, out VS_OUT result ) -{ - //-------------------------------------------------------------- - // GPU transformation of the normal / binormal / bitangent - // - // multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 ) - //-------------------------------------------------------------- - const float w0 = vertex.color2.x; - const float w1 = vertex.color2.y; - const float w2 = vertex.color2.z; - const float w3 = vertex.color2.w; - - float4 matX, matY, matZ; // must be float4 for vec4 - int joint = int( vertex.color.x * 255.1 * 3.0 ); - matX = matrices[int( joint + 0 )] * w0; - matY = matrices[int( joint + 1 )] * w0; - matZ = matrices[int( joint + 2 )] * w0; - - joint = int( vertex.color.y * 255.1 * 3.0 ); - matX += matrices[int( joint + 0 )] * w1; - matY += matrices[int( joint + 1 )] * w1; - matZ += matrices[int( joint + 2 )] * w1; - - joint = int( vertex.color.z * 255.1 * 3.0 ); - matX += matrices[int( joint + 0 )] * w2; - matY += matrices[int( joint + 1 )] * w2; - matZ += matrices[int( joint + 2 )] * w2; - - joint = int( vertex.color.w * 255.1 * 3.0 ); - matX += matrices[int( joint + 0 )] * w3; - matY += matrices[int( joint + 1 )] * w3; - matZ += matrices[int( joint + 2 )] * w3; - - float4 vertexPosition = vertex.position; - vertexPosition.w = 1.0; - - float4 modelPosition; - modelPosition.x = dot4( matX, vertexPosition ); - modelPosition.y = dot4( matY, vertexPosition ); - modelPosition.z = dot4( matZ, vertexPosition ); - modelPosition.w = vertex.position.w; - - float4 vPos = modelPosition - rpLocalLightOrigin; - vPos = ( vPos.wwww * rpLocalLightOrigin ) + vPos; - - result.position.x = dot4( vPos, rpMVPmatrixX ); - result.position.y = dot4( vPos, rpMVPmatrixY ); - result.position.z = dot4( vPos, rpMVPmatrixZ ); - result.position.w = dot4( vPos, rpMVPmatrixW ); -} \ No newline at end of file diff --git a/neo/shaders/builtin/depth.vs.hlsl b/neo/shaders/builtin/depth.vs.hlsl index 4937d8bc..f7a2b3ea 100644 --- a/neo/shaders/builtin/depth.vs.hlsl +++ b/neo/shaders/builtin/depth.vs.hlsl @@ -35,14 +35,12 @@ StructuredBuffer matrices : register(t11); struct VS_IN { - float4 position : POSITION; -#if USE_GPU_SKINNING - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; - float4 color2 : COLOR1; -#endif + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT diff --git a/neo/shaders/builtin/fog/blendLight.ps.hlsl b/neo/shaders/builtin/fog/blendLight.ps.hlsl index c94d2c07..4e3ee598 100644 --- a/neo/shaders/builtin/fog/blendLight.ps.hlsl +++ b/neo/shaders/builtin/fog/blendLight.ps.hlsl @@ -31,17 +31,19 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -Texture2D t_Light1 : register( t0 VK_DESCRIPTOR_SET( 0 ) ); -Texture2D t_Light2 : register( t1 VK_DESCRIPTOR_SET( 0 ) ); -SamplerState s_LinearClamp : register( s0 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_Light1 : register( t0 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_Light2 : register( t1 VK_DESCRIPTOR_SET( 1 ) ); +SamplerState s_LinearClamp : register( s0 VK_DESCRIPTOR_SET( 2 ) ); -struct PS_IN { +struct PS_IN +{ float4 position : SV_Position; float4 texcoord0 : TEXCOORD0_centroid; float2 texcoord1 : TEXCOORD1_centroid; }; -struct PS_OUT { +struct PS_OUT +{ float4 color : SV_Target0; }; // *INDENT-ON* diff --git a/neo/shaders/builtin/fog/blendLight.vs.hlsl b/neo/shaders/builtin/fog/blendLight.vs.hlsl index 50977a24..fbff331a 100644 --- a/neo/shaders/builtin/fog/blendLight.vs.hlsl +++ b/neo/shaders/builtin/fog/blendLight.vs.hlsl @@ -36,14 +36,12 @@ StructuredBuffer matrices: register(t11); struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; -#if USE_GPU_SKINNING - float4 color2 : COLOR1; -#endif + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT diff --git a/neo/shaders/builtin/fog/fog.ps.hlsl b/neo/shaders/builtin/fog/fog.ps.hlsl index 3563b309..a050d34a 100644 --- a/neo/shaders/builtin/fog/fog.ps.hlsl +++ b/neo/shaders/builtin/fog/fog.ps.hlsl @@ -31,19 +31,21 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -Texture2D t_Fog1 : register( t0 VK_DESCRIPTOR_SET( 0 ) ); -Texture2D t_Fog2 : register( t1 VK_DESCRIPTOR_SET( 0 ) ); +Texture2D t_Fog1 : register( t0 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_Fog2 : register( t1 VK_DESCRIPTOR_SET( 1 ) ); -SamplerState samp0 : register(s0 VK_DESCRIPTOR_SET( 1 ) ); -SamplerState samp1 : register(s1 VK_DESCRIPTOR_SET( 1 ) ); +SamplerState samp0 : register(s0 VK_DESCRIPTOR_SET( 2 ) ); +SamplerState samp1 : register(s1 VK_DESCRIPTOR_SET( 2 ) ); -struct PS_IN { +struct PS_IN +{ float4 position : SV_Position; float2 texcoord0 : TEXCOORD0_centroid; float2 texcoord1 : TEXCOORD1_centroid; }; -struct PS_OUT { +struct PS_OUT +{ float4 color : SV_Target0; }; // *INDENT-ON* diff --git a/neo/shaders/builtin/fog/fog.vs.hlsl b/neo/shaders/builtin/fog/fog.vs.hlsl index 441dad2a..7118650e 100644 --- a/neo/shaders/builtin/fog/fog.vs.hlsl +++ b/neo/shaders/builtin/fog/fog.vs.hlsl @@ -36,14 +36,12 @@ StructuredBuffer matrices: register(t11); struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; -#if USE_GPU_SKINNING - float4 color2 : COLOR1; -#endif + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT diff --git a/neo/shaders/builtin/gbuffer.ps.hlsl b/neo/shaders/builtin/gbuffer.ps.hlsl index 96c93400..806bf961 100644 --- a/neo/shaders/builtin/gbuffer.ps.hlsl +++ b/neo/shaders/builtin/gbuffer.ps.hlsl @@ -31,8 +31,8 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -Texture2D t_NormalMap : register( t0 VK_DESCRIPTOR_SET( 0 ) ); -SamplerState s_Sampler : register( s0 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_NormalMap : register( t0 VK_DESCRIPTOR_SET( 1 ) ); +SamplerState s_Sampler : register( s0 VK_DESCRIPTOR_SET( 2 ) ); struct PS_IN { diff --git a/neo/shaders/builtin/gbuffer.vs.hlsl b/neo/shaders/builtin/gbuffer.vs.hlsl index 1f97c9e3..ed8271a4 100644 --- a/neo/shaders/builtin/gbuffer.vs.hlsl +++ b/neo/shaders/builtin/gbuffer.vs.hlsl @@ -36,12 +36,12 @@ StructuredBuffer matrices : register( t11 ); struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; - float4 color2 : COLOR1; + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT diff --git a/neo/shaders/builtin/gui.ps.hlsl b/neo/shaders/builtin/gui.ps.hlsl index 50bd43af..147eb5c0 100644 --- a/neo/shaders/builtin/gui.ps.hlsl +++ b/neo/shaders/builtin/gui.ps.hlsl @@ -29,8 +29,8 @@ If you have questions concerning this license or the applicable additional terms #include "global_inc.hlsl" // *INDENT-OFF* -Texture2D texGui : register( t0 VK_DESCRIPTOR_SET( 0 ) ); -SamplerState samp0 : register( s0 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D texGui : register( t0 VK_DESCRIPTOR_SET( 1 ) ); +SamplerState samp0 : register( s0 VK_DESCRIPTOR_SET( 2 ) ); struct PS_IN { float4 position : SV_POSITION; diff --git a/neo/shaders/builtin/gui.vs.hlsl b/neo/shaders/builtin/gui.vs.hlsl index 24ae0269..f356cb43 100644 --- a/neo/shaders/builtin/gui.vs.hlsl +++ b/neo/shaders/builtin/gui.vs.hlsl @@ -30,9 +30,12 @@ If you have questions concerning this license or the applicable additional terms #include // *INDENT-OFF* -struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; +struct VS_IN +{ + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; float4 color : COLOR0; float4 color2 : COLOR1; }; diff --git a/neo/shaders/builtin/legacy/bumpyenvironment.vs.hlsl b/neo/shaders/builtin/legacy/bumpyenvironment.vs.hlsl index 40d8477a..803e2713 100644 --- a/neo/shaders/builtin/legacy/bumpyenvironment.vs.hlsl +++ b/neo/shaders/builtin/legacy/bumpyenvironment.vs.hlsl @@ -35,14 +35,12 @@ StructuredBuffer matrices : register(t11); struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; -#if USE_GPU_SKINNING - float4 color2 : COLOR1; -#endif + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT diff --git a/neo/shaders/builtin/legacy/bumpyenvironment_skinned.ps.hlsl b/neo/shaders/builtin/legacy/bumpyenvironment_skinned.ps.hlsl deleted file mode 100644 index 11366f38..00000000 --- a/neo/shaders/builtin/legacy/bumpyenvironment_skinned.ps.hlsl +++ /dev/null @@ -1,81 +0,0 @@ -/* -=========================================================================== - -Doom 3 BFG Edition GPL Source Code -Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. -Copyright (C) 2013 Robert Beckebans - -This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). - -Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Doom 3 BFG Edition Source Code. If not, see . - -In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. - -If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - -=========================================================================== -*/ - -#include "global_inc.hlsl" - - -// *INDENT-OFF* -TextureCube t_CubeMap : register( t0 ); -Texture2D t_NormalMap : register( t1 ); - -SamplerState samp0 : register( s0 ); - -struct PS_IN { - float4 position : SV_Position; - float2 texcoord0 : TEXCOORD0_centroid; - float3 texcoord1 : TEXCOORD1_centroid; - float3 texcoord2 : TEXCOORD2_centroid; - float3 texcoord3 : TEXCOORD3_centroid; - float3 texcoord4 : TEXCOORD4_centroid; - float4 color : COLOR0; -}; - -struct PS_OUT { - float4 color : SV_Target0; -}; -// *INDENT-ON* - -void main( PS_IN fragment, out PS_OUT result ) -{ - float4 bump = t_NormalMap.Sample( samp0, fragment.texcoord0 ) * 2.0f - 1.0f; - - // RB begin - float3 localNormal; -#if defined(GLES2) - localNormal = float3( bump.rg, 0.0f ); -#else - localNormal = float3( bump.wy, 0.0f ); -#endif - // RB end - localNormal.z = sqrt( 1.0f - dot3( localNormal, localNormal ) ); - - float3 globalNormal; - globalNormal.x = dot3( localNormal, fragment.texcoord2 ); - globalNormal.y = dot3( localNormal, fragment.texcoord3 ); - globalNormal.z = dot3( localNormal, fragment.texcoord4 ); - - float3 globalEye = normalize( fragment.texcoord1 ); - - float3 reflectionVector = globalNormal * dot3( globalEye, globalNormal ); - reflectionVector = ( reflectionVector * 2.0f ) - globalEye; - - float4 envMap = t_CubeMap.Sample( samp0, reflectionVector ); - - result.color = float4( sRGBToLinearRGB( envMap.xyz ), 1.0f ) * fragment.color; -} diff --git a/neo/shaders/builtin/legacy/bumpyenvironment_skinned.vs.hlsl b/neo/shaders/builtin/legacy/bumpyenvironment_skinned.vs.hlsl deleted file mode 100644 index 40b4f106..00000000 --- a/neo/shaders/builtin/legacy/bumpyenvironment_skinned.vs.hlsl +++ /dev/null @@ -1,141 +0,0 @@ -/* -=========================================================================== - -Doom 3 BFG Edition GPL Source Code -Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. -Copyright (C) 2014 Robert Beckebans - -This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). - -Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Doom 3 BFG Edition Source Code. If not, see . - -In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. - -If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - -=========================================================================== -*/ - -#include "global_inc.hlsl" - - -// *INDENT-OFF* - -struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; - float4 color2 : COLOR1; -}; - -struct VS_OUT { - float4 position : POSITION; - float2 texcoord0 : TEXCOORD0; - float3 texcoord1 : TEXCOORD1; - float3 texcoord2 : TEXCOORD2; - float3 texcoord3 : TEXCOORD3; - float3 texcoord4 : TEXCOORD4; - float4 color : COLOR0; -}; -// *INDENT-ON* - -void main( VS_IN vertex, out VS_OUT result ) -{ - float4 vNormal = vertex.normal * 2.0 - 1.0; - float4 vTangent = vertex.tangent * 2.0 - 1.0; - float3 vBinormal = cross( vNormal.xyz, vTangent.xyz ) * vTangent.w; - - //-------------------------------------------------------------- - // GPU transformation of the normal / binormal / bitangent - // - // multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 ) - //-------------------------------------------------------------- - const float w0 = vertex.color2.x; - const float w1 = vertex.color2.y; - const float w2 = vertex.color2.z; - const float w3 = vertex.color2.w; - - float4 matX, matY, matZ; // must be float4 for vec4 - int joint = int( vertex.color.x * 255.1 * 3.0 ); - matX = matrices[int( joint + 0 )] * w0; - matY = matrices[int( joint + 1 )] * w0; - matZ = matrices[int( joint + 2 )] * w0; - - joint = int( vertex.color.y * 255.1 * 3.0 ); - matX += matrices[int( joint + 0 )] * w1; - matY += matrices[int( joint + 1 )] * w1; - matZ += matrices[int( joint + 2 )] * w1; - - joint = int( vertex.color.z * 255.1 * 3.0 ); - matX += matrices[int( joint + 0 )] * w2; - matY += matrices[int( joint + 1 )] * w2; - matZ += matrices[int( joint + 2 )] * w2; - - joint = int( vertex.color.w * 255.1 * 3.0 ); - matX += matrices[int( joint + 0 )] * w3; - matY += matrices[int( joint + 1 )] * w3; - matZ += matrices[int( joint + 2 )] * w3; - - float3 normal; - normal.x = dot3( matX, vNormal ); - normal.y = dot3( matY, vNormal ); - normal.z = dot3( matZ, vNormal ); - normal = normalize( normal ); - - float3 tangent; - tangent.x = dot3( matX, vTangent ); - tangent.y = dot3( matY, vTangent ); - tangent.z = dot3( matZ, vTangent ); - tangent = normalize( tangent ); - - float3 binormal; - binormal.x = dot3( matX, vBinormal ); - binormal.y = dot3( matY, vBinormal ); - binormal.z = dot3( matZ, vBinormal ); - binormal = normalize( binormal ); - - float4 modelPosition; - modelPosition.x = dot4( matX, vertex.position ); - modelPosition.y = dot4( matY, vertex.position ); - modelPosition.z = dot4( matZ, vertex.position ); - modelPosition.w = 1.0; - - result.position.x = dot4( modelPosition, rpMVPmatrixX ); - result.position.y = dot4( modelPosition, rpMVPmatrixY ); - result.position.z = dot4( modelPosition, rpMVPmatrixZ ); - result.position.w = dot4( modelPosition, rpMVPmatrixW ); - - result.texcoord0 = vertex.texcoord.xy; - - float4 toEye = rpLocalViewOrigin - modelPosition; - result.texcoord1.x = dot3( toEye, rpModelMatrixX ); - result.texcoord1.y = dot3( toEye, rpModelMatrixY ); - result.texcoord1.z = dot3( toEye, rpModelMatrixZ ); - - result.texcoord2.x = dot3( tangent, rpModelMatrixX ); - result.texcoord3.x = dot3( tangent, rpModelMatrixY ); - result.texcoord4.x = dot3( tangent, rpModelMatrixZ ); - - result.texcoord2.y = dot3( binormal, rpModelMatrixX ); - result.texcoord3.y = dot3( binormal, rpModelMatrixY ); - result.texcoord4.y = dot3( binormal, rpModelMatrixZ ); - - result.texcoord2.z = dot3( normal, rpModelMatrixX ); - result.texcoord3.z = dot3( normal, rpModelMatrixY ); - result.texcoord4.z = dot3( normal, rpModelMatrixZ ); - - result.color = rpColor; -} \ No newline at end of file diff --git a/neo/shaders/builtin/legacy/environment.ps.hlsl b/neo/shaders/builtin/legacy/environment.ps.hlsl index 75c84a69..a31f56f8 100644 --- a/neo/shaders/builtin/legacy/environment.ps.hlsl +++ b/neo/shaders/builtin/legacy/environment.ps.hlsl @@ -33,14 +33,16 @@ If you have questions concerning this license or the applicable additional terms TextureCube t_CubeMap : register( t0 VK_DESCRIPTOR_SET( 1 ) ); SamplerState samp0 : register( s0 VK_DESCRIPTOR_SET( 2 ) ); // texture 0 is the cube map -struct PS_IN { +struct PS_IN +{ float4 position : SV_Position; float3 texcoord0 : TEXCOORD0_centroid; float3 texcoord1 : TEXCOORD1_centroid; float4 color : COLOR0; }; -struct PS_OUT { +struct PS_OUT +{ float4 color : SV_Target; }; // *INDENT-ON* diff --git a/neo/shaders/builtin/legacy/environment.vs.hlsl b/neo/shaders/builtin/legacy/environment.vs.hlsl index 8eadde1a..4cb9f31c 100644 --- a/neo/shaders/builtin/legacy/environment.vs.hlsl +++ b/neo/shaders/builtin/legacy/environment.vs.hlsl @@ -35,12 +35,12 @@ StructuredBuffer matrices : register(t11); struct VS_IN { - float4 position : POSITION; - float4 normal : NORMAL; - float4 color : COLOR0; -#if USE_GPU_SKINNING - float4 color2 : COLOR1; -#endif + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT diff --git a/neo/shaders/builtin/legacy/environment_skinned.ps.hlsl b/neo/shaders/builtin/legacy/environment_skinned.ps.hlsl deleted file mode 100644 index 94309f9b..00000000 --- a/neo/shaders/builtin/legacy/environment_skinned.ps.hlsl +++ /dev/null @@ -1,60 +0,0 @@ -/* -=========================================================================== - -Doom 3 BFG Edition GPL Source Code -Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. - -This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). - -Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Doom 3 BFG Edition Source Code. If not, see . - -In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. - -If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - -=========================================================================== -*/ - -#include "global_inc.hlsl" - - -// *INDENT-OFF* -uniform samplerCUBE samp0 : register(s0); // texture 0 is the cube map - -struct PS_IN { - float4 position : VPOS; - float3 texcoord0 : TEXCOORD0_centroid; - float3 texcoord1 : TEXCOORD1_centroid; - float4 color : COLOR0; -}; - -struct PS_OUT { - float4 color : COLOR; -}; -// *INDENT-ON* - -void main( PS_IN fragment, out PS_OUT result ) -{ - - float3 globalNormal = normalize( fragment.texcoord1 ); - float3 globalEye = normalize( fragment.texcoord0 ); - - float3 reflectionVector = _float3( dot3( globalEye, globalNormal ) ); - reflectionVector *= globalNormal; - reflectionVector = ( reflectionVector * 2.0f ) - globalEye; - - float4 envMap = texCUBE( samp0, reflectionVector ); - - result.color = float4( sRGBToLinearRGB( envMap.xyz ), 1.0f ) * fragment.color; -} diff --git a/neo/shaders/builtin/legacy/environment_skinned.vs.hlsl b/neo/shaders/builtin/legacy/environment_skinned.vs.hlsl deleted file mode 100644 index 2db2c7a3..00000000 --- a/neo/shaders/builtin/legacy/environment_skinned.vs.hlsl +++ /dev/null @@ -1,111 +0,0 @@ -/* -=========================================================================== - -Doom 3 BFG Edition GPL Source Code -Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. -Copyright (C) 2014 Robert Beckebans - -This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). - -Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Doom 3 BFG Edition Source Code. If not, see . - -In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. - -If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - -=========================================================================== -*/ - -#include "global_inc.hlsl" - - -uniform matrices_ubo { float4 matrices[408]; }; - -// *INDENT-OFF* -struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; - float4 color2 : COLOR1; -}; - -struct VS_OUT { - float4 position : POSITION; - float3 texcoord0 : TEXCOORD0; - float3 texcoord1 : TEXCOORD1; - float4 color : COLOR0; -}; -// *INDENT-ON* - -void main( VS_IN vertex, out VS_OUT result ) -{ - float4 vNormal = vertex.normal * 2.0 - 1.0; - - //-------------------------------------------------------------- - // GPU transformation of the normal / binormal / bitangent - // - // multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 ) - //-------------------------------------------------------------- - const float w0 = vertex.color2.x; - const float w1 = vertex.color2.y; - const float w2 = vertex.color2.z; - const float w3 = vertex.color2.w; - - float4 matX, matY, matZ; // must be float4 for vec4 - int joint = int( vertex.color.x * 255.1 * 3.0 ); - matX = matrices[int( joint + 0 )] * w0; - matY = matrices[int( joint + 1 )] * w0; - matZ = matrices[int( joint + 2 )] * w0; - - joint = int( vertex.color.y * 255.1 * 3.0 ); - matX += matrices[int( joint + 0 )] * w1; - matY += matrices[int( joint + 1 )] * w1; - matZ += matrices[int( joint + 2 )] * w1; - - joint = int( vertex.color.z * 255.1 * 3.0 ); - matX += matrices[int( joint + 0 )] * w2; - matY += matrices[int( joint + 1 )] * w2; - matZ += matrices[int( joint + 2 )] * w2; - - joint = int( vertex.color.w * 255.1 * 3.0 ); - matX += matrices[int( joint + 0 )] * w3; - matY += matrices[int( joint + 1 )] * w3; - matZ += matrices[int( joint + 2 )] * w3; - - float3 vNormalSkinned; - vNormalSkinned.x = dot3( matX, vNormal ); - vNormalSkinned.y = dot3( matY, vNormal ); - vNormalSkinned.z = dot3( matZ, vNormal ); - vNormalSkinned = normalize( vNormalSkinned ); - - float4 modelPosition; - modelPosition.x = dot4( matX, vertex.position ); - modelPosition.y = dot4( matY, vertex.position ); - modelPosition.z = dot4( matZ, vertex.position ); - modelPosition.w = 1.0; - - result.position.x = dot4( modelPosition, rpMVPmatrixX ); - result.position.y = dot4( modelPosition, rpMVPmatrixY ); - result.position.z = dot4( modelPosition, rpMVPmatrixZ ); - result.position.w = dot4( modelPosition, rpMVPmatrixW ); - - float4 toEye = rpLocalViewOrigin - modelPosition; - - result.texcoord0 = toEye.xyz; - result.texcoord1 = vNormalSkinned.xyz; - - result.color = rpColor; -} diff --git a/neo/shaders/builtin/legacy/skybox.ps.hlsl b/neo/shaders/builtin/legacy/skybox.ps.hlsl index 2689dcfe..60da70f4 100644 --- a/neo/shaders/builtin/legacy/skybox.ps.hlsl +++ b/neo/shaders/builtin/legacy/skybox.ps.hlsl @@ -30,16 +30,18 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -TextureCube tex : register( t0 ); -SamplerState samp0 : register(s0); +TextureCube tex : register( t0 VK_DESCRIPTOR_SET( 1 ) ); +SamplerState samp0 : register( s0 VK_DESCRIPTOR_SET( 2 ) ); -struct PS_IN { +struct PS_IN +{ float4 position : SV_Position; float3 texcoord0 : TEXCOORD0_centroid; float4 color : COLOR0; }; -struct PS_OUT { +struct PS_OUT +{ float4 color : SV_Target0; }; // *INDENT-ON* diff --git a/neo/shaders/builtin/legacy/skybox.vs.hlsl b/neo/shaders/builtin/legacy/skybox.vs.hlsl index ce9e8823..b642b04d 100644 --- a/neo/shaders/builtin/legacy/skybox.vs.hlsl +++ b/neo/shaders/builtin/legacy/skybox.vs.hlsl @@ -30,12 +30,14 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; +struct VS_IN +{ + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT { diff --git a/neo/shaders/builtin/legacy/wobblesky.ps.hlsl b/neo/shaders/builtin/legacy/wobblesky.ps.hlsl index debf171d..4f7b0d95 100644 --- a/neo/shaders/builtin/legacy/wobblesky.ps.hlsl +++ b/neo/shaders/builtin/legacy/wobblesky.ps.hlsl @@ -31,16 +31,18 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -TextureCube tex : register( t0 ); -SamplerState samp0 : register( s0 ); +TextureCube tex : register( t0 VK_DESCRIPTOR_SET( 1 ) ); +SamplerState samp0 : register( s0 VK_DESCRIPTOR_SET( 2 ) ); -struct PS_IN { +struct PS_IN +{ float4 position : SV_Position; float3 texcoord0 : TEXCOORD0_centroid; float4 color : COLOR0; }; -struct PS_OUT { +struct PS_OUT +{ float4 color : SV_Target0; }; // *INDENT-ON* diff --git a/neo/shaders/builtin/legacy/wobblesky.vs.hlsl b/neo/shaders/builtin/legacy/wobblesky.vs.hlsl index 9d128b3c..be44c459 100644 --- a/neo/shaders/builtin/legacy/wobblesky.vs.hlsl +++ b/neo/shaders/builtin/legacy/wobblesky.vs.hlsl @@ -30,15 +30,18 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; +struct VS_IN +{ + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; -struct VS_OUT { +struct VS_OUT +{ float4 position : SV_Position; float3 texcoord0 : TEXCOORD0_centroid; float4 color : COLOR0; diff --git a/neo/shaders/builtin/lighting/ambient_lightgrid_IBL.ps.hlsl b/neo/shaders/builtin/lighting/ambient_lightgrid_IBL.ps.hlsl index daeacc4f..b700b794 100644 --- a/neo/shaders/builtin/lighting/ambient_lightgrid_IBL.ps.hlsl +++ b/neo/shaders/builtin/lighting/ambient_lightgrid_IBL.ps.hlsl @@ -32,20 +32,20 @@ If you have questions concerning this license or the applicable additional terms #include "BRDF.inc.hlsl" // *INDENT-OFF* -Texture2D t_Normal : register( t0 VK_DESCRIPTOR_SET( 0 ) ); -Texture2D t_Specular : register( t1 VK_DESCRIPTOR_SET( 0 ) ); -Texture2D t_BaseColor : register( t2 VK_DESCRIPTOR_SET( 0 ) ); +Texture2D t_Normal : register( t0 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_Specular : register( t1 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_BaseColor : register( t2 VK_DESCRIPTOR_SET( 1 ) ); -Texture2D t_BrdfLut : register( t3 VK_DESCRIPTOR_SET( 1 ) ); -Texture2D t_Ssao : register( t4 VK_DESCRIPTOR_SET( 1 ) ); -Texture2D t_IrradianceCubeMap : register( t7 VK_DESCRIPTOR_SET( 1 ) ); -Texture2D t_RadianceCubeMap1 : register( t8 VK_DESCRIPTOR_SET( 1 ) ); -Texture2D t_RadianceCubeMap2 : register( t9 VK_DESCRIPTOR_SET( 1 ) ); -Texture2D t_RadianceCubeMap3 : register( t10 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_BrdfLut : register( t3 VK_DESCRIPTOR_SET( 2 ) ); +Texture2D t_Ssao : register( t4 VK_DESCRIPTOR_SET( 2 ) ); +Texture2D t_IrradianceCubeMap : register( t7 VK_DESCRIPTOR_SET( 2 ) ); +Texture2D t_RadianceCubeMap1 : register( t8 VK_DESCRIPTOR_SET( 2 ) ); +Texture2D t_RadianceCubeMap2 : register( t9 VK_DESCRIPTOR_SET( 2 ) ); +Texture2D t_RadianceCubeMap3 : register( t10 VK_DESCRIPTOR_SET( 2 ) ); -SamplerState s_Material : register( s0 VK_DESCRIPTOR_SET( 2 ) ); // (Wrap) Anisotropic sampler: normal sampler & specular sampler -SamplerState s_LinearClamp : register( s1 VK_DESCRIPTOR_SET( 2 ) ); // (Clamp) Linear sampler: brdf lut sampler & ssao sampler -//SamplerState s_Light : register( s2 VK_DESCRIPTOR_SET( 1 )); // (Clamp) Anisotropic sampler: irradiance, radiance 1, 2 and 3. +SamplerState s_Material : register( s0 VK_DESCRIPTOR_SET( 3 ) ); // (Wrap) Anisotropic sampler: normal sampler & specular sampler +SamplerState s_LinearClamp : register( s1 VK_DESCRIPTOR_SET( 3 ) ); // (Clamp) Linear sampler: brdf lut sampler & ssao sampler +//SamplerState s_Light : register( s2 VK_DESCRIPTOR_SET( 3 )); // (Clamp) Anisotropic sampler: irradiance, radiance 1, 2 and 3. struct PS_IN { diff --git a/neo/shaders/builtin/lighting/ambient_lightgrid_IBL.vs.hlsl b/neo/shaders/builtin/lighting/ambient_lightgrid_IBL.vs.hlsl index 4a425e9b..c1246f1f 100644 --- a/neo/shaders/builtin/lighting/ambient_lightgrid_IBL.vs.hlsl +++ b/neo/shaders/builtin/lighting/ambient_lightgrid_IBL.vs.hlsl @@ -36,14 +36,14 @@ StructuredBuffer matrices: register(t11); #endif // *INDENT-OFF* -struct VS_IN +struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; - float4 color2 : COLOR1; + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT diff --git a/neo/shaders/builtin/lighting/ambient_lighting_IBL.ps.hlsl b/neo/shaders/builtin/lighting/ambient_lighting_IBL.ps.hlsl index 2a8e4f10..589e7ed3 100644 --- a/neo/shaders/builtin/lighting/ambient_lighting_IBL.ps.hlsl +++ b/neo/shaders/builtin/lighting/ambient_lighting_IBL.ps.hlsl @@ -33,20 +33,20 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -Texture2D t_Normal : register( t0 VK_DESCRIPTOR_SET( 0 ) ); -Texture2D t_Specular : register( t1 VK_DESCRIPTOR_SET( 0 ) ); -Texture2D t_BaseColor : register( t2 VK_DESCRIPTOR_SET( 0 ) ); +Texture2D t_Normal : register( t0 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_Specular : register( t1 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_BaseColor : register( t2 VK_DESCRIPTOR_SET( 1 ) ); -Texture2D t_BrdfLut : register( t3 VK_DESCRIPTOR_SET( 1 ) ); -Texture2D t_Ssao : register( t4 VK_DESCRIPTOR_SET( 1 ) ); -Texture2D t_IrradianceCubeMap : register( t7 VK_DESCRIPTOR_SET( 1 ) ); -Texture2D t_RadianceCubeMap1 : register( t8 VK_DESCRIPTOR_SET( 1 ) ); -Texture2D t_RadianceCubeMap2 : register( t9 VK_DESCRIPTOR_SET( 1 ) ); -Texture2D t_RadianceCubeMap3 : register( t10 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_BrdfLut : register( t3 VK_DESCRIPTOR_SET( 2 ) ); +Texture2D t_Ssao : register( t4 VK_DESCRIPTOR_SET( 2 ) ); +Texture2D t_IrradianceCubeMap : register( t7 VK_DESCRIPTOR_SET( 2 ) ); +Texture2D t_RadianceCubeMap1 : register( t8 VK_DESCRIPTOR_SET( 2 ) ); +Texture2D t_RadianceCubeMap2 : register( t9 VK_DESCRIPTOR_SET( 2 ) ); +Texture2D t_RadianceCubeMap3 : register( t10 VK_DESCRIPTOR_SET( 2 ) ); -SamplerState s_Material : register( s0 VK_DESCRIPTOR_SET( 2 ) ); // (Wrap) Anisotropic sampler: normal sampler & specular sampler -SamplerState s_LinearClamp : register( s1 VK_DESCRIPTOR_SET( 2 ) ); // (Clamp) Linear sampler: brdf lut sampler & ssao sampler -//SamplerState s_Light : register( s2 VK_DESCRIPTOR_SET( 2 )); // (Clamp) Anisotropic sampler: irradiance, radiance 1, 2 and 3. +SamplerState s_Material : register( s0 VK_DESCRIPTOR_SET( 3 ) ); // (Wrap) Anisotropic sampler: normal sampler & specular sampler +SamplerState s_LinearClamp : register( s1 VK_DESCRIPTOR_SET( 3 ) ); // (Clamp) Linear sampler: brdf lut sampler & ssao sampler +//SamplerState s_Light : register( s2 VK_DESCRIPTOR_SET( 3 )); // (Clamp) Anisotropic sampler: irradiance, radiance 1, 2 and 3. struct PS_IN { diff --git a/neo/shaders/builtin/lighting/ambient_lighting_IBL.vs.hlsl b/neo/shaders/builtin/lighting/ambient_lighting_IBL.vs.hlsl index dac791d0..28befa53 100644 --- a/neo/shaders/builtin/lighting/ambient_lighting_IBL.vs.hlsl +++ b/neo/shaders/builtin/lighting/ambient_lighting_IBL.vs.hlsl @@ -35,14 +35,14 @@ If you have questions concerning this license or the applicable additional terms StructuredBuffer matrices: register(t11); #endif -struct VS_IN +struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; - float4 color2 : COLOR1; + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT diff --git a/neo/shaders/builtin/lighting/interaction.ps.hlsl b/neo/shaders/builtin/lighting/interaction.ps.hlsl index 581b6169..23ea32a0 100644 --- a/neo/shaders/builtin/lighting/interaction.ps.hlsl +++ b/neo/shaders/builtin/lighting/interaction.ps.hlsl @@ -32,15 +32,15 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -Texture2D t_Normal : register( t0 VK_DESCRIPTOR_SET( 0 ) ); -Texture2D t_Specular : register( t1 VK_DESCRIPTOR_SET( 0 ) ); -Texture2D t_BaseColor : register( t2 VK_DESCRIPTOR_SET( 0 ) ); +Texture2D t_Normal : register( t0 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_Specular : register( t1 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_BaseColor : register( t2 VK_DESCRIPTOR_SET( 1 ) ); -Texture2D t_LightFalloff : register( t3 VK_DESCRIPTOR_SET( 1 ) ); -Texture2D t_LightProjection : register( t4 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_LightFalloff : register( t3 VK_DESCRIPTOR_SET( 2 ) ); +Texture2D t_LightProjection : register( t4 VK_DESCRIPTOR_SET( 2 ) ); -SamplerState s_Material : register( s0 VK_DESCRIPTOR_SET( 2 ) ); // for the normal/specular/basecolor -SamplerState s_Lighting : register( s1 VK_DESCRIPTOR_SET( 2 ) ); // for sampling the jitter +SamplerState s_Material : register( s0 VK_DESCRIPTOR_SET( 3 ) ); // for the normal/specular/basecolor +SamplerState s_Lighting : register( s1 VK_DESCRIPTOR_SET( 3 ) ); // for sampling the jitter struct PS_IN { diff --git a/neo/shaders/builtin/lighting/interaction.vs.hlsl b/neo/shaders/builtin/lighting/interaction.vs.hlsl index 03d7ac08..be528720 100644 --- a/neo/shaders/builtin/lighting/interaction.vs.hlsl +++ b/neo/shaders/builtin/lighting/interaction.vs.hlsl @@ -34,14 +34,14 @@ If you have questions concerning this license or the applicable additional terms StructuredBuffer matrices: register(t11); #endif -struct VS_IN +struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; - float4 color2 : COLOR1; + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT diff --git a/neo/shaders/builtin/lighting/interactionAmbient.ps.hlsl b/neo/shaders/builtin/lighting/interactionAmbient.ps.hlsl index 28fad22d..487a482a 100644 --- a/neo/shaders/builtin/lighting/interactionAmbient.ps.hlsl +++ b/neo/shaders/builtin/lighting/interactionAmbient.ps.hlsl @@ -31,15 +31,15 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -Texture2D t_Normal : register( t0 VK_DESCRIPTOR_SET( 0 ) ); -Texture2D t_Specular : register( t1 VK_DESCRIPTOR_SET( 0 ) ); -Texture2D t_BaseColor : register( t2 VK_DESCRIPTOR_SET( 0 ) ); +Texture2D t_Normal : register( t0 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_Specular : register( t1 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_BaseColor : register( t2 VK_DESCRIPTOR_SET( 1 ) ); -Texture2D t_LightFalloff : register( t3 VK_DESCRIPTOR_SET( 1 ) ); -Texture2D t_LightProjection : register( t4 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_LightFalloff : register( t3 VK_DESCRIPTOR_SET( 2 ) ); +Texture2D t_LightProjection : register( t4 VK_DESCRIPTOR_SET( 2 ) ); -SamplerState s_Material : register( s0 VK_DESCRIPTOR_SET( 2 ) ); // for the normal/specular/basecolor -SamplerState s_Lighting : register( s1 VK_DESCRIPTOR_SET( 2 ) ); // for sampling the jitter +SamplerState s_Material : register( s0 VK_DESCRIPTOR_SET( 3 ) ); // for the normal/specular/basecolor +SamplerState s_Lighting : register( s1 VK_DESCRIPTOR_SET( 3 ) ); // for sampling the jitter struct PS_IN { diff --git a/neo/shaders/builtin/lighting/interactionAmbient.vs.hlsl b/neo/shaders/builtin/lighting/interactionAmbient.vs.hlsl index bafcbd30..7682eab2 100644 --- a/neo/shaders/builtin/lighting/interactionAmbient.vs.hlsl +++ b/neo/shaders/builtin/lighting/interactionAmbient.vs.hlsl @@ -35,12 +35,12 @@ StructuredBuffer matrices: register(t11); struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; - float4 color2 : COLOR1; + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT diff --git a/neo/shaders/builtin/lighting/interactionSM.ps.hlsl b/neo/shaders/builtin/lighting/interactionSM.ps.hlsl index d15d78f0..3023de85 100644 --- a/neo/shaders/builtin/lighting/interactionSM.ps.hlsl +++ b/neo/shaders/builtin/lighting/interactionSM.ps.hlsl @@ -33,23 +33,23 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -Texture2D t_Normal : register( t0 VK_DESCRIPTOR_SET( 0 ) ); -Texture2D t_Specular : register( t1 VK_DESCRIPTOR_SET( 0 ) ); -Texture2D t_BaseColor : register( t2 VK_DESCRIPTOR_SET( 0 ) ); +Texture2D t_Normal : register( t0 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_Specular : register( t1 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_BaseColor : register( t2 VK_DESCRIPTOR_SET( 1 ) ); -Texture2D t_LightFalloff : register( t3 VK_DESCRIPTOR_SET( 1 ) ); -Texture2D t_LightProjection : register( t4 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_LightFalloff : register( t3 VK_DESCRIPTOR_SET( 2 ) ); +Texture2D t_LightProjection : register( t4 VK_DESCRIPTOR_SET( 2 ) ); #if USE_SHADOW_ATLAS -Texture2D t_ShadowAtlas : register( t5 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_ShadowAtlas : register( t5 VK_DESCRIPTOR_SET( 2 ) ); #else -Texture2DArray t_ShadowMapArray : register( t5 VK_DESCRIPTOR_SET( 1 ) ); +Texture2DArray t_ShadowMapArray : register( t5 VK_DESCRIPTOR_SET( 2 ) ); #endif -Texture2D t_Jitter : register( t6 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_Jitter : register( t6 VK_DESCRIPTOR_SET( 2 ) ); -SamplerState s_Material : register( s0 VK_DESCRIPTOR_SET( 2 ) ); // for the normal/specular/basecolor -SamplerState s_Lighting : register( s1 VK_DESCRIPTOR_SET( 2 ) ); // for sampling the jitter -SamplerComparisonState s_Shadow : register( s2 VK_DESCRIPTOR_SET( 2 ) ); // for the depth shadow map sampler with a compare function -SamplerState s_Jitter : register( s3 VK_DESCRIPTOR_SET( 2 ) ); // for sampling the jitter +SamplerState s_Material : register( s0 VK_DESCRIPTOR_SET( 3 ) ); // for the normal/specular/basecolor +SamplerState s_Lighting : register( s1 VK_DESCRIPTOR_SET( 3 ) ); // for sampling the jitter +SamplerComparisonState s_Shadow : register( s2 VK_DESCRIPTOR_SET( 3 ) ); // for the depth shadow map sampler with a compare function +SamplerState s_Jitter : register( s3 VK_DESCRIPTOR_SET( 3 ) ); // for sampling the jitter struct PS_IN { diff --git a/neo/shaders/builtin/lighting/interactionSM.vs.hlsl b/neo/shaders/builtin/lighting/interactionSM.vs.hlsl index cfae79df..1e3f1bad 100644 --- a/neo/shaders/builtin/lighting/interactionSM.vs.hlsl +++ b/neo/shaders/builtin/lighting/interactionSM.vs.hlsl @@ -34,10 +34,10 @@ If you have questions concerning this license or the applicable additional terms StructuredBuffer matrices: register(t11); #endif -struct VS_IN +struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; + float4 position : POSITION; + float2 texcoord : TEXCOORD0; float4 normal : NORMAL; float4 tangent : TANGENT; float4 color : COLOR0; diff --git a/neo/shaders/builtin/post/SMAA_blending_weight_calc.ps.hlsl b/neo/shaders/builtin/post/SMAA_blending_weight_calc.ps.hlsl index 52c06323..aa861daa 100644 --- a/neo/shaders/builtin/post/SMAA_blending_weight_calc.ps.hlsl +++ b/neo/shaders/builtin/post/SMAA_blending_weight_calc.ps.hlsl @@ -36,12 +36,12 @@ If you have questions concerning this license or the applicable additional terms #include "SMAA.inc.hlsl" // *INDENT-OFF* -Texture2D t_SmaaEdges : register( t0 ); -Texture2D t_SmaaArea : register( t1 ); -Texture2D t_SmaaSearch : register( t2 ); +Texture2D t_SmaaEdges : register( t0 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_SmaaArea : register( t1 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_SmaaSearch : register( t2 VK_DESCRIPTOR_SET( 1 ) ); -SamplerState LinearSampler : register( s0 ); -SamplerState PointSampler : register( s1 ); +SamplerState LinearSampler : register( s0 VK_DESCRIPTOR_SET( 2 ) ); +SamplerState PointSampler : register( s1 VK_DESCRIPTOR_SET( 2 ) ); struct PS_IN { diff --git a/neo/shaders/builtin/post/SMAA_blending_weight_calc.vs.hlsl b/neo/shaders/builtin/post/SMAA_blending_weight_calc.vs.hlsl index 113e0f5c..af7f3765 100644 --- a/neo/shaders/builtin/post/SMAA_blending_weight_calc.vs.hlsl +++ b/neo/shaders/builtin/post/SMAA_blending_weight_calc.vs.hlsl @@ -36,13 +36,14 @@ If you have questions concerning this license or the applicable additional terms #include "SMAA.inc.hlsl" // *INDENT-OFF* -struct VS_IN +struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT diff --git a/neo/shaders/builtin/post/SMAA_edge_detection.ps.hlsl b/neo/shaders/builtin/post/SMAA_edge_detection.ps.hlsl index e93ab98b..984b5679 100644 --- a/neo/shaders/builtin/post/SMAA_edge_detection.ps.hlsl +++ b/neo/shaders/builtin/post/SMAA_edge_detection.ps.hlsl @@ -36,8 +36,9 @@ If you have questions concerning this license or the applicable additional terms #include "SMAA.inc.hlsl" // *INDENT-OFF* -Texture2D t_CurrentRender : register( t0 VK_DESCRIPTOR_SET( 1 ) ); -Texture2D t_PredictColor : register( t1 VK_DESCRIPTOR_SET( 1 )); +Texture2D t_CurrentRender : register( t0 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_PredictColor : register( t1 VK_DESCRIPTOR_SET( 1 )); + SamplerState samp0 : register( s0 VK_DESCRIPTOR_SET( 2 ) ); // _currentColor SamplerState samp1 : register( s1 VK_DESCRIPTOR_SET( 2 ) ); // TODO _predictColor diff --git a/neo/shaders/builtin/post/SMAA_edge_detection.vs.hlsl b/neo/shaders/builtin/post/SMAA_edge_detection.vs.hlsl index 13a30ec4..f0fc33e5 100644 --- a/neo/shaders/builtin/post/SMAA_edge_detection.vs.hlsl +++ b/neo/shaders/builtin/post/SMAA_edge_detection.vs.hlsl @@ -36,13 +36,14 @@ If you have questions concerning this license or the applicable additional terms #include "SMAA.inc.hlsl" // *INDENT-OFF* -struct VS_IN +struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT diff --git a/neo/shaders/builtin/post/SMAA_final.ps.hlsl b/neo/shaders/builtin/post/SMAA_final.ps.hlsl index 161c139f..00b8ddad 100644 --- a/neo/shaders/builtin/post/SMAA_final.ps.hlsl +++ b/neo/shaders/builtin/post/SMAA_final.ps.hlsl @@ -36,12 +36,12 @@ If you have questions concerning this license or the applicable additional terms #include "SMAA.inc.hlsl" // *INDENT-OFF* -Texture2D t_CurrentColor : register( t0 ); -Texture2D t_SmaaBlend : register( t1 ); -//Texture2D t_Velocity : register( t2 ); +Texture2D t_CurrentColor : register( t0 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_SmaaBlend : register( t1 VK_DESCRIPTOR_SET( 1 ) ); +//Texture2D t_Velocity : register( t2 VK_DESCRIPTOR_SET( 1 ) ); -SamplerState LinearSampler : register( s0 ); -SamplerState PointSampler : register( s0 ); +SamplerState LinearSampler : register( s0 VK_DESCRIPTOR_SET( 2 ) ); +SamplerState PointSampler : register( s1 VK_DESCRIPTOR_SET( 2 ) ); struct PS_IN { diff --git a/neo/shaders/builtin/post/SMAA_final.vs.hlsl b/neo/shaders/builtin/post/SMAA_final.vs.hlsl index a96fa77f..18c12387 100644 --- a/neo/shaders/builtin/post/SMAA_final.vs.hlsl +++ b/neo/shaders/builtin/post/SMAA_final.vs.hlsl @@ -36,13 +36,14 @@ If you have questions concerning this license or the applicable additional terms #include "SMAA.inc.hlsl" // *INDENT-OFF* -struct VS_IN +struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT diff --git a/neo/shaders/builtin/post/fxaa.ps.hlsl b/neo/shaders/builtin/post/fxaa.ps.hlsl deleted file mode 100644 index 69db9b85..00000000 --- a/neo/shaders/builtin/post/fxaa.ps.hlsl +++ /dev/null @@ -1,114 +0,0 @@ -/* -=========================================================================== - -Doom 3 BFG Edition GPL Source Code -Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. - -This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). - -Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Doom 3 BFG Edition Source Code. If not, see . - -In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. - -If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - -=========================================================================== -*/ - -#include "global_inc.hlsl" - -#define FXAA_GREEN_AS_LUMA 1 -#define FXAA_EARLY_EXIT 0 -#include "Fxaa3_11.h" - -// *INDENT-OFF* -uniform sampler2D samp0 : register(s0); -uniform sampler2D samp1 : register(s1); // exponent bias -1 -uniform sampler2D samp2 : register(s2); // exponent bias -2 - -uniform float4 rpUser0 : register( c128 ); -uniform float4 rpUser1 : register( c129 ); -uniform float4 rpUser2 : register( c130 ); -uniform float4 rpUser3 : register( c131 ); -uniform float4 rpUser4 : register( c132 ); -uniform float4 rpUser5 : register( c133 ); -uniform float4 rpUser6 : register( c134 ); - -struct PS_IN { - float4 position : VPOS; - float2 texcoord0 : TEXCOORD0_centroid; -}; - -struct PS_OUT { - float4 color : COLOR; -}; -// *INDENT-ON* - -void main( PS_IN fragment, out PS_OUT result ) -{ - - const float4 FXAAQualityRCPFrame = rpUser0; - const float4 FXAAConsoleRcpFrameOpt = rpUser1; - const float4 FXAAConsoleRcpFrameOpt2 = rpUser2; - const float4 FXAAConsole360RcpFrameOpt2 = rpUser3; - const float4 FXAAQualityParms = rpUser4; - const float4 FXAAConsoleEdgeParms = rpUser5; - const float4 FXAAConsole360ConstDir = rpUser6; - - // Inputs - see more info in fxaa3_11.hfile - FxaaFloat2 fxaaPos = fragment.texcoord0; - FxaaFloat4 fxaaConsolePos; - - float2 halfPixelOffset = float2( 0.5, 0.5 ) * FXAAQualityRCPFrame.xy; - fxaaConsolePos.xy = fxaaPos.xy - ( halfPixelOffset ); - fxaaConsolePos.zw = fxaaPos.xy + ( halfPixelOffset ); - FxaaFloat2 fxaaQualityRcpFrame = FXAAQualityRCPFrame.xy; - FxaaFloat4 fxaaConsoleRcpFrameOpt = FXAAConsoleRcpFrameOpt; - FxaaFloat4 fxaaConsoleRcpFrameOpt2 = FXAAConsoleRcpFrameOpt2; - FxaaFloat4 fxaaConsole360RcpFrameOpt2 = FXAAConsole360RcpFrameOpt2; - - // Quality parms - FxaaFloat fxaaQualitySubpix = FXAAQualityParms.x; - FxaaFloat fxaaQualityEdgeThreshold = FXAAQualityParms.y; - FxaaFloat fxaaQualityEdgeThresholdMin = FXAAQualityParms.z; - - // Console specific Parms - FxaaFloat fxaaConsoleEdgeSharpness = FXAAConsoleEdgeParms.x; - FxaaFloat fxaaConsoleEdgeThreshold = FXAAConsoleEdgeParms.y; - FxaaFloat fxaaConsoleEdgeThresholdMin = FXAAConsoleEdgeParms.z; - - // 360 specific parms these have to come from a constant register so that the compiler - // does not unoptimize the shader - FxaaFloat4 fxaaConsole360ConstDir = FXAAConsole360ConstDir; - - - float4 colorSample = FxaaPixelShader( fxaaPos, - fxaaConsolePos, - samp0, - samp1, - samp2, - fxaaQualityRcpFrame, - fxaaConsoleRcpFrameOpt, - fxaaConsoleRcpFrameOpt2, - fxaaConsole360RcpFrameOpt2, - fxaaQualitySubpix, - fxaaQualityEdgeThreshold, - fxaaQualityEdgeThresholdMin, - fxaaConsoleEdgeSharpness, - fxaaConsoleEdgeThreshold, - fxaaConsoleEdgeThresholdMin, - fxaaConsole360ConstDir ); - - result.color = colorSample; -} \ No newline at end of file diff --git a/neo/shaders/builtin/post/fxaa.vs.hlsl b/neo/shaders/builtin/post/fxaa.vs.hlsl deleted file mode 100644 index e44f0d25..00000000 --- a/neo/shaders/builtin/post/fxaa.vs.hlsl +++ /dev/null @@ -1,51 +0,0 @@ -/* -=========================================================================== - -Doom 3 BFG Edition GPL Source Code -Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. - -This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). - -Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Doom 3 BFG Edition Source Code. If not, see . - -In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. - -If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - -=========================================================================== -*/ - -#include "global_inc.hlsl" - - -// *INDENT-OFF* -struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; -}; - -struct VS_OUT { - float4 position : POSITION; - float2 texcoord0 : TEXCOORD0; -}; -// *INDENT-ON* - -void main( VS_IN vertex, out VS_OUT result ) -{ - result.position = vertex.position; - result.texcoord0 = vertex.texcoord; -} \ No newline at end of file diff --git a/neo/shaders/builtin/post/hdr_glare_chromatic.ps.hlsl b/neo/shaders/builtin/post/hdr_glare_chromatic.ps.hlsl index 0b68e5a0..a18aca3b 100644 --- a/neo/shaders/builtin/post/hdr_glare_chromatic.ps.hlsl +++ b/neo/shaders/builtin/post/hdr_glare_chromatic.ps.hlsl @@ -31,8 +31,8 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -Texture2D t_CurrentRender : register( t0 ); -SamplerState samp0 : register( s0 ); +Texture2D t_CurrentRender : register( t0 VK_DESCRIPTOR_SET( 1 ) ); +SamplerState samp0 : register( s0 VK_DESCRIPTOR_SET( 2 ) ); struct PS_IN { diff --git a/neo/shaders/builtin/post/hdr_glare_chromatic.vs.hlsl b/neo/shaders/builtin/post/hdr_glare_chromatic.vs.hlsl index 1463556e..65dfc087 100644 --- a/neo/shaders/builtin/post/hdr_glare_chromatic.vs.hlsl +++ b/neo/shaders/builtin/post/hdr_glare_chromatic.vs.hlsl @@ -30,12 +30,14 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; +struct VS_IN +{ + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT { diff --git a/neo/shaders/builtin/post/motionBlur.ps.hlsl b/neo/shaders/builtin/post/motionBlur.ps.hlsl index f50cf154..8548161a 100644 --- a/neo/shaders/builtin/post/motionBlur.ps.hlsl +++ b/neo/shaders/builtin/post/motionBlur.ps.hlsl @@ -32,10 +32,10 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -Texture2D t_ViewColor : register( t0 VK_DESCRIPTOR_SET( 0 ) ); -Texture2D t_ViewDepth : register( t1 VK_DESCRIPTOR_SET( 0 ) ); +Texture2D t_ViewColor : register( t0 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_ViewDepth : register( t1 VK_DESCRIPTOR_SET( 1 ) ); -SamplerState LinearSampler : register( s0 VK_DESCRIPTOR_SET( 1 ) ); +SamplerState LinearSampler : register( s0 VK_DESCRIPTOR_SET( 2 ) ); struct PS_IN diff --git a/neo/shaders/builtin/post/motionBlur.vs.hlsl b/neo/shaders/builtin/post/motionBlur.vs.hlsl index 1664ae35..4566bae3 100644 --- a/neo/shaders/builtin/post/motionBlur.vs.hlsl +++ b/neo/shaders/builtin/post/motionBlur.vs.hlsl @@ -30,10 +30,14 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -struct VS_IN +struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT diff --git a/neo/shaders/builtin/post/postprocess.ps.hlsl b/neo/shaders/builtin/post/postprocess.ps.hlsl index af362e6e..8684da9f 100644 --- a/neo/shaders/builtin/post/postprocess.ps.hlsl +++ b/neo/shaders/builtin/post/postprocess.ps.hlsl @@ -3,7 +3,7 @@ Doom 3 BFG Edition GPL Source Code Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. -Copyright (C) 2015-2020 Robert Beckebans +Copyright (C) 2015-2022 Robert Beckebans Copyright (C) 2014 Timothy Lottes (AMD) Copyright (C) 2019 Justin Marshall (IcedTech) diff --git a/neo/shaders/builtin/post/postprocess.vs.hlsl b/neo/shaders/builtin/post/postprocess.vs.hlsl index 1e90ae75..75519fe8 100644 --- a/neo/shaders/builtin/post/postprocess.vs.hlsl +++ b/neo/shaders/builtin/post/postprocess.vs.hlsl @@ -30,12 +30,14 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; +struct VS_IN +{ + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT { diff --git a/neo/shaders/builtin/post/screen.ps.hlsl b/neo/shaders/builtin/post/screen.ps.hlsl index 36dd4481..9da70a0c 100644 --- a/neo/shaders/builtin/post/screen.ps.hlsl +++ b/neo/shaders/builtin/post/screen.ps.hlsl @@ -31,8 +31,8 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -Texture2D t_BaseColor : register( t0 VK_DESCRIPTOR_SET( 0 ) ); -SamplerState samp0 : register( s0 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_BaseColor : register( t0 VK_DESCRIPTOR_SET( 1 ) ); +SamplerState samp0 : register( s0 VK_DESCRIPTOR_SET( 2 ) ); struct PS_IN { diff --git a/neo/shaders/builtin/post/screen.vs.hlsl b/neo/shaders/builtin/post/screen.vs.hlsl index 1463556e..65dfc087 100644 --- a/neo/shaders/builtin/post/screen.vs.hlsl +++ b/neo/shaders/builtin/post/screen.vs.hlsl @@ -30,12 +30,14 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; +struct VS_IN +{ + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT { diff --git a/neo/shaders/builtin/post/tonemap.ps.hlsl b/neo/shaders/builtin/post/tonemap.ps.hlsl index 110d6e88..cb13131e 100644 --- a/neo/shaders/builtin/post/tonemap.ps.hlsl +++ b/neo/shaders/builtin/post/tonemap.ps.hlsl @@ -31,11 +31,11 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -Texture2D t_CurrentRender : register( t0 VK_DESCRIPTOR_SET( 0 ) ); -Texture2D t_HeatMap : register( t1 VK_DESCRIPTOR_SET( 0 ) ); +Texture2D t_CurrentRender : register( t0 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_HeatMap : register( t1 VK_DESCRIPTOR_SET( 1 ) ); -SamplerState samp0 : register( s0 VK_DESCRIPTOR_SET( 1 ) ); // texture 0 is _currentRender -SamplerState samp1 : register( s1 VK_DESCRIPTOR_SET( 1 ) ); // texture 1 is heatmap +SamplerState samp0 : register( s0 VK_DESCRIPTOR_SET( 2 ) ); // texture 0 is _currentRender +SamplerState samp1 : register( s1 VK_DESCRIPTOR_SET( 2 ) ); // texture 1 is heatmap struct PS_IN { diff --git a/neo/shaders/builtin/post/tonemap.vs.hlsl b/neo/shaders/builtin/post/tonemap.vs.hlsl index 1ed4f468..2162a486 100644 --- a/neo/shaders/builtin/post/tonemap.vs.hlsl +++ b/neo/shaders/builtin/post/tonemap.vs.hlsl @@ -30,12 +30,14 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; +struct VS_IN +{ + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT { diff --git a/neo/shaders/builtin/texture.vs.hlsl b/neo/shaders/builtin/texture.vs.hlsl index 4a07351b..6491a155 100644 --- a/neo/shaders/builtin/texture.vs.hlsl +++ b/neo/shaders/builtin/texture.vs.hlsl @@ -30,12 +30,14 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; +struct VS_IN +{ + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT { diff --git a/neo/shaders/builtin/texture_color.vs.hlsl b/neo/shaders/builtin/texture_color.vs.hlsl index 84b6b669..7451a5af 100644 --- a/neo/shaders/builtin/texture_color.vs.hlsl +++ b/neo/shaders/builtin/texture_color.vs.hlsl @@ -35,8 +35,10 @@ StructuredBuffer matrices : register(t11); struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; float4 color : COLOR0; float4 color2 : COLOR1; }; diff --git a/neo/shaders/builtin/texture_color_skinned.ps.hlsl b/neo/shaders/builtin/texture_color_skinned.ps.hlsl deleted file mode 100644 index c3103eee..00000000 --- a/neo/shaders/builtin/texture_color_skinned.ps.hlsl +++ /dev/null @@ -1,51 +0,0 @@ -/* -=========================================================================== - -Doom 3 BFG Edition GPL Source Code -Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. - -This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). - -Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Doom 3 BFG Edition Source Code. If not, see . - -In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. - -If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - -=========================================================================== -*/ - -#include "renderprogs/global.inc.hlsl" - - -// *INDENT-OFF* -uniform sampler2D samp0 : register(s0); - -struct PS_IN { - float4 position : VPOS; - float2 texcoord0 : TEXCOORD0_centroid; - float4 color : COLOR0; -}; - -struct PS_OUT { - float4 color : COLOR; -}; -// *INDENT-ON* - -void main( PS_IN fragment, out PS_OUT result ) -{ - float4 color = tex2D( samp0, fragment.texcoord0 ) * fragment.color; - clip( color.a - rpAlphaTest.x ); - result.color = sRGBAToLinearRGBA( color ); -} \ No newline at end of file diff --git a/neo/shaders/builtin/texture_color_skinned.vs.hlsl b/neo/shaders/builtin/texture_color_skinned.vs.hlsl deleted file mode 100644 index c57d8715..00000000 --- a/neo/shaders/builtin/texture_color_skinned.vs.hlsl +++ /dev/null @@ -1,110 +0,0 @@ -/* -=========================================================================== - -Doom 3 BFG Edition GPL Source Code -Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. -Copyright (C) 2014 Robert Beckebans - -This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). - -Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Doom 3 BFG Edition Source Code. If not, see . - -In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. - -If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - -=========================================================================== -*/ - -#include "renderprogs/global.inc.hlsl" - - -uniform matrices_ubo { float4 matrices[408]; }; - -// *INDENT-OFF* -struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; - float4 color2 : COLOR1; -}; - -struct VS_OUT { - float4 position : POSITION; - float2 texcoord0 : TEXCOORD0; - float4 color : COLOR0; -}; -// *INDENT-ON* - -void main( VS_IN vertex, out VS_OUT result ) -{ - //-------------------------------------------------------------- - // GPU transformation of the normal / binormal / bitangent - // - // multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 ) - //-------------------------------------------------------------- - const float w0 = vertex.color2.x; - const float w1 = vertex.color2.y; - const float w2 = vertex.color2.z; - const float w3 = vertex.color2.w; - - float4 matX, matY, matZ; // must be float4 for vec4 - int joint = int( vertex.color.x * 255.1 * 3.0 ); - matX = matrices[int( joint + 0 )] * w0; - matY = matrices[int( joint + 1 )] * w0; - matZ = matrices[int( joint + 2 )] * w0; - - joint = int( vertex.color.y * 255.1 * 3.0 ); - matX += matrices[int( joint + 0 )] * w1; - matY += matrices[int( joint + 1 )] * w1; - matZ += matrices[int( joint + 2 )] * w1; - - joint = int( vertex.color.z * 255.1 * 3.0 ); - matX += matrices[int( joint + 0 )] * w2; - matY += matrices[int( joint + 1 )] * w2; - matZ += matrices[int( joint + 2 )] * w2; - - joint = int( vertex.color.w * 255.1 * 3.0 ); - matX += matrices[int( joint + 0 )] * w3; - matY += matrices[int( joint + 1 )] * w3; - matZ += matrices[int( joint + 2 )] * w3; - - float4 modelPosition; - modelPosition.x = dot4( matX, vertex.position ); - modelPosition.y = dot4( matY, vertex.position ); - modelPosition.z = dot4( matZ, vertex.position ); - modelPosition.w = 1.0; - - result.position.x = dot4( modelPosition, rpMVPmatrixX ); - result.position.y = dot4( modelPosition, rpMVPmatrixY ); - result.position.z = dot4( modelPosition, rpMVPmatrixZ ); - result.position.w = dot4( modelPosition, rpMVPmatrixW ); - - // compute oldschool texgen or multiply by texture matrix - BRANCH if( rpTexGen0Enabled.x > 0.0 ) - { - result.texcoord0.x = dot4( modelPosition, rpTexGen0S ); - result.texcoord0.y = dot4( modelPosition, rpTexGen0T ); - } - else - { - result.texcoord0.x = dot4( vertex.texcoord.xy, rpTextureMatrixS ); - result.texcoord0.y = dot4( vertex.texcoord.xy, rpTextureMatrixT ); - } - - float4 vertexColor = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd; - result.color = vertexColor * rpColor; -} \ No newline at end of file diff --git a/neo/shaders/builtin/texture_color_texgen.vs.hlsl b/neo/shaders/builtin/texture_color_texgen.vs.hlsl index 502b1c8b..7b818387 100644 --- a/neo/shaders/builtin/texture_color_texgen.vs.hlsl +++ b/neo/shaders/builtin/texture_color_texgen.vs.hlsl @@ -30,15 +30,18 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; +struct VS_IN +{ + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; -struct VS_OUT { +struct VS_OUT +{ float4 position : POSITION; float4 texcoord0 : TEXCOORD0; float4 color : COLOR0; diff --git a/neo/shaders/builtin/vertex_color.vs.hlsl b/neo/shaders/builtin/vertex_color.vs.hlsl index de024afa..6cbea33b 100644 --- a/neo/shaders/builtin/vertex_color.vs.hlsl +++ b/neo/shaders/builtin/vertex_color.vs.hlsl @@ -33,12 +33,12 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; - float4 color2 : COLOR1; + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT diff --git a/neo/shaders/builtin/video/bink.ps.hlsl b/neo/shaders/builtin/video/bink.ps.hlsl index 34820c2a..cb8b78ba 100644 --- a/neo/shaders/builtin/video/bink.ps.hlsl +++ b/neo/shaders/builtin/video/bink.ps.hlsl @@ -30,11 +30,11 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -Texture2D t_Y : register( t0 ); -Texture2D t_Cr : register( t1 ); -Texture2D t_Cb : register( t2 ); +Texture2D t_Y : register( t0 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_Cr : register( t1 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_Cb : register( t2 VK_DESCRIPTOR_SET( 1 ) ); -SamplerState LinearSampler : register( s0 ); +SamplerState LinearSampler : register( s0 VK_DESCRIPTOR_SET( 2 ) ); struct PS_IN { diff --git a/neo/shaders/builtin/video/bink.vs.hlsl b/neo/shaders/builtin/video/bink.vs.hlsl index 53f62181..cd6b347e 100644 --- a/neo/shaders/builtin/video/bink.vs.hlsl +++ b/neo/shaders/builtin/video/bink.vs.hlsl @@ -30,12 +30,14 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; +struct VS_IN +{ + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT { diff --git a/neo/shaders/builtin/video/bink_gui.ps.hlsl b/neo/shaders/builtin/video/bink_gui.ps.hlsl index c4394276..bc9eb3da 100644 --- a/neo/shaders/builtin/video/bink_gui.ps.hlsl +++ b/neo/shaders/builtin/video/bink_gui.ps.hlsl @@ -30,11 +30,11 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -Texture2D t_Y : register( t0 ); -Texture2D t_Cr : register( t1 ); -Texture2D t_Cb : register( t2 ); +Texture2D t_Y : register( t0 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_Cr : register( t1 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_Cb : register( t2 VK_DESCRIPTOR_SET( 1 ) ); -SamplerState LinearSampler : register( s0 ); +SamplerState LinearSampler : register( s0 VK_DESCRIPTOR_SET( 2 ) ); struct PS_IN { float4 position : SV_Position; diff --git a/neo/shaders/builtin/video/bink_gui.vs.hlsl b/neo/shaders/builtin/video/bink_gui.vs.hlsl index 503278b0..aa6cc550 100644 --- a/neo/shaders/builtin/video/bink_gui.vs.hlsl +++ b/neo/shaders/builtin/video/bink_gui.vs.hlsl @@ -31,13 +31,14 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; - float4 color2 : COLOR1; +struct VS_IN +{ + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT { diff --git a/neo/shaders/colorProcess.ps.hlsl b/neo/shaders/colorProcess.ps.hlsl index b7dbca28..fb3dcf43 100644 --- a/neo/shaders/colorProcess.ps.hlsl +++ b/neo/shaders/colorProcess.ps.hlsl @@ -32,15 +32,17 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* Texture2D t_CurrentRender : register( t0 VK_DESCRIPTOR_SET( 0 ) ); -SamplerState LinearSampler : register( s0 VK_DESCRIPTOR_SET( 1 ) ); +SamplerState LinearSampler : register( s0 VK_DESCRIPTOR_SET( 2 ) ); -struct PS_IN { +struct PS_IN +{ float4 position : SV_Position; float4 color : COLOR0; float3 texcoord0 : TEXCOORD0_centroid; }; -struct PS_OUT { +struct PS_OUT +{ float4 color : SV_Target; }; // *INDENT-ON* diff --git a/neo/shaders/colorProcess.vs.hlsl b/neo/shaders/colorProcess.vs.hlsl index 353eb1e7..c625acba 100644 --- a/neo/shaders/colorProcess.vs.hlsl +++ b/neo/shaders/colorProcess.vs.hlsl @@ -31,16 +31,18 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; - float4 color2 : COLOR1; +struct VS_IN +{ + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; -struct VS_OUT { +struct VS_OUT +{ float4 position : SV_Position; float4 color : COLOR0; float3 texcoord0 : TEXCOORD0_centroid; diff --git a/neo/shaders/enviroSuit.ps.hlsl b/neo/shaders/enviroSuit.ps.hlsl index e82bbc3c..8744e5a2 100644 --- a/neo/shaders/enviroSuit.ps.hlsl +++ b/neo/shaders/enviroSuit.ps.hlsl @@ -30,10 +30,10 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -Texture2D t_CurrentRender : register( t0 VK_DESCRIPTOR_SET( 1 ) ); -Texture2D t_NormalMap : register( t1 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_CurrentRender : register( t0 VK_DESCRIPTOR_SET( 0 ) ); +Texture2D t_NormalMap : register( t1 VK_DESCRIPTOR_SET( 0 ) ); -SamplerState LinearSampler : register( s0 VK_DESCRIPTOR_SET( 2 )); +SamplerState LinearSampler : register( s0 VK_DESCRIPTOR_SET( 1 ) ); struct PS_IN { float4 position : SV_Position; diff --git a/neo/shaders/enviroSuit.vs.hlsl b/neo/shaders/enviroSuit.vs.hlsl index 16613f83..de038b3f 100644 --- a/neo/shaders/enviroSuit.vs.hlsl +++ b/neo/shaders/enviroSuit.vs.hlsl @@ -33,15 +33,18 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; +struct VS_IN +{ + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; -struct VS_OUT { +struct VS_OUT +{ float4 position : SV_Position; float2 texcoord : TEXCOORD0; float4 color : COLOR; diff --git a/neo/shaders/fogwithlights.ps.hlsl b/neo/shaders/fogwithlights.ps.hlsl index 0bd79010..62353853 100644 --- a/neo/shaders/fogwithlights.ps.hlsl +++ b/neo/shaders/fogwithlights.ps.hlsl @@ -31,10 +31,10 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -Texture2D t_CurrentRender : register( t0 VK_DESCRIPTOR_SET( 1 ) ); -Texture2D t_NormalMap : register( t1 VK_DESCRIPTOR_SET( 1 ) ); +Texture2D t_CurrentRender : register( t0 VK_DESCRIPTOR_SET( 0 ) ); +Texture2D t_NormalMap : register( t1 VK_DESCRIPTOR_SET( 0 ) ); -SamplerState LinearSampler : register( s0 VK_DESCRIPTOR_SET( 2 ) ); +SamplerState LinearSampler : register( s0 VK_DESCRIPTOR_SET( 1 ) ); struct PS_IN { float4 position : SV_Position; diff --git a/neo/shaders/fogwithlights.vs.hlsl b/neo/shaders/fogwithlights.vs.hlsl index 24fbb2e3..77879465 100644 --- a/neo/shaders/fogwithlights.vs.hlsl +++ b/neo/shaders/fogwithlights.vs.hlsl @@ -31,15 +31,18 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; +struct VS_IN +{ + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; -struct VS_OUT { +struct VS_OUT +{ float4 position : SV_Position; float4 texcoord0 : TEXCOORD0_centroid; float4 texcoord1 : TEXCOORD1_centroid; diff --git a/neo/shaders/heatHazeWithMask.ps.hlsl b/neo/shaders/heatHazeWithMask.ps.hlsl index 5f69263f..388c861e 100644 --- a/neo/shaders/heatHazeWithMask.ps.hlsl +++ b/neo/shaders/heatHazeWithMask.ps.hlsl @@ -30,20 +30,22 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -Texture2D t_CurrentRender : register( t0 ); -Texture2D t_NormalMap : register( t1 ); -Texture2D t_Mask : register( t2 ); +Texture2D t_CurrentRender : register( t0 VK_DESCRIPTOR_SET( 0 ) ); +Texture2D t_NormalMap : register( t1 VK_DESCRIPTOR_SET( 0 ) ); +Texture2D t_Mask : register( t2 VK_DESCRIPTOR_SET( 0 ) ); -SamplerState LinearSampler : register( s0 ); +SamplerState LinearSampler : register( s0 VK_DESCRIPTOR_SET( 1 ) ); -struct PS_IN { +struct PS_IN +{ float4 position : SV_Position; float4 texcoord0 : TEXCOORD0_centroid; float4 texcoord1 : TEXCOORD1_centroid; float4 texcoord2 : TEXCOORD2_centroid; }; -struct PS_OUT { +struct PS_OUT +{ float4 color : SV_Target; }; // *INDENT-ON* diff --git a/neo/shaders/heatHazeWithMask.vs.hlsl b/neo/shaders/heatHazeWithMask.vs.hlsl index 45f7217e..0cb9cc10 100644 --- a/neo/shaders/heatHazeWithMask.vs.hlsl +++ b/neo/shaders/heatHazeWithMask.vs.hlsl @@ -39,12 +39,12 @@ StructuredBuffer matrices : register(t11); struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; - float4 color2 : COLOR1; + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT diff --git a/neo/shaders/heatHazeWithMaskAndVertex.ps.hlsl b/neo/shaders/heatHazeWithMaskAndVertex.ps.hlsl index 6a32505a..957f860f 100644 --- a/neo/shaders/heatHazeWithMaskAndVertex.ps.hlsl +++ b/neo/shaders/heatHazeWithMaskAndVertex.ps.hlsl @@ -30,13 +30,14 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -Texture2D t_CurrentRender : register( t0 ); -Texture2D t_NormalMap : register( t1 ); -Texture2D t_Mask : register( t2 ); +Texture2D t_CurrentRender : register( t0 VK_DESCRIPTOR_SET( 0 ) ); +Texture2D t_NormalMap : register( t1 VK_DESCRIPTOR_SET( 0 ) ); +Texture2D t_Mask : register( t2 VK_DESCRIPTOR_SET( 0 ) ); -SamplerState LinearSampler : register( s0 ); +SamplerState LinearSampler : register( s0 VK_DESCRIPTOR_SET( 1 ) ); -struct PS_IN { +struct PS_IN +{ float4 position : SV_Position; float4 texcoord0 : TEXCOORD0_centroid; float4 texcoord1 : TEXCOORD1_centroid; @@ -44,7 +45,8 @@ struct PS_IN { float4 color : COLOR0; }; -struct PS_OUT { +struct PS_OUT +{ float4 color : SV_Target0; }; // *INDENT-ON* diff --git a/neo/shaders/heatHazeWithMaskAndVertex.vs.hlsl b/neo/shaders/heatHazeWithMaskAndVertex.vs.hlsl index 5707356f..596592af 100644 --- a/neo/shaders/heatHazeWithMaskAndVertex.vs.hlsl +++ b/neo/shaders/heatHazeWithMaskAndVertex.vs.hlsl @@ -35,14 +35,14 @@ If you have questions concerning this license or the applicable additional terms StructuredBuffer matrices : register(t11); #endif -struct VS_IN +struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; - float4 color2 : COLOR1; + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT diff --git a/neo/shaders/heathaze.ps.hlsl b/neo/shaders/heathaze.ps.hlsl index a21cfe6f..6b93e921 100644 --- a/neo/shaders/heathaze.ps.hlsl +++ b/neo/shaders/heathaze.ps.hlsl @@ -31,10 +31,10 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -Texture2D t_CurrentRender : register( t0 ); -Texture2D t_NormalMap : register( t1 ); +Texture2D t_CurrentRender : register( t0 VK_DESCRIPTOR_SET( 0 ) ); +Texture2D t_NormalMap : register( t1 VK_DESCRIPTOR_SET( 0 ) ); -SamplerState LinearSampler : register( s0 ); +SamplerState LinearSampler : register( s0 VK_DESCRIPTOR_SET( 1 ) ); struct PS_IN { float4 position : SV_Position; diff --git a/neo/shaders/heathaze.vs.hlsl b/neo/shaders/heathaze.vs.hlsl index eeea0e10..9beb790f 100644 --- a/neo/shaders/heathaze.vs.hlsl +++ b/neo/shaders/heathaze.vs.hlsl @@ -39,12 +39,12 @@ StructuredBuffer matrices : register(t11); struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; - float4 color2 : COLOR1; + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT diff --git a/neo/shaders/mattiascrt.ps.hlsl b/neo/shaders/mattiascrt.ps.hlsl index dc96f152..f2fd239d 100644 --- a/neo/shaders/mattiascrt.ps.hlsl +++ b/neo/shaders/mattiascrt.ps.hlsl @@ -32,17 +32,19 @@ If you have questions concerning this license or the applicable additional terms // *INDENT-OFF* -Texture2D t_CurrentRender : register( t0 ); +Texture2D t_CurrentRender : register( t0 VK_DESCRIPTOR_SET( 0 ) ); -SamplerState LinearSampler : register( s0 ); +SamplerState LinearSampler : register( s0 VK_DESCRIPTOR_SET( 1 ) ); -struct PS_IN { +struct PS_IN +{ float4 position : SV_Position; float4 texcoord0 : TEXCOORD0_centroid; float4 texcoord1 : TEXCOORD1_centroid; }; -struct PS_OUT { +struct PS_OUT +{ float4 color : SV_Target; }; // *INDENT-ON* diff --git a/neo/shaders/mattiascrt.vs.hlsl b/neo/shaders/mattiascrt.vs.hlsl index f6da194c..7ceb4e89 100644 --- a/neo/shaders/mattiascrt.vs.hlsl +++ b/neo/shaders/mattiascrt.vs.hlsl @@ -33,14 +33,14 @@ If you have questions concerning this license or the applicable additional terms StructuredBuffer matrices : register(t11); #endif -struct VS_IN +struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; - float4 color2 : COLOR1; + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT diff --git a/neo/shaders/vornoipattern.vs.hlsl b/neo/shaders/vornoipattern.vs.hlsl index a4e2e1d7..df5c6bcf 100644 --- a/neo/shaders/vornoipattern.vs.hlsl +++ b/neo/shaders/vornoipattern.vs.hlsl @@ -35,12 +35,12 @@ StructuredBuffer matrices : register(t11); struct VS_IN { - float4 position : POSITION; - float2 texcoord : TEXCOORD0; - float4 normal : NORMAL; - float4 tangent : TANGENT; - float4 color : COLOR0; - float4 color2 : COLOR1; + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float4 normal : NORMAL; + float4 tangent : TANGENT; + float4 color : COLOR0; + float4 color2 : COLOR1; }; struct VS_OUT diff --git a/neo/sys/DeviceManager.h b/neo/sys/DeviceManager.h index 5822f9be..09c48979 100644 --- a/neo/sys/DeviceManager.h +++ b/neo/sys/DeviceManager.h @@ -157,6 +157,7 @@ protected: virtual void DestroyDeviceAndSwapChain() = 0; virtual void ResizeSwapChain() = 0; virtual void BeginFrame() = 0; + virtual void EndFrame() = 0; // RB: added for BFG edition virtual void Present() = 0; public: diff --git a/neo/sys/win32/DeviceManager_DX12.cpp b/neo/sys/win32/DeviceManager_DX12.cpp index 53db9417..88ccb7d3 100644 --- a/neo/sys/win32/DeviceManager_DX12.cpp +++ b/neo/sys/win32/DeviceManager_DX12.cpp @@ -93,6 +93,7 @@ protected: uint32_t GetCurrentBackBufferIndex() override; uint32_t GetBackBufferCount() override; void BeginFrame() override; + void EndFrame() override; void Present() override; private: @@ -590,6 +591,11 @@ uint32_t DeviceManager_DX12::GetBackBufferCount() return m_SwapChainDesc.BufferCount; } +void DeviceManager_DX12::EndFrame() +{ + +} + void DeviceManager_DX12::Present() { if( !windowVisible ) diff --git a/neo/sys/win32/DeviceManager_VK.cpp b/neo/sys/win32/DeviceManager_VK.cpp index a75d34ec..5f456b0d 100644 --- a/neo/sys/win32/DeviceManager_VK.cpp +++ b/neo/sys/win32/DeviceManager_VK.cpp @@ -88,6 +88,7 @@ protected: } void BeginFrame() override; + void EndFrame() override; void Present() override; const char* GetRendererString() const override @@ -163,7 +164,7 @@ private: // device { VK_KHR_SWAPCHAIN_EXTENSION_NAME, - VK_KHR_MAINTENANCE1_EXTENSION_NAME + VK_KHR_MAINTENANCE1_EXTENSION_NAME, }, }; @@ -262,26 +263,25 @@ private: if( flags & VK_DEBUG_REPORT_ERROR_BIT_EXT ) { - idLib::Printf( "[Vulkan] ERROR location=0x%zx code=%d, layerPrefix='%s'] %s", location, code, layerPrefix, msg ); + idLib::Printf( "[Vulkan] ERROR location=0x%zx code=%d, layerPrefix='%s'] %s\n", location, code, layerPrefix, msg ); } else if( flags & VK_DEBUG_REPORT_WARNING_BIT_EXT ) { - idLib::Printf( "[Vulkan] WARNING location=0x%zx code=%d, layerPrefix='%s'] %s", location, code, layerPrefix, msg ); + idLib::Printf( "[Vulkan] WARNING location=0x%zx code=%d, layerPrefix='%s'] %s\n", location, code, layerPrefix, msg ); } else if( flags & VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT ) { - idLib::Printf( "[Vulkan] PERFORMANCE WARNING location=0x%zx code=%d, layerPrefix='%s'] %s", location, code, layerPrefix, msg ); + idLib::Printf( "[Vulkan] PERFORMANCE WARNING location=0x%zx code=%d, layerPrefix='%s'] %s\n", location, code, layerPrefix, msg ); } else if( flags & VK_DEBUG_REPORT_INFORMATION_BIT_EXT ) { - idLib::Printf( "[Vulkan] INFO location=0x%zx code=%d, layerPrefix='%s'] %s", location, code, layerPrefix, msg ); + idLib::Printf( "[Vulkan] INFO location=0x%zx code=%d, layerPrefix='%s'] %s\n", location, code, layerPrefix, msg ); } else if( flags & VK_DEBUG_REPORT_DEBUG_BIT_EXT ) { - idLib::Printf( "[Vulkan] DEBUG location=0x%zx code=%d, layerPrefix='%s'] %s", location, code, layerPrefix, msg ); + idLib::Printf( "[Vulkan] DEBUG location=0x%zx code=%d, layerPrefix='%s'] %s\n", location, code, layerPrefix, msg ); } - return VK_FALSE; } }; @@ -397,10 +397,10 @@ bool DeviceManager_VK::createInstance() return false; } - common->Printf( "Enabled Vulkan instance extensions:" ); + common->Printf( "Enabled Vulkan instance extensions:\n" ); for( const auto& ext : enabledExtensions.instance ) { - common->Printf( " %s", ext.c_str() ); + common->Printf( " %s\n", ext.c_str() ); } std::unordered_set requiredLayers = enabledExtensions.layers; @@ -429,10 +429,10 @@ bool DeviceManager_VK::createInstance() return false; } - common->Printf( "Enabled Vulkan layers:" ); + common->Printf( "Enabled Vulkan layers:\n" ); for( const auto& layer : enabledExtensions.layers ) { - common->Printf( " %s", layer.c_str() ); + common->Printf( " %s\n", layer.c_str() ); } auto instanceExtVec = stringSetToVector( enabledExtensions.instance ); @@ -705,7 +705,7 @@ bool DeviceManager_VK::createDevice() common->Printf( "Enabled Vulkan device extensions:" ); for( const auto& ext : enabledExtensions.device ) { - common->Printf( " %s", ext.c_str() ); + common->Printf( " %s\n", ext.c_str() ); if( ext == VK_KHR_ACCELERATION_STRUCTURE_EXTENSION_NAME ) { @@ -713,6 +713,7 @@ bool DeviceManager_VK::createDevice() } else if( ext == VK_KHR_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME ) { + // RB: only makes problems at the moment bufferAddressSupported = true; } else if( ext == VK_KHR_RAY_TRACING_PIPELINE_EXTENSION_NAME ) @@ -946,7 +947,7 @@ bool DeviceManager_VK::createSwapChain() m_SwapChainFormat = { vk::Format( nvrhi::vulkan::convertFormat( deviceParms.swapChainFormat ) ), - vk::ColorSpaceKHR::eSrgbNonlinear // SP: Does this matter this is non-linear srgb? + vk::ColorSpaceKHR::eSrgbNonlinear }; vk::Extent2D extent = vk::Extent2D( deviceParms.backBufferWidth, deviceParms.backBufferHeight ); @@ -1155,14 +1156,17 @@ void DeviceManager_VK::BeginFrame() m_NvrhiDevice->queueWaitForSemaphore( nvrhi::CommandQueue::Graphics, m_PresentSemaphore, 0 ); } -void DeviceManager_VK::Present() +void DeviceManager_VK::EndFrame() { m_NvrhiDevice->queueSignalSemaphore( nvrhi::CommandQueue::Graphics, m_PresentSemaphore, 0 ); m_BarrierCommandList->open(); // umm... m_BarrierCommandList->close(); m_NvrhiDevice->executeCommandList( m_BarrierCommandList ); +} +void DeviceManager_VK::Present() +{ vk::PresentInfoKHR info = vk::PresentInfoKHR() .setWaitSemaphoreCount( 1 ) .setPWaitSemaphores( &m_PresentSemaphore )