Share
Embed
バイラテラルアップサンプリング
高解像度なディスプレイに対して効率よくリアルタイムレンダリングを行う為の工夫を紹介します
これは2025年5月11日に行われた Kernel/VM探検隊@関西 11回目 での発表動資料です
発表動画 : https://www.youtube.com/watch?v=tGUp17w6Bbs
ソースコード : https://github.com/Fadis/gct/tree/kernelvm_20250511
Fadis
May 09, 2025
Transcript
97 slides
-
୯Ґͷॲཧ ϥελϥΠζ ϐΫηϧͷ৭ΛܾΊΔͷʹ ඞཁͳใΛ Πϝʔδʹॻ͘ Graphics Pipeline Compute Pipeline ΠϝʔδΛಡΜͰ
ϐΫηϧͷ৭ΛܾΊΔ ԆϨϯμϦϯά GόοϑΝ -
୯Ґͷॲཧ ϥελϥΠζ ϐΫηϧͷ৭ΛܾΊΔͷʹ ඞཁͳใΛ Πϝʔδʹॻ͘ Graphics Pipeline Compute Pipeline ΠϝʔδΛಡΜͰ
ϐΫηϧͷ৭ΛܾΊΔ ԆϨϯμϦϯά ར ྡ͢ΔϐΫηϧͷใΛಡΊΔ GόοϑΝ ಉظ -
୯Ґͷॲཧ ϥελϥΠζ ϐΫηϧͷ৭ΛܾΊΔͷʹ ඞཁͳใΛ Πϝʔδʹॻ͘ Graphics Pipeline Compute Pipeline ΠϝʔδΛಡΜͰ
ϐΫηϧͷ৭ΛܾΊΔ ԆϨϯμϦϯά ར ྡ͢ΔϐΫηϧͷใΛಡΊΔ ෳࡶͳϐΫηϧॲཧΛෳͷγΣʔμʹ͚ΒΕΔ GόοϑΝ ಉظ -
୯Ґͷॲཧ ϥελϥΠζ ϐΫηϧͷ৭ΛܾΊΔͷʹ ඞཁͳใΛ Πϝʔδʹॻ͘ Graphics Pipeline Compute Pipeline ΠϝʔδΛಡΜͰ
ϐΫηϧͷ৭ΛܾΊΔ ԆϨϯμϦϯά ར ྡ͢ΔϐΫηϧͷใΛಡΊΔ ෳࡶͳϐΫηϧॲཧΛෳͷγΣʔμʹ͚ΒΕΔ Compute Pipelineઐ༻ͷػೳ͕͑Δ GόοϑΝ -
γϟυϚοϓͷੜ Graphics Pipeline GόοϑΝͷੜ Graphics Pipeline ޫ Compute Pipeline τʔϯϚοϐϯά
Compute Pipeline ΨϯϚ Compute Pipeline ϒϧʔϜ Compute Pipeline -
froxelαϯϓϦϯά Compute Pipeline γϟυϚοϓͷੜ Graphics Pipeline GόοϑΝͷੜ Graphics Pipeline ޫ
Compute Pipeline τʔϯϚοϐϯά Compute Pipeline ΨϯϚ Compute Pipeline ΦΫϧʔδϣϯΧϦϯά Graphics Pipeline ϨϯζϑϨΞ Compute Pipeline ΞϯϏΤϯτΦΫϧʔδϣϯ Compute Pipeline froxelͷੜ Compute Pipeline CoCͷੜ Compute Pipeline ΦʔτϑΥʔΧε Compute Pipeline ϏωοςΟϯά Compute Pipeline ඃࣸքਂޮՌ Compute Pipeline ϒϧʔϜ Compute Pipeline ৭ۭؒͷม Compute Pipeline ಁ໌ͷղܾ Compute Pipeline ۭͷੜ Compute Pipeline -
froxelαϯϓϦϯά Compute Pipeline γϟυϚοϓͷੜ Graphics Pipeline GόοϑΝͷੜ Graphics Pipeline ޫ
Compute Pipeline τʔϯϚοϐϯά Compute Pipeline ΨϯϚ Compute Pipeline ΦΫϧʔδϣϯΧϦϯά Graphics Pipeline ϨϯζϑϨΞ Compute Pipeline ΞϯϏΤϯτΦΫϧʔδϣϯ Compute Pipeline froxelͷੜ Compute Pipeline CoCͷੜ Compute Pipeline ΦʔτϑΥʔΧε Compute Pipeline ϏωοςΟϯά Compute Pipeline ඃࣸքਂޮՌ Compute Pipeline ϒϧʔϜ Compute Pipeline ৭ۭؒͷม Compute Pipeline ಁ໌ͷղܾ Compute Pipeline ۭͷੜ Compute Pipeline 1ϑϨʔϜຖʹܭࢉ͢Δඞཁ͕͋Γ ܭࢉίετ͕ϐΫηϧʹൺྫ͢Δॲཧ -
C. Tomasi and R. Manduchi, “Bilateral fi ltering for gray
and color images,” in Sixth International Conference on Computer Vision, Jan 1998, pp. 839–846. https://ieeexplore.ieee.org/document/710815 όΠϥςϥϧ ϑΟϧλ -
C. Tomasi and R. Manduchi, “Bilateral fi ltering for gray
and color images,” in Sixth International Conference on Computer Vision, Jan 1998, pp. 839–846. https://ieeexplore.ieee.org/document/710815 όΠϥςϥϧ ϑΟϧλ ৭ͷมԽͷܹ͠͞Ͱ ϑΟϧλͷॏΈΛม͑Δ Τοδ͚ͩͯ͠ ϊΠζΛআڈ͢Δ ը૾ॲཧख๏ -
όΠϥςϥϧ ΞοϓαϯϓϦϯά ղ૾ͷ ը૾ ߴղ૾ͷ Τοδใ ΤοδҎ֎ઢܗิؒ ߴղ૾ͷ ը૾ ΤοδͰۙͷϐΫηϧͷ͏ͪ
͕͍݅ۙϐΫηϧͷ৭Λ࠾༻ ߴղ૾ͷΤοδใΛ Ͳ͏ͬͯ༻ҙ͢Δ͔ -
froxelαϯϓϦϯά Compute Pipeline γϟυϚοϓͷੜ Graphics Pipeline GόοϑΝͷੜ Graphics Pipeline ޫ
Compute Pipeline τʔϯϚοϐϯά Compute Pipeline ΨϯϚ Compute Pipeline ΦΫϧʔδϣϯΧϦϯά Graphics Pipeline ϨϯζϑϨΞ Compute Pipeline ΞϯϏΤϯτΦΫϧʔδϣϯ Compute Pipeline froxelͷੜ Compute Pipeline CoCͷੜ Compute Pipeline ΦʔτϑΥʔΧε Compute Pipeline ϏωοςΟϯά Compute Pipeline ඃࣸքਂޮՌ Compute Pipeline ϒϧʔϜ Compute Pipeline ৭ۭؒͷม Compute Pipeline ಁ໌ͷղܾ Compute Pipeline ۭͷੜ Compute Pipeline bilateral offsetͷੜ Compute Pipeline όΠϥςϥϧΞοϓαϯϓϦϯά Compute Pipeline GόοϑΝΛ2160pͰ࡞Δ GόοϑΝ͔ΒΤοδΛಘΔ 1080pͰϨϯμϦϯά͢Δ -
ਂ Ξϧϕυ ΞϧϑΝ ๏ઢ ൃޫ ःṭ ϝλϦοΫ ϥϑωε ΠϯελϯεID ϓϦϛςΟϒID
ΦϓςΟΧϧϑϩʔ 0 16 32 48 64bit GόοϑΝͷத -
ਂ Ξϧϕυ ΞϧϑΝ ๏ઢ ൃޫ ःṭ ϝλϦοΫ ϥϑωε ΠϯελϯεID ϓϦϛςΟϒID
ΦϓςΟΧϧϑϩʔ 0 16 32 48 64bit ਂ Ξϧϕυ ΞϧϑΝ ๏ઢ ൃޫ ःṭ ϝλϦοΫ ϥϑωε ΠϯελϯεID ϓϦϛςΟϒID ΦϓςΟΧϧϑϩʔ ਂ Ξϧϕυ ΞϧϑΝ ๏ઢ ൃޫ ःṭ ϝλϦοΫ ϥϑωε ΠϯελϯεID ϓϦϛςΟϒID ΦϓςΟΧϧϑϩʔ ਂ Ξϧϕυ ΞϧϑΝ ๏ઢ ൃޫ ःṭ ϝλϦοΫ ϥϑωε ΠϯελϯεID ϓϦϛςΟϒID ΦϓςΟΧϧϑϩʔ ϨΠϠʔͷॱং ϨΠϠʔ0 ϨΠϠʔ1 ϨΠϠʔ2 ϨΠϠʔ3 -
fid (x, y) = { 1 xpid = ypid ∧
xiid = yiid 0 xpid ≠ ypid ∨ xiid ≠ yiid fdepth (x, y) = min(1.3 − |xdepth , ydepth |,1) fnormal (x, y) = min(1.3max(xnormal ⋅ ynormal ,0),1) f(x, y) = fid (x, y)fdepth (x, y)fnormal (x, y) -
A B P C D Pͷ৭ΛܾΊ͍ͨͱ͖ ɺ ɺ ɺ ɺ
ΛٻΊ ࠷େ͖ͳΛฦͨ͠ϐΫηϧͷ৭ΛPͷ৭ͱ͢Δ f(A, P) f(B, P) f(C, P) f(D, P) f(E, P) fid (x, y) = { 1 xpid = ypid ∧ xiid = yiid 0 xpid ≠ ypid ∨ xiid ≠ yiid fdepth (x, y) = min(1.3 − |xdepth , ydepth |,1) fnormal (x, y) = min(1.3max(xnormal ⋅ ynormal ,0),1) f(x, y) = fid (x, y)fdepth (x, y)fnormal (x, y) -
A B P C D Pͷ৭ΛܾΊ͍ͨͱ͖ E = A +
B + C + D 4 ɺ ɺ ɺ ɺ ΛٻΊ ࠷େ͖ͳΛฦͨ͠ϐΫηϧͷ৭ΛPͷ৭ͱ͢Δ f(A, P) f(B, P) f(C, P) f(D, P) f(E, P) ͕࠷େͩͬͨ߹ઢܗิؒ͢Δ f(E, P) fid (x, y) = { 1 xpid = ypid ∧ xiid = yiid 0 xpid ≠ ypid ∨ xiid ≠ yiid fdepth (x, y) = min(1.3 − |xdepth , ydepth |,1) fnormal (x, y) = min(1.3max(xnormal ⋅ ynormal ,0),1) f(x, y) = fid (x, y)fdepth (x, y)fnormal (x, y) -
A B P C D 35 36 11 12 ϐΫηϧPͷ৭
ϐΫηϧCͷ৭ʹ͖͢ͱஅ͞Εͨ߹ Pͷ৭ઢܗิؒͳΒ ͔Β αϯϓϦϯά͖͢ॴΛ όΠϥςϥϧΞοϓαϯϓϦϯάͰ ͔ΒαϯϓϦϯά͢Δ (35.5,11.5) (35.0,12.0) -
A B P C D 35 36 11 12 (−0.5,0.5)
ϐΫηϧPͷ৭ ϐΫηϧCͷ৭ʹ͖͢ͱஅ͞Εͨ߹ Pͷ৭ઢܗิؒͳΒ ͔Β αϯϓϦϯά͖͢ॴΛ όΠϥςϥϧΞοϓαϯϓϦϯάͰ ͔ΒαϯϓϦϯά͢Δ (35.5,11.5) (35.0,12.0) ͜ͷࠩ ͕ όΠϥςϥϧΦϑηοτ (−0.5,0.5) όΠϥςϥϧΦϑηοτΛٻΊͯΠϝʔδʹه͓͚ͯ͠ ΤοδΛอޢͯ͠ิ͕ؒͰ͖Δ -
A B C D ͜ͷϐΫηϧ ɺ ɺ ͷ͍ͣΕ͔ʹͳΔ A B
A + B 2 2bit ͜ͷϐΫηϧৗʹA -
A B C D ͜ͷϐΫηϧ ɺ ɺ ͷ͍ͣΕ͔ʹͳΔ A B
A + B 2 ͜ͷϐΫηϧ ɺ ɺ ɺ ɺ ͷ͍ͣΕ͔ʹͳΔ A B C D A + B + C + D 4 2bit 3bit ͜ͷϐΫηϧৗʹA -
A B C D ͜ͷϐΫηϧ ɺ ɺ ͷ͍ͣΕ͔ʹͳΔ A B
A + B 2 ͜ͷϐΫηϧ ɺ ɺ ͷ͍ͣΕ͔ʹͳΔ A C A + C 2 ͜ͷϐΫηϧ ɺ ɺ ɺ ɺ ͷ͍ͣΕ͔ʹͳΔ A B C D A + B + C + D 4 2bit 3bit 2bit ͜ͷϐΫηϧৗʹA -
A B C D ͜ͷϐΫηϧ ɺ ɺ ͷ͍ͣΕ͔ʹͳΔ A B
A + B 2 ͜ͷϐΫηϧ ɺ ɺ ͷ͍ͣΕ͔ʹͳΔ A C A + C 2 ͜ͷϐΫηϧ ɺ ɺ ɺ ɺ ͷ͍ͣΕ͔ʹͳΔ A B C D A + B + C + D 4 2bit 3bit 2bit ͜ͷϐΫηϧৗʹA 7bit͋Ε ϐΫηϧͷ όΠϥςϥϧΦϑηοτΛهͰ͖Δ 2 × 2 -
const auto bilateral_weight_desc = builder.call( builder.get_image_io_create_info( std::make_shared< gct::compute >( gct::compute_create_info()
.set_allocator_set( res.allocator_set ) .set_shader( CMAKE_CURRENT_BINARY_DIR "/bilateral_weight/bilateral_weight.comp.spv" ) .set_scene_graph( sg->get_resource() ) .add_resource( { "global_uniforms", global_uniform } ) ), gct::image_io_plan() .add_input( "src" ) .add_input( "depth" ) .add_output( "dest", "src", { 0.5f, -1.f }, vk::Format::eR8Uint ) .set_dim( "src", { 0.5f, -1.f } ) .set_node_name( "bilateral_weight" ) ) )( gct::shader_graph::vertex::combined_result_type() .add( "src", extended_gbuffer_desc.linear ) .add( "depth", extended_depth_desc.linear ) ); const auto lighting_desc = builder.call( builder.get_image_io_create_info( std::make_shared< gct::compute >( gct::compute_create_info() .set_allocator_set( res.allocator_set ) .set_shader( CMAKE_CURRENT_BINARY_DIR "/lighting/lighting.comp.spv" ) bilateral offsetͷܭࢉΛ ೖྗΠϝʔδ(GόοϑΝ)ͷͷղ૾Ͱߦ͏ ग़ྗΠϝʔδೖྗͷͷղ૾Ͱ ϑΥʔϚοτ8bitූ߸ͳ͠ -
const auto lighting_desc = builder.call( builder.get_image_io_create_info( std::make_shared< gct::compute >( gct::compute_create_info()
.set_allocator_set( res.allocator_set ) .set_shader( CMAKE_CURRENT_BINARY_DIR "/lighting/lighting.comp.spv" ) .set_scene_graph( sg->get_resource() ) .add_resource( { "global_uniforms", global_uniform } ) ), gct::image_io_plan() .add_input( "src" ) .add_input( "depth" ) .add_output( "dest", "src", { 0.5f, -4.f }, vk::Format::eR16G16B16A16Sfloat ) .set_dim( "src", { 0.5f, -4.f } ) .set_node_name( "lighting" ) ) .set_push_constant( "unproject", *unproject_to_world_desc ) )( gct::shader_graph::vertex::combined_result_type() .add( "src", extended_gbuffer_desc.linear ) .add( "depth", extended_depth_desc.linear ) ); ޫͷܭࢉΛ ೖྗΠϝʔδ(GόοϑΝ)ͷͷղ૾Ͱߦ͏ ग़ྗΠϝʔδೖྗͷͷղ૾Ͱ ϑΥʔϚοτਫ਼ුಈখ4ݸͷϕΫλ -
const float depth_similarity_01 = min( 1.3 - abs( normal_depth[ pos0
].w - normal_depth[ pos1 ].w ), 1.0 ); const float depth_similarity_a1 = min( 1.3 - abs( ( normal_depth[ pos0 ].w + normal_depth[ pos2 ].w ) * 0.5 - normal_depth[ pos1 ].w ), 1.0 ); const float depth_similarity_12 = min( 1.3 - abs( normal_depth[ pos1 ].w - normal_depth[ pos2 ].w ), 1.0 ); const float depth_similarity_b1 = min( 1.3 - abs( ( normal_depth[ pos3 ].w + normal_depth[ pos4 ].w ) * 0.5 - normal_depth[ pos1 ].w ), 1.0 ); const float depth_similarity_13 = min( 1.3 - abs( normal_depth[ pos1 ].w - normal_depth[ pos3 ].w ), 1.0 ); const float depth_similarity_14 = min( 1.3 - abs( normal_depth[ pos1 ].w - normal_depth[ pos4 ].w ), 1.0 ); const float normal_similarity_01 = min( 1.3 * max( dot( normal_depth[ pos0 ].xyz, normal_depth[ pos1 ].xyz ), 0.0 ),1.0 ); const float normal_similarity_a1 = min( 1.3 * max( dot( normalize( normal_depth[ pos0 ].xyz + normal_depth[ pos2 ].xyz ), normal_depth[ pos1 ].xyz ), 0.0 ), 1.0 ); const float normal_similarity_12 = min( 1.3 * max( dot( normal_depth[ pos1 ].xyz, normal_depth[ pos2 ].xyz ), 0.0 ), 1.0 ); const float normal_similarity_b1 = min( 1.3 * max( dot( normalize( normal_depth[ pos3 ].xyz + normal_depth[ pos4 ].xyz ), normal_depth[ pos1 ].xyz ), 0.0 ), 1.0 ); const float normal_similarity_13 = min( 1.3 * max( dot( normal_depth[ pos1 ].xyz, normal_depth[ pos3 ].xyz ), 0.0 ), 1.0 ); const float normal_similarity_14 = min( 1.3 * max( dot( normal_depth[ pos1 ].xyz, normal_depth[ pos4 ].xyz ), 0.0 ), 1.0 ); const float similarity_01 = instance_similarity_01 * depth_similarity_01 * normal_similarity_01; const float similarity_a1 = instance_similarity_02 * instance_similarity_01 * depth_similarity_a1 * normal_similarity_a1; const float similarity_12 = instance_similarity_12 * depth_similarity_12 * normal_similarity_12; const float similarity_b1 = instance_similarity_34 * instance_similarity_13 * depth_similarity_b1 * normal_similarity_b1; const float similarity_13 = instance_similarity_13 * depth_similarity_13 * normal_similarity_13; const float similarity_14 = instance_similarity_14 * depth_similarity_14 * normal_similarity_14; const float similarity_center = max( similarity_a1, similarity_b1 ); float highest = similarity_center; xy = 4; xy = ( highest < similarity_01 ) ? 0 : xy; highest = max( highest, similarity_01 ); xy = ( highest < similarity_12 ) ? 3 : xy; highest = max( highest, similarity_12 ); xy = ( highest < similarity_13 ) ? 1 : xy; highest = max( highest, similarity_13 ); xy = ( highest < similarity_14 ) ? 2 : xy; highest = max( highest, similarity_14 ); ίϯϐϡʔτγΣʔμͰ όΠϥςϥϧΦϑηοτΛٻΊΔ -
if( src_offset.x != 0 && src_offset.y == 0 ) {
linear = mix( p0, p1, ( ( ( bw >> 5 ) & 0x3 ) == 0 ) ? 0.0 : ( ( ( ( bw >> 5 ) & 0x3 ) == 1 ) ? 1.0 : 0.5 ) ); } else if( src_offset.x == 0 && src_offset.y != 0 ) { linear = mix( p0, p2, ( ( ( bw >> 3 ) & 0x3 ) == 0 ) ? 0.0 : ( ( ( ( bw >> 3 ) & 0x3 ) == 1 ) ? 1.0 : 0.5 ) ); } else if( src_offset.x != 0 && src_offset.y != 0 ) { if( ( bw & 0x7 ) == 0 ) linear = p0; else if( ( bw & 0x7 ) == 1 ) linear = p1; else if( ( bw & 0x7 ) == 2 ) linear = p2; else if( ( bw & 0x7 ) == 3 ) linear = p3; else linear = ( p0 + p1 + p2 + p3 ) * 0.25; } else { linear = p0; } όΠϥςϥϧΦϑηοτʹج͍ͮͯ ิؒํ๏Λมߋ͢Δ -
froxelαϯϓϦϯά Compute Pipeline γϟυϚοϓͷੜ Graphics Pipeline GόοϑΝͷੜ Graphics Pipeline ޫ
Compute Pipeline τʔϯϚοϐϯά Compute Pipeline ΨϯϚ Compute Pipeline ΦΫϧʔδϣϯΧϦϯά Graphics Pipeline ϨϯζϑϨΞ Compute Pipeline ΞϯϏΤϯτΦΫϧʔδϣϯ Compute Pipeline froxelͷੜ Compute Pipeline CoCͷੜ Compute Pipeline ΦʔτϑΥʔΧε Compute Pipeline ϏωοςΟϯά Compute Pipeline ඃࣸքਂޮՌ Compute Pipeline ϒϧʔϜ Compute Pipeline ৭ۭؒͷม Compute Pipeline ಁ໌ͷղܾ Compute Pipeline ۭͷੜ Compute Pipeline bilateral offsetͷੜ Compute Pipeline όΠϥςϥϧΞοϓαϯϓϦϯά Compute Pipeline ͜ͷ෦ ઢܗิؒͱಉ͡ͳͷͰ ݪҼͰͳ͍ -
froxelαϯϓϦϯά Compute Pipeline γϟυϚοϓͷੜ Graphics Pipeline GόοϑΝͷੜ Graphics Pipeline ޫ
Compute Pipeline τʔϯϚοϐϯά Compute Pipeline ΨϯϚ Compute Pipeline ΦΫϧʔδϣϯΧϦϯά Graphics Pipeline ϨϯζϑϨΞ Compute Pipeline ΞϯϏΤϯτΦΫϧʔδϣϯ Compute Pipeline froxelͷੜ Compute Pipeline CoCͷੜ Compute Pipeline ΦʔτϑΥʔΧε Compute Pipeline ϏωοςΟϯά Compute Pipeline ඃࣸքਂޮՌ Compute Pipeline ϒϧʔϜ Compute Pipeline ৭ۭؒͷม Compute Pipeline ಁ໌ͷղܾ Compute Pipeline ۭͷੜ Compute Pipeline bilateral offsetͷੜ Compute Pipeline όΠϥςϥϧΞοϓαϯϓϦϯά Compute Pipeline ͜ͷ෦ ઢܗิؒͱಉ͡ͳͷͰ ݪҼͰͳ͍ ΞοϓαϯϓϦϯάΛઢܗิؒʹͨ͠ΒͲ͏ͳΔ͔ -
froxelαϯϓϦϯά Compute Pipeline γϟυϚοϓͷੜ Graphics Pipeline GόοϑΝͷੜ Graphics Pipeline ޫ
Compute Pipeline τʔϯϚοϐϯά Compute Pipeline ΨϯϚ Compute Pipeline ΦΫϧʔδϣϯΧϦϯά Graphics Pipeline ϨϯζϑϨΞ Compute Pipeline ΞϯϏΤϯτΦΫϧʔδϣϯ Compute Pipeline froxelͷੜ Compute Pipeline CoCͷੜ Compute Pipeline ΦʔτϑΥʔΧε Compute Pipeline ϏωοςΟϯά Compute Pipeline ඃࣸքਂޮՌ Compute Pipeline ϒϧʔϜ Compute Pipeline ৭ۭؒͷม Compute Pipeline ಁ໌ͷղܾ Compute Pipeline ۭͷੜ Compute Pipeline bilateral offsetͷੜ Compute Pipeline όΠϥςϥϧΞοϓαϯϓϦϯά Compute Pipeline ͜ͷ෦ ઢܗิؒͱಉ͡ͳͷͰ ݪҼͰͳ͍ ΦϑηοτͷੜΛΊͨΒͲ͏ͳΔ͔ -
froxelαϯϓϦϯά Compute Pipeline γϟυϚοϓͷੜ Graphics Pipeline GόοϑΝͷੜ Graphics Pipeline ޫ
Compute Pipeline τʔϯϚοϐϯά Compute Pipeline ΨϯϚ Compute Pipeline ΦΫϧʔδϣϯΧϦϯά Graphics Pipeline ϨϯζϑϨΞ Compute Pipeline ΞϯϏΤϯτΦΫϧʔδϣϯ Compute Pipeline froxelͷੜ Compute Pipeline CoCͷੜ Compute Pipeline ΦʔτϑΥʔΧε Compute Pipeline ϏωοςΟϯά Compute Pipeline ඃࣸքਂޮՌ Compute Pipeline ϒϧʔϜ Compute Pipeline ৭ۭؒͷม Compute Pipeline ಁ໌ͷղܾ Compute Pipeline ۭͷੜ Compute Pipeline bilateral offsetͷੜ Compute Pipeline όΠϥςϥϧΞοϓαϯϓϦϯά Compute Pipeline ͜ͷ෦ ઢܗิؒͱಉ͡ͳͷͰ ݪҼͰͳ͍ ͔ͯ͠͠ݪҼ͍͔ͭ͜? -
void main() { primitive_value p = read_primitive( push_constants.primitive, input_position, input_normal,
input_tangent, input_texcoord, input_optflow, input_previous_position ); if( p.albedo.a <= 0.0 ) discard; const uint visibility_index = instance_resource_index[ push_constants.instance ].visibility; visibility_pool[ visibility_index ] = 1; const ivec2 image_pos = ivec2( gl_FragCoord.x, gl_FragCoord.y ); beginInvocationInterlockARB(); update_kplus_buffer16( global_uniforms.gbuffer, global_uniforms.depth, image_pos, p, gl_FragCoord.z, input_id.xy, vec4( 0.0, 0.0, 0.0, 0.0 ) ); endInvocationInterlockARB(); } gbufferͷੜͷϑϥάϝϯτγΣʔμ Πϝʔδʹॻ͘ ଐੑΛಡΜͰ -
void main() { primitive_value p = read_primitive( push_constants.primitive, input_position, input_normal,
input_tangent, input_texcoord, input_optflow, input_previous_position ); if( p.albedo.a <= 0.0 ) discard; const uint visibility_index = instance_resource_index[ push_constants.instance ].visibility; visibility_pool[ visibility_index ] = 1; const ivec2 image_pos = ivec2( gl_FragCoord.x, gl_FragCoord.y ); beginInvocationInterlockARB(); update_kplus_buffer16( global_uniforms.gbuffer, global_uniforms.depth, image_pos, p, gl_FragCoord.z, input_id.xy, vec4( 0.0, 0.0, 0.0, 0.0 ) ); endInvocationInterlockARB(); } gbufferͷੜͷϑϥάϝϯτγΣʔμ ଐੑΛಡΜͰ Πϝʔδʹॻ͘ ΄΅ಡΜͰॻ͚ͩ͘ = Memory Bound άϩʔόϧϝϞϦͷόε͕٧·͍ͬͯΔͷͰ -
void main() { primitive_value p = read_primitive( push_constants.primitive, input_position, input_normal,
input_tangent, input_texcoord, input_optflow, input_previous_position ); if( p.albedo.a <= 0.0 ) discard; const uint visibility_index = instance_resource_index[ push_constants.instance ].visibility; visibility_pool[ visibility_index ] = 1; const ivec2 image_pos = ivec2( gl_FragCoord.x, gl_FragCoord.y ); beginInvocationInterlockARB(); update_kplus_buffer16_reduced( global_uniforms.gbuffer, global_uniforms.depth, image_pos, p, gl_FragCoord.z, input_id.xy, vec4( 0.0, 0.0, 0.0, 0.0 ) ); endInvocationInterlockARB(); } image_posͷΛݟͯ όΠϥςϥϧΦϑηοτͷܭࢉʹΘͳ͍ 4ϐΫηϧʹ͖ͭ1͔ͭ͠ॻ͔ͳ͍Α͏ʹมߋ -
άϩʔόϧϝϞϦ όε෯ 384bit͔Β512bit GPU 1ϐΫηϧ=float16 bitͳͷͰ ϞʔτϯίʔυॱͰྡ͢ΔෳͷϐΫηϧ͕ ·ͱΊͯϝϞϦʹॻ͔ΕΕΔ × 4
= 64 όεʹͱͬͯԿͷઅʹͳ͍ͬͯͳ͍ͷͰ -
ਂ ๏ઢ ϝλϦοΫ ϥϑωε ΠϯελϯεID ϓϦϛςΟϒID ΦϓςΟΧϧϑϩʔ 0 16 32
48 64bit Ξϧϕυ ΞϧϑΝ ൃޫ ःṭ ΦϓςΟΧϧϑϩʔ 2160pͰه 1080pͰه GόοϑΝΛόΠϥςϥϧΦϑηοτͷܭࢉʹඞཁͳͱ ͦ͏Ͱͳ͍ʹׂͯ͠ ޙऀΛͷαΠζͷΠϝʔδʹີʹه͢Ε ੑೳ͕ྑ͘ͳΔ͔?