Reviewed UWP branch integration
This commit is contained in:
parent
6f73008007
commit
8e0a277f7c
73
src/rlgl.c
73
src/rlgl.c
@ -1166,7 +1166,7 @@ void rlglInit(int width, int height)
|
||||
if(strcmp(extList[i], (const char *)"GL_EXT_debug_marker") == 0) debugMarkerSupported = true;
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_MSC_VER)
|
||||
//free(extList);
|
||||
#endif
|
||||
|
||||
@ -2407,10 +2407,6 @@ Shader LoadShader(char *vsFileName, char *fsFileName)
|
||||
for (int i = 0; i < MAX_SHADER_LOCATIONS; i++) shader.locs[i] = -1;
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||
// Shaders loading from external text file
|
||||
char *vShaderStr = LoadText(vsFileName);
|
||||
char *fShaderStr = LoadText(fsFileName);
|
||||
|
||||
unsigned int vertexShaderId = defaultVShaderId;
|
||||
unsigned int fragmentShaderId = defaultFShaderId;
|
||||
|
||||
@ -3181,82 +3177,46 @@ void EndVrDrawing(void)
|
||||
// Compile custom shader and return shader id
|
||||
static unsigned int CompileShader(const char *shaderStr, int type)
|
||||
{
|
||||
unsigned int program = 0;
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||
GLuint vertexShader;
|
||||
GLuint fragmentShader;
|
||||
|
||||
vertexShader = glCreateShader(GL_VERTEX_SHADER);
|
||||
fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
|
||||
const char *pvs = vShaderStr;
|
||||
const char *pfs = fShaderStr;
|
||||
|
||||
glShaderSource(vertexShader, 1, &pvs, NULL);
|
||||
glShaderSource(fragmentShader, 1, &pfs, NULL);
|
||||
unsigned int shader = glCreateShader(type);
|
||||
glShaderSource(shader, 1, &shaderStr, NULL);
|
||||
|
||||
GLint success = 0;
|
||||
|
||||
glCompileShader(vertexShader);
|
||||
|
||||
glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &success);
|
||||
glCompileShader(shader);
|
||||
glGetShaderiv(shader, GL_COMPILE_STATUS, &success);
|
||||
|
||||
if (success != GL_TRUE)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[VSHDR ID %i] Failed to compile vertex shader...", vertexShader);
|
||||
|
||||
TraceLog(LOG_WARNING, "[SHDR ID %i] Failed to compile shader...", shader);
|
||||
int maxLength = 0;
|
||||
int length;
|
||||
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &maxLength);
|
||||
|
||||
glGetShaderiv(vertexShader, GL_INFO_LOG_LENGTH, &maxLength);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_MSC_VER)
|
||||
char *log = malloc(maxLength);
|
||||
#else
|
||||
char log[maxLength];
|
||||
#endif
|
||||
glGetShaderInfoLog(vertexShader, maxLength, &length, log);
|
||||
glGetShaderInfoLog(shader, maxLength, &length, log);
|
||||
|
||||
TraceLog(LOG_INFO, "%s", log);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_MSC_VER)
|
||||
free(log);
|
||||
#endif
|
||||
}
|
||||
else TraceLog(LOG_INFO, "[VSHDR ID %i] Vertex shader compiled successfully", vertexShader);
|
||||
else TraceLog(LOG_INFO, "[SHDR ID %i] Shader compiled successfully", shader);
|
||||
|
||||
glCompileShader(fragmentShader);
|
||||
return shader;
|
||||
}
|
||||
|
||||
// Load custom shader strings and return program id
|
||||
static unsigned int LoadShaderProgram(unsigned int vShaderId, unsigned int fShaderId)
|
||||
{
|
||||
unsigned int program = 0;
|
||||
|
||||
if (success != GL_TRUE)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[FSHDR ID %i] Failed to compile fragment shader...", fragmentShader);
|
||||
|
||||
int maxLength = 0;
|
||||
int length;
|
||||
|
||||
glGetShaderiv(fragmentShader, GL_INFO_LOG_LENGTH, &maxLength);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
char *log = malloc(maxLength);
|
||||
#else
|
||||
char log[maxLength];
|
||||
#endif
|
||||
glGetShaderInfoLog(fragmentShader, maxLength, &length, log);
|
||||
|
||||
TraceLog(LOG_INFO, "%s", log);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
free(log);
|
||||
#endif
|
||||
}
|
||||
else TraceLog(LOG_INFO, "[FSHDR ID %i] Fragment shader compiled successfully", fragmentShader);
|
||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||
|
||||
GLint success = 0;
|
||||
program = glCreateProgram();
|
||||
|
||||
glAttachShader(program, vShaderId);
|
||||
@ -3304,9 +3264,6 @@ static unsigned int LoadShaderProgram(unsigned int vShaderId, unsigned int fShad
|
||||
program = 0;
|
||||
}
|
||||
else TraceLog(LOG_INFO, "[SHDR ID %i] Shader program loaded successfully", program);
|
||||
|
||||
glDeleteShader(vertexShader);
|
||||
glDeleteShader(fragmentShader);
|
||||
#endif
|
||||
return program;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user