Package com.jogamp.common.nio

Examples of com.jogamp.common.nio.CachedBufferFactory


        this.device = device;
        this.properties = properties;
        this.cl = context.getPlatform().getCommandQueueBinding();

        int pbsize = NativeSizeBuffer.elementSize();
        CachedBufferFactory factory = CachedBufferFactory.create(9*pbsize + 4, true);

        this.ibA = NativeSizeBuffer.wrap(factory.newDirectByteBuffer(3*pbsize));
        this.ibB = NativeSizeBuffer.wrap(factory.newDirectByteBuffer(3*pbsize));
        this.ibC = NativeSizeBuffer.wrap(factory.newDirectByteBuffer(3*pbsize));

        this.pbA = factory.newDirectIntBuffer(1);

    }
View Full Code Here


        }

        int pbSize = NativeSizeBuffer.elementSize();
        int deviceCount = binaries.size();
       
        CachedBufferFactory bf = CachedBufferFactory.create(binarySize + pbSize*deviceCount*3 + 4, true);
        NativeSizeBuffer devices  = NativeSizeBuffer.wrap(bf.newDirectByteBuffer(deviceCount*pbSize));
        PointerBuffer codeBuffers = PointerBuffer.wrap(bf.newDirectByteBuffer(deviceCount*pbSize));
        NativeSizeBuffer lengths  = NativeSizeBuffer.wrap(bf.newDirectByteBuffer(deviceCount*pbSize));
       
        int i = 0;
        for (Map.Entry<CLDevice, byte[]> entry : entries) {

            byte[] bytes = entry.getValue();
            CLDevice device = entry.getKey();

            devices.put(device.ID);
            lengths.put(bytes.length);

            codeBuffers.referenceBuffer(i, bf.newDirectByteBuffer(bytes));
            i++;
        }
        devices.rewind();
        lengths.rewind();

        IntBuffer errBuffer = bf.newDirectIntBuffer(1);
//        IntBuffer status = newDirectByteBuffer(binaries.size()*4).asIntBuffer();
        CLProgramBinding binding = context.getPlatform().getProgramBinding();
        long id = binding.clCreateProgramWithBinary(context.ID, devices.capacity(), devices, lengths, codeBuffers, /*status*/null, errBuffer);

//        while(status.remaining() != 0) {
View Full Code Here

    protected CLWork(CLKernel kernel, int dimension) {

        int size = dimension * NativeSizeBuffer.elementSize();

        CachedBufferFactory factory = CachedBufferFactory.create(3*size, true);
        this.workOffset = NativeSizeBuffer.wrap(factory.newDirectByteBuffer(size));
        this.workSize   = NativeSizeBuffer.wrap(factory.newDirectByteBuffer(size));
        this.groupSize  = NativeSizeBuffer.wrap(factory.newDirectByteBuffer(size));

        this.dimension  = dimension;
        this.kernel     = kernel;
    }
View Full Code Here

TOP

Related Classes of com.jogamp.common.nio.CachedBufferFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.