c - 我该如何优化它(这是一个我的世界着色器)

标签 c glsl

#version 120

#extension GL_EXT_gpu_shader4 : enable

varying vec4 texcoord;

uniform sampler2D gcolor;
uniform sampler2D gnormal;
uniform sampler2D gdepth;

const int RGBA16 = 1;
const int gcolorFormat = RGBA16;

void main(){
    vec3 finalComposite = texture2D(gcolor, texcoord.st).rgb;
    vec3 finalCompositeNormal = texture2D(gnormal, texcoord.st).rgb;
    vec3 finalCompositeDepth = texture2D(gdepth, texcoord.st).rgb;

    gl_FragData[0] = vec4(finalComposite, 1.0);
    gl_FragData[1] = vec4(finalCompositeNormal, 1.0);
    gl_FragData[2] = vec4(finalCompositeDepth, 1.0);
}

我添加后 常量 int RGBA16 = 1; const int gcolorFormat = RGBA16; 它破坏了我的帧速率我该如何优化?

最佳答案

尝试

const int RGBA16 = 1;
const int gcolorFormat = 1;

如果这仍然神秘地破坏了你的帧速率,只需使用 #define 即可。

#define RGBA16 1
#define gcolorFormat RGBA16

关于c - 我该如何优化它(这是一个我的世界着色器),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59588364/

相关文章:

android - 模拟器:错误:无法加载OpenGLES仿真库

glsl - 线性化深度

c++ - glsl 灯似乎不起作用

glsl - WebGL 渲染缓冲区从着色器接收倾斜的像素值

c - 减去一个子串

c++ - 无法引用变量...为什么?

c - 程序在实现链表时查找堆栈中最大的元素,但数据未被访问

opengl - 像素化 UV 坐标时是否可以解决舍入问题?

opengl - Cocoa 和 OpenGL,如何使用数组设置 GLSL 顶点属性?

c - a[1][2] 的原型(prototype)会不会是这个 : int **a?