Skip to content
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

Closed
wants to merge 8 commits into from
Closed

Conversation

JassonCordones
Copy link
Contributor

Refactor: Extracted logic to separate functions, flattened conditionals for better readability, etc.

Copy link
Member

@vaxerski vaxerski left a 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);
Copy link
Member

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 {
Copy link
Member

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) {
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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;
Copy link
Member

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;
Copy link
Member

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;
Copy link
Member

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?!

@JassonCordones JassonCordones marked this pull request as draft July 23, 2024 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants