2012-11-26 18:58:24 +00:00
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Doom 3 BFG Edition GPL Source Code
2012-11-28 15:47:07 +00:00
Copyright ( C ) 1993 - 2012 id Software LLC , a ZeniMax Media company .
2021-03-26 09:49:16 +00:00
Copyright ( C ) 2013 - 2021 Robert Beckebans
2022-02-21 15:29:53 +00:00
Copyright ( C ) 2022 Stephen Pridham
2012-11-26 18:58:24 +00:00
2012-11-28 15:47:07 +00:00
This file is part of the Doom 3 BFG Edition GPL Source Code ( " Doom 3 BFG Edition Source Code " ) .
2012-11-26 18:58:24 +00:00
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 .
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
2012-12-22 15:18:19 +00:00
# include "precompiled.h"
2021-07-29 13:42:02 +00:00
# pragma hdrstop
2012-11-26 18:58:24 +00:00
2023-01-25 17:27:32 +00:00
# include "imgui.h"
2012-11-26 18:58:24 +00:00
2017-09-03 08:22:36 +00:00
# include "RenderCommon.h"
2015-12-26 14:20:19 +00:00
# include "SMAA/AreaTex.h"
# include "SMAA/SearchTex.h"
2020-04-18 15:08:32 +00:00
# include "Image_brdfLut.h"
2020-05-10 20:10:32 +00:00
//#include "Image_blueNoiseVC_1M.h" // 256^2 R8 data
# include "Image_blueNoiseVC_2.h" // 512^2 RGB8 data
2012-11-26 18:58:24 +00:00
2021-03-26 09:49:16 +00:00
# include "Image_env_UAC_lobby_amb.h"
# include "Image_env_UAC_lobby_spec.h"
2012-11-26 18:58:24 +00:00
# define DEFAULT_SIZE 16
/*
= = = = = = = = = = = = = = = = = =
idImage : : MakeDefault
the default image will be grey with a white box outline
to allow you to see the mapping coordinates on a surface
= = = = = = = = = = = = = = = = = =
*/
2022-02-21 15:29:53 +00:00
void idImage : : MakeDefault ( nvrhi : : ICommandList * commandList )
2012-11-28 15:47:07 +00:00
{
2012-11-26 18:58:24 +00:00
int x , y ;
byte data [ DEFAULT_SIZE ] [ DEFAULT_SIZE ] [ 4 ] ;
2019-11-11 19:27:44 +00:00
2012-11-28 15:47:07 +00:00
if ( com_developer . GetBool ( ) )
{
2012-11-26 18:58:24 +00:00
// grey center
2012-11-28 15:47:07 +00:00
for ( y = 0 ; y < DEFAULT_SIZE ; y + + )
{
for ( x = 0 ; x < DEFAULT_SIZE ; x + + )
{
2012-11-26 18:58:24 +00:00
data [ y ] [ x ] [ 0 ] = 32 ;
data [ y ] [ x ] [ 1 ] = 32 ;
data [ y ] [ x ] [ 2 ] = 32 ;
data [ y ] [ x ] [ 3 ] = 255 ;
}
}
2019-11-11 19:27:44 +00:00
2012-11-26 18:58:24 +00:00
// white border
2012-11-28 15:47:07 +00:00
for ( x = 0 ; x < DEFAULT_SIZE ; x + + )
{
2012-11-26 18:58:24 +00:00
data [ 0 ] [ x ] [ 0 ] =
data [ 0 ] [ x ] [ 1 ] =
2012-11-28 15:47:07 +00:00
data [ 0 ] [ x ] [ 2 ] =
data [ 0 ] [ x ] [ 3 ] = 255 ;
2019-11-11 19:27:44 +00:00
2012-11-26 18:58:24 +00:00
data [ x ] [ 0 ] [ 0 ] =
data [ x ] [ 0 ] [ 1 ] =
2012-11-28 15:47:07 +00:00
data [ x ] [ 0 ] [ 2 ] =
data [ x ] [ 0 ] [ 3 ] = 255 ;
2019-11-11 19:27:44 +00:00
2012-11-28 15:47:07 +00:00
data [ DEFAULT_SIZE - 1 ] [ x ] [ 0 ] =
data [ DEFAULT_SIZE - 1 ] [ x ] [ 1 ] =
data [ DEFAULT_SIZE - 1 ] [ x ] [ 2 ] =
data [ DEFAULT_SIZE - 1 ] [ x ] [ 3 ] = 255 ;
2019-11-11 19:27:44 +00:00
2012-11-28 15:47:07 +00:00
data [ x ] [ DEFAULT_SIZE - 1 ] [ 0 ] =
data [ x ] [ DEFAULT_SIZE - 1 ] [ 1 ] =
data [ x ] [ DEFAULT_SIZE - 1 ] [ 2 ] =
data [ x ] [ DEFAULT_SIZE - 1 ] [ 3 ] = 255 ;
2012-11-26 18:58:24 +00:00
}
2012-11-28 15:47:07 +00:00
}
else
{
for ( y = 0 ; y < DEFAULT_SIZE ; y + + )
{
for ( x = 0 ; x < DEFAULT_SIZE ; x + + )
{
2012-11-26 18:58:24 +00:00
data [ y ] [ x ] [ 0 ] = 0 ;
data [ y ] [ x ] [ 1 ] = 0 ;
data [ y ] [ x ] [ 2 ] = 0 ;
data [ y ] [ x ] [ 3 ] = 0 ;
}
}
}
2019-11-11 19:27:44 +00:00
2012-11-28 15:47:07 +00:00
GenerateImage ( ( byte * ) data ,
DEFAULT_SIZE , DEFAULT_SIZE ,
2022-02-21 15:29:53 +00:00
TF_DEFAULT , TR_REPEAT , TD_DEFAULT , commandList ) ;
2019-11-11 19:27:44 +00:00
2012-11-26 18:58:24 +00:00
defaulted = true ;
}
2022-02-21 15:29:53 +00:00
static void R_DefaultImage ( idImage * image , nvrhi : : ICommandList * commandList )
2012-11-28 15:47:07 +00:00
{
2022-02-21 15:29:53 +00:00
image - > MakeDefault ( commandList ) ;
2012-11-26 18:58:24 +00:00
}
2022-02-21 15:29:53 +00:00
static void R_WhiteImage ( idImage * image , nvrhi : : ICommandList * commandList )
2012-11-28 15:47:07 +00:00
{
2012-11-26 18:58:24 +00:00
byte data [ DEFAULT_SIZE ] [ DEFAULT_SIZE ] [ 4 ] ;
2019-11-11 19:27:44 +00:00
2012-11-26 18:58:24 +00:00
// solid white texture
memset ( data , 255 , sizeof ( data ) ) ;
2012-11-28 15:47:07 +00:00
image - > GenerateImage ( ( byte * ) data , DEFAULT_SIZE , DEFAULT_SIZE ,
2022-02-21 15:29:53 +00:00
TF_DEFAULT , TR_REPEAT , TD_DEFAULT , commandList ) ;
2012-11-26 18:58:24 +00:00
}
2022-02-21 15:29:53 +00:00
static void R_BlackImage ( idImage * image , nvrhi : : ICommandList * commandList )
2012-11-28 15:47:07 +00:00
{
2012-11-26 18:58:24 +00:00
byte data [ DEFAULT_SIZE ] [ DEFAULT_SIZE ] [ 4 ] ;
2019-11-11 19:27:44 +00:00
2012-11-26 18:58:24 +00:00
// solid black texture
memset ( data , 0 , sizeof ( data ) ) ;
2012-11-28 15:47:07 +00:00
image - > GenerateImage ( ( byte * ) data , DEFAULT_SIZE , DEFAULT_SIZE ,
2022-02-21 15:29:53 +00:00
TF_DEFAULT , TR_REPEAT , TD_DEFAULT , commandList ) ;
2012-11-26 18:58:24 +00:00
}
2022-04-13 20:05:05 +00:00
static void R_BlackDiffuseImage ( idImage * image , nvrhi : : ICommandList * commandList )
{
byte data [ DEFAULT_SIZE ] [ DEFAULT_SIZE ] [ 4 ] ;
// solid black texture
memset ( data , 0 , sizeof ( data ) ) ;
image - > GenerateImage ( ( byte * ) data , DEFAULT_SIZE , DEFAULT_SIZE ,
TF_DEFAULT , TR_REPEAT , TD_DIFFUSE , commandList ) ;
}
2022-02-21 15:29:53 +00:00
static void R_CyanImage ( idImage * image , nvrhi : : ICommandList * commandList )
2020-04-20 18:51:31 +00:00
{
byte data [ DEFAULT_SIZE ] [ DEFAULT_SIZE ] [ 4 ] ;
for ( int x = 0 ; x < DEFAULT_SIZE ; x + + )
{
for ( int y = 0 ; y < DEFAULT_SIZE ; y + + )
{
data [ y ] [ x ] [ 0 ] = byte ( colorCyan . x * 255 ) ;
data [ y ] [ x ] [ 1 ] = byte ( colorCyan . y * 255 ) ;
data [ y ] [ x ] [ 2 ] = byte ( colorCyan . z * 255 ) ;
data [ y ] [ x ] [ 3 ] = byte ( colorCyan . w * 255 ) ;
}
}
2022-02-21 15:29:53 +00:00
image - > GenerateImage ( ( byte * ) data , DEFAULT_SIZE , DEFAULT_SIZE , TF_DEFAULT , TR_REPEAT , TD_DIFFUSE , commandList ) ;
2020-04-20 18:51:31 +00:00
}
2022-02-21 15:29:53 +00:00
static void R_ChromeSpecImage ( idImage * image , nvrhi : : ICommandList * commandList )
2020-04-20 18:51:31 +00:00
{
byte data [ DEFAULT_SIZE ] [ DEFAULT_SIZE ] [ 4 ] ;
for ( int x = 0 ; x < DEFAULT_SIZE ; x + + )
{
for ( int y = 0 ; y < DEFAULT_SIZE ; y + + )
{
data [ y ] [ x ] [ 0 ] = 0 ;
data [ y ] [ x ] [ 1 ] = 255 ;
data [ y ] [ x ] [ 2 ] = 255 ;
data [ y ] [ x ] [ 3 ] = 255 ;
}
}
2022-02-21 15:29:53 +00:00
image - > GenerateImage ( ( byte * ) data , DEFAULT_SIZE , DEFAULT_SIZE , TF_DEFAULT , TR_REPEAT , TD_SPECULAR_PBR_RMAO , commandList ) ;
2020-04-20 18:51:31 +00:00
}
2022-02-21 15:29:53 +00:00
static void R_PlasticSpecImage ( idImage * image , nvrhi : : ICommandList * commandList )
2020-04-20 18:51:31 +00:00
{
byte data [ DEFAULT_SIZE ] [ DEFAULT_SIZE ] [ 4 ] ;
for ( int x = 0 ; x < DEFAULT_SIZE ; x + + )
{
for ( int y = 0 ; y < DEFAULT_SIZE ; y + + )
{
data [ y ] [ x ] [ 0 ] = 0 ;
data [ y ] [ x ] [ 1 ] = 0 ;
data [ y ] [ x ] [ 2 ] = 255 ;
data [ y ] [ x ] [ 3 ] = 255 ;
}
}
2022-02-21 15:29:53 +00:00
image - > GenerateImage ( ( byte * ) data , DEFAULT_SIZE , DEFAULT_SIZE , TF_DEFAULT , TR_REPEAT , TD_SPECULAR_PBR_RMAO , commandList ) ;
2020-04-20 18:51:31 +00:00
}
2022-02-21 15:29:53 +00:00
static void R_RGBA8Image ( idImage * image , nvrhi : : ICommandList * commandList )
2012-11-28 15:47:07 +00:00
{
2012-11-26 18:58:24 +00:00
byte data [ DEFAULT_SIZE ] [ DEFAULT_SIZE ] [ 4 ] ;
2019-11-11 19:27:44 +00:00
2012-11-26 18:58:24 +00:00
memset ( data , 0 , sizeof ( data ) ) ;
data [ 0 ] [ 0 ] [ 0 ] = 16 ;
data [ 0 ] [ 0 ] [ 1 ] = 32 ;
data [ 0 ] [ 0 ] [ 2 ] = 48 ;
data [ 0 ] [ 0 ] [ 3 ] = 96 ;
2019-11-11 19:27:44 +00:00
2022-02-21 15:29:53 +00:00
image - > GenerateImage ( ( byte * ) data , DEFAULT_SIZE , DEFAULT_SIZE , TF_DEFAULT , TR_REPEAT , TD_LOOKUP_TABLE_RGBA , commandList ) ;
2012-11-26 18:58:24 +00:00
}
2023-10-17 22:01:35 +00:00
static void R_RGBA8Image_RT ( idImage * image , nvrhi : : ICommandList * commandList )
{
image - > GenerateImage ( nullptr , 512 , 512 , TF_NEAREST , TR_CLAMP , TD_LOOKUP_TABLE_RGBA , nullptr , true , false , 1 ) ;
}
2022-02-21 15:29:53 +00:00
static void R_RGBA8LinearImage ( idImage * image , nvrhi : : ICommandList * commandList )
2015-12-28 20:36:25 +00:00
{
byte data [ DEFAULT_SIZE ] [ DEFAULT_SIZE ] [ 4 ] ;
2019-11-11 19:27:44 +00:00
2015-12-28 20:36:25 +00:00
memset ( data , 0 , sizeof ( data ) ) ;
data [ 0 ] [ 0 ] [ 0 ] = 16 ;
data [ 0 ] [ 0 ] [ 1 ] = 32 ;
data [ 0 ] [ 0 ] [ 2 ] = 48 ;
data [ 0 ] [ 0 ] [ 3 ] = 96 ;
2019-11-11 19:27:44 +00:00
2022-02-21 15:29:53 +00:00
image - > GenerateImage ( ( byte * ) data , DEFAULT_SIZE , DEFAULT_SIZE , TF_LINEAR , TR_REPEAT , TD_LOOKUP_TABLE_RGBA , commandList ) ;
2015-12-28 20:36:25 +00:00
}
2022-02-21 15:29:53 +00:00
static void R_LdrNativeImage ( idImage * image , nvrhi : : ICommandList * commandList )
{
2022-04-13 20:05:05 +00:00
image - > GenerateImage ( NULL , renderSystem - > GetWidth ( ) , renderSystem - > GetHeight ( ) , TF_NEAREST , TR_CLAMP , TD_LOOKUP_TABLE_RGBA , nullptr , true , false , 1 ) ;
2022-02-21 15:29:53 +00:00
}
static void R_DepthImage ( idImage * image , nvrhi : : ICommandList * commandList )
2012-11-28 15:47:07 +00:00
{
2022-04-19 19:56:30 +00:00
uint sampleCount = R_GetMSAASamples ( ) ;
2022-04-13 20:05:05 +00:00
image - > GenerateImage ( NULL , renderSystem - > GetWidth ( ) , renderSystem - > GetHeight ( ) , TF_NEAREST , TR_CLAMP , TD_DEPTH_STENCIL , nullptr , true , false , sampleCount ) ;
2012-11-26 18:58:24 +00:00
}
2015-12-20 11:28:46 +00:00
// RB begin
2022-04-13 20:05:05 +00:00
static void R_HDR_RGBA16FImage_ResNative_MSAAOpt ( idImage * image , nvrhi : : ICommandList * commandList )
{
2022-04-19 19:56:30 +00:00
uint sampleCount = R_GetMSAASamples ( ) ;
2022-04-13 20:05:05 +00:00
image - > GenerateImage ( NULL , renderSystem - > GetWidth ( ) , renderSystem - > GetHeight ( ) , TF_NEAREST , TR_CLAMP , TD_RGBA16F , nullptr , true , sampleCount = = 1 , sampleCount ) ;
}
2022-04-19 19:56:30 +00:00
static void R_HDR_RG16FImage_ResNative ( idImage * image , nvrhi : : ICommandList * commandList )
{
image - > GenerateImage ( NULL , renderSystem - > GetWidth ( ) , renderSystem - > GetHeight ( ) , TF_NEAREST , TR_CLAMP , TD_RG16F , nullptr , true ) ;
}
2022-02-21 15:29:53 +00:00
static void R_HDR_RGBA16FImage_ResNative ( idImage * image , nvrhi : : ICommandList * commandList )
2015-12-20 11:28:46 +00:00
{
2022-04-12 16:15:48 +00:00
image - > GenerateImage ( NULL , renderSystem - > GetWidth ( ) , renderSystem - > GetHeight ( ) , TF_NEAREST , TR_CLAMP , TD_RGBA16F , nullptr , true ) ;
}
static void R_HDR_RGBA16FImage_ResNative_UAV ( idImage * image , nvrhi : : ICommandList * commandList )
{
image - > GenerateImage ( NULL , renderSystem - > GetWidth ( ) , renderSystem - > GetHeight ( ) , TF_NEAREST , TR_CLAMP , TD_RGBA16F , nullptr , true , true ) ;
}
static void R_HDR_RGBA16SImage_ResNative_UAV ( idImage * image , nvrhi : : ICommandList * commandList )
{
image - > GenerateImage ( NULL , renderSystem - > GetWidth ( ) , renderSystem - > GetHeight ( ) , TF_NEAREST , TR_CLAMP , TD_RGBA16S , nullptr , true , true ) ;
2022-02-21 15:29:53 +00:00
}
static void R_HDR_RGBA16FImage_ResGui ( idImage * image , nvrhi : : ICommandList * commandList )
{
image - > GenerateImage ( NULL , SCREEN_WIDTH , SCREEN_HEIGHT , TF_NEAREST , TR_CLAMP , TD_RGBA16F , nullptr , true ) ;
}
static void R_RGBA8Image_ResGui ( idImage * image , nvrhi : : ICommandList * commandList )
{
image - > GenerateImage ( NULL , SCREEN_WIDTH , SCREEN_HEIGHT , TF_DEFAULT , TR_CLAMP , TD_LOOKUP_TABLE_RGBA , nullptr , true ) ;
}
static void R_HDR_RGBA16FImage_ResNative_Linear ( idImage * image , nvrhi : : ICommandList * commandList )
{
image - > GenerateImage ( NULL , renderSystem - > GetWidth ( ) , renderSystem - > GetHeight ( ) , TF_NEAREST , TR_CLAMP , TD_RGBA16F , nullptr , true ) ;
}
static void R_HDR_RGBA16FImage_ResNative_NoMSAA ( idImage * image , nvrhi : : ICommandList * commandList )
{
image - > GenerateImage ( NULL , renderSystem - > GetWidth ( ) , renderSystem - > GetHeight ( ) , TF_NEAREST , TR_CLAMP , TD_RGBA16F , nullptr , true ) ;
}
static void R_HDR_RGBA16FImage_ResQuarter ( idImage * image , nvrhi : : ICommandList * commandList )
{
image - > GenerateImage ( NULL , renderSystem - > GetWidth ( ) / 4 , renderSystem - > GetHeight ( ) / 4 , TF_NEAREST , TR_CLAMP , TD_RGBA16F , nullptr , true ) ;
2015-12-20 11:28:46 +00:00
}
2022-02-21 15:29:53 +00:00
static void R_HDR_RGBA16FImage_ResQuarter_Linear ( idImage * image , nvrhi : : ICommandList * commandList )
2015-12-20 11:28:46 +00:00
{
2022-02-21 15:29:53 +00:00
image - > GenerateImage ( NULL , renderSystem - > GetWidth ( ) / 4 , renderSystem - > GetHeight ( ) / 4 , TF_LINEAR , TR_CLAMP , TD_LOOKUP_TABLE_RGBA , nullptr , true ) ;
2015-12-20 11:28:46 +00:00
}
2022-02-21 15:29:53 +00:00
static void R_HDR_RGBA16FImage_Res64 ( idImage * image , nvrhi : : ICommandList * commandList )
2015-12-20 11:28:46 +00:00
{
2022-02-21 15:29:53 +00:00
image - > GenerateImage ( NULL , 64 , 64 , TF_NEAREST , TR_CLAMP , TD_RGBA16F , nullptr , true ) ;
2015-12-20 11:28:46 +00:00
}
2022-02-21 15:29:53 +00:00
static void R_EnvprobeImage_HDR ( idImage * image , nvrhi : : ICommandList * commandList )
2015-12-20 11:28:46 +00:00
{
2022-02-21 15:29:53 +00:00
image - > GenerateImage ( NULL , ENVPROBE_CAPTURE_SIZE , ENVPROBE_CAPTURE_SIZE , TF_NEAREST , TR_CLAMP , TD_RGBA16F , nullptr , true ) ;
2015-12-20 11:28:46 +00:00
}
2022-02-21 15:29:53 +00:00
static void R_EnvprobeImage_Depth ( idImage * image , nvrhi : : ICommandList * commandList )
2015-12-20 11:28:46 +00:00
{
2022-02-21 15:29:53 +00:00
image - > GenerateImage ( NULL , ENVPROBE_CAPTURE_SIZE , ENVPROBE_CAPTURE_SIZE , TF_NEAREST , TR_CLAMP , TD_DEPTH_STENCIL , nullptr , true ) ;
2015-12-20 11:28:46 +00:00
}
2015-12-26 15:11:47 +00:00
2022-02-21 15:29:53 +00:00
static void R_SMAAImage_ResNative ( idImage * image , nvrhi : : ICommandList * commandList )
2021-03-14 12:22:17 +00:00
{
2022-02-21 15:29:53 +00:00
image - > GenerateImage ( NULL , renderSystem - > GetWidth ( ) , renderSystem - > GetHeight ( ) , TF_LINEAR , TR_CLAMP , TD_LOOKUP_TABLE_RGBA , nullptr , true ) ;
2021-03-14 12:22:17 +00:00
}
2022-02-21 15:29:53 +00:00
static void R_AmbientOcclusionImage_ResNative ( idImage * image , nvrhi : : ICommandList * commandList )
2021-03-14 12:22:17 +00:00
{
2022-07-03 09:26:54 +00:00
image - > GenerateImage ( NULL , renderSystem - > GetWidth ( ) , renderSystem - > GetHeight ( ) , TF_LINEAR , TR_CLAMP , TD_R8F , nullptr , true , true ) ;
2021-03-14 12:22:17 +00:00
}
2022-02-21 15:29:53 +00:00
static void R_GeometryBufferImage_ResNative ( idImage * image , nvrhi : : ICommandList * commandList )
2015-12-26 15:11:47 +00:00
{
2022-04-19 19:56:30 +00:00
uint sampleCount = R_GetMSAASamples ( ) ;
2022-04-13 20:05:05 +00:00
image - > GenerateImage ( NULL , renderSystem - > GetWidth ( ) , renderSystem - > GetHeight ( ) , TF_LINEAR , TR_CLAMP , TD_RGBA16F , nullptr , true , false , sampleCount ) ;
2015-12-26 15:11:47 +00:00
}
2016-01-09 12:38:49 +00:00
2022-02-21 15:29:53 +00:00
static void R_SSAOImage_ResHalf ( idImage * image , nvrhi : : ICommandList * commandList )
2020-05-15 14:25:36 +00:00
{
2022-02-21 15:29:53 +00:00
image - > GenerateImage ( NULL , renderSystem - > GetWidth ( ) / 2 , renderSystem - > GetHeight ( ) / 2 , TF_LINEAR , TR_CLAMP , TD_LOOKUP_TABLE_RGBA , nullptr , true ) ;
2020-05-15 14:25:36 +00:00
}
2022-02-21 15:29:53 +00:00
static void R_HierarchicalZBufferImage_ResNative ( idImage * image , nvrhi : : ICommandList * commandList )
2020-05-10 10:58:14 +00:00
{
2022-07-03 09:26:54 +00:00
image - > GenerateImage ( NULL , renderSystem - > GetWidth ( ) , renderSystem - > GetHeight ( ) , TF_NEAREST_MIPMAP , TR_CLAMP , TD_R32F , nullptr , true , true ) ;
2020-05-10 10:58:14 +00:00
}
2022-02-21 15:29:53 +00:00
static void R_R8Image_ResNative_Linear ( idImage * image , nvrhi : : ICommandList * commandList )
2016-01-09 12:38:49 +00:00
{
2022-02-21 15:29:53 +00:00
image - > GenerateImage ( NULL , renderSystem - > GetWidth ( ) , renderSystem - > GetHeight ( ) , TF_LINEAR , TR_CLAMP , TD_LOOKUP_TABLE_MONO , nullptr , true ) ;
2016-01-09 12:38:49 +00:00
}
2015-12-20 11:28:46 +00:00
// RB end
2022-02-21 15:29:53 +00:00
static void R_HDR_RGBA8Image_ResNative ( idImage * image , nvrhi : : ICommandList * commandList )
{
image - > GenerateImage ( NULL , renderSystem - > GetWidth ( ) , renderSystem - > GetHeight ( ) , TF_NEAREST , TR_CLAMP , TD_LOOKUP_TABLE_RGBA , commandList , true ) ;
}
static void R_AlphaNotchImage ( idImage * image , nvrhi : : ICommandList * commandList )
2012-11-28 15:47:07 +00:00
{
2012-11-26 18:58:24 +00:00
byte data [ 2 ] [ 4 ] ;
2019-11-11 19:27:44 +00:00
2012-11-26 18:58:24 +00:00
// this is used for alpha test clip planes
2019-11-11 19:27:44 +00:00
2012-11-26 18:58:24 +00:00
data [ 0 ] [ 0 ] = data [ 0 ] [ 1 ] = data [ 0 ] [ 2 ] = 255 ;
data [ 0 ] [ 3 ] = 0 ;
data [ 1 ] [ 0 ] = data [ 1 ] [ 1 ] = data [ 1 ] [ 2 ] = 255 ;
data [ 1 ] [ 3 ] = 255 ;
2019-11-11 19:27:44 +00:00
2022-02-21 15:29:53 +00:00
image - > GenerateImage ( ( byte * ) data , 2 , 1 , TF_NEAREST , TR_CLAMP , TD_LOOKUP_TABLE_ALPHA , commandList ) ;
2012-11-26 18:58:24 +00:00
}
2022-02-21 15:29:53 +00:00
static void R_FlatNormalImage ( idImage * image , nvrhi : : ICommandList * commandList )
2012-11-28 15:47:07 +00:00
{
2012-11-26 18:58:24 +00:00
byte data [ DEFAULT_SIZE ] [ DEFAULT_SIZE ] [ 4 ] ;
2019-11-11 19:27:44 +00:00
2022-02-21 15:29:53 +00:00
// flat normal map for default bump mapping
2022-03-09 19:40:15 +00:00
for ( int i = 0 ; i < DEFAULT_SIZE ; i + + )
2012-11-28 15:47:07 +00:00
{
2022-03-09 19:40:15 +00:00
for ( int j = 0 ; j < DEFAULT_SIZE ; j + + )
{
data [ j ] [ i ] [ 0 ] = 128 ;
data [ j ] [ i ] [ 1 ] = 128 ;
data [ j ] [ i ] [ 2 ] = 255 ;
data [ j ] [ i ] [ 3 ] = 255 ;
}
2012-11-26 18:58:24 +00:00
}
2022-03-09 19:40:15 +00:00
image - > GenerateImage ( ( byte * ) data , 16 , 16 , TF_DEFAULT , TR_REPEAT , TD_BUMP , commandList ) ;
2012-11-26 18:58:24 +00:00
}
/*
= = = = = = = = = = = = = = = =
R_CreateNoFalloffImage
This is a solid white texture that is zero clamped .
= = = = = = = = = = = = = = = =
*/
2022-02-21 15:29:53 +00:00
static void R_CreateNoFalloffImage ( idImage * image , nvrhi : : ICommandList * commandList )
2012-11-28 15:47:07 +00:00
{
int x , y ;
2012-11-26 18:58:24 +00:00
byte data [ 16 ] [ FALLOFF_TEXTURE_SIZE ] [ 4 ] ;
2019-11-11 19:27:44 +00:00
2012-11-26 18:58:24 +00:00
memset ( data , 0 , sizeof ( data ) ) ;
2012-11-28 15:47:07 +00:00
for ( x = 1 ; x < FALLOFF_TEXTURE_SIZE - 1 ; x + + )
{
for ( y = 1 ; y < 15 ; y + + )
{
2012-11-26 18:58:24 +00:00
data [ y ] [ x ] [ 0 ] = 255 ;
data [ y ] [ x ] [ 1 ] = 255 ;
data [ y ] [ x ] [ 2 ] = 255 ;
data [ y ] [ x ] [ 3 ] = 255 ;
}
}
2022-02-21 15:29:53 +00:00
image - > GenerateImage ( ( byte * ) data , FALLOFF_TEXTURE_SIZE , 16 , TF_DEFAULT , TR_CLAMP_TO_ZERO , TD_LOOKUP_TABLE_MONO , commandList ) ;
2012-11-26 18:58:24 +00:00
}
/*
= = = = = = = = = = = = = = = =
R_FogImage
We calculate distance correctly in two planes , but the
third will still be projection based
= = = = = = = = = = = = = = = =
*/
const int FOG_SIZE = 128 ;
2022-02-21 15:29:53 +00:00
void R_FogImage ( idImage * image , nvrhi : : ICommandList * commandList )
2012-11-28 15:47:07 +00:00
{
int x , y ;
2012-11-26 18:58:24 +00:00
byte data [ FOG_SIZE ] [ FOG_SIZE ] [ 4 ] ;
int b ;
2019-11-11 19:27:44 +00:00
2012-11-26 18:58:24 +00:00
float step [ 256 ] ;
int i ;
float remaining = 1.0 ;
2012-11-28 15:47:07 +00:00
for ( i = 0 ; i < 256 ; i + + )
{
2012-11-26 18:58:24 +00:00
step [ i ] = remaining ;
remaining * = 0.982f ;
}
2019-11-11 19:27:44 +00:00
2012-11-28 15:47:07 +00:00
for ( x = 0 ; x < FOG_SIZE ; x + + )
{
for ( y = 0 ; y < FOG_SIZE ; y + + )
{
2012-11-26 18:58:24 +00:00
float d ;
2019-11-11 19:27:44 +00:00
2012-11-28 15:47:07 +00:00
d = idMath : : Sqrt ( ( x - FOG_SIZE / 2 ) * ( x - FOG_SIZE / 2 )
+ ( y - FOG_SIZE / 2 ) * ( y - FOG_SIZE / 2 ) ) ;
d / = FOG_SIZE / 2 - 1 ;
2019-11-11 19:27:44 +00:00
2012-11-28 15:47:07 +00:00
b = ( byte ) ( d * 255 ) ;
if ( b < = 0 )
{
2012-11-26 18:58:24 +00:00
b = 0 ;
2012-11-28 15:47:07 +00:00
}
else if ( b > 255 )
{
2012-11-26 18:58:24 +00:00
b = 255 ;
}
2012-11-28 15:47:07 +00:00
b = ( byte ) ( 255 * ( 1.0 - step [ b ] ) ) ;
if ( x = = 0 | | x = = FOG_SIZE - 1 | | y = = 0 | | y = = FOG_SIZE - 1 )
{
2012-11-26 18:58:24 +00:00
b = 255 ; // avoid clamping issues
}
data [ y ] [ x ] [ 0 ] =
2012-11-28 15:47:07 +00:00
data [ y ] [ x ] [ 1 ] =
data [ y ] [ x ] [ 2 ] = 255 ;
2012-11-26 18:58:24 +00:00
data [ y ] [ x ] [ 3 ] = b ;
}
}
2019-11-11 19:27:44 +00:00
2022-02-21 15:29:53 +00:00
image - > GenerateImage ( ( byte * ) data , FOG_SIZE , FOG_SIZE , TF_LINEAR , TR_CLAMP , TD_LOOKUP_TABLE_ALPHA , commandList ) ;
2012-11-26 18:58:24 +00:00
}
/*
= = = = = = = = = = = = = = = =
FogFraction
Height values below zero are inside the fog volume
= = = = = = = = = = = = = = = =
*/
static const float RAMP_RANGE = 8 ;
static const float DEEP_RANGE = - 30 ;
2012-11-28 15:47:07 +00:00
static float FogFraction ( float viewHeight , float targetHeight )
{
2012-11-26 18:58:24 +00:00
float total = idMath : : Fabs ( targetHeight - viewHeight ) ;
2019-11-11 19:27:44 +00:00
2012-11-26 18:58:24 +00:00
// return targetHeight >= 0 ? 0 : 1.0;
// only ranges that cross the ramp range are special
2012-11-28 15:47:07 +00:00
if ( targetHeight > 0 & & viewHeight > 0 )
{
2012-11-26 18:58:24 +00:00
return 0.0 ;
}
2012-11-28 15:47:07 +00:00
if ( targetHeight < - RAMP_RANGE & & viewHeight < - RAMP_RANGE )
{
2012-11-26 18:58:24 +00:00
return 1.0 ;
}
2019-11-11 19:27:44 +00:00
2012-11-26 18:58:24 +00:00
float above ;
2012-11-28 15:47:07 +00:00
if ( targetHeight > 0 )
{
2012-11-26 18:58:24 +00:00
above = targetHeight ;
2012-11-28 15:47:07 +00:00
}
else if ( viewHeight > 0 )
{
2012-11-26 18:58:24 +00:00
above = viewHeight ;
2012-11-28 15:47:07 +00:00
}
else
{
2012-11-26 18:58:24 +00:00
above = 0 ;
}
2019-11-11 19:27:44 +00:00
2012-11-26 18:58:24 +00:00
float rampTop , rampBottom ;
2019-11-11 19:27:44 +00:00
2012-11-28 15:47:07 +00:00
if ( viewHeight > targetHeight )
{
2012-11-26 18:58:24 +00:00
rampTop = viewHeight ;
rampBottom = targetHeight ;
2012-11-28 15:47:07 +00:00
}
else
{
2012-11-26 18:58:24 +00:00
rampTop = targetHeight ;
rampBottom = viewHeight ;
}
2012-11-28 15:47:07 +00:00
if ( rampTop > 0 )
{
2012-11-26 18:58:24 +00:00
rampTop = 0 ;
}
2012-11-28 15:47:07 +00:00
if ( rampBottom < - RAMP_RANGE )
{
2012-11-26 18:58:24 +00:00
rampBottom = - RAMP_RANGE ;
}
2019-11-11 19:27:44 +00:00
2012-11-26 18:58:24 +00:00
float rampSlope = 1.0 / RAMP_RANGE ;
2019-11-11 19:27:44 +00:00
2012-11-28 15:47:07 +00:00
if ( ! total )
{
2012-11-26 18:58:24 +00:00
return - viewHeight * rampSlope ;
}
2019-11-11 19:27:44 +00:00
2012-11-26 18:58:24 +00:00
float ramp = ( 1.0 - ( rampTop * rampSlope + rampBottom * rampSlope ) * - 0.5 ) * ( rampTop - rampBottom ) ;
2019-11-11 19:27:44 +00:00
2012-11-26 18:58:24 +00:00
float frac = ( total - above - ramp ) / total ;
2019-11-11 19:27:44 +00:00
2012-11-26 18:58:24 +00:00
// after it gets moderately deep, always use full value
float deepest = viewHeight < targetHeight ? viewHeight : targetHeight ;
2019-11-11 19:27:44 +00:00
2012-11-26 18:58:24 +00:00
float deepFrac = deepest / DEEP_RANGE ;
2012-11-28 15:47:07 +00:00
if ( deepFrac > = 1.0 )
{
2012-11-26 18:58:24 +00:00
return 1.0 ;
}
2019-11-11 19:27:44 +00:00
2012-11-26 18:58:24 +00:00
frac = frac * ( 1.0 - deepFrac ) + deepFrac ;
2019-11-11 19:27:44 +00:00
2012-11-26 18:58:24 +00:00
return frac ;
}
/*
= = = = = = = = = = = = = = = =
R_FogEnterImage
Modulate the fog alpha density based on the distance of the
start and end points to the terminator plane
= = = = = = = = = = = = = = = =
*/
2022-02-21 15:29:53 +00:00
void R_FogEnterImage ( idImage * image , nvrhi : : ICommandList * commandList )
2012-11-28 15:47:07 +00:00
{
int x , y ;
2012-11-26 18:58:24 +00:00
byte data [ FOG_ENTER_SIZE ] [ FOG_ENTER_SIZE ] [ 4 ] ;
int b ;
2019-11-11 19:27:44 +00:00
2012-11-28 15:47:07 +00:00
for ( x = 0 ; x < FOG_ENTER_SIZE ; x + + )
{
for ( y = 0 ; y < FOG_ENTER_SIZE ; y + + )
{
2012-11-26 18:58:24 +00:00
float d ;
2019-11-11 19:27:44 +00:00
2012-11-28 15:47:07 +00:00
d = FogFraction ( x - ( FOG_ENTER_SIZE / 2 ) , y - ( FOG_ENTER_SIZE / 2 ) ) ;
2019-11-11 19:27:44 +00:00
2012-11-28 15:47:07 +00:00
b = ( byte ) ( d * 255 ) ;
if ( b < = 0 )
{
2012-11-26 18:58:24 +00:00
b = 0 ;
2012-11-28 15:47:07 +00:00
}
else if ( b > 255 )
{
2012-11-26 18:58:24 +00:00
b = 255 ;
}
data [ y ] [ x ] [ 0 ] =
2012-11-28 15:47:07 +00:00
data [ y ] [ x ] [ 1 ] =
data [ y ] [ x ] [ 2 ] = 255 ;
2012-11-26 18:58:24 +00:00
data [ y ] [ x ] [ 3 ] = b ;
}
}
2019-11-11 19:27:44 +00:00
2012-11-26 18:58:24 +00:00
// if mipmapped, acutely viewed surfaces fade wrong
2022-02-21 15:29:53 +00:00
image - > GenerateImage ( ( byte * ) data , FOG_ENTER_SIZE , FOG_ENTER_SIZE , TF_LINEAR , TR_CLAMP , TD_LOOKUP_TABLE_ALPHA , commandList ) ;
2012-11-26 18:58:24 +00:00
}
/*
= = = = = = = = = = = = = = = =
R_QuadraticImage
= = = = = = = = = = = = = = = =
*/
static const int QUADRATIC_WIDTH = 32 ;
static const int QUADRATIC_HEIGHT = 4 ;
2022-02-21 15:29:53 +00:00
void R_QuadraticImage ( idImage * image , nvrhi : : ICommandList * commandList )
2012-11-28 15:47:07 +00:00
{
int x , y ;
2012-11-26 18:58:24 +00:00
byte data [ QUADRATIC_HEIGHT ] [ QUADRATIC_WIDTH ] [ 4 ] ;
int b ;
2019-11-11 19:27:44 +00:00
2012-11-28 15:47:07 +00:00
for ( x = 0 ; x < QUADRATIC_WIDTH ; x + + )
{
for ( y = 0 ; y < QUADRATIC_HEIGHT ; y + + )
{
2012-11-26 18:58:24 +00:00
float d ;
2019-11-11 19:27:44 +00:00
2012-11-28 15:47:07 +00:00
d = x - ( QUADRATIC_WIDTH / 2 - 0.5 ) ;
2012-11-26 18:58:24 +00:00
d = idMath : : Fabs ( d ) ;
d - = 0.5 ;
2012-11-28 15:47:07 +00:00
d / = QUADRATIC_WIDTH / 2 ;
2019-11-11 19:27:44 +00:00
2012-11-26 18:58:24 +00:00
d = 1.0 - d ;
d = d * d ;
2019-11-11 19:27:44 +00:00
2012-11-28 15:47:07 +00:00
b = ( byte ) ( d * 255 ) ;
if ( b < = 0 )
{
2012-11-26 18:58:24 +00:00
b = 0 ;
2012-11-28 15:47:07 +00:00
}
else if ( b > 255 )
{
2012-11-26 18:58:24 +00:00
b = 255 ;
}
data [ y ] [ x ] [ 0 ] =
2012-11-28 15:47:07 +00:00
data [ y ] [ x ] [ 1 ] =
data [ y ] [ x ] [ 2 ] = b ;
2012-11-26 18:58:24 +00:00
data [ y ] [ x ] [ 3 ] = 255 ;
}
}
2019-11-11 19:27:44 +00:00
2022-02-21 15:29:53 +00:00
image - > GenerateImage ( ( byte * ) data , QUADRATIC_WIDTH , QUADRATIC_HEIGHT , TF_DEFAULT , TR_CLAMP , TD_LOOKUP_TABLE_RGB1 , commandList ) ;
2012-11-26 18:58:24 +00:00
}
2014-05-10 12:40:01 +00:00
// RB begin
2022-03-30 09:22:58 +00:00
static void R_CreateShadowMapImage_Atlas ( idImage * image , nvrhi : : ICommandList * commandList )
{
2022-04-01 15:38:52 +00:00
image - > GenerateImage ( NULL , r_shadowMapAtlasSize . GetInteger ( ) , r_shadowMapAtlasSize . GetInteger ( ) , TF_LINEAR , TR_CLAMP_TO_ZERO_ALPHA , TD_DEPTH , commandList , true ) ;
2022-03-30 09:22:58 +00:00
}
2022-02-21 15:29:53 +00:00
static void R_CreateShadowMapImage_Res0 ( idImage * image , nvrhi : : ICommandList * commandList )
2014-05-10 12:40:01 +00:00
{
2014-05-11 20:30:01 +00:00
int size = shadowMapResolutions [ 0 ] ;
2022-02-21 15:29:53 +00:00
image - > GenerateShadowArray ( size , size , TF_LINEAR , TR_CLAMP_TO_ZERO_ALPHA , TD_SHADOW_ARRAY , commandList ) ;
2014-05-11 20:30:01 +00:00
}
2022-02-21 15:29:53 +00:00
static void R_CreateShadowMapImage_Res1 ( idImage * image , nvrhi : : ICommandList * commandList )
2014-05-11 20:30:01 +00:00
{
int size = shadowMapResolutions [ 1 ] ;
2022-02-21 15:29:53 +00:00
image - > GenerateShadowArray ( size , size , TF_LINEAR , TR_CLAMP_TO_ZERO_ALPHA , TD_SHADOW_ARRAY , commandList ) ;
2014-05-11 20:30:01 +00:00
}
2022-02-21 15:29:53 +00:00
static void R_CreateShadowMapImage_Res2 ( idImage * image , nvrhi : : ICommandList * commandList )
2014-05-11 20:30:01 +00:00
{
int size = shadowMapResolutions [ 2 ] ;
2022-02-21 15:29:53 +00:00
image - > GenerateShadowArray ( size , size , TF_LINEAR , TR_CLAMP_TO_ZERO_ALPHA , TD_SHADOW_ARRAY , commandList ) ;
2014-05-11 20:30:01 +00:00
}
2022-02-21 15:29:53 +00:00
static void R_CreateShadowMapImage_Res3 ( idImage * image , nvrhi : : ICommandList * commandList )
2014-05-11 20:30:01 +00:00
{
int size = shadowMapResolutions [ 3 ] ;
2022-02-21 15:29:53 +00:00
image - > GenerateShadowArray ( size , size , TF_LINEAR , TR_CLAMP_TO_ZERO_ALPHA , TD_SHADOW_ARRAY , commandList ) ;
2014-05-11 20:30:01 +00:00
}
2022-02-21 15:29:53 +00:00
static void R_CreateShadowMapImage_Res4 ( idImage * image , nvrhi : : ICommandList * commandList )
2014-05-11 20:30:01 +00:00
{
int size = shadowMapResolutions [ 4 ] ;
2022-02-21 15:29:53 +00:00
image - > GenerateShadowArray ( size , size , TF_LINEAR , TR_CLAMP_TO_ZERO_ALPHA , TD_SHADOW_ARRAY , commandList ) ;
2014-05-10 12:40:01 +00:00
}
const static int JITTER_SIZE = 128 ;
2022-02-21 15:29:53 +00:00
static void R_CreateJitterImage16 ( idImage * image , nvrhi : : ICommandList * commandList )
2014-05-10 12:40:01 +00:00
{
static byte data [ JITTER_SIZE ] [ JITTER_SIZE * 16 ] [ 4 ] ;
2019-11-11 19:27:44 +00:00
2014-05-10 12:40:01 +00:00
for ( int i = 0 ; i < JITTER_SIZE ; i + + )
{
for ( int s = 0 ; s < 16 ; s + + )
{
int sOfs = 64 * ( s & 3 ) ;
int tOfs = 64 * ( ( s > > 2 ) & 3 ) ;
2019-11-11 19:27:44 +00:00
2014-05-10 12:40:01 +00:00
for ( int j = 0 ; j < JITTER_SIZE ; j + + )
{
data [ i ] [ s * JITTER_SIZE + j ] [ 0 ] = ( rand ( ) & 63 ) | sOfs ;
data [ i ] [ s * JITTER_SIZE + j ] [ 1 ] = ( rand ( ) & 63 ) | tOfs ;
data [ i ] [ s * JITTER_SIZE + j ] [ 2 ] = rand ( ) ;
data [ i ] [ s * JITTER_SIZE + j ] [ 3 ] = 0 ;
}
}
}
2019-11-11 19:27:44 +00:00
2022-02-21 15:29:53 +00:00
image - > GenerateImage ( ( byte * ) data , JITTER_SIZE * 16 , JITTER_SIZE , TF_NEAREST , TR_REPEAT , TD_LOOKUP_TABLE_RGBA , commandList ) ;
2014-05-10 12:40:01 +00:00
}
2022-02-21 15:29:53 +00:00
static void R_CreateJitterImage4 ( idImage * image , nvrhi : : ICommandList * commandList )
2014-05-10 12:40:01 +00:00
{
byte data [ JITTER_SIZE ] [ JITTER_SIZE * 4 ] [ 4 ] ;
2019-11-11 19:27:44 +00:00
2014-05-10 12:40:01 +00:00
for ( int i = 0 ; i < JITTER_SIZE ; i + + )
{
for ( int s = 0 ; s < 4 ; s + + )
{
int sOfs = 128 * ( s & 1 ) ;
int tOfs = 128 * ( ( s > > 1 ) & 1 ) ;
2019-11-11 19:27:44 +00:00
2014-05-10 12:40:01 +00:00
for ( int j = 0 ; j < JITTER_SIZE ; j + + )
{
data [ i ] [ s * JITTER_SIZE + j ] [ 0 ] = ( rand ( ) & 127 ) | sOfs ;
data [ i ] [ s * JITTER_SIZE + j ] [ 1 ] = ( rand ( ) & 127 ) | tOfs ;
data [ i ] [ s * JITTER_SIZE + j ] [ 2 ] = rand ( ) ;
data [ i ] [ s * JITTER_SIZE + j ] [ 3 ] = 0 ;
}
}
}
2019-11-11 19:27:44 +00:00
2022-02-21 15:29:53 +00:00
image - > GenerateImage ( ( byte * ) data , JITTER_SIZE * 4 , JITTER_SIZE , TF_NEAREST , TR_REPEAT , TD_LOOKUP_TABLE_RGBA , commandList ) ;
2014-05-10 12:40:01 +00:00
}
2022-02-21 15:29:53 +00:00
static void R_CreateJitterImage1 ( idImage * image , nvrhi : : ICommandList * commandList )
2014-05-10 12:40:01 +00:00
{
byte data [ JITTER_SIZE ] [ JITTER_SIZE ] [ 4 ] ;
2019-11-11 19:27:44 +00:00
2014-05-10 12:40:01 +00:00
for ( int i = 0 ; i < JITTER_SIZE ; i + + )
{
for ( int j = 0 ; j < JITTER_SIZE ; j + + )
{
data [ i ] [ j ] [ 0 ] = rand ( ) ;
data [ i ] [ j ] [ 1 ] = rand ( ) ;
data [ i ] [ j ] [ 2 ] = rand ( ) ;
data [ i ] [ j ] [ 3 ] = 0 ;
}
}
2019-11-11 19:27:44 +00:00
2022-02-21 15:29:53 +00:00
image - > GenerateImage ( ( byte * ) data , JITTER_SIZE , JITTER_SIZE , TF_NEAREST , TR_REPEAT , TD_LOOKUP_TABLE_RGBA , commandList ) ;
2014-05-10 12:40:01 +00:00
}
2022-02-21 15:29:53 +00:00
static void R_CreateRandom256Image ( idImage * image , nvrhi : : ICommandList * commandList )
2014-05-10 12:40:01 +00:00
{
byte data [ 256 ] [ 256 ] [ 4 ] ;
2019-11-11 19:27:44 +00:00
2014-05-10 12:40:01 +00:00
for ( int i = 0 ; i < 256 ; i + + )
{
for ( int j = 0 ; j < 256 ; j + + )
{
data [ i ] [ j ] [ 0 ] = rand ( ) ;
data [ i ] [ j ] [ 1 ] = rand ( ) ;
data [ i ] [ j ] [ 2 ] = rand ( ) ;
data [ i ] [ j ] [ 3 ] = rand ( ) ;
}
}
2019-11-11 19:27:44 +00:00
2022-02-21 15:29:53 +00:00
image - > GenerateImage ( ( byte * ) data , 256 , 256 , TF_NEAREST , TR_REPEAT , TD_LOOKUP_TABLE_RGBA , commandList ) ;
2014-05-10 12:40:01 +00:00
}
2015-12-21 10:39:19 +00:00
2020-04-28 23:19:53 +00:00
// RB
2022-02-21 15:29:53 +00:00
static void R_CreateBlueNoise256Image ( idImage * image , nvrhi : : ICommandList * commandList )
2020-04-28 23:19:53 +00:00
{
static byte data [ BLUENOISE_TEX_HEIGHT ] [ BLUENOISE_TEX_WIDTH ] [ 4 ] ;
for ( int x = 0 ; x < BLUENOISE_TEX_WIDTH ; x + + )
{
for ( int y = 0 ; y < BLUENOISE_TEX_HEIGHT ; y + + )
{
2020-05-10 20:10:32 +00:00
# if 1
2020-04-28 23:19:53 +00:00
data [ x ] [ y ] [ 0 ] = blueNoiseTexBytes [ y * BLUENOISE_TEX_PITCH + x * 3 + 0 ] ;
data [ x ] [ y ] [ 1 ] = blueNoiseTexBytes [ y * BLUENOISE_TEX_PITCH + x * 3 + 1 ] ;
data [ x ] [ y ] [ 2 ] = blueNoiseTexBytes [ y * BLUENOISE_TEX_PITCH + x * 3 + 2 ] ;
# else
data [ x ] [ y ] [ 0 ] = blueNoiseTexBytes [ y * BLUENOISE_TEX_PITCH + x ] ;
data [ x ] [ y ] [ 1 ] = blueNoiseTexBytes [ y * BLUENOISE_TEX_PITCH + x ] ;
data [ x ] [ y ] [ 2 ] = blueNoiseTexBytes [ y * BLUENOISE_TEX_PITCH + x ] ;
# endif
data [ x ] [ y ] [ 3 ] = 1 ;
}
}
2022-02-21 15:29:53 +00:00
image - > GenerateImage ( ( byte * ) data , BLUENOISE_TEX_WIDTH , BLUENOISE_TEX_HEIGHT , TF_NEAREST , TR_REPEAT , TD_LOOKUP_TABLE_RGBA , commandList ) ;
2020-04-28 23:19:53 +00:00
}
2015-12-23 12:53:21 +00:00
2022-02-21 15:29:53 +00:00
static void R_CreateHeatmap5ColorsImage ( idImage * image , nvrhi : : ICommandList * commandList )
2015-12-21 10:39:19 +00:00
{
int x , y ;
byte data [ 16 ] [ FALLOFF_TEXTURE_SIZE ] [ 4 ] ;
2019-11-11 19:27:44 +00:00
2015-12-21 10:39:19 +00:00
const int numColors = 5 ;
static idVec4 colors [ numColors ] = { colorBlue , colorCyan , colorGreen , colorYellow , colorRed } ;
2019-11-11 19:27:44 +00:00
2015-12-21 10:39:19 +00:00
memset ( data , 0 , sizeof ( data ) ) ;
for ( x = 0 ; x < FALLOFF_TEXTURE_SIZE ; x + + )
{
int index1 , index2 ;
2019-11-11 19:27:44 +00:00
2015-12-21 10:39:19 +00:00
float value = x / ( float ) FALLOFF_TEXTURE_SIZE ;
2019-11-11 19:27:44 +00:00
2015-12-21 10:39:19 +00:00
float lerp = 0.0f ;
2019-11-11 19:27:44 +00:00
2015-12-21 10:39:19 +00:00
if ( value < = 0.0 )
{
index1 = index2 = 0 ;
}
else if ( value > = 1.0f )
{
index1 = index2 = numColors - 1 ;
}
else
{
value = value * ( numColors - 1 ) ;
index1 = idMath : : Floor ( value ) ;
index2 = index1 + 1 ;
lerp = value - float ( index1 ) ;
}
2019-11-11 19:27:44 +00:00
2015-12-21 10:39:19 +00:00
idVec4 color ( 0 , 0 , 0 , 1 ) ;
2019-11-11 19:27:44 +00:00
2015-12-21 10:39:19 +00:00
color . x = ( colors [ index2 ] . x - colors [ index1 ] . x ) * lerp + colors [ index1 ] . x ;
color . y = ( colors [ index2 ] . y - colors [ index1 ] . y ) * lerp + colors [ index1 ] . y ;
color . z = ( colors [ index2 ] . z - colors [ index1 ] . z ) * lerp + colors [ index1 ] . z ;
2019-11-11 19:27:44 +00:00
2015-12-21 10:39:19 +00:00
for ( y = 0 ; y < 16 ; y + + )
{
data [ y ] [ x ] [ 0 ] = color . x * 255 ;
data [ y ] [ x ] [ 1 ] = color . y * 255 ;
data [ y ] [ x ] [ 2 ] = color . z * 255 ;
data [ y ] [ x ] [ 3 ] = 255 ;
}
}
2019-11-11 19:27:44 +00:00
2022-02-21 15:29:53 +00:00
image - > GenerateImage ( ( byte * ) data , FALLOFF_TEXTURE_SIZE , 16 , TF_LINEAR , TR_CLAMP , TD_LOOKUP_TABLE_RGBA , commandList ) ;
2015-12-21 10:39:19 +00:00
}
2022-02-21 15:29:53 +00:00
static void R_CreateHeatmap7ColorsImage ( idImage * image , nvrhi : : ICommandList * commandList )
2015-12-21 10:39:19 +00:00
{
int x , y ;
byte data [ 16 ] [ FALLOFF_TEXTURE_SIZE ] [ 4 ] ;
2019-11-11 19:27:44 +00:00
2015-12-21 10:39:19 +00:00
const int numColors = 7 ;
static idVec4 colors [ numColors ] = { colorBlack , colorBlue , colorCyan , colorGreen , colorYellow , colorRed , colorWhite } ;
2019-11-11 19:27:44 +00:00
2015-12-21 10:39:19 +00:00
memset ( data , 0 , sizeof ( data ) ) ;
for ( x = 0 ; x < FALLOFF_TEXTURE_SIZE ; x + + )
{
int index1 , index2 ;
2019-11-11 19:27:44 +00:00
2015-12-21 10:39:19 +00:00
float value = x / ( float ) FALLOFF_TEXTURE_SIZE ;
2019-11-11 19:27:44 +00:00
2015-12-21 10:39:19 +00:00
float lerp = 0.0f ;
2019-11-11 19:27:44 +00:00
2015-12-21 10:39:19 +00:00
if ( value < = 0.0 )
{
index1 = index2 = 0 ;
}
else if ( value > = 1.0f )
{
index1 = index2 = numColors - 1 ;
}
else
{
value = value * ( numColors - 1 ) ;
index1 = idMath : : Floor ( value ) ;
index2 = index1 + 1 ;
lerp = value - float ( index1 ) ;
}
2019-11-11 19:27:44 +00:00
2015-12-21 10:39:19 +00:00
idVec4 color ( 0 , 0 , 0 , 1 ) ;
2019-11-11 19:27:44 +00:00
2015-12-21 10:39:19 +00:00
color . x = ( colors [ index2 ] . x - colors [ index1 ] . x ) * lerp + colors [ index1 ] . x ;
color . y = ( colors [ index2 ] . y - colors [ index1 ] . y ) * lerp + colors [ index1 ] . y ;
color . z = ( colors [ index2 ] . z - colors [ index1 ] . z ) * lerp + colors [ index1 ] . z ;
2019-11-11 19:27:44 +00:00
2015-12-21 10:39:19 +00:00
for ( y = 0 ; y < 16 ; y + + )
{
data [ y ] [ x ] [ 0 ] = color . x * 255 ;
data [ y ] [ x ] [ 1 ] = color . y * 255 ;
data [ y ] [ x ] [ 2 ] = color . z * 255 ;
data [ y ] [ x ] [ 3 ] = 255 ;
}
}
2019-11-11 19:27:44 +00:00
2022-02-21 15:29:53 +00:00
image - > GenerateImage ( ( byte * ) data , FALLOFF_TEXTURE_SIZE , 16 , TF_LINEAR , TR_CLAMP , TD_LOOKUP_TABLE_RGBA , commandList ) ;
2015-12-21 10:39:19 +00:00
}
2015-12-23 12:53:21 +00:00
2022-02-21 15:29:53 +00:00
static void R_CreateGrainImage1 ( idImage * image , nvrhi : : ICommandList * commandList )
2015-12-23 12:53:21 +00:00
{
const static int GRAIN_SIZE = 128 ;
2019-11-11 19:27:44 +00:00
2015-12-23 12:53:21 +00:00
static byte data [ GRAIN_SIZE ] [ GRAIN_SIZE ] [ 4 ] ;
2019-11-11 19:27:44 +00:00
2015-12-23 12:53:21 +00:00
idRandom2 random ( Sys_Milliseconds ( ) ) ;
2019-11-11 19:27:44 +00:00
2015-12-23 12:53:21 +00:00
for ( int i = 0 ; i < GRAIN_SIZE ; i + + )
{
for ( int j = 0 ; j < GRAIN_SIZE ; j + + )
{
#if 0
//int value = 127 - 8 + ( rand() & 15 ); //random.RandomInt( 127 );
int value = 127 - 8 + random . RandomInt ( 15 ) ;
2019-11-11 19:27:44 +00:00
2015-12-23 12:53:21 +00:00
data [ i ] [ j ] [ 0 ] = value ;
data [ i ] [ j ] [ 1 ] = value ;
data [ i ] [ j ] [ 2 ] = value ;
data [ i ] [ j ] [ 3 ] = 0 ;
# else
data [ i ] [ j ] [ 0 ] = 127 - 8 + random . RandomInt ( 15 ) ;
data [ i ] [ j ] [ 1 ] = 127 - 8 + random . RandomInt ( 15 ) ;
data [ i ] [ j ] [ 2 ] = 127 - 8 + random . RandomInt ( 15 ) ;
data [ i ] [ j ] [ 3 ] = 0 ;
# endif
}
}
2019-11-11 19:27:44 +00:00
2022-02-21 15:29:53 +00:00
image - > GenerateImage ( ( byte * ) data , GRAIN_SIZE , GRAIN_SIZE , TF_NEAREST , TR_REPEAT , TD_LOOKUP_TABLE_RGBA , commandList ) ;
2015-12-23 12:53:21 +00:00
}
2022-02-21 15:29:53 +00:00
static void R_CreateSMAAAreaImage ( idImage * image , nvrhi : : ICommandList * commandList )
2015-12-26 14:20:19 +00:00
{
static byte data [ AREATEX_HEIGHT ] [ AREATEX_WIDTH ] [ 4 ] ;
2019-11-11 19:27:44 +00:00
2015-12-26 14:20:19 +00:00
for ( int x = 0 ; x < AREATEX_WIDTH ; x + + )
{
for ( int y = 0 ; y < AREATEX_HEIGHT ; y + + )
{
2015-12-28 20:36:25 +00:00
#if 0
data [ AREATEX_HEIGHT - y ] [ x ] [ 0 ] = areaTexBytes [ y * AREATEX_PITCH + x * 2 + 0 ] ;
data [ AREATEX_HEIGHT - y ] [ x ] [ 1 ] = areaTexBytes [ y * AREATEX_PITCH + x * 2 + 1 ] ;
data [ AREATEX_HEIGHT - y ] [ x ] [ 2 ] = 0 ;
data [ AREATEX_HEIGHT - y ] [ x ] [ 3 ] = 1 ;
# else
2015-12-26 14:20:19 +00:00
data [ y ] [ x ] [ 0 ] = areaTexBytes [ y * AREATEX_PITCH + x * 2 + 0 ] ;
data [ y ] [ x ] [ 1 ] = areaTexBytes [ y * AREATEX_PITCH + x * 2 + 1 ] ;
data [ y ] [ x ] [ 2 ] = 0 ;
data [ y ] [ x ] [ 3 ] = 1 ;
2015-12-28 20:36:25 +00:00
# endif
2015-12-26 14:20:19 +00:00
}
}
2019-11-11 19:27:44 +00:00
2022-02-21 15:29:53 +00:00
image - > GenerateImage ( ( byte * ) data , AREATEX_WIDTH , AREATEX_HEIGHT , TF_LINEAR , TR_CLAMP , TD_LOOKUP_TABLE_RGBA , commandList ) ;
2015-12-26 14:20:19 +00:00
}
2022-02-21 15:29:53 +00:00
static void R_CreateSMAASearchImage ( idImage * image , nvrhi : : ICommandList * commandList )
2015-12-26 14:20:19 +00:00
{
static byte data [ SEARCHTEX_HEIGHT ] [ SEARCHTEX_WIDTH ] [ 4 ] ;
2019-11-11 19:27:44 +00:00
2015-12-26 14:20:19 +00:00
for ( int x = 0 ; x < SEARCHTEX_WIDTH ; x + + )
{
for ( int y = 0 ; y < SEARCHTEX_HEIGHT ; y + + )
{
2015-12-28 20:36:25 +00:00
#if 0
data [ SEARCHTEX_HEIGHT - y ] [ x ] [ 0 ] = searchTexBytes [ y * SEARCHTEX_PITCH + x ] ;
data [ SEARCHTEX_HEIGHT - y ] [ x ] [ 1 ] = 0 ;
data [ SEARCHTEX_HEIGHT - y ] [ x ] [ 2 ] = 0 ;
data [ SEARCHTEX_HEIGHT - y ] [ x ] [ 3 ] = 1 ;
# else
2015-12-26 14:20:19 +00:00
data [ y ] [ x ] [ 0 ] = searchTexBytes [ y * SEARCHTEX_PITCH + x ] ;
data [ y ] [ x ] [ 1 ] = 0 ;
data [ y ] [ x ] [ 2 ] = 0 ;
data [ y ] [ x ] [ 3 ] = 1 ;
2015-12-28 20:36:25 +00:00
# endif
2015-12-26 14:20:19 +00:00
}
}
2019-11-11 19:27:44 +00:00
2022-02-21 15:29:53 +00:00
image - > GenerateImage ( ( byte * ) data , SEARCHTEX_WIDTH , SEARCHTEX_HEIGHT , TF_LINEAR , TR_CLAMP , TD_LOOKUP_TABLE_MONO , commandList ) ;
2015-12-26 14:20:19 +00:00
}
2022-02-21 15:29:53 +00:00
static void R_CreateImGuiFontImage ( idImage * image , nvrhi : : ICommandList * commandList )
2019-10-28 19:06:10 +00:00
{
ImGuiIO & io = ImGui : : GetIO ( ) ;
2019-11-11 19:27:44 +00:00
2019-10-28 19:06:10 +00:00
byte * pixels = NULL ;
int width , height ;
io . Fonts - > GetTexDataAsRGBA32 ( & pixels , & width , & height ) ; // Load as RGBA 32-bits for OpenGL3 demo because it is more likely to be compatible with user's existing shader.
2019-11-11 19:27:44 +00:00
2022-02-21 15:29:53 +00:00
image - > GenerateImage ( ( byte * ) pixels , width , height , TF_LINEAR , TR_CLAMP , TD_LOOKUP_TABLE_RGBA , commandList ) ;
2019-11-11 19:27:44 +00:00
2019-10-28 19:06:10 +00:00
// Store our identifier
2022-03-09 19:40:15 +00:00
//io.Fonts->TexID = ( void* )( intptr_t )image->GetImGuiTextureID();
io . Fonts - > TexID = ( void * ) ( intptr_t ) declManager - > FindMaterial ( " _imguiFont " ) ;
2019-11-11 19:27:44 +00:00
2019-10-28 19:06:10 +00:00
// Cleanup (don't clear the input data if you want to append new fonts later)
2019-10-28 22:45:13 +00:00
//io.Fonts->ClearInputData();
//io.Fonts->ClearTexData();
2019-10-28 19:06:10 +00:00
}
2022-02-21 15:29:53 +00:00
static void R_CreateBrdfLutImage ( idImage * image , nvrhi : : ICommandList * commandList )
2020-04-18 15:08:32 +00:00
{
2022-02-21 15:29:53 +00:00
image - > GenerateImage ( ( byte * ) brfLutTexBytes , BRDFLUT_TEX_WIDTH , BRDFLUT_TEX_HEIGHT , TF_LINEAR , TR_CLAMP , TD_RG16F , commandList ) ;
2021-03-26 09:49:16 +00:00
}
2020-04-18 15:08:32 +00:00
2022-02-21 15:29:53 +00:00
static void R_CreateEnvprobeImage_UAC_lobby_irradiance ( idImage * image , nvrhi : : ICommandList * commandList )
2021-03-26 09:49:16 +00:00
{
2022-04-13 20:05:05 +00:00
image - > GenerateImage ( ( byte * ) IMAGE_ENV_UAC_LOBBY_AMB_H_Bytes , IMAGE_ENV_UAC_LOBBY_AMB_H_TEX_WIDTH , IMAGE_ENV_UAC_LOBBY_AMB_H_TEX_HEIGHT , TF_DEFAULT , TR_CLAMP , TD_R11G11B10F , commandList , false , false , 1 , CF_2D_PACKED_MIPCHAIN ) ;
2021-03-26 09:49:16 +00:00
}
2020-04-18 15:08:32 +00:00
2022-02-21 15:29:53 +00:00
static void R_CreateEnvprobeImage_UAC_lobby_radiance ( idImage * image , nvrhi : : ICommandList * commandList )
2021-03-26 09:49:16 +00:00
{
2022-04-13 20:05:05 +00:00
image - > GenerateImage ( ( byte * ) IMAGE_ENV_UAC_LOBBY_SPEC_H_Bytes , IMAGE_ENV_UAC_LOBBY_SPEC_H_TEX_WIDTH , IMAGE_ENV_UAC_LOBBY_SPEC_H_TEX_HEIGHT , TF_DEFAULT , TR_CLAMP , TD_R11G11B10F , commandList , false , false , 1 , CF_2D_PACKED_MIPCHAIN ) ;
2020-04-18 15:08:32 +00:00
}
2014-05-10 12:40:01 +00:00
// RB end
2021-02-20 11:03:11 +00:00
2022-09-14 16:03:29 +00:00
static void R_GuiEditFunction ( idImage * image , nvrhi : : ICommandList * commandList )
{
image - > GenerateImage ( nullptr , 640 , 480 , TF_NEAREST , TR_CLAMP , TD_LOOKUP_TABLE_RGBA , nullptr , true , false , 1 ) ;
}
static void R_GuiEditDepthStencilFunction ( idImage * image , nvrhi : : ICommandList * commandList )
{
image - > GenerateImage ( nullptr , 640 , 480 , TF_NEAREST , TR_CLAMP , TD_DEPTH_STENCIL , nullptr , true , false , 1 ) ;
}
2014-05-10 12:40:01 +00:00
2012-11-26 18:58:24 +00:00
/*
= = = = = = = = = = = = = = = =
idImageManager : : CreateIntrinsicImages
= = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void idImageManager : : CreateIntrinsicImages ( )
{
2012-11-26 18:58:24 +00:00
// create built in images
defaultImage = ImageFromFunction ( " _default " , R_DefaultImage ) ;
whiteImage = ImageFromFunction ( " _white " , R_WhiteImage ) ;
blackImage = ImageFromFunction ( " _black " , R_BlackImage ) ;
2022-04-13 20:05:05 +00:00
blackDiffuseImage = ImageFromFunction ( " _blackDiffuse " , R_BlackDiffuseImage ) ;
2020-04-20 18:51:31 +00:00
cyanImage = ImageFromFunction ( " _cyan " , R_CyanImage ) ;
2012-11-26 18:58:24 +00:00
flatNormalMap = ImageFromFunction ( " _flat " , R_FlatNormalImage ) ;
alphaNotchImage = ImageFromFunction ( " _alphaNotch " , R_AlphaNotchImage ) ;
fogImage = ImageFromFunction ( " _fog " , R_FogImage ) ;
fogEnterImage = ImageFromFunction ( " _fogEnter " , R_FogEnterImage ) ;
noFalloffImage = ImageFromFunction ( " _noFalloff " , R_CreateNoFalloffImage ) ;
ImageFromFunction ( " _quadratic " , R_QuadraticImage ) ;
2019-11-11 19:27:44 +00:00
2014-05-10 12:40:01 +00:00
// RB begin
2022-03-30 09:22:58 +00:00
shadowAtlasImage = ImageFromFunction ( " _shadowMapAtlas " , R_CreateShadowMapImage_Atlas ) ;
2014-05-12 17:54:09 +00:00
shadowImage [ 0 ] = ImageFromFunction ( va ( " _shadowMapArray0_%i " , shadowMapResolutions [ 0 ] ) , R_CreateShadowMapImage_Res0 ) ;
shadowImage [ 1 ] = ImageFromFunction ( va ( " _shadowMapArray1_%i " , shadowMapResolutions [ 1 ] ) , R_CreateShadowMapImage_Res1 ) ;
shadowImage [ 2 ] = ImageFromFunction ( va ( " _shadowMapArray2_%i " , shadowMapResolutions [ 2 ] ) , R_CreateShadowMapImage_Res2 ) ;
shadowImage [ 3 ] = ImageFromFunction ( va ( " _shadowMapArray3_%i " , shadowMapResolutions [ 3 ] ) , R_CreateShadowMapImage_Res3 ) ;
shadowImage [ 4 ] = ImageFromFunction ( va ( " _shadowMapArray4_%i " , shadowMapResolutions [ 4 ] ) , R_CreateShadowMapImage_Res4 ) ;
2019-11-11 19:27:44 +00:00
2014-05-10 12:40:01 +00:00
jitterImage1 = globalImages - > ImageFromFunction ( " _jitter1 " , R_CreateJitterImage1 ) ;
jitterImage4 = globalImages - > ImageFromFunction ( " _jitter4 " , R_CreateJitterImage4 ) ;
jitterImage16 = globalImages - > ImageFromFunction ( " _jitter16 " , R_CreateJitterImage16 ) ;
2019-11-11 19:27:44 +00:00
2014-05-10 12:40:01 +00:00
randomImage256 = globalImages - > ImageFromFunction ( " _random256 " , R_CreateRandom256Image ) ;
2020-04-28 23:19:53 +00:00
blueNoiseImage256 = globalImages - > ImageFromFunction ( " _blueNoise256 " , R_CreateBlueNoise256Image ) ;
2019-11-11 19:27:44 +00:00
2022-04-13 20:05:05 +00:00
currentRenderHDRImage = globalImages - > ImageFromFunction ( " _currentRenderHDR " , R_HDR_RGBA16FImage_ResNative_MSAAOpt ) ;
2015-12-20 11:28:46 +00:00
currentRenderHDRImage64 = globalImages - > ImageFromFunction ( " _currentRenderHDR64 " , R_HDR_RGBA16FImage_Res64 ) ;
2022-04-16 14:29:17 +00:00
ldrImage = globalImages - > ImageFromFunction ( " _currentRenderLDR " , R_LdrNativeImage ) ;
2019-11-11 19:27:44 +00:00
2022-04-19 19:56:30 +00:00
taaMotionVectorsImage = ImageFromFunction ( " _taaMotionVectors " , R_HDR_RG16FImage_ResNative ) ; // RB: could be shared with _currentNormals.zw
2022-04-12 16:15:48 +00:00
taaResolvedImage = ImageFromFunction ( " _taaResolved " , R_HDR_RGBA16FImage_ResNative_UAV ) ;
taaFeedback1Image = ImageFromFunction ( " _taaFeedback1 " , R_HDR_RGBA16SImage_ResNative_UAV ) ;
taaFeedback2Image = ImageFromFunction ( " _taaFeedback2 " , R_HDR_RGBA16SImage_ResNative_UAV ) ;
2021-03-14 12:22:17 +00:00
envprobeHDRImage = globalImages - > ImageFromFunction ( " _envprobeHDR " , R_EnvprobeImage_HDR ) ;
envprobeDepthImage = ImageFromFunction ( " _envprobeDepth " , R_EnvprobeImage_Depth ) ;
2016-01-06 21:37:16 +00:00
bloomRenderImage [ 0 ] = globalImages - > ImageFromFunction ( " _bloomRender0 " , R_HDR_RGBA16FImage_ResQuarter_Linear ) ;
bloomRenderImage [ 1 ] = globalImages - > ImageFromFunction ( " _bloomRender1 " , R_HDR_RGBA16FImage_ResQuarter_Linear ) ;
2019-11-11 19:27:44 +00:00
2022-02-21 15:29:53 +00:00
glowImage [ 0 ] = globalImages - > ImageFromFunction ( " _glowImage0 " , R_RGBA8Image_ResGui ) ;
glowImage [ 1 ] = globalImages - > ImageFromFunction ( " _glowImage1 " , R_RGBA8Image_ResGui ) ;
glowDepthImage [ 0 ] = globalImages - > ImageFromFunction ( " _glowDepthImage0 " , R_DepthImage ) ;
glowDepthImage [ 1 ] = globalImages - > ImageFromFunction ( " _glowDepthImage1 " , R_DepthImage ) ;
accumTransparencyImage = globalImages - > ImageFromFunction ( " _accumTransparencyImage " , R_HDR_RGBA16FImage_ResNative_Linear ) ;
revealTransparencyImage = globalImages - > ImageFromFunction ( " _revealTransparencyImage " , R_R8Image_ResNative_Linear ) ;
2015-12-21 10:39:19 +00:00
heatmap5Image = ImageFromFunction ( " _heatmap5 " , R_CreateHeatmap5ColorsImage ) ;
heatmap7Image = ImageFromFunction ( " _heatmap7 " , R_CreateHeatmap7ColorsImage ) ;
2019-11-11 19:27:44 +00:00
2015-12-23 12:53:21 +00:00
grainImage1 = globalImages - > ImageFromFunction ( " _grain1 " , R_CreateGrainImage1 ) ;
2019-11-11 19:27:44 +00:00
2015-12-28 20:36:25 +00:00
smaaInputImage = ImageFromFunction ( " _smaaInput " , R_RGBA8LinearImage ) ;
2019-11-11 19:27:44 +00:00
2015-12-26 14:20:19 +00:00
smaaAreaImage = globalImages - > ImageFromFunction ( " _smaaArea " , R_CreateSMAAAreaImage ) ;
smaaSearchImage = globalImages - > ImageFromFunction ( " _smaaSearch " , R_CreateSMAASearchImage ) ;
2019-11-11 19:27:44 +00:00
2015-12-26 15:11:47 +00:00
smaaEdgesImage = globalImages - > ImageFromFunction ( " _smaaEdges " , R_SMAAImage_ResNative ) ;
smaaBlendImage = globalImages - > ImageFromFunction ( " _smaaBlend " , R_SMAAImage_ResNative ) ;
2019-11-11 19:27:44 +00:00
2022-04-16 14:29:17 +00:00
gbufferNormalsRoughnessImage = ImageFromFunction ( " _currentNormals " , R_GeometryBufferImage_ResNative ) ;
2019-11-11 19:27:44 +00:00
2023-01-25 19:23:14 +00:00
ambientOcclusionImage [ 0 ] = ImageFromFunction ( " _ao0 " , R_AmbientOcclusionImage_ResNative ) ;
ambientOcclusionImage [ 1 ] = ImageFromFunction ( " _ao1 " , R_AmbientOcclusionImage_ResNative ) ;
2019-11-11 19:27:44 +00:00
2016-01-09 12:38:49 +00:00
hierarchicalZbufferImage = ImageFromFunction ( " _cszBuffer " , R_HierarchicalZBufferImage_ResNative ) ;
2019-11-11 19:27:44 +00:00
2019-10-28 19:06:10 +00:00
imguiFontImage = ImageFromFunction ( " _imguiFont " , R_CreateImGuiFontImage ) ;
2020-04-18 15:08:32 +00:00
2020-04-20 18:51:31 +00:00
chromeSpecImage = ImageFromFunction ( " _chromeSpec " , R_ChromeSpecImage ) ;
plasticSpecImage = ImageFromFunction ( " _plasticSpec " , R_PlasticSpecImage ) ;
brdfLutImage = ImageFromFunction ( " _brdfLut " , R_CreateBrdfLutImage ) ;
2014-05-10 12:40:01 +00:00
// RB end
2019-11-11 19:27:44 +00:00
2012-11-26 18:58:24 +00:00
// scratchImage is used for screen wipes/doublevision etc..
2012-11-28 15:47:07 +00:00
scratchImage = ImageFromFunction ( " _scratch " , R_RGBA8Image ) ;
scratchImage2 = ImageFromFunction ( " _scratch2 " , R_RGBA8Image ) ;
2023-10-17 22:01:35 +00:00
accumImage = ImageFromFunction ( " _accum " , R_RGBA8Image_RT ) ;
currentRenderImage = globalImages - > ImageFromFunction ( " _currentRender " , R_LdrNativeImage ) ; ;
2012-11-28 15:47:07 +00:00
currentDepthImage = ImageFromFunction ( " _currentDepth " , R_DepthImage ) ;
2019-11-11 19:27:44 +00:00
2012-11-26 18:58:24 +00:00
// save a copy of this for material comparison, because currentRenderImage may get
// reassigned during stereo rendering
originalCurrentRenderImage = currentRenderImage ;
2019-11-11 19:27:44 +00:00
2012-11-28 15:47:07 +00:00
loadingIconImage = ImageFromFile ( " textures/loadingicon2 " , TF_DEFAULT , TR_CLAMP , TD_DEFAULT , CF_2D ) ;
hellLoadingIconImage = ImageFromFile ( " textures/loadingicon3 " , TF_DEFAULT , TR_CLAMP , TD_DEFAULT , CF_2D ) ;
2019-11-11 19:27:44 +00:00
2020-04-18 15:08:32 +00:00
// RB begin
2021-03-26 09:49:16 +00:00
#if 0
2021-03-22 19:45:25 +00:00
defaultUACIrradianceCube = ImageFromFile ( " env/UAC5_amb " , TF_DEFAULT , TR_CLAMP , TD_R11G11B10F , CF_2D_PACKED_MIPCHAIN ) ;
defaultUACRadianceCube = ImageFromFile ( " env/UAC5_spec " , TF_DEFAULT , TR_CLAMP , TD_R11G11B10F , CF_2D_PACKED_MIPCHAIN ) ;
2021-03-26 09:49:16 +00:00
# else
defaultUACIrradianceCube = ImageFromFunction ( " _defaultUACIrradiance " , R_CreateEnvprobeImage_UAC_lobby_irradiance ) ;
defaultUACRadianceCube = ImageFromFunction ( " _defaultUACRadiance " , R_CreateEnvprobeImage_UAC_lobby_radiance ) ;
# endif
2020-04-18 15:08:32 +00:00
// RB end
2019-11-11 19:27:44 +00:00
2022-09-14 16:03:29 +00:00
guiEdit = ImageFromFunction ( " _guiEdit " , R_GuiEditFunction ) ;
guiEditDepthStencilImage = ImageFromFunction ( " _guiEditDepthStencil " , R_GuiEditDepthStencilFunction ) ;
2012-11-26 18:58:24 +00:00
release_assert ( loadingIconImage - > referencedOutsideLevelLoad ) ;
release_assert ( hellLoadingIconImage - > referencedOutsideLevelLoad ) ;
2015-12-20 11:28:46 +00:00
}