コード例 #1
0
ファイル: es2util.cpp プロジェクト: gamecip/em-fceux
void deleteMesh(es2_mesh *p)
{
    for (int i = 0; i < p->num_varrays; i++) {
        deleteBuffer(&p->varrays[i]._buf);
    }
    deleteBuffer(&p->elem_buf);
}
コード例 #2
0
ファイル: socket.c プロジェクト: KaSt/nereamud
void clear_socket(SOCKET_DATA *sock_new, int sock)
{
  if(sock_new->page_string)    free(sock_new->page_string);
  if(sock_new->text_editor)    deleteBuffer(sock_new->text_editor);
  if(sock_new->outbuf)         deleteBuffer(sock_new->outbuf);
  if(sock_new->next_command)   deleteBuffer(sock_new->next_command);
  if(sock_new->iac_sequence)   deleteBuffer(sock_new->iac_sequence);
  if(sock_new->input_handlers) deleteListWith(sock_new->input_handlers, deleteInputHandler);
  if(sock_new->auxiliary)      deleteAuxiliaryData(sock_new->auxiliary);
  if(sock_new->input)          deleteListWith(sock_new->input, free);
  if(sock_new->command_hist)   deleteListWith(sock_new->command_hist, free);

  bzero(sock_new, sizeof(*sock_new));
  sock_new->auxiliary = newAuxiliaryData(AUXILIARY_TYPE_SOCKET);
  sock_new->input_handlers = newList();
  sock_new->input          = newList();
  sock_new->command_hist   = newList();
  sock_new->control        = sock;
  sock_new->lookup_status  = TSTATE_LOOKUP;
  sock_new->uid            = next_sock_uid++;

  sock_new->text_editor    = newBuffer(1);
  sock_new->outbuf         = newBuffer(MAX_OUTPUT);
  sock_new->next_command   = newBuffer(1);
  sock_new->iac_sequence   = newBuffer(1);
}
コード例 #3
0
ファイル: GLHelper.cpp プロジェクト: enginmanap/uberGame
GLHelper::~GLHelper() {
    for (int i = 0; i < bufferObjects.size(); ++i) {
        deleteBuffer(1, bufferObjects[i]);
    }

    deleteBuffer(1, lightUBOLocation);
    deleteBuffer(1, playerUBOLocation);
    deleteBuffer(1, depthMap);
    glDeleteFramebuffers(1, &depthOnlyFrameBuffer); //maybe we should wrap this up too
    //state->setProgram(0);
}
コード例 #4
0
ファイル: socket.c プロジェクト: KaSt/nereamud
//*****************************************************************************
//
// SOCKET MAINTENANCE
//
// Functions below this point are mainly concerned with the upkeep and
// maintenance of sockets (making sure they are initialized, garbage collected, 
// getting their addresses, etc...)
//
//*****************************************************************************
void deleteSocket(SOCKET_DATA *sock) {
  if(sock->hostname)      free(sock->hostname);
  if(sock->page_string)   free(sock->page_string);
  if(sock->text_editor)   deleteBuffer(sock->text_editor);
  if(sock->outbuf)        deleteBuffer(sock->outbuf);
  if(sock->next_command)  deleteBuffer(sock->next_command);
  if(sock->iac_sequence)  deleteBuffer(sock->iac_sequence);
  if(sock->input_handlers)deleteListWith(sock->input_handlers,deleteInputHandler);
  if(sock->input)         deleteListWith(sock->input, free);
  if(sock->command_hist)  deleteListWith(sock->command_hist, free);
  if(sock->auxiliary)     deleteAuxiliaryData(sock->auxiliary);
  free(sock);
}
コード例 #5
0
void RenderBufferCache::clear() {
    size_t count = mCache.size();
    for (size_t i = 0; i < count; i++) {
        deleteBuffer(mCache.itemAt(i).mBuffer);
    }
    mCache.clear();
}
コード例 #6
0
ファイル: FXAA.cpp プロジェクト: FallenShard/blades-engine
    void FXAA::initVAO()
    {
        auto bufferManager = m_renderer->getDeviceBufferManager();

        std::vector<GLfloat> m_quad;
        m_quad.push_back(-1.f); m_quad.push_back(-1.f);
        m_quad.push_back(+1.f); m_quad.push_back(-1.f);
        m_quad.push_back(+1.f); m_quad.push_back(+1.f);
        m_quad.push_back(-1.f); m_quad.push_back(+1.f); 

        GLuint vbo = bufferManager->allocate(m_quad.size() * sizeof(GLfloat), GL_MAP_WRITE_BIT);
        bufferManager->update(vbo, m_quad);

        std::vector<GLushort> m_quadIbo;
        m_quadIbo.push_back(0); m_quadIbo.push_back(1); m_quadIbo.push_back(2);
        m_quadIbo.push_back(0); m_quadIbo.push_back(2); m_quadIbo.push_back(3);

        GLuint ibo = bufferManager->allocate(m_quadIbo.size() * sizeof(GLushort), GL_MAP_WRITE_BIT);
        bufferManager->update(ibo, m_quadIbo);

        VertexLayout layout;
        layout.indexBuffer = ibo;
        layout.vertexBuffers.emplace_back(0, BufferDescriptor{ vbo, 0, 2 * sizeof(GLfloat) });
        layout.attributes.emplace_back(0, AttributeFormat{ VertexAttrib::Position, 2, 0 });
        m_vao = m_renderer->getVertexAssembly()->createInputState(layout);

        bufferManager->deleteBuffer(vbo);
        bufferManager->deleteBuffer(ibo);
    }
コード例 #7
0
ResourceManager::~ResourceManager()
{
    while (!mBufferMap.empty())
    {
        deleteBuffer(mBufferMap.begin()->first);
    }

    while (!mProgramMap.empty())
    {
        deleteProgram(mProgramMap.begin()->first);
    }

    while (!mShaderMap.empty())
    {
        deleteShader(mShaderMap.begin()->first);
    }

    while (!mRenderbufferMap.empty())
    {
        deleteRenderbuffer(mRenderbufferMap.begin()->first);
    }

    while (!mTextureMap.empty())
    {
        deleteTexture(mTextureMap.begin()->first);
    }
}
コード例 #8
0
bool RenderBufferCache::put(RenderBuffer* buffer) {
    if (!buffer) return false;

    const uint32_t size = buffer->getSize();
    if (size < mMaxSize) {
        while (mSize + size > mMaxSize) {
            size_t position = 0;

            RenderBuffer* victim = mCache.itemAt(position).mBuffer;
            deleteBuffer(victim);
            mCache.removeAt(position);
        }

        RenderBufferEntry entry(buffer);

        mCache.add(entry);
        mSize += size;

        RENDER_BUFFER_LOGD("Added %s render buffer (%dx%d)",
                RenderBuffer::formatName(buffer->getFormat()),
                buffer->getWidth(), buffer->getHeight());

        return true;
    }
    return false;
}
コード例 #9
0
ファイル: room_reset.c プロジェクト: KaSt/nereamud
void           deleteReset      (RESET_DATA *reset) {
  // delete all that are attached to us
  deleteListWith(reset->in,   deleteReset);
  deleteListWith(reset->on,   deleteReset);
  deleteListWith(reset->then, deleteReset);
  deleteBuffer(reset->arg);
  free(reset);
}
コード例 #10
0
ファイル: hedit.c プロジェクト: KaSt/nereamud
void deleteHelpOLC(HELP_OLC *data) {
  if(data->old_keywords) free(data->old_keywords);
  if(data->keywords)     free(data->keywords);
  if(data->user_groups)  free(data->user_groups);
  if(data->related)      free(data->related);
  if(data->info)         deleteBuffer(data->info);
  free(data);
}
コード例 #11
0
ファイル: parse.c プロジェクト: KaSt/nereamud
//
// Takes a list of tokens, and builds the proper syntax for the command and
// then sends it to the character.
void show_parse_syntax_error(CHAR_DATA *ch, const char *cmd, LIST *tokens) {
  BUFFER            *buf = newBuffer(1);
  LIST_ITERATOR   *tok_i = newListIterator(tokens);
  PARSE_TOKEN       *tok = NULL;
  bool    optional_found = FALSE;
  int              count = 0;

  // go through all of our tokens, and append their syntax to the buf
  ITERATE_LIST(tok, tok_i) {
    // make sure we add a space before anything else...
    if(count > 0)
      bprintf(buf, " ");
    count++;

    // have we encountered the "optional" marker? if so, switch our open/close
    if(tok->type == PARSE_TOKEN_OPTIONAL) {
      bprintf(buf, "[");
      optional_found = TRUE;
      // we don't want to put a space right after this [
      count = 0;
      continue;
    }

    // append our message
    switch(tok->type) {
    case PARSE_TOKEN_MULTI: {
      bprintf(buf, "<");
      LIST_ITERATOR *multi_i = newListIterator(tok->token_list);
      PARSE_TOKEN      *mtok = NULL;
      int            m_count = 0;
      ITERATE_LIST(mtok, multi_i) {
	if(m_count > 0)
	  bprintf(buf, ", ");
	m_count++;
	bprintf(buf, "%s", get_datatype_format_error_mssg(mtok));
      } deleteListIterator(multi_i);
      bprintf(buf, ">");
      break;
    }

    case PARSE_TOKEN_FLAVOR:
      bprintf(buf, "%s%s%s", (tok->flavor_optional ? "[" : ""), tok->flavor,
	      (tok->flavor_optional ? "]" : ""));
      break;

    default:
      bprintf(buf, "<%s>", get_datatype_format_error_mssg(tok));
      break;
    }
  } deleteListIterator(tok_i);

  // send the message
  send_to_char(ch, "Proper syntax is: %s %s%s\r\n", cmd, bufferString(buf),
	       (optional_found ? "]" : ""));
  deleteBuffer(buf);
}
コード例 #12
0
ファイル: NSCPlugin.cpp プロジェクト: jonasoberschweiber/nscp
int NSCPlugin::commandLineExec(bool targeted, std::string &request, std::string &reply) {
	char *buffer = NULL;
	unsigned int len = 0;
	NSCAPI::nagiosReturn ret = commandLineExec(targeted, request.c_str(), request.size(), &buffer, &len);
	if (buffer != NULL) {
		reply = std::string(buffer, len);
		deleteBuffer(&buffer);
	}
	return ret;
}
コード例 #13
0
ファイル: NSCPlugin.cpp プロジェクト: jonasoberschweiber/nscp
NSCAPI::nagiosReturn NSCPlugin::fetchMetrics(std::string &request) {
	char *buffer = NULL;
	unsigned int len = 0;
	NSCAPI::nagiosReturn ret = fetchMetrics(&buffer, &len);
	if (buffer != NULL) {
		request = std::string(buffer, len);
		deleteBuffer(&buffer);
	}
	return ret;
}
コード例 #14
0
ファイル: NSCPlugin.cpp プロジェクト: jonasoberschweiber/nscp
NSCAPI::nagiosReturn NSCPlugin::handleNotification(const char *channel, std::string &request, std::string &reply) {
	char *buffer = NULL;
	unsigned int len = 0;
	NSCAPI::nagiosReturn ret = handleNotification(channel, request.c_str(), request.size(), &buffer, &len);
	if (buffer != NULL) {
		reply = std::string(buffer, len);
		deleteBuffer(&buffer);
	}
	return ret;
}
コード例 #15
0
ファイル: qikdraw.cpp プロジェクト: qpHalcy0n/Quad2012
QENGINE_API void destroyDraw()
{
	if(g_pTexturedEffect)
		delete g_pTexturedEffect;

	if( g_pColoredEffect )
		delete g_pColoredEffect;

	deleteBuffer(g_fullscreenQuad);
}
コード例 #16
0
int oclFluid3D::setForceBuffer(oclBuffer* iBuffer)
{
	if (iBuffer->count<cl_float4>() < mParticleCount)
	{
		iBuffer->resize<cl_float4>(mParticleCount);
		Log(WARN, this) << " libCL is resizing buffer " <<  iBuffer->getName() << " to " << mParticleCount;
	}
	deleteBuffer(bfForce);
	bfForce = iBuffer;
	return bindBuffers();
}
コード例 #17
0
ファイル: pysocket.c プロジェクト: KaSt/nereamud
//
// Send a message with Python statements potentially embedded in it. For 
//evaluating 
PyObject *PySocket_send(PyObject *self, PyObject *args, PyObject *kwds) {
  static char *kwlist[ ] = { "mssg", "dict", "newline", NULL };
  SOCKET_DATA *me = NULL;
  char      *text = NULL;
  PyObject  *dict = NULL;
  bool    newline = TRUE;

  if(!PyArg_ParseTupleAndKeywords(args, kwds, "s|Ob", kwlist, 
				  &text, &dict, &newline)) {
    PyErr_Format(PyExc_TypeError, "Invalid arguments supplied to Mudsock.send");
    return NULL;
  }

  // is dict None? set it to NULL for expand_to_char
  if(dict == Py_None)
    dict = NULL;

  // make sure the dictionary is a dictionary
  if(!(dict == NULL || PyDict_Check(dict))) {
    PyErr_Format(PyExc_TypeError, "Mudsock.send expects second argument to be a dict object.");
    return NULL;
  }
  
  // make sure we exist
  if( (me = PySocket_AsSocket(self)) == NULL) {
    PyErr_Format(PyExc_TypeError, "Tried to send nonexistent socket.");
    return NULL;
  }

  if(dict != NULL)
    PyDict_SetItemString(dict, "me", self);

  // build our script environment
  BUFFER   *buf = newBuffer(1);
  bufferCat(buf, text);

  // expand out our dynamic descriptions if we have a dictionary supplied
  if(dict != NULL) {
    PyObject *env = restricted_script_dict();
    PyDict_Update(env, dict);

    // do the expansion
    expand_dynamic_descs_dict(buf, env, get_script_locale());
    Py_XDECREF(env);
  }

  if(newline == TRUE)
    bufferCat(buf, "\r\n");
  text_to_buffer(me, bufferString(buf));

  // garbage collection
  deleteBuffer(buf);
  return Py_BuildValue("");
}
コード例 #18
0
int oclFluid3D::setPositionBuffer(oclBuffer* iBuffer)
{
	if (iBuffer->count<cl_float4>() != mParticleCount)
	{
		iBuffer->resize<cl_float4>(mParticleCount);
		Log(WARN, this) << " resizing buffer " <<  iBuffer->getName() << " to " << mParticleCount;
	}
	deleteBuffer(bfPosition);
	bfPosition = iBuffer;
	return bindBuffers();
}
コード例 #19
0
ファイル: GLHelper.cpp プロジェクト: enginmanap/uberGame
bool GLHelper::freeBuffer(const GLuint bufferID) {
    for (int i = 0; i < bufferObjects.size(); ++i) {
        if (bufferObjects[i] == bufferID) {
            deleteBuffer(1, bufferObjects[i]);
            bufferObjects[i] = bufferObjects[bufferObjects.size() - 1];
            bufferObjects.pop_back();
            checkErrors("freeBuffer");
            return true;
        }
    }
    checkErrors("freeBuffer");
    return false;
}
コード例 #20
0
ファイル: GLHelper.cpp プロジェクト: enginmanap/uberGame
bool GLHelper::freeVAO(const GLuint bufferID) {
    for (int i = 0; i < vertexArrays.size(); ++i) {
        if (vertexArrays[i] == bufferID) {
            deleteBuffer(1, vertexArrays[i]);
            vertexArrays[i] = vertexArrays[vertexArrays.size() - 1];
            vertexArrays.pop_back();
            checkErrors("freeVAO");
            return true;
        }
    }
    checkErrors("freeVAO");
    return false;
}
コード例 #21
0
ファイル: pentax.cpp プロジェクト: peramikic/triggercord
std::string Camera::shoot()
{
    if (pslr_shutter(theHandle) != PSLR_OK)
    {
	DPRINT("Did not shoot.");
	return "";
    };
    std::string fn = getFilename();
    while (!saveBuffer(fn))
	usleep(10000);
    deleteBuffer();
    DPRINT("Shot.");
    return lastFilename;
}
コード例 #22
0
ファイル: pix_movieOS.cpp プロジェクト: megrimm/Gem
/////////////////////////////////////////////////////////
// Buffer for Frames
//
/////////////////////////////////////////////////////////
void pix_movieOS :: createBuffer()
{
  int neededXSize = powerOfTwo(m_xsize);
  int neededYSize = powerOfTwo(m_ysize);

  deleteBuffer();
  int dataSize = neededXSize * neededYSize * m_csize;
  m_pixBlock.image.data = new unsigned char[dataSize];
  m_data=m_pixBlock.image.data; // ??????????????
  memset(m_pixBlock.image.data, 0, dataSize);
  m_frame =/*(char*)*/m_pixBlock.image.data;

  m_pixBlock.image.xsize  = neededXSize;
  m_pixBlock.image.ysize  = neededYSize;
  m_pixBlock.image.csize  = m_csize;
  m_pixBlock.image.format = m_format;
}
コード例 #23
0
ResourceManager::~ResourceManager()
{
    while (!mBufferMap.empty())
    {
        deleteBuffer(mBufferMap.begin()->first);
    }

    while (!mProgramMap.empty())
    {
        deleteProgram(mProgramMap.begin()->first);
    }

    while (!mShaderMap.empty())
    {
        deleteShader(mShaderMap.begin()->first);
    }

    while (!mRenderbufferMap.empty())
    {
        deleteRenderbuffer(mRenderbufferMap.begin()->first);
    }

    while (!mTextureMap.empty())
    {
        deleteTexture(mTextureMap.begin()->first);
    }

    while (!mSamplerMap.empty())
    {
        deleteSampler(mSamplerMap.begin()->first);
    }

    while (!mFenceSyncMap.empty())
    {
        deleteFenceSync(mFenceSyncMap.begin()->first);
    }

    for (auto it = mPathMap.begin(); it != mPathMap.end(); ++it)
    {
        const auto *p = it->second;
        delete p;
    }
}
コード例 #24
0
ファイル: socket.c プロジェクト: KaSt/nereamud
bool flush_output(SOCKET_DATA *dsock) {
  bool  success = TRUE;
  BUFFER   *buf = NULL;

  // run any hooks prior to flushing our text
  hookRun("flush", hookBuildInfo("sk", dsock));

  // quit if we have no output and don't need/can't have a prompt
  if(bufferLength(dsock->outbuf) <= 0 && 
     (!dsock->bust_prompt || !socketHasPrompt(dsock)))
    return success;

  buf = newBuffer(1);

  // send our outbound text
  if(bufferLength(dsock->outbuf) > 0) {
    hookRun("process_outbound_text",  hookBuildInfo("sk", dsock));
    hookRun("finalize_outbound_text", hookBuildInfo("sk", dsock));
    //success = text_to_socket(dsock, bufferString(dsock->outbuf));
    bufferCat(buf, bufferString(dsock->outbuf));
    bufferClear(dsock->outbuf);
  }

  // send our prompt
  if(dsock->bust_prompt && success) {
    socketShowPrompt(dsock);
    hookRun("process_outbound_prompt",  hookBuildInfo("sk", dsock));
    hookRun("finalize_outbound_prompt", hookBuildInfo("sk", dsock));
    //success = text_to_socket(dsock, bufferString(dsock->outbuf));
    bufferCat(buf, bufferString(dsock->outbuf));
    bufferClear(dsock->outbuf);
    dsock->bust_prompt = FALSE;
  }

  success = text_to_socket(dsock, bufferString(buf));
  deleteBuffer(buf);

  // return our success
  return success;
}
コード例 #25
0
void expand_to_char(CHAR_DATA *ch, const char *mssg, PyObject *dict, 
		    const char *locale, bool newline) {
  BUFFER *buf = newBuffer(1);
  bufferCat(buf, mssg);
  if(dict != NULL) {
    // build the script dictionary
    PyObject *script_dict = restricted_script_dict();
    PyDict_Update(script_dict, dict);

    // do the expansion
    expand_dynamic_descs_dict(buf, script_dict, locale);

    // garbage collection and end
    Py_XDECREF(script_dict);
  }

  if(newline == TRUE)
    bufferCat(buf, "\r\n");
  text_to_char(ch, bufferString(buf));

  // garbage collection
  deleteBuffer(buf);
}
コード例 #26
0
ファイル: pix_movieOS.cpp プロジェクト: megrimm/Gem
/////////////////////////////////////////////////////////
// Destructor
//
/////////////////////////////////////////////////////////
pix_movieOS :: ~pix_movieOS()
{
  // Clean up the movie
  closeMess();
  deleteBuffer();
}
コード例 #27
0
 virtual void genBuffer() override {
     deleteBuffer();
     glGenBuffers(1, &_bufferId);
 }
コード例 #28
0
oclFluid3D::~oclFluid3D()
{
	deleteBuffer(bfPosition);
	deleteBuffer(bfVelocity);
	deleteBuffer(bfForce);
}
コード例 #29
0
	~Buffer()
	{
		deleteBuffer();
		size = 0;
	}
コード例 #30
0
GLHardwareBuffer::~GLHardwareBuffer()
{
    deleteBuffer();
}