mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
More compatibility with exotic compilers (yes, I actually tried to port Panda to clang)
This commit is contained in:
parent
6418e6f221
commit
102b46878e
@ -95,6 +95,8 @@
|
|||||||
#define _WIN32_WINNT 0x0502
|
#define _WIN32_WINNT 0x0502
|
||||||
|
|
||||||
#ifdef HAVE_PYTHON
|
#ifdef HAVE_PYTHON
|
||||||
|
#undef _POSIX_C_SOURCE
|
||||||
|
#undef _XOPEN_SOURCE
|
||||||
#include "pyconfig.h"
|
#include "pyconfig.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ Filename(const char *filename) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE Filename::
|
INLINE Filename::
|
||||||
Filename(const Filename ©) :
|
Filename(const Filename ©) :
|
||||||
_filename(copy._filename),
|
_filename(copy._filename.c_str()),
|
||||||
_dirname_end(copy._dirname_end),
|
_dirname_end(copy._dirname_end),
|
||||||
_basename_start(copy._basename_start),
|
_basename_start(copy._basename_start),
|
||||||
_basename_end(copy._basename_end),
|
_basename_end(copy._basename_end),
|
||||||
@ -269,7 +269,7 @@ operator + (const string &other) const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE string Filename::
|
INLINE string Filename::
|
||||||
get_fullpath() const {
|
get_fullpath() const {
|
||||||
return _filename;
|
return _filename.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -1198,7 +1198,7 @@ to_os_specific() const {
|
|||||||
return convert_pathname(standard.get_fullpath());
|
return convert_pathname(standard.get_fullpath());
|
||||||
}
|
}
|
||||||
#else // WIN32
|
#else // WIN32
|
||||||
return standard;
|
return standard.c_str();
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2432,7 +2432,7 @@ touch() const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
bool Filename::
|
bool Filename::
|
||||||
chdir() const {
|
chdir() const {
|
||||||
Filename os_specific = to_os_specific();
|
string os_specific = to_os_specific();
|
||||||
return (::chdir(os_specific.c_str()) >= 0);
|
return (::chdir(os_specific.c_str()) >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -590,6 +590,9 @@ do_remove(AsyncTask *task) {
|
|||||||
removed = true;
|
removed = true;
|
||||||
cleanup_task(task, false, false);
|
cleanup_task(task, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return removed;
|
return removed;
|
||||||
|
@ -104,7 +104,7 @@ p() const {
|
|||||||
template<class T>
|
template<class T>
|
||||||
INLINE PointerTo<T> &PointerTo<T>::
|
INLINE PointerTo<T> &PointerTo<T>::
|
||||||
operator = (To *ptr) {
|
operator = (To *ptr) {
|
||||||
reassign(ptr);
|
this->reassign(ptr);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ operator = (To *ptr) {
|
|||||||
template<class T>
|
template<class T>
|
||||||
INLINE PointerTo<T> &PointerTo<T>::
|
INLINE PointerTo<T> &PointerTo<T>::
|
||||||
operator = (const PointerTo<T> ©) {
|
operator = (const PointerTo<T> ©) {
|
||||||
reassign((const PointerToBase<T> &)copy);
|
this->reassign((const PointerToBase<T> &)copy);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,7 +226,7 @@ p() const {
|
|||||||
template<class T>
|
template<class T>
|
||||||
INLINE ConstPointerTo<T> &ConstPointerTo<T>::
|
INLINE ConstPointerTo<T> &ConstPointerTo<T>::
|
||||||
operator = (const To *ptr) {
|
operator = (const To *ptr) {
|
||||||
reassign((To *)ptr);
|
this->reassign((To *)ptr);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,7 +238,7 @@ operator = (const To *ptr) {
|
|||||||
template<class T>
|
template<class T>
|
||||||
INLINE ConstPointerTo<T> &ConstPointerTo<T>::
|
INLINE ConstPointerTo<T> &ConstPointerTo<T>::
|
||||||
operator = (const PointerTo<T> ©) {
|
operator = (const PointerTo<T> ©) {
|
||||||
reassign((const PointerToBase<T> &)copy);
|
this->reassign((const PointerToBase<T> &)copy);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,6 +250,6 @@ operator = (const PointerTo<T> ©) {
|
|||||||
template<class T>
|
template<class T>
|
||||||
INLINE ConstPointerTo<T> &ConstPointerTo<T>::
|
INLINE ConstPointerTo<T> &ConstPointerTo<T>::
|
||||||
operator = (const ConstPointerTo<T> ©) {
|
operator = (const ConstPointerTo<T> ©) {
|
||||||
reassign((const PointerToBase<T> &)copy);
|
this->reassign((const PointerToBase<T> &)copy);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -249,7 +249,7 @@ template<class Element>
|
|||||||
INLINE void PointerToArray<Element>::
|
INLINE void PointerToArray<Element>::
|
||||||
reserve(TYPENAME PointerToArray<Element>::size_type n) {
|
reserve(TYPENAME PointerToArray<Element>::size_type n) {
|
||||||
if ((this->_void_ptr) == NULL) {
|
if ((this->_void_ptr) == NULL) {
|
||||||
reassign(new ReferenceCountedVector<Element>(_type_handle));
|
((PointerToArray<Element> *)this)->reassign(new ReferenceCountedVector<Element>(_type_handle));
|
||||||
}
|
}
|
||||||
((To *)(this->_void_ptr))->reserve(n);
|
((To *)(this->_void_ptr))->reserve(n);
|
||||||
}
|
}
|
||||||
@ -263,7 +263,7 @@ template<class Element>
|
|||||||
INLINE void PointerToArray<Element>::
|
INLINE void PointerToArray<Element>::
|
||||||
resize(TYPENAME PointerToArray<Element>::size_type n) {
|
resize(TYPENAME PointerToArray<Element>::size_type n) {
|
||||||
if ((this->_void_ptr) == NULL) {
|
if ((this->_void_ptr) == NULL) {
|
||||||
reassign(new ReferenceCountedVector<Element>(_type_handle));
|
((PointerToArray<Element> *)this)->reassign(new ReferenceCountedVector<Element>(_type_handle));
|
||||||
}
|
}
|
||||||
((To *)(this->_void_ptr))->resize(n);
|
((To *)(this->_void_ptr))->resize(n);
|
||||||
}
|
}
|
||||||
@ -323,7 +323,7 @@ template<class Element>
|
|||||||
INLINE TYPENAME PointerToArray<Element>::iterator PointerToArray<Element>::
|
INLINE TYPENAME PointerToArray<Element>::iterator PointerToArray<Element>::
|
||||||
insert(iterator position, const Element &x) {
|
insert(iterator position, const Element &x) {
|
||||||
if ((this->_void_ptr) == NULL) {
|
if ((this->_void_ptr) == NULL) {
|
||||||
reassign(new ReferenceCountedVector<Element>(_type_handle));
|
((PointerToArray<Element> *)this)->reassign(new ReferenceCountedVector<Element>(_type_handle));
|
||||||
position = end();
|
position = end();
|
||||||
}
|
}
|
||||||
nassertr(position >= ((To *)(this->_void_ptr))->begin() &&
|
nassertr(position >= ((To *)(this->_void_ptr))->begin() &&
|
||||||
@ -340,7 +340,7 @@ template<class Element>
|
|||||||
INLINE void PointerToArray<Element>::
|
INLINE void PointerToArray<Element>::
|
||||||
insert(iterator position, size_type n, const Element &x) {
|
insert(iterator position, size_type n, const Element &x) {
|
||||||
if ((this->_void_ptr) == NULL) {
|
if ((this->_void_ptr) == NULL) {
|
||||||
reassign(new ReferenceCountedVector<Element>(_type_handle));
|
((PointerToArray<Element> *)this)->reassign(new ReferenceCountedVector<Element>(_type_handle));
|
||||||
position = end();
|
position = end();
|
||||||
}
|
}
|
||||||
nassertv(position >= ((To *)(this->_void_ptr))->begin() &&
|
nassertv(position >= ((To *)(this->_void_ptr))->begin() &&
|
||||||
@ -416,7 +416,7 @@ template<class Element>
|
|||||||
INLINE void PointerToArray<Element>::
|
INLINE void PointerToArray<Element>::
|
||||||
push_back(const Element &x) {
|
push_back(const Element &x) {
|
||||||
if ((this->_void_ptr) == NULL) {
|
if ((this->_void_ptr) == NULL) {
|
||||||
reassign(new ReferenceCountedVector<Element>(_type_handle));
|
((PointerToArray<Element> *)this)->reassign(new ReferenceCountedVector<Element>(_type_handle));
|
||||||
}
|
}
|
||||||
((To *)(this->_void_ptr))->push_back(x);
|
((To *)(this->_void_ptr))->push_back(x);
|
||||||
}
|
}
|
||||||
@ -676,7 +676,7 @@ get_void_ptr() const {
|
|||||||
template<class Element>
|
template<class Element>
|
||||||
INLINE void PointerToArray<Element>::
|
INLINE void PointerToArray<Element>::
|
||||||
set_void_ptr(void *p) {
|
set_void_ptr(void *p) {
|
||||||
reassign((To *)p);
|
((PointerToArray<Element> *)this)->reassign((To *)p);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -735,7 +735,7 @@ node_unref() const {
|
|||||||
template<class Element>
|
template<class Element>
|
||||||
INLINE PointerToArray<Element> &PointerToArray<Element>::
|
INLINE PointerToArray<Element> &PointerToArray<Element>::
|
||||||
operator = (ReferenceCountedVector<Element> *ptr) {
|
operator = (ReferenceCountedVector<Element> *ptr) {
|
||||||
reassign(ptr);
|
((PointerToArray<Element> *)this)->reassign(ptr);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -748,7 +748,7 @@ template<class Element>
|
|||||||
INLINE PointerToArray<Element> &PointerToArray<Element>::
|
INLINE PointerToArray<Element> &PointerToArray<Element>::
|
||||||
operator = (const PointerToArray<Element> ©) {
|
operator = (const PointerToArray<Element> ©) {
|
||||||
_type_handle = copy._type_handle;
|
_type_handle = copy._type_handle;
|
||||||
reassign(copy);
|
((PointerToArray<Element> *)this)->reassign(copy);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -762,7 +762,7 @@ operator = (const PointerToArray<Element> ©) {
|
|||||||
template<class Element>
|
template<class Element>
|
||||||
INLINE void PointerToArray<Element>::
|
INLINE void PointerToArray<Element>::
|
||||||
clear() {
|
clear() {
|
||||||
reassign((ReferenceCountedVector<Element> *)NULL);
|
((PointerToArray<Element> *)this)->reassign((ReferenceCountedVector<Element> *)NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1167,7 +1167,7 @@ node_unref() const {
|
|||||||
template<class Element>
|
template<class Element>
|
||||||
INLINE ConstPointerToArray<Element> &ConstPointerToArray<Element>::
|
INLINE ConstPointerToArray<Element> &ConstPointerToArray<Element>::
|
||||||
operator = (ReferenceCountedVector<Element> *ptr) {
|
operator = (ReferenceCountedVector<Element> *ptr) {
|
||||||
reassign(ptr);
|
((ConstPointerToArray<Element> *)this)->reassign(ptr);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1180,7 +1180,7 @@ template<class Element>
|
|||||||
INLINE ConstPointerToArray<Element> &ConstPointerToArray<Element>::
|
INLINE ConstPointerToArray<Element> &ConstPointerToArray<Element>::
|
||||||
operator = (const PointerToArray<Element> ©) {
|
operator = (const PointerToArray<Element> ©) {
|
||||||
_type_handle = copy._type_handle;
|
_type_handle = copy._type_handle;
|
||||||
reassign(copy);
|
((ConstPointerToArray<Element> *)this)->reassign(copy);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1193,7 +1193,7 @@ template<class Element>
|
|||||||
INLINE ConstPointerToArray<Element> &ConstPointerToArray<Element>::
|
INLINE ConstPointerToArray<Element> &ConstPointerToArray<Element>::
|
||||||
operator = (const ConstPointerToArray<Element> ©) {
|
operator = (const ConstPointerToArray<Element> ©) {
|
||||||
_type_handle = copy._type_handle;
|
_type_handle = copy._type_handle;
|
||||||
reassign(copy);
|
((ConstPointerToArray<Element> *)this)->reassign(copy);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1207,7 +1207,7 @@ operator = (const ConstPointerToArray<Element> ©) {
|
|||||||
template<class Element>
|
template<class Element>
|
||||||
INLINE void ConstPointerToArray<Element>::
|
INLINE void ConstPointerToArray<Element>::
|
||||||
clear() {
|
clear() {
|
||||||
reassign((ReferenceCountedVector<Element> *)NULL);
|
((ConstPointerToArray<Element> *)this)->reassign((ReferenceCountedVector<Element> *)NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // CPPPARSER
|
#endif // CPPPARSER
|
||||||
|
@ -122,7 +122,7 @@ get_orig() const {
|
|||||||
template<class T>
|
template<class T>
|
||||||
INLINE WeakPointerTo<T> &WeakPointerTo<T>::
|
INLINE WeakPointerTo<T> &WeakPointerTo<T>::
|
||||||
operator = (To *ptr) {
|
operator = (To *ptr) {
|
||||||
reassign(ptr);
|
((WeakPointerTo<T> *)this)->reassign(ptr);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ operator = (To *ptr) {
|
|||||||
template<class T>
|
template<class T>
|
||||||
INLINE WeakPointerTo<T> &WeakPointerTo<T>::
|
INLINE WeakPointerTo<T> &WeakPointerTo<T>::
|
||||||
operator = (const PointerTo<T> ©) {
|
operator = (const PointerTo<T> ©) {
|
||||||
reassign((const PointerToBase<T> &)copy);
|
((WeakPointerTo<T> *)this)->reassign((const PointerToBase<T> &)copy);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ operator = (const PointerTo<T> ©) {
|
|||||||
template<class T>
|
template<class T>
|
||||||
INLINE WeakPointerTo<T> &WeakPointerTo<T>::
|
INLINE WeakPointerTo<T> &WeakPointerTo<T>::
|
||||||
operator = (const WeakPointerTo<T> ©) {
|
operator = (const WeakPointerTo<T> ©) {
|
||||||
reassign((const PointerToBase<T> &)copy);
|
((WeakPointerTo<T> *)this)->reassign((const PointerToBase<T> &)copy);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,7 +286,7 @@ get_orig() const {
|
|||||||
template<class T>
|
template<class T>
|
||||||
INLINE WeakConstPointerTo<T> &WeakConstPointerTo<T>::
|
INLINE WeakConstPointerTo<T> &WeakConstPointerTo<T>::
|
||||||
operator = (const To *ptr) {
|
operator = (const To *ptr) {
|
||||||
reassign((To *)ptr);
|
((WeakConstPointerTo<T> *)this)->reassign((To *)ptr);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,7 +298,7 @@ operator = (const To *ptr) {
|
|||||||
template<class T>
|
template<class T>
|
||||||
INLINE WeakConstPointerTo<T> &WeakConstPointerTo<T>::
|
INLINE WeakConstPointerTo<T> &WeakConstPointerTo<T>::
|
||||||
operator = (const PointerTo<T> ©) {
|
operator = (const PointerTo<T> ©) {
|
||||||
reassign((const PointerToBase<T> &)copy);
|
((WeakConstPointerTo<T> *)this)->reassign((const PointerToBase<T> &)copy);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,7 +310,7 @@ operator = (const PointerTo<T> ©) {
|
|||||||
template<class T>
|
template<class T>
|
||||||
INLINE WeakConstPointerTo<T> &WeakConstPointerTo<T>::
|
INLINE WeakConstPointerTo<T> &WeakConstPointerTo<T>::
|
||||||
operator = (const ConstPointerTo<T> ©) {
|
operator = (const ConstPointerTo<T> ©) {
|
||||||
reassign((const PointerToBase<T> &)copy);
|
((WeakConstPointerTo<T> *)this)->reassign((const PointerToBase<T> &)copy);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,7 +322,7 @@ operator = (const ConstPointerTo<T> ©) {
|
|||||||
template<class T>
|
template<class T>
|
||||||
INLINE WeakConstPointerTo<T> &WeakConstPointerTo<T>::
|
INLINE WeakConstPointerTo<T> &WeakConstPointerTo<T>::
|
||||||
operator = (const WeakPointerTo<T> ©) {
|
operator = (const WeakPointerTo<T> ©) {
|
||||||
reassign((const PointerToBase<T> &)copy);
|
((WeakConstPointerTo<T> *)this)->reassign((const PointerToBase<T> &)copy);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,6 +334,6 @@ operator = (const WeakPointerTo<T> ©) {
|
|||||||
template<class T>
|
template<class T>
|
||||||
INLINE WeakConstPointerTo<T> &WeakConstPointerTo<T>::
|
INLINE WeakConstPointerTo<T> &WeakConstPointerTo<T>::
|
||||||
operator = (const WeakConstPointerTo<T> ©) {
|
operator = (const WeakConstPointerTo<T> ©) {
|
||||||
reassign((const PointerToBase<T> &)copy);
|
((WeakConstPointerTo<T> *)this)->assign((const PointerToBase<T> &)copy);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -203,14 +203,13 @@ cp_errchk_parameter_float(ShaderArgInfo &p, int lo, int hi)
|
|||||||
// Description:
|
// Description:
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
bool Shader::
|
bool Shader::
|
||||||
cp_errchk_parameter_ptr(ShaderArgInfo &p)
|
cp_errchk_parameter_ptr(ShaderArgInfo &p) {
|
||||||
{
|
switch (p._class) {
|
||||||
switch(p._class) {
|
|
||||||
case SAC_scalar: return true;
|
case SAC_scalar: return true;
|
||||||
case SAC_vector: return true;
|
case SAC_vector: return true;
|
||||||
case SAC_matrix: return true;
|
case SAC_matrix: return true;
|
||||||
case SAC_array:
|
case SAC_array:
|
||||||
switch(p._subclass){
|
switch (p._subclass){
|
||||||
case SAC_scalar: return true;
|
case SAC_scalar: return true;
|
||||||
case SAC_vector: return true;
|
case SAC_vector: return true;
|
||||||
case SAC_matrix: return true;
|
case SAC_matrix: return true;
|
||||||
@ -491,7 +490,7 @@ void Shader::recurse_parameters(CGparameter parameter,
|
|||||||
CGenum vbl = cgGetParameterVariability(parameter);
|
CGenum vbl = cgGetParameterVariability(parameter);
|
||||||
|
|
||||||
if ((vbl==CG_VARYING)||(vbl==CG_UNIFORM)){
|
if ((vbl==CG_VARYING)||(vbl==CG_UNIFORM)){
|
||||||
switch(cgGetParameterType(parameter)) {
|
switch (cgGetParameterType(parameter)) {
|
||||||
case CG_STRUCT:
|
case CG_STRUCT:
|
||||||
recurse_parameters(
|
recurse_parameters(
|
||||||
cgGetFirstStructParameter(parameter),type,success); break;
|
cgGetFirstStructParameter(parameter),type,success); break;
|
||||||
@ -1133,7 +1132,7 @@ compile_parameter(const ShaderArgId &arg_id,
|
|||||||
ShaderTexSpec bind;
|
ShaderTexSpec bind;
|
||||||
bind._id = arg_id;
|
bind._id = arg_id;
|
||||||
bind._name = kinputname;
|
bind._name = kinputname;
|
||||||
bind._desired_type=Texture::TT_1d_texture;
|
bind._desired_type = Texture::TT_1d_texture;
|
||||||
_tex_spec.push_back(bind);
|
_tex_spec.push_back(bind);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1141,7 +1140,7 @@ compile_parameter(const ShaderArgId &arg_id,
|
|||||||
ShaderTexSpec bind;
|
ShaderTexSpec bind;
|
||||||
bind._id = arg_id;
|
bind._id = arg_id;
|
||||||
bind._name = kinputname;
|
bind._name = kinputname;
|
||||||
bind._desired_type=Texture::TT_2d_texture;
|
bind._desired_type = Texture::TT_2d_texture;
|
||||||
_tex_spec.push_back(bind);
|
_tex_spec.push_back(bind);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1149,7 +1148,7 @@ compile_parameter(const ShaderArgId &arg_id,
|
|||||||
ShaderTexSpec bind;
|
ShaderTexSpec bind;
|
||||||
bind._id = arg_id;
|
bind._id = arg_id;
|
||||||
bind._name = kinputname;
|
bind._name = kinputname;
|
||||||
bind._desired_type=Texture::TT_3d_texture;
|
bind._desired_type = Texture::TT_3d_texture;
|
||||||
_tex_spec.push_back(bind);
|
_tex_spec.push_back(bind);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1200,7 +1199,7 @@ cg_parameter_type(CGparameter p) {
|
|||||||
switch (cgGetParameterClass(p)) {
|
switch (cgGetParameterClass(p)) {
|
||||||
case CG_PARAMETERCLASS_SCALAR: return SAT_scalar;
|
case CG_PARAMETERCLASS_SCALAR: return SAT_scalar;
|
||||||
case CG_PARAMETERCLASS_VECTOR:
|
case CG_PARAMETERCLASS_VECTOR:
|
||||||
switch(cgGetParameterColumns(p)){
|
switch (cgGetParameterColumns(p)){
|
||||||
case 1: return SAT_vec1;
|
case 1: return SAT_vec1;
|
||||||
case 2: return SAT_vec2;
|
case 2: return SAT_vec2;
|
||||||
case 3: return SAT_vec3;
|
case 3: return SAT_vec3;
|
||||||
@ -1208,9 +1207,9 @@ cg_parameter_type(CGparameter p) {
|
|||||||
default: return SAT_unknown;
|
default: return SAT_unknown;
|
||||||
}
|
}
|
||||||
case CG_PARAMETERCLASS_MATRIX:
|
case CG_PARAMETERCLASS_MATRIX:
|
||||||
switch(cgGetParameterRows(p)){
|
switch (cgGetParameterRows(p)){
|
||||||
case 1:
|
case 1:
|
||||||
switch(cgGetParameterColumns(p)){
|
switch (cgGetParameterColumns(p)){
|
||||||
case 1: return SAT_mat1x1;
|
case 1: return SAT_mat1x1;
|
||||||
case 2: return SAT_mat1x2;
|
case 2: return SAT_mat1x2;
|
||||||
case 3: return SAT_mat1x3;
|
case 3: return SAT_mat1x3;
|
||||||
@ -1218,7 +1217,7 @@ cg_parameter_type(CGparameter p) {
|
|||||||
default: return SAT_unknown;
|
default: return SAT_unknown;
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
switch(cgGetParameterColumns(p)){
|
switch (cgGetParameterColumns(p)){
|
||||||
case 1: return SAT_mat2x1;
|
case 1: return SAT_mat2x1;
|
||||||
case 2: return SAT_mat2x2;
|
case 2: return SAT_mat2x2;
|
||||||
case 3: return SAT_mat2x3;
|
case 3: return SAT_mat2x3;
|
||||||
@ -1226,7 +1225,7 @@ cg_parameter_type(CGparameter p) {
|
|||||||
default: return SAT_unknown;
|
default: return SAT_unknown;
|
||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
switch(cgGetParameterColumns(p)){
|
switch (cgGetParameterColumns(p)){
|
||||||
case 1: return SAT_mat3x1;
|
case 1: return SAT_mat3x1;
|
||||||
case 2: return SAT_mat3x2;
|
case 2: return SAT_mat3x2;
|
||||||
case 3: return SAT_mat3x3;
|
case 3: return SAT_mat3x3;
|
||||||
@ -1234,7 +1233,7 @@ cg_parameter_type(CGparameter p) {
|
|||||||
default: return SAT_unknown;
|
default: return SAT_unknown;
|
||||||
}
|
}
|
||||||
case 4:
|
case 4:
|
||||||
switch(cgGetParameterColumns(p)){
|
switch (cgGetParameterColumns(p)){
|
||||||
case 1: return SAT_mat4x1;
|
case 1: return SAT_mat4x1;
|
||||||
case 2: return SAT_mat4x2;
|
case 2: return SAT_mat4x2;
|
||||||
case 3: return SAT_mat4x3;
|
case 3: return SAT_mat4x3;
|
||||||
@ -1244,7 +1243,7 @@ cg_parameter_type(CGparameter p) {
|
|||||||
default: return SAT_unknown;
|
default: return SAT_unknown;
|
||||||
}
|
}
|
||||||
case CG_PARAMETERCLASS_SAMPLER:
|
case CG_PARAMETERCLASS_SAMPLER:
|
||||||
switch(cgGetParameterType(p)){
|
switch (cgGetParameterType(p)){
|
||||||
case CG_SAMPLER1D: return Shader::SAT_sampler1d;
|
case CG_SAMPLER1D: return Shader::SAT_sampler1d;
|
||||||
case CG_SAMPLER2D: return Shader::SAT_sampler2d;
|
case CG_SAMPLER2D: return Shader::SAT_sampler2d;
|
||||||
case CG_SAMPLER3D: return Shader::SAT_sampler3d;
|
case CG_SAMPLER3D: return Shader::SAT_sampler3d;
|
||||||
@ -1327,7 +1326,7 @@ cg_compile_entry_point(const char *entry, const ShaderCaps &caps, ShaderType typ
|
|||||||
|
|
||||||
int active, ultimate;
|
int active, ultimate;
|
||||||
|
|
||||||
switch(type) {
|
switch (type) {
|
||||||
case ST_vertex:
|
case ST_vertex:
|
||||||
active = caps._active_vprofile;
|
active = caps._active_vprofile;
|
||||||
ultimate = caps._ultimate_vprofile;
|
ultimate = caps._ultimate_vprofile;
|
||||||
@ -1342,6 +1341,10 @@ cg_compile_entry_point(const char *entry, const ShaderCaps &caps, ShaderType typ
|
|||||||
active = caps._active_gprofile;
|
active = caps._active_gprofile;
|
||||||
ultimate = caps._ultimate_gprofile;
|
ultimate = caps._ultimate_gprofile;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ST_none:
|
||||||
|
active = CG_PROFILE_UNKNOWN;
|
||||||
|
ultimate = CG_PROFILE_UNKNOWN;
|
||||||
};
|
};
|
||||||
|
|
||||||
cgGetError();
|
cgGetError();
|
||||||
@ -1662,9 +1665,9 @@ cg_analyze_shader(const ShaderCaps &caps) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
CGprogram Shader::
|
CGprogram Shader::
|
||||||
cg_program_from_shadertype(ShaderType type) {
|
cg_program_from_shadertype(ShaderType type) {
|
||||||
CGprogram prog = 0;
|
CGprogram prog;
|
||||||
|
|
||||||
switch(type) {
|
switch (type) {
|
||||||
case ST_vertex:
|
case ST_vertex:
|
||||||
prog = _cg_vprogram;
|
prog = _cg_vprogram;
|
||||||
break;
|
break;
|
||||||
@ -1676,6 +1679,9 @@ cg_program_from_shadertype(ShaderType type) {
|
|||||||
case ST_geometry:
|
case ST_geometry:
|
||||||
prog = _cg_gprogram;
|
prog = _cg_gprogram;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
prog = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
return prog;
|
return prog;
|
||||||
|
@ -611,6 +611,9 @@ estimate_texture_memory() const {
|
|||||||
case Texture::F_rgba32:
|
case Texture::F_rgba32:
|
||||||
bpp = 16;
|
bpp = 16;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t bytes = pixels * bpp;
|
size_t bytes = pixels * bpp;
|
||||||
@ -1377,6 +1380,9 @@ write(ostream &out, int indent_level) const {
|
|||||||
case T_float:
|
case T_float:
|
||||||
out << " floats";
|
out << " floats";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
out << ", ";
|
out << ", ";
|
||||||
@ -1390,6 +1396,15 @@ write(ostream &out, int indent_level) const {
|
|||||||
case F_depth_component:
|
case F_depth_component:
|
||||||
out << "depth_component";
|
out << "depth_component";
|
||||||
break;
|
break;
|
||||||
|
case F_depth_component16:
|
||||||
|
out << "depth_component16";
|
||||||
|
break;
|
||||||
|
case F_depth_component24:
|
||||||
|
out << "depth_component24";
|
||||||
|
break;
|
||||||
|
case F_depth_component32:
|
||||||
|
out << "depth_component32";
|
||||||
|
break;
|
||||||
|
|
||||||
case F_rgba:
|
case F_rgba:
|
||||||
out << "rgba";
|
out << "rgba";
|
||||||
@ -3539,6 +3554,9 @@ do_compress_ram_image(Texture::CompressionMode compression,
|
|||||||
case CM_dxt5:
|
case CM_dxt5:
|
||||||
squish_flags |= squish::kDxt5;
|
squish_flags |= squish::kDxt5;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (squish_flags != 0) {
|
if (squish_flags != 0) {
|
||||||
@ -3557,6 +3575,9 @@ do_compress_ram_image(Texture::CompressionMode compression,
|
|||||||
case QL_best:
|
case QL_best:
|
||||||
squish_flags |= squish::kColourIterativeClusterFit;
|
squish_flags |= squish::kColourIterativeClusterFit;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_squish(compression, squish_flags)) {
|
if (do_squish(compression, squish_flags)) {
|
||||||
@ -3592,6 +3613,9 @@ do_uncompress_ram_image() {
|
|||||||
case CM_dxt5:
|
case CM_dxt5:
|
||||||
squish_flags |= squish::kDxt5;
|
squish_flags |= squish::kDxt5;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (squish_flags != 0) {
|
if (squish_flags != 0) {
|
||||||
@ -3896,6 +3920,9 @@ do_set_format(Texture::Format format) {
|
|||||||
case F_color_index:
|
case F_color_index:
|
||||||
case F_depth_stencil:
|
case F_depth_stencil:
|
||||||
case F_depth_component:
|
case F_depth_component:
|
||||||
|
case F_depth_component16:
|
||||||
|
case F_depth_component24:
|
||||||
|
case F_depth_component32:
|
||||||
case F_red:
|
case F_red:
|
||||||
case F_green:
|
case F_green:
|
||||||
case F_blue:
|
case F_blue:
|
||||||
@ -3951,6 +3978,10 @@ do_set_component_type(Texture::ComponentType component_type) {
|
|||||||
case T_float:
|
case T_float:
|
||||||
_component_width = 4;
|
_component_width = 4;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case T_unsigned_int_24_8:
|
||||||
|
//FIXME: I have no idea...
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6356,6 +6387,8 @@ operator << (ostream &out, Texture::ComponentType ct) {
|
|||||||
return out << "unsigned_short";
|
return out << "unsigned_short";
|
||||||
case Texture::T_float:
|
case Texture::T_float:
|
||||||
return out << "float";
|
return out << "float";
|
||||||
|
case Texture::T_unsigned_int_24_8:
|
||||||
|
return out << "unsigned_int_24_8";
|
||||||
}
|
}
|
||||||
|
|
||||||
return out << "(**invalid Texture::ComponentType(" << (int)ct << ")**)";
|
return out << "(**invalid Texture::ComponentType(" << (int)ct << ")**)";
|
||||||
@ -6372,6 +6405,12 @@ operator << (ostream &out, Texture::Format f) {
|
|||||||
return out << "depth_stencil";
|
return out << "depth_stencil";
|
||||||
case Texture::F_depth_component:
|
case Texture::F_depth_component:
|
||||||
return out << "depth_component";
|
return out << "depth_component";
|
||||||
|
case Texture::F_depth_component16:
|
||||||
|
return out << "depth_component16";
|
||||||
|
case Texture::F_depth_component24:
|
||||||
|
return out << "depth_component24";
|
||||||
|
case Texture::F_depth_component32:
|
||||||
|
return out << "depth_component32";
|
||||||
case Texture::F_color_index:
|
case Texture::F_color_index:
|
||||||
return out << "color_index";
|
return out << "color_index";
|
||||||
case Texture::F_red:
|
case Texture::F_red:
|
||||||
|
@ -86,7 +86,7 @@ TexturePeeker(Texture *tex) {
|
|||||||
_get_component = Texture::get_unsigned_short;
|
_get_component = Texture::get_unsigned_short;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Texture::T_float:
|
default:
|
||||||
// Not supported.
|
// Not supported.
|
||||||
_image.clear();
|
_image.clear();
|
||||||
return;
|
return;
|
||||||
@ -95,10 +95,6 @@ TexturePeeker(Texture *tex) {
|
|||||||
switch (_format) {
|
switch (_format) {
|
||||||
case Texture::F_depth_stencil:
|
case Texture::F_depth_stencil:
|
||||||
case Texture::F_depth_component:
|
case Texture::F_depth_component:
|
||||||
case Texture::F_color_index:
|
|
||||||
// Not supported.
|
|
||||||
_image.clear();
|
|
||||||
return;
|
|
||||||
|
|
||||||
case Texture::F_red:
|
case Texture::F_red:
|
||||||
_get_texel = get_texel_r;
|
_get_texel = get_texel_r;
|
||||||
@ -143,7 +139,11 @@ TexturePeeker(Texture *tex) {
|
|||||||
case Texture::F_rgba32:
|
case Texture::F_rgba32:
|
||||||
_get_texel = get_texel_rgba;
|
_get_texel = get_texel_rgba;
|
||||||
break;
|
break;
|
||||||
}
|
default:
|
||||||
|
// Not supported.
|
||||||
|
_image.clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user