From patchwork Fri Feb 19 09:48:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 12094877 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70C1DC433DB for ; Fri, 19 Feb 2021 09:52:35 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D73E764DE8 for ; Fri, 19 Feb 2021 09:52:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D73E764DE8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:44078 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lD2Sf-0008FS-Nr for qemu-devel@archiver.kernel.org; Fri, 19 Feb 2021 04:52:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49470) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lD2OX-00050z-OX for qemu-devel@nongnu.org; Fri, 19 Feb 2021 04:48:17 -0500 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]:40541) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lD2OT-0000Sc-Ih for qemu-devel@nongnu.org; Fri, 19 Feb 2021 04:48:17 -0500 Received: by mail-pg1-x52b.google.com with SMTP id b21so3574861pgk.7 for ; Fri, 19 Feb 2021 01:48:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=BY28+sBVrktSq3FteMeyx7X46koEVdXXMEnXKMvUqas=; b=O1Bt7TYxGl69TZIbaK1pFS3tZkZCeNf1QCAu5lAebudPBvBcFidw7NJpvUWfm+0jYJ j25iQ64ynt/8FyBnFBy3mIDorqjaeu7ZrcvX61Btm2NhDpYN3qK33l5fWYQFrsbIQj76 wd45SQIhYkmQqhs7pHcyC8DXgcYGnovkCbsv7O6Y42sM1APHUtwjadR9Aay8NmLLfzZr d1DJit00TCaU8G0OzprOpZ6fzDYXfUWso7F/C70QAaE/x4QjdwaIuQ7M6zqhsQSdU9r1 2RfPCZ1rtlIXzLQgTFbMPb4U+zBv2FkJSE8xUoF5UvOi4VITdZGiwZhNufYoH/V0k76p Oytg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=BY28+sBVrktSq3FteMeyx7X46koEVdXXMEnXKMvUqas=; b=C8KoSEgVznhspQny2BQB3KF079WU2LyVp6OMjBY6dVsf1YljY4cO7M1dWYvuY8fUr1 m0q2vwSbxcELs8Ws0UdH2mHeSlAbZfeouCVeDhs5oXqFKNQmudiz9VvV+8/A9HEWxzS/ eouGZXSTeEuDPjdbzvsZIyhmTuUKUgsVAk0KEngT2MAVME/4EGIr+fLB8hkfy/deaEkz FrlGFGx9CK6+k8CAvtau4Qq9RMKaWoX47PLPRpvj9LfhFibVp30I2sWoFoKNUxMh5nCm TkrNk/DUH/18i92eKEis30G7hthPiSQDaiin5e7YIr1yyQf650CDFPs/z94tJ9pyx5qT n+0Q== X-Gm-Message-State: AOAM532FtzmuM47/2kyig97P2RJBJcxUwVdvZ6asxQ2YRVnWMLXhM7xl Bj1m4ArtnklequSnfEXg85AtSwDgRm6FeQ== X-Google-Smtp-Source: ABdhPJwuKzD9P1LEmHoVBrG7tw0TlZontaWgT81b4X+QC6ppVl/9U21nxyu+P9VBiEw3AreA/Nogcg== X-Received: by 2002:a05:6a00:9d:b029:1df:c229:1b95 with SMTP id c29-20020a056a00009db02901dfc2291b95mr8722780pfj.80.1613728091159; Fri, 19 Feb 2021 01:48:11 -0800 (PST) Received: from localhost.localdomain ([2400:4050:c360:8200:d8f0:71c1:3d6a:4f53]) by smtp.gmail.com with ESMTPSA id t17sm9616503pgk.25.2021.02.19.01.48.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Feb 2021 01:48:10 -0800 (PST) From: Akihiko Odaki To: Subject: [PATCH] opengl: Do not convert format with glTexImage2D on OpenGL ES Date: Fri, 19 Feb 2021 18:48:03 +0900 Message-Id: <20210219094803.90860-1-akihiko.odaki@gmail.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=akihiko.odaki@gmail.com; helo=mail-pg1-x52b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Akihiko Odaki , Gerd Hoffmann Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" OpenGL ES does not support conversion from the given data format to the internal format with glTexImage2D. Use the given data format as the internal format, and ignore the given alpha channels with GL_TEXTURE_SWIZZLE_A in case the format contains alpha channels. Signed-off-by: Akihiko Odaki --- ui/console-gl.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/ui/console-gl.c b/ui/console-gl.c index 0a6478161fe..7c9894a51d9 100644 --- a/ui/console-gl.c +++ b/ui/console-gl.c @@ -73,11 +73,20 @@ void surface_gl_create_texture(QemuGLShader *gls, glBindTexture(GL_TEXTURE_2D, surface->texture); glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, surface_stride(surface) / surface_bytes_per_pixel(surface)); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, - surface_width(surface), - surface_height(surface), - 0, surface->glformat, surface->gltype, - surface_data(surface)); + if (epoxy_is_desktop_gl()) { + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, + surface_width(surface), + surface_height(surface), + 0, surface->glformat, surface->gltype, + surface_data(surface)); + } else { + glTexImage2D(GL_TEXTURE_2D, 0, surface->glformat, + surface_width(surface), + surface_height(surface), + 0, surface->glformat, surface->gltype, + surface_data(surface)); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, GL_ONE); + } glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);