mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-22 18:31:27 +00:00
[renderer] Move most of the scene rendering into r_screen
r_screen isn't really the right place, but it gets the scene rendering out of the low-level renderers and will make it easier to sort out later, and hopefully easier to figure out a good design for vulkan.
This commit is contained in:
parent
961e6d9e6c
commit
c05476f94b
23 changed files with 115 additions and 234 deletions
|
@ -38,7 +38,8 @@ typedef struct {
|
|||
byte color[4];
|
||||
} partvert_t;
|
||||
|
||||
void gl_R_DrawParticles (void);
|
||||
struct psystem_s;
|
||||
void gl_R_DrawParticles (struct psystem_s *pssystem);
|
||||
void gl_R_Particles_Init_Cvars (void);
|
||||
void gl_R_InitParticles (void);
|
||||
|
||||
|
|
|
@ -45,9 +45,11 @@ void glrmain_init (void);
|
|||
void gl_R_RotateForEntity (struct entity_s *e);
|
||||
|
||||
struct model_s;
|
||||
struct entqueue_s;
|
||||
void gl_R_NewMap (struct model_s *worldmodel, struct model_s **models,
|
||||
int num_models);
|
||||
void gl_R_RenderView (void);
|
||||
void gl_R_RenderEntities (struct entqueue_s *queue);
|
||||
void gl_R_ClearState (void);
|
||||
void gl_R_ViewChanged (void);
|
||||
void gl_R_LineGraph (int x, int y, int *h_vals, int count, int height);
|
||||
|
|
|
@ -28,7 +28,10 @@
|
|||
#ifndef __QF_GLSL_qf_main_h
|
||||
#define __QF_GLSL_qf_main_h
|
||||
|
||||
struct entqueue_s;
|
||||
|
||||
void glsl_R_NewMap (model_t *worldmodel, model_t **models, int num_models);
|
||||
void glsl_R_RenderEntities (struct entqueue_s *queue);
|
||||
void glsl_R_RenderView (void);
|
||||
void glsl_R_ClearState (void);
|
||||
void glsl_R_ViewChanged (void);
|
||||
|
|
|
@ -38,7 +38,8 @@ typedef struct {
|
|||
byte color[4];
|
||||
} partvert_t;
|
||||
|
||||
void glsl_R_DrawParticles (void);
|
||||
struct psystem_s;
|
||||
void glsl_R_DrawParticles (struct psystem_s *psystem);
|
||||
void glsl_R_Particles_Init_Cvars (void);
|
||||
void glsl_R_InitParticles (void);
|
||||
|
||||
|
|
|
@ -30,9 +30,12 @@
|
|||
|
||||
struct vulkan_ctx_s;
|
||||
struct qfv_renderframe_s;
|
||||
struct entqueue_s;
|
||||
|
||||
void Vulkan_NewMap (model_t *worldmodel, struct model_s **models,
|
||||
int num_models, struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_RenderView (struct qfv_renderframe_s *rFrame);
|
||||
void Vulkan_RenderEntities (struct entqueue_s *queue,
|
||||
struct qfv_renderframe_s *rFrame);
|
||||
|
||||
#endif//__QF_Vulkan_qf_main_h
|
||||
|
|
|
@ -39,6 +39,7 @@ struct skin_s;
|
|||
|
||||
struct mod_alias_ctx_s;
|
||||
struct mod_sprite_ctx_s;
|
||||
struct entqueue_s;
|
||||
|
||||
/*
|
||||
All video plugins must export these functions
|
||||
|
@ -108,6 +109,8 @@ typedef struct vid_render_funcs_s {
|
|||
|
||||
void (*begin_frame) (void);
|
||||
void (*render_view) (void);
|
||||
void (*draw_entities) (struct entqueue_s *queue);
|
||||
void (*draw_particles) (struct psystem_s *psystem);
|
||||
void (*set_2d) (int scaled);
|
||||
void (*end_frame) (void);
|
||||
|
||||
|
|
|
@ -53,7 +53,6 @@ void R_InitBubble (void);
|
|||
|
||||
void R_InitParticles (void);
|
||||
void R_ClearParticles (void);
|
||||
void R_DrawParticles (void);
|
||||
struct cvar_s;
|
||||
void R_MaxParticlesCheck (struct cvar_s *r_particles,
|
||||
struct cvar_s *r_particles_max);
|
||||
|
|
|
@ -112,6 +112,8 @@ extern clipplane_t view_clipplanes[4];
|
|||
//=============================================================================
|
||||
|
||||
void R_RenderWorld (void);
|
||||
struct entqueue_s;
|
||||
void R_DrawEntitiesOnList (struct entqueue_s *queue);
|
||||
|
||||
//=============================================================================
|
||||
|
||||
|
@ -248,7 +250,8 @@ qboolean R_AliasCheckBBox (entity_t *ent);
|
|||
|
||||
// particle stuff =========================================
|
||||
|
||||
void R_DrawParticles (void);
|
||||
struct psystem_s;
|
||||
void R_DrawParticles (struct psystem_s *psystem);
|
||||
void R_InitParticles (void);
|
||||
void R_ClearParticles (void);
|
||||
void R_ReadPointFile_f (void);
|
||||
|
|
|
@ -28,11 +28,9 @@ video_renderer_common_sources = \
|
|||
libs/video/renderer/noisetextures.c \
|
||||
libs/video/renderer/r_alias.c \
|
||||
libs/video/renderer/r_billboard.c \
|
||||
libs/video/renderer/r_bsp.c \
|
||||
libs/video/renderer/r_dyn_textures.c \
|
||||
libs/video/renderer/r_ent.c \
|
||||
libs/video/renderer/r_iqm.c \
|
||||
libs/video/renderer/r_part.c \
|
||||
libs/video/renderer/r_sprite.c \
|
||||
libs/video/renderer/vid_common.c
|
||||
|
||||
|
@ -44,6 +42,7 @@ libs_video_renderer_libQFrenderer_la_LDFLAGS= @STATIC@
|
|||
libs_video_renderer_libQFrenderer_la_LIBADD= $(renderer_libs)
|
||||
libs_video_renderer_libQFrenderer_la_DEPENDENCIES= $(renderer_libs)
|
||||
libs_video_renderer_libQFrenderer_la_SOURCES=\
|
||||
libs/video/renderer/r_bsp.c \
|
||||
libs/video/renderer/r_cvar.c \
|
||||
libs/video/renderer/r_efrag.c \
|
||||
libs/video/renderer/r_fog.c \
|
||||
|
@ -51,6 +50,7 @@ libs_video_renderer_libQFrenderer_la_SOURCES=\
|
|||
libs/video/renderer/r_init.c \
|
||||
libs/video/renderer/r_light.c \
|
||||
libs/video/renderer/r_main.c \
|
||||
libs/video/renderer/r_part.c \
|
||||
libs/video/renderer/r_scrap.c \
|
||||
libs/video/renderer/r_screen.c \
|
||||
libs/video/renderer/r_progs.c
|
||||
|
|
|
@ -110,7 +110,7 @@ gl_R_InitParticles (void)
|
|||
}
|
||||
|
||||
void
|
||||
gl_R_DrawParticles (void)
|
||||
gl_R_DrawParticles (psystem_t *psystem)
|
||||
{
|
||||
unsigned char *at;
|
||||
int vacount;
|
||||
|
@ -118,10 +118,9 @@ gl_R_DrawParticles (void)
|
|||
vec3_t up_scale, right_scale, up_right_scale, down_right_scale;
|
||||
varray_t2f_c4ub_v3f_t *VA;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
if (!r_psystem.numparticles) {
|
||||
return;
|
||||
|
||||
R_RunParticles (vr_data.frametime);
|
||||
}
|
||||
|
||||
qfglBindTexture (GL_TEXTURE_2D, gl_part_tex);
|
||||
// LordHavoc: particles should not affect zbuffer
|
||||
|
|
|
@ -100,13 +100,8 @@ gl_R_RotateForEntity (entity_t *e)
|
|||
qfglMultMatrixf (&mat[0][0]);
|
||||
}
|
||||
|
||||
/*
|
||||
R_DrawEntitiesOnList
|
||||
|
||||
Draw all the entities we have information on.
|
||||
*/
|
||||
static void
|
||||
R_DrawEntitiesOnList (void)
|
||||
void
|
||||
gl_R_RenderEntities (entqueue_t *queue)
|
||||
{
|
||||
if (!r_drawentities->int_val)
|
||||
return;
|
||||
|
@ -133,8 +128,8 @@ R_DrawEntitiesOnList (void)
|
|||
qfglEnable (GL_NORMALIZE);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < r_ent_queue->ent_queues[mod_alias].size; i++) { \
|
||||
entity_t *ent = r_ent_queue->ent_queues[mod_alias].a[i]; \
|
||||
for (size_t i = 0; i < queue->ent_queues[mod_alias].size; i++) { \
|
||||
entity_t *ent = queue->ent_queues[mod_alias].a[i]; \
|
||||
gl_R_DrawAliasModel (ent);
|
||||
}
|
||||
qfglColor3ubv (color_white);
|
||||
|
@ -162,8 +157,8 @@ R_DrawEntitiesOnList (void)
|
|||
qglActiveTexture (gl_mtex_enum + 0);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < r_ent_queue->ent_queues[mod_iqm].size; i++) { \
|
||||
entity_t *ent = r_ent_queue->ent_queues[mod_iqm].a[i]; \
|
||||
for (size_t i = 0; i < queue->ent_queues[mod_iqm].size; i++) { \
|
||||
entity_t *ent = queue->ent_queues[mod_iqm].a[i]; \
|
||||
gl_R_DrawIQMModel (ent);
|
||||
}
|
||||
qfglColor3ubv (color_white);
|
||||
|
@ -172,8 +167,8 @@ R_DrawEntitiesOnList (void)
|
|||
qfglEnable (GL_ALPHA_TEST);
|
||||
if (gl_va_capable)
|
||||
qfglInterleavedArrays (GL_T2F_C4UB_V3F, 0, gl_spriteVertexArray);
|
||||
for (size_t i = 0; i < r_ent_queue->ent_queues[mod_sprite].size; i++) { \
|
||||
entity_t *ent = r_ent_queue->ent_queues[mod_sprite].a[i]; \
|
||||
for (size_t i = 0; i < queue->ent_queues[mod_sprite].size; i++) { \
|
||||
entity_t *ent = queue->ent_queues[mod_sprite].a[i]; \
|
||||
gl_R_DrawSpriteModel (ent);
|
||||
}
|
||||
qfglDisable (GL_ALPHA_TEST);
|
||||
|
@ -319,21 +314,14 @@ R_SetupGL (void)
|
|||
static void
|
||||
R_RenderScene (void)
|
||||
{
|
||||
if (r_timegraph->int_val || r_speeds->int_val || r_dspeeds->int_val)
|
||||
r_time1 = Sys_DoubleTime ();
|
||||
|
||||
R_SetupGL ();
|
||||
gl_Fog_EnableGFog ();
|
||||
|
||||
R_MarkLeaves (); // done here so we know if we're in water
|
||||
R_PushDlights (vec3_origin);
|
||||
gl_R_DrawWorld (); // adds static entities to the list
|
||||
S_ExtraUpdate (); // don't let sound get messed up if going slow
|
||||
R_DrawEntitiesOnList ();
|
||||
gl_R_RenderDlights ();
|
||||
gl_R_DrawWaterSurfaces ();
|
||||
R_DrawViewModel ();
|
||||
gl_R_DrawParticles ();
|
||||
|
||||
gl_Fog_DisableGFog ();
|
||||
}
|
||||
|
|
|
@ -173,7 +173,6 @@ gl_R_TimeRefresh_f (void)
|
|||
void
|
||||
gl_R_Init (void)
|
||||
{
|
||||
r_ent_queue = EntQueue_New (mod_num_types);
|
||||
R_Init_Cvars ();
|
||||
gl_R_Particles_Init_Cvars ();
|
||||
|
||||
|
|
|
@ -116,8 +116,8 @@ R_SetupView (void)
|
|||
qfeglEnable (GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
static void
|
||||
R_RenderEntities (void)
|
||||
void
|
||||
glsl_R_RenderEntities (entqueue_t *queue)
|
||||
{
|
||||
int begun;
|
||||
|
||||
|
@ -126,9 +126,9 @@ R_RenderEntities (void)
|
|||
#define RE_LOOP(type_name, Type) \
|
||||
do { \
|
||||
begun = 0; \
|
||||
for (size_t i = 0; i < r_ent_queue->ent_queues[mod_##type_name].size; \
|
||||
for (size_t i = 0; i < queue->ent_queues[mod_##type_name].size; \
|
||||
i++) { \
|
||||
entity_t *ent = r_ent_queue->ent_queues[mod_##type_name].a[i]; \
|
||||
entity_t *ent = queue->ent_queues[mod_##type_name].a[i]; \
|
||||
if (!begun) { \
|
||||
glsl_R_##Type##Begin (); \
|
||||
begun = 1; \
|
||||
|
@ -165,51 +165,15 @@ R_DrawViewModel (void)
|
|||
void
|
||||
glsl_R_RenderView (void)
|
||||
{
|
||||
double t[10] = {};
|
||||
int speeds = r_speeds->int_val;
|
||||
|
||||
if (!r_refdef.worldmodel) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (speeds)
|
||||
t[0] = Sys_DoubleTime ();
|
||||
R_SetupView ();
|
||||
if (speeds)
|
||||
t[1] = Sys_DoubleTime ();
|
||||
R_MarkLeaves ();
|
||||
if (speeds)
|
||||
t[2] = Sys_DoubleTime ();
|
||||
R_PushDlights (vec3_origin);
|
||||
if (speeds)
|
||||
t[3] = Sys_DoubleTime ();
|
||||
glsl_R_DrawWorld ();
|
||||
if (speeds)
|
||||
t[4] = Sys_DoubleTime ();
|
||||
glsl_R_DrawSky ();
|
||||
if (speeds)
|
||||
t[5] = Sys_DoubleTime ();
|
||||
R_RenderEntities ();
|
||||
if (speeds)
|
||||
t[6] = Sys_DoubleTime ();
|
||||
glsl_R_DrawWaterSurfaces ();
|
||||
if (speeds)
|
||||
t[7] = Sys_DoubleTime ();
|
||||
R_DrawViewModel ();
|
||||
if (speeds)
|
||||
t[8] = Sys_DoubleTime ();
|
||||
glsl_R_DrawParticles ();
|
||||
if (speeds)
|
||||
t[9] = Sys_DoubleTime ();
|
||||
if (speeds) {
|
||||
Sys_Printf ("frame: %g, setup: %g, mark: %g, pushdl: %g, world: %g,"
|
||||
" sky: %g, ents: %g, water: %g, view: %g, part: %g\n",
|
||||
(t[9] - t[0]) * 1000, (t[1] - t[0]) * 1000,
|
||||
(t[2] - t[1]) * 1000, (t[3] - t[2]) * 1000,
|
||||
(t[4] - t[3]) * 1000, (t[5] - t[4]) * 1000,
|
||||
(t[6] - t[5]) * 1000, (t[7] - t[6]) * 1000,
|
||||
(t[8] - t[7]) * 1000, (t[9] - t[8]) * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -237,7 +201,6 @@ glsl_R_TimeRefresh_f (void)
|
|||
void
|
||||
glsl_R_Init (void)
|
||||
{
|
||||
r_ent_queue = EntQueue_New (mod_num_types);
|
||||
Cmd_AddCommand ("timerefresh", glsl_R_TimeRefresh_f,
|
||||
"Test the current refresh rate for the current location.");
|
||||
R_Init_Cvars ();
|
||||
|
|
|
@ -215,7 +215,7 @@ glsl_R_InitParticles (void)
|
|||
}
|
||||
|
||||
static void
|
||||
draw_qf_particles (void)
|
||||
draw_qf_particles (psystem_t *psystem)
|
||||
{
|
||||
byte *at;
|
||||
int vacount;
|
||||
|
@ -255,8 +255,8 @@ draw_qf_particles (void)
|
|||
vacount = 0;
|
||||
VA = particleVertexArray;
|
||||
|
||||
for (unsigned i = 0; i < r_psystem.numparticles; i++) {
|
||||
particle_t *p = &r_psystem.particles[i];
|
||||
for (unsigned i = 0; i < psystem->numparticles; i++) {
|
||||
particle_t *p = &psystem->particles[i];
|
||||
// Don't render particles too close to us.
|
||||
// Note, we must still do physics and such on them.
|
||||
if (!(DotProduct (p->pos, r_refdef.frame.forward) < minparticledist)) {
|
||||
|
@ -340,7 +340,7 @@ draw_qf_particles (void)
|
|||
}
|
||||
|
||||
static void
|
||||
draw_id_particles (void)
|
||||
draw_id_particles (psystem_t *psystem)
|
||||
{
|
||||
int vacount;
|
||||
float minparticledist;
|
||||
|
@ -375,8 +375,8 @@ draw_id_particles (void)
|
|||
vacount = 0;
|
||||
VA = particleVertexArray;
|
||||
|
||||
for (unsigned i = 0; i < r_psystem.numparticles; i++) {
|
||||
particle_t *p = &r_psystem.particles[i];
|
||||
for (unsigned i = 0; i < psystem->numparticles; i++) {
|
||||
particle_t *p = &psystem->particles[i];
|
||||
// Don't render particles too close to us.
|
||||
// Note, we must still do physics and such on them.
|
||||
if (!(DotProduct (p->pos, r_refdef.frame.forward) < minparticledist)) {
|
||||
|
@ -403,15 +403,15 @@ draw_id_particles (void)
|
|||
}
|
||||
|
||||
void
|
||||
glsl_R_DrawParticles (void)
|
||||
glsl_R_DrawParticles (psystem_t *psystem)
|
||||
{
|
||||
if (!r_particles->int_val || !r_psystem.numparticles)
|
||||
if (!psystem->numparticles) {
|
||||
return;
|
||||
R_RunParticles (vr_data.frametime);
|
||||
if (!r_psystem.points_only) {
|
||||
draw_qf_particles ();
|
||||
}
|
||||
if (!psystem->points_only) {
|
||||
draw_qf_particles (psystem);
|
||||
} else {
|
||||
draw_id_particles ();
|
||||
draw_id_particles (psystem);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ void
|
|||
R_RunParticles (float dT)
|
||||
{
|
||||
psystem_t *ps = &r_psystem;//FIXME
|
||||
vec4f_t gravity = {0, 0, -vr_data.gravity, 0};
|
||||
vec4f_t gravity = {0, 0, -r_data->gravity, 0};
|
||||
|
||||
unsigned j = 0;
|
||||
for (unsigned i = 0; i < ps->numparticles; i++) {
|
||||
|
|
|
@ -161,6 +161,10 @@ SCR_UpdateScreen (transform_t *camera, double realtime, SCR_Func *scr_funcs)
|
|||
return;
|
||||
}
|
||||
|
||||
if (r_timegraph->int_val || r_speeds->int_val || r_dspeeds->int_val) {
|
||||
r_time1 = Sys_DoubleTime ();
|
||||
}
|
||||
|
||||
refdef_t *refdef = r_data->refdef;
|
||||
if (camera) {
|
||||
Transform_GetWorldMatrix (camera, refdef->camera);
|
||||
|
@ -194,15 +198,20 @@ SCR_UpdateScreen (transform_t *camera, double realtime, SCR_Func *scr_funcs)
|
|||
SCR_CalcRefdef ();
|
||||
}
|
||||
|
||||
R_RunParticles (r_data->frametime);
|
||||
R_AnimateLight ();
|
||||
refdef->viewleaf = 0;
|
||||
if (refdef->worldmodel) {
|
||||
vec4f_t position = refdef->frame.position;
|
||||
refdef->viewleaf = Mod_PointInLeaf (&position[0], refdef->worldmodel);
|
||||
}
|
||||
R_MarkLeaves ();
|
||||
R_PushDlights (vec3_origin);
|
||||
|
||||
r_funcs->begin_frame ();
|
||||
r_funcs->render_view ();
|
||||
r_funcs->draw_entities (r_ent_queue);
|
||||
r_funcs->draw_particles (&r_psystem);
|
||||
r_funcs->set_2d (0);
|
||||
view_draw (r_data->scr_view);
|
||||
r_funcs->set_2d (1);
|
||||
|
@ -475,4 +484,6 @@ SCR_Init (void)
|
|||
scr_turtle = r_funcs->Draw_PicFromWad ("turtle");
|
||||
|
||||
scr_initialized = true;
|
||||
|
||||
r_ent_queue = EntQueue_New (mod_num_types);
|
||||
}
|
||||
|
|
|
@ -112,16 +112,11 @@ float r_viewmatrix[3][4];
|
|||
|
||||
float r_aliastransition, r_resfudge;
|
||||
|
||||
static float dp_time1, dp_time2, db_time1, db_time2, rw_time1, rw_time2;
|
||||
static float se_time1, se_time2, de_time1, de_time2, dv_time1, dv_time2;
|
||||
|
||||
void
|
||||
sw_R_Init (void)
|
||||
{
|
||||
int dummy;
|
||||
|
||||
r_ent_queue = EntQueue_New (mod_num_types);
|
||||
|
||||
// get stack position so we can guess if we are going to overflow
|
||||
r_stack_start = (byte *) & dummy;
|
||||
|
||||
|
@ -411,17 +406,17 @@ draw_iqm_entity (entity_t *ent)
|
|||
R_IQMDrawModel (ent, &lighting);
|
||||
}
|
||||
|
||||
static void
|
||||
R_DrawEntitiesOnList (void)
|
||||
void
|
||||
R_DrawEntitiesOnList (entqueue_t *queue)
|
||||
{
|
||||
if (!r_drawentities->int_val)
|
||||
return;
|
||||
|
||||
#define RE_LOOP(type_name) \
|
||||
do { \
|
||||
for (size_t i = 0; i < r_ent_queue->ent_queues[mod_##type_name].size; \
|
||||
for (size_t i = 0; i < queue->ent_queues[mod_##type_name].size; \
|
||||
i++) { \
|
||||
entity_t *ent = r_ent_queue->ent_queues[mod_##type_name].a[i]; \
|
||||
entity_t *ent = queue->ent_queues[mod_##type_name].a[i]; \
|
||||
VectorCopy (Transform_GetWorldPosition (ent->transform), \
|
||||
r_entorigin); \
|
||||
draw_##type_name##_entity (ent); \
|
||||
|
@ -549,7 +544,7 @@ R_BmodelCheckBBox (entity_t *ent, model_t *clmodel, float *minmaxs)
|
|||
}
|
||||
|
||||
static void
|
||||
R_DrawBrushEntitiesOnList (void)
|
||||
R_DrawBrushEntitiesOnList (entqueue_t *queue)
|
||||
{
|
||||
int j, clipflags;
|
||||
unsigned int k;
|
||||
|
@ -562,8 +557,8 @@ R_DrawBrushEntitiesOnList (void)
|
|||
|
||||
insubmodel = true;
|
||||
|
||||
for (size_t i = 0; i < r_ent_queue->ent_queues[mod_brush].size; i++) {
|
||||
entity_t *ent = r_ent_queue->ent_queues[mod_brush].a[i];
|
||||
for (size_t i = 0; i < queue->ent_queues[mod_brush].size; i++) {
|
||||
entity_t *ent = queue->ent_queues[mod_brush].a[i];
|
||||
|
||||
VectorCopy (Transform_GetWorldPosition (ent->transform), origin);
|
||||
clmodel = ent->renderer.model;
|
||||
|
@ -642,29 +637,7 @@ R_DrawBrushEntitiesOnList (void)
|
|||
}
|
||||
|
||||
static void
|
||||
R_PrintDSpeeds (void)
|
||||
{
|
||||
float ms, dp_time, r_time2, rw_time, db_time, se_time, de_time,
|
||||
|
||||
dv_time;
|
||||
|
||||
r_time2 = Sys_DoubleTime ();
|
||||
|
||||
dp_time = (dp_time2 - dp_time1) * 1000;
|
||||
rw_time = (rw_time2 - rw_time1) * 1000;
|
||||
db_time = (db_time2 - db_time1) * 1000;
|
||||
se_time = (se_time2 - se_time1) * 1000;
|
||||
de_time = (de_time2 - de_time1) * 1000;
|
||||
dv_time = (dv_time2 - dv_time1) * 1000;
|
||||
ms = (r_time2 - r_time1) * 1000;
|
||||
|
||||
Sys_Printf ("%3i %4.1fp %3iw %4.1fb %3is %4.1fe %4.1fv\n",
|
||||
(int) ms, dp_time, (int) rw_time, db_time, (int) se_time,
|
||||
de_time, dv_time);
|
||||
}
|
||||
|
||||
static void
|
||||
R_EdgeDrawing (void)
|
||||
R_EdgeDrawing (entqueue_t *queue)
|
||||
{
|
||||
edge_t ledges[NUMSTACKEDGES +
|
||||
((CACHE_SIZE - 1) / sizeof (edge_t)) + 1];
|
||||
|
@ -690,10 +663,6 @@ R_EdgeDrawing (void)
|
|||
|
||||
R_BeginEdgeFrame ();
|
||||
|
||||
if (r_dspeeds->int_val) {
|
||||
rw_time1 = Sys_DoubleTime ();
|
||||
}
|
||||
|
||||
R_RenderWorld ();
|
||||
|
||||
if (r_drawculledpolys)
|
||||
|
@ -703,21 +672,7 @@ R_EdgeDrawing (void)
|
|||
// just z writes, so have the driver turn z compares on now
|
||||
D_TurnZOn ();
|
||||
|
||||
if (r_dspeeds->int_val) {
|
||||
rw_time2 = Sys_DoubleTime ();
|
||||
db_time1 = rw_time2;
|
||||
}
|
||||
|
||||
R_DrawBrushEntitiesOnList ();
|
||||
|
||||
if (r_dspeeds->int_val) {
|
||||
db_time2 = Sys_DoubleTime ();
|
||||
se_time1 = db_time2;
|
||||
}
|
||||
|
||||
if (!r_dspeeds->int_val) {
|
||||
S_ExtraUpdate (); // don't let sound get messed up if going slow
|
||||
}
|
||||
R_DrawBrushEntitiesOnList (queue);
|
||||
|
||||
if (!(r_drawpolys | r_drawculledpolys))
|
||||
R_ScanEdges ();
|
||||
|
@ -741,73 +696,24 @@ R_RenderView_ (void)
|
|||
|
||||
r_warpbuffer = warpbuffer;
|
||||
|
||||
if (r_timegraph->int_val || r_speeds->int_val || r_dspeeds->int_val)
|
||||
r_time1 = Sys_DoubleTime ();
|
||||
|
||||
R_SetupFrame ();
|
||||
|
||||
R_MarkLeaves (); // done here so we know if we're in water
|
||||
|
||||
R_PushDlights (vec3_origin);
|
||||
|
||||
// make FDIV fast. This reduces timing precision after we've been running for a
|
||||
// while, so we don't do it globally. This also sets chop mode, and we do it
|
||||
// here so that setup stuff like the refresh area calculations match what's
|
||||
// done in screen.c
|
||||
R_LowFPPrecision ();
|
||||
|
||||
if (!r_dspeeds->int_val) {
|
||||
S_ExtraUpdate (); // don't let sound get messed up if going slow
|
||||
}
|
||||
|
||||
R_EdgeDrawing ();
|
||||
|
||||
if (!r_dspeeds->int_val) {
|
||||
S_ExtraUpdate (); // don't let sound get messed up if going slow
|
||||
}
|
||||
|
||||
if (r_dspeeds->int_val) {
|
||||
se_time2 = Sys_DoubleTime ();
|
||||
de_time1 = se_time2;
|
||||
}
|
||||
|
||||
R_DrawEntitiesOnList ();
|
||||
|
||||
if (r_dspeeds->int_val) {
|
||||
de_time2 = Sys_DoubleTime ();
|
||||
dv_time1 = de_time2;
|
||||
}
|
||||
R_EdgeDrawing (r_ent_queue);
|
||||
|
||||
R_DrawViewModel ();
|
||||
|
||||
if (r_dspeeds->int_val) {
|
||||
dv_time2 = Sys_DoubleTime ();
|
||||
dp_time1 = Sys_DoubleTime ();
|
||||
}
|
||||
|
||||
R_DrawParticles ();
|
||||
|
||||
if (r_dspeeds->int_val)
|
||||
dp_time2 = Sys_DoubleTime ();
|
||||
|
||||
if (r_dowarp)
|
||||
D_WarpScreen ();
|
||||
|
||||
if (r_aliasstats->int_val)
|
||||
R_PrintAliasStats ();
|
||||
|
||||
if (r_speeds->int_val)
|
||||
R_PrintTimes ();
|
||||
|
||||
if (r_dspeeds->int_val)
|
||||
R_PrintDSpeeds ();
|
||||
|
||||
if (r_reportsurfout->int_val && r_outofsurfaces)
|
||||
Sys_Printf ("Short %d surfaces\n", r_outofsurfaces);
|
||||
|
||||
if (r_reportedgeout->int_val && r_outofedges)
|
||||
Sys_Printf ("Short roughly %d edges\n", r_outofedges * 2 / 3);
|
||||
|
||||
// back to high floating-point precision
|
||||
R_HighFPPrecision ();
|
||||
}
|
||||
|
|
|
@ -52,17 +52,18 @@
|
|||
vec3_t r_pright, r_pup, r_ppn, r_porigin;
|
||||
|
||||
void
|
||||
R_DrawParticles (void)
|
||||
R_DrawParticles (psystem_t *psystem)
|
||||
{
|
||||
if (!psystem->numparticles) {
|
||||
return;
|
||||
}
|
||||
VectorScale (vright, xscaleshrink, r_pright);
|
||||
VectorScale (vup, yscaleshrink, r_pup);
|
||||
VectorCopy (vfwd, r_ppn);
|
||||
VectorCopy (r_refdef.frame.position, r_porigin);
|
||||
|
||||
R_RunParticles (vr_data.frametime);
|
||||
|
||||
for (unsigned i = 0; i < r_psystem.numparticles; i++) {
|
||||
particle_t *p = &r_psystem.particles[i];
|
||||
for (unsigned i = 0; i < psystem->numparticles; i++) {
|
||||
particle_t *p = &psystem->particles[i];
|
||||
D_DrawParticle (p);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "QF/GL/qf_draw.h"
|
||||
#include "QF/GL/qf_rmain.h"
|
||||
#include "QF/GL/qf_rsurf.h"
|
||||
#include "QF/GL/qf_particles.h"
|
||||
#include "QF/GL/qf_vid.h"
|
||||
|
||||
#include "mod_internal.h"
|
||||
|
@ -327,6 +328,8 @@ vid_render_funcs_t gl_vid_render_funcs = {
|
|||
gl_R_ViewChanged,
|
||||
gl_begin_frame,
|
||||
gl_render_view,
|
||||
gl_R_RenderEntities,
|
||||
gl_R_DrawParticles,
|
||||
gl_set_2d,
|
||||
gl_end_frame,
|
||||
&model_funcs
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "QF/GLSL/qf_bsp.h"
|
||||
#include "QF/GLSL/qf_draw.h"
|
||||
#include "QF/GLSL/qf_main.h"
|
||||
#include "QF/GLSL/qf_particles.h"
|
||||
#include "QF/GLSL/qf_vid.h"
|
||||
|
||||
#include "mod_internal.h"
|
||||
|
@ -271,6 +272,8 @@ vid_render_funcs_t glsl_vid_render_funcs = {
|
|||
glsl_R_ViewChanged,
|
||||
glsl_begin_frame,
|
||||
glsl_render_view,
|
||||
glsl_R_RenderEntities,
|
||||
glsl_R_DrawParticles,
|
||||
glsl_set_2d,
|
||||
glsl_end_frame,
|
||||
&model_funcs
|
||||
|
|
|
@ -152,6 +152,12 @@ sw_set_2d (int scaled)
|
|||
static void
|
||||
sw_end_frame (void)
|
||||
{
|
||||
if (r_reportsurfout->int_val && r_outofsurfaces)
|
||||
Sys_Printf ("Short %d surfaces\n", r_outofsurfaces);
|
||||
|
||||
if (r_reportedgeout->int_val && r_outofedges)
|
||||
Sys_Printf ("Short roughly %d edges\n", r_outofedges * 2 / 3);
|
||||
|
||||
// update one of three areas
|
||||
vrect_t vrect;
|
||||
if (vr_data.scr_copyeverything) {
|
||||
|
@ -210,6 +216,8 @@ vid_render_funcs_t sw_vid_render_funcs = {
|
|||
R_ViewChanged,
|
||||
sw_begin_frame,
|
||||
sw_render_view,
|
||||
R_DrawEntitiesOnList,
|
||||
R_DrawParticles,
|
||||
sw_set_2d,
|
||||
sw_end_frame,
|
||||
&model_funcs
|
||||
|
|
|
@ -284,6 +284,25 @@ vulkan_render_view (void)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
vulkan_draw_entities (entqueue_t *queue)
|
||||
{
|
||||
__auto_type frame = &vulkan_ctx->frames.a[vulkan_ctx->curFrame];
|
||||
uint32_t imageIndex = vulkan_ctx->swapImageIndex;
|
||||
|
||||
for (size_t i = 0; i < vulkan_ctx->renderPasses.size; i++) {
|
||||
__auto_type rp = vulkan_ctx->renderPasses.a[i];
|
||||
__auto_type rpFrame = &rp->frames.a[vulkan_ctx->curFrame];
|
||||
frame->framebuffer = rp->framebuffers->a[imageIndex];
|
||||
Vulkan_RenderEntities (queue, rpFrame);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
vulkan_draw_particles (struct psystem_s *psystem)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
vulkan_set_2d (int scaled)
|
||||
{
|
||||
|
@ -667,6 +686,8 @@ vid_render_funcs_t vulkan_vid_render_funcs = {
|
|||
vulkan_R_ViewChanged,
|
||||
vulkan_begin_frame,
|
||||
vulkan_render_view,
|
||||
vulkan_draw_entities,
|
||||
vulkan_draw_particles,
|
||||
vulkan_set_2d,
|
||||
vulkan_end_frame,
|
||||
&model_funcs
|
||||
|
|
|
@ -63,17 +63,17 @@
|
|||
#include "r_internal.h"
|
||||
#include "vid_vulkan.h"
|
||||
|
||||
static void
|
||||
Vulkan_RenderEntities (qfv_renderframe_t *rFrame)
|
||||
void
|
||||
Vulkan_RenderEntities (entqueue_t *queue, qfv_renderframe_t *rFrame)
|
||||
{
|
||||
if (!r_drawentities->int_val)
|
||||
return;
|
||||
#define RE_LOOP(type_name, Type) \
|
||||
do { \
|
||||
int begun = 0; \
|
||||
for (size_t i = 0; i < r_ent_queue->ent_queues[mod_##type_name].size; \
|
||||
for (size_t i = 0; i < queue->ent_queues[mod_##type_name].size; \
|
||||
i++) { \
|
||||
entity_t *ent = r_ent_queue->ent_queues[mod_##type_name].a[i]; \
|
||||
entity_t *ent = queue->ent_queues[mod_##type_name].a[i]; \
|
||||
if (!begun) { \
|
||||
Vulkan_##Type##Begin (rFrame); \
|
||||
begun = 1; \
|
||||
|
@ -115,52 +115,16 @@ void
|
|||
Vulkan_RenderView (qfv_renderframe_t *rFrame)
|
||||
{
|
||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||
double t[10] = {};
|
||||
int speeds = r_speeds->int_val;
|
||||
|
||||
if (!r_refdef.worldmodel) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (speeds)
|
||||
t[0] = Sys_DoubleTime ();
|
||||
if (speeds)
|
||||
t[1] = Sys_DoubleTime ();
|
||||
R_MarkLeaves ();
|
||||
if (speeds)
|
||||
t[2] = Sys_DoubleTime ();
|
||||
R_PushDlights (vec3_origin);
|
||||
if (speeds)
|
||||
t[3] = Sys_DoubleTime ();
|
||||
Vulkan_DrawWorld (rFrame);
|
||||
if (speeds)
|
||||
t[4] = Sys_DoubleTime ();
|
||||
Vulkan_DrawSky (rFrame);
|
||||
if (speeds)
|
||||
t[5] = Sys_DoubleTime ();
|
||||
Vulkan_DrawViewModel (ctx);
|
||||
Vulkan_RenderEntities (rFrame);
|
||||
if (speeds)
|
||||
t[6] = Sys_DoubleTime ();
|
||||
Vulkan_DrawWaterSurfaces (rFrame);
|
||||
if (speeds)
|
||||
t[7] = Sys_DoubleTime ();
|
||||
Vulkan_DrawParticles (ctx);
|
||||
if (speeds)
|
||||
t[8] = Sys_DoubleTime ();
|
||||
Vulkan_Bsp_Flush (ctx);
|
||||
if (speeds)
|
||||
t[9] = Sys_DoubleTime ();
|
||||
if (speeds) {
|
||||
double total = (t[9] - t[0]) * 1000;
|
||||
for (int i = 0; i < 9; i++) {
|
||||
t[i] = (t[i + 1] - t[i]) * 1000;
|
||||
}
|
||||
Sys_Printf ("frame: %g, setup: %g, mark: %g, pushdl: %g, world: %g,"
|
||||
" sky: %g, ents: %g, water: %g, flush: %g, part: %g\n",
|
||||
total,
|
||||
t[0], t[1], t[2], t[3], t[4], t[5], t[6], t[7], t[8]);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue