OpenGL driver bugs with HD 4000

OpenGL driver bugs with HD 4000

I'm running this on a NUC DC53427HYE with Windows 8.1 64bit. Driver Version: 10.18.10.3379

The testcases use freeglut for creating a gl context and glew for extension loading.

First the driver doesn't accept variables declared as "varying in" or "varying out" in geometry shaders using the ARB_geometry_shader4 or EXT_geometry_shader4 extensions even though the syntax is given as an example in https://www.opengl.org/registry/specs/ARB/geometry_shader4.txt. The driver only accepts "in" or "out" as qualifiers.

#include "stdafx.h"
#include "GL/glew.h"
#include "GL/glut.h"
#include <vector>
#include <fstream>
#include <vector>
#include <iostream>

GLuint program;

const char *gs_source =
"#version 120\n"
"#extension GL_EXT_geometry_shader4 : require\n"
"varying in vec4 vtx_position[]; //doesn't compile\n"
"void main(void) {\n"
"}\n";

void printCompileError(GLuint obj){
    GLint logLength = 0;
    glGetObjectParameterivARB(obj, GL_OBJECT_INFO_LOG_LENGTH_ARB, &logLength);
    if(logLength){
        std::vector<GLcharARB> errorLog(logLength,0);
        glGetInfoLogARB(obj, logLength,0,&errorLog[0]);
        fprintf(stderr, &errorLog[0]);
    }
}

int init_resources(){
    GLint compile_ok = GL_FALSE, link_ok = GL_FALSE;
    program = glCreateProgram();
    
    glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
    glEnable(GL_VERTEX_PROGRAM_TWO_SIDE);
    glDisable(GL_CULL_FACE);

    GLuint geomObject = glCreateShaderObjectARB(GL_GEOMETRY_SHADER_ARB);
    glShaderSource(geomObject, 1, &gs_source, NULL);

    glCompileShader(geomObject);
    glGetShaderiv(geomObject, GL_COMPILE_STATUS, &compile_ok);
    if (0 == compile_ok){
        fprintf(stderr, "Error in geom shader\n");
        printCompileError(geomObject);
        __debugbreak();
        return 0;
    }
    return 0;
}

void onDisplay()
{
    glutReportErrors();
    glutSwapBuffers();
}

int main(int argc, char** argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGBA|GLUT_DOUBLE|GLUT_DEPTH);
    glutInitWindowSize(640, 480);
    glutCreateWindow("gltestcase");

    GLenum glew_status = glewInit();
    if (glew_status != GLEW_OK)
    {
        fprintf(stderr, "Error: %s\n", glewGetErrorString(glew_status));
        return EXIT_FAILURE;
    }

    if (1 == init_resources())    {
        glutDisplayFunc(onDisplay);
        glutMainLoop();
    }

    return 0;
}

The next bug happens when initializing a global variable in the fragment shader to the value of the build in varying "gl_Color". When running the test case a red and green triangle should be visible but they are just black. If the global is initialized inside main everything works as expected.

#include "stdafx.h"
#include "GL/glew.h"
#include "GL/glut.h"
#include <vector>
#include <fstream>
#include <vector>
#include <iostream>

GLuint program;

const char *vs_source =
"void main(void) {\n"
"  gl_FrontColor = gl_Color;\n"
"  gl_Position = ftransform();\n"
"  gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;\n"
"}\n";

const char *fs_source =
"vec4 globalColor = gl_Color; \n"
"vec4 fun(){\n"
"    vec4 localColor;\n"
"    localColor = globalColor;\n"
"    return localColor;\n"
"}\n"
"void main(void) {\n"
"    //globalColor = gl_Color; //if not commented out it works as expected\n"
"    gl_FragColor = fun();\n"
"}\n";

void printCompileError(GLuint obj){
    GLint logLength = 0;
    glGetObjectParameterivARB(obj, GL_OBJECT_INFO_LOG_LENGTH_ARB, &logLength);
    if(logLength){
        std::vector<GLcharARB> errorLog(logLength,0);
        glGetInfoLogARB(obj, logLength,0,&errorLog[0]);
        fprintf(stderr, &errorLog[0]);
    }
}

int init_resources(){
    GLint compile_ok = GL_FALSE, link_ok = GL_FALSE;
    program = glCreateProgram();
    
    GLuint vs = glCreateShader(GL_VERTEX_SHADER);

    glShaderSource(vs, 1, &vs_source, NULL);
    glCompileShader(vs);
    glGetShaderiv(vs, GL_COMPILE_STATUS, &compile_ok);
    if (0 == compile_ok){
        fprintf(stderr, "Error in vertex shader\n");
        printCompileError(vs);
        __debugbreak();
        return 0;
    }

    GLuint fs = glCreateShader(GL_FRAGMENT_SHADER);
    glShaderSource(fs, 1, &fs_source, NULL);
    glCompileShader(fs);
    glGetShaderiv(fs, GL_COMPILE_STATUS, &compile_ok);
    if (!compile_ok){
        fprintf(stderr, "Error in fragment shader\n");
        printCompileError(fs);
        __debugbreak();
        return 0;
    }

    glAttachShader(program, vs);
    glAttachShader(program, fs);

    glLinkProgram(program);
    glGetProgramiv(program, GL_LINK_STATUS, &link_ok);
    if (!link_ok) {
        fprintf(stderr, "glLinkProgram:");
        printCompileError(program);
        __debugbreak();
        return 0;
    }            
    glutReportErrors();
    return 1;
}

void onDisplay()
{
    glClearColor(0.0, 0.0, 1.0, 1.0);
    glClear(GL_COLOR_BUFFER_BIT);

    glUseProgram(program);
    glValidateProgram(program);
    int valid;
    glGetObjectParameterivARB(program, GL_OBJECT_VALIDATE_STATUS_ARB, &valid);
    if(!valid){
        fprintf(stderr, "validation failed");
        return;
    }

    glBegin(GL_TRIANGLES);
        glColor4f(1,0,0,0.5);
        glVertex3f(0,0,0);
        glVertex3f(1,0,0);
        glVertex3f(1,1,0);

        glColor4f(0,1,0,1);
        glVertex3f(0,0,0);
        glVertex3f(0,1,0);
        glVertex3f(1,1,0);
    glEnd();

    glutReportErrors();
    glutSwapBuffers();
}

int main(int argc, char** argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGBA|GLUT_DOUBLE|GLUT_DEPTH);
    glutInitWindowSize(640, 480);
    glutCreateWindow("gltestcase");

    GLenum glew_status = glewInit();
    if (glew_status != GLEW_OK)
    {
        fprintf(stderr, "Error: %s\n", glewGetErrorString(glew_status));
        return EXIT_FAILURE;
    }

    if (1 == init_resources())    {
        glutDisplayFunc(onDisplay);
        glutMainLoop();
    }

    return 0;
}

3 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.

Hi Nils K,

Thanks for bringing this up. I am unaware of any issues in our driver that could cause this. I have contacted our OpenGL driver development team and they will investigate.

"There is no reality in the absence of observation." - The Copenhagen Interpretation of Quantum Mechanics

Hi Nils K,

A new driver has been released that has a fix for your issue.

https://downloadcenter.intel.com/Detail_Desc.aspx?DwnldID=24245&lang=eng&ProdId=3720

 

 

"There is no reality in the absence of observation." - The Copenhagen Interpretation of Quantum Mechanics

Kommentar hinterlassen

Bitte anmelden, um einen Kommentar hinzuzufügen. Sie sind noch nicht Mitglied? Jetzt teilnehmen