This commit is contained in:
Branimir Karadžić 2017-02-06 16:22:08 -08:00
Родитель dd9f1a235f
Коммит 64922762df
6 изменённых файлов: 44 добавлений и 44 удалений

Просмотреть файл

@ -828,7 +828,7 @@ void VectorDisplay::genLinetex() // generate
const bgfx::Memory* mem = bgfx::alloc(TEXTURE_SIZE * TEXTURE_SIZE * 4);
unsigned char* texbuf = (unsigned char*)mem->data;
memset(texbuf, 0xff, mem->size);
bx::memSet(texbuf, 0xff, mem->size);
int x, y;
for (x = 0; x < TEXTURE_SIZE; x++)
{

Просмотреть файл

@ -9,7 +9,7 @@
void aabbToObb(Obb& _obb, const Aabb& _aabb)
{
memset(_obb.m_mtx, 0, sizeof(_obb.m_mtx) );
bx::memSet(_obb.m_mtx, 0, sizeof(_obb.m_mtx) );
_obb.m_mtx[ 0] = (_aabb.m_max[0] - _aabb.m_min[0]) * 0.5f;
_obb.m_mtx[ 5] = (_aabb.m_max[1] - _aabb.m_min[1]) * 0.5f;
_obb.m_mtx[10] = (_aabb.m_max[2] - _aabb.m_min[2]) * 0.5f;
@ -91,7 +91,7 @@ void aabbTransformToObb(Obb& _obb, const Aabb& _aabb, const float* _mtx)
aabbToObb(_obb, _aabb);
float result[16];
bx::mtxMul(result, _obb.m_mtx, _mtx);
memcpy(_obb.m_mtx, result, sizeof(result) );
bx::memCopy(_obb.m_mtx, result, sizeof(result) );
}
void toAabb(Aabb& _aabb, const void* _vertices, uint32_t _numVertices, uint32_t _stride)
@ -252,7 +252,7 @@ void calcObb(Obb& _obb, const void* _vertices, uint32_t _numVertices, uint32_t _
ax += angleStep;
}
memcpy(&_obb, &best, sizeof(Obb) );
bx::memCopy(&_obb, &best, sizeof(Obb) );
}
void calcMaxBoundingSphere(Sphere& _sphere, const void* _vertices, uint32_t _numVertices, uint32_t _stride)

Просмотреть файл

@ -449,7 +449,7 @@ struct DebugDraw
const uint32_t numIndices = numVertices;
vertices[id] = BX_ALLOC(m_allocator, numVertices*stride);
memset(vertices[id], 0, numVertices*stride);
bx::memSet(vertices[id], 0, numVertices*stride);
genSphere(tess, vertices[id], stride);
uint16_t* trilist = (uint16_t*)BX_ALLOC(m_allocator, numIndices*sizeof(uint16_t) );
@ -467,7 +467,7 @@ struct DebugDraw
);
indices[id] = (uint16_t*)BX_ALLOC(m_allocator, (numIndices + numLineListIndices)*sizeof(uint16_t) );
uint16_t* indicesOut = indices[id];
memcpy(indicesOut, trilist, numIndices*sizeof(uint16_t) );
bx::memCopy(indicesOut, trilist, numIndices*sizeof(uint16_t) );
bgfx::topologyConvert(bgfx::TopologyConvert::TriListToLineList
, &indicesOut[numIndices]
@ -503,7 +503,7 @@ struct DebugDraw
vertices[id] = BX_ALLOC(m_allocator, numVertices*stride);
indices[id] = (uint16_t*)BX_ALLOC(m_allocator, (numIndices + numLineListIndices)*sizeof(uint16_t) );
memset(indices[id], 0, (numIndices + numLineListIndices)*sizeof(uint16_t) );
bx::memSet(indices[id], 0, (numIndices + numLineListIndices)*sizeof(uint16_t) );
DebugShapeVertex* vertex = (DebugShapeVertex*)vertices[id];
uint16_t* index = indices[id];
@ -564,7 +564,7 @@ struct DebugDraw
vertices[id] = BX_ALLOC(m_allocator, numVertices*stride);
indices[id] = (uint16_t*)BX_ALLOC(m_allocator, (numIndices + numLineListIndices)*sizeof(uint16_t) );
memset(indices[id], 0, (numIndices + numLineListIndices)*sizeof(uint16_t) );
bx::memSet(indices[id], 0, (numIndices + numLineListIndices)*sizeof(uint16_t) );
DebugShapeVertex* vertex = (DebugShapeVertex*)vertices[id];
uint16_t* index = indices[id];
@ -634,7 +634,7 @@ struct DebugDraw
vertices[id] = BX_ALLOC(m_allocator, numVertices*stride);
indices[id] = (uint16_t*)BX_ALLOC(m_allocator, (numIndices + numLineListIndices)*sizeof(uint16_t) );
memset(indices[id], 0, (numIndices + numLineListIndices)*sizeof(uint16_t) );
bx::memSet(indices[id], 0, (numIndices + numLineListIndices)*sizeof(uint16_t) );
DebugShapeVertex* vertex = (DebugShapeVertex*)vertices[id];
uint16_t* index = indices[id];
@ -706,12 +706,12 @@ struct DebugDraw
for (uint32_t mesh = Mesh::Sphere0; mesh < Mesh::Cube; ++mesh)
{
Mesh::Enum id = Mesh::Enum(mesh);
memcpy(&vb->data[m_mesh[id].m_startVertex * stride]
bx::memCopy(&vb->data[m_mesh[id].m_startVertex * stride]
, vertices[id]
, m_mesh[id].m_numVertices*stride
);
memcpy(&ib->data[m_mesh[id].m_startIndex[0] * sizeof(uint16_t)]
bx::memCopy(&ib->data[m_mesh[id].m_startIndex[0] * sizeof(uint16_t)]
, indices[id]
, (m_mesh[id].m_numIndices[0]+m_mesh[id].m_numIndices[1])*sizeof(uint16_t)
);
@ -720,12 +720,12 @@ struct DebugDraw
BX_FREE(m_allocator, indices[id]);
}
memcpy(&vb->data[m_mesh[Mesh::Cube].m_startVertex * stride]
bx::memCopy(&vb->data[m_mesh[Mesh::Cube].m_startVertex * stride]
, s_cubeVertices
, sizeof(s_cubeVertices)
);
memcpy(&ib->data[m_mesh[Mesh::Cube].m_startIndex[0] * sizeof(uint16_t)]
bx::memCopy(&ib->data[m_mesh[Mesh::Cube].m_startIndex[0] * sizeof(uint16_t)]
, s_cubeIndices
, sizeof(s_cubeIndices)
);
@ -849,7 +849,7 @@ struct DebugDraw
bgfx::Transform transform;
m_mtx = bgfx::allocTransform(&transform, 1);
memcpy(transform.data, _mtx, 64);
bx::memCopy(transform.data, _mtx, 64);
}
void setTranslate(float _x, float _y, float _z)
@ -992,14 +992,14 @@ struct DebugDraw
flush();
memcpy(&m_cache[0], &m_cache[vertexPos], sizeof(DebugVertex) );
bx::memCopy(&m_cache[0], &m_cache[vertexPos], sizeof(DebugVertex) );
if (vertexPos == pos)
{
m_pos = 1;
}
else
{
memcpy(&m_cache[1], &m_cache[pos - 1], sizeof(DebugVertex) );
bx::memCopy(&m_cache[1], &m_cache[pos - 1], sizeof(DebugVertex) );
m_pos = 2;
}
@ -1466,7 +1466,7 @@ struct DebugDraw
float mtx[2][16];
bx::mtxFromNormal(mtx[0], normal, _radius, _from, attrib.m_spin);
memcpy(mtx[1], mtx[0], 64);
bx::memCopy(mtx[1], mtx[0], 64);
mtx[1][12] = _to[0];
mtx[1][13] = _to[1];
mtx[1][14] = _to[2];
@ -1496,7 +1496,7 @@ struct DebugDraw
float mtx[2][16];
bx::mtxFromNormal(mtx[0], normal, _radius, _from, attrib.m_spin);
memcpy(mtx[1], mtx[0], 64);
bx::memCopy(mtx[1], mtx[0], 64);
mtx[1][12] = _to[0];
mtx[1][13] = _to[1];
mtx[1][14] = _to[2];
@ -1843,11 +1843,11 @@ private:
{
bgfx::TransientVertexBuffer tvb;
bgfx::allocTransientVertexBuffer(&tvb, m_pos, DebugVertex::ms_decl);
memcpy(tvb.data, m_cache, m_pos * DebugVertex::ms_decl.m_stride);
bx::memCopy(tvb.data, m_cache, m_pos * DebugVertex::ms_decl.m_stride);
bgfx::TransientIndexBuffer tib;
bgfx::allocTransientIndexBuffer(&tib, m_indexPos);
memcpy(tib.data, m_indices, m_indexPos * sizeof(uint16_t) );
bx::memCopy(tib.data, m_indices, m_indexPos * sizeof(uint16_t) );
const Attrib& attrib = m_attrib[m_stack];
@ -1881,7 +1881,7 @@ private:
{
bgfx::TransientVertexBuffer tvb;
bgfx::allocTransientVertexBuffer(&tvb, m_posQuad, DebugUvVertex::ms_decl);
memcpy(tvb.data, m_cacheQuad, m_posQuad * DebugUvVertex::ms_decl.m_stride);
bx::memCopy(tvb.data, m_cacheQuad, m_posQuad * DebugUvVertex::ms_decl.m_stride);
bgfx::TransientIndexBuffer tib;
bgfx::allocTransientIndexBuffer(&tib, numIndices);

Просмотреть файл

@ -190,7 +190,7 @@ namespace
int old = gl->ctextures;
gl->ctextures = (gl->ctextures == 0) ? 2 : gl->ctextures*2;
gl->textures = (struct GLNVGtexture*)BX_REALLOC(gl->m_allocator, gl->textures, sizeof(struct GLNVGtexture)*gl->ctextures);
memset(&gl->textures[old], 0xff, (gl->ctextures-old)*sizeof(struct GLNVGtexture) );
bx::memSet(&gl->textures[old], 0xff, (gl->ctextures-old)*sizeof(struct GLNVGtexture) );
if (gl->textures == NULL)
{
@ -200,7 +200,7 @@ namespace
tex = &gl->textures[gl->ntextures++];
}
memset(tex, 0, sizeof(*tex) );
bx::memSet(tex, 0, sizeof(*tex) );
return tex;
}
@ -230,7 +230,7 @@ namespace
{
bgfx::destroyTexture(gl->textures[ii].id);
}
memset(&gl->textures[ii], 0, sizeof(gl->textures[ii]) );
bx::memSet(&gl->textures[ii], 0, sizeof(gl->textures[ii]) );
gl->textures[ii].id.idx = bgfx::invalidHandle;
return 1;
}
@ -252,7 +252,7 @@ namespace
const bgfx::Memory* mem = bgfx::alloc(4*4*4);
uint32_t* bgra8 = (uint32_t*)mem->data;
memset(bgra8, 0, 4*4*4);
bx::memSet(bgra8, 0, 4*4*4);
gl->texMissing = bgfx::createTexture2D(4, 4, false, 1, bgfx::TextureFormat::BGRA8, 0, mem);
gl->u_scissorMat = bgfx::createUniform("u_scissorMat", bgfx::UniformType::Mat3);
@ -415,14 +415,14 @@ namespace
struct GLNVGtexture* tex = NULL;
float invxform[6] = {};
memset(frag, 0, sizeof(*frag) );
bx::memSet(frag, 0, sizeof(*frag) );
frag->innerCol = glnvg__premulColor(paint->innerColor);
frag->outerCol = glnvg__premulColor(paint->outerColor);
if (scissor->extent[0] < -0.5f || scissor->extent[1] < -0.5f)
{
memset(frag->scissorMat, 0, sizeof(frag->scissorMat) );
bx::memSet(frag->scissorMat, 0, sizeof(frag->scissorMat) );
frag->scissorExt[0] = 1.0f;
frag->scissorExt[1] = 1.0f;
frag->scissorScale[0] = 1.0f;
@ -437,7 +437,7 @@ namespace
frag->scissorScale[0] = sqrtf(scissor->xform[0]*scissor->xform[0] + scissor->xform[2]*scissor->xform[2]) / fringe;
frag->scissorScale[1] = sqrtf(scissor->xform[1]*scissor->xform[1] + scissor->xform[3]*scissor->xform[3]) / fringe;
}
memcpy(frag->extent, paint->extent, sizeof(frag->extent) );
bx::memCopy(frag->extent, paint->extent, sizeof(frag->extent) );
frag->strokeMult = (width*0.5f + fringe*0.5f) / fringe;
gl->th = gl->texMissing;
@ -730,7 +730,7 @@ namespace
BX_WARN(true, "Vertex number truncated due to transient vertex buffer overflow");
}
memcpy(gl->tvb.data, gl->verts, gl->nverts * sizeof(struct NVGvertex) );
bx::memCopy(gl->tvb.data, gl->verts, gl->nverts * sizeof(struct NVGvertex) );
gl->state = glnvg__blendCompositeOperation(compositeOperation)
| BGFX_STATE_RGB_WRITE
@ -792,7 +792,7 @@ namespace
gl->calls = (struct GLNVGcall*)BX_REALLOC(gl->m_allocator, gl->calls, sizeof(struct GLNVGcall) * gl->ccalls);
}
ret = &gl->calls[gl->ncalls++];
memset(ret, 0, sizeof(struct GLNVGcall) );
bx::memSet(ret, 0, sizeof(struct GLNVGcall) );
return ret;
}
@ -878,12 +878,12 @@ namespace
{
struct GLNVGpath* copy = &gl->paths[call->pathOffset + i];
const struct NVGpath* path = &paths[i];
memset(copy, 0, sizeof(struct GLNVGpath) );
bx::memSet(copy, 0, sizeof(struct GLNVGpath) );
if (path->nfill > 0)
{
copy->fillOffset = offset;
copy->fillCount = path->nfill;
memcpy(&gl->verts[offset], path->fill, sizeof(struct NVGvertex) * path->nfill);
bx::memCopy(&gl->verts[offset], path->fill, sizeof(struct NVGvertex) * path->nfill);
offset += path->nfill;
}
@ -891,7 +891,7 @@ namespace
{
copy->strokeOffset = offset;
copy->strokeCount = path->nstroke;
memcpy(&gl->verts[offset], path->stroke, sizeof(struct NVGvertex) * path->nstroke);
bx::memCopy(&gl->verts[offset], path->stroke, sizeof(struct NVGvertex) * path->nstroke);
offset += path->nstroke;
}
}
@ -914,7 +914,7 @@ namespace
call->uniformOffset = glnvg__allocFragUniforms(gl, 2);
// Simple shader for stencil
frag = nvg__fragUniformPtr(gl, call->uniformOffset);
memset(frag, 0, sizeof(*frag) );
bx::memSet(frag, 0, sizeof(*frag) );
frag->type = NSVG_SHADER_SIMPLE;
// Fill shader
glnvg__convertPaint(gl, nvg__fragUniformPtr(gl, call->uniformOffset + gl->fragSize), paint, scissor, fringe, fringe);
@ -948,12 +948,12 @@ namespace
{
struct GLNVGpath* copy = &gl->paths[call->pathOffset + i];
const struct NVGpath* path = &paths[i];
memset(copy, 0, sizeof(struct GLNVGpath) );
bx::memSet(copy, 0, sizeof(struct GLNVGpath) );
if (path->nstroke)
{
copy->strokeOffset = offset;
copy->strokeCount = path->nstroke;
memcpy(&gl->verts[offset], path->stroke, sizeof(struct NVGvertex) * path->nstroke);
bx::memCopy(&gl->verts[offset], path->stroke, sizeof(struct NVGvertex) * path->nstroke);
offset += path->nstroke;
}
}
@ -976,7 +976,7 @@ namespace
// Allocate vertices for all the paths.
call->vertexOffset = glnvg__allocVerts(gl, nverts);
call->vertexCount = nverts;
memcpy(&gl->verts[call->vertexOffset], verts, sizeof(struct NVGvertex) * nverts);
bx::memCopy(&gl->verts[call->vertexOffset], verts, sizeof(struct NVGvertex) * nverts);
// Fill shader
call->uniformOffset = glnvg__allocFragUniforms(gl, 1);
@ -1048,9 +1048,9 @@ NVGcontext* nvgCreate(int edgeaa, unsigned char _viewId, bx::AllocatorI* _alloca
struct NVGcontext* ctx = NULL;
struct GLNVGcontext* gl = (struct GLNVGcontext*)BX_ALLOC(_allocator, sizeof(struct GLNVGcontext) );
if (gl == NULL) goto error;
memset(gl, 0, sizeof(struct GLNVGcontext) );
bx::memSet(gl, 0, sizeof(struct GLNVGcontext) );
memset(&params, 0, sizeof(params) );
bx::memSet(&params, 0, sizeof(params) );
params.renderCreate = nvgRenderCreate;
params.renderCreateTexture = nvgRenderCreateTexture;
params.renderDeleteTexture = nvgRenderDeleteTexture;

Просмотреть файл

@ -38,7 +38,7 @@ public:
{
m_bw = _width/64;
m_bh = _height/numBlocks;
memset(m_mem, 0xff, sizeof(m_mem) );
bx::memSet(m_mem, 0xff, sizeof(m_mem) );
}
bool find(uint16_t _width, uint16_t _height, Pack2D& _pack)

Просмотреть файл

@ -191,7 +191,7 @@ namespace ps
void reset()
{
m_num = 0;
memset(&m_aabb, 0, sizeof(Aabb) );
bx::memSet(&m_aabb, 0, sizeof(Aabb) );
}
void update(float _dt)
@ -206,7 +206,7 @@ namespace ps
{
if (ii != num-1)
{
memcpy(&particle, &m_particles[num-1], sizeof(Particle) );
bx::memCopy(&particle, &m_particles[num-1], sizeof(Particle) );
--ii;
}
@ -310,7 +310,7 @@ namespace ps
bx::vec3MulMtx(particle.end[0], end, mtx);
bx::vec3Add(particle.end[1], particle.end[0], gravity);
memcpy(particle.rgba, m_uniforms.m_rgba, BX_COUNTOF(m_uniforms.m_rgba)*sizeof(uint32_t) );
bx::memCopy(particle.rgba, m_uniforms.m_rgba, BX_COUNTOF(m_uniforms.m_rgba)*sizeof(uint32_t) );
particle.blendStart = bx::flerp(m_uniforms.m_blendStart[0], m_uniforms.m_blendStart[1], bx::frnd(&m_rng) );
particle.blendEnd = bx::flerp(m_uniforms.m_blendEnd[0], m_uniforms.m_blendEnd[1], bx::frnd(&m_rng) );
@ -602,7 +602,7 @@ namespace ps
}
else
{
memcpy(&emitter.m_uniforms, _uniforms, sizeof(EmitterUniforms) );
bx::memCopy(&emitter.m_uniforms, _uniforms, sizeof(EmitterUniforms) );
}
}