[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    Re: [OpenJDK 2D-Dev] <AWT Dev> Fwd: creating images using native code
From:       Alan Snyder <javalists () cbfiddle ! com>
Date:       2015-08-20 16:48:37
Message-ID: 7AFEC7C7-C0A1-4C6D-99F2-E441C6A9BEEB () cbfiddle ! com
[Download RAW message or body]

I have filed an RFE <https://bugs.openjdk.java.net/browse/JDK-8133998>.

  Alan



> On Aug 18, 2015, at 9:58 AM, Sergey Bylokhov <Sergey.Bylokhov@oracle.com> wrote:
> 
> This is 2d related question (cc 2d-dev).
> > From: Alan Snyder < <mailto:javalists@cbfiddle.com>javalists@cbfiddle.com \
> >                 <mailto:javalists@cbfiddle.com>>
> > Subject: <AWT Dev> creating images using native code
> > Date: August 11, 2015 at 5:36:55 PM PDT
> > To: awt-dev@openjdk.java.net <mailto:awt-dev@openjdk.java.net>
> > 
> > I am currently creating images with data provided by native code by capturing the \
> > data in an int array then using that array to construct a DataBufferInt which is \
> > used to create a WritableRaster which is used to create a BufferedImage. 
> > That seems to work fine, except that looking at the code it appears that the \
> > buffer is considered untrackable, which sounds like a bad thing. Does that in \
> > fact prevent caching the image in a GPU, for example?
> Yes you are right, because in this case we cannot be sure when the data inside the \
> raster is changed, this can occur for example when we copy this data from/to gpu. 
> > 
> > If so, is there a good way to create a cacheable image?
> The public way is to draw the image once again to another one which will be cached \
> instead. 
> > 
> > The solutions I have found so far all wind up processing the pixels one at a time \
> > at some point, as far as I can tell, which should not be necessary. 
> > I'm wondering why there is no way to simply declare that the buffer will not \
> > change in the future. 
> > Alan
> > 
> 
> 
> 
> -- 
> Best regards, Sergey. 


[Attachment #3 (unknown)]

<html><head><meta http-equiv="Content-Type" content="text/html \
charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; \
-webkit-line-break: after-white-space;" class=""><div class="">I have filed \
an&nbsp;<a href="https://bugs.openjdk.java.net/browse/JDK-8133998" \
class="">RFE</a>.</div><div class=""><br class=""></div>&nbsp; Alan<div class=""><br \
class=""></div><div class=""><br class=""></div><div class=""><br \
class=""><div><blockquote type="cite" class=""><div class="">On Aug 18, 2015, at 9:58 \
AM, Sergey Bylokhov &lt;<a href="mailto:Sergey.Bylokhov@oracle.com" \
class="">Sergey.Bylokhov@oracle.com</a>&gt; wrote:</div><br \
class="Apple-interchange-newline"><div class="">  
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" class="">
  
  <div bgcolor="#FFFFFF" text="#000000" class="">
    <div class="">This is 2d related question (cc 2d-dev).<br \
class="Apple-interchange-newline">  <div class="">
        <blockquote type="cite" class="">
          <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
            0px; margin-left: 0px;" class=""><span style="font-family: \
-webkit-system-font, 'Helvetica Neue', Helvetica, sans-serif;" class=""><b \
                class="">From: </b></span><span style="font-family:
              -webkit-system-font, Helvetica Neue, Helvetica,
              sans-serif;" class="">Alan Snyder &lt;<a moz-do-not-send="true" \
href="mailto:javalists@cbfiddle.com" class=""></a><a class="moz-txt-link-abbreviated" \
href="mailto:javalists@cbfiddle.com">javalists@cbfiddle.com</a>&gt;<br class="">  \
</span></div>  <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
            0px; margin-left: 0px;" class=""><span style="font-family: \
-webkit-system-font, 'Helvetica Neue', Helvetica, sans-serif;" class=""><b \
                class="">Subject: </b></span><span style="font-family:
              -webkit-system-font, Helvetica Neue, Helvetica,
              sans-serif;" class=""><b class="">&lt;AWT Dev&gt; creating
                images using native code</b><br class="">
            </span></div>
          <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
            0px; margin-left: 0px;" class=""><span style="font-family: \
-webkit-system-font, 'Helvetica Neue', Helvetica, sans-serif;" class=""><b \
                class="">Date: </b></span><span style="font-family:
              -webkit-system-font, Helvetica Neue, Helvetica,
              sans-serif;" class="">August 11, 2015 at 5:36:55 PM PDT<br class="">
            </span></div>
          <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
            0px; margin-left: 0px;" class=""><span style="font-family: \
-webkit-system-font, 'Helvetica Neue', Helvetica, sans-serif;" class=""><b \
                class="">To: </b></span><span style="font-family:
              -webkit-system-font, Helvetica Neue, Helvetica,
              sans-serif;" class=""><a moz-do-not-send="true" \
href="mailto:awt-dev@openjdk.java.net" class="">awt-dev@openjdk.java.net</a><br \
class="">  </span></div>
          <br class="">
          <div class="">I am currently creating images with data
            provided by native code by capturing the data in an int
            array then using that array to construct a DataBufferInt
            which is used to create a WritableRaster which is used to
            create a BufferedImage.<br class="">
            <br class="">
            That seems to work fine, except that looking at the code it
            appears that the buffer is considered untrackable, which
            sounds like a bad thing. Does that in fact prevent caching
            the image in a GPU, for example?<br class="">
          </div>
        </blockquote>
        Yes you are right, because in this case we cannot be sure when
        the data inside the raster is changed, this can occur for
        example when we copy this data from/to gpu.<br class="">
        <br class="">
        <blockquote type="cite" class="">
          <div class=""><br class="">
            If so, is there a good way to create a cacheable image?<br class="">
          </div>
        </blockquote>
        The public way is to draw the image once again to another one
        which will be cached instead.<br class="">
        <br class="">
        <blockquote type="cite" class="">
          <div class=""><br class="">
            The solutions I have found so far all wind up processing the
            pixels one at a time at some point, as far as I can tell,
            which should not be necessary.<br class="">
            <br class="">
            I'm wondering why there is no way to simply declare that the
            buffer will not change in the future.<br class="">
            <br class="">
            &nbsp;Alan<br class="">
            <br class="">
          </div>
        </blockquote>
      </div>
      <br class="">
    </div>
    <blockquote cite="mid:121DE4C1-E74B-426D-9344-9ACEBA420830@cbfiddle.com" \
type="cite" class="">  </blockquote>
    <br class="">
    <br class="">
    <pre class="moz-signature" cols="72">-- 
Best regards, Sergey. </pre>
  </div>

</div></blockquote></div><br class=""></div></body></html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic