Skip to content
This repository has been archived by the owner on Apr 17, 2022. It is now read-only.

Use shaders for pieblitfunc #4508

Closed
wzdev-ci opened this issue Sep 18, 2016 · 12 comments
Closed

Use shaders for pieblitfunc #4508

wzdev-ci opened this issue Sep 18, 2016 · 12 comments

Comments

@wzdev-ci
Copy link
Contributor

resolution_fixed type_patch (an actual patch, not a request for one) | by Vincent


This patch adds shaders for the drawImage operation in pieblitfunc.cpp.
These shaders are GL 3+ compliant so it's a step forward in the path to support
core OpenGL context.


Issue migrated from trac:4508 at 2022-04-16 12:37:02 -0700

@wzdev-ci
Copy link
Contributor Author

Vincent uploaded file 0001-Implement-rectangle-drawing-shader.patch (48.5 KiB)

@wzdev-ci
Copy link
Contributor Author

Vincent commented


Updated the patch.

Since following patches are requiring more uniform, I implemented a small Template mechanism in pie_ActivateShader.

Pie_ActiateShader() second, third...and up to the last are values to be passed as uniform depending on their glm type. The order in which they are passed is the order in which uniform names are declared in pie_LoadShader.
This allows to support more kinds of shaders since not every shader has a fogEnabled, normalMap... inputs.

Ideally uniforms should be passed as array to avoid overhead but the gl uniform buffer extension is part of GL 3.1/ glsl 140 only.

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Oct 2, 2016

Per changed blocking which not transferred by tractive

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Oct 2, 2016

Per changed blockedby which not transferred by tractive

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Oct 2, 2016

Per commented


In general, very nice. A few things, though.

Are you putting those conditional branches inside the rectangle shaders to save some bytes of memory and bandwidth, at the expense of more GPU work? If you are making some conscious trade off here, please add some comments in the code that this is what you are doing.

In pie_Skybox_Init(), you are calling dynamic code to reorder static data. That makes no sense to me. Just change the order of the static data instead?

In general, please document your assumptions and reasons better. The most interesting part of your patch, the new shader interface, is not even mentioned. Code that solves problems in a "magical" way with zero documentation is very difficult for other people to use.

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Oct 8, 2016

Vincent uploaded file 0001-Implement-rectangle-drawing-shader.2.patch (60.8 KiB)

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Oct 8, 2016

Vincent commented


I updated the path. I added several comments and merged some vertex shader code.
For Skybox_Init the code is expanding the GL_QUAD_STRIP primitives into GL_TRIANGLES one.
There is 10 different vertexes for GL_QUAD_STRIP while some vertexes are duplicated in GL_TRIANGLE ; I could manually expand the vertex but maybe it will look less readable.

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Oct 8, 2016

Vincent uploaded file 0001-Implement-rectangle-drawing-shader.3.patch (62.0 KiB)

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Oct 8, 2016

Vincent commented


Sorry Something went wrong with patch2, rect.vert content disappeared.

patch3 fixes it and also expand manually vertexes in skybox init code.

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Oct 8, 2016

Per commented


Thanks. Haven't had time to look at the new patch yet, but I think both I and cyp prefer to cherry-pick the code from your github branch, so it is probably not necessary to post patches (unless you want to). Just let us know in the tickets when you have new code that we should consider for merging. Also, I will try to loiter on IRC a bit more, so you can try to catch me there. Might help to speed things up :-)

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Dec 3, 2016

Per changed status from new to closed

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Dec 3, 2016

Per changed resolution from `` to fixed

@wzdev-ci wzdev-ci closed this as completed Dec 3, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant