mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-14 06:34:10 +00:00
Killed entire HLSL -> GLSL conversion code
This commit is contained in:
parent
8975f59f62
commit
cf9f430d1c
5 changed files with 15 additions and 17599 deletions
|
@ -3,7 +3,7 @@
|
|||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013-2018 Robert Beckebans
|
||||
Copyright (C) 2013-2023 Robert Beckebans
|
||||
Copyright (C) 2022 Stephen Pridham
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
@ -34,22 +34,9 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "RenderCommon.h"
|
||||
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
|
||||
#include <sys/DeviceManager.h>
|
||||
#include <nvrhi/utils.h>
|
||||
|
||||
extern DeviceManager* deviceManager;
|
||||
|
||||
#elif defined(USE_VULKAN)
|
||||
|
||||
extern idUniformBuffer emptyUBO;
|
||||
|
||||
void CreateVertexDescriptions();
|
||||
|
||||
void CreateDescriptorPools( VkDescriptorPool( &pools )[NUM_FRAME_DATA] );
|
||||
|
||||
#endif
|
||||
#include <sys/DeviceManager.h>
|
||||
#include <nvrhi/utils.h>
|
||||
extern DeviceManager* deviceManager;
|
||||
|
||||
idRenderProgManager renderProgManager;
|
||||
|
||||
|
@ -96,7 +83,6 @@ void idRenderProgManager::Init( nvrhi::IDevice* device )
|
|||
builtinShaders[i] = -1;
|
||||
}
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
this->device = device;
|
||||
|
||||
uniforms.SetNum( RENDERPARM_TOTAL, vec4_zero );
|
||||
|
@ -434,7 +420,7 @@ void idRenderProgManager::Init( nvrhi::IDevice* device )
|
|||
{
|
||||
{ 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_CONSTANT_BUFFER_ONLY },
|
||||
// RB begin
|
||||
|
||||
{ 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 },
|
||||
|
||||
|
@ -450,14 +436,14 @@ void idRenderProgManager::Init( nvrhi::IDevice* device )
|
|||
|
||||
{ BUILTIN_SMALL_GEOMETRY_BUFFER, "builtin/gbuffer", "", { {"USE_GPU_SKINNING", "0" }, { "USE_NORMAL_FMT_RGB8", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT },
|
||||
{ BUILTIN_SMALL_GEOMETRY_BUFFER_SKINNED, "builtin/gbuffer", "_skinned", { {"USE_GPU_SKINNING", "1" }, { "USE_NORMAL_FMT_RGB8", "0" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT_SKINNED },
|
||||
// RB end
|
||||
|
||||
{ BUILTIN_TEXTURED, "builtin/texture", "", { }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT },
|
||||
{ BUILTIN_TEXTURE_VERTEXCOLOR, "builtin/texture_color", "", { {"USE_GPU_SKINNING", "0" }, {"USE_SRGB", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT },
|
||||
{ BUILTIN_TEXTURE_VERTEXCOLOR_SRGB, "builtin/texture_color", "_sRGB", { {"USE_GPU_SKINNING", "0" }, {"USE_SRGB", "1" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT },
|
||||
{ BUILTIN_TEXTURE_VERTEXCOLOR_SKINNED, "builtin/texture_color", "_skinned", { {"USE_GPU_SKINNING", "1" }, {"USE_SRGB", "0" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT_SKINNED },
|
||||
{ BUILTIN_TEXTURE_TEXGEN_VERTEXCOLOR, "builtin/texture_color_texgen", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT },
|
||||
|
||||
// RB begin
|
||||
|
||||
{ BUILTIN_INTERACTION, "builtin/lighting/interaction", "", { {"USE_GPU_SKINNING", "0" }, { "USE_PBR", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION },
|
||||
{ BUILTIN_INTERACTION_SKINNED, "builtin/lighting/interaction", "_skinned", { {"USE_GPU_SKINNING", "1" }, { "USE_PBR", "0" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SKINNED },
|
||||
|
||||
|
@ -516,7 +502,7 @@ void idRenderProgManager::Init( nvrhi::IDevice* device )
|
|||
|
||||
{ BUILTIN_DEBUG_OCTAHEDRON, "builtin/debug/octahedron", "", { {"USE_GPU_SKINNING", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT },
|
||||
{ BUILTIN_DEBUG_OCTAHEDRON_SKINNED, "builtin/debug/octahedron", "_skinned", { {"USE_GPU_SKINNING", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT_SKINNED },
|
||||
// RB end
|
||||
|
||||
|
||||
{ BUILTIN_ENVIRONMENT, "builtin/legacy/environment", "", { {"USE_GPU_SKINNING", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT },
|
||||
{ BUILTIN_ENVIRONMENT_SKINNED, "builtin/legacy/environment", "_skinned", { {"USE_GPU_SKINNING", "1" } }, true , SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT_SKINNED },
|
||||
|
@ -539,7 +525,7 @@ void idRenderProgManager::Init( nvrhi::IDevice* device )
|
|||
{ BUILTIN_SKYBOX, "builtin/legacy/skybox", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT },
|
||||
{ BUILTIN_WOBBLESKY, "builtin/legacy/wobblesky", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT },
|
||||
{ BUILTIN_POSTPROCESS, "builtin/post/postprocess", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_POST_PROCESS_FINAL },
|
||||
// RB begin
|
||||
|
||||
{ BUILTIN_SCREEN, "builtin/post/screen", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT },
|
||||
{ BUILTIN_TONEMAP, "builtin/post/tonemap", "", { { "BRIGHTPASS", "0" }, { "HDR_DEBUG", "0"} }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT },
|
||||
{ BUILTIN_BRIGHTPASS, "builtin/post/tonemap", "_brightpass", { { "BRIGHTPASS", "1" }, { "HDR_DEBUG", "0"} }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT },
|
||||
|
@ -563,7 +549,7 @@ void idRenderProgManager::Init( nvrhi::IDevice* device )
|
|||
{ BUILTIN_DEEP_GBUFFER_RADIOSITY_SSGI, "builtin/SSGI/DeepGBufferRadiosity_radiosity", "", { }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT },
|
||||
{ BUILTIN_DEEP_GBUFFER_RADIOSITY_BLUR, "builtin/SSGI/DeepGBufferRadiosity_blur", "", { }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT },
|
||||
{ BUILTIN_DEEP_GBUFFER_RADIOSITY_BLUR_AND_OUTPUT, "builtin/SSGI/DeepGBufferRadiosity_blur", "_write", { }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT },
|
||||
// RB end
|
||||
|
||||
{ BUILTIN_STEREO_DEGHOST, "builtin/VR/stereoDeGhost", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT },
|
||||
{ BUILTIN_STEREO_WARP, "builtin/VR/stereoWarp", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT },
|
||||
{ BUILTIN_BINK, "builtin/video/bink", "", { {"USE_SRGB", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_BINK_VIDEO },
|
||||
|
@ -572,9 +558,7 @@ void idRenderProgManager::Init( nvrhi::IDevice* device )
|
|||
{ BUILTIN_STEREO_INTERLACE, "builtin/VR/stereoInterlace", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT },
|
||||
{ BUILTIN_MOTION_BLUR, "builtin/post/motionBlur", "", { { "VECTORS_ONLY", "1" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT },
|
||||
|
||||
// RB begin
|
||||
{ BUILTIN_DEBUG_SHADOWMAP, "builtin/debug/debug_shadowmap", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT },
|
||||
// RB end
|
||||
|
||||
// SP begin
|
||||
{ BUILTIN_BLIT, "builtin/blit", "", { { "TEXTURE_ARRAY", "0" } }, false, SHADER_STAGE_FRAGMENT, LAYOUT_UNKNOWN, BINDING_LAYOUT_BLIT },
|
||||
|
@ -637,7 +621,6 @@ void idRenderProgManager::Init( nvrhi::IDevice* device )
|
|||
LoadComputeProgram( i, cIndex );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
r_useHalfLambertLighting.ClearModified();
|
||||
r_usePBR.ClearModified();
|
||||
|
@ -656,7 +639,7 @@ void idRenderProgManager::Init( nvrhi::IDevice* device )
|
|||
renderProgs[builtinShaders[BUILTIN_SHADOW_SKINNED]].usesJoints = true;
|
||||
renderProgs[builtinShaders[BUILTIN_SHADOW_DEBUG_SKINNED]].usesJoints = true;
|
||||
renderProgs[builtinShaders[BUILTIN_FOG_SKINNED]].usesJoints = true;
|
||||
// RB begin
|
||||
|
||||
renderProgs[builtinShaders[BUILTIN_DEBUG_LIGHTGRID_SKINNED]].usesJoints = true;
|
||||
renderProgs[builtinShaders[BUILTIN_DEBUG_OCTAHEDRON_SKINNED]].usesJoints = true;
|
||||
|
||||
|
@ -686,29 +669,9 @@ void idRenderProgManager::Init( nvrhi::IDevice* device )
|
|||
renderProgs[builtinShaders[BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_SPOT_SKINNED]].usesJoints = true;
|
||||
renderProgs[builtinShaders[BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_POINT_SKINNED]].usesJoints = true;
|
||||
renderProgs[builtinShaders[BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_PARALLEL_SKINNED]].usesJoints = true;
|
||||
// RB end
|
||||
}
|
||||
|
||||
cmdSystem->AddCommand( "reloadShaders", R_ReloadShaders, CMD_FL_RENDERER, "reloads shaders" );
|
||||
|
||||
#if defined(USE_VULKAN)
|
||||
counter = 0;
|
||||
|
||||
// Create Vertex Descriptions
|
||||
CreateVertexDescriptions();
|
||||
|
||||
// Create Descriptor Pools
|
||||
CreateDescriptorPools( descriptorPools );
|
||||
|
||||
for( int i = 0; i < NUM_FRAME_DATA; ++i )
|
||||
{
|
||||
parmBuffers[i] = new idUniformBuffer();
|
||||
parmBuffers[i]->AllocBufferObject( NULL, MAX_DESC_SETS * MAX_DESC_SET_UNIFORMS * sizeof( idVec4 ), BU_DYNAMIC );
|
||||
}
|
||||
|
||||
// Placeholder: mainly for optionalSkinning
|
||||
emptyUBO.AllocBufferObject( NULL, sizeof( idVec4 ), BU_DYNAMIC );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -746,7 +709,6 @@ void idRenderProgManager::Shutdown()
|
|||
{
|
||||
KillAllShaders();
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
// SRS - Delete renderprogs builtin binding layouts
|
||||
for( int i = 0; i < renderProgs.Num(); i++ )
|
||||
{
|
||||
|
@ -770,7 +732,6 @@ void idRenderProgManager::Shutdown()
|
|||
{
|
||||
constantBuffer[i] = nullptr;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -800,16 +761,6 @@ int idRenderProgManager::FindShader( const char* name, rpStage_t stage )
|
|||
shader.name = shaderName;
|
||||
shader.stage = stage;
|
||||
|
||||
#if 0
|
||||
for( int i = 0; i < MAX_SHADER_MACRO_NAMES; i++ )
|
||||
{
|
||||
int feature = ( bool )( 0 & BIT( i ) );
|
||||
idStr macroName( GetGLSLMacroName( ( shaderFeature_t )i ) );
|
||||
idStr value( feature );
|
||||
shader.macros.Append( shaderMacro_t( macroName, value ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
int index = shaders.Append( shader );
|
||||
LoadShader( index, stage );
|
||||
|
||||
|
@ -817,39 +768,6 @@ int idRenderProgManager::FindShader( const char* name, rpStage_t stage )
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
int idRenderProgManager::FindShader( const char* name, rpStage_t stage, const char* nameOutSuffix, uint32 features, bool builtin, vertexLayoutType_t vertexLayout )
|
||||
{
|
||||
idStr shaderName( name );
|
||||
shaderName.StripFileExtension();
|
||||
//shaderName += nameOutSuffix;
|
||||
|
||||
for( int i = 0; i < shaders.Num(); i++ )
|
||||
{
|
||||
shader_t& shader = shaders[ i ];
|
||||
if( shader.name.Icmp( shaderName.c_str() ) == 0 && shader.stage == stage && shader.nameOutSuffix.Icmp( nameOutSuffix ) == 0 )
|
||||
{
|
||||
LoadShader( i, stage );
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
shader_t shader;
|
||||
shader.name = shaderName;
|
||||
shader.nameOutSuffix = nameOutSuffix;
|
||||
shader.shaderFeatures = features;
|
||||
shader.builtin = builtin;
|
||||
shader.stage = stage;
|
||||
shader.vertexLayout = vertexLayout;
|
||||
|
||||
int index = shaders.Append( shader );
|
||||
LoadShader( index, stage );
|
||||
|
||||
return index;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
int idRenderProgManager::FindShader( const char* name, rpStage_t stage, const char* nameOutSuffix, const idList<shaderMacro_t>& macros, bool builtin, vertexLayoutType_t vertexLayout )
|
||||
{
|
||||
idStr shaderName( name );
|
||||
|
@ -880,7 +798,6 @@ int idRenderProgManager::FindShader( const char* name, rpStage_t stage, const ch
|
|||
return index;
|
||||
}
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
nvrhi::ShaderHandle idRenderProgManager::GetShader( int index )
|
||||
{
|
||||
return shaders[index].handle;
|
||||
|
@ -911,7 +828,6 @@ programInfo_t idRenderProgManager::GetProgramInfo( int index )
|
|||
|
||||
return info;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool idRenderProgManager::IsShaderBound() const
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013-2022 Robert Beckebans
|
||||
Copyright (C) 2013-2023 Robert Beckebans
|
||||
Copyright (C) 2016-2017 Dustin Land
|
||||
Copyright (C) 2022 Stephen Pridham
|
||||
|
||||
|
@ -443,7 +443,6 @@ public:
|
|||
int FindShader( const char* name, rpStage_t stage, const char* nameOutSuffix, uint32 features, bool builtin, vertexLayoutType_t vertexLayout = LAYOUT_DRAW_VERT );
|
||||
int FindShader( const char* name, rpStage_t stage, const char* nameOutSuffix, const idList<shaderMacro_t>& macros, bool builtin, vertexLayoutType_t vertexLayout = LAYOUT_DRAW_VERT );
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
nvrhi::ShaderHandle GetShader( int index );
|
||||
|
||||
programInfo_t GetProgramInfo( int index );
|
||||
|
@ -452,7 +451,6 @@ public:
|
|||
{
|
||||
return currentIndex;
|
||||
}
|
||||
#endif
|
||||
|
||||
void BindProgram( int progIndex );
|
||||
|
||||
|
@ -782,20 +780,12 @@ public:
|
|||
|
||||
void BindShader_Shadow()
|
||||
{
|
||||
// RB: no FFP fragment rendering anymore
|
||||
//BindShader( -1, builtinShaders[BUILTIN_SHADOW], -1, true );
|
||||
|
||||
BindShader_Builtin( BUILTIN_SHADOW );
|
||||
// RB end
|
||||
}
|
||||
|
||||
void BindShader_ShadowSkinned()
|
||||
{
|
||||
// RB: no FFP fragment rendering anymore
|
||||
//BindShader( -1, builtinShaders[BUILTIN_SHADOW_SKINNED], -1, true );
|
||||
|
||||
BindShader_Builtin( BUILTIN_SHADOW_SKINNED );
|
||||
// RB end
|
||||
}
|
||||
|
||||
void BindShader_ShadowDebug()
|
||||
|
@ -992,12 +982,10 @@ public:
|
|||
|
||||
void SetUniformValue( const renderParm_t rp, const float* value );
|
||||
void CommitUniforms( uint64 stateBits );
|
||||
void CachePipeline( uint64 stateBits );
|
||||
int FindProgram( const char* name, int vIndex, int fIndex, bindingLayoutType_t bindingType = BINDING_LAYOUT_DEFAULT );
|
||||
void ZeroUniforms();
|
||||
int UniformSize();
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
bool CommitConstantBuffer( nvrhi::ICommandList* commandList, bool bindingLayoutTypeChanged );
|
||||
|
||||
ID_INLINE nvrhi::IBuffer* ConstantBuffer()
|
||||
|
@ -1024,10 +1012,6 @@ public:
|
|||
idUniformBuffer renderParmUbo;
|
||||
idArray<idUniformBuffer, NUM_BINDING_LAYOUTS> bindingParmUbo;
|
||||
idArray<idVec4*, NUM_BINDING_LAYOUTS> mappedRenderParms;
|
||||
#elif defined(USE_VULKAN)
|
||||
void PrintPipelines();
|
||||
void ClearPipelines();
|
||||
#endif
|
||||
|
||||
static const char* FindEmbeddedSourceShader( const char* name );
|
||||
|
||||
|
@ -1037,38 +1021,17 @@ private:
|
|||
// Reads the binary fileName and returns a ShaderBlob.
|
||||
ShaderBlob GetBytecode( const char* fileName );
|
||||
|
||||
idStr StripDeadCode( const idStr& in, const char* name, const idStrList& compileMacros, bool builtin );
|
||||
idStr ConvertCG2GLSL( const idStr& in, const char* name, rpStage_t stage, idStr& outLayout, bool vkGLSL, bool hasGPUSkinning, vertexLayoutType_t vertexLayout );
|
||||
|
||||
int builtinShaders[MAX_BUILTINS];
|
||||
void BindShader_Builtin( int i )
|
||||
{
|
||||
BindProgram( i );
|
||||
}
|
||||
|
||||
enum shaderFeature_t
|
||||
{
|
||||
USE_GPU_SKINNING,
|
||||
LIGHT_POINT,
|
||||
LIGHT_PARALLEL,
|
||||
BRIGHTPASS,
|
||||
HDR_DEBUG,
|
||||
USE_SRGB,
|
||||
USE_PBR,
|
||||
|
||||
MAX_SHADER_MACRO_NAMES,
|
||||
};
|
||||
|
||||
static const char* GLSLMacroNames[MAX_SHADER_MACRO_NAMES];
|
||||
const char* GetGLSLMacroName( shaderFeature_t sf ) const;
|
||||
|
||||
bool CompileGLSL( uint target, const char* name );
|
||||
void LoadProgram( const int programIndex, const int vertexShaderIndex, const int fragmentShaderIndex );
|
||||
void LoadComputeProgram( const int programIndex, const int computeShaderIndex );
|
||||
|
||||
static const uint INVALID_PROGID = 0xFFFFFFFF;
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
struct shader_t
|
||||
{
|
||||
shader_t() :
|
||||
|
@ -1134,131 +1097,6 @@ private:
|
|||
idStaticList< idStaticList<nvrhi::BindingLayoutHandle, nvrhi::c_MaxBindingLayouts>, NUM_BINDING_LAYOUTS > bindingLayouts;
|
||||
|
||||
idArray<nvrhi::BufferHandle, NUM_BINDING_LAYOUTS> constantBuffer;
|
||||
|
||||
#elif defined(USE_VULKAN)
|
||||
struct shader_t
|
||||
{
|
||||
shader_t() :
|
||||
shaderFeatures( 0 ),
|
||||
builtin( false ),
|
||||
vertexLayout( LAYOUT_DRAW_VERT ),
|
||||
module( VK_NULL_HANDLE ) {}
|
||||
idStr name;
|
||||
idStr nameOutSuffix;
|
||||
uint32 shaderFeatures; // RB: Cg compile macros
|
||||
bool builtin; // RB: part of the core shaders built into the executable
|
||||
rpStage_t stage;
|
||||
vertexLayoutType_t vertexLayout;
|
||||
VkShaderModule module;
|
||||
idList<rpBinding_t> bindings;
|
||||
idList<int> parmIndices;
|
||||
};
|
||||
|
||||
struct renderProg_t
|
||||
{
|
||||
renderProg_t() :
|
||||
progId( INVALID_PROGID ),
|
||||
usesJoints( false ),
|
||||
optionalSkinning( false ),
|
||||
builtin( false ),
|
||||
vertexShaderIndex( -1 ),
|
||||
fragmentShaderIndex( -1 ),
|
||||
vertexLayout( LAYOUT_DRAW_VERT ),
|
||||
pipelineLayout( VK_NULL_HANDLE ),
|
||||
descriptorSetLayout( VK_NULL_HANDLE ) {}
|
||||
|
||||
struct pipelineState_t
|
||||
{
|
||||
pipelineState_t() :
|
||||
stateBits( 0 ),
|
||||
pipeline( VK_NULL_HANDLE )
|
||||
{
|
||||
}
|
||||
|
||||
uint64 stateBits;
|
||||
VkPipeline pipeline;
|
||||
};
|
||||
|
||||
VkPipeline GetPipeline( uint64 stateBits, VkShaderModule vertexShader, VkShaderModule fragmentShader );
|
||||
|
||||
idStr name;
|
||||
uint progId;
|
||||
bool usesJoints;
|
||||
bool optionalSkinning;
|
||||
bool builtin; // RB: part of the core shaders built into the executable
|
||||
int vertexShaderIndex;
|
||||
int fragmentShaderIndex;
|
||||
|
||||
vertexLayoutType_t vertexLayout;
|
||||
VkPipelineLayout pipelineLayout;
|
||||
VkDescriptorSetLayout descriptorSetLayout;
|
||||
idList<rpBinding_t> bindings;
|
||||
idList<pipelineState_t> pipelines;
|
||||
};
|
||||
|
||||
static void CreateDescriptorSetLayout( const shader_t& vertexShader, const shader_t& fragmentShader, renderProg_t& renderProg );
|
||||
void AllocParmBlockBuffer( const idList<int>& parmIndices, idUniformBuffer& ubo );
|
||||
#else
|
||||
struct shader_t
|
||||
{
|
||||
shader_t() :
|
||||
progId( INVALID_PROGID ),
|
||||
shaderFeatures( 0 ),
|
||||
builtin( false ),
|
||||
vertexLayout( LAYOUT_DRAW_VERT ),
|
||||
uniformArray( -1 ) {}
|
||||
idStr name;
|
||||
idStr nameOutSuffix;
|
||||
uint32 shaderFeatures; // RB: Cg compile macros
|
||||
bool builtin; // RB: part of the core shaders built into the executable
|
||||
vertexLayoutType_t vertexLayout;
|
||||
rpStage_t stage;
|
||||
uint progId;
|
||||
int uniformArray;
|
||||
idList<int> uniforms;
|
||||
};
|
||||
|
||||
struct renderProg_t
|
||||
{
|
||||
renderProg_t() :
|
||||
progId( INVALID_PROGID ),
|
||||
usesJoints( false ),
|
||||
optionalSkinning( false ),
|
||||
builtin( false ),
|
||||
vertexLayout( LAYOUT_UNKNOWN ),
|
||||
vertexShaderIndex( -1 ),
|
||||
fragmentShaderIndex( -1 ) {}
|
||||
|
||||
idStr name;
|
||||
uint progId;
|
||||
bool usesJoints;
|
||||
bool optionalSkinning;
|
||||
bool builtin; // RB: part of the core shaders built into the executable
|
||||
vertexLayoutType_t vertexLayout;
|
||||
int vertexShaderIndex;
|
||||
int fragmentShaderIndex;
|
||||
};
|
||||
|
||||
void LoadShader( shader_t& shader );
|
||||
|
||||
int current;
|
||||
idList<renderProg_t, TAG_RENDER> renderProgs;
|
||||
idList<shader_t, TAG_RENDER> shaders;
|
||||
|
||||
idStaticList < idVec4, RENDERPARM_TOTAL > uniforms;
|
||||
|
||||
#if defined( USE_VULKAN )
|
||||
int counter;
|
||||
int currentData;
|
||||
int currentDescSet;
|
||||
int currentParmBufferOffset;
|
||||
VkDescriptorPool descriptorPools[ NUM_FRAME_DATA ];
|
||||
VkDescriptorSet descriptorSets[ NUM_FRAME_DATA ][ MAX_DESC_SETS ];
|
||||
|
||||
idUniformBuffer* parmBuffers[ NUM_FRAME_DATA ];
|
||||
#endif
|
||||
|
||||
#endif //#if defined( USE_NVRHI )
|
||||
};
|
||||
|
||||
extern idRenderProgManager renderProgManager;
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1527,19 +1527,8 @@ void GfxInfo_f( const idCmdArgs& args )
|
|||
"fullscreen"
|
||||
};
|
||||
|
||||
common->Printf( "\nGL_VENDOR: %s\n", glConfig.vendor_string );
|
||||
common->Printf( "GL_RENDERER: %s\n", glConfig.renderer_string );
|
||||
common->Printf( "GL_VERSION: %s\n", glConfig.version_string );
|
||||
common->Printf( "GL_EXTENSIONS: %s\n", glConfig.extensions_string );
|
||||
#if !defined( USE_NVRHI )
|
||||
if( glConfig.wgl_extensions_string )
|
||||
{
|
||||
common->Printf( "WGL_EXTENSIONS: %s\n", glConfig.wgl_extensions_string );
|
||||
}
|
||||
common->Printf( "GL_MAX_TEXTURE_SIZE: %d\n", glConfig.maxTextureSize );
|
||||
common->Printf( "GL_MAX_TEXTURE_COORDS_ARB: %d\n", glConfig.maxTextureCoords );
|
||||
common->Printf( "GL_MAX_TEXTURE_IMAGE_UNITS_ARB: %d\n", glConfig.maxTextureImageUnits );
|
||||
#endif
|
||||
common->Printf( "Graphics API: %s\n", deviceManager->GetDevice()->getGraphicsAPI() == nvrhi::GraphicsAPI::D3D12 ? "DirectX 12 " : "Vulkan" );
|
||||
common->Printf( "Render Device: %s\n", deviceManager->GetRendererString() );
|
||||
|
||||
// print all the display adapters, monitors, and video modes
|
||||
//void DumpAllDisplayDevices();
|
||||
|
@ -1558,10 +1547,7 @@ void GfxInfo_f( const idCmdArgs& args )
|
|||
|
||||
common->Printf( "-------\n" );
|
||||
|
||||
// RB begin
|
||||
#if defined(_WIN32) && !defined(USE_VULKAN) && !defined(USE_NVRHI)
|
||||
// WGL_EXT_swap_interval
|
||||
if( r_swapInterval.GetInteger() && wglSwapIntervalEXT != NULL )
|
||||
if( r_swapInterval.GetInteger() )//&& wglSwapIntervalEXT != NULL )
|
||||
{
|
||||
common->Printf( "Forcing swapInterval %i\n", r_swapInterval.GetInteger() );
|
||||
}
|
||||
|
@ -1569,8 +1555,6 @@ void GfxInfo_f( const idCmdArgs& args )
|
|||
{
|
||||
common->Printf( "swapInterval not forced\n" );
|
||||
}
|
||||
#endif
|
||||
// RB end
|
||||
|
||||
if( glConfig.stereoPixelFormatAvailable && glConfig.isStereoPixelFormat )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue