Skip to content

Commit

Permalink
Add documentation comments and nodiscard attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
mogemimi committed Aug 23, 2019
1 parent 3ba1ddf commit 6547456
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
11 changes: 10 additions & 1 deletion include/Pomdog/Content/AssetBuilders/ShaderBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,35 +31,44 @@ class POMDOG_EXPORT Builder<Shader> final {

~Builder();

/// Sets the string of the GLSL source code, and the entry point of the function.
Builder& SetGLSL(const void* shaderSource, std::size_t byteLength);

/// Sets the file path to GLSL file, and the entry point of the function.
Builder& SetGLSLFromFile(const std::string& filePath);

/// Sets the string of the HLSL source code, and the entry point of the function.
Builder& SetHLSL(
const void* shaderSource,
std::size_t byteLength,
const std::string& entryPoint);

/// Sets the data from a precompiled HLSL binary, and the entry point of the function.
Builder& SetHLSLPrecompiled(
const void* shaderSource,
std::size_t byteLength);

/// Sets the file path to HLSL file, and the entry point of the function.
Builder& SetHLSLFromFile(
const std::string& filePath,
const std::string& entryPoint);

/// Sets the string of the Metal source code, and the entry point of the function.
Builder& SetMetal(
const void* shaderSource,
std::size_t byteLength,
const std::string& entryPoint);

/// Sets the file path to `.metal` file, and the entry point of the function.
Builder& SetMetalFromFile(
const std::string& filePath,
const std::string& entryPoint);

/// Sets the entry point of the function in the default library.
Builder& SetMetalFromLibrary(const std::string& entryPoint);

std::shared_ptr<Shader> Build();
/// Returns an object representing shader function.
[[nodiscard]] std::shared_ptr<Shader> Build();

private:
class Impl;
Expand Down
4 changes: 3 additions & 1 deletion include/Pomdog/Graphics/ShaderCompilers/GLSLCompiler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ class Shader;
namespace Pomdog::ShaderCompilers {

struct POMDOG_EXPORT GLSLCompiler final {
static std::unique_ptr<Shader> CreateShader(
/// Creates a shader from a string of source code.
[[nodiscard]] static std::unique_ptr<Shader>
CreateShader(
GraphicsDevice& graphicsDevice,
const void* shaderSource,
std::size_t byteLength,
Expand Down
8 changes: 6 additions & 2 deletions include/Pomdog/Graphics/ShaderCompilers/HLSLCompiler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@ class Shader;
namespace Pomdog::ShaderCompilers {

struct POMDOG_EXPORT HLSLCompiler final {
static std::unique_ptr<Shader> CreateShaderFromBinary(
/// Creates a shader from a string of source code.
[[nodiscard]] static std::unique_ptr<Shader>
CreateShaderFromBinary(
GraphicsDevice& graphicsDevice,
const void* shaderSource,
std::size_t byteLength,
ShaderPipelineStage pipelineStage);

static std::unique_ptr<Shader> CreateShaderFromSource(
/// Creates a shader from precompiled shader binary data.
[[nodiscard]] static std::unique_ptr<Shader>
CreateShaderFromSource(
GraphicsDevice& graphicsDevice,
const void* shaderSource,
std::size_t byteLength,
Expand Down
4 changes: 3 additions & 1 deletion include/Pomdog/Graphics/ShaderCompilers/MetalCompiler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ class Shader;
namespace Pomdog::ShaderCompilers {

struct POMDOG_EXPORT MetalCompiler final {
static std::unique_ptr<Shader> CreateShaderFromSource(
/// Creates a shader from a string of source code.
[[nodiscard]] static std::unique_ptr<Shader>
CreateShaderFromSource(
GraphicsDevice& graphicsDevice,
const void* shaderSource,
std::size_t byteLength,
Expand Down

0 comments on commit 6547456

Please sign in to comment.