-
+#include "shadermodeinfo.h"
#include "quakedef.h"
#include "cl_collision.h"
#include "dpsoftrast.h"
}
}
-static qboolean GL_Backend_CompileShader(int programobject, GLenum shadertypeenum, const char *shadertype, int numstrings, const char **strings)
+static qboolean GL_Backend_CompileShader(shadermodeinfo_t *modeinfo, int programobject, GLenum shadertypeenum, const char *shadertype, int numstrings, const char **strings)
{
int shaderobject;
int shadercompiled;
char compilelog[MAX_INPUTLINE];
+
shaderobject = qglCreateShader(shadertypeenum);CHECKGLERROR
if (!shaderobject)
return false;
return true;
}
-unsigned int GL_Backend_CompileProgram(int vertexstrings_count, const char **vertexstrings_list, int geometrystrings_count, const char **geometrystrings_list, int fragmentstrings_count, const char **fragmentstrings_list)
+unsigned int GL_Backend_CompileProgram(shadermodeinfo_t *modeinfo, int vertexstrings_count, const char **vertexstrings_list, int geometrystrings_count, const char **geometrystrings_list, int fragmentstrings_count, const char **fragmentstrings_list)
{
GLint programlinked;
GLuint programobject = 0;
qglBindFragDataLocation(programobject, 0, "dp_FragColor");
#endif
- if (vertexstrings_count && !GL_Backend_CompileShader(programobject, GL_VERTEX_SHADER, "vertex", vertexstrings_count, vertexstrings_list))
+ if (vertexstrings_count && !GL_Backend_CompileShader(modeinfo, programobject, GL_VERTEX_SHADER, "vertex", vertexstrings_count, vertexstrings_list))
goto cleanup;
#ifdef GL_GEOMETRY_SHADER
- if (geometrystrings_count && !GL_Backend_CompileShader(programobject, GL_GEOMETRY_SHADER, "geometry", geometrystrings_count, geometrystrings_list))
+ if (geometrystrings_count && !GL_Backend_CompileShader(modeinfo, programobject, GL_GEOMETRY_SHADER, "geometry", geometrystrings_count, geometrystrings_list))
goto cleanup;
#endif
- if (fragmentstrings_count && !GL_Backend_CompileShader(programobject, GL_FRAGMENT_SHADER, "fragment", fragmentstrings_count, fragmentstrings_list))
+ if (fragmentstrings_count && !GL_Backend_CompileShader(modeinfo, programobject, GL_FRAGMENT_SHADER, "fragment", fragmentstrings_count, fragmentstrings_list))
goto cleanup;
qglLinkProgram(programobject);CHECKGLERROR
#ifndef GL_BACKEND_H
#define GL_BACKEND_H
+typedef struct shadermodeinfo_s shadermodeinfo_t;
+
extern r_viewport_t gl_viewport;
extern matrix4x4_t gl_modelmatrix;
extern matrix4x4_t gl_viewmatrix;
void R_Mesh_DestroyFramebufferObject(int fbo);
void R_Mesh_SetRenderTargets(int fbo, rtexture_t *depthtexture, rtexture_t *colortexture, rtexture_t *colortexture2, rtexture_t *colortexture3, rtexture_t *colortexture4);
-unsigned int GL_Backend_CompileProgram(int vertexstrings_count, const char **vertexstrings_list, int geometrystrings_count, const char **geometrystrings_list, int fragmentstrings_count, const char **fragmentstrings_list);
+unsigned int GL_Backend_CompileProgram(shadermodeinfo_t *modeinfo, int vertexstrings_count, const char **vertexstrings_list, int geometrystrings_count, const char **geometrystrings_list, int fragmentstrings_count, const char **fragmentstrings_list);
void GL_Backend_FreeProgram(unsigned int prog);
extern cvar_t gl_paranoid;
*/
// r_main.c
+#include "shadermodeinfo.h"
#include "quakedef.h"
#include "cl_dyntexture.h"
#include "r_shadow.h"
}
shaderpermutationinfo_t;
+// ~exidl: moved to shadermodeinfo.h
+/*
typedef struct shadermodeinfo_s
{
const char *vertexfilename;
const char *name;
}
shadermodeinfo_t;
+*/
// NOTE: MUST MATCH ORDER OF SHADERPERMUTATION_* DEFINES!
shaderpermutationinfo_t shaderpermutationinfo[SHADERPERMUTATION_COUNT] =
// compile the shader program
if (vertstrings_count + geomstrings_count + fragstrings_count)
- p->program = GL_Backend_CompileProgram(vertstrings_count, vertstrings_list, geomstrings_count, geomstrings_list, fragstrings_count, fragstrings_list);
+ p->program = GL_Backend_CompileProgram(modeinfo, vertstrings_count, vertstrings_list, geomstrings_count, geomstrings_list, fragstrings_count, fragstrings_list);
if (p->program)
{
CHECKGLERROR