SH-680 Update streaming cost to be based on a triangle budget instead of a magic scaler.
Reviewed by Nyx.master
parent
12e08417bf
commit
38778fcc61
|
|
@ -9145,28 +9145,51 @@
|
|||
<key>Value</key>
|
||||
<real>1.0</real>
|
||||
</map>
|
||||
<key>MeshStreamingCostScaler</key>
|
||||
<key>MeshTriangleBudget</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>DEBUG</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>F32</string>
|
||||
<key>Value</key>
|
||||
<real>2.0</real>
|
||||
</map>
|
||||
<key>MeshThreadCount</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Number of threads to use for loading meshes.</string>
|
||||
<string>Target visible triangle budget to use when estimating streaming cost.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>U32</string>
|
||||
<key>Value</key>
|
||||
<integer>8</integer>
|
||||
<real>250000</real>
|
||||
</map>
|
||||
<key>MeshMetaDataDiscount</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Number of bytes to deduct for metadata when determining streaming cost.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>U32</string>
|
||||
<key>Value</key>
|
||||
<real>384</real>
|
||||
</map>
|
||||
<key>MeshMinimumByteSize</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Minimum number of bytes per LoD block when determining streaming cost.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>U32</string>
|
||||
<key>Value</key>
|
||||
<real>16</real>
|
||||
</map>
|
||||
<key>MeshBytesPerTriangle</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Approximation of bytes per triangle to use for determining mesh streaming cost.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>U32</string>
|
||||
<key>Value</key>
|
||||
<real>16</real>
|
||||
</map>
|
||||
|
||||
<key>MeshMaxConcurrentRequests</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
|
|||
|
|
@ -3185,17 +3185,46 @@ void LLMeshRepository::uploadError(LLSD& args)
|
|||
//static
|
||||
F32 LLMeshRepository::getStreamingCost(LLSD& header, F32 radius, S32* bytes, S32* bytes_visible, S32 lod)
|
||||
{
|
||||
F32 dlowest = llmin(radius/0.03f, 256.f);
|
||||
F32 dlow = llmin(radius/0.06f, 256.f);
|
||||
F32 dmid = llmin(radius/0.24f, 256.f);
|
||||
|
||||
F32 METADATA_DISCOUNT = 128.f; //discount 128 bytes to cover the cost of LLSD tags and compression domain overhead
|
||||
F32 MINIMUM_SIZE = 32.f; //make sure nothing is "free"
|
||||
F32 max_distance = 512.f;
|
||||
|
||||
F32 bytes_lowest = llmax((F32) header["lowest_lod"]["size"].asReal()-METADATA_DISCOUNT, MINIMUM_SIZE)/1024.f;
|
||||
F32 bytes_low = llmax((F32) header["low_lod"]["size"].asReal()/-METADATA_DISCOUNT, MINIMUM_SIZE)/1024.f;
|
||||
F32 bytes_mid = llmax((F32) header["medium_lod"]["size"].asReal()-METADATA_DISCOUNT, MINIMUM_SIZE)/1024.f;
|
||||
F32 bytes_high = llmax((F32) header["high_lod"]["size"].asReal()-METADATA_DISCOUNT, MINIMUM_SIZE)/1024.f;
|
||||
F32 dlowest = llmin(radius/0.03f, max_distance);
|
||||
F32 dlow = llmin(radius/0.06f, max_distance);
|
||||
F32 dmid = llmin(radius/0.24f, max_distance);
|
||||
|
||||
F32 METADATA_DISCOUNT = (F32) gSavedSettings.getU32("MeshMetaDataDiscount"); //discount 128 bytes to cover the cost of LLSD tags and compression domain overhead
|
||||
F32 MINIMUM_SIZE = (F32) gSavedSettings.getU32("MeshMinimumByteSize"); //make sure nothing is "free"
|
||||
|
||||
F32 bytes_per_triangle = (F32) gSavedSettings.getU32("MeshBytesPerTriangle");
|
||||
|
||||
S32 bytes_lowest = header["lowest_lod"]["size"].asInteger();
|
||||
S32 bytes_low = header["low_lod"]["size"].asInteger();
|
||||
S32 bytes_mid = header["medium_lod"]["size"].asInteger();
|
||||
S32 bytes_high = header["high_lod"]["size"].asInteger();
|
||||
|
||||
if (bytes_high == 0)
|
||||
{
|
||||
return 0.f;
|
||||
}
|
||||
|
||||
if (bytes_mid == 0)
|
||||
{
|
||||
bytes_mid = bytes_high;
|
||||
}
|
||||
|
||||
if (bytes_low == 0)
|
||||
{
|
||||
bytes_low = bytes_mid;
|
||||
}
|
||||
|
||||
if (bytes_lowest == 0)
|
||||
{
|
||||
bytes_lowest = bytes_low;
|
||||
}
|
||||
|
||||
F32 triangles_lowest = llmax((F32) bytes_lowest-METADATA_DISCOUNT, MINIMUM_SIZE)/bytes_per_triangle;
|
||||
F32 triangles_low = llmax((F32) bytes_low-METADATA_DISCOUNT, MINIMUM_SIZE)/bytes_per_triangle;
|
||||
F32 triangles_mid = llmax((F32) bytes_mid-METADATA_DISCOUNT, MINIMUM_SIZE)/bytes_per_triangle;
|
||||
F32 triangles_high = llmax((F32) bytes_high-METADATA_DISCOUNT, MINIMUM_SIZE)/bytes_per_triangle;
|
||||
|
||||
if (bytes)
|
||||
{
|
||||
|
|
@ -3206,7 +3235,6 @@ F32 LLMeshRepository::getStreamingCost(LLSD& header, F32 radius, S32* bytes, S32
|
|||
*bytes += header["high_lod"]["size"].asInteger();
|
||||
}
|
||||
|
||||
|
||||
if (bytes_visible)
|
||||
{
|
||||
lod = LLMeshRepository::getActualMeshLOD(header, lod);
|
||||
|
|
@ -3216,27 +3244,7 @@ F32 LLMeshRepository::getStreamingCost(LLSD& header, F32 radius, S32* bytes, S32
|
|||
}
|
||||
}
|
||||
|
||||
if (bytes_high == 0.f)
|
||||
{
|
||||
return 0.f;
|
||||
}
|
||||
|
||||
if (bytes_mid == 0.f)
|
||||
{
|
||||
bytes_mid = bytes_high;
|
||||
}
|
||||
|
||||
if (bytes_low == 0.f)
|
||||
{
|
||||
bytes_low = bytes_mid;
|
||||
}
|
||||
|
||||
if (bytes_lowest == 0.f)
|
||||
{
|
||||
bytes_lowest = bytes_low;
|
||||
}
|
||||
|
||||
F32 max_area = 65536.f;
|
||||
F32 max_area = 102932.f; //area of circle that encompasses region
|
||||
F32 min_area = 1.f;
|
||||
|
||||
F32 high_area = llmin(F_PI*dmid*dmid, max_area);
|
||||
|
|
@ -3259,12 +3267,12 @@ F32 LLMeshRepository::getStreamingCost(LLSD& header, F32 radius, S32* bytes, S32
|
|||
low_area /= total_area;
|
||||
lowest_area /= total_area;
|
||||
|
||||
F32 weighted_avg = bytes_high*high_area +
|
||||
bytes_mid*mid_area +
|
||||
bytes_low*low_area +
|
||||
bytes_lowest*lowest_area;
|
||||
F32 weighted_avg = triangles_high*high_area +
|
||||
triangles_mid*mid_area +
|
||||
triangles_low*low_area +
|
||||
triangles_lowest*lowest_area;
|
||||
|
||||
return weighted_avg * gSavedSettings.getF32("MeshStreamingCostScaler");
|
||||
return weighted_avg/gSavedSettings.getU32("MeshTriangleBudget")*15000.f;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -83,6 +83,9 @@ void LLSceneView::draw()
|
|||
S32 total_visible_triangles[] = {0, 0};
|
||||
S32 total_triangles[] = {0, 0};
|
||||
|
||||
S32 total_visible_bytes[] = {0, 0};
|
||||
S32 total_bytes[] = {0, 0};
|
||||
|
||||
//streaming cost
|
||||
std::vector<F32> streaming_cost[2];
|
||||
F32 total_streaming[] = { 0.f, 0.f };
|
||||
|
|
@ -122,13 +125,19 @@ void LLSceneView::draw()
|
|||
visible_triangles[idx].push_back(visible);
|
||||
triangles[idx].push_back(high_triangles);
|
||||
|
||||
F32 streaming = object->getStreamingCost();
|
||||
S32 bytes = 0;
|
||||
S32 visible_bytes = 0;
|
||||
|
||||
F32 streaming = object->getStreamingCost(&bytes, &visible_bytes);
|
||||
total_streaming[idx] += streaming;
|
||||
streaming_cost[idx].push_back(streaming);
|
||||
|
||||
F32 physics = object->getPhysicsCost();
|
||||
total_physics[idx] += physics;
|
||||
physics_cost[idx].push_back(physics);
|
||||
|
||||
total_bytes[idx] += bytes;
|
||||
total_visible_bytes[idx] += visible_bytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -279,8 +288,8 @@ void LLSceneView::draw()
|
|||
total_visible += tri_count;
|
||||
}
|
||||
|
||||
std::string label = llformat("%s Object Triangle Counts (Ktris) -- [%.2f, %.2f] Mean: %.2f Median: %.2f Visible: %.2f/%.2f",
|
||||
category[idx], tri_domain[0]/1024.f, tri_domain[1]/1024.f, (total/count)/1024.f, triangles[idx][count/2]/1024.f, total_visible_triangles[idx]/1024.f, total_triangles[idx]/1024.f);
|
||||
std::string label = llformat("%s Object Triangle Counts (Ktris) -- Visible: %.2f/%.2f (%.2f KB Visible)",
|
||||
category[idx], total_visible_triangles[idx]/1024.f, total_triangles[idx]/1024.f, total_visible_bytes[idx]/1024.f);
|
||||
|
||||
LLFontGL::getFontMonospace()->renderUTF8(label,
|
||||
0 , tri_rect.mLeft, tri_rect.mTop+margin, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP);
|
||||
|
|
|
|||
|
|
@ -528,8 +528,8 @@ public:
|
|||
addText(xpos,ypos, llformat("%s streaming cost: %.1f", label, cost));
|
||||
ypos += y_inc;
|
||||
|
||||
addText(xpos, ypos, llformat(" %.1f KTris, %.1f/%.1f KB, %d objects",
|
||||
count/1024.f, visible_bytes/1024.f, total_bytes/1024.f, object_count));
|
||||
addText(xpos, ypos, llformat(" %.3f KTris, %.1f/%.1f KB, %d objects",
|
||||
count/1000.f, visible_bytes/1024.f, total_bytes/1024.f, object_count));
|
||||
ypos += y_inc;
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue