This commit is contained in:
Branimir Karadžić
2017-02-08 19:55:31 -08:00
parent aa2a9deb5f
commit b99ebb9535
46 changed files with 338 additions and 353 deletions

View File

@@ -15,9 +15,6 @@
#include "font/text_buffer_manager.h"
#include "imgui/imgui.h"
#include <stdio.h>
#include <string.h>
TrueTypeHandle loadTtf(FontManager* _fm, const char* _filePath)
{
uint32_t size;

View File

@@ -58,7 +58,7 @@ class ExampleLod : public entry::AppI
m_textureBark = loadTexture("textures/bark1.dds");
const bgfx::Memory* stippleTex = bgfx::alloc(8*4);
memset(stippleTex->data, 0, stippleTex->size);
bx::memSet(stippleTex->data, 0, stippleTex->size);
for (uint32_t ii = 0; ii < 32; ++ii)
{

View File

@@ -896,7 +896,7 @@ int _main_(int _argc, char** _argv)
lightRgbInnerR[ii][2] = rgbInnerR[index][2];
lightRgbInnerR[ii][3] = rgbInnerR[index][3];
}
memcpy(s_uniforms.m_lightRgbInnerR, lightRgbInnerR, MAX_NUM_LIGHTS * 4*sizeof(float) );
bx::memCopy(s_uniforms.m_lightRgbInnerR, lightRgbInnerR, MAX_NUM_LIGHTS * 4*sizeof(float) );
// Set view and projection matrices.
const float aspect = float(viewState.m_width)/float(viewState.m_height);
@@ -1026,7 +1026,7 @@ int _main_(int _argc, char** _argv)
lightPosRadius[ii][2] = cosf( (lightTimeAccumulator*1.3f + ii*0.13f + ii*bx::piHalf*1.79f ) )*20.0f;
lightPosRadius[ii][3] = radius;
}
memcpy(s_uniforms.m_lightPosRadius, lightPosRadius, numLights * 4*sizeof(float) );
bx::memCopy(s_uniforms.m_lightPosRadius, lightPosRadius, numLights * 4*sizeof(float) );
// Floor position.
float floorMtx[16];
@@ -1144,7 +1144,7 @@ int _main_(int _argc, char** _argv)
bx::vec3MulMtx(reflectedLights[ii], lightPosRadius[ii], reflectMtx);
reflectedLights[ii][3] = lightPosRadius[ii][3];
}
memcpy(s_uniforms.m_lightPosRadius, reflectedLights, numLights * 4*sizeof(float) );
bx::memCopy(s_uniforms.m_lightPosRadius, reflectedLights, numLights * 4*sizeof(float) );
// Reflect and submit bunny.
float mtxReflectedBunny[16];
@@ -1168,7 +1168,7 @@ int _main_(int _argc, char** _argv)
}
// Set lights back.
memcpy(s_uniforms.m_lightPosRadius, lightPosRadius, numLights * 4*sizeof(float) );
bx::memCopy(s_uniforms.m_lightPosRadius, lightPosRadius, numLights * 4*sizeof(float) );
// Third pass - Blend plane.
// Floor.
@@ -1237,7 +1237,7 @@ int _main_(int _argc, char** _argv)
float ground[4];
float plane_pos[3] = { 0.0f, 0.0f, 0.0f };
float normal[3] = { 0.0f, 1.0f, 0.0f };
memcpy(ground, normal, sizeof(float) * 3);
bx::memCopy(ground, normal, sizeof(float) * 3);
ground[3] = -bx::vec3Dot(plane_pos, normal) - 0.01f; // - 0.01 against z-fighting
for (uint8_t ii = 0, viewId = RENDER_VIEWID_RANGE5_PASS_6; ii < numLights; ++ii, ++viewId)
@@ -1250,7 +1250,7 @@ int _main_(int _argc, char** _argv)
// Get homogeneous light pos.
float* lightPos = lightPosRadius[ii];
float pos[4];
memcpy(pos, lightPos, sizeof(float) * 3);
bx::memCopy(pos, lightPos, sizeof(float) * 3);
pos[3] = 1.0f;
// Calculate shadow mtx for current light.

View File

@@ -3,9 +3,6 @@
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
*/
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
#include <map>
@@ -760,7 +757,7 @@ uint16_t weldVertices(WeldedVertex* _output, const bgfx::VertexDecl& _decl, cons
const uint32_t size = sizeof(uint16_t)*(hashSize + _num);
uint16_t* hashTable = (uint16_t*)alloca(size);
memset(hashTable, 0xff, size);
bx::memSet(hashTable, 0xff, size);
uint16_t* next = hashTable + hashSize;
@@ -888,7 +885,7 @@ struct Group
face.m_i[0] = i0;
face.m_i[1] = i1;
face.m_i[2] = i2;
memcpy(face.m_plane, plane, 4*sizeof(float) );
bx::memCopy(face.m_plane, plane, 4*sizeof(float) );
m_faces.push_back(face);
//Use unique indices for EdgeMap.
@@ -916,14 +913,14 @@ struct Group
if (iter != edgeMap.end() )
{
EdgeAndPlane& ep = iter->second;
memcpy(ep.m_plane[ep.m_faceIndex].m_plane, plane, 4*sizeof(float) );
bx::memCopy(ep.m_plane[ep.m_faceIndex].m_plane, plane, 4*sizeof(float) );
ep.m_faceReverseOrder[ep.m_faceIndex] = true;
}
else
{
std::pair<EdgeMap::iterator, bool> result = edgeMap.insert(std::make_pair(key, EdgeAndPlane(ui0, ui1) ) );
EdgeAndPlane& ep = result.first->second;
memcpy(ep.m_plane[ep.m_faceIndex].m_plane, plane, 4*sizeof(float) );
bx::memCopy(ep.m_plane[ep.m_faceIndex].m_plane, plane, 4*sizeof(float) );
ep.m_faceReverseOrder[ep.m_faceIndex] = false;
ep.m_faceIndex++;
}
@@ -938,8 +935,8 @@ struct Group
Edge* edge = &m_edges[m_numEdges];
Plane* plane = &m_edgePlanes[index];
memcpy(edge, iter->second.m_faceReverseOrder, sizeof(Edge) );
memcpy(plane, iter->second.m_plane, 2 * sizeof(Plane) );
bx::memCopy(edge, iter->second.m_faceReverseOrder, sizeof(Edge) );
bx::memCopy(plane, iter->second.m_plane, 2 * sizeof(Plane) );
m_numEdges++;
index += 2;
@@ -1002,7 +999,7 @@ struct Mesh
size = _numVertices*_decl.getStride();
group.m_vertices = (uint8_t*)malloc(size);
memcpy(group.m_vertices, _vertices, size);
bx::memCopy(group.m_vertices, _vertices, size);
mem = bgfx::makeRef(group.m_vertices, size);
group.m_vbh = bgfx::createVertexBuffer(mem, _decl);
@@ -1012,7 +1009,7 @@ struct Mesh
size = _numIndices*2;
group.m_indices = (uint16_t*)malloc(size);
memcpy(group.m_indices, _indices, size);
bx::memCopy(group.m_indices, _indices, size);
mem = bgfx::makeRef(group.m_indices, size);
group.m_ibh = bgfx::createIndexBuffer(mem);
@@ -1204,7 +1201,7 @@ struct Instance
void submit(uint8_t _viewId, const RenderState& _renderState)
{
memcpy(s_uniforms.m_color, m_color, 3*sizeof(float) );
bx::memCopy(s_uniforms.m_color, m_color, 3*sizeof(float) );
float mtx[16];
bx::mtxSRT(mtx
@@ -1374,7 +1371,7 @@ void shadowVolumeCreate(ShadowVolume& _shadowVolume
VertexData(const float* _v3, float _extrude = 0.0f, float _k = 1.0f)
{
memcpy(m_v, _v3, 3*sizeof(float) );
bx::memCopy(m_v, _v3, 3*sizeof(float) );
m_extrude = _extrude;
m_k = _k;
}
@@ -2575,9 +2572,9 @@ int _main_(int _argc, char** _argv)
{
const float* lightPos = lightPosRadius[ii];
memcpy(s_uniforms.m_lightPosRadius, lightPosRadius[ii], 4*sizeof(float) );
memcpy(s_uniforms.m_lightRgbInnerR, lightRgbInnerR[ii], 3*sizeof(float) );
memcpy(s_uniforms.m_color, lightRgbInnerR[ii], 3*sizeof(float) );
bx::memCopy(s_uniforms.m_lightPosRadius, lightPosRadius[ii], 4*sizeof(float) );
bx::memCopy(s_uniforms.m_lightRgbInnerR, lightRgbInnerR[ii], 3*sizeof(float) );
bx::memCopy(s_uniforms.m_color, lightRgbInnerR[ii], 3*sizeof(float) );
if (settings_useStencilTexture)
{
@@ -2639,7 +2636,7 @@ int _main_(int _argc, char** _argv)
);
// Set virtual light pos.
memcpy(s_uniforms.m_virtualLightPos_extrusionDist, transformedLightPos, 3*sizeof(float) );
bx::memCopy(s_uniforms.m_virtualLightPos_extrusionDist, transformedLightPos, 3*sizeof(float) );
s_uniforms.m_virtualLightPos_extrusionDist[3] = instance.m_svExtrusionDistance;
// Compute transform for shadow volume.
@@ -2786,7 +2783,7 @@ int _main_(int _argc, char** _argv)
const float lightScale[3] = { 1.5f, 1.5f, 1.5f };
for (uint8_t ii = 0; ii < settings_numLights; ++ii)
{
memcpy(s_uniforms.m_color, lightRgbInnerR[ii], 3*sizeof(float) );
bx::memCopy(s_uniforms.m_color, lightRgbInnerR[ii], 3*sizeof(float) );
float lightMtx[16];
mtxBillboard(lightMtx, viewState.m_view, lightPosRadius[ii], lightScale);

View File

@@ -2344,7 +2344,7 @@ int _main_(int _argc, char** _argv)
bx::mtxTranspose(mtxYpr[ii], mtxTmp);
memcpy(lightView[ii], mtxYpr[ii], 12*sizeof(float) );
bx::memCopy(lightView[ii], mtxYpr[ii], 12*sizeof(float) );
lightView[ii][12] = tmp[0];
lightView[ii][13] = tmp[1];
lightView[ii][14] = tmp[2];

View File

@@ -675,10 +675,10 @@ int _main_(int _argc, char** _argv)
uniforms.m_doSpecular = float(settings.m_doSpecular);
uniforms.m_doDiffuseIbl = float(settings.m_doDiffuseIbl);
uniforms.m_doSpecularIbl = float(settings.m_doSpecularIbl);
memcpy(uniforms.m_rgbDiff, settings.m_rgbDiff, 3*sizeof(float) );
memcpy(uniforms.m_rgbSpec, settings.m_rgbSpec, 3*sizeof(float) );
memcpy(uniforms.m_lightDir, settings.m_lightDir, 3*sizeof(float) );
memcpy(uniforms.m_lightCol, settings.m_lightCol, 3*sizeof(float) );
bx::memCopy(uniforms.m_rgbDiff, settings.m_rgbDiff, 3*sizeof(float) );
bx::memCopy(uniforms.m_rgbSpec, settings.m_rgbSpec, 3*sizeof(float) );
bx::memCopy(uniforms.m_lightDir, settings.m_lightDir, 3*sizeof(float) );
bx::memCopy(uniforms.m_lightCol, settings.m_lightCol, 3*sizeof(float) );
int64_t now = bx::getHPCounter();
static int64_t last = now;
@@ -717,7 +717,7 @@ int _main_(int _argc, char** _argv)
}
}
camera.update(deltaTimeSec);
memcpy(uniforms.m_cameraPos, camera.m_pos.curr, 3*sizeof(float) );
bx::memCopy(uniforms.m_cameraPos, camera.m_pos.curr, 3*sizeof(float) );
// View Transform 0.
float view[16];
@@ -755,7 +755,7 @@ int _main_(int _argc, char** _argv)
bgfx::submit(0, programSky);
// Submit view 1.
memcpy(uniforms.m_mtx, mtxEnvRot, 16*sizeof(float)); // Used for IBL.
bx::memCopy(uniforms.m_mtx, mtxEnvRot, 16*sizeof(float)); // Used for IBL.
if (0 == settings.m_meshSelection)
{
// Submit bunny.

View File

@@ -126,7 +126,7 @@ public:
m_timeOffset = bx::getHPCounter();
memset(m_fbh, 0xff, sizeof(m_fbh) );
bx::memSet(m_fbh, 0xff, sizeof(m_fbh) );
}
virtual int shutdown() BX_OVERRIDE

View File

@@ -119,7 +119,7 @@ class ExampleTerrain : public entry::AppI
m_terrain.m_heightMap = (uint8_t*)BX_ALLOC(entry::getAllocator(), num);
bx::mtxSRT(m_terrain.m_transform, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
memset(m_terrain.m_heightMap, 0, sizeof(uint8_t) * s_terrainSize * s_terrainSize);
bx::memSet(m_terrain.m_heightMap, 0, sizeof(uint8_t) * s_terrainSize * s_terrainSize);
cameraCreate();

View File

@@ -495,7 +495,7 @@ class ExampleWireframe : public entry::AppI
float view[16];
float proj[16];
m_camera.update(deltaTimeSec);
memcpy(m_uniforms.m_camPos, m_camera.m_pos.curr, 3*sizeof(float));
bx::memCopy(m_uniforms.m_camPos, m_camera.m_pos.curr, 3*sizeof(float));
m_camera.mtxLookAt(view);
bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f);
bgfx::setViewTransform(0, view, proj);

View File

@@ -407,7 +407,7 @@ bgfx::TextureHandle loadTexture(bx::FileReaderI* _reader, const char* _filePath,
*srcB,
*srcA,
};
memcpy(&out[ii * bytesPerPixel], rgba, bytesPerPixel);
bx::memCopy(&out[ii * bytesPerPixel], rgba, bytesPerPixel);
srcR += stepR;
srcG += stepG;
@@ -487,7 +487,7 @@ void calcTangents(void* _vertices, uint16_t _numVertices, bgfx::VertexDecl _decl
};
float* tangents = new float[6*_numVertices];
memset(tangents, 0, 6*_numVertices*sizeof(float) );
bx::memSet(tangents, 0, 6*_numVertices*sizeof(float) );
PosTexcoord v0;
PosTexcoord v1;

View File

@@ -15,32 +15,32 @@ int cmdMove(CmdContext* /*_context*/, void* /*_userData*/, int _argc, char const
{
if (_argc > 1)
{
if (0 == strcmp(_argv[1], "forward") )
if (0 == bx::strncmp(_argv[1], "forward") )
{
cameraSetKeyState(CAMERA_KEY_FORWARD, true);
return 0;
}
else if (0 == strcmp(_argv[1], "left") )
else if (0 == bx::strncmp(_argv[1], "left") )
{
cameraSetKeyState(CAMERA_KEY_LEFT, true);
return 0;
}
else if (0 == strcmp(_argv[1], "right") )
else if (0 == bx::strncmp(_argv[1], "right") )
{
cameraSetKeyState(CAMERA_KEY_RIGHT, true);
return 0;
}
else if (0 == strcmp(_argv[1], "backward") )
else if (0 == bx::strncmp(_argv[1], "backward") )
{
cameraSetKeyState(CAMERA_KEY_BACKWARD, true);
return 0;
}
else if (0 == strcmp(_argv[1], "up") )
else if (0 == bx::strncmp(_argv[1], "up") )
{
cameraSetKeyState(CAMERA_KEY_UP, true);
return 0;
}
else if (0 == strcmp(_argv[1], "down") )
else if (0 == bx::strncmp(_argv[1], "down") )
{
cameraSetKeyState(CAMERA_KEY_DOWN, true);
return 0;
@@ -264,7 +264,7 @@ struct Camera
void setPosition(const float* _pos)
{
memcpy(m_eye, _pos, sizeof(float)*3);
bx::memCopy(m_eye, _pos, sizeof(float)*3);
}
void setVerticalAngle(float _verticalAngle)
@@ -334,12 +334,12 @@ void cameraGetViewMtx(float* _viewMtx)
void cameraGetPosition(float* _pos)
{
memcpy(_pos, s_camera->m_eye, 3*sizeof(float) );
bx::memCopy(_pos, s_camera->m_eye, 3*sizeof(float) );
}
void cameraGetAt(float* _at)
{
memcpy(_at, s_camera->m_at, 3*sizeof(float) );
bx::memCopy(_at, s_camera->m_at, 3*sizeof(float) );
}
void cameraUpdate(float _deltaTime, const entry::MouseState& _mouseState)

View File

@@ -7,7 +7,6 @@
#include <bgfx/bgfx.h>
#include <limits.h> // INT_MAX
#include <memory.h> // memset
#include <vector>
#include "cube_atlas.h"
@@ -270,7 +269,7 @@ Atlas::Atlas(uint16_t _textureSize, uint16_t _maxRegionsCount)
m_regions = new AtlasRegion[_maxRegionsCount];
m_textureBuffer = new uint8_t[ _textureSize * _textureSize * 6 * 4 ];
memset(m_textureBuffer, 0, _textureSize * _textureSize * 6 * 4);
bx::memSet(m_textureBuffer, 0, _textureSize * _textureSize * 6 * 4);
m_textureHandle = bgfx::createTextureCube(_textureSize
, false
@@ -293,8 +292,8 @@ Atlas::Atlas(uint16_t _textureSize, const uint8_t* _textureBuffer, uint16_t _reg
m_regions = new AtlasRegion[_regionCount];
m_textureBuffer = new uint8_t[getTextureBufferSize()];
memcpy(m_regions, _regionBuffer, _regionCount * sizeof(AtlasRegion) );
memcpy(m_textureBuffer, _textureBuffer, getTextureBufferSize() );
bx::memCopy(m_regions, _regionBuffer, _regionCount * sizeof(AtlasRegion) );
bx::memCopy(m_textureBuffer, _textureBuffer, getTextureBufferSize() );
m_textureHandle = bgfx::createTextureCube(_textureSize
, false
@@ -409,7 +408,7 @@ void Atlas::updateRegion(const AtlasRegion& _region, const uint8_t* _bitmapBuffe
if (0 < size)
{
const bgfx::Memory* mem = bgfx::alloc(size);
memset(mem->data, 0, mem->size);
bx::memSet(mem->data, 0, mem->size);
if (_region.getType() == AtlasRegion::TYPE_BGRA8)
{
const uint8_t* inLineBuffer = _bitmapBuffer;
@@ -417,12 +416,12 @@ void Atlas::updateRegion(const AtlasRegion& _region, const uint8_t* _bitmapBuffe
for (int yy = 0; yy < _region.height; ++yy)
{
memcpy(outLineBuffer, inLineBuffer, _region.width * 4);
bx::memCopy(outLineBuffer, inLineBuffer, _region.width * 4);
inLineBuffer += _region.width * 4;
outLineBuffer += m_textureSize * 4;
}
memcpy(mem->data, _bitmapBuffer, mem->size);
bx::memCopy(mem->data, _bitmapBuffer, mem->size);
}
else
{
@@ -437,7 +436,7 @@ void Atlas::updateRegion(const AtlasRegion& _region, const uint8_t* _bitmapBuffe
outLineBuffer[(xx * 4) + layer] = inLineBuffer[xx];
}
memcpy(mem->data + yy * _region.width * 4, outLineBuffer, _region.width * 4);
bx::memCopy(mem->data + yy * _region.width * 4, outLineBuffer, _region.width * 4);
inLineBuffer += _region.width;
outLineBuffer += m_textureSize * 4;
}

View File

@@ -3,10 +3,8 @@
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
*/
#include <ctype.h> // isspace
#include <stdint.h>
#include <stdlib.h> // size_t
#include <string.h> // strlen
#include <bx/allocator.h>
#include <bx/hash.h>
@@ -33,7 +31,7 @@ struct CmdContext
void add(const char* _name, ConsoleFn _fn, void* _userData)
{
uint32_t cmd = bx::hashMurmur2A(_name, (uint32_t)strlen(_name) );
uint32_t cmd = bx::hashMurmur2A(_name, (uint32_t)bx::strnlen(_name) );
BX_CHECK(m_lookup.end() == m_lookup.find(cmd), "Command \"%s\" already exist.", _name);
Func fn = { _fn, _userData };
m_lookup.insert(stl::make_pair(cmd, fn) );
@@ -51,7 +49,7 @@ struct CmdContext
if (argc > 0)
{
int err = -1;
uint32_t cmd = bx::hashMurmur2A(argv[0], (uint32_t)strlen(argv[0]) );
uint32_t cmd = bx::hashMurmur2A(argv[0], (uint32_t)bx::strnlen(argv[0]) );
CmdLookup::iterator it = m_lookup.find(cmd);
if (it != m_lookup.end() )
{

View File

@@ -254,7 +254,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
bool setOrToggle(uint32_t& _flags, const char* _name, uint32_t _bit, int _first, int _argc, char const* const* _argv)
{
if (0 == strcmp(_argv[_first], _name) )
if (0 == bx::strncmp(_argv[_first], _name) )
{
int arg = _first+1;
if (_argc > arg)
@@ -310,7 +310,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
bgfx::setDebug(s_debug);
return 0;
}
else if (0 == strcmp(_argv[1], "screenshot") )
else if (0 == bx::strncmp(_argv[1], "screenshot") )
{
if (_argc > 2)
{
@@ -328,7 +328,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
return 0;
}
else if (0 == strcmp(_argv[1], "fullscreen") )
else if (0 == bx::strncmp(_argv[1], "fullscreen") )
{
WindowHandle window = { 0 };
toggleFullscreen(window);

View File

@@ -7,7 +7,6 @@
#define ENTRY_H_HEADER_GUARD
#include "dbg.h"
#include <string.h> // memset
#include <bx/bx.h>
#include <bx/string.h>
@@ -227,7 +226,7 @@ namespace entry
{
GamepadState()
{
memset(m_axis, 0, sizeof(m_axis) );
bx::memSet(m_axis, 0, sizeof(m_axis) );
}
int32_t m_axis[entry::GamepadAxis::Count];

View File

@@ -96,7 +96,7 @@ namespace entry
Context()
: m_window(NULL)
{
memset(m_value, 0, sizeof(m_value) );
bx::memSet(m_value, 0, sizeof(m_value) );
// Deadzone values from xinput.h
m_deadzone[GamepadAxis::LeftX ] =

View File

@@ -29,7 +29,7 @@ namespace entry
, m_my(0)
, m_scroll(0)
{
memset(s_translateKey, 0, sizeof(s_translateKey));
bx::memSet(s_translateKey, 0, sizeof(s_translateKey));
s_translateKey[27] = Key::Esc;
s_translateKey[uint8_t('\n')] =
s_translateKey[uint8_t('\r')] = Key::Return;

View File

@@ -158,8 +158,8 @@ namespace entry
GamepadGLFW()
: m_connected(false)
{
memset(m_axes, 0, sizeof(m_axes));
memset(m_buttons, 0, sizeof(m_buttons));
bx::memSet(m_axes, 0, sizeof(m_axes));
bx::memSet(m_buttons, 0, sizeof(m_buttons));
}
void update(EventQueue& _eventQueue)
@@ -310,7 +310,7 @@ namespace entry
Context()
: m_scrollPos(0.0)
{
memset(s_translateKey, 0, sizeof(s_translateKey));
bx::memSet(s_translateKey, 0, sizeof(s_translateKey));
s_translateKey[GLFW_KEY_ESCAPE] = Key::Esc;
s_translateKey[GLFW_KEY_ENTER] = Key::Return;
s_translateKey[GLFW_KEY_TAB] = Key::Tab;

View File

@@ -9,8 +9,6 @@
#include <bgfx/platform.h>
#include <stdio.h>
#include <string.h>
#include <pthread.h>
#include <string>

View File

@@ -11,7 +11,6 @@
#include <bx/spscqueue.h>
#include "entry.h"
#include <string.h> // memcpy
#ifndef ENTRY_CONFIG_USE_NOOP
# define ENTRY_CONFIG_USE_NOOP (BX_PLATFORM_QNX)
@@ -199,7 +198,7 @@ namespace entry
{
CharEvent* ev = new CharEvent(_handle);
ev->m_len = _len;
memcpy(ev->m_char, _char, 4);
bx::memCopy(ev->m_char, _char, 4);
m_queue.push(ev);
}

View File

@@ -158,7 +158,7 @@ namespace entry
: m_controller(NULL)
, m_jid(INT32_MAX)
{
memset(m_value, 0, sizeof(m_value) );
bx::memSet(m_value, 0, sizeof(m_value) );
// Deadzone values from xinput.h
m_deadzone[GamepadAxis::LeftX ] =
@@ -341,7 +341,7 @@ namespace entry
, m_mouseLock(false)
, m_fullscreen(false)
{
memset(s_translateKey, 0, sizeof(s_translateKey) );
bx::memSet(s_translateKey, 0, sizeof(s_translateKey) );
initTranslateKey(SDL_SCANCODE_ESCAPE, Key::Esc);
initTranslateKey(SDL_SCANCODE_RETURN, Key::Return);
initTranslateKey(SDL_SCANCODE_TAB, Key::Tab);
@@ -425,7 +425,7 @@ namespace entry
initTranslateKey(SDL_SCANCODE_Y, Key::KeyY);
initTranslateKey(SDL_SCANCODE_Z, Key::KeyZ);
memset(s_translateGamepad, uint8_t(Key::Count), sizeof(s_translateGamepad) );
bx::memSet(s_translateGamepad, uint8_t(Key::Count), sizeof(s_translateGamepad) );
initTranslateGamepad(SDL_CONTROLLER_BUTTON_A, Key::GamepadA);
initTranslateGamepad(SDL_CONTROLLER_BUTTON_B, Key::GamepadB);
initTranslateGamepad(SDL_CONTROLLER_BUTTON_X, Key::GamepadX);
@@ -442,7 +442,7 @@ namespace entry
initTranslateGamepad(SDL_CONTROLLER_BUTTON_START, Key::GamepadStart);
initTranslateGamepad(SDL_CONTROLLER_BUTTON_GUIDE, Key::GamepadGuide);
memset(s_translateGamepadAxis, uint8_t(GamepadAxis::Count), sizeof(s_translateGamepadAxis) );
bx::memSet(s_translateGamepadAxis, uint8_t(GamepadAxis::Count), sizeof(s_translateGamepadAxis) );
initTranslateGamepadAxis(SDL_CONTROLLER_AXIS_LEFTX, GamepadAxis::LeftX);
initTranslateGamepadAxis(SDL_CONTROLLER_AXIS_LEFTY, GamepadAxis::LeftY);
initTranslateGamepadAxis(SDL_CONTROLLER_AXIS_TRIGGERLEFT, GamepadAxis::LeftZ);

View File

@@ -34,7 +34,7 @@ namespace entry
inline void winSetHwnd(::HWND _window)
{
bgfx::PlatformData pd;
memset(&pd, 0, sizeof(pd) );
bx::memSet(&pd, 0, sizeof(pd) );
pd.nwh = _window;
bgfx::setPlatformData(pd);
}
@@ -75,8 +75,8 @@ namespace entry
XInput()
: m_xinputdll(NULL)
{
memset(m_connected, 0, sizeof(m_connected) );
memset(m_state, 0, sizeof(m_state) );
bx::memSet(m_connected, 0, sizeof(m_connected) );
bx::memSet(m_state, 0, sizeof(m_state) );
m_deadzone[GamepadAxis::LeftX ] =
m_deadzone[GamepadAxis::LeftY ] = XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE;
@@ -85,7 +85,7 @@ namespace entry
m_deadzone[GamepadAxis::LeftZ ] =
m_deadzone[GamepadAxis::RightZ] = XINPUT_GAMEPAD_TRIGGER_THRESHOLD;
memset(m_flip, 1, sizeof(m_flip) );
bx::memSet(m_flip, 1, sizeof(m_flip) );
m_flip[GamepadAxis::LeftY ] =
m_flip[GamepadAxis::RightY] = -1;
}
@@ -353,7 +353,7 @@ namespace entry
, m_init(false)
, m_exit(false)
{
memset(s_translateKey, 0, sizeof(s_translateKey) );
bx::memSet(s_translateKey, 0, sizeof(s_translateKey) );
s_translateKey[VK_ESCAPE] = Key::Esc;
s_translateKey[VK_RETURN] = Key::Return;
s_translateKey[VK_TAB] = Key::Tab;
@@ -451,7 +451,7 @@ namespace entry
HINSTANCE instance = (HINSTANCE)GetModuleHandle(NULL);
WNDCLASSEXA wnd;
memset(&wnd, 0, sizeof(wnd) );
bx::memSet(&wnd, 0, sizeof(wnd) );
wnd.cbSize = sizeof(wnd);
wnd.style = CS_HREDRAW | CS_VREDRAW;
wnd.lpfnWndProc = wndProc;

View File

@@ -20,7 +20,6 @@
#include <bx/thread.h>
#include <bx/os.h>
#include <bx/handlealloc.h>
#include <string.h> // memset
#include <string>
#include <fcntl.h>
@@ -107,7 +106,7 @@ namespace entry
{
m_fd = open("/dev/input/js0", O_RDONLY | O_NONBLOCK);
memset(m_value, 0, sizeof(m_value) );
bx::memSet(m_value, 0, sizeof(m_value) );
// Deadzone values from xinput.h
m_deadzone[GamepadAxis::LeftX ] =
@@ -250,7 +249,7 @@ namespace entry
: m_modifiers(Modifier::None)
, m_exit(false)
{
memset(s_translateKey, 0, sizeof(s_translateKey) );
bx::memSet(s_translateKey, 0, sizeof(s_translateKey) );
initTranslateKey(XK_Escape, Key::Esc);
initTranslateKey(XK_Return, Key::Return);
initTranslateKey(XK_Tab, Key::Tab);
@@ -352,7 +351,7 @@ namespace entry
m_visual = DefaultVisual(m_display, screen);
m_root = RootWindow(m_display, screen);
memset(&m_windowAttrs, 0, sizeof(m_windowAttrs) );
bx::memSet(&m_windowAttrs, 0, sizeof(m_windowAttrs) );
m_windowAttrs.background_pixmap = 0;
m_windowAttrs.border_pixel = 0;
m_windowAttrs.event_mask = 0
@@ -379,7 +378,7 @@ namespace entry
// Clear window to black.
XSetWindowAttributes attr;
memset(&attr, 0, sizeof(attr) );
bx::memSet(&attr, 0, sizeof(attr) );
XChangeWindowAttributes(m_display, m_window[0], CWBackPixel, &attr);
const char* wmDeleteWindowName = "WM_DELETE_WINDOW";
@@ -605,7 +604,7 @@ namespace entry
// Clear window to black.
XSetWindowAttributes attr;
memset(&attr, 0, sizeof(attr) );
bx::memSet(&attr, 0, sizeof(attr) );
XChangeWindowAttributes(m_display, window, CWBackPixel, &attr);
const char* wmDeleteWindowName = "WM_DELETE_WINDOW";

View File

@@ -35,7 +35,7 @@ struct InputMouse
m_norm[2] = 0.0f;
}
memset(m_buttons, 0, sizeof(m_buttons) );
bx::memSet(m_buttons, 0, sizeof(m_buttons) );
}
void setResolution(uint16_t _width, uint16_t _height)
@@ -78,8 +78,8 @@ struct InputKeyboard
void reset()
{
memset(m_key, 0, sizeof(m_key) );
memset(m_once, 0xff, sizeof(m_once) );
bx::memSet(m_key, 0, sizeof(m_key) );
bx::memSet(m_once, 0xff, sizeof(m_once) );
}
static uint32_t encodeKeyState(uint8_t _modifiers, bool _down)
@@ -130,7 +130,7 @@ struct InputKeyboard
popChar();
}
memcpy(&m_char[m_ring.m_current], _char, 4);
bx::memCopy(&m_char[m_ring.m_current], _char, 4);
m_ring.commit(4);
}
@@ -169,7 +169,7 @@ struct Gamepad
void reset()
{
memset(m_axis, 0, sizeof(m_axis) );
bx::memSet(m_axis, 0, sizeof(m_axis) );
}
void setAxis(entry::GamepadAxis::Enum _axis, int32_t _value)

View File

@@ -197,7 +197,7 @@ static void glyphInfoInit(GlyphInfo& _glyphInfo, FT_BitmapGlyph _bitmap, FT_Glyp
for (int32_t ii = 0; ii < hh; ++ii)
{
memcpy(_dst, src, dstPitch);
bx::memCopy(_dst, src, dstPitch);
_dst += dstPitch;
src += srcPitch;
@@ -319,8 +319,8 @@ static void makeDistanceMap(const uint8_t* _img, uint8_t* _outImg, uint32_t _wid
}
// Compute inside = edtaa3(1-bitmap); % Transform foreground (1's)
memset(gx, 0, sizeof(double) * _width * _height);
memset(gy, 0, sizeof(double) * _width * _height);
bx::memSet(gx, 0, sizeof(double) * _width * _height);
bx::memSet(gy, 0, sizeof(double) * _width * _height);
for (ii = 0; ii < _width * _height; ++ii)
{
data[ii] = 1.0 - data[ii];
@@ -418,12 +418,12 @@ bool TrueTypeFont::bakeGlyphDistance(CodePoint _codePoint, GlyphInfo& _glyphInfo
uint32_t buffSize = nw * nh * sizeof(uint8_t);
uint8_t* alphaImg = (uint8_t*)malloc(buffSize);
memset(alphaImg, 0, nw * nh * sizeof(uint8_t) );
bx::memSet(alphaImg, 0, nw * nh * sizeof(uint8_t) );
//copy the original buffer to the temp one
for (uint32_t ii = dh; ii < nh - dh; ++ii)
{
memcpy(alphaImg + ii * nw + dw, _outBuffer + (ii - dh) * ww, ww);
bx::memCopy(alphaImg + ii * nw + dw, _outBuffer + (ii - dh) * ww, ww);
}
makeDistanceMap(alphaImg, _outBuffer, nw, nh);
@@ -482,7 +482,7 @@ void FontManager::init()
const uint32_t W = 3;
// Create filler rectangle
uint8_t buffer[W * W * 4];
memset(buffer, 255, W * W * 4);
bx::memSet(buffer, 255, W * W * 4);
m_blackGlyph.width = W;
m_blackGlyph.height = W;
@@ -513,7 +513,7 @@ TrueTypeHandle FontManager::createTtf(const uint8_t* _buffer, uint32_t _size)
BX_CHECK(id != bx::HandleAlloc::invalid, "Invalid handle used");
m_cachedFiles[id].buffer = new uint8_t[_size];
m_cachedFiles[id].bufferSize = _size;
memcpy(m_cachedFiles[id].buffer, _buffer, _size);
bx::memCopy(m_cachedFiles[id].buffer, _buffer, _size);
TrueTypeHandle ret = { id };
return ret;

View File

@@ -9,7 +9,6 @@
#include <bgfx/embedded_shader.h>
#include <stddef.h> // offsetof
#include <memory.h> // memcpy
#include <wchar.h> // wcslen
#include "text_buffer_manager.h"
@@ -252,7 +251,7 @@ void TextBuffer::appendText(FontHandle _fontHandle, const char* _string, const c
if (_end == NULL)
{
_end = _string + strlen(_string);
_end = _string + bx::strnlen(_string);
}
BX_CHECK(_end >= _string);
@@ -802,8 +801,8 @@ void TextBufferManager::submitTextBuffer(TextBufferHandle _handle, uint8_t _id,
bgfx::TransientVertexBuffer tvb;
bgfx::allocTransientIndexBuffer(&tib, bc.textBuffer->getIndexCount() );
bgfx::allocTransientVertexBuffer(&tvb, bc.textBuffer->getVertexCount(), m_vertexDecl);
memcpy(tib.data, bc.textBuffer->getIndexBuffer(), indexSize);
memcpy(tvb.data, bc.textBuffer->getVertexBuffer(), vertexSize);
bx::memCopy(tib.data, bc.textBuffer->getIndexBuffer(), indexSize);
bx::memCopy(tvb.data, bc.textBuffer->getVertexBuffer(), vertexSize);
bgfx::setVertexBuffer(&tvb, 0, bc.textBuffer->getVertexCount() );
bgfx::setIndexBuffer(&tib, 0, bc.textBuffer->getIndexCount() );
}

View File

@@ -97,10 +97,10 @@ struct OcornutImguiContext
bgfx::allocTransientIndexBuffer(&tib, numIndices);
ImDrawVert* verts = (ImDrawVert*)tvb.data;
memcpy(verts, drawList->VtxBuffer.begin(), numVertices * sizeof(ImDrawVert) );
bx::memCopy(verts, drawList->VtxBuffer.begin(), numVertices * sizeof(ImDrawVert) );
ImDrawIdx* indices = (ImDrawIdx*)tib.data;
memcpy(indices, drawList->IdxBuffer.begin(), numIndices * sizeof(ImDrawIdx) );
bx::memCopy(indices, drawList->IdxBuffer.begin(), numIndices * sizeof(ImDrawIdx) );
uint32_t offset = 0;
for (const ImDrawCmd* cmd = drawList->CmdBuffer.begin(), *cmdEnd = drawList->CmdBuffer.end(); cmd != cmdEnd; ++cmd)

View File

@@ -76,7 +76,7 @@ namespace bgfx
if ( (int32_t)sizeof(temp) < total)
{
out = (char*)alloca(total+1);
memcpy(out, temp, len);
bx::memCopy(out, temp, len);
bx::vsnprintf(out + len, total-len, _format, _argList);
}
out[total] = '\0';
@@ -315,7 +315,7 @@ namespace bgfx
, "Only backbuffer pointer and native window handle can be changed after initialization!"
);
}
memcpy(&g_platformData, &_data, sizeof(PlatformData) );
bx::memCopy(&g_platformData, &_data, sizeof(PlatformData) );
g_platformDataChangedSinceReset = true;
}
@@ -492,7 +492,7 @@ namespace bgfx
for (uint32_t xx = 0; xx < 8; ++xx)
{
uint8_t bit = 1<<(7-xx);
memset(&pix[xx*_bpp], _charset[ii*_height+yy]&bit ? 255 : 0, _bpp);
bx::memSet(&pix[xx*_bpp], _charset[ii*_height+yy]&bit ? 255 : 0, _bpp);
}
pix += _pitch;
@@ -709,7 +709,7 @@ namespace bgfx
{ (xx )*8.0f, (yy+1)*fontHeight, 0.0f, fg, bg, (ch )*8.0f*texelWidth - texelWidthHalf, ubottom },
};
memcpy(vertex, vert, sizeof(vert) );
bx::memCopy(vertex, vert, sizeof(vert) );
vertex += 4;
indices[0] = uint16_t(startVertex+0);
@@ -1467,7 +1467,7 @@ namespace bgfx
m_render->destroy();
#endif // BGFX_CONFIG_MULTITHREADED
memset(&g_internalData, 0, sizeof(InternalData) );
bx::memSet(&g_internalData, 0, sizeof(InternalData) );
s_ctx = NULL;
m_submit->destroy();
@@ -1595,24 +1595,24 @@ namespace bgfx
m_resolution.m_flags &= ~BGFX_RESET_INTERNAL_FORCE;
m_submit->m_debug = m_debug;
memcpy(m_submit->m_viewRemap, m_viewRemap, sizeof(m_viewRemap) );
memcpy(m_submit->m_fb, m_fb, sizeof(m_fb) );
memcpy(m_submit->m_clear, m_clear, sizeof(m_clear) );
memcpy(m_submit->m_rect, m_rect, sizeof(m_rect) );
memcpy(m_submit->m_scissor, m_scissor, sizeof(m_scissor) );
memcpy(m_submit->m_view, m_view, sizeof(m_view) );
memcpy(m_submit->m_proj, m_proj, sizeof(m_proj) );
memcpy(m_submit->m_viewFlags, m_viewFlags, sizeof(m_viewFlags) );
bx::memCopy(m_submit->m_viewRemap, m_viewRemap, sizeof(m_viewRemap) );
bx::memCopy(m_submit->m_fb, m_fb, sizeof(m_fb) );
bx::memCopy(m_submit->m_clear, m_clear, sizeof(m_clear) );
bx::memCopy(m_submit->m_rect, m_rect, sizeof(m_rect) );
bx::memCopy(m_submit->m_scissor, m_scissor, sizeof(m_scissor) );
bx::memCopy(m_submit->m_view, m_view, sizeof(m_view) );
bx::memCopy(m_submit->m_proj, m_proj, sizeof(m_proj) );
bx::memCopy(m_submit->m_viewFlags, m_viewFlags, sizeof(m_viewFlags) );
if (m_colorPaletteDirty > 0)
{
--m_colorPaletteDirty;
memcpy(m_submit->m_colorPalette, m_clearColor, sizeof(m_clearColor) );
bx::memCopy(m_submit->m_colorPalette, m_clearColor, sizeof(m_clearColor) );
}
m_submit->finish();
bx::xchg(m_render, m_submit);
memcpy(m_render->m_occlusion, m_submit->m_occlusion, sizeof(m_submit->m_occlusion) );
bx::memCopy(m_render->m_occlusion, m_submit->m_occlusion, sizeof(m_submit->m_occlusion) );
if (!BX_ENABLED(BGFX_CONFIG_MULTITHREADED)
|| m_singleThreaded)
@@ -1623,7 +1623,7 @@ namespace bgfx
m_frames++;
m_submit->start();
memset(m_seq, 0, sizeof(m_seq) );
bx::memSet(m_seq, 0, sizeof(m_seq) );
freeAllHandles(m_submit);
m_submit->resetFreeHandles();
@@ -1843,7 +1843,7 @@ namespace bgfx
};
OSVERSIONINFOEXA ovi;
memset(&ovi, 0, sizeof(ovi) );
bx::memSet(&ovi, 0, sizeof(ovi) );
ovi.dwOSVersionInfoSize = sizeof(ovi);
// _WIN32_WINNT_WINBLUE 0x0603
// _WIN32_WINNT_WIN8 0x0602
@@ -2566,7 +2566,7 @@ namespace bgfx
goto error;
}
memset(&g_caps, 0, sizeof(g_caps) );
bx::memSet(&g_caps, 0, sizeof(g_caps) );
g_caps.limits.maxDrawCalls = BGFX_CONFIG_MAX_DRAW_CALLS;
g_caps.limits.maxBlits = BGFX_CONFIG_MAX_BLIT_ITEMS;
g_caps.limits.maxViews = BGFX_CONFIG_MAX_VIEWS;
@@ -2713,7 +2713,7 @@ error:
{
BX_CHECK(0 < _size, "Invalid memory operation. _size is 0.");
const Memory* mem = alloc(_size);
memcpy(mem->data, _data, _size);
bx::memCopy(mem->data, _data, _size);
return mem;
}

View File

@@ -443,7 +443,7 @@ namespace bgfx
if (size < m_size)
{
memset(&m_mem[size], 0, m_size-size);
bx::memSet(&m_mem[size], 0, m_size-size);
}
}
}
@@ -655,7 +655,7 @@ namespace bgfx
{
BX_CHECK(m_size == BGFX_CONFIG_MAX_COMMAND_BUFFER_SIZE, "Called write outside start/finish?");
BX_CHECK(m_pos < m_size, "CommandBuffer::write error (pos: %d, size: %d).", m_pos, m_size);
memcpy(&m_buffer[m_pos], _data, _size);
bx::memCopy(&m_buffer[m_pos], _data, _size);
m_pos += _size;
}
@@ -669,7 +669,7 @@ namespace bgfx
void read(void* _data, uint32_t _size)
{
BX_CHECK(m_pos < m_size, "CommandBuffer::read error (pos: %d, size: %d).", m_pos, m_size);
memcpy(_data, &m_buffer[m_pos], _size);
bx::memCopy(_data, &m_buffer[m_pos], _size);
m_pos += _size;
}
@@ -910,7 +910,7 @@ namespace bgfx
void setIdentity()
{
memset(un.val, 0, sizeof(un.val) );
bx::memSet(un.val, 0, sizeof(un.val) );
un.val[0] = un.val[5] = un.val[10] = un.val[15] = 1.0f;
}
};
@@ -947,7 +947,7 @@ namespace bgfx
if (NULL != _mtx)
{
uint32_t first = reserve(&_num);
memcpy(&m_cache[first], _mtx, sizeof(Matrix4)*_num);
bx::memCopy(&m_cache[first], _mtx, sizeof(Matrix4)*_num);
return first;
}
@@ -1072,7 +1072,7 @@ namespace bgfx
if (m_pos + _size < m_size)
{
memcpy(&m_buffer[m_pos], _data, _size);
bx::memCopy(&m_buffer[m_pos], _data, _size);
m_pos += _size;
}
}
@@ -1093,7 +1093,7 @@ namespace bgfx
uint32_t read()
{
uint32_t result;
memcpy(&result, read(sizeof(uint32_t) ), sizeof(uint32_t) );
bx::memCopy(&result, read(sizeof(uint32_t) ), sizeof(uint32_t) );
return result;
}
@@ -1427,7 +1427,7 @@ namespace bgfx
term.m_program = invalidHandle;
m_sortKeys[BGFX_CONFIG_MAX_DRAW_CALLS] = term.encodeDraw();
m_sortValues[BGFX_CONFIG_MAX_DRAW_CALLS] = BGFX_CONFIG_MAX_DRAW_CALLS;
memset(m_occlusion, 0xff, sizeof(m_occlusion) );
bx::memSet(m_occlusion, 0xff, sizeof(m_occlusion) );
}
~Frame()
@@ -1955,8 +1955,8 @@ namespace bgfx
void init()
{
memset(m_vertexDeclRef, 0, sizeof(m_vertexDeclRef) );
memset(m_vertexBufferRef, 0xff, sizeof(m_vertexBufferRef) );
bx::memSet(m_vertexDeclRef, 0, sizeof(m_vertexDeclRef) );
bx::memSet(m_vertexBufferRef, 0xff, sizeof(m_vertexBufferRef) );
}
template <uint16_t MaxHandlesT>
@@ -2252,7 +2252,7 @@ namespace bgfx
m_flipAfterRender = !!(_flags & BGFX_RESET_FLIP_AFTER_RENDER);
memset(m_fb, 0xff, sizeof(m_fb) );
bx::memSet(m_fb, 0xff, sizeof(m_fb) );
for (uint16_t ii = 0, num = m_textureHandle.getNumHandles(); ii < num; ++ii)
{
@@ -2978,7 +2978,7 @@ namespace bgfx
{
uint32_t size = sr.m_num*sizeof(UniformHandle);
sr.m_uniforms = (UniformHandle*)BX_ALLOC(g_allocator, size);
memcpy(sr.m_uniforms, uniforms, size);
bx::memCopy(sr.m_uniforms, uniforms, size);
}
CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateShader);
@@ -3000,7 +3000,7 @@ namespace bgfx
ShaderRef& sr = m_shaderRef[_handle.idx];
if (NULL != _uniforms)
{
memcpy(_uniforms, sr.m_uniforms, bx::uint16_min(_max, sr.m_num)*sizeof(UniformHandle) );
bx::memCopy(_uniforms, sr.m_uniforms, bx::uint16_min(_max, sr.m_num)*sizeof(UniformHandle) );
}
return sr.m_num;
@@ -3403,7 +3403,7 @@ namespace bgfx
FrameBufferRef& ref = m_frameBufferRef[handle.idx];
ref.m_window = false;
memset(ref.un.m_th, 0xff, sizeof(ref.un.m_th) );
bx::memSet(ref.un.m_th, 0xff, sizeof(ref.un.m_th) );
BackbufferRatio::Enum bbRatio = BackbufferRatio::Enum(m_textureRef[_attachment[0].handle.idx].m_bbRatio);
for (uint32_t ii = 0; ii < _num; ++ii)
{
@@ -3639,7 +3639,7 @@ namespace bgfx
, _index
, BGFX_CONFIG_MAX_COLOR_PALETTE
);
memcpy(&m_clearColor[_index][0], _rgba, 16);
bx::memCopy(&m_clearColor[_index][0], _rgba, 16);
m_colorPaletteDirty = 2;
}
@@ -3717,7 +3717,7 @@ namespace bgfx
if (NULL != _view)
{
memcpy(m_view[_id].un.val, _view, sizeof(Matrix4) );
bx::memCopy(m_view[_id].un.val, _view, sizeof(Matrix4) );
}
else
{
@@ -3726,7 +3726,7 @@ namespace bgfx
if (NULL != _proj)
{
memcpy(m_proj[0][_id].un.val, _proj, sizeof(Matrix4) );
bx::memCopy(m_proj[0][_id].un.val, _proj, sizeof(Matrix4) );
}
else
{
@@ -3735,11 +3735,11 @@ namespace bgfx
if (NULL != _proj1)
{
memcpy(m_proj[1][_id].un.val, _proj1, sizeof(Matrix4) );
bx::memCopy(m_proj[1][_id].un.val, _proj1, sizeof(Matrix4) );
}
else
{
memcpy(m_proj[1][_id].un.val, m_proj[0][_id].un.val, sizeof(Matrix4) );
bx::memCopy(m_proj[1][_id].un.val, m_proj[0][_id].un.val, sizeof(Matrix4) );
}
}
@@ -3767,7 +3767,7 @@ namespace bgfx
}
else
{
memcpy(&m_viewRemap[_id], _order, num);
bx::memCopy(&m_viewRemap[_id], _order, num);
}
}

View File

@@ -59,7 +59,7 @@ namespace bgfx { namespace gl
static HGLRC createContext(HDC _hdc)
{
PIXELFORMATDESCRIPTOR pfd;
memset(&pfd, 0, sizeof(pfd) );
bx::memSet(&pfd, 0, sizeof(pfd) );
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
@@ -245,7 +245,7 @@ namespace bgfx { namespace gl
BGFX_FATAL(NULL != m_context, Fatal::UnableToInitialize, "Failed to create context 0x%08x.", GetLastError() );
BX_STATIC_ASSERT(sizeof(contextAttrs) == sizeof(m_contextAttrs) );
memcpy(m_contextAttrs, contextAttrs, sizeof(contextAttrs) );
bx::memCopy(m_contextAttrs, contextAttrs, sizeof(contextAttrs) );
}
wglMakeCurrent(NULL, NULL);

View File

@@ -104,7 +104,7 @@ namespace bgfx
for (int eye = 0; eye < 2; ++eye)
{
BX_STATIC_ASSERT(sizeof(_desc->m_eyeFov[eye]) == sizeof(hmdDesc.DefaultEyeFov[eye]));
memcpy(&_desc->m_eyeFov[eye], &hmdDesc.DefaultEyeFov[eye], sizeof(_desc->m_eyeFov[eye]));
bx::memCopy(&_desc->m_eyeFov[eye], &hmdDesc.DefaultEyeFov[eye], sizeof(_desc->m_eyeFov[eye]));
_desc->m_eyeSize[eye].m_w = eyeSize[eye].w;
_desc->m_eyeSize[eye].m_h = eyeSize[eye].h;
}

View File

@@ -661,7 +661,7 @@ namespace bgfx
for (uint32_t yy = 0; yy < _height; ++yy, src += _srcPitch, dst += _dstPitch)
{
memcpy(dst, src, pitch);
bx::memCopy(dst, src, pitch);
}
}
@@ -2544,10 +2544,10 @@ namespace bgfx
src += 8;
uint8_t* block = &dst[(yy*_pitch+xx*4)*4];
memcpy(&block[0*_pitch], &temp[ 0], 16);
memcpy(&block[1*_pitch], &temp[16], 16);
memcpy(&block[2*_pitch], &temp[32], 16);
memcpy(&block[3*_pitch], &temp[48], 16);
bx::memCopy(&block[0*_pitch], &temp[ 0], 16);
bx::memCopy(&block[1*_pitch], &temp[16], 16);
bx::memCopy(&block[2*_pitch], &temp[32], 16);
bx::memCopy(&block[3*_pitch], &temp[48], 16);
}
}
break;
@@ -2563,10 +2563,10 @@ namespace bgfx
src += 8;
uint8_t* block = &dst[(yy*_pitch+xx*4)*4];
memcpy(&block[0*_pitch], &temp[ 0], 16);
memcpy(&block[1*_pitch], &temp[16], 16);
memcpy(&block[2*_pitch], &temp[32], 16);
memcpy(&block[3*_pitch], &temp[48], 16);
bx::memCopy(&block[0*_pitch], &temp[ 0], 16);
bx::memCopy(&block[1*_pitch], &temp[16], 16);
bx::memCopy(&block[2*_pitch], &temp[32], 16);
bx::memCopy(&block[3*_pitch], &temp[48], 16);
}
}
break;
@@ -2582,10 +2582,10 @@ namespace bgfx
src += 8;
uint8_t* block = &dst[(yy*_pitch+xx*4)*4];
memcpy(&block[0*_pitch], &temp[ 0], 16);
memcpy(&block[1*_pitch], &temp[16], 16);
memcpy(&block[2*_pitch], &temp[32], 16);
memcpy(&block[3*_pitch], &temp[48], 16);
bx::memCopy(&block[0*_pitch], &temp[ 0], 16);
bx::memCopy(&block[1*_pitch], &temp[16], 16);
bx::memCopy(&block[2*_pitch], &temp[32], 16);
bx::memCopy(&block[3*_pitch], &temp[48], 16);
}
}
break;
@@ -2599,10 +2599,10 @@ namespace bgfx
src += 8;
uint8_t* block = &dst[(yy*_pitch+xx*4)*4];
memcpy(&block[0*_pitch], &temp[ 0], 16);
memcpy(&block[1*_pitch], &temp[16], 16);
memcpy(&block[2*_pitch], &temp[32], 16);
memcpy(&block[3*_pitch], &temp[48], 16);
bx::memCopy(&block[0*_pitch], &temp[ 0], 16);
bx::memCopy(&block[1*_pitch], &temp[16], 16);
bx::memCopy(&block[2*_pitch], &temp[32], 16);
bx::memCopy(&block[3*_pitch], &temp[48], 16);
}
}
break;
@@ -2627,10 +2627,10 @@ namespace bgfx
}
uint8_t* block = &dst[(yy*_pitch+xx*4)*4];
memcpy(&block[0*_pitch], &temp[ 0], 16);
memcpy(&block[1*_pitch], &temp[16], 16);
memcpy(&block[2*_pitch], &temp[32], 16);
memcpy(&block[3*_pitch], &temp[48], 16);
bx::memCopy(&block[0*_pitch], &temp[ 0], 16);
bx::memCopy(&block[1*_pitch], &temp[16], 16);
bx::memCopy(&block[2*_pitch], &temp[32], 16);
bx::memCopy(&block[3*_pitch], &temp[48], 16);
}
}
break;
@@ -2645,10 +2645,10 @@ namespace bgfx
src += 8;
uint8_t* block = &dst[(yy*_pitch+xx*4)*4];
memcpy(&block[0*_pitch], &temp[ 0], 16);
memcpy(&block[1*_pitch], &temp[16], 16);
memcpy(&block[2*_pitch], &temp[32], 16);
memcpy(&block[3*_pitch], &temp[48], 16);
bx::memCopy(&block[0*_pitch], &temp[ 0], 16);
bx::memCopy(&block[1*_pitch], &temp[16], 16);
bx::memCopy(&block[2*_pitch], &temp[32], 16);
bx::memCopy(&block[3*_pitch], &temp[48], 16);
}
}
break;
@@ -2681,10 +2681,10 @@ namespace bgfx
decodeBlockPtc14(temp, src, xx, yy, width, height);
uint8_t* block = &dst[(yy*_pitch+xx*4)*4];
memcpy(&block[0*_pitch], &temp[ 0], 16);
memcpy(&block[1*_pitch], &temp[16], 16);
memcpy(&block[2*_pitch], &temp[32], 16);
memcpy(&block[3*_pitch], &temp[48], 16);
bx::memCopy(&block[0*_pitch], &temp[ 0], 16);
bx::memCopy(&block[1*_pitch], &temp[16], 16);
bx::memCopy(&block[2*_pitch], &temp[32], 16);
bx::memCopy(&block[3*_pitch], &temp[48], 16);
}
}
break;
@@ -2697,10 +2697,10 @@ namespace bgfx
decodeBlockPtc14A(temp, src, xx, yy, width, height);
uint8_t* block = &dst[(yy*_pitch+xx*4)*4];
memcpy(&block[0*_pitch], &temp[ 0], 16);
memcpy(&block[1*_pitch], &temp[16], 16);
memcpy(&block[2*_pitch], &temp[32], 16);
memcpy(&block[3*_pitch], &temp[48], 16);
bx::memCopy(&block[0*_pitch], &temp[ 0], 16);
bx::memCopy(&block[1*_pitch], &temp[16], 16);
bx::memCopy(&block[2*_pitch], &temp[32], 16);
bx::memCopy(&block[3*_pitch], &temp[48], 16);
}
}
break;
@@ -2720,7 +2720,7 @@ namespace bgfx
break;
case TextureFormat::BGRA8:
memcpy(_dst, _src, _pitch*_height);
bx::memCopy(_dst, _src, _pitch*_height);
break;
default:
@@ -2742,7 +2742,7 @@ namespace bgfx
switch (_format)
{
case TextureFormat::RGBA8:
memcpy(_dst, _src, _pitch*_height);
bx::memCopy(_dst, _src, _pitch*_height);
break;
case TextureFormat::BGRA8:
@@ -2862,7 +2862,7 @@ namespace bgfx
break;
case TextureFormat::RGBA32F:
memcpy(_dst, _src, _pitch*_height);
bx::memCopy(_dst, _src, _pitch*_height);
break;
case TextureFormat::RGBA8:

View File

@@ -57,7 +57,7 @@ namespace bgfx
}
else
{
memcpy(&m_view[0][ii].un.f4x4, &_frame->m_view[ii].un.f4x4, sizeof(Matrix4) );
bx::memCopy(&m_view[0][ii].un.f4x4, &_frame->m_view[ii].un.f4x4, sizeof(Matrix4) );
}
}
}

View File

@@ -70,7 +70,7 @@ namespace bgfx { namespace d3d11
{
Zero()
{
memset(this, 0, sizeof(Zero) );
bx::memSet(this, 0, sizeof(Zero) );
}
ID3D11Buffer* m_buffer[D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
@@ -364,7 +364,7 @@ namespace bgfx { namespace d3d11
{
if (UINT16_MAX != _decl.m_attributes[attr])
{
memcpy(elem, &s_attrib[attr], sizeof(D3D11_INPUT_ELEMENT_DESC) );
bx::memCopy(elem, &s_attrib[attr], sizeof(D3D11_INPUT_ELEMENT_DESC) );
if (0 == _decl.m_attributes[attr])
{
@@ -397,8 +397,8 @@ namespace bgfx { namespace d3d11
void clear()
{
memset(m_srv, 0, sizeof(m_srv) );
memset(m_sampler, 0, sizeof(m_sampler) );
bx::memSet(m_srv, 0, sizeof(m_srv) );
bx::memSet(m_sampler, 0, sizeof(m_sampler) );
}
ID3D11ShaderResourceView* m_srv[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS];
@@ -675,9 +675,9 @@ namespace bgfx { namespace d3d11
, m_timerQuerySupport(false)
{
m_fbh.idx = invalidHandle;
memset(&m_adapterDesc, 0, sizeof(m_adapterDesc) );
memset(&m_scd, 0, sizeof(m_scd) );
memset(&m_windows, 0xff, sizeof(m_windows) );
bx::memSet(&m_adapterDesc, 0, sizeof(m_adapterDesc) );
bx::memSet(&m_scd, 0, sizeof(m_scd) );
bx::memSet(&m_windows, 0xff, sizeof(m_windows) );
}
~RendererContextD3D11()
@@ -712,8 +712,8 @@ namespace bgfx { namespace d3d11
}
m_fbh.idx = invalidHandle;
memset(m_uniforms, 0, sizeof(m_uniforms) );
memset(&m_resolution, 0, sizeof(m_resolution) );
bx::memSet(m_uniforms, 0, sizeof(m_uniforms) );
bx::memSet(&m_resolution, 0, sizeof(m_resolution) );
m_ags = NULL;
m_agsdll = bx::dlopen(
@@ -1124,7 +1124,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
DX_RELEASE(device, 2);
}
memset(&m_adapterDesc, 0, sizeof(m_adapterDesc) );
bx::memSet(&m_adapterDesc, 0, sizeof(m_adapterDesc) );
hr = adapter->GetDesc(&m_adapterDesc);
BX_WARN(SUCCEEDED(hr), "Adapter GetDesc failed 0x%08x.", hr);
@@ -1145,7 +1145,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
goto error;
}
memset(&m_scd, 0, sizeof(m_scd) );
bx::memSet(&m_scd, 0, sizeof(m_scd) );
m_scd.Width = BGFX_DEFAULT_WIDTH;
m_scd.Height = BGFX_DEFAULT_HEIGHT;
m_scd.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
@@ -1205,7 +1205,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
goto error;
}
memset(&m_scd, 0, sizeof(m_scd) );
bx::memSet(&m_scd, 0, sizeof(m_scd) );
m_scd.BufferDesc.Width = BGFX_DEFAULT_WIDTH;
m_scd.BufferDesc.Height = BGFX_DEFAULT_HEIGHT;
m_scd.BufferDesc.RefreshRate.Numerator = 60;
@@ -1236,7 +1236,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
}
else
{
memset(&m_scd, 0, sizeof(m_scd) );
bx::memSet(&m_scd, 0, sizeof(m_scd) );
m_scd.SampleDesc.Count = 1;
m_scd.SampleDesc.Quality = 0;
setBufferSize(BGFX_DEFAULT_WIDTH, BGFX_DEFAULT_HEIGHT);
@@ -1258,7 +1258,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
m_infoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_WARNING, false);
D3D11_INFO_QUEUE_FILTER filter;
memset(&filter, 0, sizeof(filter) );
bx::memSet(&filter, 0, sizeof(filter) );
D3D11_MESSAGE_CATEGORY catlist[] =
{
@@ -1763,7 +1763,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
void createVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) BX_OVERRIDE
{
VertexDecl& decl = m_vertexDecls[_handle.idx];
memcpy(&decl, &_decl, sizeof(VertexDecl) );
bx::memCopy(&decl, &_decl, sizeof(VertexDecl) );
dump(decl);
}
@@ -1869,7 +1869,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
for (uint32_t yy = 0, height = srcHeight; yy < height; ++yy)
{
memcpy(dst, src, pitch);
bx::memCopy(dst, src, pitch);
src += srcPitch;
dst += dstPitch;
@@ -1963,7 +1963,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
uint32_t size = BX_ALIGN_16(g_uniformTypeSize[_type]*_num);
void* data = BX_ALLOC(g_allocator, size);
memset(data, 0, size);
bx::memSet(data, 0, size);
m_uniforms[_handle.idx] = data;
m_uniformReg.add(_handle, _name, data);
}
@@ -1990,7 +1990,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
backBuffer->GetDesc(&backBufferDesc);
D3D11_TEXTURE2D_DESC desc;
memcpy(&desc, &backBufferDesc, sizeof(desc) );
bx::memCopy(&desc, &backBufferDesc, sizeof(desc) );
desc.SampleDesc.Count = 1;
desc.SampleDesc.Quality = 0;
desc.Usage = D3D11_USAGE_STAGING;
@@ -2062,7 +2062,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
void updateUniform(uint16_t _loc, const void* _data, uint32_t _size) BX_OVERRIDE
{
memcpy(m_uniforms[_loc], _data, _size);
bx::memCopy(m_uniforms[_loc], _data, _size);
}
void setMarker(const char* _marker, uint32_t _size) BX_OVERRIDE
@@ -2527,12 +2527,12 @@ BX_PRAGMA_DIAGNOSTIC_POP();
{
if (_flags&BGFX_UNIFORM_FRAGMENTBIT)
{
memcpy(&m_fsScratch[_regIndex], _val, _numRegs*16);
bx::memCopy(&m_fsScratch[_regIndex], _val, _numRegs*16);
m_fsChanges += _numRegs;
}
else
{
memcpy(&m_vsScratch[_regIndex], _val, _numRegs*16);
bx::memCopy(&m_vsScratch[_regIndex], _val, _numRegs*16);
m_vsChanges += _numRegs;
}
}
@@ -2661,7 +2661,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
D3D11_INPUT_ELEMENT_DESC vertexElements[Attrib::Count+1+BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT];
VertexDecl decl;
memcpy(&decl, &_vertexDecl, sizeof(VertexDecl) );
bx::memCopy(&decl, &_vertexDecl, sizeof(VertexDecl) );
const uint16_t* attrMask = _program.m_vsh->m_attrMask;
for (uint32_t ii = 0; ii < Attrib::Count; ++ii)
@@ -2698,7 +2698,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
++elem;
}
memcpy(curr, &inst, sizeof(D3D11_INPUT_ELEMENT_DESC) );
bx::memCopy(curr, &inst, sizeof(D3D11_INPUT_ELEMENT_DESC) );
curr->InputSlot = 1;
curr->SemanticIndex = index;
curr->AlignedByteOffset = ii*16;
@@ -2798,7 +2798,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
{
for (uint32_t ii = 1; ii < BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS; ++ii)
{
memcpy(&desc.RenderTarget[ii], drt, sizeof(D3D11_RENDER_TARGET_BLEND_DESC) );
bx::memCopy(&desc.RenderTarget[ii], drt, sizeof(D3D11_RENDER_TARGET_BLEND_DESC) );
}
}
@@ -2849,7 +2849,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
if (NULL == dss)
{
D3D11_DEPTH_STENCIL_DESC desc;
memset(&desc, 0, sizeof(desc) );
bx::memSet(&desc, 0, sizeof(desc) );
desc.DepthEnable = 0 != func;
desc.DepthWriteMask = !!(BGFX_STATE_DEPTH_WRITE & _state) ? D3D11_DEPTH_WRITE_MASK_ALL : D3D11_DEPTH_WRITE_MASK_ZERO;
desc.DepthFunc = s_cmpFunc[func];
@@ -3229,7 +3229,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
backBuffer->GetDesc(&backBufferDesc);
D3D11_TEXTURE2D_DESC desc;
memcpy(&desc, &backBufferDesc, sizeof(desc) );
bx::memCopy(&desc, &backBufferDesc, sizeof(desc) );
desc.SampleDesc.Count = 1;
desc.SampleDesc.Quality = 0;
desc.Usage = D3D11_USAGE_STAGING;
@@ -3327,7 +3327,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
else
{
UniformHandle handle;
memcpy(&handle, _uniformBuffer.read(sizeof(UniformHandle) ), sizeof(UniformHandle) );
bx::memCopy(&handle, _uniformBuffer.read(sizeof(UniformHandle) ), sizeof(UniformHandle) );
data = (const char*)m_uniforms[handle.idx];
}
@@ -3451,7 +3451,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
for (uint32_t ii = 0; ii < numMrt; ++ii)
{
uint8_t index = (uint8_t)bx::uint32_min(BGFX_CONFIG_MAX_COLOR_PALETTE-1, _clear.m_index[ii]);
memcpy(mrtClear[ii], _palette[index], 16);
bx::memCopy(mrtClear[ii], _palette[index], 16);
}
deviceCtx->UpdateSubresource(fsh->m_buffer, 0, 0, mrtClear, 0, 0);
@@ -3672,7 +3672,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
, m_textureSwapChain(NULL)
, m_mirrorTexture(NULL)
{
memset(m_eyeRtv, 0, sizeof(m_eyeRtv));
bx::memSet(m_eyeRtv, 0, sizeof(m_eyeRtv));
}
bool VRImplOVRD3D11::createSwapChain(const VRDesc& _desc, int _msaaSamples, int _mirrorWidth, int _mirrorHeight)
@@ -4085,7 +4085,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
: D3D11_MAP_WRITE_NO_OVERWRITE
;
DX_CHECK(deviceCtx->Map(m_ptr, 0, type, 0, &mapped) );
memcpy( (uint8_t*)mapped.pData + _offset, _data, _size);
bx::memCopy( (uint8_t*)mapped.pData + _offset, _data, _size);
deviceCtx->Unmap(m_ptr, 0);
#endif // 0
}
@@ -4276,7 +4276,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
uint8_t numAttrs = 0;
bx::read(&reader, numAttrs);
memset(m_attrMask, 0, sizeof(m_attrMask) );
bx::memSet(m_attrMask, 0, sizeof(m_attrMask) );
for (uint32_t ii = 0; ii < numAttrs; ++ii)
{
@@ -4437,7 +4437,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
;
D3D11_SHADER_RESOURCE_VIEW_DESC srvd;
memset(&srvd, 0, sizeof(srvd) );
bx::memSet(&srvd, 0, sizeof(srvd) );
DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN;
if (swizzle)
@@ -4740,7 +4740,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
m_denseIdx = UINT16_MAX;
m_numTh = _num;
m_needPresent = false;
memcpy(m_attachment, _attachment, _num*sizeof(Attachment) );
bx::memCopy(m_attachment, _attachment, _num*sizeof(Attachment) );
postReset();
}
@@ -4748,7 +4748,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
void FrameBufferD3D11::create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat)
{
DXGI_SWAP_CHAIN_DESC scd;
memcpy(&scd, &s_renderD3D11->m_scd, sizeof(DXGI_SWAP_CHAIN_DESC) );
bx::memCopy(&scd, &s_renderD3D11->m_scd, sizeof(DXGI_SWAP_CHAIN_DESC) );
scd.BufferDesc.Width = _width;
scd.BufferDesc.Height = _height;
scd.OutputWindow = (HWND)_nwh;

View File

@@ -182,14 +182,14 @@ namespace bgfx { namespace d3d11
{
BX_CHECK(NULL != _vsh->m_ptr, "Vertex shader doesn't exist.");
m_vsh = _vsh;
memcpy(&m_predefined[0], _vsh->m_predefined, _vsh->m_numPredefined*sizeof(PredefinedUniform) );
bx::memCopy(&m_predefined[0], _vsh->m_predefined, _vsh->m_numPredefined*sizeof(PredefinedUniform) );
m_numPredefined = _vsh->m_numPredefined;
if (NULL != _fsh)
{
BX_CHECK(NULL != _fsh->m_ptr, "Fragment shader doesn't exist.");
m_fsh = _fsh;
memcpy(&m_predefined[m_numPredefined], _fsh->m_predefined, _fsh->m_numPredefined*sizeof(PredefinedUniform) );
bx::memCopy(&m_predefined[m_numPredefined], _fsh->m_predefined, _fsh->m_numPredefined*sizeof(PredefinedUniform) );
m_numPredefined += _fsh->m_numPredefined;
}
}

View File

@@ -316,7 +316,7 @@ namespace bgfx { namespace d3d12
{
if (UINT16_MAX != _decl.m_attributes[attr])
{
memcpy(elem, &s_attrib[attr], sizeof(D3D12_INPUT_ELEMENT_DESC) );
bx::memCopy(elem, &s_attrib[attr], sizeof(D3D12_INPUT_ELEMENT_DESC) );
if (0 == _decl.m_attributes[attr])
{
@@ -501,8 +501,8 @@ namespace bgfx { namespace d3d12
// m_renderdocdll = loadRenderDoc();
m_fbh.idx = invalidHandle;
memset(m_uniforms, 0, sizeof(m_uniforms) );
memset(&m_resolution, 0, sizeof(m_resolution) );
bx::memSet(m_uniforms, 0, sizeof(m_uniforms) );
bx::memSet(&m_resolution, 0, sizeof(m_resolution) );
#if USE_D3D12_DYNAMIC_LIB
m_kernel32dll = bx::dlopen("kernel32.dll");
@@ -684,7 +684,7 @@ namespace bgfx { namespace d3d12
if (NULL != m_factory)
{
memset(&m_adapterDesc, 0, sizeof(m_adapterDesc) );
bx::memSet(&m_adapterDesc, 0, sizeof(m_adapterDesc) );
luid = m_device->GetAdapterLuid();
#if BX_PLATFORM_WINDOWS
IDXGIAdapter3* adapter;
@@ -730,7 +730,7 @@ namespace bgfx { namespace d3d12
);
if (0 == ii)
{
memcpy(&m_architecture, &architecture, sizeof(architecture) );
bx::memCopy(&m_architecture, &architecture, sizeof(architecture) );
}
}
}
@@ -895,7 +895,7 @@ namespace bgfx { namespace d3d12
m_infoQueue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_WARNING, false);
D3D12_INFO_QUEUE_FILTER filter;
memset(&filter, 0, sizeof(filter) );
bx::memSet(&filter, 0, sizeof(filter) );
D3D12_MESSAGE_CATEGORY catlist[] =
{
@@ -1319,7 +1319,7 @@ namespace bgfx { namespace d3d12
void createVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) BX_OVERRIDE
{
VertexDecl& decl = m_vertexDecls[_handle.idx];
memcpy(&decl, &_decl, sizeof(VertexDecl) );
bx::memCopy(&decl, &_decl, sizeof(VertexDecl) );
dump(decl);
}
@@ -1456,7 +1456,7 @@ namespace bgfx { namespace d3d12
for (uint32_t yy = 0, height = srcHeight; yy < height; ++yy)
{
memcpy(dst, src, pitch);
bx::memCopy(dst, src, pitch);
src += srcPitch;
dst += dstPitch;
@@ -1547,7 +1547,7 @@ namespace bgfx { namespace d3d12
uint32_t size = BX_ALIGN_16(g_uniformTypeSize[_type] * _num);
void* data = BX_ALLOC(g_allocator, size);
memset(data, 0, size);
bx::memSet(data, 0, size);
m_uniforms[_handle.idx] = data;
m_uniformReg.add(_handle, _name, data);
}
@@ -1630,7 +1630,7 @@ namespace bgfx { namespace d3d12
void updateUniform(uint16_t _loc, const void* _data, uint32_t _size) BX_OVERRIDE
{
memcpy(m_uniforms[_loc], _data, _size);
bx::memCopy(m_uniforms[_loc], _data, _size);
}
void setMarker(const char* /*_marker*/, uint32_t /*_size*/) BX_OVERRIDE
@@ -1762,7 +1762,7 @@ namespace bgfx { namespace d3d12
void postReset()
{
memset(m_backBufferColorFence, 0, sizeof(m_backBufferColorFence) );
bx::memSet(m_backBufferColorFence, 0, sizeof(m_backBufferColorFence) );
uint32_t rtvDescriptorSize = m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV);
@@ -1835,7 +1835,7 @@ namespace bgfx { namespace d3d12
uint32_t msaa = s_checkMsaa[ii];
D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS data;
memset(&data, 0, sizeof(msaa) );
bx::memSet(&data, 0, sizeof(msaa) );
data.Format = getBufferFormat();
data.SampleCount = msaa;
data.Flags = D3D12_MULTISAMPLE_QUALITY_LEVELS_FLAG_NONE;
@@ -1945,12 +1945,12 @@ data.NumQualityLevels = 0;
{
if (_flags&BGFX_UNIFORM_FRAGMENTBIT)
{
memcpy(&m_fsScratch[_regIndex], _val, _numRegs*16);
bx::memCopy(&m_fsScratch[_regIndex], _val, _numRegs*16);
m_fsChanges += _numRegs;
}
else
{
memcpy(&m_vsScratch[_regIndex], _val, _numRegs*16);
bx::memCopy(&m_vsScratch[_regIndex], _val, _numRegs*16);
m_vsChanges += _numRegs;
}
}
@@ -1977,7 +1977,7 @@ data.NumQualityLevels = 0;
{
uint32_t size = program.m_vsh->m_size;
memcpy(data, m_vsScratch, size);
bx::memCopy(data, m_vsScratch, size);
data += size;
m_vsChanges = 0;
@@ -1985,7 +1985,7 @@ data.NumQualityLevels = 0;
if (NULL != program.m_fsh)
{
memcpy(data, m_fsScratch, program.m_fsh->m_size);
bx::memCopy(data, m_fsScratch, program.m_fsh->m_size);
m_fsChanges = 0;
}
@@ -2149,7 +2149,7 @@ data.NumQualityLevels = 0;
{
for (uint32_t ii = 1; ii < BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS; ++ii)
{
memcpy(&_desc.RenderTarget[ii], drt, sizeof(D3D12_RENDER_TARGET_BLEND_DESC) );
bx::memCopy(&_desc.RenderTarget[ii], drt, sizeof(D3D12_RENDER_TARGET_BLEND_DESC) );
}
}
}
@@ -2181,7 +2181,7 @@ data.NumQualityLevels = 0;
{
const uint32_t fstencil = unpackStencil(0, _stencil);
memset(&_desc, 0, sizeof(_desc) );
bx::memSet(&_desc, 0, sizeof(_desc) );
uint32_t func = (_state&BGFX_STATE_DEPTH_TEST_MASK)>>BGFX_STATE_DEPTH_TEST_SHIFT;
_desc.DepthEnable = 0 != func;
_desc.DepthWriteMask = !!(BGFX_STATE_DEPTH_WRITE & _state)
@@ -2212,7 +2212,7 @@ data.NumQualityLevels = 0;
uint32_t setInputLayout(D3D12_INPUT_ELEMENT_DESC* _vertexElements, const VertexDecl& _vertexDecl, const ProgramD3D12& _program, uint8_t _numInstanceData)
{
VertexDecl decl;
memcpy(&decl, &_vertexDecl, sizeof(VertexDecl) );
bx::memCopy(&decl, &_vertexDecl, sizeof(VertexDecl) );
const uint16_t* attrMask = _program.m_vsh->m_attrMask;
for (uint32_t ii = 0; ii < Attrib::Count; ++ii)
@@ -2249,7 +2249,7 @@ data.NumQualityLevels = 0;
++elem;
}
memcpy(curr, &inst, sizeof(D3D12_INPUT_ELEMENT_DESC) );
bx::memCopy(curr, &inst, sizeof(D3D12_INPUT_ELEMENT_DESC) );
curr->InputSlot = 1;
curr->SemanticIndex = index;
curr->AlignedByteOffset = ii*16;
@@ -2291,7 +2291,7 @@ data.NumQualityLevels = 0;
}
D3D12_COMPUTE_PIPELINE_STATE_DESC desc;
memset(&desc, 0, sizeof(desc) );
bx::memSet(&desc, 0, sizeof(desc) );
desc.pRootSignature = m_rootSignature;
@@ -2330,7 +2330,7 @@ data.NumQualityLevels = 0;
_stencil &= packStencil(~BGFX_STENCIL_FUNC_REF_MASK, BGFX_STENCIL_MASK);
VertexDecl decl;
memcpy(&decl, &m_vertexDecls[_declIdx], sizeof(VertexDecl) );
bx::memCopy(&decl, &m_vertexDecls[_declIdx], sizeof(VertexDecl) );
const uint16_t* attrMask = program.m_vsh->m_attrMask;
for (uint32_t ii = 0; ii < Attrib::Count; ++ii)
@@ -2361,7 +2361,7 @@ data.NumQualityLevels = 0;
}
D3D12_GRAPHICS_PIPELINE_STATE_DESC desc;
memset(&desc, 0, sizeof(desc) );
bx::memSet(&desc, 0, sizeof(desc) );
desc.pRootSignature = m_rootSignature;
@@ -2369,7 +2369,7 @@ data.NumQualityLevels = 0;
desc.VS.BytecodeLength = program.m_vsh->m_code->size;
const Memory* temp = alloc(program.m_fsh->m_code->size);
memset(temp->data, 0, temp->size);
bx::memSet(temp->data, 0, temp->size);
bx::MemoryReader rd(program.m_fsh->m_code->data, program.m_fsh->m_code->size);
bx::StaticMemoryBlockWriter wr(temp->data, temp->size);
@@ -2410,7 +2410,7 @@ data.NumQualityLevels = 0;
if (patchShader)
{
memcpy(temp->data, program.m_fsh->m_code->data, program.m_fsh->m_code->size);
bx::memCopy(temp->data, program.m_fsh->m_code->data, program.m_fsh->m_code->size);
bx::seek(&wr, 0, bx::Whence::Begin);
union { uint32_t offset; void* ptr; } cast =
@@ -2509,7 +2509,7 @@ data.NumQualityLevels = 0;
if (FAILED(hr) )
{
BX_TRACE("Failed to load cached PSO (HRESULT 0x%08x).", hr);
memset(&desc.CachedPSO, 0, sizeof(desc.CachedPSO) );
bx::memSet(&desc.CachedPSO, 0, sizeof(desc.CachedPSO) );
}
}
}
@@ -2632,7 +2632,7 @@ data.NumQualityLevels = 0;
else
{
UniformHandle handle;
memcpy(&handle, _uniformBuffer.read(sizeof(UniformHandle) ), sizeof(UniformHandle) );
bx::memCopy(&handle, _uniformBuffer.read(sizeof(UniformHandle) ), sizeof(UniformHandle) );
data = (const char*)m_uniforms[handle.idx];
}
@@ -2977,7 +2977,7 @@ data.NumQualityLevels = 0;
D3D12_SHADER_RESOURCE_VIEW_DESC* srvd = &_texture.m_srvd;
if (0 != _mip)
{
memcpy(&tmpSrvd, srvd, sizeof(tmpSrvd) );
bx::memCopy(&tmpSrvd, srvd, sizeof(tmpSrvd) );
srvd = &tmpSrvd;
switch (_texture.m_srvd.ViewDimension)
@@ -3023,7 +3023,7 @@ data.NumQualityLevels = 0;
if (0 != _mip)
{
memcpy(&tmpUavd, uavd, sizeof(tmpUavd) );
bx::memCopy(&tmpUavd, uavd, sizeof(tmpUavd) );
uavd = &tmpUavd;
switch (_texture.m_uavd.ViewDimension)
@@ -3473,7 +3473,7 @@ data.NumQualityLevels = 0;
}
else
{
memset(&cmd.vbv[1], 0, sizeof(cmd.vbv[1]) );
bx::memSet(&cmd.vbv[1], 0, sizeof(cmd.vbv[1]) );
}
cmd.draw.InstanceCount = _draw.m_numInstances;
cmd.draw.VertexCountPerInstance = numVertices;
@@ -3514,7 +3514,7 @@ data.NumQualityLevels = 0;
}
else
{
memset(&cmd.vbv[1], 0, sizeof(cmd.vbv[1]) );
bx::memSet(&cmd.vbv[1], 0, sizeof(cmd.vbv[1]) );
}
cmd.drawIndexed.IndexCountPerInstance = numIndices;
cmd.drawIndexed.InstanceCount = _draw.m_numInstances;
@@ -3581,7 +3581,7 @@ data.NumQualityLevels = 0;
if (0 != memcmp(m_current.vbv, cmd.vbv, sizeof(cmd.vbv) ) )
{
memcpy(m_current.vbv, cmd.vbv, sizeof(cmd.vbv) );
bx::memCopy(m_current.vbv, cmd.vbv, sizeof(cmd.vbv) );
_commandList->IASetVertexBuffers(0
, 0 == cmd.vbv[1].BufferLocation ? 1 : 2
, cmd.vbv
@@ -3611,7 +3611,7 @@ data.NumQualityLevels = 0;
if (0 != memcmp(m_current.vbv, cmd.vbv, sizeof(cmd.vbv) ) )
{
memcpy(m_current.vbv, cmd.vbv, sizeof(cmd.vbv) );
bx::memCopy(m_current.vbv, cmd.vbv, sizeof(cmd.vbv) );
_commandList->IASetVertexBuffers(0
, 0 == cmd.vbv[1].BufferLocation ? 1 : 2
, cmd.vbv
@@ -3620,7 +3620,7 @@ data.NumQualityLevels = 0;
if (0 != memcmp(&m_current.ibv, &cmd.ibv, sizeof(cmd.ibv) ) )
{
memcpy(&m_current.ibv, &cmd.ibv, sizeof(cmd.ibv) );
bx::memCopy(&m_current.ibv, &cmd.ibv, sizeof(cmd.ibv) );
_commandList->IASetIndexBuffer(&cmd.ibv);
}
@@ -3644,14 +3644,14 @@ data.NumQualityLevels = 0;
if (_clean)
{
memset(&m_current, 0, sizeof(m_current) );
bx::memSet(&m_current, 0, sizeof(m_current) );
}
}
void BatchD3D12::begin()
{
memset(&m_stats, 0, sizeof(m_stats) );
memset(&m_current, 0, sizeof(m_current) );
bx::memSet(&m_stats, 0, sizeof(m_stats) );
bx::memSet(&m_current, 0, sizeof(m_current) );
}
void BatchD3D12::end(ID3D12GraphicsCommandList* _commandList)
@@ -3772,7 +3772,7 @@ data.NumQualityLevels = 0;
ID3D12Resource* staging = createCommittedResource(s_renderD3D12->m_device, HeapProperty::Upload, _size);
uint8_t* data;
DX_CHECK(staging->Map(0, NULL, (void**)&data) );
memcpy(data, _data, _size);
bx::memCopy(data, _data, _size);
staging->Unmap(0, NULL);
D3D12_RESOURCE_STATES state = setState(_commandList, D3D12_RESOURCE_STATE_COPY_DEST);
@@ -3933,7 +3933,7 @@ data.NumQualityLevels = 0;
uint8_t numAttrs = 0;
bx::read(&reader, numAttrs);
memset(m_attrMask, 0, sizeof(m_attrMask) );
bx::memSet(m_attrMask, 0, sizeof(m_attrMask) );
for (uint32_t ii = 0; ii < numAttrs; ++ii)
{
@@ -4128,7 +4128,7 @@ data.NumQualityLevels = 0;
const uint32_t msaaQuality = bx::uint32_satsub( (m_flags&BGFX_TEXTURE_RT_MSAA_MASK)>>BGFX_TEXTURE_RT_MSAA_SHIFT, 1);
const DXGI_SAMPLE_DESC& msaa = s_msaa[msaaQuality];
memset(&m_srvd, 0, sizeof(m_srvd) );
bx::memSet(&m_srvd, 0, sizeof(m_srvd) );
m_srvd.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
m_srvd.Format = s_textureFormat[m_textureFormat].m_fmtSrv;
DXGI_FORMAT format = s_textureFormat[m_textureFormat].m_fmt;
@@ -4385,7 +4385,7 @@ data.NumQualityLevels = 0;
DX_CHECK(staging->Map(0, NULL, (void**)&data) );
for (uint32_t ii = 0, height = _rect.m_height; ii < height; ++ii)
{
memcpy(&data[ii*rowPitch], &_mem->data[ii*srcpitch], srcpitch);
bx::memCopy(&data[ii*rowPitch], &_mem->data[ii*srcpitch], srcpitch);
}
staging->Unmap(0, NULL);
@@ -4431,7 +4431,7 @@ data.NumQualityLevels = 0;
{
m_denseIdx = UINT16_MAX;
m_numTh = _num;
memcpy(m_attachment, _attachment, _num*sizeof(Attachment) );
bx::memCopy(m_attachment, _attachment, _num*sizeof(Attachment) );
postReset();
}
@@ -5286,7 +5286,7 @@ data.NumQualityLevels = 0;
}
else
{
memcpy(&srvHandle[stage], &srvHandle[0], sizeof(D3D12_GPU_DESCRIPTOR_HANDLE) );
bx::memCopy(&srvHandle[stage], &srvHandle[0], sizeof(D3D12_GPU_DESCRIPTOR_HANDLE) );
samplerFlags[stage] = 0;
}
}

View File

@@ -231,14 +231,14 @@ namespace bgfx { namespace d3d12
{
BX_CHECK(NULL != _vsh->m_code, "Vertex shader doesn't exist.");
m_vsh = _vsh;
memcpy(&m_predefined[0], _vsh->m_predefined, _vsh->m_numPredefined*sizeof(PredefinedUniform));
bx::memCopy(&m_predefined[0], _vsh->m_predefined, _vsh->m_numPredefined*sizeof(PredefinedUniform));
m_numPredefined = _vsh->m_numPredefined;
if (NULL != _fsh)
{
BX_CHECK(NULL != _fsh->m_code, "Fragment shader doesn't exist.");
m_fsh = _fsh;
memcpy(&m_predefined[m_numPredefined], _fsh->m_predefined, _fsh->m_numPredefined*sizeof(PredefinedUniform));
bx::memCopy(&m_predefined[m_numPredefined], _fsh->m_predefined, _fsh->m_numPredefined*sizeof(PredefinedUniform));
m_numPredefined += _fsh->m_numPredefined;
}
}
@@ -271,8 +271,8 @@ namespace bgfx { namespace d3d12
, m_state(D3D12_RESOURCE_STATE_COMMON)
, m_numMips(0)
{
memset(&m_srvd, 0, sizeof(m_srvd) );
memset(&m_uavd, 0, sizeof(m_uavd) );
bx::memSet(&m_srvd, 0, sizeof(m_srvd) );
bx::memSet(&m_uavd, 0, sizeof(m_uavd) );
}
void create(const Memory* _mem, uint32_t _flags, uint8_t _skip);
@@ -380,7 +380,7 @@ namespace bgfx { namespace d3d12
, m_minIndirect(0)
, m_flushPerBatch(0)
{
memset(m_num, 0, sizeof(m_num) );
bx::memSet(m_num, 0, sizeof(m_num) );
}
~BatchD3D12()

View File

@@ -329,13 +329,13 @@ namespace bgfx { namespace d3d9
ErrorState::Enum errorState = ErrorState::Default;
m_fbh.idx = invalidHandle;
memset(m_uniforms, 0, sizeof(m_uniforms) );
memset(&m_resolution, 0, sizeof(m_resolution) );
bx::memSet(m_uniforms, 0, sizeof(m_uniforms) );
bx::memSet(&m_resolution, 0, sizeof(m_resolution) );
D3DFORMAT adapterFormat = D3DFMT_X8R8G8B8;
// http://msdn.microsoft.com/en-us/library/windows/desktop/bb172588%28v=vs.85%29.aspx
memset(&m_params, 0, sizeof(m_params) );
bx::memSet(&m_params, 0, sizeof(m_params) );
m_params.BackBufferWidth = BGFX_DEFAULT_WIDTH;
m_params.BackBufferHeight = BGFX_DEFAULT_HEIGHT;
m_params.BackBufferFormat = adapterFormat;
@@ -1023,7 +1023,7 @@ namespace bgfx { namespace d3d9
for (uint32_t yy = 0, height = srcHeight; yy < height; ++yy)
{
memcpy(dst, src, pitch);
bx::memCopy(dst, src, pitch);
src += srcPitch;
dst += dstPitch;
@@ -1117,7 +1117,7 @@ namespace bgfx { namespace d3d9
uint32_t size = BX_ALIGN_16(g_uniformTypeSize[_type]*_num);
void* data = BX_ALLOC(g_allocator, size);
memset(data, 0, size);
bx::memSet(data, 0, size);
m_uniforms[_handle.idx] = data;
m_uniformReg.add(_handle, _name, data);
}
@@ -1196,7 +1196,7 @@ namespace bgfx { namespace d3d9
void updateUniform(uint16_t _loc, const void* _data, uint32_t _size) BX_OVERRIDE
{
memcpy(m_uniforms[_loc], _data, _size);
bx::memCopy(m_uniforms[_loc], _data, _size);
}
void setMarker(const char* _marker, uint32_t _size) BX_OVERRIDE
@@ -1760,7 +1760,7 @@ namespace bgfx { namespace d3d9
else
{
UniformHandle handle;
memcpy(&handle, _uniformBuffer.read(sizeof(UniformHandle) ), sizeof(UniformHandle) );
bx::memCopy(&handle, _uniformBuffer.read(sizeof(UniformHandle) ), sizeof(UniformHandle) );
data = (const char*)m_uniforms[handle.idx];
}
@@ -2004,7 +2004,7 @@ namespace bgfx { namespace d3d9
for (uint32_t ii = 0; ii < numMrt; ++ii)
{
uint8_t index = (uint8_t)bx::uint32_min(BGFX_CONFIG_MAX_COLOR_PALETTE - 1, _clear.m_index[ii]);
memcpy(mrtClear[ii], _palette[index], 16);
bx::memCopy(mrtClear[ii], _palette[index], 16);
}
}
else
@@ -2019,7 +2019,7 @@ namespace bgfx { namespace d3d9
for (uint32_t ii = 0; ii < numMrt; ++ii)
{
memcpy(mrtClear[ii], rgba, 16);
bx::memCopy(mrtClear[ii], rgba, 16);
}
}
@@ -2311,7 +2311,7 @@ namespace bgfx { namespace d3d9
bool asInt;
_decl.decode(Attrib::Enum(attr), num, type, normalized, asInt);
memcpy(elem, &s_attrib[attr], sizeof(D3DVERTEXELEMENT9) );
bx::memCopy(elem, &s_attrib[attr], sizeof(D3DVERTEXELEMENT9) );
elem->Type = s_attribType[type][num-1][normalized];
elem->Offset = _decl.m_offset[attr];
@@ -2331,13 +2331,13 @@ namespace bgfx { namespace d3d9
for (uint8_t ii = 0; ii < _numInstanceData; ++ii)
{
memcpy(elem, &inst, sizeof(D3DVERTEXELEMENT9) );
bx::memCopy(elem, &inst, sizeof(D3DVERTEXELEMENT9) );
elem->UsageIndex = uint8_t(7-ii); // TEXCOORD7 = i_data0, TEXCOORD6 = i_data1, etc.
elem->Offset = ii*16;
++elem;
}
memcpy(elem, &s_attrib[Attrib::Count], sizeof(D3DVERTEXELEMENT9) );
bx::memCopy(elem, &s_attrib[Attrib::Count], sizeof(D3DVERTEXELEMENT9) );
IDirect3DVertexDeclaration9* ptr;
DX_CHECK(s_renderD3D9->m_device->CreateVertexDeclaration(vertexElements, &ptr) );
@@ -2346,7 +2346,7 @@ namespace bgfx { namespace d3d9
void VertexDeclD3D9::create(const VertexDecl& _decl)
{
memcpy(&m_decl, &_decl, sizeof(VertexDecl) );
bx::memCopy(&m_decl, &_decl, sizeof(VertexDecl) );
dump(m_decl);
m_ptr = createVertexDeclaration(_decl, 0);
}
@@ -2990,7 +2990,7 @@ namespace bgfx { namespace d3d9
break;
default:
memcpy(bits, mip.m_data, size);
bx::memCopy(bits, mip.m_data, size);
break;
}
}
@@ -3052,7 +3052,7 @@ namespace bgfx { namespace d3d9
break;
default:
memcpy(dst, src, rectpitch);
bx::memCopy(dst, src, rectpitch);
break;
}
src += srcpitch;
@@ -3159,7 +3159,7 @@ namespace bgfx { namespace d3d9
m_num = 0;
m_numTh = _num;
m_needResolve = false;
memcpy(m_attachment, _attachment, _num*sizeof(Attachment) );
bx::memCopy(m_attachment, _attachment, _num*sizeof(Attachment) );
for (uint32_t ii = 0; ii < _num; ++ii)
{
@@ -3216,7 +3216,7 @@ namespace bgfx { namespace d3d9
m_height = bx::uint32_max(_height, 16);
D3DPRESENT_PARAMETERS params;
memcpy(&params, &s_renderD3D9->m_params, sizeof(D3DPRESENT_PARAMETERS) );
bx::memCopy(&params, &s_renderD3D9->m_params, sizeof(D3DPRESENT_PARAMETERS) );
params.BackBufferWidth = m_width;
params.BackBufferHeight = m_height;
@@ -3326,7 +3326,7 @@ namespace bgfx { namespace d3d9
if (NULL != m_hwnd)
{
D3DPRESENT_PARAMETERS params;
memcpy(&params, &s_renderD3D9->m_params, sizeof(D3DPRESENT_PARAMETERS) );
bx::memCopy(&params, &s_renderD3D9->m_params, sizeof(D3DPRESENT_PARAMETERS) );
params.BackBufferWidth = m_width;
params.BackBufferHeight = m_height;

View File

@@ -144,7 +144,7 @@ namespace bgfx { namespace d3d9
, _discard || (m_dynamic && 0 == _offset && m_size == _size) ? D3DLOCK_DISCARD : 0
) );
memcpy(buffer, _data, _size);
bx::memCopy(buffer, _data, _size);
DX_CHECK(m_ptr->Unlock() );
}
@@ -185,7 +185,7 @@ namespace bgfx { namespace d3d9
, _discard || (m_dynamic && 0 == _offset && m_size == _size) ? D3DLOCK_DISCARD : 0
) );
memcpy(buffer, _data, _size);
bx::memCopy(buffer, _data, _size);
DX_CHECK(m_ptr->Unlock() );
}
@@ -276,8 +276,8 @@ namespace bgfx { namespace d3d9
BX_CHECK(NULL != _fsh.m_pixelShader, "Fragment shader doesn't exist.");
m_fsh = &_fsh;
memcpy(&m_predefined[0], _vsh.m_predefined, _vsh.m_numPredefined*sizeof(PredefinedUniform) );
memcpy(&m_predefined[_vsh.m_numPredefined], _fsh.m_predefined, _fsh.m_numPredefined*sizeof(PredefinedUniform) );
bx::memCopy(&m_predefined[0], _vsh.m_predefined, _vsh.m_numPredefined*sizeof(PredefinedUniform) );
bx::memCopy(&m_predefined[_vsh.m_numPredefined], _fsh.m_predefined, _fsh.m_numPredefined*sizeof(PredefinedUniform) );
m_numPredefined = _vsh.m_numPredefined + _fsh.m_numPredefined;
}

View File

@@ -1437,7 +1437,7 @@ namespace bgfx { namespace gl
, m_backBufferFbo(0)
, m_msaaBackBufferFbo(0)
{
memset(m_msaaBackBufferRbos, 0, sizeof(m_msaaBackBufferRbos) );
bx::memSet(m_msaaBackBufferRbos, 0, sizeof(m_msaaBackBufferRbos) );
}
~RendererContextGL()
@@ -1449,8 +1449,8 @@ namespace bgfx { namespace gl
m_renderdocdll = loadRenderDoc();
m_fbh.idx = invalidHandle;
memset(m_uniforms, 0, sizeof(m_uniforms) );
memset(&m_resolution, 0, sizeof(m_resolution) );
bx::memSet(m_uniforms, 0, sizeof(m_uniforms) );
bx::memSet(&m_resolution, 0, sizeof(m_resolution) );
setRenderContextSize(BGFX_DEFAULT_WIDTH, BGFX_DEFAULT_HEIGHT);
@@ -1607,7 +1607,7 @@ namespace bgfx { namespace gl
}
// Allow all texture filters.
memset(s_textureFilter, true, BX_COUNTOF(s_textureFilter) );
bx::memSet(s_textureFilter, true, BX_COUNTOF(s_textureFilter) );
bool bc123Supported = 0
|| s_extension[Extension::EXT_texture_compression_s3tc ].m_supported
@@ -2311,7 +2311,7 @@ namespace bgfx { namespace gl
void createVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) BX_OVERRIDE
{
VertexDecl& decl = m_vertexDecls[_handle.idx];
memcpy(&decl, &_decl, sizeof(VertexDecl) );
bx::memCopy(&decl, &_decl, sizeof(VertexDecl) );
dump(decl);
}
@@ -2508,7 +2508,7 @@ namespace bgfx { namespace gl
uint32_t size = g_uniformTypeSize[_type]*_num;
void* data = BX_ALLOC(g_allocator, size);
memset(data, 0, size);
bx::memSet(data, 0, size);
m_uniforms[_handle.idx] = data;
m_uniformReg.add(_handle, _name, m_uniforms[_handle.idx]);
}
@@ -2563,7 +2563,7 @@ namespace bgfx { namespace gl
void updateUniform(uint16_t _loc, const void* _data, uint32_t _size) BX_OVERRIDE
{
memcpy(m_uniforms[_loc], _data, _size);
bx::memCopy(m_uniforms[_loc], _data, _size);
}
void setMarker(const char* _marker, uint32_t _size) BX_OVERRIDE
@@ -3205,7 +3205,7 @@ namespace bgfx { namespace gl
else
{
UniformHandle handle;
memcpy(&handle, _uniformBuffer.read(sizeof(UniformHandle) ), sizeof(UniformHandle) );
bx::memCopy(&handle, _uniformBuffer.read(sizeof(UniformHandle) ), sizeof(UniformHandle) );
data = (const char*)m_uniforms[handle.idx];
}
@@ -3400,7 +3400,7 @@ namespace bgfx { namespace gl
for (uint32_t ii = 0; ii < numMrt; ++ii)
{
uint8_t index = (uint8_t)bx::uint32_min(BGFX_CONFIG_MAX_COLOR_PALETTE-1, _clear.m_index[ii]);
memcpy(mrtClear[ii], _palette[index], 16);
bx::memCopy(mrtClear[ii], _palette[index], 16);
}
}
else
@@ -3415,7 +3415,7 @@ namespace bgfx { namespace gl
for (uint32_t ii = 0; ii < numMrt; ++ii)
{
memcpy(mrtClear[ii], rgba, 16);
bx::memCopy(mrtClear[ii], rgba, 16);
}
}
@@ -3536,7 +3536,7 @@ namespace bgfx { namespace gl
, m_textureSwapChain(NULL)
, m_mirrorTexture(NULL)
{
memset(&m_eyeTarget, 0, sizeof(m_eyeTarget) );
bx::memSet(&m_eyeTarget, 0, sizeof(m_eyeTarget) );
}
static void setDefaultSamplerState()
@@ -4298,7 +4298,7 @@ namespace bgfx { namespace gl
}
}
memset(m_attributes, 0xff, sizeof(m_attributes) );
bx::memSet(m_attributes, 0xff, sizeof(m_attributes) );
uint32_t used = 0;
for (uint8_t ii = 0; ii < Attrib::Count; ++ii)
{
@@ -5312,8 +5312,8 @@ namespace bgfx { namespace gl
void strins(char* _str, const char* _insert)
{
size_t len = bx::strnlen(_insert);
memmove(&_str[len], _str, bx::strnlen(_str)+1);
memcpy(_str, _insert, len);
bx::memMove(&_str[len], _str, bx::strnlen(_str)+1);
bx::memCopy(_str, _insert, len);
}
void ShaderGL::create(Memory* _mem)
@@ -5543,7 +5543,7 @@ namespace bgfx { namespace gl
{
char* insert = const_cast<char*>(fragDepth);
strins(insert, "bg");
memcpy(insert + 2, "fx", 2);
bx::memCopy(insert + 2, "fx", 2);
}
}
else if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL)
@@ -5814,7 +5814,7 @@ namespace bgfx { namespace gl
m_denseIdx = UINT16_MAX;
m_numTh = _num;
memcpy(m_attachment, _attachment, _num*sizeof(Attachment) );
bx::memCopy(m_attachment, _attachment, _num*sizeof(Attachment) );
m_needPresent = false;
@@ -5988,7 +5988,7 @@ namespace bgfx { namespace gl
m_swapChain = NULL;
}
memset(m_fbo, 0, sizeof(m_fbo) );
bx::memSet(m_fbo, 0, sizeof(m_fbo) );
uint16_t denseIdx = m_denseIdx;
m_denseIdx = UINT16_MAX;
m_needPresent = false;

View File

@@ -1310,7 +1310,7 @@ namespace bgfx { namespace gl
, m_num(0)
, m_needPresent(false)
{
memset(m_fbo, 0, sizeof(m_fbo) );
bx::memSet(m_fbo, 0, sizeof(m_fbo) );
}
void create(uint8_t _num, const Attachment* _attachment);

View File

@@ -726,8 +726,8 @@ VK_IMPORT_DEVICE
ErrorState::Enum errorState = ErrorState::Default;
m_fbh.idx = invalidHandle;
memset(m_uniforms, 0, sizeof(m_uniforms) );
memset(&m_resolution, 0, sizeof(m_resolution) );
bx::memSet(m_uniforms, 0, sizeof(m_uniforms) );
bx::memSet(&m_resolution, 0, sizeof(m_resolution) );
bool imported = true;
VkResult result;
@@ -1969,7 +1969,7 @@ VK_IMPORT_DEVICE
void createVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) BX_OVERRIDE
{
VertexDecl& decl = m_vertexDecls[_handle.idx];
memcpy(&decl, &_decl, sizeof(VertexDecl) );
bx::memCopy(&decl, &_decl, sizeof(VertexDecl) );
dump(decl);
}
@@ -2098,7 +2098,7 @@ VK_IMPORT_DEVICE
uint32_t size = BX_ALIGN_16(g_uniformTypeSize[_type] * _num);
void* data = BX_ALLOC(g_allocator, size);
memset(data, 0, size);
bx::memSet(data, 0, size);
m_uniforms[_handle.idx] = data;
m_uniformReg.add(_handle, _name, data);
}
@@ -2123,7 +2123,7 @@ VK_IMPORT_DEVICE
void updateUniform(uint16_t _loc, const void* _data, uint32_t _size) BX_OVERRIDE
{
memcpy(m_uniforms[_loc], _data, _size);
bx::memCopy(m_uniforms[_loc], _data, _size);
}
void setMarker(const char* /*_marker*/, uint32_t /*_size*/) BX_OVERRIDE
@@ -2224,12 +2224,12 @@ VK_IMPORT_DEVICE
BX_UNUSED(_flags, _regIndex, _val, _numRegs);
if (_flags&BGFX_UNIFORM_FRAGMENTBIT)
{
memcpy(&m_fsScratch[_regIndex], _val, _numRegs*16);
bx::memCopy(&m_fsScratch[_regIndex], _val, _numRegs*16);
m_fsChanges += _numRegs;
}
else
{
memcpy(&m_vsScratch[_regIndex], _val, _numRegs*16);
bx::memCopy(&m_vsScratch[_regIndex], _val, _numRegs*16);
m_vsChanges += _numRegs;
}
}
@@ -2257,12 +2257,12 @@ VK_IMPORT_DEVICE
uint8_t* data = (uint8_t*)m_scratchBuffer[m_backBufferColorIdx].allocUbv(descriptorBufferInfo, total);
uint32_t size = program.m_vsh->m_size;
memcpy(data, m_vsScratch, size);
bx::memCopy(data, m_vsScratch, size);
data += size;
if (NULL != program.m_fsh)
{
memcpy(data, m_fsScratch, program.m_fsh->m_size);
bx::memCopy(data, m_fsScratch, program.m_fsh->m_size);
}
vkCmdBindDescriptorSets(_commandBuffer
@@ -2446,7 +2446,7 @@ VK_IMPORT_DEVICE
{
for (uint32_t ii = 1; ii < numAttachments; ++ii)
{
memcpy(&bas[ii], bas, sizeof(VkPipelineColorBlendAttachmentState) );
bx::memCopy(&bas[ii], bas, sizeof(VkPipelineColorBlendAttachmentState) );
}
}
@@ -2530,7 +2530,7 @@ VK_IMPORT_DEVICE
_vertexInputState.flags = 0;
VertexDecl decl;
memcpy(&decl, &_vertexDecl, sizeof(VertexDecl) );
bx::memCopy(&decl, &_vertexDecl, sizeof(VertexDecl) );
const uint16_t* attrMask = _program.m_vsh->m_attrMask;
for (uint32_t ii = 0; ii < Attrib::Count; ++ii)
@@ -2551,7 +2551,7 @@ VK_IMPORT_DEVICE
uint32_t index = 7 - ii; // TEXCOORD7 = i_data0, TEXCOORD6 = i_data1, etc.
BX_UNUSED(index);
// memcpy(curr, &inst, sizeof(D3D12_INPUT_ELEMENT_DESC) );
// bx::memCopy(curr, &inst, sizeof(D3D12_INPUT_ELEMENT_DESC) );
// curr->InputSlot = 1;
// curr->SemanticIndex = index;
// curr->AlignedByteOffset = ii*16;
@@ -2591,7 +2591,7 @@ VK_IMPORT_DEVICE
_stencil &= packStencil(~BGFX_STENCIL_FUNC_REF_MASK, BGFX_STENCIL_MASK);
VertexDecl decl;
memcpy(&decl, &m_vertexDecls[_declIdx], sizeof(VertexDecl) );
bx::memCopy(&decl, &m_vertexDecls[_declIdx], sizeof(VertexDecl) );
const uint16_t* attrMask = program.m_vsh->m_attrMask;
for (uint32_t ii = 0; ii < Attrib::Count; ++ii)
@@ -2806,7 +2806,7 @@ VK_IMPORT_DEVICE
else
{
UniformHandle handle;
memcpy(&handle, _uniformBuffer.read(sizeof(UniformHandle) ), sizeof(UniformHandle) );
bx::memCopy(&handle, _uniformBuffer.read(sizeof(UniformHandle) ), sizeof(UniformHandle) );
data = (const char*)m_uniforms[handle.idx];
}
@@ -2891,7 +2891,7 @@ VK_IMPORT_DEVICE
attachments[mrt].colorAttachment = mrt;
attachments[mrt].aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
uint8_t index = (uint8_t)bx::uint32_min(BGFX_CONFIG_MAX_COLOR_PALETTE-1, _clear.m_index[ii]);
memcpy(&attachments[mrt].clearValue.color.float32, _palette[index], 16);
bx::memCopy(&attachments[mrt].clearValue.color.float32, _palette[index], 16);
++mrt;
}
}
@@ -2909,7 +2909,7 @@ VK_IMPORT_DEVICE
{
attachments[mrt].colorAttachment = mrt;
attachments[mrt].aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
memcpy(&attachments[mrt].clearValue.color.float32, frgba, 16);
bx::memCopy(&attachments[mrt].clearValue.color.float32, frgba, 16);
++mrt;
}
}
@@ -3344,7 +3344,7 @@ VK_DESTROY
{
void* dst;
VK_CHECK(vkMapMemory(device, m_deviceMem, 0, ma.allocationSize, 0, &dst) );
memcpy(dst, _data, _size);
bx::memCopy(dst, _data, _size);
vkUnmapMemory(device, m_deviceMem);
}
@@ -3496,8 +3496,8 @@ VK_DESTROY
bx::skip(&reader, shaderSize+1);
m_code = alloc( ( (shaderSize+3)/4)*4);
memset(m_code->data, 0, m_code->size);
memcpy(m_code->data
bx::memSet(m_code->data, 0, m_code->size);
bx::memCopy(m_code->data
, code
, shaderSize+1
);
@@ -3510,7 +3510,7 @@ VK_DESTROY
: sizeof(fs_cubes_spv)
;
m_code = alloc(shaderSize);
memcpy(m_code->data
bx::memCopy(m_code->data
, BGFX_CHUNK_MAGIC_VSH == magic
? vs_cubes_spv
: fs_cubes_spv
@@ -3526,7 +3526,7 @@ VK_DESTROY
smci.pCode = (const uint32_t*)m_code->data;
VK_CHECK(vkCreateShaderModule(s_renderVK->m_device, &smci, s_renderVK->m_allocatorCb, &m_module) );
memset(m_attrMask, 0, sizeof(m_attrMask) );
bx::memSet(m_attrMask, 0, sizeof(m_attrMask) );
m_attrMask[Attrib::Position] = UINT16_MAX;
m_attrMask[Attrib::Color0] = UINT16_MAX;
iohash = 0;
@@ -4174,7 +4174,7 @@ BX_UNUSED(currentSamplerStateIdx);
// }
// else
// {
// memcpy(&srvHandle[stage], &srvHandle[0], sizeof(D3D12_GPU_DESCRIPTOR_HANDLE) );
// bx::memCopy(&srvHandle[stage], &srvHandle[0], sizeof(D3D12_GPU_DESCRIPTOR_HANDLE) );
// samplerFlags[stage] = 0;
// }
// }

View File

@@ -398,14 +398,14 @@ VK_DESTROY
{
BX_CHECK(NULL != _vsh->m_code, "Vertex shader doesn't exist.");
m_vsh = _vsh;
memcpy(&m_predefined[0], _vsh->m_predefined, _vsh->m_numPredefined*sizeof(PredefinedUniform));
bx::memCopy(&m_predefined[0], _vsh->m_predefined, _vsh->m_numPredefined*sizeof(PredefinedUniform));
m_numPredefined = _vsh->m_numPredefined;
if (NULL != _fsh)
{
BX_CHECK(NULL != _fsh->m_code, "Fragment shader doesn't exist.");
m_fsh = _fsh;
memcpy(&m_predefined[m_numPredefined], _fsh->m_predefined, _fsh->m_numPredefined*sizeof(PredefinedUniform));
bx::memCopy(&m_predefined[m_numPredefined], _fsh->m_predefined, _fsh->m_numPredefined*sizeof(PredefinedUniform));
m_numPredefined += _fsh->m_numPredefined;
}
}

View File

@@ -749,7 +749,7 @@ namespace bgfx
uint8_t* data = (uint8_t*)mb.more();
uint32_t size = uint32_t(bx::getSize(&writer) );
_dst.byteCode.reserve(size);
memcpy(_dst.byteCode.data(), data, size);
bx::memCopy(_dst.byteCode.data(), data, size);
}
} // namespace bgfx

View File

@@ -730,21 +730,21 @@ namespace bgfx
}
uint32_t last[16];
memset(last, 0, sizeof(last) );
bx::memSet(last, 0, sizeof(last) );
const uint32_t remaining = _size & 0x3f;
if (remaining >= 56)
{
memcpy(&last[0], data, remaining);
bx::memCopy(&last[0], data, remaining);
last[remaining/4] = 0x80;
dxbcHashBlock(last, hash);
memset(&last[1], 0, 56);
bx::memSet(&last[1], 0, 56);
}
else
{
memcpy(&last[1], data, remaining);
bx::memCopy(&last[1], data, remaining);
last[1 + remaining/4] = 0x80;
}
@@ -752,7 +752,7 @@ namespace bgfx
last[15] = _size * 2 + 1;
dxbcHashBlock(last, hash);
memcpy(_digest, hash, 16);
bx::memCopy(_digest, hash, 16);
}
int32_t read(bx::ReaderI* _reader, DxbcSubOperand& _subOperand, bx::Error* _err)
@@ -1928,7 +1928,7 @@ namespace bgfx
uint8_t* data = (uint8_t*)mb.more();
uint32_t size = uint32_t(bx::getSize(&writer) );
_dst.byteCode.reserve(size);
memcpy(_dst.byteCode.data(), data, size);
bx::memCopy(_dst.byteCode.data(), data, size);
}
} // namespace bgfx

View File

@@ -74,8 +74,8 @@ namespace bgfx
{
m_hash = _renderer; // use hash to store renderer type while building VertexDecl.
m_stride = 0;
memset(m_attributes, 0xff, sizeof(m_attributes) );
memset(m_offset, 0, sizeof(m_offset) );
bx::memSet(m_attributes, 0xff, sizeof(m_attributes) );
bx::memSet(m_offset, 0, sizeof(m_offset) );
return *this;
}
@@ -513,7 +513,7 @@ namespace bgfx
break;
case AttribType::Float:
memcpy(data, _input, num*sizeof(float) );
bx::memCopy(data, _input, num*sizeof(float) );
break;
}
}
@@ -522,7 +522,7 @@ namespace bgfx
{
if (!_decl.has(_attr) )
{
memset(_output, 0, 4*sizeof(float) );
bx::memSet(_output, 0, 4*sizeof(float) );
return;
}
@@ -630,7 +630,7 @@ namespace bgfx
break;
case AttribType::Float:
memcpy(_output, data, num*sizeof(float) );
bx::memCopy(_output, data, num*sizeof(float) );
_output += num;
break;
}
@@ -648,7 +648,7 @@ namespace bgfx
{
if (_destDecl.m_hash == _srcDecl.m_hash)
{
memcpy(_destData, _srcData, _srcDecl.getSize(_num) );
bx::memCopy(_destData, _srcData, _srcDecl.getSize(_num) );
return;
}
@@ -721,11 +721,11 @@ namespace bgfx
switch (cop.op)
{
case ConvertOp::Set:
memset(dest + cop.dest, 0, cop.size);
bx::memSet(dest + cop.dest, 0, cop.size);
break;
case ConvertOp::Copy:
memcpy(dest + cop.dest, src + cop.src, cop.size);
bx::memCopy(dest + cop.dest, src + cop.src, cop.size);
break;
case ConvertOp::Convert:
@@ -755,7 +755,7 @@ namespace bgfx
const float epsilonSq = _epsilon*_epsilon;
uint32_t numVertices = 0;
memset(_output, 0xff, _num*sizeof(uint16_t) );
bx::memSet(_output, 0xff, _num*sizeof(uint16_t) );
for (uint32_t ii = 0; ii < _num; ++ii)
{
@@ -800,7 +800,7 @@ namespace bgfx
const uint32_t size = sizeof(uint16_t)*(hashSize + _num);
uint16_t* hashTable = (uint16_t*)alloca(size);
memset(hashTable, 0xff, size);
bx::memSet(hashTable, 0xff, size);
uint16_t* next = hashTable + hashSize;