简体   繁体   English

GLSL着色器在Intel集成GPU上运行完美,但在NVIDIA上却没有

[英]GLSL Shaders run perfect on Intel's integrated GPU but nothing on NVIDIA

I'm using Geometry Shaders for Geometry Amplification. 我正在使用“几何着色器”进行几何放大。 The code runs perfectly with Intel graphics both in Windows and OS X. 该代码可以在Windows和OS X中与Intel图形完美运行。

I change the configs to use the dedicated NVIDIA GPU from my windows machine aaaaaaaaaaand... nothing. 我将配置更改为使用Windows计算机aaaaaaaaaa和...上的专用NVIDIA GPU。

This code: 这段代码:

    void testError(std::string src) {
        GLenum err = glGetError();
       if (err != GL_NO_ERROR){
           printf("(%s) Error: %s %d\n", src.c_str(), gluErrorString(err), err);
        }
    }

    ...

    printf("glIsProgram: %s\n", glIsProgram(shaderProgram)?"True":"false");
    glUseProgram(shaderProgram);
    testError("GOGO 111");
    GLint isLinked = 0;
    glGetProgramiv(shaderProgram, GL_LINK_STATUS, (int *)&isLinked);
    if (isLinked == GL_FALSE)
    {
        GLint maxLength = 0;
        glGetProgramiv(shaderProgram, GL_INFO_LOG_LENGTH, &maxLength);

        //The maxLength includes the NULL character
        std::vector<GLchar> infoLog(maxLength);
        glGetProgramInfoLog(shaderProgram, maxLength, &maxLength, &infoLog[0]);
        printf("Program Not Linked %d:\n %s\n", maxLength, infoLog);
        //We don't need the program anymore.
        glDeleteProgram(shaderProgram);

        //Use the infoLog as you see fit.

        //In this simple program, we'll just leave
        return 0;
    }

Outputs: 输出:

    glIsProgram: True
    (GOGO 111) Error: invalid operation 1282
    Program Not Linked 116:
     ­Ð

Also the Log have a strange behaviour since it is not printing nothing but the length would be 116. 此外,日志还有一个奇怪的行为,因为它不打印任何内容,但长度为116。

Thank you. 谢谢。

EDIT This: 编辑此:

char * infoLog;
glGetProgramiv(shaderProgram, GL_INFO_LOG_LENGTH, &maxLength);

Printed out the result. 打印出结果。

Program Not Linked 116:
 Geometry info
 -------------
 (0) : error C6033: Hardware limitation reached, can only emit 128 vertices of this size

Which comes from: 来自:

const GLchar* geometryShaderSrc = GLSL(
    layout(points) in;
    layout(triangle_strip, max_vertices = 256) out;
...

It's just weird that the Intel integrated GPUS have less hardware (memory?) imitations that an NVIDIA GPU. 奇怪的是,英特尔集成GPU的硬件(内存)模仿量少于NVIDIA GPU。 Any solution to go around this without decreasing the vertices? 在不减少顶点的情况下解决此问题的任何解决方案?

It looks like you're exceeding the GEOMETRY_TOTAL_OUTPUT_COMPONENTS limit. 您似乎已超过GEOMETRY_TOTAL_OUTPUT_COMPONENTS限制。

In the OpenGL 4.4 Spec - Section 11.3.4.5 - page 388 OpenGL 4.4规范 -第11.3.4.5节-第388页中

The product of the total number of vertices and the sum of all components of all active output variables may not exceed the value of MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS . 顶点总数与所有活动输出变量的所有组件之和的乘积不得超过MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS的值。 LinkProgram will fail if it determines that the total component limit would be violated. 如果确定违反了组件总数限制, LinkProgram将失败。

ie max_vertices cannot exceed MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS / number_of_components max_vertices不能超过MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS / number_of_components

The minimum requirements are detailed in Table 23.60 - page 585 最低要求在表23.60-第585页中详细介绍

GEOMETRY_TOTAL_OUTPUT_COMPONENTS 1024

It seems like you have 8 components, so can only have 128 vertices. 看来您有8个分量,所以只能有128个顶点。 You must either decrease the number of components, or decrease the number of vertices. 您必须减少零部件数量或减少顶点数量。

Check the value of GEOMETRY_TOTAL_OUTPUT_COMPONENTS on each device to make sure. 检查每个设备上的GEOMETRY_TOTAL_OUTPUT_COMPONENTS的值以确保。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM