Permalink
Browse files

Cleaned-up program sources some.

  • Loading branch information...
1 parent ccad701 commit 459d69e8ecc7ff5dce3f0f6c4dc6592996c91049 @gzorin committed Feb 23, 2013
Showing with 0 additions and 249 deletions.
  1. +0 −12 src/library/program.cc
  2. +0 −99 src/library/program.h
  3. +0 −138 src/library/set.h
View
@@ -1418,11 +1418,6 @@ glGetAttribLocation (GLuint program_name, const GLchar* name)
RSXGL_NOERROR(-1);
}
- /*rsxgl_debug_printf("%s program.attribs: %lx program.attribs.size(): %lu program.names.get(): %lx program.names_size: %lu\n",
- __PRETTY_FUNCTION__,
- (uint64_t)program.attribs,(uint32_t)program.attribs.size(),
- (uint64_t)program.names.get(),(uint32_t)program.names_size);*/
-
auto tmp = program_t::table_t< program_t::attrib_t >::find(program.names.get(),program.attribs,name);
if(tmp.second) {
@@ -1538,13 +1533,6 @@ glGetUniformLocation (GLuint program_name, const GLchar* name)
RSXGL_NOERROR(-1);
}
- /*rsxgl_debug_printf("%s program.attribs: %lx program.attribs.size(): %lu program.names.get(): %lx program.names_size: %lu\n",
- __PRETTY_FUNCTION__,
- (uint64_t)program.uniforms,(uint32_t)program.uniforms.size(),
- (uint64_t)program.names.get(),(uint32_t)program.names_size);
- rsxgl_debug_printf("\t%lx %lu\n",(uint64_t)program.names().values,(uint32_t)program.names().size);
- rsxgl_debug_printf("\tprogram.names.get(): %lx program.names_size: %lu\n",(uint64_t)program.names.get(),(uint32_t)program.names_size);*/
-
auto tmp = program_t::table_t< program_t::uniform_t >::find(program.names.get(),program.uniforms,name);
if(tmp.second) {
View
@@ -10,7 +10,6 @@
#include "gl_constants.h"
#include "gl_object_storage.h"
-#include "array.h"
#include "ieee32_t.h"
#include "compiler_context.h"
@@ -102,104 +101,6 @@ struct program_t {
typedef boost::uint_value_t< RSXGL_MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1 >::least texture_size_type;
// Table:
-#if 0
- template< typename Value, typename SizeType >
- struct table {
- typedef std::pair< name_size_type, Value > value_type;
- typedef array< value_type, SizeType > array_type;
-
- typedef typename array_type::size_type size_type;
- typedef typename array_type::pointer_type pointer_type;
- typedef typename array_type::const_pointer_type const_pointer_type;
-
- struct find_lt {
- const char * m_names;
-
- find_lt(const char * _names) : m_names(_names) {
- }
-
- bool operator()(const value_type & lhs,const char * rhs) const {
- /*rsxgl_debug_printf("%s seeking:%s %lx\n",__PRETTY_FUNCTION__,rhs,(uint64_t)m_names);*/
- return strcmp(m_names + lhs.first,rhs) < 0;
- }
-
- bool operator()(const char * lhs,const value_type & rhs) const {
- /*rsxgl_debug_printf("%s seeking:%s\n",__PRETTY_FUNCTION__,lhs,(uint64_t)m_names);*/
- return strcmp(lhs,m_names + rhs.first) < 0;
- }
- };
-
- struct find_eq {
- const char * m_names;
-
- find_eq(const char * _names) : m_names(_names) {
- }
-
- bool operator()(const value_type & lhs,const char * rhs) const {
- /*rsxgl_debug_printf("%s seeking:%s %lx\n",__PRETTY_FUNCTION__,rhs,(uint64_t)m_names);*/
- return strcmp(m_names + lhs.first,rhs) == 0;
- }
-
- bool operator()(const char * lhs,const value_type & rhs) const {
- /*rsxgl_debug_printf("%s seeking:%s\n",__PRETTY_FUNCTION__,lhs,(uint64_t)m_names);*/
- return strcmp(lhs,m_names + rhs.first) == 0;
- }
- };
-
- struct type : public array_type::type {
- typedef typename array_type::type base_type;
-
- const char * m_names;
-
- type(pointer_type & _values,size_type & _size,const char * _names)
- : base_type(_values,_size), m_names(_names) {
- /*rsxgl_debug_printf("%s %lx %lu\n",__PRETTY_FUNCTION__,(uint64_t)_values,(uint32_t)_size);*/
- }
-
- std::pair< bool, size_type > find(const char * name) const {
- /*rsxgl_debug_printf("%s: %lx %u %lx %s\n",
- __PRETTY_FUNCTION__,
- (uint64_t)base_type::values,(uint32_t)base_type::size,
- (uint64_t)m_names,
- name);*/
- typename array_type::pointer_type it = std::lower_bound(base_type::values,base_type::values + base_type::size,name,find_lt(m_names));
- if(it != (base_type::values + base_type::size) && find_eq(m_names)(name,*it)) {
- return std::make_pair(true,it - base_type::values);
- }
- else {
- return std::make_pair(false,0);
- }
- }
- };
-
- struct const_type : public array_type::const_type {
- typedef typename array_type::const_type base_type;
-
- const char * m_names;
-
- const_type(const const_pointer_type & _values,const size_type & _size,const char * _names)
- : base_type(_values,_size), m_names(_names) {
- /*rsxgl_debug_printf("%s %lx %lu\n",__PRETTY_FUNCTION__,(uint64_t)_values,(uint32_t)_size);*/
- }
-
- std::pair< bool, size_type > find(const char * name) const {
- rsxgl_debug_printf("%s: %lx %u %lx %s\n",
- __PRETTY_FUNCTION__,
- (uint64_t)base_type::values,(uint32_t)base_type::size,
- (uint64_t)m_names,
- name);
- typename array_type::const_pointer_type it = std::lower_bound(base_type::values,base_type::values + base_type::size,name,find_lt(m_names));
- if(it != (base_type::values + base_type::size) && find_eq(m_names)(name,*it)) {
- return std::make_pair(true,it - base_type::values);
- }
- else {
- return std::make_pair(false,0);
- }
- }
- };
- };
-#endif
-
template< typename Value >
struct table_t {
typedef std::vector< std::pair< name_size_type, Value > > type;
View
@@ -1,138 +0,0 @@
-//-*-C++-*-
-//
-// set.h
-//
-// Simple set, based upon the array class.
-
-#ifndef rsxgl_set_H
-#define rsxgl_set_H
-
-#include "array.h"
-
-#include <memory>
-#include <functional>
-
-template< typename Type, typename SizeType, typename Compare = std::less< Type >, typename Alloc = std::allocator< void > >
-struct set : public array< Type, SizeType, Alloc > {
- typedef array< Type, SizeType, Alloc > array_type;
-
- typedef typename array_type::value_type value_type;
- typedef typename array_type::size_type size_type;
- typedef typename array_type::pointer_type pointer_type;
- typedef typename array_type::const_pointer_type const_pointer_type;
-
- typedef typename array_type::allocator allocator;
-
- struct type : protected array_type::type {
- type(pointer_type & _values,size_type & _size) : array_type::type(_values,_size) {}
- //type(const type & rhs) = default;
- //type(type && rhs) : array_type::type(rhs.values,rhs.size) {}
- type & operator =(const type & rhs) = delete;
-
- void construct() {
- array_type::type::construct(0);
- }
-
- void destruct() {
- array_type::type::destruct();
- }
-
- size_type get_size() const {
- return array_type::type::size;
- }
-
- bool insert(const value_type & x) const {
- pointer_type it = std::lower_bound(array_type::type::values,array_type::type::values + array_type::type::size,x,Compare());
-
- if(it != array_type::type::values + array_type::type::size && !Compare()(x,*it)) {
- return false;
- }
- else {
- const size_type i = it - array_type::type::values;
- const size_type _size = array_type::type::size + 1;
-
- allocator alloc;
- pointer_type tmp = (_size > 0) ? alloc.allocate(_size) : 0;
-
- if(array_type::type::values != 0) {
- std::uninitialized_copy(array_type::type::values,it,tmp);
-
- std::uninitialized_copy(it,array_type::type::values + array_type::type::size,tmp + i + 1);
- alloc.deallocate(array_type::type::values,array_type::type::size);
- }
-
- std::uninitialized_copy(&x,&x + 1,tmp + i);
-
- array_type::type::values = tmp;
- array_type::type::size = _size;
-
- return true;
- }
- }
-
- bool erase(const value_type & x) const {
- pointer_type it = std::lower_bound(array_type::type::values,array_type::type::values + array_type::type::size,x,Compare());
-
- if(it != array_type::type::values + array_type::type::size && !Compare()(x,*it)) {
- const size_type i = it - array_type::type::values;
- const size_type _size = array_type::type::size - 1;
-
- allocator alloc;
- pointer_type tmp = (_size > 0) ? alloc.allocate(_size) : 0;
-
- if(array_type::type::values != 0) {
- std::uninitialized_copy(array_type::type::values,it,tmp);
- std::uninitialized_copy(it + 1,array_type::type::values + array_type::type::size,tmp + i);
- alloc.deallocate(array_type::type::values,array_type::type::size);
- }
-
- array_type::type::values = tmp;
- array_type::type::size = _size;
-
- return true;
- }
- else {
- return false;
- }
- }
-
- bool has(const value_type & x) const {
- return binary_search(array_type::type::values,array_type::type::values + array_type::type::size,x,Compare());
- }
-
- value_type & operator[](size_type i) {
- assert(i < array_type::type::size);
- return array_type::type::values[i];
- }
-
- void clear() {
- destruct();
- construct();
- }
- };
-
- struct const_type : protected array_type::const_type {
- const_type(const const_pointer_type & _values,const size_type & _size) : array_type::const_type(_values,_size) {}
- //const_type(const const_type & rhs) = default;
- //const_type(const_type && rhs) : array_type::const_type(rhs.values,rhs.size) {}
- const_type & operator =(const type & rhs) = delete;
-
- size_type get_size() const {
- return array_type::const_type::size;
- }
-
- bool has(const value_type & x) const {
- return binary_search(array_type::const_type::values,array_type::const_type::values + array_type::const_type::size,x,Compare());
- }
-
- const value_type & operator[](size_type i) const {
- assert(i < array_type::const_type::size);
- return array_type::const_type::values[i];
- }
- };
-
- static void assign(type lhs,const_type rhs) {
- }
-};
-
-#endif

0 comments on commit 459d69e

Please sign in to comment.