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 09:11:51 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0468294989==" Return-path: Received: from culpepper.freedesktop.org (culpepper.freedesktop.org [IPv6:2610:10:20:722:a800:ff:fe98:4b55]) by gabe.freedesktop.org (Postfix) with ESMTP id BE1156E661 for ; Mon, 1 Apr 2019 09:11:51 +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 --===============0468294989== Content-Type: multipart/alternative; boundary="15541099112.FFF7963B9.1784" Content-Transfer-Encoding: 7bit --15541099112.FFF7963B9.1784 Date: Mon, 1 Apr 2019 09:11:51 +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 Daniel Stone changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |NOTOURBUG Status|NEW |RESOLVED --- Comment #19 from Daniel Stone --- (In reply to Laurent from comment #18) > Yeah so there are one thread per fragment and not per instruction. With t= he CPU you need mutex to avoid concurrent access, and I think two CPU threa= d cannot write/read to/from the memory at the same time, the GPU can becaus= e he use one micro controller per thread (if I'm not wrong) so you don't ne= ed to protect from concurrent access but you need to use an OIT mechanism i= n the driver (I think) because you don't know which thread'll write to the = memory first... 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. You also have the issue of wasted work: by the time a fragment shader execu= tes, you might as well just render the fragment, since so much work has already = been done to arrive at the per-fragment execution stage. OpenGL and Vulkan already provide you many tools you can use to control how= 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). U= sing compute shaders might also help you with your concurrency problems. I would recommend looking into these common approaches first. > I saw you wrote a GLSL compiler to translate GLSL source code to binary c= ode > but I think it's a waste of time because GLSL source code is very 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 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 debug > it more quickly. When you run gcc, it produces code targeted for your CPU (x86-64 or Arm). g= cc cannot produce code which will be executed by a GPU. It also cannot parse G= LSL: even though GLSL visually looks a bit like C, it obviously executes very differently. I think you will very quickly discover that the amount of code in Mesa is n= ot a 'waste of time', and is in fact all required to be able to run things on a = GPU. I'm going to close this report as 'NOTOURBUG', since it seems like the prob= lems 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 tutori= als (e.g. on depth/stencil or compute shaders). --=20 You are receiving this mail because: You are the assignee for the bug.= --15541099112.FFF7963B9.1784 Date: Mon, 1 Apr 2019 09:11:51 +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 <= span class=3D"fn">Daniel Stone changed bug 11022= 9
What Removed Added
Resolution --- NOTOURBUG
Status NEW RESOLVED

Comme= nt # 19 on bug 11022= 9 from Daniel Stone
(In reply to Laurent from comment #18)
> Yeah so there are one thread per fragment and no=
t per instruction. With the CPU you need mutex to avoid concurrent access, =
and I think two CPU thread cannot write/read to/from the memory at the same=
 time, the GPU can because he use one micro controller per thread (if I'm n=
ot 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 whic=
h thread'll write to the memory first...

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.

You also have the issue of wasted work: by the time a fragment shader execu=
tes,
you might as well just render the fragment, since so much work has already =
been
done to arrive at the per-fragment execution stage.

OpenGL and Vulkan already provide you many tools you can use to control how=
 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). U=
sing
compute shaders might also help you with your concurrency problems. I would
recommend looking into these common approaches first.

> I saw you wrote a GLSL compiler to translate GLS=
L source code to binary code
> but I  think it's a waste of time because GLSL source code is very sim=
ilar
> to C source code so I think I'll use gcc compiler to compile GLSL sour=
ce
> 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 d=
ebug
> it more quickly.

When you run gcc, it produces code targeted for your CPU (x86-64 or Arm). g=
cc
cannot produce code which will be executed by a GPU. It also cannot parse G=
LSL:
even though GLSL visually looks a bit like C, it obviously executes very
differently.

I think you will very quickly discover that the amount of code in Mesa is n=
ot a
'waste of time', and is in fact all required to be able to run things on a =
GPU.

I'm going to close this report as 'NOTOURBUG', since it seems like the prob=
lems
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 tutori=
als
(e.g. on depth/stencil or compute shaders).


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