Consolidate the register counting functions to a single location in the HLSL layout encoder source.

This new method explicitly depends on HLSL packing rules, instead of a GL idiom.

TRAC #23748

Signed-off-by: Geoff Lang
Signed-off-by: Nicolas Capens
diff --git a/src/compiler/OutputHLSL.h b/src/compiler/OutputHLSL.h
index 02ee447..86d68f3 100644
--- a/src/compiler/OutputHLSL.h
+++ b/src/compiler/OutputHLSL.h
@@ -178,10 +178,13 @@
     int samplerRegister(TIntermSymbol *sampler);
     int uniformRegister(TIntermSymbol *uniform);
     void declareInterfaceBlockField(const TType &type, const TString &name, std::vector<InterfaceBlockField>& output);
-    void declareUniformToList(const TType &type, const TString &name, int registerIndex, std::vector<Uniform>& output);
+    Uniform declareUniformToList(const TType &type, const TString &name, int registerIndex, std::vector<Uniform>& output);
     void declareUniform(const TType &type, const TString &name, int index);
     void declareVaryingToList(const TType &type, const TString &name, std::vector<Varying>& fieldsOut);
 
+    // Returns the uniform's register index
+    int declareUniformAndAssignRegister(const TType &type, const TString &name);
+
     TString interfaceBlockFieldString(const TInterfaceBlock &interfaceBlock, const TField &field);
     TString decoratePrivate(const TString &privateText);
     TString interfaceBlockStructNameString(const TInterfaceBlock &interfaceBlockType);