28 #include "../idlib/precompiled.h"
45 static void R_PerformanceCounters(
void ) {
51 common->
Printf(
"v:%i ds:%i t:%i/%i v:%i/%i st:%i sv:%i image:%5.1f MB\n",
63 common->
Printf(
"views:%i draws:%i tris:%i (shdw:%i) (vbo:%i) image:%5.1f MB\n",
75 common->
Printf(
"callback:%i md5:%i dfrmVerts:%i dfrmTris:%i tangTris:%i guis:%i\n",
86 common->
Printf(
"%i sin %i sclip %i sout %i bin %i bout\n",
96 common->
Printf(
"createInteractions:%i createLightTris:%i createShadowVolumes:%i\n",
104 common->
Printf(
"entityUpdates:%i entityRefs:%i lightUpdates:%i lightRefs:%i\n",
116 memset( &tr.
pc, 0,
sizeof( tr.
pc ) );
129 static void R_IssueRenderCommands(
void ) {
192 static void R_ViewStatistics(
viewDef_t *parms ) {
223 R_ViewStatistics( parms );
274 static void R_CheckCvars(
void ) {
333 bool clip,
float min_x,
float min_y,
float max_x,
float max_y ) {
335 clip, min_x, min_y, max_x, max_y );
404 frow = row * 0.0625f;
405 fcol = col * 0.0625f;
410 fcol + size, frow + size,
426 const unsigned char *
s;
430 s = (
const unsigned char*)
string;
440 color[3] = setColor[3];
477 frow = row * 0.0625f;
478 fcol = col * 0.0625f;
483 fcol + size, frow + size,
513 color[3] = setColor[3];
720 if ( frontEndMsec ) {
728 R_PerformanceCounters();
741 R_IssueRenderCommands();
774 viewport->
x2 =
idMath::Ftoi( rc->
x + floor( ( renderView->
x + renderView->
width ) * wRatio + 0.5f ) - 1 );
782 for ( i = 0 ; i < 20 ; i++ ) {
783 if ( ( 1 << i ) == v ) {
786 if ( ( 1 << i ) > v ) {
811 if ( width < 1 || height < 1 ) {
837 width = r.
x2 - r.
x1 + 1;
838 height = r.
y2 - r.
y1 + 1;
840 if ( forceDimensions ) {
842 width = renderView.
width;
843 height = renderView.
height;
847 if ( makePowerOfTwo ) {
864 common->
Error(
"idRenderSystemLocal::CropRenderSize: currentRenderCrop == MAX_RENDER_CROPS" );
888 common->
Error(
"idRenderSystemLocal::UnCrop: currentRenderCrop < 1" );
925 common->
Printf(
"write DC_CAPTURE_RENDER: %s\n", imageName );
961 R_IssueRenderCommands();
973 for (
int i = 0 ; i <
c ; i++ ) {
974 data2[ i * 4 ] =
data[ i * 3 ];
975 data2[ i * 4 + 1 ] =
data[ i * 3 + 1 ];
976 data2[ i * 4 + 2 ] =
data[ i * 3 + 2 ];
977 data2[ i * 4 + 3 ] = 0xff;
1008 worlds.
Remove( static_cast<idRenderWorldLocal *>(rw) );
~idRenderSystemLocal(void)
virtual void FreeRenderWorld(idRenderWorld *rw)
void R_ClearCommandChain(void)
void R_LockSurfaceScene(viewDef_t *parms)
const int C_COLOR_DEFAULT
idCVar r_frontBuffer("r_frontBuffer","0", CVAR_RENDERER|CVAR_BOOL,"draw to front buffer for debugging")
idCVar r_gamma("r_gamma","1", CVAR_RENDERER|CVAR_ARCHIVE|CVAR_FLOAT,"changes gamma tables", 0.5f, 3.0f)
renderCommand_t commandId
virtual void WriteDemoPics()
void GL_CheckErrors(void)
virtual bool UploadImage(const char *imageName, const byte *data, int width, int height)
class idGuiModel * guiModel
virtual void SetColor4(float r, float g, float b, float a)
idCVar r_brightness("r_brightness","1", CVAR_RENDERER|CVAR_ARCHIVE|CVAR_FLOAT,"changes gamma tables", 0.5f, 2.0f)
drawSurfsCommand_t lockSurfacesCmd
idRenderSystem * renderSystem
virtual void CaptureRenderToImage(const char *imageName)
virtual void PrintMemInfo(MemInfo_t *mi)=0
idCVar r_screenFraction("r_screenFraction","100", CVAR_RENDERER|CVAR_INTEGER,"for testing fill rate, the resolution of the entire screen can be changed")
idImage * GetImage(const char *name) const
idRenderSystemLocal(void)
idCVar r_renderer("r_renderer","best", CVAR_RENDERER|CVAR_ARCHIVE,"hardware specific renderer path to use", r_rendererArgs, idCmdSystem::ArgCompletion_String< r_rendererArgs >)
GLenum GLsizei GLenum GLenum const GLvoid * image
GLenum GLsizei const GLvoid * string
idRenderWorldLocal * primaryWorld
void SetBackEndRenderer()
void PrintMemInfo(MemInfo_t *mi)
class idGuiModel * demoGuiModel
idList< idRenderWorldLocal * > worlds
renderCommand_t commandId
static idVec4 & ColorForIndex(int i)
renderCommand_t commandId
idCVar r_skipBackEnd("r_skipBackEnd","0", CVAR_RENDERER|CVAR_BOOL,"don't draw anything")
int Icmp(const char *text) const
idCVar r_showDemo("r_showDemo","0", CVAR_RENDERER|CVAR_BOOL,"report reads and writes to the demo file")
idCVar r_showAlloc("r_showAlloc","0", CVAR_RENDERER|CVAR_BOOL,"report alloc/free counts")
virtual void CropRenderSize(int width, int height, bool makePowerOfTwo=false, bool forceDimensions=false)
backEndName_t backEndRenderer
void * R_GetCommandBuffer(int bytes)
virtual void DrawStretchPic(const idDrawVert *verts, const glIndex_t *indexes, int vertCount, int indexCount, const idMaterial *material, bool clip=true, float x=0.0f, float y=0.0f, float w=640.0f, float h=0.0f)
void DrawStretchTri(idVec2 p1, idVec2 p2, idVec2 p3, idVec2 t1, idVec2 t2, idVec2 t3, const idMaterial *material)
void R_AddDrawViewCmd(viewDef_t *parms)
virtual void BeginFrame(int windowWidth, int windowHeight)
const int SMALLCHAR_WIDTH
bool backEndRendererHasVertexPrograms
virtual void DrawBigChar(int x, int y, int ch, const idMaterial *material)
virtual int WriteInt(const int value)
virtual void PrintMemInfo(MemInfo_t *mi)
void R_SetColorMappings(void)
GLubyte GLubyte GLubyte GLubyte w
struct viewEntity_s * next
void UploadScratch(const byte *pic, int width, int height)
idCVar r_showUpdates("r_showUpdates","0", CVAR_RENDERER|CVAR_BOOL,"report entity and light updates and ref counts")
idCVar r_showCull("r_showCull","0", CVAR_RENDERER|CVAR_BOOL,"report sphere and box culling stats")
GLsizei GLsizei GLenum GLenum const GLvoid * data
int GetInteger(void) const
virtual void GetGLSettings(int &width, int &height)
idImageManager * globalImages
virtual void virtual void FatalError(const char *fmt,...) id_attribute((format(printf
virtual void CaptureRenderToFile(const char *fileName, bool fixAlpha)
idCVar r_logFile("r_logFile","0", CVAR_RENDERER|CVAR_INTEGER,"number of frames to emit GL logs")
virtual void EndFrame(int *frontEndMsec, int *backEndMsec)
void R_WriteTGA(const char *filename, const byte *data, int width, int height, bool flipVertical=false)
void SetImageFilterAndRepeat() const
float backEndRendererMaxLight
void R_GlobalToNormalizedDeviceCoordinates(const idVec3 &global, idVec3 &ndc)
virtual void DrawBigStringExt(int x, int y, const char *string, const idVec4 &setColor, bool forceColor, const idMaterial *material)
void RenderViewToViewport(const renderView_t *renderView, idScreenRect *viewport)
GLubyte GLubyte GLubyte a
virtual void Printf(const char *fmt,...) id_attribute((format(printf
void WriteToDemo(idDemoFile *demo)
idCVar r_showDefs("r_showDefs","0", CVAR_RENDERER|CVAR_BOOL,"report the number of modeDefs and lightDefs in view")
void R_SetViewMatrix(viewDef_t *viewDef)
void GLimp_EnableLogging(bool enable)
GLenum GLsizei GLsizei height
virtual void SetColor(const idVec4 &rgba)
void RB_ExecuteBackEndCommands(const emptyCommand_t *cmds)
idImage * ImageFromFile(const char *name, textureFilter_t filter, bool allowDownSize, textureRepeat_t repeat, textureDepth_t depth, cubeFiles_t cubeMap=CF_2D)
renderCrop_t renderCrops[MAX_RENDER_CROPS]
void myGlMultMatrix(const float *a, const float *b, float *out)
const char * GetString(void) const
int Append(const type &obj)
GLdouble GLdouble GLdouble r
idRenderModelManager * renderModelManager
struct viewEntity_s * viewEntitys
GLenum GLenum GLvoid * row
void DrawStretchPic(const idDrawVert *verts, const glIndex_t *indexes, int vertCount, int indexCount, const idMaterial *hShader, bool clip=true, float min_x=0.0f, float min_y=0.0f, float max_x=640.0f, float max_y=480.0f)
void * R_StaticAlloc(int bytes)
renderCommand_t commandId
int R_CountFrameData(void)
virtual void DrawDemoPics()
virtual void DrawSmallStringExt(int x, int y, const char *string, const idVec4 &setColor, bool forceColor, const idMaterial *material)
bool IsModified(void) const
idCVar r_showInteractions("r_showInteractions","0", CVAR_RENDERER|CVAR_BOOL,"report interaction generation activity")
const int SMALLCHAR_HEIGHT
float modelViewMatrix[16]
void * R_FrameAlloc(int bytes)
idVertexCache vertexCache
idCVar r_showPrimitives("r_showPrimitives","0", CVAR_RENDERER|CVAR_INTEGER,"report drawsurf/index/vertex counts")
void SetColor(float r, float g, float b, float a)
idCVar r_showMemory("r_showMemory","0", CVAR_RENDERER|CVAR_BOOL,"print frame memory utilization")
virtual void DrawSmallChar(int x, int y, int ch, const idMaterial *material)
idCVar r_showLightScale("r_showLightScale","0", CVAR_RENDERER|CVAR_BOOL,"report the scale factor applied to drawing for overbrights")
virtual idRenderWorld * AllocRenderWorld(void)
void R_StaticFree(void *data)
int RoundDownToPowerOfTwo(int num)
void R_ToggleSmpFrame(void)
virtual void Error(const char *fmt,...) id_attribute((format(printf
idCVar r_showSurfaces("r_showSurfaces","0", CVAR_RENDERER|CVAR_BOOL,"report surface/light/shadow counts")
idCVar r_showDynamic("r_showDynamic","0", CVAR_RENDERER|CVAR_BOOL,"report stats on dynamic surface generation")
virtual void GlobalToNormalizedDeviceCoordinates(const idVec3 &global, idVec3 &ndc)
bool Remove(const type &obj)
virtual void DrawStretchTri(idVec2 p1, idVec2 p2, idVec2 p3, idVec2 t1, idVec2 t2, idVec2 t3, const idMaterial *material)
void WriteHashString(const char *str)