Merge branch '694-nvrhi-vulkan-swapchain' into 635-nvrhi3

This commit is contained in:
Robert Beckebans 2022-09-23 19:21:26 +02:00
commit a02f7dde13
119 changed files with 723 additions and 1389 deletions

2
neo/extern/nvrhi vendored

@ -1 +1 @@
Subproject commit 2caca768dc9598cd8e46f3d2257270a1db1981ce
Subproject commit 6cd068816ca7b6348196129285c76008960eb93f

View file

@ -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 <sys/DeviceManager.h>
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

View file

@ -40,6 +40,7 @@ If you have questions concerning this license or the applicable additional terms
#include "nvrhi/utils.h"
#include <sys/DeviceManager.h>
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();
}
}
/*

View file

@ -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() );
}
}

View file

@ -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;

View file

@ -39,6 +39,8 @@ If you have questions concerning this license or the applicable additional terms
#include <sys/DeviceManager.h>
#include <nvrhi/utils.h>
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 },

View file

@ -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

View file

@ -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

View file

@ -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 );

View file

@ -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*

View file

@ -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 {

View file

@ -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*

View file

@ -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 {

View file

@ -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;

View file

@ -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 {

View file

@ -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*

View file

@ -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;
};

View file

@ -93,11 +93,11 @@ static const float projScale = 500.0;
#define VALUE_TYPE float
Texture2D t_NormalRoughness : register( t0 VK_DESCRIPTOR_SET( 0 ) );
Texture2D<VALUE_TYPE> 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<VALUE_TYPE> 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

View file

@ -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

View file

@ -22,9 +22,9 @@
// *INDENT-OFF*
#define VALUE_TYPE float
Texture2D t_NormalRoughness : register( t0 VK_DESCRIPTOR_SET( 0 ) );
Texture2D<VALUE_TYPE> 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<VALUE_TYPE> 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

View file

@ -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

View file

@ -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
{

View file

@ -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

View file

@ -20,11 +20,11 @@
// *INDENT-OFF*
Texture2D<float3> t_ViewNormal : register( t0 );
Texture2D<float1> t_ViewDepth : register( t1 );
Texture2D<float1> t_ViewAo : register( t2 );
Texture2D<float3> t_ViewNormal : register( t0 VK_DESCRIPTOR_SET( 1 ) );
Texture2D<float1> t_ViewDepth : register( t1 VK_DESCRIPTOR_SET( 1 ) );
Texture2D<float1> 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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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*

View file

@ -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 {

View file

@ -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*

View file

@ -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 {

View file

@ -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*

View file

@ -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*

View file

@ -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*

View file

@ -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
{

View file

@ -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 {

View file

@ -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*

View file

@ -35,14 +35,14 @@ If you have questions concerning this license or the applicable additional terms
StructuredBuffer<float4> 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

View file

@ -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 {

View file

@ -35,14 +35,14 @@ If you have questions concerning this license or the applicable additional terms
StructuredBuffer<float4> 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

View file

@ -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*

View file

@ -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 <http://www.gnu.org/licenses/>.
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;
}

View file

@ -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 <http://www.gnu.org/licenses/>.
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 );
}

View file

@ -35,14 +35,12 @@ StructuredBuffer<float4> 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

View file

@ -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*

View file

@ -36,14 +36,12 @@ StructuredBuffer<float4> 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

View file

@ -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*

View file

@ -36,14 +36,12 @@ StructuredBuffer<float4> 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

View file

@ -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
{

View file

@ -36,12 +36,12 @@ StructuredBuffer<float4> 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

View file

@ -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;

View file

@ -30,9 +30,12 @@ If you have questions concerning this license or the applicable additional terms
#include <global_inc.hlsl>
// *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;
};

View file

@ -35,14 +35,12 @@ StructuredBuffer<float4> 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

View file

@ -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 <http://www.gnu.org/licenses/>.
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;
}

View file

@ -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 <http://www.gnu.org/licenses/>.
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;
}

View file

@ -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*

View file

@ -35,12 +35,12 @@ StructuredBuffer<float4> 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

View file

@ -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 <http://www.gnu.org/licenses/>.
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;
}

View file

@ -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 <http://www.gnu.org/licenses/>.
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;
}

View file

@ -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*

View file

@ -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 {

View file

@ -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*

View file

@ -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;

View file

@ -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
{

View file

@ -36,14 +36,14 @@ StructuredBuffer<float4> 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

View file

@ -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
{

View file

@ -35,14 +35,14 @@ If you have questions concerning this license or the applicable additional terms
StructuredBuffer<float4> 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

View file

@ -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
{

View file

@ -34,14 +34,14 @@ If you have questions concerning this license or the applicable additional terms
StructuredBuffer<float4> 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

View file

@ -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
{

View file

@ -35,12 +35,12 @@ StructuredBuffer<float4> 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

View file

@ -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<float> t_ShadowMapArray : register( t5 VK_DESCRIPTOR_SET( 1 ) );
Texture2DArray<float> 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
{

View file

@ -34,10 +34,10 @@ If you have questions concerning this license or the applicable additional terms
StructuredBuffer<float4> 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;

View file

@ -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
{

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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
{

View file

@ -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

View file

@ -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 <http://www.gnu.org/licenses/>.
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;
}

View file

@ -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 <http://www.gnu.org/licenses/>.
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;
}

View file

@ -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
{

View file

@ -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 {

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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 {

View file

@ -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
{

View file

@ -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 {

View file

@ -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
{

View file

@ -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 {

View file

@ -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 {

View file

@ -35,8 +35,10 @@ StructuredBuffer<float4> 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;
};

View file

@ -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 <http://www.gnu.org/licenses/>.
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 );
}

View file

@ -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 <http://www.gnu.org/licenses/>.
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;
}

View file

@ -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;

View file

@ -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

View file

@ -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 {

View file

@ -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 {

View file

@ -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;

Some files were not shown because too many files have changed in this diff Show more