diff options
| author | Pierre Bourdon <delroth@gmail.com> | 2016-06-24 10:43:46 +0200 |
|---|---|---|
| committer | Pierre Bourdon <delroth@gmail.com> | 2016-06-24 10:43:46 +0200 |
| commit | 3570c7f03a2aa90aa634f96c0af1969af610f14d (patch) | |
| tree | 4252e03c0e853ba7cffe022937698c854ad0eaa9 /Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp | |
| parent | 2115e8a4a6814e32107b5205ff5c95bbd3c6e99c (diff) | |
Reformat all the things. Have fun with merge conflicts.
Diffstat (limited to 'Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp b/Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp index 68b8e1b2d6..93a8c18d40 100644 --- a/Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp +++ b/Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp @@ -3,10 +3,10 @@ // Refer to the license.txt file included. #include "Common/Common.h" +#include "Common/GL/GLUtil.h" #include "Common/MemoryUtil.h" #include "Common/x64ABI.h" #include "Common/x64Emitter.h" -#include "Common/GL/GLUtil.h" #include "VideoBackends/OGL/ProgramShaderCache.h" #include "VideoBackends/OGL/VertexManager.h" @@ -20,73 +20,73 @@ namespace OGL { - -NativeVertexFormat* VertexManager::CreateNativeVertexFormat(const PortableVertexDeclaration& vtx_decl) +NativeVertexFormat* +VertexManager::CreateNativeVertexFormat(const PortableVertexDeclaration& vtx_decl) { - return new GLVertexFormat(vtx_decl); + return new GLVertexFormat(vtx_decl); } static inline GLuint VarToGL(VarType t) { - static const GLuint lookup[5] = { - GL_UNSIGNED_BYTE, GL_BYTE, GL_UNSIGNED_SHORT, GL_SHORT, GL_FLOAT - }; - return lookup[t]; + static const GLuint lookup[5] = {GL_UNSIGNED_BYTE, GL_BYTE, GL_UNSIGNED_SHORT, GL_SHORT, + GL_FLOAT}; + return lookup[t]; } -static void SetPointer(u32 attrib, u32 stride, const AttributeFormat &format) +static void SetPointer(u32 attrib, u32 stride, const AttributeFormat& format) { - if (!format.enable) - return; - - glEnableVertexAttribArray(attrib); - if (format.integer) - glVertexAttribIPointer(attrib, format.components, VarToGL(format.type), stride, (u8*)nullptr + format.offset); - else - glVertexAttribPointer(attrib, format.components, VarToGL(format.type), true, stride, (u8*)nullptr + format.offset); + if (!format.enable) + return; + + glEnableVertexAttribArray(attrib); + if (format.integer) + glVertexAttribIPointer(attrib, format.components, VarToGL(format.type), stride, + (u8*)nullptr + format.offset); + else + glVertexAttribPointer(attrib, format.components, VarToGL(format.type), true, stride, + (u8*)nullptr + format.offset); } GLVertexFormat::GLVertexFormat(const PortableVertexDeclaration& _vtx_decl) { - this->vtx_decl = _vtx_decl; - u32 vertex_stride = _vtx_decl.stride; + this->vtx_decl = _vtx_decl; + u32 vertex_stride = _vtx_decl.stride; - // We will not allow vertex components causing uneven strides. - if (vertex_stride & 3) - PanicAlert("Uneven vertex stride: %i", vertex_stride); + // We will not allow vertex components causing uneven strides. + if (vertex_stride & 3) + PanicAlert("Uneven vertex stride: %i", vertex_stride); - VertexManager* const vm = static_cast<VertexManager*>(g_vertex_manager.get()); + VertexManager* const vm = static_cast<VertexManager*>(g_vertex_manager.get()); - glGenVertexArrays(1, &VAO); - glBindVertexArray(VAO); + glGenVertexArrays(1, &VAO); + glBindVertexArray(VAO); - // the element buffer is bound directly to the vao, so we must it set for every vao - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vm->m_index_buffers); - glBindBuffer(GL_ARRAY_BUFFER, vm->m_vertex_buffers); + // the element buffer is bound directly to the vao, so we must it set for every vao + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vm->m_index_buffers); + glBindBuffer(GL_ARRAY_BUFFER, vm->m_vertex_buffers); - SetPointer(SHADER_POSITION_ATTRIB, vertex_stride, _vtx_decl.position); + SetPointer(SHADER_POSITION_ATTRIB, vertex_stride, _vtx_decl.position); - for (int i = 0; i < 3; i++) - SetPointer(SHADER_NORM0_ATTRIB+i, vertex_stride, _vtx_decl.normals[i]); + for (int i = 0; i < 3; i++) + SetPointer(SHADER_NORM0_ATTRIB + i, vertex_stride, _vtx_decl.normals[i]); - for (int i = 0; i < 2; i++) - SetPointer(SHADER_COLOR0_ATTRIB+i, vertex_stride, _vtx_decl.colors[i]); + for (int i = 0; i < 2; i++) + SetPointer(SHADER_COLOR0_ATTRIB + i, vertex_stride, _vtx_decl.colors[i]); - for (int i = 0; i < 8; i++) - SetPointer(SHADER_TEXTURE0_ATTRIB+i, vertex_stride, _vtx_decl.texcoords[i]); + for (int i = 0; i < 8; i++) + SetPointer(SHADER_TEXTURE0_ATTRIB + i, vertex_stride, _vtx_decl.texcoords[i]); - SetPointer(SHADER_POSMTX_ATTRIB, vertex_stride, _vtx_decl.posmtx); + SetPointer(SHADER_POSMTX_ATTRIB, vertex_stride, _vtx_decl.posmtx); - vm->m_last_vao = VAO; + vm->m_last_vao = VAO; } GLVertexFormat::~GLVertexFormat() { - glDeleteVertexArrays(1, &VAO); + glDeleteVertexArrays(1, &VAO); } void GLVertexFormat::SetupVertexPointers() { } - } |
