removed platform defines from CommonInclude #54

This commit is contained in:
Turanszki Janos
2019-11-23 16:38:08 +00:00
parent fbb53e3a6d
commit be79d4c097
36 changed files with 218 additions and 216 deletions
+3 -3
View File
@@ -239,7 +239,7 @@ LightWindow::LightWindow(wiGUI* gui) : GUI(gui)
lensflare_Label->SetSize(XMFLOAT2(140, 20));
lightWindow->AddWidget(lensflare_Label);
for (size_t i = 0; i < ARRAYSIZE(lensflare_Button); ++i)
for (size_t i = 0; i < arraysize(lensflare_Button); ++i)
{
lensflare_Button[i] = new wiButton("LensFlareSlot");
lensflare_Button[i]->SetText("");
@@ -333,7 +333,7 @@ void LightWindow::SetEntity(Entity entity)
SetLightType(light->GetType());
for (size_t i = 0; i < ARRAYSIZE(lensflare_Button); ++i)
for (size_t i = 0; i < arraysize(lensflare_Button); ++i)
{
if (light->lensFlareRimTextures.size() > i && light->lensFlareRimTextures[i] && !light->lensFlareNames[i].empty())
{
@@ -361,7 +361,7 @@ void LightWindow::SetEntity(Entity entity)
energySlider->SetEnabled(false);
colorPicker->SetEnabled(false);
for (size_t i = 0; i < ARRAYSIZE(lensflare_Button); ++i)
for (size_t i = 0; i < arraysize(lensflare_Button); ++i)
{
lensflare_Button[i]->SetEnabled(false);
}
+6 -6
View File
@@ -84,7 +84,7 @@ Translator::Translator()
XMFLOAT4(0,0,0,1), XMFLOAT4(1,1,1,1),
XMFLOAT4(3,0,0,1), XMFLOAT4(1,1,1,1),
};
vertexCount_Axis = ARRAYSIZE(verts) / 2;
vertexCount_Axis = arraysize(verts) / 2;
GPUBufferDesc bd;
bd.Usage = USAGE_DEFAULT;
@@ -112,7 +112,7 @@ Translator::Translator()
XMFLOAT4(1,1,0,1), XMFLOAT4(1,1,1,1),
XMFLOAT4(0,1,0,1), XMFLOAT4(1,1,1,1),
};
vertexCount_Plane = ARRAYSIZE(verts) / 2;
vertexCount_Plane = arraysize(verts) / 2;
GPUBufferDesc bd;
bd.Usage = USAGE_DEFAULT;
@@ -169,7 +169,7 @@ Translator::Translator()
XMFLOAT4(edge,edge,edge,1), XMFLOAT4(1,1,1,1),
XMFLOAT4(-edge,edge,-edge,1), XMFLOAT4(1,1,1,1),
};
vertexCount_Origin = ARRAYSIZE(verts) / 2;
vertexCount_Origin = arraysize(verts) / 2;
GPUBufferDesc bd;
bd.Usage = USAGE_DEFAULT;
@@ -466,7 +466,7 @@ void Translator::Draw(const CameraComponent& camera, CommandList cmd) const
const UINT strides[] = {
sizeof(XMFLOAT4) + sizeof(XMFLOAT4),
};
device->BindVertexBuffers(vbs, 0, ARRAYSIZE(vbs), strides, nullptr, cmd);
device->BindVertexBuffers(vbs, 0, arraysize(vbs), strides, nullptr, cmd);
}
// xy
@@ -502,7 +502,7 @@ void Translator::Draw(const CameraComponent& camera, CommandList cmd) const
const UINT strides[] = {
sizeof(XMFLOAT4) + sizeof(XMFLOAT4),
};
device->BindVertexBuffers(vbs, 0, ARRAYSIZE(vbs), strides, nullptr, cmd);
device->BindVertexBuffers(vbs, 0, arraysize(vbs), strides, nullptr, cmd);
}
// x
@@ -538,7 +538,7 @@ void Translator::Draw(const CameraComponent& camera, CommandList cmd) const
const UINT strides[] = {
sizeof(XMFLOAT4) + sizeof(XMFLOAT4),
};
device->BindVertexBuffers(vbs, 0, ARRAYSIZE(vbs), strides, nullptr, cmd);
device->BindVertexBuffers(vbs, 0, arraysize(vbs), strides, nullptr, cmd);
XMStoreFloat4x4(&sb.g_xTransform, mat);
sb.g_xColor = state == TRANSLATOR_XYZ ? XMFLOAT4(1, 1, 1, 1) : XMFLOAT4(0.25f, 0.25f, 0.25f, 1);
device->UpdateBuffer(wiRenderer::GetConstantBuffer(CBTYPE_MISC), &sb, cmd);
+1 -13
View File
@@ -11,6 +11,7 @@
using namespace DirectX;
using namespace DirectX::PackedVector;
#define arraysize(a) (sizeof(a) / sizeof(a[0]))
#define ALIGN_16 void* operator new(size_t i){return _mm_malloc(i, 16);} void operator delete(void* p){_mm_free(p);}
#define SAFE_RELEASE(a) if((a)!=nullptr){(a)->Release();(a)=nullptr;}
#define SAFE_DELETE(a) {delete (a);(a)=nullptr;}
@@ -22,17 +23,4 @@ static const XMFLOAT4X4 IDENTITYMATRIX = XMFLOAT4X4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0
typedef uint64_t wiCPUHandle;
static const wiCPUHandle WI_NULL_HANDLE = 0;
// Platform specific parts:
#ifdef _WIN32
#define NOMINMAX
#include <SDKDDKVer.h>
#include <windows.h>
#endif // _WIN32
#ifdef WINSTORE_SUPPORT
#include <Windows.UI.Core.h>
#endif // WINSTORE_SUPPORT
#endif //WICKEDENGINE_COMMONINCLUDE_H
+13
View File
@@ -0,0 +1,13 @@
#pragma once
#ifdef _WIN32
#define NOMINMAX
#include <SDKDDKVer.h>
#include <windows.h>
#ifdef WINSTORE_SUPPORT
#include <Windows.UI.Core.h>
#endif // WINSTORE_SUPPORT
#endif // _WIN32
+2 -2
View File
@@ -180,7 +180,7 @@ void RenderPath3D_Deferred::Render() const
GPUBarrier::Image(&depthBuffer, IMAGE_LAYOUT_DEPTHSTENCIL, IMAGE_LAYOUT_COPY_SRC),
GPUBarrier::Image(&depthBuffer_Copy, IMAGE_LAYOUT_SHADER_RESOURCE, IMAGE_LAYOUT_COPY_DST)
};
device->Barrier(barriers, ARRAYSIZE(barriers), cmd);
device->Barrier(barriers, arraysize(barriers), cmd);
}
device->CopyResource(&depthBuffer_Copy, &depthBuffer, cmd);
@@ -190,7 +190,7 @@ void RenderPath3D_Deferred::Render() const
GPUBarrier::Image(&depthBuffer, IMAGE_LAYOUT_COPY_SRC, IMAGE_LAYOUT_DEPTHSTENCIL_READONLY),
GPUBarrier::Image(&depthBuffer_Copy, IMAGE_LAYOUT_COPY_DST, IMAGE_LAYOUT_SHADER_RESOURCE)
};
device->Barrier(barriers, ARRAYSIZE(barriers), cmd);
device->Barrier(barriers, arraysize(barriers), cmd);
}
RenderLinearDepth(cmd);
+2 -2
View File
@@ -132,7 +132,7 @@ void RenderPath3D_Forward::Render() const
GPUBarrier::Image(&depthBuffer, IMAGE_LAYOUT_DEPTHSTENCIL, IMAGE_LAYOUT_COPY_SRC),
GPUBarrier::Image(&depthBuffer_Copy, IMAGE_LAYOUT_SHADER_RESOURCE, IMAGE_LAYOUT_COPY_DST)
};
device->Barrier(barriers, ARRAYSIZE(barriers), cmd);
device->Barrier(barriers, arraysize(barriers), cmd);
}
device->CopyResource(&depthBuffer_Copy, &depthBuffer, cmd);
@@ -142,7 +142,7 @@ void RenderPath3D_Forward::Render() const
GPUBarrier::Image(&depthBuffer, IMAGE_LAYOUT_COPY_SRC, IMAGE_LAYOUT_DEPTHSTENCIL_READONLY),
GPUBarrier::Image(&depthBuffer_Copy, IMAGE_LAYOUT_COPY_DST, IMAGE_LAYOUT_SHADER_RESOURCE)
};
device->Barrier(barriers, ARRAYSIZE(barriers), cmd);
device->Barrier(barriers, arraysize(barriers), cmd);
}
}
+2 -2
View File
@@ -78,7 +78,7 @@ void RenderPath3D_TiledDeferred::Render() const
GPUBarrier::Image(&depthBuffer, IMAGE_LAYOUT_DEPTHSTENCIL, IMAGE_LAYOUT_COPY_SRC),
GPUBarrier::Image(&depthBuffer_Copy, IMAGE_LAYOUT_SHADER_RESOURCE, IMAGE_LAYOUT_COPY_DST)
};
device->Barrier(barriers, ARRAYSIZE(barriers), cmd);
device->Barrier(barriers, arraysize(barriers), cmd);
}
device->CopyResource(&depthBuffer_Copy, &depthBuffer, cmd);
@@ -88,7 +88,7 @@ void RenderPath3D_TiledDeferred::Render() const
GPUBarrier::Image(&depthBuffer, IMAGE_LAYOUT_COPY_SRC, IMAGE_LAYOUT_DEPTHSTENCIL_READONLY),
GPUBarrier::Image(&depthBuffer_Copy, IMAGE_LAYOUT_COPY_DST, IMAGE_LAYOUT_SHADER_RESOURCE)
};
device->Barrier(barriers, ARRAYSIZE(barriers), cmd);
device->Barrier(barriers, arraysize(barriers), cmd);
}
RenderLinearDepth(cmd);
+2 -2
View File
@@ -59,7 +59,7 @@ void RenderPath3D_TiledForward::Render() const
GPUBarrier::Image(&depthBuffer, IMAGE_LAYOUT_DEPTHSTENCIL, IMAGE_LAYOUT_COPY_SRC),
GPUBarrier::Image(&depthBuffer_Copy, IMAGE_LAYOUT_SHADER_RESOURCE, IMAGE_LAYOUT_COPY_DST)
};
device->Barrier(barriers, ARRAYSIZE(barriers), cmd);
device->Barrier(barriers, arraysize(barriers), cmd);
}
device->CopyResource(&depthBuffer_Copy, &depthBuffer, cmd);
@@ -69,7 +69,7 @@ void RenderPath3D_TiledForward::Render() const
GPUBarrier::Image(&depthBuffer, IMAGE_LAYOUT_COPY_SRC, IMAGE_LAYOUT_DEPTHSTENCIL_READONLY),
GPUBarrier::Image(&depthBuffer_Copy, IMAGE_LAYOUT_COPY_DST, IMAGE_LAYOUT_SHADER_RESOURCE)
};
device->Barrier(barriers, ARRAYSIZE(barriers), cmd);
device->Barrier(barriers, arraysize(barriers), cmd);
}
}
-1
View File
@@ -49,7 +49,6 @@
#include "wiGUI.h"
#include "wiWidget.h"
#include "wiHashString.h"
#include "wiWindowRegistration.h"
#include "wiArchive.h"
#include "wiSpinLock.h"
#include "wiRectPacker.h"
@@ -229,6 +229,7 @@
<ClInclude Include="$(MSBuildThisFileDirectory)BULLET\LinearMath\btVector3.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)CommonInclude.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)ConstantBufferMapping.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)Platform.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)RenderPath3D_Deferred.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)RenderPath3D_Deferred_BindLua.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)RenderPath3D_Forward.h" />
@@ -1134,6 +1134,9 @@
<ClInclude Include="$(MSBuildThisFileDirectory)wiInput_BindLua.h">
<Filter>ENGINE\Scripting\LuaBindings</Filter>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)Platform.h">
<Filter>ENGINE\Common</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(MSBuildThisFileDirectory)LUA\lapi.c">
+2 -2
View File
@@ -102,7 +102,7 @@ namespace wiAudio
assert(SUCCEEDED(hr));
XAUDIO2_EFFECT_DESCRIPTOR effects[] = { { reverbEffect, TRUE, 1 } };
XAUDIO2_EFFECT_CHAIN effectChain = { ARRAYSIZE(effects), effects };
XAUDIO2_EFFECT_CHAIN effectChain = { arraysize(effects), effects };
hr = audioEngine->CreateSubmixVoice(
&reverbSubmix,
1, // reverb is mono
@@ -279,7 +279,7 @@ namespace wiAudio
{ XAUDIO2_SEND_USEFILTER, submixVoices[instance->type] },
{ XAUDIO2_SEND_USEFILTER, reverbSubmix },
};
XAUDIO2_VOICE_SENDS SFXSendList = { ARRAYSIZE(SFXSend), SFXSend };
XAUDIO2_VOICE_SENDS SFXSendList = { arraysize(SFXSend), SFXSend };
hr = audioEngine->CreateSourceVoice(&instanceinternal->sourceVoice, &soundinternal->wfx,
0, XAUDIO2_DEFAULT_FREQ_RATIO, NULL, &SFXSendList, NULL);
-1
View File
@@ -1,5 +1,4 @@
#include "wiDirectInput.h"
#include "CommonInclude.h"
namespace wiInput
{
+1
View File
@@ -1,5 +1,6 @@
#pragma once
#include "CommonInclude.h"
#include "Platform.h"
// TODO REFACTOR
+20 -20
View File
@@ -313,13 +313,13 @@ void wiEmittedParticle::UpdateGPU(const TransformComponent& transform, const Mat
indirectBuffers.get(),
distanceBuffer.get(),
};
device->BindUAVs(CS, uavs, 0, ARRAYSIZE(uavs), cmd);
device->BindUAVs(CS, uavs, 0, arraysize(uavs), cmd);
GPUResource* resources[] = {
mesh == nullptr ? nullptr : mesh->indexBuffer.get(),
mesh == nullptr ? nullptr : (mesh->streamoutBuffer_POS != nullptr ? mesh->streamoutBuffer_POS.get() : mesh->vertexBuffer_POS.get()),
};
device->BindResources(CS, resources, TEXSLOT_ONDEMAND0, ARRAYSIZE(resources), cmd);
device->BindResources(CS, resources, TEXSLOT_ONDEMAND0, arraysize(resources), cmd);
device->Barrier(&GPUBarrier::Buffer(indirectBuffers.get(), BUFFER_STATE_INDIRECT_ARGUMENT, BUFFER_STATE_UNORDERED_ACCESS), 1, cmd);
@@ -356,11 +356,11 @@ void wiEmittedParticle::UpdateGPU(const TransformComponent& transform, const Mat
counterBuffer.get(),
particleBuffer.get(),
};
device->BindResources(CS, res_partition, 0, ARRAYSIZE(res_partition), cmd);
device->BindResources(CS, res_partition, 0, arraysize(res_partition), cmd);
GPUResource* uav_partition[] = {
sphPartitionCellIndices.get(),
};
device->BindUAVs(CS, uav_partition, 0, ARRAYSIZE(uav_partition), cmd);
device->BindUAVs(CS, uav_partition, 0, arraysize(uav_partition), cmd);
device->DispatchIndirect(indirectBuffers.get(), ARGUMENTBUFFER_OFFSET_DISPATCHSIMULATION, cmd);
device->Barrier(&GPUBarrier::Memory(), 1, cmd);
device->EventEnd(cmd);
@@ -375,7 +375,7 @@ void wiEmittedParticle::UpdateGPU(const TransformComponent& transform, const Mat
GPUResource* uav_partitionoffsets[] = {
sphPartitionCellOffsets.get(),
};
device->BindUAVs(CS, uav_partitionoffsets, 0, ARRAYSIZE(uav_partitionoffsets), cmd);
device->BindUAVs(CS, uav_partitionoffsets, 0, arraysize(uav_partitionoffsets), cmd);
device->Dispatch((uint32_t)ceilf((float)SPH_PARTITION_BUCKET_COUNT / (float)THREADCOUNT_SIMULATION), 1, 1, cmd);
device->Barrier(&GPUBarrier::Memory(), 1, cmd);
device->EventEnd(cmd);
@@ -388,7 +388,7 @@ void wiEmittedParticle::UpdateGPU(const TransformComponent& transform, const Mat
counterBuffer.get(),
sphPartitionCellIndices.get(),
};
device->BindResources(CS, res_partitionoffsets, 0, ARRAYSIZE(res_partitionoffsets), cmd);
device->BindResources(CS, res_partitionoffsets, 0, arraysize(res_partitionoffsets), cmd);
device->DispatchIndirect(indirectBuffers.get(), ARGUMENTBUFFER_OFFSET_DISPATCHSIMULATION, cmd);
device->Barrier(&GPUBarrier::Memory(), 1, cmd);
device->EventEnd(cmd);
@@ -406,11 +406,11 @@ void wiEmittedParticle::UpdateGPU(const TransformComponent& transform, const Mat
sphPartitionCellIndices.get(),
sphPartitionCellOffsets.get(),
};
device->BindResources(CS, res_density, 0, ARRAYSIZE(res_density), cmd);
device->BindResources(CS, res_density, 0, arraysize(res_density), cmd);
GPUResource* uav_density[] = {
densityBuffer.get()
};
device->BindUAVs(CS, uav_density, 0, ARRAYSIZE(uav_density), cmd);
device->BindUAVs(CS, uav_density, 0, arraysize(uav_density), cmd);
device->DispatchIndirect(indirectBuffers.get(), ARGUMENTBUFFER_OFFSET_DISPATCHSIMULATION, cmd);
device->Barrier(&GPUBarrier::Memory(), 1, cmd);
device->EventEnd(cmd);
@@ -426,11 +426,11 @@ void wiEmittedParticle::UpdateGPU(const TransformComponent& transform, const Mat
sphPartitionCellIndices.get(),
sphPartitionCellOffsets.get(),
};
device->BindResources(CS, res_force, 0, ARRAYSIZE(res_force), cmd);
device->BindResources(CS, res_force, 0, arraysize(res_force), cmd);
GPUResource* uav_force[] = {
particleBuffer.get(),
};
device->BindUAVs(CS, uav_force, 0, ARRAYSIZE(uav_force), cmd);
device->BindUAVs(CS, uav_force, 0, arraysize(uav_force), cmd);
device->DispatchIndirect(indirectBuffers.get(), ARGUMENTBUFFER_OFFSET_DISPATCHSIMULATION, cmd);
device->Barrier(&GPUBarrier::Memory(), 1, cmd);
device->EventEnd(cmd);
@@ -444,8 +444,8 @@ void wiEmittedParticle::UpdateGPU(const TransformComponent& transform, const Mat
}
device->EventBegin("Simulate", cmd);
device->BindUAVs(CS, uavs, 0, ARRAYSIZE(uavs), cmd);
device->BindResources(CS, resources, TEXSLOT_ONDEMAND0, ARRAYSIZE(resources), cmd);
device->BindUAVs(CS, uavs, 0, arraysize(uavs), cmd);
device->BindResources(CS, resources, TEXSLOT_ONDEMAND0, arraysize(resources), cmd);
// update CURRENT alive list, write NEW alive list
if (IsSorted())
@@ -475,8 +475,8 @@ void wiEmittedParticle::UpdateGPU(const TransformComponent& transform, const Mat
device->EventEnd(cmd);
device->UnbindUAVs(0, ARRAYSIZE(uavs), cmd);
device->UnbindResources(TEXSLOT_ONDEMAND0, ARRAYSIZE(resources), cmd);
device->UnbindUAVs(0, arraysize(uavs), cmd);
device->UnbindResources(TEXSLOT_ONDEMAND0, arraysize(resources), cmd);
device->EventEnd(cmd);
@@ -559,18 +559,18 @@ void wiEmittedParticle::UpdateGPU(const TransformComponent& transform, const Mat
GPUResource* res[] = {
counterBuffer.get(),
};
device->BindResources(CS, res, 0, ARRAYSIZE(res), cmd);
device->BindResources(CS, res, 0, arraysize(res), cmd);
GPUResource* uavs[] = {
indirectBuffers.get(),
};
device->BindUAVs(CS, uavs, 0, ARRAYSIZE(uavs), cmd);
device->BindUAVs(CS, uavs, 0, arraysize(uavs), cmd);
device->Dispatch(1, 1, 1, cmd);
device->Barrier(&GPUBarrier::Memory(), 1, cmd);
device->UnbindUAVs(0, ARRAYSIZE(uavs), cmd);
device->UnbindResources(0, ARRAYSIZE(res), cmd);
device->UnbindUAVs(0, arraysize(uavs), cmd);
device->UnbindResources(0, arraysize(res), cmd);
device->EventEnd(cmd);
}
}
@@ -599,13 +599,13 @@ void wiEmittedParticle::Draw(const CameraComponent& camera, const MaterialCompon
GPUBarrier::Buffer(particleBuffer.get(), BUFFER_STATE_UNORDERED_ACCESS, BUFFER_STATE_SHADER_RESOURCE),
GPUBarrier::Buffer(aliveList[1].get(), BUFFER_STATE_UNORDERED_ACCESS, BUFFER_STATE_SHADER_RESOURCE),
};
device->Barrier(barriers, ARRAYSIZE(barriers), cmd);
device->Barrier(barriers, arraysize(barriers), cmd);
const GPUResource* res[] = {
particleBuffer.get(),
aliveList[1].get() // NEW aliveList
};
device->BindResources(VS, res, 0, ARRAYSIZE(res), cmd);
device->BindResources(VS, res, 0, arraysize(res), cmd);
device->DrawInstancedIndirect(indirectBuffers.get(), ARGUMENTBUFFER_OFFSET_DRAWPARTICLES, cmd);
+1 -1
View File
@@ -41,7 +41,7 @@ namespace wiFFTGenerator
device->BindResources(CS, srvs, TEXSLOT_ONDEMAND0, 1, cmd);
const GPUResource* uavs[1] = { &pUAV_Dst };
device->BindUAVs(CS, uavs, 0, ARRAYSIZE(uavs), cmd);
device->BindUAVs(CS, uavs, 0, arraysize(uavs), cmd);
// Shader
if (istride > 1)
+5 -11
View File
@@ -308,7 +308,7 @@ void wiFont::LoadShaders()
};
vertexShader = static_cast<const VertexShader*>(wiResourceManager::GetShaderManager().add(path + "fontVS.cso", wiResourceManager::VERTEXSHADER));
wiRenderer::GetDevice()->CreateInputLayout(layout, ARRAYSIZE(layout), &vertexShader->code, &vertexLayout);
wiRenderer::GetDevice()->CreateInputLayout(layout, arraysize(layout), &vertexShader->code, &vertexLayout);
pixelShader = static_cast<const PixelShader*>(wiResourceManager::GetShaderManager().add(path + "fontPS.cso", wiResourceManager::PIXELSHADER));
@@ -500,7 +500,7 @@ void wiFont::Draw(CommandList cmd) const
const uint32_t offsets[] = {
mem.offset,
};
device->BindVertexBuffers(vbs, 0, ARRAYSIZE(vbs), strides, offsets, cmd);
device->BindVertexBuffers(vbs, 0, arraysize(vbs), strides, offsets, cmd);
assert(text.length() * 4 < 65536 && "The index buffer currently only supports so many characters!");
device->BindIndexBuffer(&indexBuffer, INDEXFORMAT_16BIT, 0, cmd);
@@ -610,13 +610,7 @@ wstring wiFont::GetText() const
}
string wiFont::GetTextA() const
{
#ifdef WIN32
if (text.empty()) return std::string();
int size_needed = WideCharToMultiByte(CP_UTF8, 0, text.c_str(), (int)text.size(), NULL, 0, NULL, NULL);
std::string strTo(size_needed, 0);
WideCharToMultiByte(CP_UTF8, 0, text.c_str(), (int)text.size(), &strTo[0], size_needed, NULL, NULL);
return strTo;
#else
return string(text.begin(),text.end());
#endif
string retval;
wiHelper::StringConvert(this->text, retval);
return retval;
}
+10 -10
View File
@@ -381,7 +381,7 @@ void wiGPUBVH::Build(const Scene& scene, CommandList cmd)
&primitiveDataBuffer,
&primitiveMortonBuffer,
};
device->BindUAVs(CS, uavs, 0, ARRAYSIZE(uavs), cmd);
device->BindUAVs(CS, uavs, 0, arraysize(uavs), cmd);
for (size_t i = 0; i < scene.objects.GetCount(); ++i)
{
@@ -413,7 +413,7 @@ void wiGPUBVH::Build(const Scene& scene, CommandList cmd)
mesh.vertexBuffer_UV1.get(),
mesh.vertexBuffer_COL.get(),
};
device->BindResources(CS, res, TEXSLOT_ONDEMAND0, ARRAYSIZE(res), cmd);
device->BindResources(CS, res, TEXSLOT_ONDEMAND0, arraysize(res), cmd);
device->Dispatch((cb.xBVHMeshTriangleCount + BVH_BUILDER_GROUPSIZE - 1) / BVH_BUILDER_GROUPSIZE, 1, 1, cmd);
@@ -425,7 +425,7 @@ void wiGPUBVH::Build(const Scene& scene, CommandList cmd)
}
device->Barrier(&GPUBarrier::Memory(), 1, cmd);
device->UnbindUAVs(0, ARRAYSIZE(uavs), cmd);
device->UnbindUAVs(0, arraysize(uavs), cmd);
}
device->UpdateBuffer(&primitiveCounterBuffer, &primitiveCount, cmd);
device->EventEnd(cmd);
@@ -442,19 +442,19 @@ void wiGPUBVH::Build(const Scene& scene, CommandList cmd)
&bvhParentBuffer,
&bvhFlagBuffer
};
device->BindUAVs(CS, uavs, 0, ARRAYSIZE(uavs), cmd);
device->BindUAVs(CS, uavs, 0, arraysize(uavs), cmd);
GPUResource* res[] = {
&primitiveCounterBuffer,
&primitiveIDBuffer,
&primitiveMortonBuffer,
};
device->BindResources(CS, res, TEXSLOT_ONDEMAND0, ARRAYSIZE(res), cmd);
device->BindResources(CS, res, TEXSLOT_ONDEMAND0, arraysize(res), cmd);
device->Dispatch((primitiveCount + BVH_BUILDER_GROUPSIZE - 1) / BVH_BUILDER_GROUPSIZE, 1, 1, cmd);
device->Barrier(&GPUBarrier::Memory(), 1, cmd);
device->UnbindUAVs(0, ARRAYSIZE(uavs), cmd);
device->UnbindUAVs(0, arraysize(uavs), cmd);
}
device->EventEnd(cmd);
@@ -467,7 +467,7 @@ void wiGPUBVH::Build(const Scene& scene, CommandList cmd)
&bvhNodeBuffer,
&bvhFlagBuffer,
};
device->BindUAVs(CS, uavs, 0, ARRAYSIZE(uavs), cmd);
device->BindUAVs(CS, uavs, 0, arraysize(uavs), cmd);
GPUResource* res[] = {
&primitiveCounterBuffer,
@@ -475,12 +475,12 @@ void wiGPUBVH::Build(const Scene& scene, CommandList cmd)
&primitiveBuffer,
&bvhParentBuffer,
};
device->BindResources(CS, res, TEXSLOT_ONDEMAND0, ARRAYSIZE(res), cmd);
device->BindResources(CS, res, TEXSLOT_ONDEMAND0, arraysize(res), cmd);
device->Dispatch((primitiveCount + BVH_BUILDER_GROUPSIZE - 1) / BVH_BUILDER_GROUPSIZE, 1, 1, cmd);
device->Barrier(&GPUBarrier::Memory(), 1, cmd);
device->UnbindUAVs(0, ARRAYSIZE(uavs), cmd);
device->UnbindUAVs(0, arraysize(uavs), cmd);
}
device->EventEnd(cmd);
@@ -584,7 +584,7 @@ void wiGPUBVH::Bind(SHADERSTAGE stage, CommandList cmd) const
&primitiveDataBuffer,
&bvhNodeBuffer,
};
device->BindResources(stage, res, TEXSLOT_ONDEMAND0, ARRAYSIZE(res), cmd);
device->BindResources(stage, res, TEXSLOT_ONDEMAND0, arraysize(res), cmd);
}
void wiGPUBVH::LoadShaders()
+7 -7
View File
@@ -86,17 +86,17 @@ namespace wiGPUSortLib
const GPUResource* res[] = {
&counterBuffer_read,
};
device->BindResources(CS, res, 0, ARRAYSIZE(res), cmd);
device->BindResources(CS, res, 0, arraysize(res), cmd);
const GPUResource* uavs[] = {
&indirectBuffer,
};
device->BindUAVs(CS, uavs, 0, ARRAYSIZE(uavs), cmd);
device->BindUAVs(CS, uavs, 0, arraysize(uavs), cmd);
device->Dispatch(1, 1, 1, cmd);
device->Barrier(&GPUBarrier::Memory(), 1, cmd);
device->UnbindUAVs(0, ARRAYSIZE(uavs), cmd);
device->UnbindUAVs(0, arraysize(uavs), cmd);
{
GPUBarrier barrier;
@@ -112,13 +112,13 @@ namespace wiGPUSortLib
const GPUResource* uavs[] = {
&indexBuffer_write,
};
device->BindUAVs(CS, uavs, 0, ARRAYSIZE(uavs), cmd);
device->BindUAVs(CS, uavs, 0, arraysize(uavs), cmd);
const GPUResource* resources[] = {
&counterBuffer_read,
&comparisonBuffer_read,
};
device->BindResources(CS, resources, 0, ARRAYSIZE(resources), cmd);
device->BindResources(CS, resources, 0, arraysize(resources), cmd);
// initial sorting:
bool bDone = true;
@@ -196,8 +196,8 @@ namespace wiGPUSortLib
presorted *= 2;
}
device->UnbindUAVs(0, ARRAYSIZE(uavs), cmd);
device->UnbindResources(0, ARRAYSIZE(resources), cmd);
device->UnbindUAVs(0, arraysize(uavs), cmd);
device->UnbindResources(0, arraysize(resources), cmd);
device->EventEnd(cmd);
+4 -4
View File
@@ -1115,14 +1115,14 @@ GraphicsDevice_DX11::GraphicsDevice_DX11(wiWindowRegistration::window_type windo
D3D_DRIVER_TYPE_WARP,
D3D_DRIVER_TYPE_REFERENCE,
};
uint32_t numDriverTypes = ARRAYSIZE(driverTypes);
uint32_t numDriverTypes = arraysize(driverTypes);
D3D_FEATURE_LEVEL featureLevels[] =
{
D3D_FEATURE_LEVEL_11_1,
D3D_FEATURE_LEVEL_11_0,
};
uint32_t numFeatureLevels = ARRAYSIZE(featureLevels);
uint32_t numFeatureLevels = arraysize(featureLevels);
for (uint32_t driverTypeIndex = 0; driverTypeIndex < numDriverTypes; driverTypeIndex++)
{
@@ -2755,7 +2755,7 @@ void GraphicsDevice_DX11::BindUAVs(SHADERSTAGE stage, const GPUResource *const*
}
void GraphicsDevice_DX11::UnbindResources(uint32_t slot, uint32_t num, CommandList cmd)
{
assert(num <= ARRAYSIZE(__nullBlob) && "Extend nullBlob to support more resource unbinding!");
assert(num <= arraysize(__nullBlob) && "Extend nullBlob to support more resource unbinding!");
deviceContexts[cmd]->PSSetShaderResources(slot, num, (ID3D11ShaderResourceView**)__nullBlob);
deviceContexts[cmd]->VSSetShaderResources(slot, num, (ID3D11ShaderResourceView**)__nullBlob);
deviceContexts[cmd]->GSSetShaderResources(slot, num, (ID3D11ShaderResourceView**)__nullBlob);
@@ -2765,7 +2765,7 @@ void GraphicsDevice_DX11::UnbindResources(uint32_t slot, uint32_t num, CommandLi
}
void GraphicsDevice_DX11::UnbindUAVs(uint32_t slot, uint32_t num, CommandList cmd)
{
assert(num <= ARRAYSIZE(__nullBlob) && "Extend nullBlob to support more resource unbinding!");
assert(num <= arraysize(__nullBlob) && "Extend nullBlob to support more resource unbinding!");
deviceContexts[cmd]->CSSetUnorderedAccessViews(slot, num, (ID3D11UnorderedAccessView**)__nullBlob, 0);
raster_uavs_count[cmd] = 0;
+2 -2
View File
@@ -3222,7 +3222,7 @@ namespace wiGraphics
ID3D12DescriptorHeap* heaps[] = {
GetFrameResources().descriptors[cmd]->resource_heap_GPU, GetFrameResources().descriptors[cmd]->sampler_heap_GPU
};
GetDirectCommandList(cmd)->SetDescriptorHeaps(ARRAYSIZE(heaps), heaps);
GetDirectCommandList(cmd)->SetDescriptorHeaps(arraysize(heaps), heaps);
GetDirectCommandList(cmd)->SetGraphicsRootSignature(graphicsRootSig);
GetDirectCommandList(cmd)->SetComputeRootSignature(computeRootSig);
@@ -3272,7 +3272,7 @@ namespace wiGraphics
}
pipelines_global.clear();
for (int i = 0; i < ARRAYSIZE(pipelines_worker); ++i)
for (int i = 0; i < arraysize(pipelines_worker); ++i)
{
for (auto& x : pipelines_worker[i])
{
+12 -12
View File
@@ -912,10 +912,10 @@ namespace wiGraphics
std::vector<VkDescriptorPoolSize> poolSizes;
poolSizes.reserve(ARRAYSIZE(tableLayout) * numTables);
poolSizes.reserve(arraysize(tableLayout) * numTables);
for (uint32_t i = 0; i < numTables; ++i)
{
for (int j = 0; j < ARRAYSIZE(tableLayout); ++j)
for (int j = 0; j < arraysize(tableLayout); ++j)
{
poolSizes.push_back(tableLayout[j]);
}
@@ -959,23 +959,23 @@ namespace wiGraphics
}
// Create null descriptor fillers:
for (int slot = 0; slot < ARRAYSIZE(null_bufferInfos); ++slot)
for (int slot = 0; slot < arraysize(null_bufferInfos); ++slot)
{
null_bufferInfos[slot].buffer = device->nullBuffer;
null_bufferInfos[slot].offset = 0;
null_bufferInfos[slot].range = VK_WHOLE_SIZE;
}
for (int slot = 0; slot < ARRAYSIZE(null_imageInfos); ++slot)
for (int slot = 0; slot < arraysize(null_imageInfos); ++slot)
{
null_imageInfos[slot] = {};
null_imageInfos[slot].imageView = device->nullImageView;
null_imageInfos[slot].imageLayout = VK_IMAGE_LAYOUT_GENERAL;
}
for (int slot = 0; slot < ARRAYSIZE(null_texelBufferViews); ++slot)
for (int slot = 0; slot < arraysize(null_texelBufferViews); ++slot)
{
null_texelBufferViews[slot] = device->nullBufferView;
}
for (int slot = 0; slot < ARRAYSIZE(null_samplerInfos); ++slot)
for (int slot = 0; slot < arraysize(null_samplerInfos); ++slot)
{
null_samplerInfos[slot] = {};
null_samplerInfos[slot].imageView = VK_NULL_HANDLE;
@@ -3889,7 +3889,7 @@ namespace wiGraphics
assert(res == VK_SUCCESS);
VkViewport viewports[6];
for (uint32_t i = 0; i < ARRAYSIZE(viewports); ++i)
for (uint32_t i = 0; i < arraysize(viewports); ++i)
{
viewports[i].x = 0;
viewports[i].y = 0;
@@ -3898,17 +3898,17 @@ namespace wiGraphics
viewports[i].minDepth = 0;
viewports[i].maxDepth = 1;
}
vkCmdSetViewport(GetDirectCommandList(cmd), 0, ARRAYSIZE(viewports), viewports);
vkCmdSetViewport(GetDirectCommandList(cmd), 0, arraysize(viewports), viewports);
VkRect2D scissors[8];
for (int i = 0; i < ARRAYSIZE(scissors); ++i)
for (int i = 0; i < arraysize(scissors); ++i)
{
scissors[i].offset.x = 0;
scissors[i].offset.y = 0;
scissors[i].extent.width = 65535;
scissors[i].extent.height = 65535;
}
vkCmdSetScissor(GetDirectCommandList(cmd), 0, ARRAYSIZE(scissors), scissors);
vkCmdSetScissor(GetDirectCommandList(cmd), 0, arraysize(scissors), scissors);
float blendConstants[] = { 1,1,1,1 };
vkCmdSetBlendConstants(GetDirectCommandList(cmd), blendConstants);
@@ -3955,7 +3955,7 @@ namespace wiGraphics
}
pipelines_global.clear();
for (int i = 0; i < ARRAYSIZE(pipelines_worker); ++i)
for (int i = 0; i < arraysize(pipelines_worker); ++i)
{
for (auto& x : pipelines_worker[i])
{
@@ -4602,7 +4602,7 @@ namespace wiGraphics
VkPipelineDynamicStateCreateInfo dynamicState = {};
dynamicState.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO;
dynamicState.dynamicStateCount = ARRAYSIZE(dynamicStates);
dynamicState.dynamicStateCount = arraysize(dynamicStates);
dynamicState.pDynamicStates = dynamicStates;
pipelineInfo.pDynamicState = &dynamicState;
+1 -1
View File
@@ -14,7 +14,7 @@
#ifdef _WIN32
#define VK_USE_PLATFORM_WIN32_KHR
#endif // WIN32
#endif // _WIN32
#include <vulkan/vulkan.h>
+6 -6
View File
@@ -125,18 +125,18 @@ void wiHairParticle::UpdateGPU(const MeshComponent& mesh, const MaterialComponen
particleBuffer.get(),
simulationBuffer.get()
};
device->BindUAVs(CS, uavs, 0, ARRAYSIZE(uavs), cmd);
device->BindUAVs(CS, uavs, 0, arraysize(uavs), cmd);
GPUResource* res[] = {
mesh.indexBuffer.get(),
mesh.streamoutBuffer_POS != nullptr ? mesh.streamoutBuffer_POS.get() : mesh.vertexBuffer_POS.get(),
};
device->BindResources(CS, res, TEXSLOT_ONDEMAND0, ARRAYSIZE(res), cmd);
device->BindResources(CS, res, TEXSLOT_ONDEMAND0, arraysize(res), cmd);
device->Dispatch(hcb.xHairNumDispatchGroups, 1, 1, cmd);
device->UnbindUAVs(0, ARRAYSIZE(uavs), cmd);
device->UnbindResources(TEXSLOT_ONDEMAND0, ARRAYSIZE(res), cmd);
device->UnbindUAVs(0, arraysize(uavs), cmd);
device->UnbindResources(TEXSLOT_ONDEMAND0, arraysize(res), cmd);
device->EventEnd(cmd);
}
@@ -169,8 +169,8 @@ void wiHairParticle::Draw(const CameraComponent& camera, const MaterialComponent
const GPUResource* res[] = {
material.GetBaseColorMap()
};
device->BindResources(PS, res, TEXSLOT_ONDEMAND0, ARRAYSIZE(res), cmd);
device->BindResources(VS, res, TEXSLOT_ONDEMAND0, ARRAYSIZE(res), cmd);
device->BindResources(PS, res, TEXSLOT_ONDEMAND0, arraysize(res), cmd);
device->BindResources(VS, res, TEXSLOT_ONDEMAND0, arraysize(res), cmd);
}
device->BindConstantBuffer(VS, cb.get(), CB_GETBINDSLOT(HairParticleCB), cmd);
+1 -1
View File
@@ -181,7 +181,7 @@ namespace wiHelper
if (!initComplete)
{
CHAR fileName[1024] = {};
GetModuleFileNameA(NULL, fileName, ARRAYSIZE(fileName));
GetModuleFileNameA(NULL, fileName, arraysize(fileName));
appDir = GetDirectoryFromPath(fileName);
initComplete = true;
}
+1
View File
@@ -1,4 +1,5 @@
#include "wiInput.h"
#include "Platform.h"
#include "wiXInput.h"
#include "wiDirectInput.h"
#include "wiRawInput.h"
+1
View File
@@ -2,6 +2,7 @@
#include "wiSpinLock.h"
#include "wiBackLog.h"
#include "wiContainers.h"
#include "Platform.h"
#include <thread>
#include <condition_variable>
+1 -1
View File
@@ -413,7 +413,7 @@ namespace wiMath
XMFLOAT4(0.9960937500f, 0.1495198903f, 0.0432000000f, 0.4635568513f),
XMFLOAT4(0.0019531250f, 0.4828532236f, 0.2432000000f, 0.6064139942f),
};
return HALTON[idx % ARRAYSIZE(HALTON)];
return HALTON[idx % arraysize(HALTON)];
}
uint32_t CompressNormal(const XMFLOAT3& normal)
+2 -2
View File
@@ -260,10 +260,10 @@ void wiOcean::UpdateDisplacementMap(const WeatherComponent& weather, float time,
&m_pBuffer_Float2_H0,
&m_pBuffer_Float_Omega
};
device->BindResources(CS, cs0_srvs, TEXSLOT_ONDEMAND0, ARRAYSIZE(cs0_srvs), cmd);
device->BindResources(CS, cs0_srvs, TEXSLOT_ONDEMAND0, arraysize(cs0_srvs), cmd);
const GPUResource* cs0_uavs[1] = { &m_pBuffer_Float2_Ht };
device->BindUAVs(CS, cs0_uavs, 0, ARRAYSIZE(cs0_uavs), cmd);
device->BindUAVs(CS, cs0_uavs, 0, arraysize(cs0_uavs), cmd);
Ocean_Simulation_PerFrameCB perFrameData;
perFrameData.g_Time = time * params.time_scale;
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -29,7 +29,7 @@ namespace wiTextureHelper
// Random64x64
{
uint8_t data[64 * 64 * 4];
for (int i = 0; i < ARRAYSIZE(data); i += 4)
for (int i = 0; i < arraysize(data); i += 4)
{
data[i] = wiRandom::getRandom(0, 255);
data[i + 1] = wiRandom::getRandom(0, 255);
+1
View File
@@ -1,5 +1,6 @@
#include "wiTimer.h"
#include "wiHelper.h"
#include "Platform.h"
double wiTimer::PCFreq = 0;
__int64 wiTimer::CounterStart = 0;
+1 -1
View File
@@ -9,7 +9,7 @@ namespace wiVersion
// minor features, major updates
const int minor = 35;
// minor bug fixes, alterations, refactors, updates
const int revision = 0;
const int revision = 1;
long GetVersion()
+5 -5
View File
@@ -2057,7 +2057,7 @@ void wiColorPicker::Render(const wiGUI* gui, CommandList cmd) const
const uint32_t strides[] = {
sizeof(Vertex),
};
wiRenderer::GetDevice()->BindVertexBuffers(vbs, 0, ARRAYSIZE(vbs), strides, nullptr, cmd);
wiRenderer::GetDevice()->BindVertexBuffers(vbs, 0, arraysize(vbs), strides, nullptr, cmd);
wiRenderer::GetDevice()->Draw(vb_saturation.GetDesc().ByteWidth / sizeof(Vertex), 0, cmd);
}
@@ -2075,7 +2075,7 @@ void wiColorPicker::Render(const wiGUI* gui, CommandList cmd) const
const uint32_t strides[] = {
sizeof(Vertex),
};
wiRenderer::GetDevice()->BindVertexBuffers(vbs, 0, ARRAYSIZE(vbs), strides, nullptr, cmd);
wiRenderer::GetDevice()->BindVertexBuffers(vbs, 0, arraysize(vbs), strides, nullptr, cmd);
wiRenderer::GetDevice()->Draw(vb_hue.GetDesc().ByteWidth / sizeof(Vertex), 0, cmd);
}
@@ -2102,7 +2102,7 @@ void wiColorPicker::Render(const wiGUI* gui, CommandList cmd) const
const uint32_t strides[] = {
sizeof(Vertex),
};
wiRenderer::GetDevice()->BindVertexBuffers(vbs, 0, ARRAYSIZE(vbs), strides, nullptr, cmd);
wiRenderer::GetDevice()->BindVertexBuffers(vbs, 0, arraysize(vbs), strides, nullptr, cmd);
wiRenderer::GetDevice()->Draw(vb_picker_hue.GetDesc().ByteWidth / sizeof(Vertex), 0, cmd);
}
@@ -2153,7 +2153,7 @@ void wiColorPicker::Render(const wiGUI* gui, CommandList cmd) const
const uint32_t strides[] = {
sizeof(Vertex),
};
wiRenderer::GetDevice()->BindVertexBuffers(vbs, 0, ARRAYSIZE(vbs), strides, nullptr, cmd);
wiRenderer::GetDevice()->BindVertexBuffers(vbs, 0, arraysize(vbs), strides, nullptr, cmd);
wiRenderer::GetDevice()->Draw(vb_picker_saturation.GetDesc().ByteWidth / sizeof(Vertex), 0, cmd);
}
@@ -2171,7 +2171,7 @@ void wiColorPicker::Render(const wiGUI* gui, CommandList cmd) const
const uint32_t strides[] = {
sizeof(Vertex),
};
wiRenderer::GetDevice()->BindVertexBuffers(vbs, 0, ARRAYSIZE(vbs), strides, nullptr, cmd);
wiRenderer::GetDevice()->BindVertexBuffers(vbs, 0, arraysize(vbs), strides, nullptr, cmd);
wiRenderer::GetDevice()->Draw(vb_preview.GetDesc().ByteWidth / sizeof(Vertex), 0, cmd);
}
+1 -1
View File
@@ -58,7 +58,7 @@ protected:
wiColor::White(),
wiColor::Gray(),
};
static_assert(ARRAYSIZE(colors) == WIDGETSTATE_COUNT, "Every WIDGETSTATE needs a default color!");
static_assert(arraysize(colors) == WIDGETSTATE_COUNT, "Every WIDGETSTATE needs a default color!");
wiColor textColor = wiColor(255, 255, 255, 255);
wiColor textShadowColor = wiColor(0, 0, 0, 255);
+1
View File
@@ -1,5 +1,6 @@
#pragma once
#include "CommonInclude.h"
#include "Platform.h"
namespace wiWindowRegistration
{