Package com.jogamp.common.nio

Examples of com.jogamp.common.nio.NativeSizeBuffer


    public CLCommandQueue putCopyBufferRect(CLBuffer<?> src, CLBuffer<?> dest,
            int srcOriginX, int srcOriginY, int srcOriginZ, int destOriginX, int destOriginY, int destOriginZ, int rangeX, int rangeY, int rangeZ,
            long srcRowPitch, long srcSlicePitch, long destRowPitch, long destSlicePitch,
            CLEventList condition, CLEventList events) {

        NativeSizeBuffer conditionIDs = null;
        int conditions = 0;
        if(condition != null) {
            conditionIDs = condition.IDsView;
            conditions   = condition.size;
        }
View Full Code Here


     * Calls {@native clEnqueueWriteImage}.
     */
    public CLCommandQueue putWriteImage(CLImage2d<?> writeImage, int inputRowPitch,
            int originX, int originY, int rangeX, int rangeY, boolean blockingWrite, CLEventList condition, CLEventList events) {

        NativeSizeBuffer conditionIDs = null;
        int conditions = 0;
        if(condition != null) {
            conditionIDs = condition.IDsView;
            conditions   = condition.size;
        }
View Full Code Here

     * Calls {@native clEnqueueWriteImage}.
     */
    public CLCommandQueue putWriteImage(CLImage3d<?> writeImage, int inputRowPitch, int inputSlicePitch,
            int originX, int originY, int originZ, int rangeX, int rangeY, int rangeZ, boolean blockingWrite, CLEventList condition, CLEventList events) {

        NativeSizeBuffer conditionIDs = null;
        int conditions = 0;
        if(condition != null) {
            conditionIDs = condition.IDsView;
            conditions   = condition.size;
        }
View Full Code Here

   
    static CLProgram create(CLContext context, String src) {

        IntBuffer status = newDirectIntBuffer(1);
       
        NativeSizeBuffer length = NativeSizeBuffer.allocateDirect(1).put(0, src.length());
        String[] srcArray = new String[] {src};
       
        // Create the program
        CLProgramBinding binding = context.getPlatform().getProgramBinding();
        long id = binding.clCreateProgramWithSource(context.ID, 1, srcArray, length, status);
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);
View Full Code Here

        if(released) {
            return "";
        }

        NativeSizeBuffer size = NativeSizeBuffer.allocateDirect(1);

        int ret = binding.clGetProgramBuildInfo(ID, device.ID, flag, 0, null, size);
        if(ret != CL_SUCCESS) {
            throw newException(ret, "on clGetProgramBuildInfo with "+device);
        }

        ByteBuffer buffer = newDirectByteBuffer((int)size.get(0));

        ret = binding.clGetProgramBuildInfo(ID, device.ID, flag, buffer.capacity(), buffer, null);
        if(ret != CL_SUCCESS) {
            throw newException(ret, "on clGetProgramBuildInfo with "+device);
        }

        return CLUtil.clString2JavaString(buffer, (int)size.get(0));
    }
View Full Code Here

        if(released) {
            return "";
        }

        NativeSizeBuffer size = NativeSizeBuffer.allocateDirect(1);

        int ret = binding.clGetProgramInfo(ID, flag, 0, null, size);
        checkForError(ret, "on clGetProgramInfo");

        ByteBuffer buffer = newDirectByteBuffer((int)size.get(0));

        ret = binding.clGetProgramInfo(ID, flag, buffer.capacity(), buffer, null);
        checkForError(ret, "on clGetProgramInfo");

        return CLUtil.clString2JavaString(buffer, (int)size.get(0));
    }
View Full Code Here

            //No changes to the program executable are allowed while there are
            //kernel objects associated with a program object.
            releaseKernels();
        }

        NativeSizeBuffer deviceIDs = null;
        int count = 0;
        if(devices != null && devices.length != 0) {
            deviceIDs = NativeSizeBuffer.allocateDirect(devices.length);
            for (int i = 0; i < devices.length; i++) {
                deviceIDs.put(i, devices[i].ID);
            }
            deviceIDs.rewind();
            count = devices.length;
        }

        // nvidia driver doesn't like empty strings
        if(options != null && options.trim().isEmpty()) {
View Full Code Here

            throw newException(ret, "can not create kernels for "+this);
        }

        if(numKernels.get(0) > 0) {

            NativeSizeBuffer kernelIDs = NativeSizeBuffer.allocateDirect(numKernels.get(0));
            ret = kernelBinding.clCreateKernelsInProgram(ID, kernelIDs.capacity(), kernelIDs, null);
            if(ret != CL_SUCCESS) {
                throw newException(ret, "can not create "+kernelIDs.capacity()+" kernels for "+this);
            }

            for (int i = 0; i < kernelIDs.capacity(); i++) {
                CLKernel kernel = new CLKernel(this, kernelIDs.get(i));
                kernels.add(kernel);
                newKernels.put(kernel.name, kernel);
            }
        }else{
            initBuildStatus();
View Full Code Here

    public CLDevice[] getCLDevices() {
        if(released) {
            return new CLDevice[0];
        }

        NativeSizeBuffer size = NativeSizeBuffer.allocateDirect(1);
        int ret = binding.clGetProgramInfo(ID, CL_PROGRAM_DEVICES, 0, null, size);
        if(ret != CL_SUCCESS) {
            throw newException(ret, "on clGetProgramInfo of "+this);
        }

        ByteBuffer bb = newDirectByteBuffer((int) size.get(0));
        ret = binding.clGetProgramInfo(ID, CL_PROGRAM_DEVICES, bb.capacity(), bb, null);
        if(ret != CL_SUCCESS) {
            throw newException(ret, "on clGetProgramInfo of "+this);
        }
View Full Code Here

TOP

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

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.