summaryrefslogtreecommitdiff
path: root/devtools/bin/shaderinfo.pl
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /devtools/bin/shaderinfo.pl
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'devtools/bin/shaderinfo.pl')
-rw-r--r--devtools/bin/shaderinfo.pl36
1 files changed, 36 insertions, 0 deletions
diff --git a/devtools/bin/shaderinfo.pl b/devtools/bin/shaderinfo.pl
new file mode 100644
index 0000000..57a8157
--- /dev/null
+++ b/devtools/bin/shaderinfo.pl
@@ -0,0 +1,36 @@
+#! perl
+
+my $fname=shift || die "format is shaderinfo blah.vcs";
+
+open(SHADER, $fname) || die "can't open $fname";
+binmode SHADER;
+
+read(SHADER,$header,20);
+($ver,$ntotal,$ndynamic,$flags,$centroidmask)=unpack("LLLLL",$header);
+
+#print "Version $ver total combos=$ntotal, num dynamic combos=$ndynamic,\n flags=$flags, centroid mask=$centroidmask\n";
+
+read(SHADER,$refsize,4);
+$refsize=unpack("L",$refsize);
+#print "Size of reference shader for diffing=$refsize\n";
+
+seek(SHADER,$refsize,1);
+
+$nskipped_combos=0;
+for(1..$ntotal)
+ {
+ read(SHADER,$combodata,8);
+ ($ofs,$combosize)=unpack("LL",$combodata);
+ if ( $ofs == 0xffffffff)
+ {
+ $nskipped_combos++;
+ }
+ else
+ {
+ }
+ }
+#print "$nskipped_combos skipped, for an actual total of ",$ntotal-$nskipped_combos,"\n";
+#print "Real to skipped ratio = ",($ntotal-$nskipped_combos)/$ntotal,"\n";
+# csv output - name, real combos, virtual combos, dynamic combos
+my $real_combos=$ntotal-$nskipped_combos;
+print "$fname,$real_combos,$ntotal,$ndynamic\n";