|
|
@@ -199,8 +199,8 @@ bool Graphics::gl3Support = false;
|
|
|
Graphics::Graphics(Context* context) :
|
|
|
Object(context),
|
|
|
impl_(new GraphicsImpl()),
|
|
|
- window_(0),
|
|
|
- externalWindow_(0),
|
|
|
+ window_(nullptr),
|
|
|
+ externalWindow_(nullptr),
|
|
|
width_(0),
|
|
|
height_(0),
|
|
|
position_(SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED),
|
|
|
@@ -290,11 +290,11 @@ Graphics::~Graphics()
|
|
|
{
|
|
|
SDL_ShowCursor(SDL_TRUE);
|
|
|
SDL_DestroyWindow(window_);
|
|
|
- window_ = 0;
|
|
|
+ window_ = nullptr;
|
|
|
}
|
|
|
|
|
|
delete impl_;
|
|
|
- impl_ = 0;
|
|
|
+ impl_ = nullptr;
|
|
|
|
|
|
context_->ReleaseSDL();
|
|
|
}
|
|
|
@@ -485,7 +485,7 @@ void Graphics::Close()
|
|
|
{
|
|
|
SDL_ShowCursor(SDL_TRUE);
|
|
|
SDL_DestroyWindow(window_);
|
|
|
- window_ = 0;
|
|
|
+ window_ = nullptr;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -508,8 +508,8 @@ bool Graphics::TakeScreenShot(Image& destImage)
|
|
|
textureDesc.Usage = D3D11_USAGE_STAGING;
|
|
|
textureDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
|
|
|
|
|
|
- ID3D11Texture2D* stagingTexture = 0;
|
|
|
- HRESULT hr = impl_->device_->CreateTexture2D(&textureDesc, 0, &stagingTexture);
|
|
|
+ ID3D11Texture2D* stagingTexture = nullptr;
|
|
|
+ HRESULT hr = impl_->device_->CreateTexture2D(&textureDesc, nullptr, &stagingTexture);
|
|
|
if (FAILED(hr))
|
|
|
{
|
|
|
URHO3D_SAFE_RELEASE(stagingTexture);
|
|
|
@@ -517,7 +517,7 @@ bool Graphics::TakeScreenShot(Image& destImage)
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- ID3D11Resource* source = 0;
|
|
|
+ ID3D11Resource* source = nullptr;
|
|
|
impl_->defaultRenderTargetView_->GetResource(&source);
|
|
|
|
|
|
if (multiSample_ > 1)
|
|
|
@@ -541,7 +541,7 @@ bool Graphics::TakeScreenShot(Image& destImage)
|
|
|
source->Release();
|
|
|
|
|
|
D3D11_MAPPED_SUBRESOURCE mappedData;
|
|
|
- mappedData.pData = 0;
|
|
|
+ mappedData.pData = nullptr;
|
|
|
hr = impl_->deviceContext_->Map(stagingTexture, 0, D3D11_MAP_READ, 0, &mappedData);
|
|
|
if (FAILED(hr) || !mappedData.pData)
|
|
|
{
|
|
|
@@ -596,7 +596,7 @@ bool Graphics::BeginFrame()
|
|
|
|
|
|
// Cleanup textures from previous frame
|
|
|
for (unsigned i = 0; i < MAX_TEXTURE_UNITS; ++i)
|
|
|
- SetTexture(i, 0);
|
|
|
+ SetTexture(i, nullptr);
|
|
|
|
|
|
numPrimitives_ = 0;
|
|
|
numBatches_ = 0;
|
|
|
@@ -706,7 +706,7 @@ bool Graphics::ResolveToTexture(Texture2D* destination, const IntRect& viewport)
|
|
|
srcBox.front = 0;
|
|
|
srcBox.back = 1;
|
|
|
|
|
|
- ID3D11Resource* source = 0;
|
|
|
+ ID3D11Resource* source = nullptr;
|
|
|
bool resolve = multiSample_ > 1;
|
|
|
impl_->defaultRenderTargetView_->GetResource(&source);
|
|
|
|
|
|
@@ -932,10 +932,10 @@ bool Graphics::SetVertexBuffers(const PODVector<VertexBuffer*>& buffers, unsigne
|
|
|
|
|
|
for (unsigned i = 0; i < MAX_VERTEX_STREAMS; ++i)
|
|
|
{
|
|
|
- VertexBuffer* buffer = 0;
|
|
|
+ VertexBuffer* buffer = nullptr;
|
|
|
bool changed = false;
|
|
|
|
|
|
- buffer = i < buffers.Size() ? buffers[i] : 0;
|
|
|
+ buffer = i < buffers.Size() ? buffers[i] : nullptr;
|
|
|
if (buffer)
|
|
|
{
|
|
|
const PODVector<VertexElement>& elements = buffer->GetElements();
|
|
|
@@ -954,8 +954,8 @@ bool Graphics::SetVertexBuffers(const PODVector<VertexBuffer*>& buffers, unsigne
|
|
|
}
|
|
|
else if (vertexBuffers_[i])
|
|
|
{
|
|
|
- vertexBuffers_[i] = 0;
|
|
|
- impl_->vertexBuffers_[i] = 0;
|
|
|
+ vertexBuffers_[i] = nullptr;
|
|
|
+ impl_->vertexBuffers_[i] = nullptr;
|
|
|
impl_->vertexSizes_[i] = 0;
|
|
|
impl_->vertexOffsets_[i] = 0;
|
|
|
changed = true;
|
|
|
@@ -993,7 +993,7 @@ void Graphics::SetIndexBuffer(IndexBuffer* buffer)
|
|
|
impl_->deviceContext_->IASetIndexBuffer((ID3D11Buffer*)buffer->GetGPUObject(),
|
|
|
buffer->GetIndexSize() == sizeof(unsigned short) ? DXGI_FORMAT_R16_UINT : DXGI_FORMAT_R32_UINT, 0);
|
|
|
else
|
|
|
- impl_->deviceContext_->IASetIndexBuffer(0, DXGI_FORMAT_UNKNOWN, 0);
|
|
|
+ impl_->deviceContext_->IASetIndexBuffer(nullptr, DXGI_FORMAT_UNKNOWN, 0);
|
|
|
|
|
|
indexBuffer_ = buffer;
|
|
|
}
|
|
|
@@ -1026,14 +1026,14 @@ void Graphics::SetShaders(ShaderVariation* vs, ShaderVariation* ps)
|
|
|
if (!success)
|
|
|
{
|
|
|
URHO3D_LOGERROR("Failed to compile vertex shader " + vs->GetFullName() + ":\n" + vs->GetCompilerOutput());
|
|
|
- vs = 0;
|
|
|
+ vs = nullptr;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
- vs = 0;
|
|
|
+ vs = nullptr;
|
|
|
}
|
|
|
|
|
|
- impl_->deviceContext_->VSSetShader((ID3D11VertexShader*)(vs ? vs->GetGPUObject() : 0), 0, 0);
|
|
|
+ impl_->deviceContext_->VSSetShader((ID3D11VertexShader*)(vs ? vs->GetGPUObject() : nullptr), nullptr, 0);
|
|
|
vertexShader_ = vs;
|
|
|
impl_->vertexDeclarationDirty_ = true;
|
|
|
}
|
|
|
@@ -1050,14 +1050,14 @@ void Graphics::SetShaders(ShaderVariation* vs, ShaderVariation* ps)
|
|
|
if (!success)
|
|
|
{
|
|
|
URHO3D_LOGERROR("Failed to compile pixel shader " + ps->GetFullName() + ":\n" + ps->GetCompilerOutput());
|
|
|
- ps = 0;
|
|
|
+ ps = nullptr;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
- ps = 0;
|
|
|
+ ps = nullptr;
|
|
|
}
|
|
|
|
|
|
- impl_->deviceContext_->PSSetShader((ID3D11PixelShader*)(ps ? ps->GetGPUObject() : 0), 0, 0);
|
|
|
+ impl_->deviceContext_->PSSetShader((ID3D11PixelShader*)(ps ? ps->GetGPUObject() : nullptr), nullptr, 0);
|
|
|
pixelShader_ = ps;
|
|
|
}
|
|
|
|
|
|
@@ -1080,7 +1080,7 @@ void Graphics::SetShaders(ShaderVariation* vs, ShaderVariation* ps)
|
|
|
for (unsigned i = 0; i < MAX_SHADER_PARAMETER_GROUPS; ++i)
|
|
|
{
|
|
|
ID3D11Buffer* vsBuffer = impl_->shaderProgram_->vsConstantBuffers_[i] ? (ID3D11Buffer*)impl_->shaderProgram_->vsConstantBuffers_[i]->
|
|
|
- GetGPUObject() : 0;
|
|
|
+ GetGPUObject() : nullptr;
|
|
|
if (vsBuffer != impl_->constantBuffers_[VS][i])
|
|
|
{
|
|
|
impl_->constantBuffers_[VS][i] = vsBuffer;
|
|
|
@@ -1089,7 +1089,7 @@ void Graphics::SetShaders(ShaderVariation* vs, ShaderVariation* ps)
|
|
|
}
|
|
|
|
|
|
ID3D11Buffer* psBuffer = impl_->shaderProgram_->psConstantBuffers_[i] ? (ID3D11Buffer*)impl_->shaderProgram_->psConstantBuffers_[i]->
|
|
|
- GetGPUObject() : 0;
|
|
|
+ GetGPUObject() : nullptr;
|
|
|
if (psBuffer != impl_->constantBuffers_[PS][i])
|
|
|
{
|
|
|
impl_->constantBuffers_[PS][i] = psBuffer;
|
|
|
@@ -1104,7 +1104,7 @@ void Graphics::SetShaders(ShaderVariation* vs, ShaderVariation* ps)
|
|
|
impl_->deviceContext_->PSSetConstantBuffers(0, MAX_SHADER_PARAMETER_GROUPS, &impl_->constantBuffers_[PS][0]);
|
|
|
}
|
|
|
else
|
|
|
- impl_->shaderProgram_ = 0;
|
|
|
+ impl_->shaderProgram_ = nullptr;
|
|
|
|
|
|
// Store shader combination if shader dumping in progress
|
|
|
if (shaderPrecache_)
|
|
|
@@ -1314,7 +1314,7 @@ void Graphics::SetTexture(unsigned index, Texture* texture)
|
|
|
if (texture && texture->GetParametersDirty())
|
|
|
{
|
|
|
texture->UpdateParameters();
|
|
|
- textures_[index] = 0; // Force reassign
|
|
|
+ textures_[index] = nullptr; // Force reassign
|
|
|
}
|
|
|
|
|
|
if (texture != textures_[index])
|
|
|
@@ -1330,8 +1330,8 @@ void Graphics::SetTexture(unsigned index, Texture* texture)
|
|
|
}
|
|
|
|
|
|
textures_[index] = texture;
|
|
|
- impl_->shaderResourceViews_[index] = texture ? (ID3D11ShaderResourceView*)texture->GetShaderResourceView() : 0;
|
|
|
- impl_->samplers_[index] = texture ? (ID3D11SamplerState*)texture->GetSampler() : 0;
|
|
|
+ impl_->shaderResourceViews_[index] = texture ? (ID3D11ShaderResourceView*)texture->GetShaderResourceView() : nullptr;
|
|
|
+ impl_->samplers_[index] = texture ? (ID3D11SamplerState*)texture->GetSampler() : nullptr;
|
|
|
impl_->texturesDirty_ = true;
|
|
|
}
|
|
|
}
|
|
|
@@ -1381,19 +1381,19 @@ void Graphics::SetTextureParametersDirty()
|
|
|
void Graphics::ResetRenderTargets()
|
|
|
{
|
|
|
for (unsigned i = 0; i < MAX_RENDERTARGETS; ++i)
|
|
|
- SetRenderTarget(i, (RenderSurface*)0);
|
|
|
- SetDepthStencil((RenderSurface*)0);
|
|
|
+ SetRenderTarget(i, (RenderSurface*)nullptr);
|
|
|
+ SetDepthStencil((RenderSurface*)nullptr);
|
|
|
SetViewport(IntRect(0, 0, width_, height_));
|
|
|
}
|
|
|
|
|
|
void Graphics::ResetRenderTarget(unsigned index)
|
|
|
{
|
|
|
- SetRenderTarget(index, (RenderSurface*)0);
|
|
|
+ SetRenderTarget(index, (RenderSurface*)nullptr);
|
|
|
}
|
|
|
|
|
|
void Graphics::ResetDepthStencil()
|
|
|
{
|
|
|
- SetDepthStencil((RenderSurface*)0);
|
|
|
+ SetDepthStencil((RenderSurface*)nullptr);
|
|
|
}
|
|
|
|
|
|
void Graphics::SetRenderTarget(unsigned index, RenderSurface* renderTarget)
|
|
|
@@ -1433,7 +1433,7 @@ void Graphics::SetRenderTarget(unsigned index, RenderSurface* renderTarget)
|
|
|
|
|
|
void Graphics::SetRenderTarget(unsigned index, Texture2D* texture)
|
|
|
{
|
|
|
- RenderSurface* renderTarget = 0;
|
|
|
+ RenderSurface* renderTarget = nullptr;
|
|
|
if (texture)
|
|
|
renderTarget = texture->GetRenderSurface();
|
|
|
|
|
|
@@ -1451,7 +1451,7 @@ void Graphics::SetDepthStencil(RenderSurface* depthStencil)
|
|
|
|
|
|
void Graphics::SetDepthStencil(Texture2D* texture)
|
|
|
{
|
|
|
- RenderSurface* depthStencil = 0;
|
|
|
+ RenderSurface* depthStencil = nullptr;
|
|
|
if (texture)
|
|
|
depthStencil = texture->GetRenderSurface();
|
|
|
|
|
|
@@ -1708,7 +1708,7 @@ void Graphics::SetClipPlane(bool enable, const Plane& clipPlane, const Matrix3x4
|
|
|
|
|
|
bool Graphics::IsInitialized() const
|
|
|
{
|
|
|
- return window_ != 0 && impl_->GetDevice() != 0;
|
|
|
+ return window_ != nullptr && impl_->GetDevice() != nullptr;
|
|
|
}
|
|
|
|
|
|
PODVector<int> Graphics::GetMultiSampleLevels() const
|
|
|
@@ -1763,18 +1763,18 @@ ShaderVariation* Graphics::GetShader(ShaderType type, const char* name, const ch
|
|
|
String fullShaderName = shaderPath_ + name + shaderExtension_;
|
|
|
// Try to reduce repeated error log prints because of missing shaders
|
|
|
if (lastShaderName_ == name && !cache->Exists(fullShaderName))
|
|
|
- return 0;
|
|
|
+ return nullptr;
|
|
|
|
|
|
lastShader_ = cache->GetResource<Shader>(fullShaderName);
|
|
|
lastShaderName_ = name;
|
|
|
}
|
|
|
|
|
|
- return lastShader_ ? lastShader_->GetVariation(type, defines) : (ShaderVariation*)0;
|
|
|
+ return lastShader_ ? lastShader_->GetVariation(type, defines) : (ShaderVariation*)nullptr;
|
|
|
}
|
|
|
|
|
|
VertexBuffer* Graphics::GetVertexBuffer(unsigned index) const
|
|
|
{
|
|
|
- return index < MAX_VERTEX_STREAMS ? vertexBuffers_[index] : 0;
|
|
|
+ return index < MAX_VERTEX_STREAMS ? vertexBuffers_[index] : nullptr;
|
|
|
}
|
|
|
|
|
|
ShaderProgram* Graphics::GetShaderProgram() const
|
|
|
@@ -1803,12 +1803,12 @@ const String& Graphics::GetTextureUnitName(TextureUnit unit)
|
|
|
|
|
|
Texture* Graphics::GetTexture(unsigned index) const
|
|
|
{
|
|
|
- return index < MAX_TEXTURE_UNITS ? textures_[index] : 0;
|
|
|
+ return index < MAX_TEXTURE_UNITS ? textures_[index] : nullptr;
|
|
|
}
|
|
|
|
|
|
RenderSurface* Graphics::GetRenderTarget(unsigned index) const
|
|
|
{
|
|
|
- return index < MAX_RENDERTARGETS ? renderTargets_[index] : 0;
|
|
|
+ return index < MAX_RENDERTARGETS ? renderTargets_[index] : nullptr;
|
|
|
}
|
|
|
|
|
|
IntVector2 Graphics::GetRenderTargetDimensions() const
|
|
|
@@ -1911,7 +1911,7 @@ void Graphics::CleanupShaderPrograms(ShaderVariation* variation)
|
|
|
}
|
|
|
|
|
|
if (vertexShader_ == variation || pixelShader_ == variation)
|
|
|
- impl_->shaderProgram_ = 0;
|
|
|
+ impl_->shaderProgram_ = nullptr;
|
|
|
}
|
|
|
|
|
|
void Graphics::CleanupRenderSurface(RenderSurface* surface)
|
|
|
@@ -2138,15 +2138,15 @@ bool Graphics::CreateDevice(int width, int height, int multiSample)
|
|
|
if (!impl_->device_)
|
|
|
{
|
|
|
HRESULT hr = D3D11CreateDevice(
|
|
|
- 0,
|
|
|
+ nullptr,
|
|
|
D3D_DRIVER_TYPE_HARDWARE,
|
|
|
+ nullptr,
|
|
|
0,
|
|
|
- 0,
|
|
|
- 0,
|
|
|
+ nullptr,
|
|
|
0,
|
|
|
D3D11_SDK_VERSION,
|
|
|
&impl_->device_,
|
|
|
- 0,
|
|
|
+ nullptr,
|
|
|
&impl_->deviceContext_
|
|
|
);
|
|
|
|
|
|
@@ -2172,7 +2172,7 @@ bool Graphics::CreateDevice(int width, int height, int multiSample)
|
|
|
if (impl_->swapChain_)
|
|
|
{
|
|
|
impl_->swapChain_->Release();
|
|
|
- impl_->swapChain_ = 0;
|
|
|
+ impl_->swapChain_ = nullptr;
|
|
|
}
|
|
|
|
|
|
DXGI_SWAP_CHAIN_DESC swapChainDesc;
|
|
|
@@ -2188,11 +2188,11 @@ bool Graphics::CreateDevice(int width, int height, int multiSample)
|
|
|
swapChainDesc.Windowed = TRUE;
|
|
|
swapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
|
|
|
|
|
|
- IDXGIDevice* dxgiDevice = 0;
|
|
|
+ IDXGIDevice* dxgiDevice = nullptr;
|
|
|
impl_->device_->QueryInterface(IID_IDXGIDevice, (void**)&dxgiDevice);
|
|
|
- IDXGIAdapter* dxgiAdapter = 0;
|
|
|
+ IDXGIAdapter* dxgiAdapter = nullptr;
|
|
|
dxgiDevice->GetParent(IID_IDXGIAdapter, (void**)&dxgiAdapter);
|
|
|
- IDXGIFactory* dxgiFactory = 0;
|
|
|
+ IDXGIFactory* dxgiFactory = nullptr;
|
|
|
dxgiAdapter->GetParent(IID_IDXGIFactory, (void**)&dxgiFactory);
|
|
|
HRESULT hr = dxgiFactory->CreateSwapChain(impl_->device_, &swapChainDesc, &impl_->swapChain_);
|
|
|
// After creating the swap chain, disable automatic Alt-Enter fullscreen/windowed switching
|
|
|
@@ -2218,32 +2218,32 @@ bool Graphics::UpdateSwapChain(int width, int height)
|
|
|
{
|
|
|
bool success = true;
|
|
|
|
|
|
- ID3D11RenderTargetView* nullView = 0;
|
|
|
- impl_->deviceContext_->OMSetRenderTargets(1, &nullView, 0);
|
|
|
+ ID3D11RenderTargetView* nullView = nullptr;
|
|
|
+ impl_->deviceContext_->OMSetRenderTargets(1, &nullView, nullptr);
|
|
|
if (impl_->defaultRenderTargetView_)
|
|
|
{
|
|
|
impl_->defaultRenderTargetView_->Release();
|
|
|
- impl_->defaultRenderTargetView_ = 0;
|
|
|
+ impl_->defaultRenderTargetView_ = nullptr;
|
|
|
}
|
|
|
if (impl_->defaultDepthStencilView_)
|
|
|
{
|
|
|
impl_->defaultDepthStencilView_->Release();
|
|
|
- impl_->defaultDepthStencilView_ = 0;
|
|
|
+ impl_->defaultDepthStencilView_ = nullptr;
|
|
|
}
|
|
|
if (impl_->defaultDepthTexture_)
|
|
|
{
|
|
|
impl_->defaultDepthTexture_->Release();
|
|
|
- impl_->defaultDepthTexture_ = 0;
|
|
|
+ impl_->defaultDepthTexture_ = nullptr;
|
|
|
}
|
|
|
if (impl_->resolveTexture_)
|
|
|
{
|
|
|
impl_->resolveTexture_->Release();
|
|
|
- impl_->resolveTexture_ = 0;
|
|
|
+ impl_->resolveTexture_ = nullptr;
|
|
|
}
|
|
|
|
|
|
- impl_->depthStencilView_ = 0;
|
|
|
+ impl_->depthStencilView_ = nullptr;
|
|
|
for (unsigned i = 0; i < MAX_RENDERTARGETS; ++i)
|
|
|
- impl_->renderTargetViews_[i] = 0;
|
|
|
+ impl_->renderTargetViews_[i] = nullptr;
|
|
|
impl_->renderTargetsDirty_ = true;
|
|
|
|
|
|
impl_->swapChain_->ResizeBuffers(1, (UINT)width, (UINT)height, DXGI_FORMAT_UNKNOWN, DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH);
|
|
|
@@ -2259,7 +2259,7 @@ bool Graphics::UpdateSwapChain(int width, int height)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- hr = impl_->device_->CreateRenderTargetView(backbufferTexture, 0, &impl_->defaultRenderTargetView_);
|
|
|
+ hr = impl_->device_->CreateRenderTargetView(backbufferTexture, nullptr, &impl_->defaultRenderTargetView_);
|
|
|
backbufferTexture->Release();
|
|
|
if (FAILED(hr))
|
|
|
{
|
|
|
@@ -2283,7 +2283,7 @@ bool Graphics::UpdateSwapChain(int width, int height)
|
|
|
depthDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
|
|
|
depthDesc.CPUAccessFlags = 0;
|
|
|
depthDesc.MiscFlags = 0;
|
|
|
- hr = impl_->device_->CreateTexture2D(&depthDesc, 0, &impl_->defaultDepthTexture_);
|
|
|
+ hr = impl_->device_->CreateTexture2D(&depthDesc, nullptr, &impl_->defaultDepthTexture_);
|
|
|
if (FAILED(hr))
|
|
|
{
|
|
|
URHO3D_SAFE_RELEASE(impl_->defaultDepthTexture_);
|
|
|
@@ -2292,7 +2292,7 @@ bool Graphics::UpdateSwapChain(int width, int height)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- hr = impl_->device_->CreateDepthStencilView(impl_->defaultDepthTexture_, 0, &impl_->defaultDepthStencilView_);
|
|
|
+ hr = impl_->device_->CreateDepthStencilView(impl_->defaultDepthTexture_, nullptr, &impl_->defaultDepthStencilView_);
|
|
|
if (FAILED(hr))
|
|
|
{
|
|
|
URHO3D_SAFE_RELEASE(impl_->defaultDepthStencilView_);
|
|
|
@@ -2328,40 +2328,40 @@ void Graphics::ResetCachedState()
|
|
|
{
|
|
|
for (unsigned i = 0; i < MAX_VERTEX_STREAMS; ++i)
|
|
|
{
|
|
|
- vertexBuffers_[i] = 0;
|
|
|
- impl_->vertexBuffers_[i] = 0;
|
|
|
+ vertexBuffers_[i] = nullptr;
|
|
|
+ impl_->vertexBuffers_[i] = nullptr;
|
|
|
impl_->vertexSizes_[i] = 0;
|
|
|
impl_->vertexOffsets_[i] = 0;
|
|
|
}
|
|
|
|
|
|
for (unsigned i = 0; i < MAX_TEXTURE_UNITS; ++i)
|
|
|
{
|
|
|
- textures_[i] = 0;
|
|
|
- impl_->shaderResourceViews_[i] = 0;
|
|
|
- impl_->samplers_[i] = 0;
|
|
|
+ textures_[i] = nullptr;
|
|
|
+ impl_->shaderResourceViews_[i] = nullptr;
|
|
|
+ impl_->samplers_[i] = nullptr;
|
|
|
}
|
|
|
|
|
|
for (unsigned i = 0; i < MAX_RENDERTARGETS; ++i)
|
|
|
{
|
|
|
- renderTargets_[i] = 0;
|
|
|
- impl_->renderTargetViews_[i] = 0;
|
|
|
+ renderTargets_[i] = nullptr;
|
|
|
+ impl_->renderTargetViews_[i] = nullptr;
|
|
|
}
|
|
|
|
|
|
for (unsigned i = 0; i < MAX_SHADER_PARAMETER_GROUPS; ++i)
|
|
|
{
|
|
|
- impl_->constantBuffers_[VS][i] = 0;
|
|
|
- impl_->constantBuffers_[PS][i] = 0;
|
|
|
+ impl_->constantBuffers_[VS][i] = nullptr;
|
|
|
+ impl_->constantBuffers_[PS][i] = nullptr;
|
|
|
}
|
|
|
|
|
|
- depthStencil_ = 0;
|
|
|
- impl_->depthStencilView_ = 0;
|
|
|
+ depthStencil_ = nullptr;
|
|
|
+ impl_->depthStencilView_ = nullptr;
|
|
|
viewport_ = IntRect(0, 0, width_, height_);
|
|
|
|
|
|
- indexBuffer_ = 0;
|
|
|
+ indexBuffer_ = nullptr;
|
|
|
vertexDeclarationHash_ = 0;
|
|
|
primitiveType_ = 0;
|
|
|
- vertexShader_ = 0;
|
|
|
- pixelShader_ = 0;
|
|
|
+ vertexShader_ = nullptr;
|
|
|
+ pixelShader_ = nullptr;
|
|
|
blendMode_ = BLEND_REPLACE;
|
|
|
alphaToCoverage_ = false;
|
|
|
colorWrite_ = true;
|
|
|
@@ -2383,7 +2383,7 @@ void Graphics::ResetCachedState()
|
|
|
stencilCompareMask_ = M_MAX_UNSIGNED;
|
|
|
stencilWriteMask_ = M_MAX_UNSIGNED;
|
|
|
useClipPlane_ = false;
|
|
|
- impl_->shaderProgram_ = 0;
|
|
|
+ impl_->shaderProgram_ = nullptr;
|
|
|
impl_->renderTargetsDirty_ = true;
|
|
|
impl_->texturesDirty_ = true;
|
|
|
impl_->vertexDeclarationDirty_ = true;
|
|
|
@@ -2415,7 +2415,7 @@ void Graphics::PrepareDraw()
|
|
|
for (unsigned i = 0; i < MAX_RENDERTARGETS; ++i)
|
|
|
impl_->renderTargetViews_[i] =
|
|
|
(renderTargets_[i] && renderTargets_[i]->GetUsage() == TEXTURE_RENDERTARGET) ?
|
|
|
- (ID3D11RenderTargetView*)renderTargets_[i]->GetRenderTargetView() : 0;
|
|
|
+ (ID3D11RenderTargetView*)renderTargets_[i]->GetRenderTargetView() : nullptr;
|
|
|
// If rendertarget 0 is null and not doing depth-only rendering, render to the backbuffer
|
|
|
// Special case: if rendertarget 0 is null and depth stencil has same size as backbuffer, assume the intention is to do
|
|
|
// backbuffer rendering with a custom depth stencil
|
|
|
@@ -2504,7 +2504,7 @@ void Graphics::PrepareDraw()
|
|
|
stateDesc.RenderTarget[0].BlendOpAlpha = d3dBlendOp[blendMode_];
|
|
|
stateDesc.RenderTarget[0].RenderTargetWriteMask = colorWrite_ ? D3D11_COLOR_WRITE_ENABLE_ALL : 0x0;
|
|
|
|
|
|
- ID3D11BlendState* newBlendState = 0;
|
|
|
+ ID3D11BlendState* newBlendState = nullptr;
|
|
|
HRESULT hr = impl_->device_->CreateBlendState(&stateDesc, &newBlendState);
|
|
|
if (FAILED(hr))
|
|
|
{
|
|
|
@@ -2515,7 +2515,7 @@ void Graphics::PrepareDraw()
|
|
|
i = impl_->blendStates_.Insert(MakePair(newBlendStateHash, newBlendState));
|
|
|
}
|
|
|
|
|
|
- impl_->deviceContext_->OMSetBlendState(i->second_, 0, M_MAX_UNSIGNED);
|
|
|
+ impl_->deviceContext_->OMSetBlendState(i->second_, nullptr, M_MAX_UNSIGNED);
|
|
|
impl_->blendStateHash_ = newBlendStateHash;
|
|
|
}
|
|
|
|
|
|
@@ -2552,7 +2552,7 @@ void Graphics::PrepareDraw()
|
|
|
stateDesc.BackFace.StencilPassOp = d3dStencilOp[stencilPass_];
|
|
|
stateDesc.BackFace.StencilFunc = d3dCmpFunc[stencilTestMode_];
|
|
|
|
|
|
- ID3D11DepthStencilState* newDepthState = 0;
|
|
|
+ ID3D11DepthStencilState* newDepthState = nullptr;
|
|
|
HRESULT hr = impl_->device_->CreateDepthStencilState(&stateDesc, &newDepthState);
|
|
|
if (FAILED(hr))
|
|
|
{
|
|
|
@@ -2601,7 +2601,7 @@ void Graphics::PrepareDraw()
|
|
|
stateDesc.MultisampleEnable = lineAntiAlias_ ? FALSE : TRUE;
|
|
|
stateDesc.AntialiasedLineEnable = lineAntiAlias_ ? TRUE : FALSE;
|
|
|
|
|
|
- ID3D11RasterizerState* newRasterizerState = 0;
|
|
|
+ ID3D11RasterizerState* newRasterizerState = nullptr;
|
|
|
HRESULT hr = impl_->device_->CreateRasterizerState(&stateDesc, &newRasterizerState);
|
|
|
if (FAILED(hr))
|
|
|
{
|
|
|
@@ -2652,7 +2652,7 @@ void Graphics::CreateResolveTexture()
|
|
|
textureDesc.Usage = D3D11_USAGE_DEFAULT;
|
|
|
textureDesc.CPUAccessFlags = 0;
|
|
|
|
|
|
- HRESULT hr = impl_->device_->CreateTexture2D(&textureDesc, 0, &impl_->resolveTexture_);
|
|
|
+ HRESULT hr = impl_->device_->CreateTexture2D(&textureDesc, nullptr, &impl_->resolveTexture_);
|
|
|
if (FAILED(hr))
|
|
|
{
|
|
|
URHO3D_SAFE_RELEASE(impl_->resolveTexture_);
|