From mboxrd@z Thu Jan 1 00:00:00 1970 From: bugzilla-daemon@freedesktop.org Subject: [Bug 110229] Textures binded to framebuffer objects or images are not correctly updated. Date: Mon, 01 Apr 2019 11:12:13 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0690428265==" Return-path: Received: from culpepper.freedesktop.org (culpepper.freedesktop.org [131.252.210.165]) by gabe.freedesktop.org (Postfix) with ESMTP id 24A986E69C for ; Mon, 1 Apr 2019 11:12:13 +0000 (UTC) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============0690428265== Content-Type: multipart/alternative; boundary="15541171330.aA9C293ca.31923" Content-Transfer-Encoding: 7bit --15541171330.aA9C293ca.31923 Date: Mon, 1 Apr 2019 11:12:13 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.freedesktop.org/ Auto-Submitted: auto-generated https://bugs.freedesktop.org/show_bug.cgi?id=3D110229 --- Comment #20 from Laurent --- (In reply to Daniel Stone from comment #19) > (In reply to Laurent from comment #18) > > Yeah so there are one thread per fragment and not per instruction. With= the CPU you need mutex to avoid concurrent access, and I think two CPU thr= ead cannot write/read to/from the memory at the same time, the GPU can beca= use he use one micro controller per thread (if I'm not wrong) so you don't = need to protect from concurrent access but you need to use an OIT mechanism= in the driver (I think) because you don't know which thread'll write to th= e memory first... >=20 > Yes, you're right that the GPU executes code for multiple fragments > concurrently. The shader code has to know this and implement its own > concurrency protection. This is one of the (many) reasons why pretty much > no-one else uses a linked-list implementation in a fragment shader. >=20 > You also have the issue of wasted work: by the time a fragment shader > executes, you might as well just render the fragment, since so much work = has > already been done to arrive at the per-fragment execution stage. >=20 > OpenGL and Vulkan already provide you many tools you can use to control h= ow > you render, such as compute shaders with indirect dispatch, or even just > using stencil/depth tests (which you can also implement with a compute > shader). Using compute shaders might also help you with your concurrency > problems. I would recommend looking into these common approaches first. >=20 > > I saw you wrote a GLSL compiler to translate GLSL source code to binary= code > > but I think it's a waste of time because GLSL source code is very simi= lar > > to C source code so I think I'll use gcc compiler to compile GLSL source > > code before sending it to the VRAM and executing it. (The only thing I'= ll > > have to do is translate GLSL code to C source code. > >=20 > > I'll saving me a lot of time and in this way I think I'll be able to de= bug > > it more quickly. >=20 > When you run gcc, it produces code targeted for your CPU (x86-64 or Arm). > gcc cannot produce code which will be executed by a GPU. It also cannot > parse GLSL: even though GLSL visually looks a bit like C, it obviously > executes very differently. >=20 > I think you will very quickly discover that the amount of code in Mesa is > not a 'waste of time', and is in fact all required to be able to run thin= gs > on a GPU. >=20 > I'm going to close this report as 'NOTOURBUG', since it seems like the > problems you have in your code are caused by incorrectly using OpenGL, and > could be better handled through an OpenGL user support forum, or by > following tutorials (e.g. on depth/stencil or compute shaders). Ok if you think that's not your bug, do as you wish, but why are you writing the driver source code in C if gcc cannot produce code which'll be executed= on a GPU ? --=20 You are receiving this mail because: You are the assignee for the bug.= --15541171330.aA9C293ca.31923 Date: Mon, 1 Apr 2019 11:12:13 +0000 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.freedesktop.org/ Auto-Submitted: auto-generated

Comme= nt # 20 on bug 11022= 9 from Laurent
(In reply to Daniel Stone from comment #19)
> (In reply to Laurent from comment #18)
> > Yeah so there are one thread per fragment and not per instruction=
. With the CPU you need mutex to avoid concurrent access, and I think two C=
PU thread cannot write/read to/from the memory at the same time, the GPU ca=
n because he use one micro controller per thread (if I'm not wrong) so you =
don't need to protect from concurrent access but you need to use an OIT mec=
hanism in the driver (I think) because you don't know which thread'll write=
 to the memory first...
>=20
> Yes, you're right that the GPU executes code for multiple fragments
> concurrently. The shader code has to know this and implement its own
> concurrency protection. This is one of the (many) reasons why pretty m=
uch
> no-one else uses a linked-list implementation in a fragment shader.
>=20
> You also have the issue of wasted work: by the time a fragment shader
> executes, you might as well just render the fragment, since so much wo=
rk has
> already been done to arrive at the per-fragment execution stage.
>=20
> OpenGL and Vulkan already provide you many tools you can use to contro=
l how
> you render, such as compute shaders with indirect dispatch, or even ju=
st
> using stencil/depth tests (which you can also implement with a compute
> shader). Using compute shaders might also help you with your concurren=
cy
> problems. I would recommend looking into these common approaches first.
>=20
> > I saw you wrote a GLSL compiler to translate GLSL source code to =
binary code
> > but I  think it's a waste of time because GLSL source code is ver=
y similar
> > to C source code so I think I'll use gcc compiler to compile GLSL=
 source
> > code before sending it to the VRAM and executing it. (The only th=
ing I'll
> > have to do is translate GLSL code to C source code.
> >=20
> > I'll saving me a lot of time and in this way I think I'll be able=
 to debug
> > it more quickly.
>=20
> When you run gcc, it produces code targeted for your CPU (x86-64 or Ar=
m).
> gcc cannot produce code which will be executed by a GPU. It also cannot
> parse GLSL: even though GLSL visually looks a bit like C, it obviously
> executes very differently.
>=20
> I think you will very quickly discover that the amount of code in Mesa=
 is
> not a 'waste of time', and is in fact all required to be able to run t=
hings
> on a GPU.
>=20
> I'm going to close this report as 'NOTOURBUG', since it seems like the
> problems you have in your code are caused by incorrectly using OpenGL,=
 and
> could be better handled through an OpenGL user support forum, or by
> following tutorials (e.g. on depth/stencil or compute shaders).

Ok if you think that's not your bug, do as you wish, but why are you writing
the driver source code in C if gcc cannot produce code which'll be executed=
 on
a GPU ?


You are receiving this mail because:
  • You are the assignee for the bug.
= --15541171330.aA9C293ca.31923-- --===============0690428265== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVs --===============0690428265==--