optimized resource binding frequency

This commit is contained in:
turanszkij
2017-05-21 22:01:51 +02:00
parent f692cf26dc
commit be6747adfc
9 changed files with 319 additions and 156 deletions
+7 -1
View File
@@ -334,7 +334,13 @@ void wiEmittedParticle::Draw(GRAPHICSTHREAD threadID, int FLAG)
device->BindBlendState((additive?blendStateAdd:blendStateAlpha),threadID);
device->BindVertexBuffer(vertexBuffer,0,sizeof(Point),threadID);
const GPUBuffer* vbs[] = {
vertexBuffer,
};
const UINT strides[] = {
sizeof(Point),
};
device->BindVertexBuffers(vbs, 0, ARRAYSIZE(vbs), strides, threadID);
if(!wireRender && material->texture)
device->BindResourcePS(material->texture,TEXSLOT_ONDEMAND0,threadID);
+8 -1
View File
@@ -291,7 +291,14 @@ void wiFont::Draw(GRAPHICSTHREAD threadID, bool scissorTest)
device->BindDepthStencilState(depthStencilState, 1, threadID);
device->BindBlendState(blendState, threadID);
device->BindVertexBuffer(vertexBuffer, 0, sizeof(Vertex), threadID);
const GPUBuffer* vbs[] = {
vertexBuffer,
};
const UINT strides[] = {
sizeof(Vertex),
};
device->BindVertexBuffers(vbs, 0, ARRAYSIZE(vbs), strides, threadID);
device->BindIndexBuffer(indexBuffer, threadID);
device->BindResourcePS(fontStyles[style].texture, TEXSLOT_ONDEMAND0, threadID);
+9 -4
View File
@@ -97,7 +97,14 @@ namespace wiGraphicsTypes
virtual void BindResourceDS(const GPUResource* resource, int slot, GRAPHICSTHREAD threadID, int arrayIndex = -1) = 0;
virtual void BindResourceHS(const GPUResource* resource, int slot, GRAPHICSTHREAD threadID, int arrayIndex = -1) = 0;
virtual void BindResourceCS(const GPUResource* resource, int slot, GRAPHICSTHREAD threadID, int arrayIndex = -1) = 0;
virtual void BindUnorderedAccessResourceCS(const GPUUnorderedResource* buffer, int slot, GRAPHICSTHREAD threadID, int arrayIndex = -1) = 0;
virtual void BindResourcesPS(const GPUResource *const* resources, int slot, int count, GRAPHICSTHREAD threadID) = 0;
virtual void BindResourcesVS(const GPUResource *const* resources, int slot, int count, GRAPHICSTHREAD threadID) = 0;
virtual void BindResourcesGS(const GPUResource *const* resources, int slot, int count, GRAPHICSTHREAD threadID) = 0;
virtual void BindResourcesDS(const GPUResource *const* resources, int slot, int count, GRAPHICSTHREAD threadID) = 0;
virtual void BindResourcesHS(const GPUResource *const* resources, int slot, int count, GRAPHICSTHREAD threadID) = 0;
virtual void BindResourcesCS(const GPUResource *const* resources, int slot, int count, GRAPHICSTHREAD threadID) = 0;
virtual void BindUnorderedAccessResourceCS(const GPUUnorderedResource* resource, int slot, GRAPHICSTHREAD threadID, int arrayIndex = -1) = 0;
virtual void BindUnorderedAccessResourcesCS(const GPUUnorderedResource *const* resources, int slot, int count, GRAPHICSTHREAD threadID) = 0;
virtual void UnBindResources(int slot, int num, GRAPHICSTHREAD threadID) = 0;
virtual void UnBindUnorderedAccessResources(int slot, int num, GRAPHICSTHREAD threadID) = 0;
virtual void BindSamplerPS(const Sampler* sampler, int slot, GRAPHICSTHREAD threadID) = 0;
@@ -112,8 +119,7 @@ namespace wiGraphicsTypes
virtual void BindConstantBufferDS(const GPUBuffer* buffer, int slot, GRAPHICSTHREAD threadID) = 0;
virtual void BindConstantBufferHS(const GPUBuffer* buffer, int slot, GRAPHICSTHREAD threadID) = 0;
virtual void BindConstantBufferCS(const GPUBuffer* buffer, int slot, GRAPHICSTHREAD threadID) = 0;
virtual void BindVertexBuffer(const GPUBuffer* vertexBuffer, int slot, UINT stride, GRAPHICSTHREAD threadID) = 0;
virtual void BindVertexBuffers(GPUBuffer* const *vertexBuffers, int slot, UINT count, const UINT* strides, GRAPHICSTHREAD threadID) = 0;
virtual void BindVertexBuffers(const GPUBuffer *const* vertexBuffers, int slot, int count, const UINT* strides, GRAPHICSTHREAD threadID) = 0;
virtual void BindIndexBuffer(const GPUBuffer* indexBuffer, GRAPHICSTHREAD threadID) = 0;
virtual void BindPrimitiveTopology(PRIMITIVETOPOLOGY type, GRAPHICSTHREAD threadID) = 0;
virtual void BindVertexLayout(const VertexLayout* layout, GRAPHICSTHREAD threadID) = 0;
@@ -121,7 +127,6 @@ namespace wiGraphicsTypes
virtual void BindBlendStateEx(const BlendState* state, const XMFLOAT4& blendFactor, UINT sampleMask, GRAPHICSTHREAD threadID) = 0;
virtual void BindDepthStencilState(const DepthStencilState* state, UINT stencilRef, GRAPHICSTHREAD threadID) = 0;
virtual void BindRasterizerState(const RasterizerState* state, GRAPHICSTHREAD threadID) = 0;
virtual void BindStreamOutTarget(const GPUBuffer* buffer, GRAPHICSTHREAD threadID) = 0;
virtual void BindStreamOutTargets(GPUBuffer* const *buffers, UINT count, GRAPHICSTHREAD threadID) = 0;
virtual void BindPS(const PixelShader* shader, GRAPHICSTHREAD threadID) = 0;
virtual void BindVS(const VertexShader* shader, GRAPHICSTHREAD threadID) = 0;
+88 -46
View File
@@ -2893,6 +2893,66 @@ void GraphicsDevice_DX11::BindResourceCS(const GPUResource* resource, int slot,
}
}
}
void GraphicsDevice_DX11::BindResourcesPS(const GPUResource *const* resources, int slot, int count, GRAPHICSTHREAD threadID)
{
assert(count <= 8);
ID3D11ShaderResourceView* srvs[8];
for (int i = 0; i < count; ++i)
{
srvs[i] = resources[i] != nullptr ? resources[i]->SRV_DX11 : nullptr;
}
deviceContexts[threadID]->PSSetShaderResources(static_cast<UINT>(slot), static_cast<UINT>(count), srvs);
}
void GraphicsDevice_DX11::BindResourcesVS(const GPUResource *const* resources, int slot, int count, GRAPHICSTHREAD threadID)
{
assert(count <= 8);
ID3D11ShaderResourceView* srvs[8];
for (int i = 0; i < count; ++i)
{
srvs[i] = resources[i] != nullptr ? resources[i]->SRV_DX11 : nullptr;
}
deviceContexts[threadID]->VSSetShaderResources(static_cast<UINT>(slot), static_cast<UINT>(count), srvs);
}
void GraphicsDevice_DX11::BindResourcesGS(const GPUResource *const* resources, int slot, int count, GRAPHICSTHREAD threadID)
{
assert(count <= 8);
ID3D11ShaderResourceView* srvs[8];
for (int i = 0; i < count; ++i)
{
srvs[i] = resources[i] != nullptr ? resources[i]->SRV_DX11 : nullptr;
}
deviceContexts[threadID]->GSSetShaderResources(static_cast<UINT>(slot), static_cast<UINT>(count), srvs);
}
void GraphicsDevice_DX11::BindResourcesDS(const GPUResource *const* resources, int slot, int count, GRAPHICSTHREAD threadID)
{
assert(count <= 8);
ID3D11ShaderResourceView* srvs[8];
for (int i = 0; i < count; ++i)
{
srvs[i] = resources[i] != nullptr ? resources[i]->SRV_DX11 : nullptr;
}
deviceContexts[threadID]->DSSetShaderResources(static_cast<UINT>(slot), static_cast<UINT>(count), srvs);
}
void GraphicsDevice_DX11::BindResourcesHS(const GPUResource *const* resources, int slot, int count, GRAPHICSTHREAD threadID)
{
assert(count <= 8);
ID3D11ShaderResourceView* srvs[8];
for (int i = 0; i < count; ++i)
{
srvs[i] = resources[i] != nullptr ? resources[i]->SRV_DX11 : nullptr;
}
deviceContexts[threadID]->HSSetShaderResources(static_cast<UINT>(slot), static_cast<UINT>(count), srvs);
}
void GraphicsDevice_DX11::BindResourcesCS(const GPUResource *const* resources, int slot, int count, GRAPHICSTHREAD threadID)
{
assert(count <= 8);
ID3D11ShaderResourceView* srvs[8];
for (int i = 0; i < count; ++i)
{
srvs[i] = resources[i] != nullptr ? resources[i]->SRV_DX11 : nullptr;
}
deviceContexts[threadID]->CSSetShaderResources(static_cast<UINT>(slot), static_cast<UINT>(count), srvs);
}
void GraphicsDevice_DX11::BindUnorderedAccessResourceCS(const GPUUnorderedResource* resource, int slot, GRAPHICSTHREAD threadID, int arrayIndex)
{
if (resource != nullptr)
@@ -2908,6 +2968,16 @@ void GraphicsDevice_DX11::BindUnorderedAccessResourceCS(const GPUUnorderedResour
}
}
}
void GraphicsDevice_DX11::BindUnorderedAccessResourcesCS(const GPUUnorderedResource *const* resources, int slot, int count, GRAPHICSTHREAD threadID)
{
assert(count <= 8);
ID3D11UnorderedAccessView* uavs[8];
for (int i = 0; i < count; ++i)
{
uavs[i] = resources[i] != nullptr ? resources[i]->UAV_DX11 : nullptr;
}
deviceContexts[threadID]->CSSetUnorderedAccessViews(static_cast<UINT>(slot), static_cast<UINT>(count), uavs, nullptr);
}
void GraphicsDevice_DX11::UnBindResources(int slot, int num, GRAPHICSTHREAD threadID)
{
assert(num <= ARRAYSIZE(__nullBlob) && "Extend nullBlob to support more resource unbinding!");
@@ -2977,34 +3047,19 @@ void GraphicsDevice_DX11::BindConstantBufferCS(const GPUBuffer* buffer, int slot
ID3D11Buffer* res = buffer ? buffer->resource_DX11 : nullptr;
deviceContexts[threadID]->CSSetConstantBuffers(slot, 1, &res);
}
void GraphicsDevice_DX11::BindVertexBuffer(const GPUBuffer* vertexBuffer, int slot, UINT stride, GRAPHICSTHREAD threadID)
{
UINT data[8] = { 0 };
if (vertexBuffer == nullptr)
{
deviceContexts[threadID]->IASetVertexBuffers(0, 0, (ID3D11Buffer**)__nullBlob, data, (UINT*)__nullBlob);
}
else
{
deviceContexts[threadID]->IASetVertexBuffers(slot, 1, &vertexBuffer->resource_DX11, &stride, (UINT*)__nullBlob);
}
}
void GraphicsDevice_DX11::BindVertexBuffers(GPUBuffer* const *vertexBuffers, int slot, UINT count, const UINT* strides, GRAPHICSTHREAD threadID)
void GraphicsDevice_DX11::BindVertexBuffers(const GPUBuffer* const *vertexBuffers, int slot, int count, const UINT* strides, GRAPHICSTHREAD threadID)
{
assert(count <= 8);
ID3D11Buffer* res[8] = { 0 };
for (UINT i = 0; i < count; ++i)
{
if (vertexBuffers[i] != nullptr)
{
res[i] = vertexBuffers[i]->resource_DX11;
}
res[i] = vertexBuffers[i] != nullptr ? vertexBuffers[i]->resource_DX11 : nullptr;
}
deviceContexts[threadID]->IASetVertexBuffers(slot, count, res, strides, (UINT*)__nullBlob);
deviceContexts[threadID]->IASetVertexBuffers(static_cast<UINT>(slot), static_cast<UINT>(count), res, strides, (UINT*)__nullBlob);
}
void GraphicsDevice_DX11::BindIndexBuffer(const GPUBuffer* indexBuffer, GRAPHICSTHREAD threadID)
{
ID3D11Buffer* res = indexBuffer ? indexBuffer->resource_DX11 : nullptr;
ID3D11Buffer* res = indexBuffer != nullptr ? indexBuffer->resource_DX11 : nullptr;
deviceContexts[threadID]->IASetIndexBuffer(res, DXGI_FORMAT_R32_UINT, 0);
}
void GraphicsDevice_DX11::BindPrimitiveTopology(PRIMITIVETOPOLOGY type, GRAPHICSTHREAD threadID)
@@ -3034,38 +3089,27 @@ void GraphicsDevice_DX11::BindPrimitiveTopology(PRIMITIVETOPOLOGY type, GRAPHICS
}
void GraphicsDevice_DX11::BindVertexLayout(const VertexLayout* layout, GRAPHICSTHREAD threadID)
{
ID3D11InputLayout* res = layout ? layout->resource_DX11 : nullptr;
ID3D11InputLayout* res = layout != nullptr ? layout->resource_DX11 : nullptr;
deviceContexts[threadID]->IASetInputLayout(res);
}
void GraphicsDevice_DX11::BindBlendState(const BlendState* state, GRAPHICSTHREAD threadID)
{
static float blendFactor[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
static UINT sampleMask = 0xffffffff;
static const float blendFactor[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
static const UINT sampleMask = 0xffffffff;
deviceContexts[threadID]->OMSetBlendState(state->resource_DX11, blendFactor, sampleMask);
}
void GraphicsDevice_DX11::BindBlendStateEx(const BlendState* state, const XMFLOAT4& blendFactor, UINT sampleMask, GRAPHICSTHREAD threadID)
{
float fblendFactor[4] = { blendFactor.x, blendFactor.y, blendFactor.z, blendFactor.w };
const float fblendFactor[4] = { blendFactor.x, blendFactor.y, blendFactor.z, blendFactor.w };
deviceContexts[threadID]->OMSetBlendState(state->resource_DX11, fblendFactor, sampleMask);
}
void GraphicsDevice_DX11::BindDepthStencilState(const DepthStencilState* state, UINT stencilRef, GRAPHICSTHREAD threadID)
{
deviceContexts[threadID]->OMSetDepthStencilState(state->resource_DX11, stencilRef);
deviceContexts[threadID]->OMSetDepthStencilState(state != nullptr ? state->resource_DX11 : nullptr, stencilRef);
}
void GraphicsDevice_DX11::BindRasterizerState(const RasterizerState* state, GRAPHICSTHREAD threadID)
{
deviceContexts[threadID]->RSSetState(state->resource_DX11);
}
void GraphicsDevice_DX11::BindStreamOutTarget(const GPUBuffer* buffer, GRAPHICSTHREAD threadID)
{
if (buffer == nullptr)
{
deviceContexts[threadID]->SOSetTargets(0, (ID3D11Buffer**)__nullBlob, (UINT*)__nullBlob);
}
else
{
deviceContexts[threadID]->SOSetTargets(1, &buffer->resource_DX11, (UINT*)__nullBlob);
}
deviceContexts[threadID]->RSSetState(state != nullptr ? state->resource_DX11 : nullptr);
}
void GraphicsDevice_DX11::BindStreamOutTargets(GPUBuffer* const * buffers, UINT count, GRAPHICSTHREAD threadID)
{
@@ -3074,41 +3118,38 @@ void GraphicsDevice_DX11::BindStreamOutTargets(GPUBuffer* const * buffers, UINT
ID3D11Buffer* res[8] = { 0 };
for (UINT i = 0; i < count; ++i)
{
if (buffers[i] != nullptr)
{
res[i] = buffers[i]->resource_DX11;
}
res[i] = buffers[i] != nullptr ? buffers[i]->resource_DX11 : nullptr;
}
deviceContexts[threadID]->SOSetTargets(count, res, offsetSO);
}
void GraphicsDevice_DX11::BindPS(const PixelShader* shader, GRAPHICSTHREAD threadID)
{
ID3D11PixelShader* res = shader ? shader->resource_DX11 : nullptr;
ID3D11PixelShader* res = shader != nullptr ? shader->resource_DX11 : nullptr;
deviceContexts[threadID]->PSSetShader(res, nullptr, 0);
}
void GraphicsDevice_DX11::BindVS(const VertexShader* shader, GRAPHICSTHREAD threadID)
{
ID3D11VertexShader* res = shader ? shader->resource_DX11 : nullptr;
ID3D11VertexShader* res = shader != nullptr ? shader->resource_DX11 : nullptr;
deviceContexts[threadID]->VSSetShader(res, nullptr, 0);
}
void GraphicsDevice_DX11::BindGS(const GeometryShader* shader, GRAPHICSTHREAD threadID)
{
ID3D11GeometryShader* res = shader ? shader->resource_DX11 : nullptr;
ID3D11GeometryShader* res = shader != nullptr ? shader->resource_DX11 : nullptr;
deviceContexts[threadID]->GSSetShader(res, nullptr, 0);
}
void GraphicsDevice_DX11::BindHS(const HullShader* shader, GRAPHICSTHREAD threadID)
{
ID3D11HullShader* res = shader ? shader->resource_DX11 : nullptr;
ID3D11HullShader* res = shader != nullptr ? shader->resource_DX11 : nullptr;
deviceContexts[threadID]->HSSetShader(res, nullptr, 0);
}
void GraphicsDevice_DX11::BindDS(const DomainShader* shader, GRAPHICSTHREAD threadID)
{
ID3D11DomainShader* res = shader ? shader->resource_DX11 : nullptr;
ID3D11DomainShader* res = shader != nullptr ? shader->resource_DX11 : nullptr;
deviceContexts[threadID]->DSSetShader(res, nullptr, 0);
}
void GraphicsDevice_DX11::BindCS(const ComputeShader* shader, GRAPHICSTHREAD threadID)
{
ID3D11ComputeShader* res = shader ? shader->resource_DX11 : nullptr;
ID3D11ComputeShader* res = shader != nullptr ? shader->resource_DX11 : nullptr;
deviceContexts[threadID]->CSSetShader(res, nullptr, 0);
}
void GraphicsDevice_DX11::Draw(int vertexCount, GRAPHICSTHREAD threadID)
@@ -3146,6 +3187,7 @@ void GraphicsDevice_DX11::CopyTexture2D_Region(Texture2D* pDst, UINT dstMip, UIN
}
void GraphicsDevice_DX11::MSAAResolve(Texture2D* pDst, const Texture2D* pSrc, GRAPHICSTHREAD threadID)
{
assert(pDst != nullptr && pSrc != nullptr);
deviceContexts[threadID]->ResolveSubresource(pDst->texture2D_DX11, 0, pSrc->texture2D_DX11, 0, _ConvertFormat(pDst->desc.Format));
}
void GraphicsDevice_DX11::UpdateBuffer(GPUBuffer* buffer, const void* data, GRAPHICSTHREAD threadID, int dataSize)
+9 -4
View File
@@ -79,7 +79,14 @@ namespace wiGraphicsTypes
virtual void BindResourceDS(const GPUResource* resource, int slot, GRAPHICSTHREAD threadID, int arrayIndex = -1) override;
virtual void BindResourceHS(const GPUResource* resource, int slot, GRAPHICSTHREAD threadID, int arrayIndex = -1) override;
virtual void BindResourceCS(const GPUResource* resource, int slot, GRAPHICSTHREAD threadID, int arrayIndex = -1) override;
virtual void BindUnorderedAccessResourceCS(const GPUUnorderedResource* buffer, int slot, GRAPHICSTHREAD threadID, int arrayIndex = -1) override;
virtual void BindResourcesPS(const GPUResource *const* resources, int slot, int count, GRAPHICSTHREAD threadID) override;
virtual void BindResourcesVS(const GPUResource *const* resources, int slot, int count, GRAPHICSTHREAD threadID) override;
virtual void BindResourcesGS(const GPUResource *const* resources, int slot, int count, GRAPHICSTHREAD threadID) override;
virtual void BindResourcesDS(const GPUResource *const* resources, int slot, int count, GRAPHICSTHREAD threadID) override;
virtual void BindResourcesHS(const GPUResource *const* resources, int slot, int count, GRAPHICSTHREAD threadID) override;
virtual void BindResourcesCS(const GPUResource *const* resources, int slot, int count, GRAPHICSTHREAD threadID) override;
virtual void BindUnorderedAccessResourceCS(const GPUUnorderedResource* resource, int slot, GRAPHICSTHREAD threadID, int arrayIndex = -1) override;
virtual void BindUnorderedAccessResourcesCS(const GPUUnorderedResource *const* resources, int slot, int count, GRAPHICSTHREAD threadID) override;
virtual void UnBindResources(int slot, int num, GRAPHICSTHREAD threadID) override;
virtual void UnBindUnorderedAccessResources(int slot, int num, GRAPHICSTHREAD threadID) override;
virtual void BindSamplerPS(const Sampler* sampler, int slot, GRAPHICSTHREAD threadID) override;
@@ -94,8 +101,7 @@ namespace wiGraphicsTypes
virtual void BindConstantBufferDS(const GPUBuffer* buffer, int slot, GRAPHICSTHREAD threadID) override;
virtual void BindConstantBufferHS(const GPUBuffer* buffer, int slot, GRAPHICSTHREAD threadID) override;
virtual void BindConstantBufferCS(const GPUBuffer* buffer, int slot, GRAPHICSTHREAD threadID) override;
virtual void BindVertexBuffer(const GPUBuffer* vertexBuffer, int slot, UINT stride, GRAPHICSTHREAD threadID) override;
virtual void BindVertexBuffers(GPUBuffer* const *vertexBuffers, int slot, UINT count, const UINT* strides, GRAPHICSTHREAD threadID) override;
virtual void BindVertexBuffers(const GPUBuffer* const *vertexBuffers, int slot, int count, const UINT* strides, GRAPHICSTHREAD threadID) override;
virtual void BindIndexBuffer(const GPUBuffer* indexBuffer, GRAPHICSTHREAD threadID) override;
virtual void BindPrimitiveTopology(PRIMITIVETOPOLOGY type, GRAPHICSTHREAD threadID) override;
virtual void BindVertexLayout(const VertexLayout* layout, GRAPHICSTHREAD threadID) override;
@@ -103,7 +109,6 @@ namespace wiGraphicsTypes
virtual void BindBlendStateEx(const BlendState* state, const XMFLOAT4& blendFactor, UINT sampleMask, GRAPHICSTHREAD threadID) override;
virtual void BindDepthStencilState(const DepthStencilState* state, UINT stencilRef, GRAPHICSTHREAD threadID) override;
virtual void BindRasterizerState(const RasterizerState* state, GRAPHICSTHREAD threadID) override;
virtual void BindStreamOutTarget(const GPUBuffer* buffer, GRAPHICSTHREAD threadID) override;
virtual void BindStreamOutTargets(GPUBuffer* const *buffers, UINT count, GRAPHICSTHREAD threadID) override;
virtual void BindPS(const PixelShader* shader, GRAPHICSTHREAD threadID) override;
virtual void BindVS(const VertexShader* shader, GRAPHICSTHREAD threadID) override;
+7 -1
View File
@@ -413,7 +413,13 @@ void wiHairParticle::Draw(Camera* camera, SHADERTYPE shaderType, GRAPHICSTHREAD
device->BindGS(gs, threadID);
}
device->BindVertexBuffer(vb, 0, sizeof(Point), threadID);
const GPUBuffer* vbs[] = {
vb,
};
const UINT strides[] = {
sizeof(Point),
};
device->BindVertexBuffers(vbs, 0, ARRAYSIZE(vbs), strides, threadID);
device->Draw((int)points.size(), threadID);
device->BindGS(nullptr,threadID);
-4
View File
@@ -244,8 +244,6 @@ void wiImage::Draw(Texture2D* texture, const wiImageEffects& effects,GRAPHICSTHR
bool fullScreenEffect = false;
device->BindVertexLayout(nullptr, threadID);
device->BindVertexBuffer(nullptr, 0, 0, threadID);
device->BindIndexBuffer(nullptr, threadID);
device->BindPrimitiveTopology(PRIMITIVETOPOLOGY::TRIANGLESTRIP, threadID);
device->BindRasterizerState(rasterizerState, threadID);
@@ -538,8 +536,6 @@ void wiImage::DrawDeferred(Texture2D* lightmap_diffuse, Texture2D* lightmap_spec
device->BindDepthStencilState(depthStencilStateLess,stencilRef,threadID);
device->BindVertexLayout(nullptr, threadID);
device->BindVertexBuffer(nullptr, 0, 0, threadID);
device->BindIndexBuffer(nullptr, threadID);
device->BindVS(screenVS,threadID);
device->BindPS(deferredPS,threadID);
+108 -53
View File
@@ -1885,7 +1885,12 @@ void wiRenderer::UpdateRenderData(GRAPHICSTHREAD threadID)
// Unload skinning shader
GetDevice()->BindGS(nullptr, threadID);
GetDevice()->BindVS(nullptr, threadID);
GetDevice()->BindStreamOutTarget(nullptr, threadID);
GPUBuffer* sos[] = {
nullptr,
nullptr,
nullptr,
};
GetDevice()->BindStreamOutTargets(sos, ARRAYSIZE(sos), threadID);
}
#endif
@@ -2050,7 +2055,6 @@ void wiRenderer::OcclusionCulling_Render(GRAPHICSTHREAD threadID)
GetDevice()->BindBlendState(blendStates[BSTYPE_COLORWRITEDISABLE], threadID);
GetDevice()->BindDepthStencilState(depthStencils[DSSTYPE_DEPTHREAD], STENCILREF_DEFAULT, threadID);
GetDevice()->BindVertexLayout(nullptr, threadID);
GetDevice()->BindVertexBuffer(nullptr, 0, 0, threadID);
GetDevice()->BindVS(vertexShaders[VSTYPE_CUBE], threadID);
GetDevice()->BindPS(nullptr, threadID);
GetDevice()->BindPrimitiveTopology(PRIMITIVETOPOLOGY::TRIANGLESTRIP, threadID);
@@ -2256,7 +2260,13 @@ void wiRenderer::DrawDebugBoneLines(Camera* camera, GRAPHICSTHREAD threadID)
GetDevice()->UpdateBuffer(constantBuffers[CBTYPE_MISC], &sb, threadID);
GetDevice()->BindVertexBuffer(&boneLines[i]->vertexBuffer, 0, sizeof(XMFLOAT4) + sizeof(XMFLOAT4), threadID);
const GPUBuffer* vbs[] = {
&boneLines[i]->vertexBuffer,
};
const UINT strides[] = {
sizeof(XMFLOAT4) + sizeof(XMFLOAT4),
};
GetDevice()->BindVertexBuffers(vbs, 0, ARRAYSIZE(vbs), strides, threadID);
GetDevice()->Draw(2, threadID);
}
@@ -2288,7 +2298,13 @@ void wiRenderer::DrawDebugLines(Camera* camera, GRAPHICSTHREAD threadID)
GetDevice()->UpdateBuffer(constantBuffers[CBTYPE_MISC], &sb, threadID);
GetDevice()->BindVertexBuffer(&linesTemp[i]->vertexBuffer, 0, sizeof(XMFLOAT4) + sizeof(XMFLOAT4), threadID);
const GPUBuffer* vbs[] = {
&linesTemp[i]->vertexBuffer,
};
const UINT strides[] = {
sizeof(XMFLOAT4) + sizeof(XMFLOAT4),
};
GetDevice()->BindVertexBuffers(vbs, 0, ARRAYSIZE(vbs), strides, threadID);
GetDevice()->Draw(2, threadID);
}
@@ -2313,8 +2329,14 @@ void wiRenderer::DrawDebugBoxes(Camera* camera, GRAPHICSTHREAD threadID)
GetDevice()->BindPS(pixelShaders[PSTYPE_LINE],threadID);
GetDevice()->BindVS(vertexShaders[VSTYPE_LINE],threadID);
GetDevice()->BindVertexBuffer(&Cube::vertexBuffer,0, sizeof(XMFLOAT4) + sizeof(XMFLOAT4),threadID);
const GPUBuffer* vbs[] = {
&Cube::vertexBuffer,
};
const UINT strides[] = {
sizeof(XMFLOAT4) + sizeof(XMFLOAT4),
};
GetDevice()->BindVertexBuffers(vbs, 0, ARRAYSIZE(vbs), strides, threadID);
GetDevice()->BindIndexBuffer(&Cube::indexBuffer,threadID);
MiscCB sb;
@@ -2371,11 +2393,18 @@ void wiRenderer::DrawTranslators(Camera* camera, GRAPHICSTHREAD threadID)
XMMATRIX matZ = XMMatrixTranspose(XMMatrixRotationY(-XM_PIDIV2)*XMMatrixRotationZ(-XM_PIDIV2)*mat);
// Planes:
GetDevice()->BindVertexBuffer(wiTranslator::vertexBuffer_Plane, 0, sizeof(XMFLOAT4) + sizeof(XMFLOAT4), threadID);
GetDevice()->BindRasterizerState(rasterizers[RSTYPE_DOUBLESIDED], threadID);
GetDevice()->BindPrimitiveTopology(TRIANGLELIST, threadID);
GetDevice()->BindBlendState(blendStates[BSTYPE_ADDITIVE], threadID);
{
const GPUBuffer* vbs[] = {
wiTranslator::vertexBuffer_Plane,
};
const UINT strides[] = {
sizeof(XMFLOAT4) + sizeof(XMFLOAT4),
};
GetDevice()->BindVertexBuffers(vbs, 0, ARRAYSIZE(vbs), strides, threadID);
GetDevice()->BindRasterizerState(rasterizers[RSTYPE_DOUBLESIDED], threadID);
GetDevice()->BindPrimitiveTopology(TRIANGLELIST, threadID);
GetDevice()->BindBlendState(blendStates[BSTYPE_ADDITIVE], threadID);
}
// xy
sb.mTransform = matX;
@@ -2396,11 +2425,18 @@ void wiRenderer::DrawTranslators(Camera* camera, GRAPHICSTHREAD threadID)
GetDevice()->Draw(wiTranslator::vertexCount_Plane, threadID);
// Lines:
GetDevice()->BindVertexBuffer(wiTranslator::vertexBuffer_Axis, 0, sizeof(XMFLOAT4) + sizeof(XMFLOAT4), threadID);
GetDevice()->BindRasterizerState(rasterizers[RSTYPE_WIRE_DOUBLESIDED_SMOOTH], threadID);
GetDevice()->BindPrimitiveTopology(LINELIST, threadID);
GetDevice()->BindBlendState(blendStates[BSTYPE_TRANSPARENT], threadID);
{
const GPUBuffer* vbs[] = {
wiTranslator::vertexBuffer_Axis,
};
const UINT strides[] = {
sizeof(XMFLOAT4) + sizeof(XMFLOAT4),
};
GetDevice()->BindVertexBuffers(vbs, 0, ARRAYSIZE(vbs), strides, threadID);
GetDevice()->BindRasterizerState(rasterizers[RSTYPE_WIRE_DOUBLESIDED_SMOOTH], threadID);
GetDevice()->BindPrimitiveTopology(LINELIST, threadID);
GetDevice()->BindBlendState(blendStates[BSTYPE_TRANSPARENT], threadID);
}
// x
sb.mTransform = matX;
@@ -2421,13 +2457,21 @@ void wiRenderer::DrawTranslators(Camera* camera, GRAPHICSTHREAD threadID)
GetDevice()->Draw(wiTranslator::vertexCount_Axis, threadID);
// Origin:
sb.mTransform = XMMatrixTranspose(mat);
sb.mColor = x->state == wiTranslator::TRANSLATOR_XYZ ? XMFLOAT4(1, 1, 1, 1) : XMFLOAT4(0.5f, 0.5f, 0.5f, 1);
GetDevice()->UpdateBuffer(constantBuffers[CBTYPE_MISC], &sb, threadID);
GetDevice()->BindPrimitiveTopology(TRIANGLELIST, threadID);
GetDevice()->BindRasterizerState(rasterizers[RSTYPE_FRONT], threadID);
GetDevice()->BindVertexBuffer(wiTranslator::vertexBuffer_Origin, 0, sizeof(XMFLOAT4) + sizeof(XMFLOAT4), threadID);
GetDevice()->Draw(wiTranslator::vertexCount_Origin, threadID);
{
const GPUBuffer* vbs[] = {
wiTranslator::vertexBuffer_Origin,
};
const UINT strides[] = {
sizeof(XMFLOAT4) + sizeof(XMFLOAT4),
};
GetDevice()->BindVertexBuffers(vbs, 0, ARRAYSIZE(vbs), strides, threadID);
sb.mTransform = XMMatrixTranspose(mat);
sb.mColor = x->state == wiTranslator::TRANSLATOR_XYZ ? XMFLOAT4(1, 1, 1, 1) : XMFLOAT4(0.5f, 0.5f, 0.5f, 1);
GetDevice()->UpdateBuffer(constantBuffers[CBTYPE_MISC], &sb, threadID);
GetDevice()->BindPrimitiveTopology(TRIANGLELIST, threadID);
GetDevice()->BindRasterizerState(rasterizers[RSTYPE_FRONT], threadID);
GetDevice()->Draw(wiTranslator::vertexCount_Origin, threadID);
}
}
GetDevice()->EventEnd(threadID);
@@ -2452,9 +2496,6 @@ void wiRenderer::DrawDebugEnvProbes(Camera* camera, GRAPHICSTHREAD threadID)
GetDevice()->BindPS(pixelShaders[PSTYPE_CUBEMAP], threadID);
GetDevice()->BindVS(vertexShaders[VSTYPE_SPHERE], threadID);
GetDevice()->BindVertexBuffer(nullptr, 0, 0, threadID);
GetDevice()->BindIndexBuffer(nullptr, threadID);
MiscCB sb;
for (auto& x : GetScene().environmentProbes)
{
@@ -2534,7 +2575,13 @@ void wiRenderer::DrawDebugGridHelper(Camera* camera, GRAPHICSTHREAD threadID)
GetDevice()->UpdateBuffer(constantBuffers[CBTYPE_MISC], &sb, threadID);
GetDevice()->BindVertexBuffer(grid, 0, sizeof(XMFLOAT4) + sizeof(XMFLOAT4), threadID);
const GPUBuffer* vbs[] = {
grid,
};
const UINT strides[] = {
sizeof(XMFLOAT4) + sizeof(XMFLOAT4),
};
GetDevice()->BindVertexBuffers(vbs, 0, ARRAYSIZE(vbs), strides, threadID);
GetDevice()->Draw(gridVertexCount, threadID);
@@ -2558,8 +2605,6 @@ void wiRenderer::DrawDebugVoxels(Camera* camera, GRAPHICSTHREAD threadID)
GetDevice()->BindGS(geometryShaders[GSTYPE_VOXEL], threadID);
GetDevice()->BindVertexLayout(nullptr, threadID);
GetDevice()->BindVertexBuffer(nullptr, 0, 0, threadID);
GetDevice()->BindIndexBuffer(nullptr, threadID);
@@ -2603,7 +2648,13 @@ void wiRenderer::DrawDebugEmitters(Camera* camera, GRAPHICSTHREAD threadID)
for (auto& y : x->object->mesh->subsets)
{
GetDevice()->BindVertexBuffer(&x->object->mesh->vertexBuffers[VPROP_POS], 0, sizeof(XMFLOAT4), threadID);
const GPUBuffer* vbs[] = {
&x->object->mesh->vertexBuffers[VPROP_POS],
};
const UINT strides[] = {
sizeof(XMFLOAT4),
};
GetDevice()->BindVertexBuffers(vbs, 0, ARRAYSIZE(vbs), strides, threadID);
GetDevice()->BindIndexBuffer(&y.indexBuffer, threadID);
GetDevice()->DrawIndexed((int)y.subsetIndices.size(), threadID);
}
@@ -2702,7 +2753,13 @@ void wiRenderer::DrawTrails(GRAPHICSTHREAD threadID, Texture2D* refracRes)
if(!trails.empty()){
GetDevice()->UpdateBuffer(&o->trailBuff,trails.data(),threadID,(int)(sizeof(RibbonVertex)*trails.size()));
GetDevice()->BindVertexBuffer(&o->trailBuff,0,sizeof(RibbonVertex),threadID);
const GPUBuffer* vbs[] = {
&o->trailBuff,
};
const UINT strides[] = {
sizeof(RibbonVertex),
};
GetDevice()->BindVertexBuffers(vbs, 0, ARRAYSIZE(vbs), strides, threadID);
GetDevice()->Draw((int)trails.size(),threadID);
trails.clear();
@@ -2771,8 +2828,6 @@ void wiRenderer::DrawLights(Camera* camera, GRAPHICSTHREAD threadID)
GetDevice()->BindRasterizerState(rasterizers[RSTYPE_BACK],threadID);
GetDevice()->BindVertexLayout(nullptr, threadID);
GetDevice()->BindVertexBuffer(nullptr, 0, 0, threadID);
GetDevice()->BindIndexBuffer(nullptr, threadID);
// Environmental light (envmap + voxelGI) is always drawn
{
@@ -2903,8 +2958,6 @@ void wiRenderer::DrawVolumeLights(Camera* camera, GRAPHICSTHREAD threadID)
GetDevice()->BindPrimitiveTopology(TRIANGLELIST,threadID);
GetDevice()->BindVertexLayout(nullptr, threadID);
GetDevice()->BindVertexBuffer(nullptr, 0, 0, threadID);
GetDevice()->BindIndexBuffer(nullptr, threadID);
GetDevice()->BindDepthStencilState(depthStencils[DSSTYPE_DEPTHREAD],STENCILREF_DEFAULT,threadID);
@@ -3965,15 +4018,15 @@ void wiRenderer::RenderMeshes(const XMFLOAT3& eye, const CulledCollection& culle
if (!wireRender)
{
GetDevice()->BindResourcePS(material->GetBaseColorMap(), TEXSLOT_ONDEMAND0, threadID);
if (!easyTextureBind)
{
GetDevice()->BindResourcePS(material->GetNormalMap(), TEXSLOT_ONDEMAND1, threadID);
GetDevice()->BindResourcePS(material->GetRoughnessMap(), TEXSLOT_ONDEMAND2, threadID);
GetDevice()->BindResourcePS(material->GetReflectanceMap(), TEXSLOT_ONDEMAND3, threadID);
GetDevice()->BindResourcePS(material->GetMetalnessMap(), TEXSLOT_ONDEMAND4, threadID);
GetDevice()->BindResourcePS(material->GetDisplacementMap(), TEXSLOT_ONDEMAND5, threadID);
}
const GPUResource* res[] = {
static_cast<const GPUResource*>(material->GetBaseColorMap()),
static_cast<const GPUResource*>(material->GetNormalMap()),
static_cast<const GPUResource*>(material->GetRoughnessMap()),
static_cast<const GPUResource*>(material->GetReflectanceMap()),
static_cast<const GPUResource*>(material->GetMetalnessMap()),
static_cast<const GPUResource*>(material->GetDisplacementMap()),
};
GetDevice()->BindResourcesPS(res, TEXSLOT_ONDEMAND0, (easyTextureBind ? 1 : ARRAYSIZE(res)), threadID);
PSTYPES realPS = GetPSTYPE(shaderType, material);
if ((shaderType == SHADERTYPE_SHADOW || shaderType == SHADERTYPE_ALPHATESTONLY) && material->alphaRef > 1.0f - 1.0f/256.0f)
@@ -4127,7 +4180,6 @@ void wiRenderer::DrawSky(GRAPHICSTHREAD threadID)
GetDevice()->BindResourcePS(wiTextureHelper::getInstance()->getBlackCubeMap(), TEXSLOT_ENV_GLOBAL, threadID);
}
GetDevice()->BindVertexBuffer(nullptr,0,0,threadID);
GetDevice()->BindVertexLayout(nullptr, threadID);
GetDevice()->Draw(240,threadID);
@@ -4145,7 +4197,6 @@ void wiRenderer::DrawSun(GRAPHICSTHREAD threadID)
GetDevice()->BindVS(vertexShaders[VSTYPE_SKY], threadID);
GetDevice()->BindPS(pixelShaders[PSTYPE_SUN], threadID);
GetDevice()->BindVertexBuffer(nullptr, 0, 0, threadID);
GetDevice()->BindVertexLayout(nullptr, threadID);
GetDevice()->Draw(240, threadID);
@@ -4286,7 +4337,6 @@ void wiRenderer::RefreshEnvProbes(GRAPHICSTHREAD threadID)
GetDevice()->BindResourcePS(enviroMap, TEXSLOT_ENV_GLOBAL, threadID);
GetDevice()->BindVertexBuffer(nullptr, 0, 0, threadID);
GetDevice()->BindVertexLayout(nullptr, threadID);
GetDevice()->Draw(240, threadID);
}
@@ -4651,12 +4701,17 @@ void wiRenderer::ComputeTiledLightCulling(GRAPHICSTHREAD threadID)
device->BindCS(computeShaders[CSTYPE_TILEDLIGHTCULLING], threadID);
}
}
device->BindUnorderedAccessResourceCS(lightCounterHelper_Opaque, UAVSLOT_LIGHTINDEXCOUNTERHELPER_OPAQUE, threadID);
device->BindUnorderedAccessResourceCS(lightCounterHelper_Transparent, UAVSLOT_LIGHTINDEXCOUNTERHELPER_TRANSPARENT, threadID);
device->BindUnorderedAccessResourceCS(resourceBuffers[RBTYPE_LIGHTINDEXLIST_OPAQUE], UAVSLOT_LIGHTINDEXLIST_OPAQUE, threadID);
device->BindUnorderedAccessResourceCS(resourceBuffers[RBTYPE_LIGHTINDEXLIST_TRANSPARENT], UAVSLOT_LIGHTINDEXLIST_TRANSPARENT, threadID);
device->BindUnorderedAccessResourceCS(textures[TEXTYPE_2D_LIGHTGRID_OPAQUE], UAVSLOT_LIGHTGRID_OPAQUE, threadID);
device->BindUnorderedAccessResourceCS(textures[TEXTYPE_2D_LIGHTGRID_TRANSPARENT], UAVSLOT_LIGHTGRID_TRANSPARENT, threadID);
const GPUUnorderedResource* uavs[] = {
static_cast<const GPUUnorderedResource*>(lightCounterHelper_Opaque),
static_cast<const GPUUnorderedResource*>(lightCounterHelper_Transparent),
static_cast<const GPUUnorderedResource*>(resourceBuffers[RBTYPE_LIGHTINDEXLIST_OPAQUE]),
static_cast<const GPUUnorderedResource*>(resourceBuffers[RBTYPE_LIGHTINDEXLIST_TRANSPARENT]),
static_cast<const GPUUnorderedResource*>(textures[TEXTYPE_2D_LIGHTGRID_OPAQUE]),
static_cast<const GPUUnorderedResource*>(textures[TEXTYPE_2D_LIGHTGRID_TRANSPARENT]),
};
device->BindUnorderedAccessResourcesCS(uavs, UAVSLOT_LIGHTINDEXCOUNTERHELPER_OPAQUE, ARRAYSIZE(uavs), threadID);
device->Dispatch(dispatchParams.numThreads[0], dispatchParams.numThreads[1], dispatchParams.numThreads[2], threadID);
device->UnBindUnorderedAccessResources(0, 8, threadID); // this unbinds pretty much every uav
+83 -42
View File
@@ -1497,57 +1497,98 @@ void wiColorPicker::Render(wiGUI* gui)
wiRenderer::GetDevice()->BindPS(wiRenderer::pixelShaders[PSTYPE_LINE], threadID);
wiRenderer::GetDevice()->BindPrimitiveTopology(TRIANGLESTRIP, threadID);
// render saturation triangle
wiRenderer::MiscCB cb;
cb.mTransform = XMMatrixTranspose(
XMMatrixRotationZ(-angle) *
XMMatrixTranslation(translation.x + __colorpicker_center, translation.y + __colorpicker_center, 0) *
__cam
);
cb.mColor = XMFLOAT4(1, 1, 1, 1);
wiRenderer::GetDevice()->UpdateBuffer(wiRenderer::constantBuffers[CBTYPE_MISC], &cb, threadID);
wiRenderer::GetDevice()->BindVertexBuffer(&vb_saturation, 0, sizeof(Vertex), threadID);
wiRenderer::GetDevice()->Draw(vb_saturation.GetDesc().ByteWidth / sizeof(Vertex), threadID);
// render saturation triangle
{
cb.mTransform = XMMatrixTranspose(
XMMatrixRotationZ(-angle) *
XMMatrixTranslation(translation.x + __colorpicker_center, translation.y + __colorpicker_center, 0) *
__cam
);
cb.mColor = XMFLOAT4(1, 1, 1, 1);
wiRenderer::GetDevice()->UpdateBuffer(wiRenderer::constantBuffers[CBTYPE_MISC], &cb, threadID);
const GPUBuffer* vbs[] = {
&vb_saturation,
};
const UINT strides[] = {
sizeof(Vertex),
};
wiRenderer::GetDevice()->BindVertexBuffers(vbs, 0, ARRAYSIZE(vbs), strides, threadID);
wiRenderer::GetDevice()->Draw(vb_saturation.GetDesc().ByteWidth / sizeof(Vertex), threadID);
}
// render hue circle
cb.mTransform = XMMatrixTranspose(
XMMatrixTranslation(translation.x + __colorpicker_center, translation.y + __colorpicker_center, 0) *
__cam
);
cb.mColor = XMFLOAT4(1, 1, 1, 1);
wiRenderer::GetDevice()->UpdateBuffer(wiRenderer::constantBuffers[CBTYPE_MISC], &cb, threadID);
wiRenderer::GetDevice()->BindVertexBuffer(&vb_hue, 0, sizeof(Vertex), threadID);
wiRenderer::GetDevice()->Draw(vb_hue.GetDesc().ByteWidth / sizeof(Vertex), threadID);
{
cb.mTransform = XMMatrixTranspose(
XMMatrixTranslation(translation.x + __colorpicker_center, translation.y + __colorpicker_center, 0) *
__cam
);
cb.mColor = XMFLOAT4(1, 1, 1, 1);
wiRenderer::GetDevice()->UpdateBuffer(wiRenderer::constantBuffers[CBTYPE_MISC], &cb, threadID);
const GPUBuffer* vbs[] = {
&vb_hue,
};
const UINT strides[] = {
sizeof(Vertex),
};
wiRenderer::GetDevice()->BindVertexBuffers(vbs, 0, ARRAYSIZE(vbs), strides, threadID);
wiRenderer::GetDevice()->Draw(vb_hue.GetDesc().ByteWidth / sizeof(Vertex), threadID);
}
// render hue picker
cb.mTransform = XMMatrixTranspose(
XMMatrixTranslation(hue_picker.x, hue_picker.y, 0) *
__cam
);
cb.mColor = XMFLOAT4(1 - hue_color.x, 1 - hue_color.y, 1 - hue_color.z, 1);
wiRenderer::GetDevice()->UpdateBuffer(wiRenderer::constantBuffers[CBTYPE_MISC], &cb, threadID);
wiRenderer::GetDevice()->BindVertexBuffer(&vb_picker, 0, sizeof(Vertex), threadID);
wiRenderer::GetDevice()->Draw(vb_picker.GetDesc().ByteWidth / sizeof(Vertex), threadID);
{
cb.mTransform = XMMatrixTranspose(
XMMatrixTranslation(hue_picker.x, hue_picker.y, 0) *
__cam
);
cb.mColor = XMFLOAT4(1 - hue_color.x, 1 - hue_color.y, 1 - hue_color.z, 1);
wiRenderer::GetDevice()->UpdateBuffer(wiRenderer::constantBuffers[CBTYPE_MISC], &cb, threadID);
const GPUBuffer* vbs[] = {
&vb_picker,
};
const UINT strides[] = {
sizeof(Vertex),
};
wiRenderer::GetDevice()->BindVertexBuffers(vbs, 0, ARRAYSIZE(vbs), strides, threadID);
wiRenderer::GetDevice()->Draw(vb_picker.GetDesc().ByteWidth / sizeof(Vertex), threadID);
}
// render saturation picker
cb.mTransform = XMMatrixTranspose(
XMMatrixTranslation(saturation_picker.x, saturation_picker.y, 0) *
__cam
);
cb.mColor = XMFLOAT4(1 - final_color.x, 1 - final_color.y, 1 - final_color.z, 1);
wiRenderer::GetDevice()->UpdateBuffer(wiRenderer::constantBuffers[CBTYPE_MISC], &cb, threadID);
wiRenderer::GetDevice()->BindVertexBuffer(&vb_picker, 0, sizeof(Vertex), threadID);
wiRenderer::GetDevice()->Draw(vb_picker.GetDesc().ByteWidth / sizeof(Vertex), threadID);
{
cb.mTransform = XMMatrixTranspose(
XMMatrixTranslation(saturation_picker.x, saturation_picker.y, 0) *
__cam
);
cb.mColor = XMFLOAT4(1 - final_color.x, 1 - final_color.y, 1 - final_color.z, 1);
wiRenderer::GetDevice()->UpdateBuffer(wiRenderer::constantBuffers[CBTYPE_MISC], &cb, threadID);
const GPUBuffer* vbs[] = {
&vb_picker,
};
const UINT strides[] = {
sizeof(Vertex),
};
wiRenderer::GetDevice()->BindVertexBuffers(vbs, 0, ARRAYSIZE(vbs), strides, threadID);
wiRenderer::GetDevice()->Draw(vb_picker.GetDesc().ByteWidth / sizeof(Vertex), threadID);
}
// render preview
cb.mTransform = XMMatrixTranspose(
XMMatrixTranslation(translation.x + 260, translation.y + 40, 0) *
__cam
);
cb.mColor = GetPickColor();
wiRenderer::GetDevice()->UpdateBuffer(wiRenderer::constantBuffers[CBTYPE_MISC], &cb, threadID);
wiRenderer::GetDevice()->BindVertexBuffer(&vb_preview, 0, sizeof(Vertex), threadID);
wiRenderer::GetDevice()->Draw(vb_preview.GetDesc().ByteWidth / sizeof(Vertex), threadID);
{
cb.mTransform = XMMatrixTranspose(
XMMatrixTranslation(translation.x + 260, translation.y + 40, 0) *
__cam
);
cb.mColor = GetPickColor();
wiRenderer::GetDevice()->UpdateBuffer(wiRenderer::constantBuffers[CBTYPE_MISC], &cb, threadID);
const GPUBuffer* vbs[] = {
&vb_preview,
};
const UINT strides[] = {
sizeof(Vertex),
};
wiRenderer::GetDevice()->BindVertexBuffers(vbs, 0, ARRAYSIZE(vbs), strides, threadID);
wiRenderer::GetDevice()->Draw(vb_preview.GetDesc().ByteWidth / sizeof(Vertex), threadID);
}
// RGB values:
stringstream _rgb("");