+void R_CalcBeam_Vertex3f(float *vert, const vec3_t org1, const vec3_t org2, float width);
+void R_DrawSprite(int blendfunc1, int blendfunc2, rtexture_t *texture, rtexture_t *fogtexture, int depthdisable, const vec3_t origin, const vec3_t left, const vec3_t up, float scalex1, float scalex2, float scaley1, float scaley2, float cr, float cg, float cb, float ca);
+
+extern mempool_t *r_main_mempool;
+
+extern int rsurface_array_size;
+extern float *rsurface_array_modelvertex3f;
+extern float *rsurface_array_modelsvector3f;
+extern float *rsurface_array_modeltvector3f;
+extern float *rsurface_array_modelnormal3f;
+extern float *rsurface_array_deformedvertex3f;
+extern float *rsurface_array_deformedsvector3f;
+extern float *rsurface_array_deformedtvector3f;
+extern float *rsurface_array_deformednormal3f;
+extern float *rsurface_array_color4f;
+extern float *rsurface_array_texcoord3f;
+
+typedef enum rsurfmode_e
+{
+ RSURFMODE_NONE,
+ RSURFMODE_SHOWSURFACES,
+ RSURFMODE_SKY,
+ RSURFMODE_MULTIPASS,
+ RSURFMODE_GLSL
+}
+rsurfmode_t;
+
+extern float *rsurface_vertex3f;
+extern float *rsurface_svector3f;
+extern float *rsurface_tvector3f;
+extern float *rsurface_normal3f;
+extern float *rsurface_lightmapcolor4f;
+extern vec3_t rsurface_modelorg;
+extern qboolean rsurface_generatedvertex;
+extern const entity_render_t *rsurface_entity;
+extern const model_t *rsurface_model;
+extern texture_t *rsurface_texture;
+extern rtexture_t *rsurface_lightmaptexture;
+extern rsurfmode_t rsurface_mode;
+
+void RSurf_ActiveEntity(const entity_render_t *ent);
+void RSurf_CleanUp(void);
+
+void R_Mesh_ResizeArrays(int newvertices);
+
+struct entity_render_s;
+struct texture_s;
+struct msurface_s;
+void R_UpdateTextureInfo(const entity_render_t *ent, texture_t *t);
+void R_UpdateAllTextureInfo(entity_render_t *ent);
+void R_QueueTextureSurfaceList(int texturenumsurfaces, msurface_t **texturesurfacelist);
+void R_DrawSurfaces(entity_render_t *ent, qboolean skysurfaces);
+
+void RSurf_PrepareVerticesForBatch(qboolean generatenormals, qboolean generatetangents, int texturenumsurfaces, msurface_t **texturesurfacelist);
+
+#define SHADERPERMUTATION_MODE_LIGHTSOURCE (1<<0) // (lightsource) use directional pixel shading from light source (rtlight)
+#define SHADERPERMUTATION_MODE_LIGHTDIRECTIONMAP_MODELSPACE (1<<1) // (lightmap) use directional pixel shading from texture containing modelspace light directions (deluxemap)
+#define SHADERPERMUTATION_MODE_LIGHTDIRECTIONMAP_TANGENTSPACE (1<<2) // (lightmap) use directional pixel shading from texture containing tangentspace light directions (deluxemap)
+#define SHADERPERMUTATION_MODE_LIGHTDIRECTION (1<<3) // (lightmap) use directional pixel shading from fixed light direction (q3bsp)
+#define SHADERPERMUTATION_GLOW (1<<4) // (lightmap) blend in an additive glow texture
+#define SHADERPERMUTATION_FOG (1<<5) // tint the color by fog color or black if using additive blend mode
+#define SHADERPERMUTATION_COLORMAPPING (1<<6) // indicates this is a colormapped skin
+#define SHADERPERMUTATION_SPECULAR (1<<7) // (lightsource or deluxemapping) render specular effects
+#define SHADERPERMUTATION_CUBEFILTER (1<<8) // (lightsource) use cubemap light filter
+#define SHADERPERMUTATION_OFFSETMAPPING (1<<9) // adjust texcoords to roughly simulate a displacement mapped surface
+#define SHADERPERMUTATION_OFFSETMAPPING_RELIEFMAPPING (1<<10) // adjust texcoords to accurately simulate a displacement mapped surface (requires OFFSETMAPPING to also be set!)
+#define SHADERPERMUTATION_COUNT (1<<11) // how many permutations are possible
+
+typedef struct r_glsl_permutation_s