This commit is contained in:
Attila Uygun 2023-06-17 21:05:05 +02:00
parent 8fd24a3c1a
commit 67632ff144
12 changed files with 20 additions and 20 deletions

View File

@ -30,7 +30,7 @@ class Mesh {
size_t GetIndexSize() const; size_t GetIndexSize() const;
Primitive primitive() const { return primitive_; } Primitive primitive() const { return primitive_; }
const VertexDescripton& vertex_description() const { const VertexDescription& vertex_description() const {
return vertex_description_; return vertex_description_;
} }
size_t num_vertices() const { return num_vertices_; } size_t num_vertices() const { return num_vertices_; }
@ -41,7 +41,7 @@ class Mesh {
private: private:
Primitive primitive_ = kPrimitive_TriangleStrip; Primitive primitive_ = kPrimitive_TriangleStrip;
VertexDescripton vertex_description_; VertexDescription vertex_description_;
size_t num_vertices_ = 0; size_t num_vertices_ = 0;
DataType index_description_ = kDataType_Invalid; DataType index_description_ = kDataType_Invalid;
size_t num_indices_ = 0; size_t num_indices_ = 0;

View File

@ -23,14 +23,14 @@ class Geometry : public RenderResource {
void Draw(); void Draw();
const VertexDescripton& vertex_description() const { const VertexDescription& vertex_description() const {
return vertex_description_; return vertex_description_;
} }
Primitive primitive() { return primitive_; } Primitive primitive() { return primitive_; }
private: private:
VertexDescripton vertex_description_; VertexDescription vertex_description_;
Primitive primitive_ = kPrimitive_Invalid; Primitive primitive_ = kPrimitive_Invalid;
}; };

View File

@ -85,7 +85,7 @@ RENDER_COMMAND_END
RENDER_COMMAND_BEGIN(CmdCreateShader) RENDER_COMMAND_BEGIN(CmdCreateShader)
std::unique_ptr<ShaderSource> source; std::unique_ptr<ShaderSource> source;
VertexDescripton vertex_description; VertexDescription vertex_description;
uint64_t resource_id; uint64_t resource_id;
bool enable_depth_test; bool enable_depth_test;
RENDER_COMMAND_END RENDER_COMMAND_END

View File

@ -121,7 +121,7 @@ void RendererOpenGL::ActivateTexture(uint64_t resource_id) {
uint64_t RendererOpenGL::CreateShader( uint64_t RendererOpenGL::CreateShader(
std::unique_ptr<ShaderSource> source, std::unique_ptr<ShaderSource> source,
const VertexDescripton& vertex_description, const VertexDescription& vertex_description,
Primitive primitive, Primitive primitive,
bool enable_depth_test) { bool enable_depth_test) {
auto cmd = std::make_unique<CmdCreateShader>(); auto cmd = std::make_unique<CmdCreateShader>();
@ -853,7 +853,7 @@ void RendererOpenGL::BindTexture(GLuint id) {
} }
bool RendererOpenGL::SetupVertexLayout( bool RendererOpenGL::SetupVertexLayout(
const VertexDescripton& vd, const VertexDescription& vd,
GLuint vertex_size, GLuint vertex_size,
bool use_vao, bool use_vao,
std::vector<GeometryOpenGL::Element>& vertex_layout) { std::vector<GeometryOpenGL::Element>& vertex_layout) {
@ -918,7 +918,7 @@ GLuint RendererOpenGL::CreateShader(const char* source, GLenum type) {
} }
bool RendererOpenGL::BindAttributeLocation(GLuint id, bool RendererOpenGL::BindAttributeLocation(GLuint id,
const VertexDescripton& vd) { const VertexDescription& vd) {
int current = 0; int current = 0;
int tex_coord = 0; int tex_coord = 0;

View File

@ -55,7 +55,7 @@ class RendererOpenGL final : public Renderer {
void ActivateTexture(uint64_t resource_id) final; void ActivateTexture(uint64_t resource_id) final;
uint64_t CreateShader(std::unique_ptr<ShaderSource> source, uint64_t CreateShader(std::unique_ptr<ShaderSource> source,
const VertexDescripton& vertex_description, const VertexDescription& vertex_description,
Primitive primitive, Primitive primitive,
bool enable_depth_test) final; bool enable_depth_test) final;
void DestroyShader(uint64_t resource_id) final; void DestroyShader(uint64_t resource_id) final;
@ -196,12 +196,12 @@ class RendererOpenGL final : public Renderer {
void HandleCmdSetUniformInt(RenderCommand* cmd); void HandleCmdSetUniformInt(RenderCommand* cmd);
void BindTexture(GLuint id); void BindTexture(GLuint id);
bool SetupVertexLayout(const VertexDescripton& vd, bool SetupVertexLayout(const VertexDescription& vd,
GLuint vertex_size, GLuint vertex_size,
bool use_vao, bool use_vao,
std::vector<GeometryOpenGL::Element>& vertex_layout); std::vector<GeometryOpenGL::Element>& vertex_layout);
GLuint CreateShader(const char* source, GLenum type); GLuint CreateShader(const char* source, GLenum type);
bool BindAttributeLocation(GLuint id, const VertexDescripton& vd); bool BindAttributeLocation(GLuint id, const VertexDescription& vd);
GLint GetUniformLocation(GLuint id, GLint GetUniformLocation(GLuint id,
const std::string& name, const std::string& name,
std::unordered_map<std::string, GLuint>& uniforms); std::unordered_map<std::string, GLuint>& uniforms);

View File

@ -41,7 +41,7 @@ class Renderer {
virtual void ActivateTexture(uint64_t resource_id) = 0; virtual void ActivateTexture(uint64_t resource_id) = 0;
virtual uint64_t CreateShader(std::unique_ptr<ShaderSource> source, virtual uint64_t CreateShader(std::unique_ptr<ShaderSource> source,
const VertexDescripton& vertex_description, const VertexDescription& vertex_description,
Primitive primitive, Primitive primitive,
bool enable_depth_test) = 0; bool enable_depth_test) = 0;
virtual void DestroyShader(uint64_t resource_id) = 0; virtual void DestroyShader(uint64_t resource_id) = 0;

View File

@ -14,7 +14,7 @@ const char kLayoutDelimiter[] = ";/ \t";
namespace eng { namespace eng {
bool ParseVertexDescription(std::string vd_str, VertexDescripton& out) { bool ParseVertexDescription(std::string vd_str, VertexDescription& out) {
// Parse the description. // Parse the description.
char buffer[32]; char buffer[32];
strcpy(buffer, vd_str.c_str()); strcpy(buffer, vd_str.c_str());

View File

@ -38,10 +38,10 @@ enum DataType {
using ElementCount = size_t; using ElementCount = size_t;
using DataTypeSize = size_t; using DataTypeSize = size_t;
using VertexDescripton = using VertexDescription =
std::vector<std::tuple<AttribType, DataType, ElementCount, DataTypeSize>>; std::vector<std::tuple<AttribType, DataType, ElementCount, DataTypeSize>>;
bool ParseVertexDescription(std::string vd_str, VertexDescripton& out); bool ParseVertexDescription(std::string vd_str, VertexDescription& out);
} // namespace eng } // namespace eng

View File

@ -14,7 +14,7 @@ Shader::~Shader() {
} }
void Shader::Create(std::unique_ptr<ShaderSource> source, void Shader::Create(std::unique_ptr<ShaderSource> source,
const VertexDescripton& vd, const VertexDescription& vd,
Primitive primitive, Primitive primitive,
bool enable_depth_test) { bool enable_depth_test) {
Destroy(); Destroy();

View File

@ -19,7 +19,7 @@ class Shader : public RenderResource {
~Shader(); ~Shader();
void Create(std::unique_ptr<ShaderSource> source, void Create(std::unique_ptr<ShaderSource> source,
const VertexDescripton& vd, const VertexDescription& vd,
Primitive primitive, Primitive primitive,
bool enable_depth_test); bool enable_depth_test);

View File

@ -277,7 +277,7 @@ std::vector<uint8_t> CompileGlsl(EShLanguage stage,
} }
VertexInputDescription GetVertexInputDescription( VertexInputDescription GetVertexInputDescription(
const eng::VertexDescripton& vd) { const eng::VertexDescription& vd) {
unsigned vertex_offset = 0; unsigned vertex_offset = 0;
unsigned location = 0; unsigned location = 0;
@ -534,7 +534,7 @@ void RendererVulkan::ActivateTexture(uint64_t resource_id) {
uint64_t RendererVulkan::CreateShader( uint64_t RendererVulkan::CreateShader(
std::unique_ptr<ShaderSource> source, std::unique_ptr<ShaderSource> source,
const VertexDescripton& vertex_description, const VertexDescription& vertex_description,
Primitive primitive, Primitive primitive,
bool enable_depth_test) { bool enable_depth_test) {
auto it = spirv_cache_.find(source->name()); auto it = spirv_cache_.find(source->name());

View File

@ -38,7 +38,7 @@ class RendererVulkan final : public Renderer {
void ActivateTexture(uint64_t resource_id) final; void ActivateTexture(uint64_t resource_id) final;
uint64_t CreateShader(std::unique_ptr<ShaderSource> source, uint64_t CreateShader(std::unique_ptr<ShaderSource> source,
const VertexDescripton& vertex_description, const VertexDescription& vertex_description,
Primitive primitive, Primitive primitive,
bool enable_depth_test) final; bool enable_depth_test) final;
void DestroyShader(uint64_t resource_id) final; void DestroyShader(uint64_t resource_id) final;