我如何优化它(这是一个minecraft着色器)

我如何优化它(这是一个minecraft着色器),c,glsl,C,Glsl,在我加上 常数int RGBA16=1; 常量int gcolorFormat=RGBA16; 它破坏了我的帧速率我如何优化它?试试看 #version 120 #extension GL_EXT_gpu_shader4 : enable varying vec4 texcoord; uniform sampler2D gcolor; uniform sampler2D gnormal; uniform sampler2D gdepth; const int RGBA16 = 1; co

在我加上 常数int RGBA16=1; 常量int gcolorFormat=RGBA16; 它破坏了我的帧速率我如何优化它?

试试看

#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);
}
如果这仍然神秘地破坏了你的帧速率,那就用#define来代替

const int RGBA16 = 1;
const int gcolorFormat = 1;
#define RGBA16 1
#define gcolorFormat RGBA16