gpt4 book ai didi

c++ - GLSL 着色器在 Intel 的集成 GPU 上运行完美但在 NVIDIA 上没有

转载 作者:行者123 更新时间:2023-11-30 05:31:00 25 4
gpt4 key购买 nike

我正在使用几何着色器进行几何放大。代码在 Windows 和 OS X 中与英特尔显卡完美运行。

我更改了配置以使用我的 Windows 机器上的专用 NVIDIA GPU aaaaaaaaaa...什么都没有。

这段代码:

    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;
}

输出:

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

日志也有一个奇怪的行为,因为它什么都不打印,但长度为 116。

谢谢。

编辑这:

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

打印出结果。

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

来自:

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

奇怪的是,Intel 集成 GPU 的硬件(内存?)仿制品少于 NVIDIA GPU。在不减少顶点的情况下解决这个问题的解决方案是什么?

最佳答案

您似乎超出了 GEOMETRY_TOTAL_OUTPUT_COMPONENTS 限制。

OpenGL 4.4 Spec - 第 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. LinkProgram will fail if it determines that the total component limit would be violated.

max_vertices 不能超过 MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS/number_of_components

最低要求详见表 23.60 - 第 585 页

GEOMETRY_TOTAL_OUTPUT_COMPONENTS 1024

看起来你有 8 个组件,所以只能有 128 个顶点。您必须减少组件数量或减少顶点数量。

在每个设备上检查 GEOMETRY_TOTAL_OUTPUT_COMPONENTS 的值以确保。

关于c++ - GLSL 着色器在 Intel 的集成 GPU 上运行完美但在 NVIDIA 上没有,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35728951/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com