Home /Modules/operating-system/SLVideoCardCatalog.sleela

SLVideoCardCatalog.sleela

lib/operating-system/video-cards/SLVideoCardCatalog.sleela · 108 line(s) · sleela

<< lib/operating-system/video-cards/SLVideoCardCatalog.sleela
   SLeeLa Standard Library Definition.
   Definition: Defines SLVideoCardCatalog โ€” a by-name factory for graphics
     cards. Discrete-GPU silicon comes from a finite set of vendors โ€” NVIDIA
     (GeForce/RTX), AMD (Radeon RX), and Intel (Arc) โ€” with board partners
     (ASUS, MSI, Gigabyte, Sapphire, PowerColor, Zotac) shipping the same GPUs.
     The catalogue returns representative, correctly-specified SLVideoCard
     instances for well-known models so a machine description can request a
     display adapter by name.
   
   Representative model names stand in for identity; VRAM and clocks vary by SKU
   and board partner and can be refined on the returned SLVideoCard.
   
   Family: operating-system. Produces SLVideoCard. >>
#sleela 2.5
material;
class SLVideoCardCatalog {
  < ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
  << Eleven catalogued attributes with getter/setter pairs, so a GUI, loader,
     or catalog can read and (where appropriate) override this record.
     Values are faithful to the subject's real origin where publicly known. >>
  String metaVersion = "1.0.0";
  int metaId = 10948;
  String metaAuthor = "Kiro Agent";
  String metaDate = "2026-10-16";
  String metaCopyright = "SLeeLa project";
  String metaTrademark = "none";
  String metaCorporation = "none";
  < metaOrigin: National | <nation> | International | Galactic >
  String metaOrigin = "International";
  String metaBirthDate = "2026-10-10";
  < metaScienceRating: maturity/robustness on a 1..10 scale >
  int metaScienceRating = 9;
  < metaNationalSchedule: a real, citable instrument or "none" >
  String metaNationalSchedule = "none";

  String getMetaVersion() { return metaVersion; }
  void setMetaVersion(String v) { metaVersion = v; }
  int getMetaId() { return metaId; }
  void setMetaId(int v) { metaId = v; }
  String getAuthor() { return metaAuthor; }
  void setAuthor(String v) { metaAuthor = v; }
  String getDate() { return metaDate; }
  void setDate(String v) { metaDate = v; }
  String getCopyright() { return metaCopyright; }
  void setCopyright(String v) { metaCopyright = v; }
  String getTrademark() { return metaTrademark; }
  void setTrademark(String v) { metaTrademark = v; }
  String getCorporation() { return metaCorporation; }
  void setCorporation(String v) { metaCorporation = v; }
  String getOrigin() { return metaOrigin; }
  void setOrigin(String v) { metaOrigin = v; }
  String getBirthDate() { return metaBirthDate; }
  void setBirthDate(String v) { metaBirthDate = v; }
  int getScienceRating() { return metaScienceRating; }
  void setScienceRating(int v) { metaScienceRating = v; }
  String getNationalSchedule() { return metaNationalSchedule; }
  void setNationalSchedule(String v) { metaNationalSchedule = v; }
  void configure() {}

  < A GeForce/RTX card by model, e.g. geforce("RTX 4090", 24576). >
  SLVideoCard geforce(String model, int vramMb) {
    SLVideoCard g = new SLVideoCard();
    g.configure("NVIDIA", "GeForce " + model, g.GPU_NVIDIA, vramMb);
    g.setBoardPower(nvPower(model));
    return g;
  }
  < A Radeon RX card by model, e.g. radeon("RX 7900 XTX", 24576). >
  SLVideoCard radeon(String model, int vramMb) {
    SLVideoCard g = new SLVideoCard();
    g.configure("AMD", "Radeon " + model, g.GPU_AMD, vramMb);
    return g;
  }
  < An Intel Arc card by model, e.g. arc("A770", 16384). >
  SLVideoCard arc(String model, int vramMb) {
    SLVideoCard g = new SLVideoCard();
    g.configure("Intel", "Arc " + model, g.GPU_INTEL, vramMb);
    return g;
  }

  < Build any card by vendor + model name. >
  SLVideoCard card(String vendor, String model, int vramMb) {
    if (vendor == "NVIDIA") { return geforce(model, vramMb); }
    if (vendor == "AMD")    { return radeon(model, vramMb); }
    if (vendor == "Intel")  { return arc(model, vramMb); }
    SLVideoCard g = new SLVideoCard();
    g.configureByVendor(vendor, model, vramMb);
    return g;
  }

  boolean knownVendor(String vendor) {
    return vendor == "NVIDIA" || vendor == "AMD" || vendor == "Intel";
  }
  < Board partners that ship these GPUs (for identity/branding). >
  boolean knownBoardPartner(String partner) {
    return partner == "ASUS" || partner == "MSI" || partner == "Gigabyte"
        || partner == "Sapphire" || partner == "PowerColor" || partner == "Zotac"
        || partner == "EVGA" || partner == "XFX";
  }

  int nvPower(String model) {
    if (model == "RTX 4090") { return 450; }
    if (model == "RTX 4080") { return 320; }
    if (model == "RTX 4070") { return 200; }
    return 220;
  }
}