Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.0 KiB

  1. #! perl
  2. my $fname=shift || die "format is shaderinfo blah.vcs";
  3. open(SHADER, $fname) || die "can't open $fname";
  4. binmode SHADER;
  5. read(SHADER,$header,20);
  6. ($ver,$ntotal,$ndynamic,$flags,$centroidmask)=unpack("LLLLL",$header);
  7. #print "Version $ver total combos=$ntotal, num dynamic combos=$ndynamic,\n flags=$flags, centroid mask=$centroidmask\n";
  8. read(SHADER,$refsize,4);
  9. $refsize=unpack("L",$refsize);
  10. #print "Size of reference shader for diffing=$refsize\n";
  11. seek(SHADER,$refsize,1);
  12. $nskipped_combos=0;
  13. for(1..$ntotal)
  14. {
  15. read(SHADER,$combodata,8);
  16. ($ofs,$combosize)=unpack("LL",$combodata);
  17. if ( $ofs == 0xffffffff)
  18. {
  19. $nskipped_combos++;
  20. }
  21. else
  22. {
  23. }
  24. }
  25. #print "$nskipped_combos skipped, for an actual total of ",$ntotal-$nskipped_combos,"\n";
  26. #print "Real to skipped ratio = ",($ntotal-$nskipped_combos)/$ntotal,"\n";
  27. # csv output - name, real combos, virtual combos, dynamic combos
  28. my $real_combos=$ntotal-$nskipped_combos;
  29. print "$fname,$real_combos,$ntotal,$ndynamic\n";