* format: add internal formats for drm formats
cross referenced with weston and added internal formats and types for a
lot of missing ones. also added a isFormatYUV helper.
* framebuffer: ensure we use right internalformat
ensure we use the right internal format to avoid internal driver
blitting, also since we only attach the GL_STENCIL_ATTACHMENT we might
just aswell only use the GL_STENCIL_INDEX8 to not confuse drivers that
we want a depth aswell.
* texture: use external on yuv or non linear mods
using external makes us use the gpu's internal detiler.
and this is makes intel a lot happier then having to format convert it
to a linear format internally.
* shaders: add external support to CM frag
add external support to CM frag, and correct ext.frag typo.
* formats: remove duplicates and fix a typo in cm.frag
remove duplicate formats and a typo in cm.frag
* formats: add swizzle logic to all formats
add swizzle logic from weston for all formats and use it in shm texture
paths.
* format: more format changes
use monitor drm format instead of forcing something different.
* shader: remove external from cm.frag
drivers want this resolved at compiletime cant use both
samplerExternalOES and sampler2d and then runtime branch it.
* screencopy: swizzle textures in screencopy
swizzle textures in screencopy, to get the right colors when copying.
* screencopy: restore old behaviour
try restore old behaviour before the gles3 format changes.
glReadPixels had the wrong format, so i went to far trying to mitigate
it. should be like before now.
* framebuffer: dont release if format or size changes
we dont have to release and recreate both the texture and framebuffer if
size or format changes, we can just bind the texture and call glTexImage2D
with the new format and size.
* framebuffer: set the alloced viewport size
if monitor size mismatch with the allocated m_size its going to set a
mismatched viewport and cause rendering issues. and if they are
mismatching there is a missing alloc call.
* renderbuffer: cleanup unneded binds
the renderbuffer is attached to the fbo and trying to rebind it in
bind() is causing unnecessery state changes, just bind the fbo.
add safeguard in the destructor, the constructor can return early on
failure and leave m_rbo empty or m_image as EGL_NO_IMAGE_KHR.
* opengl: cache viewport state
according to nvidia docs calling glViewPort unnecessarily on the same
already set viewport is wasteful and can cause state changes when not
needed. cache it in a struct and only call it when the viewport is
actually changing.
* opengl: cache glenable/gldisable state
avoid making multiple glenable/gldisable calls on already set caps, can
cause state changes and incur driver overhead.
* opengl: cache glscissor box
only call glscissor if the box actually has changed, try to avoid state
changes.
* opengl: cache gluniform calls
cache the gluniform calls, the uniform values are cached in driver per
program only the drawcalls setting the uniform yet again with the same
value on same location is causing more overhead then caching it ourself
and just no oping on it if no changes.
* shader: rewrite handling of uniforms and state
this is way faster as we don't need to mess with maps (hashing, etc) and instead can just use an array
* opengl: stuff and 300 shaders
* opengl: typo
* opengl: get the uniform locations properly
now that the legacy shaders are gone get the uniformlocations for
SKIP_CM etc, so they can be properly set and used depending on if
cm_enabled is set to false or true, before it was falling back to a
legacy shader that didnt even have those uniforms.
* opengl: check epsilon on float and remove extra glcall
seems an extra unset glcall was added, remove it. and check the float
epsilon on the glfloat.
* opengl: remove instanced shader draw
remove the instanced boolean from the vertex shader, might be neglible
differences, needs more benchmark/work to see if its even worth it.
* texture: cache texture paramaters
parameters where occasionally set twice or more on same texture, short
version wrap it and cache it. and move gpu churn to cpu churn.
add a bind/unbind to texture aswell.
* texture: use fast std::array caching
cache the texparameter values in fast array lookups
and incase we dont want it cached, apply it anyways.
* shader: fix typo and hdr typo
actually use Matrix4x2fv in the 4x2fv cache function, and send the
proper float array for hdr.
* texture: make caching not linear lookup
make caching of texture params not linear.
* minor style changes
* opengl: revert drawarrays
revert the mostly code style reduce loc change of drawarrays, and focus
on the caching. its a if else case going wrong here breaking
blur/contrast amongst others drawing.
---------
Co-authored-by: Vaxry <vaxry@vaxry.net>
* core: drop the legacy renderer
the legacy renderer is broken and barely used, drop it.
* Nix: drop support for legacyRenderer
---------
Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
ensure framebuffer textures are detached and deleted, avoid leaving framebuffers bound when not needed
* render: avoid calling glDeleteProgram on no program
its safe to do so but it adds a bunch of unnecessery lines in apitrace
when tracing. if guard it and return early.
* opengl: ensure texture and buffers are unbound
ensure bound buffers are unbound after use, also detach textures from
framebuffer before deleting it otherwise it will become dangling and
essentially leak.
When an asset is missing, instead of a black screen, render an obnoxious, yet standard, missing texture.
Additionally, warn the user assets failed to load.
Shoutout to Arch for having their assets broken for months. Fix your shit. I am tired of it, and it's negatively impacting users.
* framebuffer: avoid gluint overflow
GLuint was being initialized to -1 and rolling over to unsigned int max,
its defined behaviour but very unnecessery. add a bool and use it for
checking if allocated or not.
* opengl: avoid gluint rollover
-1 rolls over to unsigned int max, use 0xFF instead.
* core: big uint64_t to int type conversion
there were a few uint64_t to int implicit conversions overflowing int
and causing UB, make all monitor/workspaces/windows use the new
typedefs. also fix the various related 64 to 32 implicit conversions
going around found with -Wshorten-64-to-32