Browse Source

shader: Clean up use of ::ShaderType

rdb 1 year ago
parent
commit
81dc219618

+ 5 - 5
panda/src/display/shaderInputBinding_impls.cxx

@@ -275,7 +275,7 @@ check_light_struct_member(const string &name, const ShaderType *type) {
     return false;
   }
 
-  const ::ShaderType::Matrix *matrix = type->as_matrix();
+  const ShaderType::Matrix *matrix = type->as_matrix();
   if (matrix != nullptr) {
     if (matrix->get_num_rows() != num_rows ||
         matrix->get_num_columns() < min_cols ||
@@ -288,7 +288,7 @@ check_light_struct_member(const string &name, const ShaderType *type) {
   }
   else {
     uint32_t num_components = 1;
-    if (const ::ShaderType::Vector *vector = type->as_vector()) {
+    if (const ShaderType::Vector *vector = type->as_vector()) {
       num_components = vector->get_num_components();
     }
     else if (type->as_scalar() == nullptr) {
@@ -2239,15 +2239,15 @@ r_collect_members(const InternalName *name, const ShaderType *type, size_t offse
 
     _data_members.push_back({binding, offset});
   }
-  else if (const ::ShaderType::Struct *struct_type = type->as_struct()) {
+  else if (const ShaderType::Struct *struct_type = type->as_struct()) {
     for (size_t i = 0; i < struct_type->get_num_members(); ++i) {
-      const ::ShaderType::Struct::Member &member = struct_type->get_member(i);
+      const ShaderType::Struct::Member &member = struct_type->get_member(i);
 
       PT(InternalName) fqname = ((InternalName *)name)->append(member.name);
       r_collect_members(fqname, member.type, offset + member.offset);
     }
   }
-  else if (const ::ShaderType::Array *array_type = type->as_array()) {
+  else if (const ShaderType::Array *array_type = type->as_array()) {
     size_t basename_size = name->get_basename().size();
     char *buffer = (char *)alloca(basename_size + 14);
     memcpy(buffer, name->get_basename().c_str(), basename_size);

+ 1 - 1
panda/src/gobj/shader.I

@@ -730,7 +730,7 @@ write_datagram(Datagram &dg) const {
  */
 INLINE void Shader::ShaderPtrData::
 read_datagram(DatagramIterator &scan) {
-  _type = (::ShaderType::ScalarType) scan.get_uint8();
+  _type = (ShaderType::ScalarType) scan.get_uint8();
   _size = scan.get_uint32();
 
   if (_type == ScalarType::ST_double) {

+ 3 - 3
panda/src/gobj/shader.cxx

@@ -455,7 +455,7 @@ link() {
   pmap<CPT_InternalName, Parameter> parameters_by_name;
   pvector<Parameter *> parameters;
 
-  pmap<CPT_InternalName, const ::ShaderType *> spec_const_types;
+  pmap<CPT_InternalName, const ShaderType *> spec_const_types;
 
   for (LinkedModule &linked_module : _modules) {
     const ShaderModule *module = linked_module._module.get_read_pointer();
@@ -499,7 +499,7 @@ link() {
       if (!result.second) {
         // Another module has already defined a spec constant with this name.
         // Make sure they have the same type.
-        const ::ShaderType *other_type = it->second;
+        const ShaderType *other_type = it->second;
         if (spec_const.type != other_type) {
           shader_cat.error()
             << "Specialization constant " << *spec_const.name << " in module "
@@ -554,7 +554,7 @@ add_parameter(const InternalName *name, const ShaderType *type, int location) {
  * Binds a vertex input parameter with the given type.
  */
 bool Shader::
-bind_vertex_input(const InternalName *name, const ::ShaderType *type, int location) {
+bind_vertex_input(const InternalName *name, const ShaderType *type, int location) {
   std::string name_str = name->get_name();
 
   Shader::ShaderVarSpec bind;

+ 4 - 4
panda/src/gobj/shader.h

@@ -135,7 +135,7 @@ public:
 
   struct Parameter {
     CPT_InternalName _name;
-    const ::ShaderType *_type = nullptr;
+    const ShaderType *_type = nullptr;
     PT(ShaderInputBinding) _binding = nullptr;
     int _location = -1;
     int _stage_mask = 0;
@@ -259,7 +259,7 @@ public:
   };
 
 protected:
-  bool report_parameter_error(const InternalName *name, const ::ShaderType *type, const char *msg);
+  bool report_parameter_error(const InternalName *name, const ShaderType *type, const char *msg);
 
 public:
   size_t add_matrix_cache_item(StateMatrix input, const InternalName *arg, int dep);
@@ -334,8 +334,8 @@ private:
 
 public:
   bool link();
-  void add_parameter(const InternalName *name, const ::ShaderType *type, int location = -1);
-  bool bind_vertex_input(const InternalName *name, const ::ShaderType *type, int location);
+  void add_parameter(const InternalName *name, const ShaderType *type, int location = -1);
+  bool bind_vertex_input(const InternalName *name, const ShaderType *type, int location);
 
   bool check_modified() const;
   ShaderCompiler *get_compiler(ShaderLanguage lang) const;