Skip to content

Commit

Permalink
#2467 'texture_pixel_format' is no longer needed
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Nov 5, 2023
1 parent 7eab59e commit ff4e5e3
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions xpra/client/gl/backing.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ class GLWindowBackingBase(WindowBackingBase):

def __init__(self, wid: int, window_alpha: bool, pixel_depth: int = 0):
self.wid: int = wid
self.texture_pixel_format : IntConstant | None = None
# this is the pixel format we are currently updating the fbo with
# can be: "YUV420P", "YUV422P", "YUV444P", "GBRP" or None when not initialized yet.
self.pixel_format : str = ""
Expand Down Expand Up @@ -244,13 +243,11 @@ def opengl_init(self):

def get_info(self) -> dict[str,Any]:
info = super().get_info()
tpf = self.texture_pixel_format
tif = self.internal_format
info |= {
"type" : "OpenGL",
"bit-depth" : self.bit_depth,
"pixel-format" : self.pixel_format,
"texture-pixel-format" : CONSTANT_TO_PIXEL_FORMAT.get(tpf) or str(tpf),
"internal-format" : INTERNAL_FORMAT_TO_STR.get(tif) or str(tif),
}
return info
Expand Down Expand Up @@ -301,18 +298,12 @@ def init_formats(self) -> None:
else:
if self.bit_depth not in (0, 24, 32) and first_time(f"bit-depth-{self.bit_depth}"):
log.warn(f"Warning: invalid bit depth {self.bit_depth}, using 24")
# assume 24:
# (pixels are always stored in 32bpp - but this makes it clearer when we do/don't support alpha)
if self._alpha_enabled:
self.internal_format = GL_RGBA8
else:
self.internal_format = GL_RGB8
# (pixels are always stored in 32bpp - but this makes it clearer when we do/don't support alpha)
if self._alpha_enabled:
self.texture_pixel_format = GL_RGBA
else:
self.texture_pixel_format = GL_RGB
log("init_formats() texture pixel format=%s, internal format=%s, rgb modes=%s",
CONSTANT_TO_PIXEL_FORMAT.get(self.texture_pixel_format),
log("init_formats() internal format=%s, rgb modes=%s",
INTERNAL_FORMAT_TO_STR.get(self.internal_format),
self.RGB_MODES)

Expand Down Expand Up @@ -512,7 +503,7 @@ def init_fbo(self, texture_index: int, fbo, w: int, h: int, mag_filter) -> None:
# nvidia needs this even though we don't use mipmaps (repeated through this file):
glTexParameteri(target, GL_TEXTURE_MAG_FILTER, mag_filter)
glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
glTexImage2D(target, 0, self.internal_format, w, h, 0, self.texture_pixel_format, GL_UNSIGNED_BYTE, None)
glTexImage2D(target, 0, self.internal_format, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, None)
glBindFramebuffer(GL_FRAMEBUFFER, fbo)
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target, self.textures[texture_index], 0)

Expand Down

0 comments on commit ff4e5e3

Please sign in to comment.