rsdAllocation.h revision eb4fe18dd88634330f9566cbb9e785d8c7ec5813
1/* 2 * Copyright (C) 2011 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17#ifndef RSD_ALLOCATION_H 18#define RSD_ALLOCATION_H 19 20#include <rs_hal.h> 21#include <rsRuntime.h> 22 23#include <GLES/gl.h> 24#include <GLES2/gl2.h> 25 26struct DrvAllocation { 27 // Is this a legal structure to be used as a texture source. 28 // Initially this will require 1D or 2D and color data 29 uint32_t textureID; 30 31 // Is this a legal structure to be used as a vertex source. 32 // Initially this will require 1D and x(yzw). Additional per element data 33 // is allowed. 34 uint32_t bufferID; 35 36 // Is this a legal structure to be used as an FBO render target 37 uint32_t renderTargetID; 38 39 uint8_t * mallocPtr; 40 41 GLenum glTarget; 42 43 bool uploadDeferred; 44}; 45 46bool rsdAllocationInit(const android::renderscript::Context *rsc, 47 android::renderscript::Allocation *alloc, 48 bool forceZero); 49void rsdAllocationDestroy(const android::renderscript::Context *rsc, 50 android::renderscript::Allocation *alloc); 51 52void rsdAllocationResize(const android::renderscript::Context *rsc, 53 const android::renderscript::Allocation *alloc, 54 const android::renderscript::Type *newType, bool zeroNew); 55void rsdAllocationSyncAll(const android::renderscript::Context *rsc, 56 const android::renderscript::Allocation *alloc, 57 RsAllocationUsageType src); 58void rsdAllocationMarkDirty(const android::renderscript::Context *rsc, 59 const android::renderscript::Allocation *alloc); 60 61void rsdAllocationData1D(const android::renderscript::Context *rsc, 62 const android::renderscript::Allocation *alloc, 63 uint32_t xoff, uint32_t lod, uint32_t count, 64 const void *data, uint32_t sizeBytes); 65void rsdAllocationData2D(const android::renderscript::Context *rsc, 66 const android::renderscript::Allocation *alloc, 67 uint32_t xoff, uint32_t yoff, uint32_t lod, RsAllocationCubemapFace face, 68 uint32_t w, uint32_t h, 69 const void *data, uint32_t sizeBytes); 70void rsdAllocationData3D(const android::renderscript::Context *rsc, 71 const android::renderscript::Allocation *alloc, 72 uint32_t xoff, uint32_t yoff, uint32_t zoff, 73 uint32_t lod, RsAllocationCubemapFace face, 74 uint32_t w, uint32_t h, uint32_t d, const void *data, uint32_t sizeBytes); 75 76void rsdAllocationElementData1D(const android::renderscript::Context *rsc, 77 const android::renderscript::Allocation *alloc, 78 uint32_t x, 79 const void *data, uint32_t elementOff, uint32_t sizeBytes); 80void rsdAllocationElementData2D(const android::renderscript::Context *rsc, 81 const android::renderscript::Allocation *alloc, 82 uint32_t x, uint32_t y, 83 const void *data, uint32_t elementOff, uint32_t sizeBytes); 84 85 86 87 88#endif 89