gl33: remove trailing [0] from array uniform names
This commit is contained in:
parent
50056eb41a
commit
4ebd7ba14b
6 changed files with 15 additions and 11 deletions
|
@ -282,9 +282,9 @@ static void reimu_dream_draw_gaps(EntityInterface *gap_renderer_ent) {
|
|||
r_uniform_vec2("viewport", VIEWPORT_W, VIEWPORT_H);
|
||||
r_uniform_float("time", global.frames / 60.0f);
|
||||
r_uniform_vec2("gap_size", GAP_WIDTH/2.0f, GAP_LENGTH/2.0f);
|
||||
r_uniform_vec2_array("gaps[0]", 0, NUM_GAPS, gaps);
|
||||
r_uniform_float_array("gap_angles[0]", 0, NUM_GAPS, angles);
|
||||
r_uniform_int_array("gap_links[0]", 0, NUM_GAPS, links);
|
||||
r_uniform_vec2_array("gaps", 0, NUM_GAPS, gaps);
|
||||
r_uniform_float_array("gap_angles", 0, NUM_GAPS, angles);
|
||||
r_uniform_int_array("gap_links", 0, NUM_GAPS, links);
|
||||
draw_framebuffer_tex(framebuffers->front, VIEWPORT_W, VIEWPORT_H);
|
||||
|
||||
r_blend(BLEND_PREMUL_ALPHA);
|
||||
|
|
|
@ -147,7 +147,7 @@ void r_flush_sprites(void) {
|
|||
|
||||
r_shader_ptr(NOT_NULL(_r_sprite_batch.shader));
|
||||
r_uniform_sampler("tex", _r_sprite_batch.primary_texture);
|
||||
r_uniform_sampler_array("tex_aux[0]", 0, R_NUM_SPRITE_AUX_TEXTURES, _r_sprite_batch.aux_textures);
|
||||
r_uniform_sampler_array("tex_aux", 0, R_NUM_SPRITE_AUX_TEXTURES, _r_sprite_batch.aux_textures);
|
||||
r_framebuffer(_r_sprite_batch.framebuffer);
|
||||
r_blend(_r_sprite_batch.blend);
|
||||
r_capabilities(_r_sprite_batch.capbits);
|
||||
|
|
|
@ -164,7 +164,7 @@ static MagicUniformSpec magic_unfiroms[] = {
|
|||
[UMAGIC_MATRIX_TEX] = { "r_textureMatrix", "mat4", UNIFORM_MAT4 },
|
||||
[UMAGIC_COLOR] = { "r_color", "vec4", UNIFORM_VEC4 },
|
||||
[UMAGIC_VIEWPORT] = { "r_viewport", "vec4", UNIFORM_VEC4 },
|
||||
[UMAGIC_COLOR_OUT_SIZES] = { "r_colorOutputSizes[0]", "vec2", UNIFORM_VEC2 },
|
||||
[UMAGIC_COLOR_OUT_SIZES] = { "r_colorOutputSizes", "vec2", UNIFORM_VEC2 },
|
||||
[UMAGIC_DEPTH_OUT_SIZE] = { "r_depthOutputSize", "vec2", UNIFORM_VEC2 },
|
||||
};
|
||||
static_assert(ARRAY_SIZE(magic_unfiroms) == NUM_MAGIC_UNIFORMS);
|
||||
|
@ -326,6 +326,10 @@ static bool cache_uniforms(ShaderProgram *prog) {
|
|||
glGetActiveUniform(prog->gl_handle, i, maxlen, NULL, &size, &type, name);
|
||||
loc = glGetUniformLocation(prog->gl_handle, name);
|
||||
|
||||
if(strendswith(name, "[0]")) {
|
||||
name[strlen(name) - 3] = 0;
|
||||
}
|
||||
|
||||
if(loc < 0) {
|
||||
// builtin uniform
|
||||
continue;
|
||||
|
|
|
@ -107,7 +107,7 @@ void gles30_fbcopyfallback_init(void) {
|
|||
r_shader_object_destroy(vert_shobj);
|
||||
r_shader_object_destroy(frag_shobj);
|
||||
|
||||
blit_uniforms.outputs_enabled = NOT_NULL(r_shader_uniform(blit_shader, "outputs_enabled[0]"));
|
||||
blit_uniforms.outputs_enabled = NOT_NULL(r_shader_uniform(blit_shader, "outputs_enabled"));
|
||||
blit_uniforms.depth_enabled = NOT_NULL(r_shader_uniform(blit_shader, "depth_enabled"));
|
||||
blit_uniforms.input_depth = NOT_NULL(r_shader_uniform(blit_shader, "input_depth"));
|
||||
|
||||
|
|
|
@ -1576,7 +1576,7 @@ void stage_draw_bottom_text(void) {
|
|||
r_uniform_vec3("color_low", 1.0, 0.0, 0.0);
|
||||
r_uniform_vec3("color_mid", 1.0, 1.0, 0.0);
|
||||
r_uniform_vec3("color_high", 0.0, 1.0, 0.0);
|
||||
r_uniform_float_array("points[0]", 0, graphspan, graph);
|
||||
r_uniform_float_array("points", 0, graphspan, graph);
|
||||
draw_graph(142, SCREEN_H - text_h, graphspan, text_h);
|
||||
}
|
||||
#endif
|
||||
|
@ -1605,7 +1605,7 @@ static void stage_draw_framerate_graphs(float x, float y, float w, float h) {
|
|||
r_uniform_vec3("color_low", 0.0, 1.0, 1.0);
|
||||
r_uniform_vec3("color_mid", 1.0, 1.0, 0.0);
|
||||
r_uniform_vec3("color_high", 1.0, 0.0, 0.0);
|
||||
r_uniform_float_array("points[0]", 0, NUM_SAMPLES, samples);
|
||||
r_uniform_float_array("points", 0, NUM_SAMPLES, samples);
|
||||
draw_graph(x, y, w, h);
|
||||
|
||||
// x -= w * 1.1;
|
||||
|
@ -1615,7 +1615,7 @@ static void stage_draw_framerate_graphs(float x, float y, float w, float h) {
|
|||
r_uniform_vec3("color_low", 0.0, 1.0, 0.0);
|
||||
r_uniform_vec3("color_mid", 1.0, 0.0, 0.0);
|
||||
r_uniform_vec3("color_high", 1.0, 0.0, 0.5);
|
||||
r_uniform_float_array("points[0]", 0, NUM_SAMPLES, samples);
|
||||
r_uniform_float_array("points", 0, NUM_SAMPLES, samples);
|
||||
draw_graph(x, y, w, h);
|
||||
|
||||
r_state_pop();
|
||||
|
|
|
@ -140,8 +140,8 @@ void camera3d_set_point_light_uniforms(
|
|||
vec3 lrad[num_lights];
|
||||
camera3d_fill_point_light_uniform_vectors(cam, num_lights, lights, lpos, lrad);
|
||||
|
||||
r_uniform_vec3_array("light_positions[0]", 0, num_lights, lpos);
|
||||
r_uniform_vec3_array("light_colors[0]", 0, num_lights, lrad);
|
||||
r_uniform_vec3_array("light_positions", 0, num_lights, lpos);
|
||||
r_uniform_vec3_array("light_colors", 0, num_lights, lrad);
|
||||
r_uniform_int("light_count", num_lights);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue