opengl - Unexplainable behavior when using uniform sampler2d[] -
i'm sorry require little bit of explanation. i'm trying make simple possible.
what want do: i'm visualizing height fields. height field may have multiple patches. patch smaller texture alters height field.
i'm using opengl 4.0, tesselation shaders. problem should irrelevant.
what working allready. have visualisation height field (without patches) working. interessing parts in regard problem tesselation evaluation shader , fragment shader.
the tesselation evaluation shader fetches each vertex height height field sampler.
layout(quads, fractional_odd_spacing, ccw) in; out float onedge; out float tedistancetominheight; out vec4 tcposition; void main() { // bilinear interpolate: position vec4 pos_a = mix(gl_in[0].gl_position, gl_in[1].gl_position, gl_tesscoord.x); vec4 pos_b = mix(gl_in[3].gl_position, gl_in[2].gl_position, gl_tesscoord.x); vec4 position = mix(pos_a, pos_b, gl_tesscoord.y); // bilinear interpolate: hf texture coordinate vec2 tex_a = mix(gl_in[0].gl_texcoord[hftexcoordid].xy, gl_in[1].gl_texcoord[hftexcoordid].xy, gl_tesscoord.x); vec2 tex_b = mix(gl_in[3].gl_texcoord[hftexcoordid].xy, gl_in[2].gl_texcoord[hftexcoordid].xy, gl_tesscoord.x); vec2 hftexcoord = mix(tex_a, tex_b, gl_tesscoord.y); float height = getheightfieldheight(hftexcoord); position.y = height; //position.y = getheightfieldheightmin(); gl_position = gl_modelviewprojectionmatrix * position; tcposition = gl_position; gl_texcoord[hftexcoordid].xy = hftexcoord; // vertex on edge of patch if 1 of tess coords 0 onedge = float((gl_tesscoord.x == 0 || gl_tesscoord.y == 0)); tedistancetominheight = height - getheightfieldheightmin(); }
the fragment shader uses reative height of vertex belonging fragment @ hand access 1d height palett texture. please ignore height gradient now. it's used calc normals. works fine.
in float onedge; in float tedistancetominheight; in vec4 tcposition; out vec4 fragcolor; vec3 getheightmapgradient(in vec2 ts_position, in vec2 texel_offset) { vec3 x = vec3(2.0 * texel_offset.x, 0.0, getheightfieldheight(ts_position + vec2(texel_offset.x, 0.0)) - getheightfieldheight(ts_position - vec2(texel_offset.x, 0.0))); vec3 y = vec3(0.0, 2.0 * texel_offset.y, getheightfieldheight(ts_position + vec2(0.0, texel_offset.y)) - getheightfieldheight(ts_position - vec2(0.0, texel_offset.y))); return cross(x, y); } void main() { if(tedistancetominheight < 0.00001){ // filter points near 0 position discard; } // attributes vec2 hftexcoords = gl_texcoord[hftexcoordid].xy; //float hfpalettetexcoord = getheightfieldheight(hftexcoords) / heightfieldheight; float hfpalettetexcoord = (texture(heightfield, hftexcoords).r -heightfieldlowering); vec2 heightmapsize = vec2(texturesize(heightfield, 0).xy); vec2 heightmaptexelsize = vec2(1.0) / vec2(heightmapsize); // standard colors vec4 white = vec4(1); vec4 yellow = vec4(1,1,0,1); vec4 blue = vec4(0,0,1,1); // color fragcolor = texture(heightfieldpalette, hfpalettetexcoord ); // use height field palette color if(onedge > 0.9 && showoriginalgrid == 1 ){ fragcolor = mix(fragcolor, yellow, 0.5); } // shading vec3 n = normalize(getheightmapgradient(hftexcoords, heightmaptexelsize).xzy); vec3 l = vec3(1,1,0); vec3 v = normalize(cameraposition - tcposition.xyz); vec3 h = normalize(l + v); float df= dot(n, l); fragcolor = (fragcolor * (df * 0.5 + 0.5)) // diffuse + vec4(1) * pow(max(0.0, dot(n,h)), 60.0) // specular + 0.1; // ambient }
includes before each shader following code. contains uniform , helper functions.
#version 400 compatibility // defines #define hftexcoordid 0 // environment uniform ivec2 screensize = ivec2(800,600); uniform vec3 cameraposition = vec3(0); // tesselation uniform float maxedgelength = 4; // height field uniform float heightfieldheight = 1; uniform float heightfieldlowering = 0.2; uniform sampler2d heightfield; uniform sampler1d heightfieldpalette; // density map uniform sampler2d densitymap; // patches uniform sampler2d[20] patches; uniform int patchescount = 0; uniform ivec2[20] patchespositions; uniform float[20] patchesheights; uniform ivec2[20] patchessizes; // show options uniform int showoriginalgrid = 0; // functions ivec2 gethfposition(vec2 hftexcoords){ return ivec2(texturesize(heightfield, 0).xy * hftexcoords); } ivec2 getpatchsize(in int patchindex){ return patchessizes[patchindex]; //return texturesize(patches[patchindex], 0).xy; } vec2 topatchcoords(in int patchindex, in vec2 hftexcoords){ ivec2 hfposition = gethfposition(hftexcoords); ivec2 patchstart = patchespositions[patchindex]; ivec2 patchpos = hfposition - patchstart; //return texturesize(patches[1], 0).xy; return vec2(patchpos / getpatchsize(patchindex)); } float getpatchheight(in int patchindex, in vec2 hftexcoords){ vec2 patchcoords = topatchcoords(patchindex, hftexcoords); // seams combination of loop // texture access results in undefined behavior. float relheight = (texture(patches[patchindex], patchcoords).r -0.5); return relheight * patchesheights[patchindex] * heightfieldheight; } float getpatchedheight(in vec2 texcoords){ float patchesheight = 0; // working //patchesheight += getpatchheight(0, texcoords); //patchesheight += getpatchheight(1, texcoords); //patchesheight += getpatchheight(2, texcoords); // works < 5 . for(int = 0; < 6 && < patchescount-1; i++){ patchesheight += getpatchheight(i, texcoords); } return patchesheight; } float getheightfieldheight(in vec2 texturecoordinates){ float height = (texture(heightfield, texturecoordinates).r -heightfieldlowering) * heightfieldheight; height += getpatchedheight(texturecoordinates); return height; } float getheightfieldheightmin(){ return (-0.2 * heightfieldheight); } float getdensity(in vec2 coords){ return texture(densitymap, coords).r; }
the problem
shaders described , pasted above working correctly long don't access patches uniform.
uniform sampler2d[20] patches;
the idea behind sampler2d[] have sort of array while each texture of array may have different size. i'm aware of fact each of constuct uses (in case) 20 texture units. limitation of fine.
the moment access patches uniform fragment shader outputs black pixels. tessellation evaluation shader working correctly, know, because can see hills in height field, arn't part of it.
i'm thankfull suggestions. regarding problem.
i know use sampler2darray, each element (texture) has have same size. need patch size flexable. cutting patches textures of fixed size , stiching them in shader, whould alternative, don't want implement organisation overhead unless have to.
infolog
visualization lib rary v2011.5.1142 [f32] jun 9 2011 - 11:36:25 - gcc compiler [release] [x32] --- environment --- vl_logfile_path <not present> vl_data_path <not present> vl_verbosity_level = normal vl_check_gl_states = yes --- global settings --- log file = log.txt data path = ../data verbosity level = normal check opengl states = yes --- glew --- glew version: 1.5.7 --- opengl info --- opengl version: 4.1.0 nvidia 260.19.21 opengl vendor: nvidia corporation opengl renderer: quadro 6000/pci/sse2 opengl profile: compatible glsl version: 4.10 nvidia via cg compiler max texture size: 16384 texture coords: 8 texture conventional units: 4 texture image units: 32 anisotropic texture filter: yes, 16x s3 texture compression: yes vertex buffer object: yes pixel buffer object: yes framebuffer object: yes max vertex attributes: 16 max varying floats: 60 max fragment uniform components: 2048 max vertex uniform components: 4096 max elements vertices: 1048576 max elements indices: 1048576 --- opengl extensions --- gl_arb_blend_func_extended gl_arb_color_buffer_float gl_arb_compatibility gl_arb_copy_buffer gl_arb_depth_buffer_float gl_arb_depth_clamp gl_arb_depth_texture gl_arb_draw_buffers gl_arb_draw_buffers_blend gl_arb_draw_indirect gl_arb_draw_elements_base_vertex gl_arb_draw_instanced gl_arb_es2_compatibility gl_arb_explicit_attrib_location gl_arb_fragment_coord_conventions gl_arb_fragment_program gl_arb_fragment_program_shadow gl_arb_fragment_shader gl_arb_framebuffer_object gl_arb_framebuffer_srgb gl_arb_geometry_shader4 gl_arb_get_program_binary gl_arb_gpu_shader5 gl_arb_gpu_shader_fp64 gl_arb_half_float_pixel gl_arb_half_float_vertex gl_arb_imaging gl_arb_instanced_arrays gl_arb_map_buffer_range gl_arb_multisample gl_arb_multitexture gl_arb_occlusion_query gl_arb_occlusion_query2 gl_arb_pixel_buffer_object gl_arb_point_parameters gl_arb_point_sprite gl_arb_provoking_vertex gl_arb_robustness gl_arb_sample_shading gl_arb_sampler_objects gl_arb_seamless_cube_map gl_arb_separate_shader_objects gl_arb_shader_bit_encoding gl_arb_shader_objects gl_arb_shader_precision gl_arb_shader_subroutine gl_arb_shading_language_100 gl_arb_shadow gl_arb_sync gl_arb_tessellation_shader gl_arb_texture_border_clamp gl_arb_texture_buffer_object gl_arb_texture_buffer_object_rgb32 gl_arb_texture_compression gl_arb_texture_compression_bptc gl_arb_texture_compression_rgtc gl_arb_texture_cube_map gl_arb_texture_cube_map_array gl_arb_texture_env_add gl_arb_texture_env_combine gl_arb_texture_env_crossbar gl_arb_texture_env_dot3 gl_arb_texture_float gl_arb_texture_gather gl_arb_texture_mirrored_repeat gl_arb_texture_multisample gl_arb_texture_non_power_of_two gl_arb_texture_query_lod gl_arb_texture_rectangle gl_arb_texture_rg gl_arb_texture_rgb10_a2ui gl_arb_texture_swizzle gl_arb_timer_query gl_arb_transform_feedback2 gl_arb_transform_feedback3 gl_arb_transpose_matrix gl_arb_uniform_buffer_object gl_arb_vertex_array_bgra gl_arb_vertex_array_object gl_arb_vertex_attrib_64bit gl_arb_vertex_buffer_object gl_arb_vertex_program gl_arb_vertex_shader gl_arb_vertex_type_2_10_10_10_rev gl_arb_viewport_array gl_arb_window_pos gl_ati_draw_buffers gl_ati_texture_float gl_ati_texture_mirror_once gl_s3_s3tc gl_ext_texture_env_add gl_ext_abgr gl_ext_bgra gl_ext_bindable_uniform gl_ext_blend_color gl_ext_blend_equation_separate gl_ext_blend_func_separate gl_ext_blend_minmax gl_ext_blend_subtract gl_ext_compiled_vertex_array gl_ext_cg_shader gl_ext_depth_bounds_test gl_ext_direct_state_access gl_ext_draw_buffers2 gl_ext_draw_instanced gl_ext_draw_range_elements gl_ext_fog_coord gl_ext_framebuffer_blit gl_ext_framebuffer_multisample gl_extx_framebuffer_mixed_formats gl_ext_framebuffer_object gl_ext_framebuffer_srgb gl_ext_geometry_shader4 gl_ext_gpu_program_parameters gl_ext_gpu_shader4 gl_ext_multi_draw_arrays gl_ext_packed_depth_stencil gl_ext_packed_float gl_ext_packed_pixels gl_ext_pixel_buffer_object gl_ext_point_parameters gl_ext_provoking_vertex gl_ext_rescale_normal gl_ext_secondary_color gl_ext_separate_shader_objects gl_ext_separate_specular_color gl_ext_shader_image_load_store gl_ext_shadow_funcs gl_ext_stencil_two_side gl_ext_stencil_wrap gl_ext_texture3d gl_ext_texture_array gl_ext_texture_buffer_object gl_ext_texture_compression_latc gl_ext_texture_compression_rgtc gl_ext_texture_compression_s3tc gl_ext_texture_cube_map gl_ext_texture_edge_clamp gl_ext_texture_env_combine gl_ext_texture_env_dot3 gl_ext_texture_filter_anisotropic gl_ext_texture_integer gl_ext_texture_lod gl_ext_texture_lod_bias gl_ext_texture_mirror_clamp gl_ext_texture_object gl_ext_texture_shared_exponent gl_ext_texture_srgb gl_ext_texture_swizzle gl_ext_timer_query gl_ext_transform_feedback2 gl_ext_vertex_array gl_ext_vertex_array_bgra gl_ext_vertex_attrib_64bit gl_ibm_rasterpos_clip gl_ibm_texture_mirrored_repeat gl_ktx_buffer_region gl_nv_blend_square gl_nv_conditional_render gl_nv_copy_depth_to_color gl_nv_copy_image gl_nv_depth_buffer_float gl_nv_depth_clamp gl_nv_explicit_multisample gl_nv_fence gl_nv_float_buffer gl_nv_fog_distance gl_nv_fragment_program gl_nv_fragment_program_option gl_nv_fragment_program2 gl_nv_framebuffer_multisample_coverage gl_nv_geometry_shader4 gl_nv_gpu_program4 gl_nv_gpu_program4_1 gl_nv_gpu_program5 gl_nv_gpu_program_fp64 gl_nv_gpu_shader5 gl_nv_half_float gl_nv_light_max_exponent gl_nv_multisample_coverage gl_nv_multisample_filter_hint gl_nv_occlusion_query gl_nv_packed_depth_stencil gl_nv_parameter_buffer_object gl_nv_parameter_buffer_object2 gl_nv_pixel_data_range gl_nv_point_sprite gl_nv_primitive_restart gl_nv_register_combiners gl_nv_register_combiners2 gl_nv_shader_buffer_load gl_nv_texgen_reflection gl_nv_texture_barrier gl_nv_texture_compression_vtc gl_nv_texture_env_combine4 gl_nv_texture_expand_normal gl_nv_texture_multisample gl_nv_texture_rectangle gl_nv_texture_shader gl_nv_texture_shader2 gl_nv_texture_shader3 gl_nv_transform_feedback gl_nv_transform_feedback2 gl_nv_vdpau_interop gl_nv_vertex_array_range gl_nv_vertex_array_range2 gl_nv_vertex_attrib_integer_64bit gl_nv_vertex_buffer_unified_memory gl_nv_vertex_program gl_nv_vertex_program1_1 gl_nv_vertex_program2 gl_nv_vertex_program2_option gl_nv_vertex_program3 gl_nv_video_capture gl_nvx_conditional_render gl_nvx_gpu_memory_info gl_sgis_generate_mipmap gl_sgis_texture_lod gl_sgix_depth_texture gl_sgix_shadow gl_sun_slice_accum --- glew --- glew version: 1.5.7 --- opengl info --- opengl version: 4.1.0 nvidia 260.19.21 opengl vendor: nvidia corporation opengl renderer: quadro 6000/pci/sse2 opengl profile: compatible glsl version: 4.10 nvidia via cg compiler max texture size: 16384 texture coords: 8 texture conventional units: 4 texture image units: 32 anisotropic texture filter: yes, 16x s3 texture compression: yes vertex buffer object: yes pixel buffer object: yes framebuffer object: yes max vertex attributes: 16 max varying floats: 60 max fragment uniform components: 2048 max vertex uniform components: 4096 max elements vertices: 1048576 max elements indices: 1048576 --- opengl extensions --- gl_arb_blend_func_extended gl_arb_color_buffer_float gl_arb_compatibility gl_arb_copy_buffer gl_arb_depth_buffer_float gl_arb_depth_clamp gl_arb_depth_texture gl_arb_draw_buffers gl_arb_draw_buffers_blend gl_arb_draw_indirect gl_arb_draw_elements_base_vertex gl_arb_draw_instanced gl_arb_es2_compatibility gl_arb_explicit_attrib_location gl_arb_fragment_coord_conventions gl_arb_fragment_program gl_arb_fragment_program_shadow gl_arb_fragment_shader gl_arb_framebuffer_object gl_arb_framebuffer_srgb gl_arb_geometry_shader4 gl_arb_get_program_binary gl_arb_gpu_shader5 gl_arb_gpu_shader_fp64 gl_arb_half_float_pixel gl_arb_half_float_vertex gl_arb_imaging gl_arb_instanced_arrays gl_arb_map_buffer_range gl_arb_multisample gl_arb_multitexture gl_arb_occlusion_query gl_arb_occlusion_query2 gl_arb_pixel_buffer_object gl_arb_point_parameters gl_arb_point_sprite gl_arb_provoking_vertex gl_arb_robustness gl_arb_sample_shading gl_arb_sampler_objects gl_arb_seamless_cube_map gl_arb_separate_shader_objects gl_arb_shader_bit_encoding gl_arb_shader_objects gl_arb_shader_precision gl_arb_shader_subroutine gl_arb_shading_language_100 gl_arb_shadow gl_arb_sync gl_arb_tessellation_shader gl_arb_texture_border_clamp gl_arb_texture_buffer_object gl_arb_texture_buffer_object_rgb32 gl_arb_texture_compression gl_arb_texture_compression_bptc gl_arb_texture_compression_rgtc gl_arb_texture_cube_map gl_arb_texture_cube_map_array gl_arb_texture_env_add gl_arb_texture_env_combine gl_arb_texture_env_crossbar gl_arb_texture_env_dot3 gl_arb_texture_float gl_arb_texture_gather gl_arb_texture_mirrored_repeat gl_arb_texture_multisample gl_arb_texture_non_power_of_two gl_arb_texture_query_lod gl_arb_texture_rectangle gl_arb_texture_rg gl_arb_texture_rgb10_a2ui gl_arb_texture_swizzle gl_arb_timer_query gl_arb_transform_feedback2 gl_arb_transform_feedback3 gl_arb_transpose_matrix gl_arb_uniform_buffer_object gl_arb_vertex_array_bgra gl_arb_vertex_array_object gl_arb_vertex_attrib_64bit gl_arb_vertex_buffer_object gl_arb_vertex_program gl_arb_vertex_shader gl_arb_vertex_type_2_10_10_10_rev gl_arb_viewport_array gl_arb_window_pos gl_ati_draw_buffers gl_ati_texture_float gl_ati_texture_mirror_once gl_s3_s3tc gl_ext_texture_env_add gl_ext_abgr gl_ext_bgra gl_ext_bindable_uniform gl_ext_blend_color gl_ext_blend_equation_separate gl_ext_blend_func_separate gl_ext_blend_minmax gl_ext_blend_subtract gl_ext_compiled_vertex_array gl_ext_cg_shader gl_ext_depth_bounds_test gl_ext_direct_state_access gl_ext_draw_buffers2 gl_ext_draw_instanced gl_ext_draw_range_elements gl_ext_fog_coord gl_ext_framebuffer_blit gl_ext_framebuffer_multisample gl_extx_framebuffer_mixed_formats gl_ext_framebuffer_object gl_ext_framebuffer_srgb gl_ext_geometry_shader4 gl_ext_gpu_program_parameters gl_ext_gpu_shader4 gl_ext_multi_draw_arrays gl_ext_packed_depth_stencil gl_ext_packed_float gl_ext_packed_pixels gl_ext_pixel_buffer_object gl_ext_point_parameters gl_ext_provoking_vertex gl_ext_rescale_normal gl_ext_secondary_color gl_ext_separate_shader_objects gl_ext_separate_specular_color gl_ext_shader_image_load_store gl_ext_shadow_funcs gl_ext_stencil_two_side gl_ext_stencil_wrap gl_ext_texture3d gl_ext_texture_array gl_ext_texture_buffer_object gl_ext_texture_compression_latc gl_ext_texture_compression_rgtc gl_ext_texture_compression_s3tc gl_ext_texture_cube_map gl_ext_texture_edge_clamp gl_ext_texture_env_combine gl_ext_texture_env_dot3 gl_ext_texture_filter_anisotropic gl_ext_texture_integer gl_ext_texture_lod gl_ext_texture_lod_bias gl_ext_texture_mirror_clamp gl_ext_texture_object gl_ext_texture_shared_exponent gl_ext_texture_srgb gl_ext_texture_swizzle gl_ext_timer_query gl_ext_transform_feedback2 gl_ext_vertex_array gl_ext_vertex_array_bgra gl_ext_vertex_attrib_64bit gl_ibm_rasterpos_clip gl_ibm_texture_mirrored_repeat gl_ktx_buffer_region gl_nv_blend_square gl_nv_conditional_render gl_nv_copy_depth_to_color gl_nv_copy_image gl_nv_depth_buffer_float gl_nv_depth_clamp gl_nv_explicit_multisample gl_nv_fence gl_nv_float_buffer gl_nv_fog_distance gl_nv_fragment_program gl_nv_fragment_program_option gl_nv_fragment_program2 gl_nv_framebuffer_multisample_coverage gl_nv_geometry_shader4 gl_nv_gpu_program4 gl_nv_gpu_program4_1 gl_nv_gpu_program5 gl_nv_gpu_program_fp64 gl_nv_gpu_shader5 gl_nv_half_float gl_nv_light_max_exponent gl_nv_multisample_coverage gl_nv_multisample_filter_hint gl_nv_occlusion_query gl_nv_packed_depth_stencil gl_nv_parameter_buffer_object gl_nv_parameter_buffer_object2 gl_nv_pixel_data_range gl_nv_point_sprite gl_nv_primitive_restart gl_nv_register_combiners gl_nv_register_combiners2 gl_nv_shader_buffer_load gl_nv_texgen_reflection gl_nv_texture_barrier gl_nv_texture_compression_vtc gl_nv_texture_env_combine4 gl_nv_texture_expand_normal gl_nv_texture_multisample gl_nv_texture_rectangle gl_nv_texture_shader gl_nv_texture_shader2 gl_nv_texture_shader3 gl_nv_transform_feedback gl_nv_transform_feedback2 gl_nv_vdpau_interop gl_nv_vertex_array_range gl_nv_vertex_array_range2 gl_nv_vertex_attrib_integer_64bit gl_nv_vertex_buffer_unified_memory gl_nv_vertex_program gl_nv_vertex_program1_1 gl_nv_vertex_program2 gl_nv_vertex_program2_option gl_nv_vertex_program3 gl_nv_video_capture gl_nvx_conditional_render gl_nvx_gpu_memory_info gl_sgis_generate_mipmap gl_sgis_texture_lod gl_sgix_depth_texture gl_sgix_shadow gl_sun_slice_accum patchescontainer::patchescontainer: working dir: ./data/patches/pick_height_testing_png/ patchescontainer::loadpatchesfromworkingdir ignoring file = data/patches/pick_height_testing_png/.svn patch::initialize(): name = data/patches/pick_height_testing_png/patch01-position=20x20-maxheight=1.0.png width = 50 height = 50 depth = 0 format = if_luminance type = it_unsigned_byte pitch = 50 bytealign = 1 patch::initialize(): name = data/patches/pick_height_testing_png/patch02-position=20x2-maxheight=1.5.png width = 20 height = 20 depth = 0 format = if_luminance type = it_unsigned_byte pitch = 20 bytealign = 1 found matching densitymap ./data/density_maps/pick_height_testing_png.png loading height field image name = ./data/horizons/pick_height_testing.png width = 200 height = 200 depth = 0 format = if_luminance type = it_unsigned_byte pitch = 200 bytealign = 1 name = ./data/textures/tesselation_palette_blue_red.png width = 300 height = 0 depth = 0 format = if_rgb type = it_unsigned_byte pitch = 900 bytealign = 1 gl_max_tess_evaluation_texture_image_units: 32
well, can see 1 problem:
uniform sampler2d[20] patches;
i'm going go out on limb , guess opengl 4.0-class hardware incapable of using more 16 textures within single shader stage. if want verify this, check gl_max_tess_evaluation_texture_image_units
; i'd bet it's 16.
also, rules accessing sampler arrays strict (and i'm betting you're breaking them). indices sampler arrays must, in glsl 4.00, either:
1: compile-time constant expressions
2: expressions resolve uniform values. not uniform
in keyword, expressions based on compile-time constants or uniform values. cannot based on values retrieved textures, shader-stage inputs, or of kind.
this legal:
for(int = 0; < someuniform; i++) { texture(patches[i], texcoord); }
this not legal:
texture(patches[positionofsomevertex * uniformscalefactor], texcoord);
there's reason why people use array textures instead of sampler arrays.
adendum: perhaps quote glsl version 4.10 specification help:
a fragment-shader expression dynamically uniform if fragments evaluating same resulting value. when loops involved, refers expression's value same loop iteration. when functions involved, refers calls same call point.
this defined other shader stages, based on per-instance data process.
note constant expressions trivially dynamically uniform. follows typical loop counters based on these dynamically uniform.
your expression involves conditional branch based on not dynamically uniform. therefore, index used not dynamically uniform.
the basic idea "dynamically uniform" this: given same uniform
values, should able pass anything shader stage inputs , same texture accessed array. code not guarantee this.
Comments
Post a Comment