final int bpp = t.format().getBytesPerPixel(); final long size = width * height * (long) bpp;
@Test public final void testTexture2DGetImageIdentities() { final JCGLTexturesType t = this.getTextures("main"); final List<JCGLTextureUnitType> us = t.textureGetUnits(); final JCGLTextureUnitType u = us.get(0); for (final JCGLTextureFormat v : JCGLTextureFormat.values()) { final JCGLTexture2DType ta = t.texture2DAllocate( u, 128L, 256L, v, JCGLTextureWrapS.TEXTURE_WRAP_REPEAT, JCGLTextureWrapT.TEXTURE_WRAP_REPEAT, JCGLTextureFilterMinification.TEXTURE_FILTER_LINEAR, JCGLTextureFilterMagnification.TEXTURE_FILTER_LINEAR); Assert.assertTrue(t.textureUnitIsBound(u)); Assert.assertTrue(t.texture2DIsBound(u, ta)); final ByteBuffer i = t.texture2DGetImage(u, ta); Assert.assertEquals(ByteOrder.nativeOrder(), i.order()); Assert.assertEquals( 128L * 256L * (long) v.getBytesPerPixel(), (long) i.capacity()); Assert.assertFalse(ta.isDeleted()); t.texture2DDelete(ta); Assert.assertTrue(ta.isDeleted()); } }
private static LWJGL3TextureSpec makeTextureSpec( final JCGLTextureFormat format) JCGLPixelFormat ct = format.getComponentType(); switch (ct) { case PIXEL_PACKED_UNSIGNED_INT_1010102:
private static Map<JCGLTextureFormat, LWJGL3TextureSpec> makeTextureSpecs() { final Map<JCGLTextureFormat, LWJGL3TextureSpec> m = new EnumMap<>(JCGLTextureFormat.class); final JCGLTextureFormat[] values = JCGLTextureFormat.values(); for (int index = 0; index < values.length; ++index) { final JCGLTextureFormat format = values[index]; final LWJGL3TextureSpec spec = makeTextureSpec(format); Preconditions.checkPrecondition( format, !m.containsKey(format), ignored -> "Format must be unique"); m.put(format, spec); } return m; }
private static Map<JCGLTextureFormat, LWJGL3TextureSpec> makeTextureSpecs() { final Map<JCGLTextureFormat, LWJGL3TextureSpec> m = new EnumMap<>(JCGLTextureFormat.class); final JCGLTextureFormat[] values = JCGLTextureFormat.values(); for (int index = 0; index < values.length; ++index) { final JCGLTextureFormat format = values[index]; final LWJGL3TextureSpec spec = LWJGL3TextureSpecs.makeTextureSpec(format); Preconditions.checkPrecondition( format, !m.containsKey(format), ignored -> "Format must be unique"); m.put(format, spec); } return m; }
final int bpp = t.format().getBytesPerPixel(); final long size = width * height * (long) bpp;
@Test public final void testTexture2DGetImageIdentities() { final JCGLTexturesType t = this.getTextures("main"); final List<JCGLTextureUnitType> us = t.textureGetUnits(); final JCGLTextureUnitType u = us.get(0); for (final JCGLTextureFormat v : JCGLTextureFormat.values()) { final JCGLTexture2DType ta = t.texture2DAllocate( u, 128L, 256L, v, JCGLTextureWrapS.TEXTURE_WRAP_REPEAT, JCGLTextureWrapT.TEXTURE_WRAP_REPEAT, JCGLTextureFilterMinification.TEXTURE_FILTER_LINEAR, JCGLTextureFilterMagnification.TEXTURE_FILTER_LINEAR); Assert.assertTrue(t.textureUnitIsBound(u)); Assert.assertTrue(t.texture2DIsBound(u, ta)); final ByteBuffer i = t.texture2DGetImage(u, ta); Assert.assertEquals(ByteOrder.nativeOrder(), i.order()); Assert.assertEquals( 128L * 256L * (long) v.getBytesPerPixel(), (long) i.capacity()); Assert.assertFalse(ta.isDeleted()); t.texture2DDelete(ta); Assert.assertTrue(ta.isDeleted()); } }
"basn6a08.png")); for (final JCGLTextureFormat v : JCGLTextureFormat.values()) { switch (v) { case TEXTURE_FORMAT_R_32I_4BPP:
private static LWJGL3TextureSpec makeTextureSpec( final JCGLTextureFormat format) JCGLPixelFormat ct = format.getComponentType(); switch (ct) { case PIXEL_PACKED_UNSIGNED_INT_1010102:
RangeCheck.checkGreaterEqualLong(height, "Height", 2L, "Valid heights"); final long bytes = width * height * format.getBytesPerPixel(); FakeTextures.LOG.debug( "allocate {} {}x{} {} bytes",
final JCGLTextureUnitType u = us.get(0); for (final JCGLTextureFormat v : JCGLTextureFormat.values()) { final JCGLTextureCubeType ta = t.textureCubeAllocate( Assert.assertEquals(ByteOrder.nativeOrder(), i.order()); Assert.assertEquals( 128L * 128L * (long) v.getBytesPerPixel(), (long) i.capacity());
"basn6a08.png")); for (final JCGLTextureFormat v : JCGLTextureFormat.values()) { switch (v) { case TEXTURE_FORMAT_R_32I_4BPP:
RangeCheck.checkGreaterEqualLong(in_size, "Size", 2L, "Valid sizes"); final long bytes = (in_size * in_size) * 6L * format.getBytesPerPixel(); LOG.debug( "allocate {} {}x{}x6 {} bytes",
final JCGLTextureUnitType u = us.get(0); for (final JCGLTextureFormat v : JCGLTextureFormat.values()) { final JCGLTextureCubeType ta = t.textureCubeAllocate( Assert.assertEquals(ByteOrder.nativeOrder(), i.order()); Assert.assertEquals( 128L * 128L * (long) v.getBytesPerPixel(), (long) i.capacity());
"basn6a08.png")); for (final JCGLTextureFormat v : JCGLTextureFormat.values()) { switch (v) { case TEXTURE_FORMAT_R_32I_4BPP:
RangeCheck.checkGreaterEqualLong(in_size, "Size", 2L, "Valid sizes"); final long bytes = (in_size * in_size) * 6L * format.getBytesPerPixel(); FakeTextures.LOG.debug( "allocate {} {}x{}x6 {} bytes",
"basn6a08.png")); for (final JCGLTextureFormat v : JCGLTextureFormat.values()) { switch (v) { case TEXTURE_FORMAT_R_32I_4BPP:
RangeCheck.checkGreaterEqualLong(height, "Height", 2L, "Valid heights"); final long bytes = width * height * format.getBytesPerPixel(); LOG.debug( "allocate {} {}x{} {} bytes",
final JCGLTextureUnitType u = us.get(0); for (final JCGLTextureFormat v : JCGLTextureFormat.values()) { final JCGLTextureCubeType ta = t.textureCubeAllocate(
this.width * this.height * (long) this.format.getBytesPerPixel(); this.byte_range = new UnsignedRangeInclusiveL(0L, size_bytes - 1L); this.width * this.height * (long) this.format.getBytesPerPixel();