engine: move FillRenderAPI and FillTriAPI to renderers to reduce amount of exports

This commit is contained in:
Alibek Omarov
2026-04-14 11:27:13 +05:00
parent a49db03561
commit e6924844da
6 changed files with 122 additions and 187 deletions

View File

@@ -413,6 +413,42 @@ static const char *R_GetConfigName( void )
return "opengl";
}
static void R_FillRenderAPI( render_api_t *api )
{
api->GetDetailScaleForTexture = R_GetDetailScaleForTexture;
api->GetExtraParmsForTexture = R_GetExtraParmsForTexture;
api->GetFrameTime = R_GetFrameTime;
api->R_SetCurrentEntity = R_SetCurrentEntity;
api->R_SetCurrentModel = R_SetCurrentModel;
api->GL_CreateTexture = GL_CreateTexture;
api->GL_LoadTextureArray = GL_LoadTextureArray;
api->GL_CreateTextureArray = GL_CreateTextureArray;
api->DrawSingleDecal = DrawSingleDecal;
api->R_DecalSetupVerts = R_DecalSetupVerts;
api->R_EntityRemoveDecals = R_EntityRemoveDecals;
api->GL_SelectTexture = GL_SelectTexture;
api->GL_LoadTextureMatrix = GL_LoadTexMatrixExt;
api->GL_TexMatrixIdentity = GL_LoadIdentityTexMatrix;
api->GL_CleanUpTextureUnits = GL_CleanUpTextureUnits;
api->GL_TexGen = GL_TexGen;
api->GL_TextureTarget = GL_TextureTarget;
api->GL_TexCoordArrayMode = GL_SetTexCoordArrayMode;
api->GL_UpdateTexSize = GL_UpdateTexSize;
api->GL_DrawParticles = CL_DrawParticlesExternal;
api->LightVec = R_LightVec;
api->StudioGetTexture = R_StudioGetTexture;
api->GL_GetProcAddress = R_GetProcAddress;
}
static void R_FillTriAPI( triangleapi_t *api )
{
api->TexCoord2f = TriTexCoord2f;
api->Fog = TriFog;
api->ScreenToWorld = R_ScreenToWorld;
api->GetMatrix = TriGetMatrix;
api->FogParams = TriFogParams;
}
const ref_interface_t gReffuncs =
{
R_Init,
@@ -483,42 +519,17 @@ const ref_interface_t gReffuncs =
R_BeamCull,
GL_RefGetParm,
R_GetDetailScaleForTexture,
R_GetExtraParmsForTexture,
R_GetFrameTime,
R_SetCurrentEntity,
R_SetCurrentModel,
GL_FindTexture,
GL_TextureName,
GL_TextureData,
GL_LoadTexture,
GL_CreateTexture,
GL_LoadTextureArray,
GL_CreateTextureArray,
GL_FreeTexture,
R_OverrideTextureSourceSize,
DrawSingleDecal,
R_DecalSetupVerts,
R_EntityRemoveDecals,
R_UploadStretchRaw,
GL_Bind,
GL_SelectTexture,
GL_LoadTexMatrixExt,
GL_LoadIdentityTexMatrix,
GL_CleanUpTextureUnits,
GL_TexGen,
GL_TextureTarget,
GL_SetTexCoordArrayMode,
GL_UpdateTexSize,
CL_DrawParticlesExternal,
R_LightVec,
R_StudioGetTexture,
R_RenderFrame,
Mod_SetOrthoBounds,
@@ -526,22 +537,19 @@ const ref_interface_t gReffuncs =
Mod_GetCurrentVis,
R_NewMap,
R_ClearScene,
R_GetProcAddress,
TriRenderMode,
TriBegin,
TriEnd,
_TriColor4f,
_TriColor4ub,
TriTexCoord2f,
TriVertex3fv,
TriVertex3f,
TriFog,
R_ScreenToWorld,
TriGetMatrix,
TriFogParams,
TriCullFace,
R_FillRenderAPI,
R_FillTriAPI,
VGUI_SetupDrawing,
VGUI_UploadTextureBlock,
};

View File

@@ -59,6 +59,16 @@ static void R_StudioSetDrawInterface( struct r_studio_interface_s *pDraw )
;
}
static void R_FillRenderAPI( render_api_t *api )
{
;
}
static void R_FillTriAPI( triangleapi_t *api )
{
;
}
static qboolean R_Init( void )
{
gEngfuncs.R_Init_Video( REF_SOFTWARE );
@@ -493,43 +503,18 @@ static const ref_interface_t gReffuncs =
.CL_DrawBeams = CL_DrawBeams,
.R_BeamCull = R_BeamCull,
.RefGetParm = RefGetParm,
.GetDetailScaleForTexture = GetDetailScaleForTexture,
.GetExtraParmsForTexture = GetExtraParmsForTexture,
.GetFrameTime = GetFrameTime,
.RefGetParm = RefGetParm,
.R_SetCurrentEntity = R_SetCurrentEntity,
.R_SetCurrentModel = R_SetCurrentModel,
.GL_FindTexture = GL_FindTexture,
.GL_TextureName = GL_TextureName,
.GL_TextureData = GL_TextureData,
.GL_LoadTexture = GL_LoadTexture,
.GL_CreateTexture = GL_CreateTexture,
.GL_LoadTextureArray = GL_LoadTextureArray,
.GL_CreateTextureArray = GL_CreateTextureArray,
.GL_FreeTexture = R_SimpleStubUInt,
.GL_FindTexture = GL_FindTexture,
.GL_TextureName = GL_TextureName,
.GL_TextureData = GL_TextureData,
.GL_LoadTexture = GL_LoadTexture,
.GL_FreeTexture = R_SimpleStubUInt,
.R_OverrideTextureSourceSize = R_OverrideTextureSourceSize,
.DrawSingleDecal = DrawSingleDecal,
.R_DecalSetupVerts = R_DecalSetupVerts,
.R_EntityRemoveDecals = R_EntityRemoveDecals,
.AVI_UploadRawFrame = AVI_UploadRawFrame,
.GL_Bind = GL_Bind,
.GL_SelectTexture = R_SimpleStubInt,
.GL_LoadTextureMatrix = GL_LoadTextureMatrix,
.GL_TexMatrixIdentity = R_SimpleStub,
.GL_CleanUpTextureUnits = R_SimpleStubInt,
.GL_TexGen = GL_TexGen,
.GL_TextureTarget = R_SimpleStubUInt,
.GL_TexCoordArrayMode = R_SimpleStubUInt,
.GL_UpdateTexSize = GL_UpdateTexSize,
.GL_DrawParticles = GL_DrawParticles,
.LightVec = LightVec,
.StudioGetTexture = StudioGetTexture,
.GL_Bind = GL_Bind,
.GL_RenderFrame = GL_RenderFrame,
.GL_OrthoBounds = GL_OrthoBounds,
@@ -537,22 +522,19 @@ static const ref_interface_t gReffuncs =
.Mod_GetCurrentVis = Mod_GetCurrentVis,
.R_NewMap = R_SimpleStub,
.R_ClearScene = R_SimpleStub,
.R_GetProcAddress = R_GetProcAddress,
.TriRenderMode = R_SimpleStubInt,
.Begin = R_SimpleStubInt,
.End = R_SimpleStub,
.Color4f = Color4f,
.Color4ub = Color4ub,
.TexCoord2f = TexCoord2f,
.Vertex3fv = Vertex3fv,
.Vertex3f = Vertex3f,
.Fog = Fog,
.ScreenToWorld = ScreenToWorld,
.GetMatrix = GetMatrix,
.FogParams = FogParams,
.CullFace = CullFace,
.R_FillRenderAPI = R_FillRenderAPI,
.R_FillTriAPI = R_FillTriAPI,
.VGUI_SetupDrawing = VGUI_SetupDrawing,
.VGUI_UploadTextureBlock = VGUI_UploadTextureBlock,
};

View File

@@ -398,6 +398,42 @@ static void * GAME_EXPORT R_GetProcAddress( const char *name )
return gEngfuncs.GL_GetProcAddress( name );
}
static void R_FillRenderAPI( render_api_t *api )
{
api->GetDetailScaleForTexture = R_GetDetailScaleForTexture;
api->GetExtraParmsForTexture = R_GetExtraParmsForTexture;
api->GetFrameTime = R_GetFrameTime;
api->R_SetCurrentEntity = R_SetCurrentEntity;
api->R_SetCurrentModel = R_SetCurrentModel;
api->GL_CreateTexture = GL_CreateTexture;
api->GL_LoadTextureArray = GL_LoadTextureArray;
api->GL_CreateTextureArray = GL_CreateTextureArray;
api->DrawSingleDecal = DrawSingleDecal;
api->R_DecalSetupVerts = R_DecalSetupVerts;
api->R_EntityRemoveDecals = R_EntityRemoveDecals;
api->GL_SelectTexture = GL_SelectTexture;
api->GL_LoadTextureMatrix = GL_LoadTexMatrixExt;
api->GL_TexMatrixIdentity = GL_LoadIdentityTexMatrix;
api->GL_CleanUpTextureUnits = GL_CleanUpTextureUnits;
api->GL_TexGen = GL_TexGen;
api->GL_TextureTarget = GL_TextureTarget;
api->GL_TexCoordArrayMode = GL_SetTexCoordArrayMode;
api->GL_UpdateTexSize = GL_UpdateTexSize;
api->GL_DrawParticles = CL_DrawParticlesExternal;
api->LightVec = R_LightVec;
api->StudioGetTexture = R_StudioGetTexture;
api->GL_GetProcAddress = R_GetProcAddress;
}
static void R_FillTriAPI( triangleapi_t *api )
{
api->TexCoord2f = TriTexCoord2f;
api->Fog = TriFog;
api->ScreenToWorld = R_ScreenToWorld;
api->GetMatrix = TriGetMatrix;
api->FogParams = TriFogParams;
}
const ref_interface_t gReffuncs =
{
R_Init,
@@ -468,42 +504,17 @@ const ref_interface_t gReffuncs =
R_BeamCull,
GL_RefGetParm,
R_GetDetailScaleForTexture,
R_GetExtraParmsForTexture,
R_GetFrameTime,
R_SetCurrentEntity,
R_SetCurrentModel,
GL_FindTexture,
GL_TextureName,
GL_TextureData,
GL_LoadTexture,
GL_CreateTexture,
GL_LoadTextureArray,
GL_CreateTextureArray,
GL_FreeTexture,
R_OverrideTextureSourceSize,
DrawSingleDecal,
R_DecalSetupVerts,
R_EntityRemoveDecals,
R_UploadStretchRaw,
GL_Bind,
GL_SelectTexture,
GL_LoadTexMatrixExt,
GL_LoadIdentityTexMatrix,
GL_CleanUpTextureUnits,
GL_TexGen,
GL_TextureTarget,
GL_SetTexCoordArrayMode,
GL_UpdateTexSize,
CL_DrawParticlesExternal,
R_LightVec,
R_StudioGetTexture,
R_RenderFrame,
Mod_SetOrthoBounds,
@@ -511,22 +522,19 @@ const ref_interface_t gReffuncs =
Mod_GetCurrentVis,
R_NewMap,
R_ClearScene,
R_GetProcAddress,
TriRenderMode,
TriBegin,
TriEnd,
_TriColor4f,
_TriColor4ub,
TriTexCoord2f,
TriVertex3fv,
TriVertex3f,
TriFog,
R_ScreenToWorld,
TriGetMatrix,
TriFogParams,
TriCullFace,
R_FillRenderAPI,
R_FillTriAPI,
VGUI_SetupDrawing,
VGUI_UploadTextureBlock,
};