-
-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Renderer refactor #436
Renderer refactor #436
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like you broke half the code with this
GLuint compileShader(const GLuint& type, std::string src) { | ||
auto shader = glCreateShader(type); | ||
[[nodiscard]] GLuint compileShader(GLenum type, const std::string& src) noexcept { | ||
GLuint shader = glCreateShader(type); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no
1, 0, // top right | ||
0, 0, // top left | ||
1, 1, // bottom right | ||
0, 1, // bottom left | ||
}; | ||
|
||
GLuint compileShader(const GLuint& type, std::string src) { | ||
auto shader = glCreateShader(type); | ||
[[nodiscard]] GLuint compileShader(GLenum type, const std::string& src) noexcept { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why nodiscard
@@ -187,27 +176,27 @@ CRenderer::SRenderFeedback CRenderer::renderLock(const CSessionLockSurface& surf | |||
if (WAITFORASSETS) { | |||
|
|||
// render status | |||
if (!**PDISABLEBAR) { | |||
if (!*PDISABLEBAR) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is straight-up wrong
glUseProgram(rectShader.program); | ||
|
||
glUniformMatrix3fv(rectShader.proj, 1, GL_TRUE, glMatrix); | ||
if (col.a >= 0.0f) { // Check if color is provided |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if the color is transparent
why not check if the shader uniform exists
|
||
// premultiply the color as well as we don't work with straight alpha | ||
glUniform4f(rectShader.color, col.r * col.a, col.g * col.a, col.b * col.a, col.a); | ||
if (rounding > 0) { // Check if rounding is provided |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same thing. Also no {}
} | ||
|
||
} | ||
)#"; | ||
}; | ||
|
||
inline const std::string QUADVERTSRC = R"#( | ||
#version 100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant
varying highp vec2 v_texcoord; // is in 0-1 | ||
varying vec4 FragColor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wot?
vec3 masks = vec3(equal(maxcVec, col)) * vec3(notEqual(maxcVec, vec3(green, blue, red))); | ||
vec3 adds = vec3(0.0, 2.0, 4.0) + vec3(green - blue, blue - red, red - green) / delta; | ||
vec3 masks = vec3(equal(maxcVec, col)) * vec3(notEqual(maxcVec, vec3(col.g, col.b, col.r))); | ||
vec3 adds = vec3(0.0, 2.0, 4.0) + vec3(col.g - col.b, col.b - col.r, col.r - col.g) / delta; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you are getting rid of these, get rid of the vars too
|
||
hue += dot(adds, masks); | ||
hue /= 6.0; | ||
hue += dot(adds, masks)/6.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong...
|
||
glUseProgram(blurFinishShader.program); | ||
CFramebuffer* targetFB = (currentRenderToFB == &mirrors[0]) ? &mirrors[1] : &mirrors[0]; | ||
drawPass(&blurFinishShader, targetFB); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?!
Refactor: Extracted logic to separate functions, flattened conditionals for better readability, etc.