mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
Removing alloca compat include.
This commit is contained in:
@@ -707,7 +707,7 @@ uint16_t weldVertices(WeldedVertex* _output, const bgfx::VertexLayout& _layout,
|
||||
uint16_t numVertices = 0;
|
||||
|
||||
const uint32_t size = sizeof(uint16_t)*(hashSize + _num);
|
||||
uint16_t* hashTable = (uint16_t*)alloca(size);
|
||||
uint16_t* hashTable = (uint16_t*)BX_STACK_ALLOC(size);
|
||||
bx::memSet(hashTable, 0xff, size);
|
||||
|
||||
uint16_t* next = hashTable + hashSize;
|
||||
|
||||
@@ -339,7 +339,7 @@ void VectorDisplay::endDraw()
|
||||
|
||||
// from the list of points, build a list of lines
|
||||
uint32_t nlines = (uint32_t)m_pendingPoints.size() - 1;
|
||||
Line* lines = (Line*)alloca(nlines * sizeof(Line) );
|
||||
Line* lines = (Line*)BX_STACK_ALLOC(nlines * sizeof(Line) );
|
||||
|
||||
float t = effectiveThickness();
|
||||
int first_last_same = true
|
||||
@@ -630,7 +630,7 @@ void VectorDisplay::drawFan(float _cx, float _cy, float _pa, float _a, float _t,
|
||||
{
|
||||
_t = -_t;
|
||||
nsteps = (int32_t)bx::max(1.0f, bx::round(a2pa / (bx::kPi / 8.0f) ) );
|
||||
angles = (float*)alloca(sizeof(float) * (nsteps + 1) );
|
||||
angles = (float*)BX_STACK_ALLOC(sizeof(float) * (nsteps + 1) );
|
||||
for (i = 0; i <= nsteps; i++)
|
||||
{
|
||||
angles[i] = _a + i * a2pa / nsteps;
|
||||
@@ -639,7 +639,7 @@ void VectorDisplay::drawFan(float _cx, float _cy, float _pa, float _a, float _t,
|
||||
else
|
||||
{
|
||||
nsteps = (int32_t)bx::max(1.0f, bx::round(pa2a / (bx::kPi / 8.0f) ) );
|
||||
angles = (float*)alloca(sizeof(float) * (nsteps + 1) );
|
||||
angles = (float*)BX_STACK_ALLOC(sizeof(float) * (nsteps + 1) );
|
||||
for (i = 0; i <= nsteps; i++)
|
||||
{
|
||||
angles[i] = _pa + i * pa2a / nsteps;
|
||||
|
||||
@@ -1169,7 +1169,7 @@ struct DebugDrawEncoderImpl
|
||||
}
|
||||
else
|
||||
{
|
||||
mtx = (float*)alloca(_num*64);
|
||||
mtx = (float*)BX_STACK_ALLOC(_num*64);
|
||||
for (uint16_t ii = 0; ii < _num; ++ii)
|
||||
{
|
||||
const float* mtxTransform = (const float*)_mtx;
|
||||
|
||||
@@ -176,7 +176,7 @@ void showExampleDialog(entry::AppI* _app, const char* _errorText)
|
||||
|
||||
{
|
||||
uint32_t num = entry::getNumApps();
|
||||
const char** items = (const char**)alloca(num*sizeof(void*) );
|
||||
const char** items = (const char**)BX_STACK_ALLOC(num*sizeof(void*) );
|
||||
|
||||
uint32_t ii = 0;
|
||||
int32_t current = 0;
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace bgfx
|
||||
va_end(argListCopy);
|
||||
if ( (int32_t)sizeof(temp) < total)
|
||||
{
|
||||
out = (char*)alloca(total+1);
|
||||
out = (char*)BX_STACK_ALLOC(total+1);
|
||||
bx::memCopy(out, temp, len);
|
||||
bx::vsnprintf(out + len, total-len, _format, _argList);
|
||||
}
|
||||
@@ -136,7 +136,7 @@ namespace bgfx
|
||||
BX_UNUSED(_filePath, _width, _height, _pitch, _data, _size, _yflip);
|
||||
|
||||
const int32_t len = bx::strLen(_filePath)+5;
|
||||
char* filePath = (char*)alloca(len);
|
||||
char* filePath = (char*)BX_STACK_ALLOC(len);
|
||||
bx::strCopy(filePath, len, _filePath);
|
||||
bx::strCat(filePath, len, ".tga");
|
||||
|
||||
@@ -447,7 +447,7 @@ namespace bgfx
|
||||
int32_t len = bx::vsnprintf(out, sizeof(temp), _format, argList);
|
||||
if ( (int32_t)sizeof(temp) < len)
|
||||
{
|
||||
out = (char*)alloca(len+1);
|
||||
out = (char*)BX_STACK_ALLOC(len+1);
|
||||
len = bx::vsnprintf(out, len, _format, argList);
|
||||
}
|
||||
out[len] = '\0';
|
||||
@@ -642,7 +642,7 @@ namespace bgfx
|
||||
va_list argListCopy;
|
||||
va_copy(argListCopy, _argList);
|
||||
uint32_t num = bx::vsnprintf(NULL, 0, _format, argListCopy) + 1;
|
||||
char* temp = (char*)alloca(num);
|
||||
char* temp = (char*)BX_STACK_ALLOC(num);
|
||||
va_copy(argListCopy, _argList);
|
||||
num = bx::vsnprintf(temp, num, _format, argListCopy);
|
||||
|
||||
|
||||
@@ -787,8 +787,8 @@ namespace bgfx
|
||||
{
|
||||
if (0 < m_num)
|
||||
{
|
||||
uint32_t* tempKeys = (uint32_t*)alloca(sizeof(m_keys) );
|
||||
uint32_t* tempValues = (uint32_t*)alloca(sizeof(m_values) );
|
||||
uint32_t* tempKeys = (uint32_t*)BX_STACK_ALLOC(sizeof(m_keys) );
|
||||
uint32_t* tempValues = (uint32_t*)BX_STACK_ALLOC(sizeof(m_values) );
|
||||
bx::radixSort(m_keys, tempKeys, m_values, tempValues, m_num);
|
||||
return true;
|
||||
}
|
||||
@@ -4193,7 +4193,7 @@ namespace bgfx
|
||||
sr.m_num = 0;
|
||||
sr.m_uniforms = NULL;
|
||||
|
||||
UniformHandle* uniforms = (UniformHandle*)alloca(count*sizeof(UniformHandle) );
|
||||
UniformHandle* uniforms = (UniformHandle*)BX_STACK_ALLOC(count*sizeof(UniformHandle) );
|
||||
|
||||
for (uint32_t ii = 0; ii < count; ++ii)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace bgfx
|
||||
);
|
||||
if (0 != result)
|
||||
{
|
||||
HMODULE* modules = (HMODULE*)alloca(size);
|
||||
HMODULE* modules = (HMODULE*)BX_STACK_ALLOC(size);
|
||||
result = EnumProcessModules(process
|
||||
, modules
|
||||
, size
|
||||
|
||||
@@ -2089,7 +2089,7 @@ namespace bgfx { namespace d3d11
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_ANNOTATION) )
|
||||
{
|
||||
uint32_t size = _len*sizeof(wchar_t);
|
||||
wchar_t* name = (wchar_t*)alloca(size+2);
|
||||
wchar_t* name = (wchar_t*)BX_STACK_ALLOC(size+2);
|
||||
name[_len] = L'\0';
|
||||
mbstowcs(name, _marker, _len);
|
||||
PIX_SETMARKER(kColorMarker, name);
|
||||
@@ -4420,7 +4420,7 @@ namespace bgfx { namespace d3d11
|
||||
|
||||
const uint16_t numSides = ti.numLayers * (imageContainer.m_cubeMap ? 6 : 1);
|
||||
const uint32_t numSrd = numSides * ti.numMips;
|
||||
D3D11_SUBRESOURCE_DATA* srd = (D3D11_SUBRESOURCE_DATA*)alloca(numSrd*sizeof(D3D11_SUBRESOURCE_DATA) );
|
||||
D3D11_SUBRESOURCE_DATA* srd = (D3D11_SUBRESOURCE_DATA*)BX_STACK_ALLOC(numSrd*sizeof(D3D11_SUBRESOURCE_DATA) );
|
||||
|
||||
uint32_t kk = 0;
|
||||
|
||||
|
||||
@@ -606,7 +606,7 @@ namespace bgfx { namespace d3d12
|
||||
va_end(argList);
|
||||
temp[size] = '\0';
|
||||
|
||||
wchar_t* wtemp = (wchar_t*)alloca( (size+1)*2);
|
||||
wchar_t* wtemp = (wchar_t*)BX_STACK_ALLOC( (size+1)*2);
|
||||
mbstowcs(wtemp, temp, size+1);
|
||||
_object->SetName(wtemp);
|
||||
}
|
||||
@@ -5083,7 +5083,7 @@ namespace bgfx { namespace d3d12
|
||||
m_numMips = ti.numMips;
|
||||
const uint16_t numSides = ti.numLayers * (imageContainer.m_cubeMap ? 6 : 1);
|
||||
const uint32_t numSrd = numSides * ti.numMips;
|
||||
D3D12_SUBRESOURCE_DATA* srd = (D3D12_SUBRESOURCE_DATA*)alloca(numSrd*sizeof(D3D12_SUBRESOURCE_DATA) );
|
||||
D3D12_SUBRESOURCE_DATA* srd = (D3D12_SUBRESOURCE_DATA*)BX_STACK_ALLOC(numSrd*sizeof(D3D12_SUBRESOURCE_DATA) );
|
||||
|
||||
uint32_t kk = 0;
|
||||
|
||||
@@ -5224,7 +5224,7 @@ namespace bgfx { namespace d3d12
|
||||
state |= D3D12_RESOURCE_STATE_DEPTH_WRITE;
|
||||
state &= ~D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE;
|
||||
|
||||
clearValue = (D3D12_CLEAR_VALUE*)alloca(sizeof(D3D12_CLEAR_VALUE) );
|
||||
clearValue = (D3D12_CLEAR_VALUE*)BX_STACK_ALLOC(sizeof(D3D12_CLEAR_VALUE) );
|
||||
clearValue->Format = tfi.m_fmtDsv;
|
||||
clearValue->DepthStencil.Depth = 1.0f;
|
||||
clearValue->DepthStencil.Stencil = 0;
|
||||
@@ -5235,7 +5235,7 @@ namespace bgfx { namespace d3d12
|
||||
state |= D3D12_RESOURCE_STATE_RENDER_TARGET;
|
||||
state &= ~D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE;
|
||||
|
||||
clearValue = (D3D12_CLEAR_VALUE*)alloca(sizeof(D3D12_CLEAR_VALUE) );
|
||||
clearValue = (D3D12_CLEAR_VALUE*)BX_STACK_ALLOC(sizeof(D3D12_CLEAR_VALUE) );
|
||||
clearValue->Format = resourceDesc.Format;
|
||||
clearValue->Color[0] = 0.0f;
|
||||
clearValue->Color[1] = 0.0f;
|
||||
|
||||
@@ -1634,7 +1634,7 @@ namespace bgfx { namespace gl
|
||||
}
|
||||
else
|
||||
{
|
||||
data = bx::alignPtr(alloca(size+16), 0, 16);
|
||||
data = bx::alignPtr(BX_STACK_ALLOC(size+16), 0, 16);
|
||||
}
|
||||
|
||||
flushGlError();
|
||||
@@ -2338,7 +2338,7 @@ namespace bgfx { namespace gl
|
||||
if (0 < numCmpFormats)
|
||||
{
|
||||
numCmpFormats = numCmpFormats > 256 ? 256 : numCmpFormats;
|
||||
cmpFormat = (GLint*)alloca(sizeof(GLint)*numCmpFormats);
|
||||
cmpFormat = (GLint*)BX_STACK_ALLOC(sizeof(GLint)*numCmpFormats);
|
||||
GL_CHECK(glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, cmpFormat) );
|
||||
|
||||
for (GLint ii = 0; ii < numCmpFormats; ++ii)
|
||||
@@ -5137,7 +5137,7 @@ namespace bgfx { namespace gl
|
||||
}
|
||||
|
||||
uint32_t maxLength = bx::uint32_max(max0, max1);
|
||||
char* name = (char*)alloca(maxLength + 1);
|
||||
char* name = (char*)BX_STACK_ALLOC(maxLength + 1);
|
||||
|
||||
BX_TRACE("Program %d", m_id);
|
||||
BX_TRACE("Attributes (%d):", activeAttribs);
|
||||
@@ -6310,7 +6310,7 @@ namespace bgfx { namespace gl
|
||||
&& 0 != bx::strCmp(code, "#version", 8) ) // #2000
|
||||
{
|
||||
int32_t tempLen = code.getLength() + (4<<10);
|
||||
char* temp = (char*)alloca(tempLen);
|
||||
char* temp = (char*)BX_STACK_ALLOC(tempLen);
|
||||
bx::StaticMemoryBlockWriter writer(temp, tempLen);
|
||||
|
||||
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES)
|
||||
@@ -6846,7 +6846,7 @@ namespace bgfx { namespace gl
|
||||
{
|
||||
int32_t codeLen = (int32_t)bx::strLen(code);
|
||||
int32_t tempLen = codeLen + (4<<10);
|
||||
char* temp = (char*)alloca(tempLen);
|
||||
char* temp = (char*)BX_STACK_ALLOC(tempLen);
|
||||
bx::StaticMemoryBlockWriter writer(temp, tempLen);
|
||||
|
||||
int32_t verLen = 0;
|
||||
@@ -6918,7 +6918,7 @@ namespace bgfx { namespace gl
|
||||
GLsizei len;
|
||||
GL_CHECK(glGetShaderiv(m_id, GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE, &len) );
|
||||
|
||||
char* source = (char*)alloca(len);
|
||||
char* source = (char*)BX_STACK_ALLOC(len);
|
||||
GL_CHECK(glGetTranslatedShaderSourceANGLE(m_id, len, &len, source) );
|
||||
|
||||
BX_TRACE("ANGLE source (len: %d):\n%s\n####", len, source);
|
||||
|
||||
@@ -497,7 +497,7 @@ namespace bgfx
|
||||
int32_t len = bx::vsnprintf(out, max, _format, argList);
|
||||
if (len > max)
|
||||
{
|
||||
out = (char*)alloca(len);
|
||||
out = (char*)BX_STACK_ALLOC(len);
|
||||
len = bx::vsnprintf(out, len, _format, argList);
|
||||
}
|
||||
|
||||
@@ -592,7 +592,7 @@ namespace bgfx
|
||||
int32_t len = bx::vsnprintf(out, max, _format, argList);
|
||||
if (len > max)
|
||||
{
|
||||
out = (char*)alloca(len);
|
||||
out = (char*)BX_STACK_ALLOC(len);
|
||||
len = bx::vsnprintf(out, len, _format, argList);
|
||||
}
|
||||
|
||||
@@ -683,7 +683,7 @@ namespace bgfx
|
||||
{
|
||||
const int32_t len = bx::strLen(_find);
|
||||
|
||||
char* replace = (char*)alloca(len+1);
|
||||
char* replace = (char*)BX_STACK_ALLOC(len+1);
|
||||
bx::strCopy(replace, len+1, _replace);
|
||||
for (int32_t ii = bx::strLen(replace); ii < len; ++ii)
|
||||
{
|
||||
@@ -2747,7 +2747,7 @@ namespace bgfx
|
||||
bin2c = baseName(outFilePath);
|
||||
if (!bin2c.isEmpty() )
|
||||
{
|
||||
char* temp = (char*)alloca(bin2c.getLength()+1);
|
||||
char* temp = (char*)BX_STACK_ALLOC(bin2c.getLength()+1);
|
||||
for (uint32_t ii = 0, num = bin2c.getLength(); ii < num; ++ii)
|
||||
{
|
||||
char ch = bin2c.getPtr()[ii];
|
||||
|
||||
Reference in New Issue
Block a user