コード例 #1
0
        public static CachedTexture getCachedTexture(int width, int height, int pixelFormat, int[] buffer, int bufferOffset, int bufferLength)
        {
            int offset = 0;

            // When the texture is directly available from the memory,
            // we can reuse the memory array and do not need to copy the whole texture.
            if (buffer == RuntimeContext.MemoryInt)
            {
                if (pixelFormat == TPSM_PIXEL_STORAGE_MODE_32BIT_ABGR8888 || pspsharp.graphics.RE.IRenderingEngine_Fields.isTextureTypeIndexed[pixelFormat])
                {
                    // Do not reuse the memory buffer when the texture is inside the current GE,
                    // copy the texture (this is better matching the PSP texture cache behavior).
                    int textureAddress = bufferOffset << 2;
                    if (!Modules.sceDisplayModule.isGeAddress(textureAddress))
                    {
                        offset = bufferOffset;
                    }
                }
            }

            CachedTexture cachedTexture = getCachedTexture(width, height, pixelFormat, offset);

            cachedTexture.setBuffer(buffer, bufferOffset, bufferLength);

            if (buffer == RuntimeContext.MemoryInt)
            {
                int textureAddress = bufferOffset << 2;
                if (Memory.isVRAM(textureAddress))
                {
                    cachedTexture.VRAMTexture = true;
                }
            }

            return(cachedTexture);
        }
コード例 #2
0
        public static CachedTexture getCachedTexture(int width, int height, int pixelFormat, short[] buffer, int bufferOffset, int bufferLength)
        {
            CachedTexture cachedTexture = getCachedTexture(width, height, pixelFormat, 0);

            cachedTexture.setBuffer(buffer, bufferOffset, bufferLength);

            return(cachedTexture);
        }