Skip to content

Commit

Permalink
Minor coding style changes in Vulkan
Browse files Browse the repository at this point in the history
  • Loading branch information
mogemimi committed May 15, 2016
1 parent f1f8076 commit 3cd4f5e
Show file tree
Hide file tree
Showing 16 changed files with 80 additions and 59 deletions.
4 changes: 2 additions & 2 deletions src/RenderSystem.Vulkan/BufferVulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ BufferVulkan::BufferVulkan(
//-----------------------------------------------------------------------
BufferVulkan::BufferVulkan(
::VkDevice deviceIn,
void const* sourceData,
const void* sourceData,
std::size_t sizeInBytes,
BufferUsage bufferUsage,
VkBufferUsageFlags usageFlags)
Expand Down Expand Up @@ -146,7 +146,7 @@ void BufferVulkan::GetData(
}
//-----------------------------------------------------------------------
void BufferVulkan::SetData(
std::size_t offsetInBytes, void const* source, std::size_t sizeInBytes)
std::size_t offsetInBytes, const void* source, std::size_t sizeInBytes)
{
POMDOG_ASSERT(nativeBuffer != nullptr);

Expand Down
4 changes: 2 additions & 2 deletions src/RenderSystem.Vulkan/BufferVulkan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class BufferVulkan final : public NativeBuffer {

BufferVulkan(
::VkDevice device,
void const* sourceData,
const void* sourceData,
std::size_t sizeInBytes,
BufferUsage bufferUsage,
VkBufferUsageFlags usageFlags);
Expand All @@ -34,7 +34,7 @@ class BufferVulkan final : public NativeBuffer {

void SetData(
std::size_t offsetInBytes,
void const* source,
const void* source,
std::size_t sizeInBytes) override;

VkBuffer GetBuffer() const;
Expand Down
22 changes: 11 additions & 11 deletions src/RenderSystem.Vulkan/GraphicsCommandListVulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ std::size_t GraphicsCommandListVulkan::GetCount() const noexcept
POMDOG_THROW_EXCEPTION(std::runtime_error, "Not implemented");
}
//-----------------------------------------------------------------------
void GraphicsCommandListVulkan::Clear(ClearOptions options, Color const& color, float depth, std::uint8_t stencil)
void GraphicsCommandListVulkan::Clear(ClearOptions options, const Color& color, float depth, std::uint8_t stencil)
{
POMDOG_THROW_EXCEPTION(std::runtime_error, "Not implemented");
}
Expand Down Expand Up @@ -89,12 +89,12 @@ void GraphicsCommandListVulkan::DrawIndexedInstanced(
POMDOG_THROW_EXCEPTION(std::runtime_error, "Not implemented");
}
//-----------------------------------------------------------------------
void GraphicsCommandListVulkan::SetViewport(Viewport const& viewport)
void GraphicsCommandListVulkan::SetViewport(const Viewport& viewport)
{
POMDOG_THROW_EXCEPTION(std::runtime_error, "Not implemented");
}
//-----------------------------------------------------------------------
void GraphicsCommandListVulkan::SetScissorRectangle(Rectangle const& rectangle)
void GraphicsCommandListVulkan::SetScissorRectangle(const Rectangle& rectangle)
{
POMDOG_THROW_EXCEPTION(std::runtime_error, "Not implemented");
}
Expand All @@ -104,12 +104,12 @@ void GraphicsCommandListVulkan::SetPrimitiveTopology(PrimitiveTopology primitive
POMDOG_THROW_EXCEPTION(std::runtime_error, "Not implemented");
}
//-----------------------------------------------------------------------
void GraphicsCommandListVulkan::SetBlendFactor(Color const& blendFactor)
void GraphicsCommandListVulkan::SetBlendFactor(const Color& blendFactor)
{
POMDOG_THROW_EXCEPTION(std::runtime_error, "Not implemented");
}
//-----------------------------------------------------------------------
void GraphicsCommandListVulkan::SetVertexBuffers(std::vector<VertexBufferBinding> const& vertexBuffers)
void GraphicsCommandListVulkan::SetVertexBuffers(const std::vector<VertexBufferBinding>& vertexBuffers)
{
POMDOG_THROW_EXCEPTION(std::runtime_error, "Not implemented");
}
Expand All @@ -119,17 +119,17 @@ void GraphicsCommandListVulkan::SetVertexBuffers(std::vector<VertexBufferBinding
POMDOG_THROW_EXCEPTION(std::runtime_error, "Not implemented");
}
//-----------------------------------------------------------------------
void GraphicsCommandListVulkan::SetIndexBuffer(std::shared_ptr<IndexBuffer> const& indexBuffer)
void GraphicsCommandListVulkan::SetIndexBuffer(const std::shared_ptr<IndexBuffer>& indexBuffer)
{
POMDOG_THROW_EXCEPTION(std::runtime_error, "Not implemented");
}
//-----------------------------------------------------------------------
void GraphicsCommandListVulkan::SetPipelineState(std::shared_ptr<NativePipelineState> const& pipelineState)
void GraphicsCommandListVulkan::SetPipelineState(const std::shared_ptr<NativePipelineState>& pipelineState)
{
POMDOG_THROW_EXCEPTION(std::runtime_error, "Not implemented");
}
//-----------------------------------------------------------------------
void GraphicsCommandListVulkan::SetConstantBuffer(int index, std::shared_ptr<NativeBuffer> const& constantBuffer)
void GraphicsCommandListVulkan::SetConstantBuffer(int index, const std::shared_ptr<NativeBuffer>& constantBuffer)
{
POMDOG_THROW_EXCEPTION(std::runtime_error, "Not implemented");
}
Expand All @@ -144,12 +144,12 @@ void GraphicsCommandListVulkan::SetTexture(int index)
POMDOG_THROW_EXCEPTION(std::runtime_error, "Not implemented");
}
//-----------------------------------------------------------------------
void GraphicsCommandListVulkan::SetTexture(int index, std::shared_ptr<Texture2D> const& texture)
void GraphicsCommandListVulkan::SetTexture(int index, const std::shared_ptr<Texture2D>& texture)
{
POMDOG_THROW_EXCEPTION(std::runtime_error, "Not implemented");
}
//-----------------------------------------------------------------------
void GraphicsCommandListVulkan::SetTexture(int index, std::shared_ptr<RenderTarget2D> const& texture)
void GraphicsCommandListVulkan::SetTexture(int index, const std::shared_ptr<RenderTarget2D>& texture)
{
POMDOG_THROW_EXCEPTION(std::runtime_error, "Not implemented");
}
Expand All @@ -159,7 +159,7 @@ void GraphicsCommandListVulkan::SetRenderTarget()
POMDOG_THROW_EXCEPTION(std::runtime_error, "Not implemented");
}
//-----------------------------------------------------------------------
void GraphicsCommandListVulkan::SetRenderTargets(std::vector<std::shared_ptr<RenderTarget2D>> const& renderTargets)
void GraphicsCommandListVulkan::SetRenderTargets(const std::vector<std::shared_ptr<RenderTarget2D>>& renderTargets)
{
POMDOG_THROW_EXCEPTION(std::runtime_error, "Not implemented");
}
Expand Down
22 changes: 11 additions & 11 deletions src/RenderSystem.Vulkan/GraphicsCommandListVulkan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class GraphicsCommandListVulkan final : public NativeGraphicsCommandList {

std::size_t GetCount() const noexcept;

void Clear(ClearOptions options, Color const& color, float depth, std::uint8_t stencil);
void Clear(ClearOptions options, const Color& color, float depth, std::uint8_t stencil);

void Draw(std::size_t vertexCount);

Expand All @@ -32,35 +32,35 @@ class GraphicsCommandListVulkan final : public NativeGraphicsCommandList {
std::size_t indexCount,
std::size_t instanceCount);

void SetViewport(Viewport const& viewport);
void SetViewport(const Viewport& viewport);

void SetScissorRectangle(Rectangle const& rectangle);
void SetScissorRectangle(const Rectangle& rectangle);

void SetPrimitiveTopology(PrimitiveTopology primitiveTopology);

void SetBlendFactor(Color const& blendFactor);
void SetBlendFactor(const Color& blendFactor);

void SetVertexBuffers(std::vector<VertexBufferBinding> const& vertexBuffers);
void SetVertexBuffers(const std::vector<VertexBufferBinding>& vertexBuffers);

void SetVertexBuffers(std::vector<VertexBufferBinding> && vertexBuffers);

void SetIndexBuffer(std::shared_ptr<IndexBuffer> const& indexBuffer);
void SetIndexBuffer(const std::shared_ptr<IndexBuffer>& indexBuffer);

void SetPipelineState(std::shared_ptr<NativePipelineState> const& pipelineState);
void SetPipelineState(const std::shared_ptr<NativePipelineState>& pipelineState);

void SetConstantBuffer(int index, std::shared_ptr<NativeBuffer> const& constantBuffer);
void SetConstantBuffer(int index, const std::shared_ptr<NativeBuffer>& constantBuffer);

void SetSampler(int index, std::shared_ptr<NativeSamplerState> && sampler);

void SetTexture(int index);

void SetTexture(int index, std::shared_ptr<Texture2D> const& texture);
void SetTexture(int index, const std::shared_ptr<Texture2D>& texture);

void SetTexture(int index, std::shared_ptr<RenderTarget2D> const& texture);
void SetTexture(int index, const std::shared_ptr<RenderTarget2D>& texture);

void SetRenderTarget();

void SetRenderTargets(std::vector<std::shared_ptr<RenderTarget2D>> const& renderTargets);
void SetRenderTargets(const std::vector<std::shared_ptr<RenderTarget2D>>& renderTargets);

void SetRenderTargets(std::vector<std::shared_ptr<RenderTarget2D>> && renderTargets);

Expand Down
2 changes: 1 addition & 1 deletion src/RenderSystem.Vulkan/GraphicsCommandQueueVulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void GraphicsCommandQueueVulkan::Reset()
POMDOG_THROW_EXCEPTION(std::runtime_error, "Not implemented");
}
//-----------------------------------------------------------------------
void GraphicsCommandQueueVulkan::PushbackCommandList(std::shared_ptr<GraphicsCommandList> const& commandList)
void GraphicsCommandQueueVulkan::PushbackCommandList(const std::shared_ptr<GraphicsCommandList>& commandList)
{
POMDOG_THROW_EXCEPTION(std::runtime_error, "Not implemented");
}
Expand Down
2 changes: 1 addition & 1 deletion src/RenderSystem.Vulkan/GraphicsCommandQueueVulkan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class GraphicsCommandQueueVulkan final : public NativeGraphicsCommandQueue {
public:
void Reset();

void PushbackCommandList(std::shared_ptr<GraphicsCommandList> const& commandList);
void PushbackCommandList(const std::shared_ptr<GraphicsCommandList>& commandList);

void ExecuteCommandLists();

Expand Down
27 changes: 18 additions & 9 deletions src/RenderSystem.Vulkan/GraphicsDeviceVulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ GraphicsDeviceVulkan::CreateGraphicsCommandList()
//-----------------------------------------------------------------------
std::unique_ptr<Shader>
GraphicsDeviceVulkan::CreateShader(
ShaderBytecode const& shaderBytecode,
ShaderCompileOptions const& compileOptions)
const ShaderBytecode& shaderBytecode,
const ShaderCompileOptions& compileOptions)
{
POMDOG_ASSERT(impl);
POMDOG_ASSERT(impl->device != nullptr);
Expand All @@ -253,7 +253,10 @@ GraphicsDeviceVulkan::CreateBuffer(
//-----------------------------------------------------------------------
std::unique_ptr<NativeBuffer>
GraphicsDeviceVulkan::CreateBuffer(
void const* sourceData, std::size_t sizeInBytes, BufferUsage bufferUsage, BufferBindMode)
const void* sourceData,
std::size_t sizeInBytes,
BufferUsage bufferUsage,
BufferBindMode)
{
POMDOG_ASSERT(impl);
POMDOG_ASSERT(impl->device != nullptr);
Expand All @@ -262,31 +265,35 @@ GraphicsDeviceVulkan::CreateBuffer(
}
//-----------------------------------------------------------------------
std::unique_ptr<NativeSamplerState>
GraphicsDeviceVulkan::CreateSamplerState(SamplerDescription const& description)
GraphicsDeviceVulkan::CreateSamplerState(const SamplerDescription& description)
{
POMDOG_ASSERT(impl);
POMDOG_ASSERT(impl->device != nullptr);
return std::make_unique<SamplerStateVulkan>(impl->device, description);
}
//-----------------------------------------------------------------------
std::unique_ptr<NativePipelineState>
GraphicsDeviceVulkan::CreatePipelineState(PipelineStateDescription const& description)
GraphicsDeviceVulkan::CreatePipelineState(const PipelineStateDescription& description)
{
POMDOG_ASSERT(impl);
POMDOG_ASSERT(impl->device != nullptr);
return std::make_unique<PipelineStateVulkan>(impl->device, description);
}
//-----------------------------------------------------------------------
std::unique_ptr<NativeEffectReflection>
GraphicsDeviceVulkan::CreateEffectReflection(PipelineStateDescription const& description,
GraphicsDeviceVulkan::CreateEffectReflection(
const PipelineStateDescription& description,
NativePipelineState & pipelineState)
{
POMDOG_THROW_EXCEPTION(std::runtime_error, "Not implemented");
}
//-----------------------------------------------------------------------
std::unique_ptr<NativeTexture2D>
GraphicsDeviceVulkan::CreateTexture2D(std::int32_t width, std::int32_t height,
std::int32_t mipmapLevels, SurfaceFormat format)
GraphicsDeviceVulkan::CreateTexture2D(
std::int32_t width,
std::int32_t height,
std::int32_t mipmapLevels,
SurfaceFormat format)
{
POMDOG_ASSERT(impl);
POMDOG_ASSERT(impl->device != nullptr);
Expand All @@ -295,7 +302,9 @@ GraphicsDeviceVulkan::CreateTexture2D(std::int32_t width, std::int32_t height,
}
//-----------------------------------------------------------------------
std::unique_ptr<NativeRenderTarget2D>
GraphicsDeviceVulkan::CreateRenderTarget2D(std::int32_t width, std::int32_t height,
GraphicsDeviceVulkan::CreateRenderTarget2D(
std::int32_t width,
std::int32_t height,
std::int32_t mipmapLevels,
SurfaceFormat format,
DepthFormat depthStencilFormat,
Expand Down
36 changes: 24 additions & 12 deletions src/RenderSystem.Vulkan/GraphicsDeviceVulkan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,45 @@ class GraphicsDeviceVulkan final : public NativeGraphicsDevice {
CreateGraphicsCommandList() override;

std::unique_ptr<Shader>
CreateShader(ShaderBytecode const& shaderBytecode,
ShaderCompileOptions const& compileOptions) override;
CreateShader(
const ShaderBytecode& shaderBytecode,
const ShaderCompileOptions& compileOptions) override;

std::unique_ptr<NativeBuffer>
CreateBuffer(std::size_t sizeInBytes,
BufferUsage bufferUsage, BufferBindMode bindMode) override;
CreateBuffer(
std::size_t sizeInBytes,
BufferUsage bufferUsage,
BufferBindMode bindMode) override;

std::unique_ptr<NativeBuffer>
CreateBuffer(void const* sourceData, std::size_t sizeInBytes,
BufferUsage bufferUsage, BufferBindMode bindMode) override;
CreateBuffer(
const void* sourceData,
std::size_t sizeInBytes,
BufferUsage bufferUsage,
BufferBindMode bindMode) override;

std::unique_ptr<NativeSamplerState>
CreateSamplerState(SamplerDescription const& description) override;
CreateSamplerState(const SamplerDescription& description) override;

std::unique_ptr<NativePipelineState>
CreatePipelineState(PipelineStateDescription const& description) override;
CreatePipelineState(const PipelineStateDescription& description) override;

std::unique_ptr<NativeEffectReflection>
CreateEffectReflection(PipelineStateDescription const& description,
CreateEffectReflection(
const PipelineStateDescription& description,
NativePipelineState & pipelineState) override;

std::unique_ptr<NativeTexture2D>
CreateTexture2D(std::int32_t width, std::int32_t height,
std::int32_t mipmapLevels, SurfaceFormat format) override;
CreateTexture2D(
std::int32_t width,
std::int32_t height,
std::int32_t mipmapLevels,
SurfaceFormat format) override;

std::unique_ptr<NativeRenderTarget2D>
CreateRenderTarget2D(std::int32_t width, std::int32_t height,
CreateRenderTarget2D(
std::int32_t width,
std::int32_t height,
std::int32_t mipmapLevels,
SurfaceFormat format,
DepthFormat depthStencilFormat,
Expand Down
2 changes: 1 addition & 1 deletion src/RenderSystem.Vulkan/PipelineStateVulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ VkPolygonMode ToVkPolygonMode(FillMode fillMode) noexcept
//-----------------------------------------------------------------------
PipelineStateVulkan::PipelineStateVulkan(
VkDevice device,
PipelineStateDescription const& description)
const PipelineStateDescription& description)
{
POMDOG_ASSERT(device != nullptr);

Expand Down
2 changes: 1 addition & 1 deletion src/RenderSystem.Vulkan/PipelineStateVulkan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class PipelineStateVulkan final : public NativePipelineState {
public:
PipelineStateVulkan(
VkDevice device,
PipelineStateDescription const& description);
const PipelineStateDescription& description);

private:
};
Expand Down
2 changes: 1 addition & 1 deletion src/RenderSystem.Vulkan/SamplerStateVulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ ToTextureFilter(TextureFilter filter)
//-----------------------------------------------------------------------
SamplerStateVulkan::SamplerStateVulkan(
::VkDevice deviceIn,
SamplerDescription const& description)
const SamplerDescription& description)
: device(deviceIn)
, sampler(nullptr)
{
Expand Down
2 changes: 1 addition & 1 deletion src/RenderSystem.Vulkan/SamplerStateVulkan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class SamplerStateVulkan final : public NativeSamplerState {
public:
SamplerStateVulkan(
::VkDevice device,
SamplerDescription const& description);
const SamplerDescription& description);

~SamplerStateVulkan();

Expand Down
4 changes: 2 additions & 2 deletions src/RenderSystem.Vulkan/ShaderVulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ namespace Vulkan {
//-----------------------------------------------------------------------
ShaderVulkan::ShaderVulkan(
::VkDevice deviceIn,
ShaderBytecode const& shaderBytecode,
ShaderCompileOptions const& compileOptions)
const ShaderBytecode& shaderBytecode,
const ShaderCompileOptions& compileOptions)
: device(deviceIn)
, shaderModule(nullptr)
{
Expand Down
4 changes: 2 additions & 2 deletions src/RenderSystem.Vulkan/ShaderVulkan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ class ShaderVulkan final : public Shader {
public:
ShaderVulkan(
::VkDevice device,
ShaderBytecode const& shaderBytecode,
ShaderCompileOptions const& compileOptions);
const ShaderBytecode& shaderBytecode,
const ShaderCompileOptions& compileOptions);

~ShaderVulkan();

Expand Down
2 changes: 1 addition & 1 deletion src/RenderSystem.Vulkan/Texture2DVulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void Texture2DVulkan::SetData(
std::int32_t pixelHeight,
std::int32_t levelCount,
SurfaceFormat format,
void const* pixelData)
const void* pixelData)
{
POMDOG_ASSERT(pixelWidth > 0);
POMDOG_ASSERT(pixelHeight > 0);
Expand Down
Loading

0 comments on commit 3cd4f5e

Please sign in to comment.