Renderer: Implement and fix front face (winding order) between Vulkan / OpenGL
This commit is contained in:
@@ -22,9 +22,7 @@ namespace Nz
|
||||
OpenGLRenderPipeline(OpenGLDevice& device, RenderPipelineInfo pipelineInfo);
|
||||
~OpenGLRenderPipeline() = default;
|
||||
|
||||
void Apply(const GL::Context& context) const;
|
||||
|
||||
void FlipY(bool shouldFlipY) const;
|
||||
void Apply(const GL::Context& context, bool flipViewport) const;
|
||||
|
||||
inline const RenderPipelineInfo& GetPipelineInfo() const override;
|
||||
|
||||
@@ -32,7 +30,7 @@ namespace Nz
|
||||
RenderPipelineInfo m_pipelineInfo;
|
||||
GL::Program m_program;
|
||||
GLint m_flipYUniformLocation;
|
||||
mutable bool m_isYFlipped;
|
||||
mutable bool m_isViewportFlipped;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,8 @@ namespace Nz
|
||||
|
||||
inline GLenum ToOpenGL(BlendEquation blendEquation);
|
||||
inline GLenum ToOpenGL(BlendFunc blendFunc);
|
||||
inline GLenum ToOpenGL(FaceSide filter);
|
||||
inline GLenum ToOpenGL(FaceSide side);
|
||||
inline GLenum ToOpenGL(FrontFace face);
|
||||
inline GLenum ToOpenGL(PrimitiveMode primitiveMode);
|
||||
inline GLenum ToOpenGL(SamplerFilter filter);
|
||||
inline GLenum ToOpenGL(SamplerFilter minFilter, SamplerMipmapMode mipmapFilter);
|
||||
|
||||
@@ -72,9 +72,9 @@ namespace Nz
|
||||
return {};
|
||||
}
|
||||
|
||||
inline GLenum ToOpenGL(FaceSide filter)
|
||||
inline GLenum ToOpenGL(FaceSide side)
|
||||
{
|
||||
switch (filter)
|
||||
switch (side)
|
||||
{
|
||||
case FaceSide::None:
|
||||
break;
|
||||
@@ -84,11 +84,23 @@ namespace Nz
|
||||
case FaceSide::FrontAndBack: return GL_FRONT_AND_BACK;
|
||||
}
|
||||
|
||||
NazaraError("Unhandled FaceSide 0x" + NumberToString(UnderlyingCast(filter), 16));
|
||||
NazaraError("Unhandled FaceSide 0x" + NumberToString(UnderlyingCast(side), 16));
|
||||
return {};
|
||||
}
|
||||
|
||||
GLenum ToOpenGL(PrimitiveMode primitiveMode)
|
||||
inline GLenum ToOpenGL(FrontFace face)
|
||||
{
|
||||
switch (face)
|
||||
{
|
||||
case FrontFace::Clockwise: return GL_CW;
|
||||
case FrontFace::CounterClockwise: return GL_CCW;
|
||||
}
|
||||
|
||||
NazaraError("Unhandled FrontFace 0x" + NumberToString(UnderlyingCast(face), 16));
|
||||
return {};
|
||||
}
|
||||
|
||||
inline GLenum ToOpenGL(PrimitiveMode primitiveMode)
|
||||
{
|
||||
switch (primitiveMode)
|
||||
{
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace Nz::GL
|
||||
|
||||
virtual void SwapBuffers() = 0;
|
||||
|
||||
void UpdateStates(const RenderStates& renderStates) const;
|
||||
void UpdateStates(const RenderStates& renderStates, bool isViewportFlipped) const;
|
||||
|
||||
#define NAZARA_OPENGLRENDERER_FUNC(name, sig) sig name = nullptr;
|
||||
NAZARA_OPENGLRENDERER_FOREACH_GLES_FUNC(NAZARA_OPENGLRENDERER_FUNC, NAZARA_OPENGLRENDERER_FUNC)
|
||||
|
||||
@@ -76,6 +76,7 @@ typedef void (GL_APIENTRYP PFNGLSPECIALIZESHADERARBPROC) (GLuint shader, const G
|
||||
cb(glFramebufferRenderbuffer, PFNGLFRAMEBUFFERRENDERBUFFERPROC) \
|
||||
cb(glFramebufferTexture2D, PFNGLFRAMEBUFFERTEXTURE2DPROC) \
|
||||
cb(glFramebufferTextureLayer, PFNGLFRAMEBUFFERTEXTURELAYERPROC) \
|
||||
cb(glFrontFace, PFNGLFRONTFACEPROC) \
|
||||
cb(glGenBuffers, PFNGLGENBUFFERSPROC) \
|
||||
cb(glGenFramebuffers, PFNGLGENFRAMEBUFFERSPROC) \
|
||||
cb(glGenQueries, PFNGLGENQUERIESPROC) \
|
||||
|
||||
Reference in New Issue
Block a user