Skip to content

Commit

Permalink
changed syserrs to Logger
Browse files Browse the repository at this point in the history
  • Loading branch information
redrezo committed Jul 28, 2020
1 parent 7a6e100 commit 2077a31
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import org.eclipse.fx.drift.impl.DriftDebug;
import org.eclipse.fx.drift.impl.NGDriftFXSurface;
import org.eclipse.fx.drift.internal.Log;
import org.eclipse.fx.drift.internal.ScreenObserver;
import org.eclipse.fx.drift.internal.SurfaceData;
import org.eclipse.fx.drift.internal.frontend.FrontSwapChain;
Expand Down Expand Up @@ -241,7 +242,7 @@ public void dirty() {
public void setSwapChain(FrontSwapChain swapChain) {
DriftDebug.outputThread();
FrontSwapChain leftover = swapChainBuf.getAndSet(swapChain);
if (leftover != null) System.err.println("Leftover swapchain!!! This is not good! " + leftover);
if (leftover != null) Log.info("Leftover swapchain!!! This is not good! " + leftover);
Platform.runLater(() -> getHelper().markDirty(DirtyBits.NODE_CONTENTS));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ protected void renderContent(Graphics g) {
nextSwapChain = null;
}
catch (Exception e) {
System.err.println("ERROR during swapchain recreation");
Log.error("ERROR during swapchain recreation");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public WaitSyncResult ClientWaitSync(Duration timeout) {
case GL.GL_CONDITION_SATISFIED: return WaitSyncResult.CONDITION_SATISFIED;
case GL.GL_WAIT_FAILED: return WaitSyncResult.WAIT_FAILED;
}
System.err.println("glClientWaitSync: Unexpected result!!! " + r);
Log.error("glClientWaitSync: Unexpected result!!! " + r);
return WaitSyncResult.WAIT_FAILED;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ private static void initializeContext(ResourceFactory rf) {
// glContext = GL.createSharedCompatContext(wrapContext);
glContext = GL.createContext(wrapContext, 2, 0);
boolean su = GL.makeContextCurrent(glContext);
System.err.println("QuantumHelper#initializeContext");
System.err.println("prismContext = " + prismContext);
System.err.println("glContext = " + glContext);
System.err.println("makeCurrent: " + su);
Log.debug("QuantumHelper#initializeContext");
Log.debug("prismContext = " + prismContext);
Log.debug("glContext = " + glContext);
Log.debug("makeCurrent: " + su);

long nativeHandle = GL.getNativeContextHandle(glContext);
System.err.println("nativeHandle = " + nativeHandle);
System.err.println("CGLGetCurrent = " + MacOS.CGLGetCurrentContext() ) ;
Log.debug("nativeHandle = " + nativeHandle);
Log.debug("CGLGetCurrent = " + MacOS.CGLGetCurrentContext() ) ;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ public class ResourceLogger {


public static void resourceAllocated(long id, String type, String nfo) {
System.err.println("RESOURCE: + " + type + "(0x"+ Long.toHexString(id) + ") " + nfo);
Log.debug("RESOURCE: + " + type + "(0x"+ Long.toHexString(id) + ") " + nfo);
}

public static void resourceDisposed(long id) {
System.err.println("RESOURCE: - 0x" + Long.toHexString(id));
Log.debug("RESOURCE: - 0x" + Long.toHexString(id));
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.Optional;

import org.eclipse.fx.drift.internal.GL;
import org.eclipse.fx.drift.internal.Log;
import org.eclipse.fx.drift.internal.jni.win32.NVDXInterop;
import org.eclipse.fx.drift.internal.jni.win32.Win32;
import org.eclipse.fx.drift.internal.jni.win32.WindowsError;
Expand Down Expand Up @@ -44,7 +45,7 @@ public static NVDXInteropDevice openDevice(Win32.IDirect3DDevice9Ex dxDevice) th
}

device.usageCount++;
System.err.println(device);
Log.debug("" + device);
return device;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import org.eclipse.fx.drift.RenderTarget;
import org.eclipse.fx.drift.SwapchainConfig;
import org.eclipse.fx.drift.internal.Log;
import org.eclipse.fx.drift.internal.common.ImageData;
import org.eclipse.fx.drift.internal.transport.command.DisposeSwapchainCommand;
import org.eclipse.fx.drift.internal.transport.command.PresentCommand;
Expand Down Expand Up @@ -65,15 +66,15 @@ public void dispose() {
}
}
disposeTime += System.nanoTime();
System.err.println("Dispose waiting time was " + disposeTime + "ns");
Log.debug("Dispose waiting time was " + disposeTime + "ns");
synchronized (freeImages) {
for (Image image : freeImages) {
image.release();
}
// TODO release ohter images
images.removeAll(freeImages);
if (!images.isEmpty()) {
System.err.println("Unreleased Swapchain images remaining: " + images);
Log.error("Unreleased Swapchain images remaining: " + images);
}
disposed = true;
}
Expand All @@ -97,7 +98,7 @@ public void release(ImageData imageData) {
Image image = imageMap.get(imageData);
if (image == null) {
// panic
System.err.println("Wrong image released !!!!!");
Log.error("Wrong image released !!!!!");
}
else {
freeImages.add(image);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.eclipse.fx.drift.internal.frontend;

import org.eclipse.fx.drift.internal.Log;
import org.eclipse.fx.drift.internal.common.ImageData;
import org.eclipse.fx.drift.internal.prism.Prism;

Expand Down Expand Up @@ -27,7 +28,7 @@ public D getData() {
public void allocate(ResourceFactory rf) throws Exception {
texture = rf.createTexture(PixelFormat.BYTE_BGRA_PRE, Texture.Usage.DYNAMIC, Texture.WrapMode.CLAMP_NOT_NEEDED, data.size.x, data.size.y);
texture.makePermanent();
System.err.println("Texture Created! " + this + " / " + texture + " / " + Prism.getTextureHandle(texture));
Log.debug("Texture Created! " + this + " / " + texture + " / " + Prism.getTextureHandle(texture));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.eclipse.fx.drift.DriftFXSurface;
import org.eclipse.fx.drift.PresentationMode;
import org.eclipse.fx.drift.Vec2i;
import org.eclipse.fx.drift.internal.Log;
import org.eclipse.fx.drift.internal.common.ImageData;
import org.eclipse.fx.drift.internal.transport.Command;
import org.eclipse.fx.drift.internal.transport.command.CreateSwapchainCommand;
Expand Down Expand Up @@ -68,7 +69,7 @@ public void receiveCommand(Command command) {
// System.err.println("Frontend received " + command);

if (command instanceof CreateSwapchainCommand) {
System.err.println("Frontend received " + command);
Log.debug("Frontend received " + command);
CreateSwapchainCommand cmd = (CreateSwapchainCommand) command;
doCreateSwapchain(cmd.getId(), cmd.getImages(), cmd.getPresentatioMode());
}
Expand All @@ -78,12 +79,12 @@ else if (command instanceof PresentCommand) {
doPresent(cmd.getImageData());
}
else {
System.err.println("!!! Instant release");
Log.debug("!!! Instant release");
sendRelease(cmd.getSwapChainId(), cmd.getImageData());
}
}
else if (command instanceof DisposeSwapchainCommand) {
System.err.println("Frontend received " + command);
Log.debug("Frontend received " + command);
DisposeSwapchainCommand cmd = (DisposeSwapchainCommand) command;
swapChains.get(cmd.getId()).scheduleDispose();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,17 @@ private void copyTextureFramebuffer(int sourceTex, int targetTex, Vec2i size) {
}

public static void dumpIOSurface(long ioSurfaceID, Vec2i size) {
System.err.println("dumpIOSurface " + ioSurfaceID);
Log.debug("dumpIOSurface " + ioSurfaceID);
int tempTexture = glGenTexture();
CGLContextObj cglContext = CGLGetCurrentContext();
System.err.println("GOT CONTEXT " + cglContext);
Log.debug("GOT CONTEXT " + cglContext);
IOSurfaceRef ioSurface = IOSurfaceLookup(ioSurfaceID);
System.err.println("GOT IOSURFACE " + ioSurface);
Log.debug("GOT IOSURFACE " + ioSurface);
//System.err.println("Got cglContext=" + cglContext + " and ioSurface=" + ioSurface);
GL.glBindTexture(GL_TEXTURE_RECTANGLE, tempTexture);
CGLError success = CGLTexImageIOSurface2D(cglContext, GL_TEXTURE_RECTANGLE, GL_RGBA, size.x, size.y, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, ioSurface, 0);
GL.glBindTexture(GL_TEXTURE_RECTANGLE, 0);
System.err.println("mount success_: " + success);
Log.debug("mount success_: " + success);

MacOS.IOSurfaceLock(ioSurface);

Expand All @@ -180,7 +180,7 @@ public static void dumpIOSurface(long ioSurfaceID, Vec2i size) {
byte g = buf.get();
byte b = buf.get();
byte a = buf.get();
System.err.println("First Pixel: " + r + " / " + g + " / " + b + " / " + a);
Log.debug("First Pixel: " + r + " / " + g + " / " + b + " / " + a);


// SYS.free(memPointer);
Expand All @@ -196,7 +196,7 @@ public static void dumpIOSurface(long ioSurfaceID, Vec2i size) {
}

public static void dumpGLTexture(int name, Vec2i size) {
System.err.println("dumpGLTexture " + name);
Log.debug("dumpGLTexture " + name);

int memSize = size.x * size.y * 4;

Expand All @@ -214,7 +214,7 @@ public static void dumpGLTexture(int name, Vec2i size) {
byte g = buf.get();
byte b = buf.get();
byte a = buf.get();
System.err.println("First Pixel: " + r + " / " + g + " / " + b + " / " + a);
Log.debug("First Pixel: " + r + " / " + g + " / " + b + " / " + a);


}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.nio.ByteBuffer;
import java.util.Stack;

import org.eclipse.fx.drift.internal.Log;
import org.eclipse.fx.drift.internal.NativeLoader;


Expand Down Expand Up @@ -129,7 +130,7 @@ public void pop() {
private static native void nOutputLong(long target);

public static void output(IMemoryStack stack, Long t) {
System.err.println("J 0x" + java.lang.Long.toHexString(t.get()) + " (" + t.get() + ")");
Log.debug("J 0x" + java.lang.Long.toHexString(t.get()) + " (" + t.get() + ")");
nOutputLong(t.getAddress());
}
public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import java.util.Optional;
import java.util.stream.Stream;

import org.eclipse.fx.drift.internal.Log;

public enum ErrorCode {
ERROR_INVALID_HANDLE(0x6),
ERROR_INVALID_DATA(0xD),
Expand All @@ -24,7 +26,7 @@ public static ErrorCode fromValue(int value) {
return code.get();
}
else {
System.err.println("Error code not yet supported: " + Integer.toHexString(value));
Log.error("Error code not yet supported: " + Integer.toHexString(value));
Thread.dumpStack();
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import java.util.Optional;
import java.util.stream.Stream;

import org.eclipse.fx.drift.internal.Log;

public enum HRESULT {
E_OUTOFMEMORY(0x8007000EL),
E_INVALIDARG(0x80070057L),
Expand All @@ -21,7 +23,7 @@ public static HRESULT fromValue(long value) {
return code.get();
}
else {
System.err.println("Error code not yet supported: " + Long.toHexString(value));
Log.error("Error code not yet supported: " + Long.toHexString(value));
Thread.dumpStack();
return null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.eclipse.fx.drift.internal.jni.win32;

import org.eclipse.fx.drift.internal.Log;

public class NVDXInterop {

public final static int WGL_ACCESS_READ_ONLY_NV = 0x0000;
Expand Down Expand Up @@ -28,7 +30,7 @@ public static boolean wglDXCloseDeviceNV(Win32.HANDLE hDevice) throws WindowsErr

public static boolean wglDXSetResourceShareHandleNV(Win32.IDirect3DResource9 dxResource, Win32.HANDLE shareHandle) throws WindowsError {
boolean result = nWglDXSetResourceShareHandleNV(dxResource.address, shareHandle.address);
System.err.println(result + " = wglDXSetResourceShareHandleNV(" + Long.toHexString(dxResource.address) + ", " + Long.toHexString(shareHandle.address) + ")");
Log.debug(result + " = wglDXSetResourceShareHandleNV(" + Long.toHexString(dxResource.address) + ", " + Long.toHexString(shareHandle.address) + ")");

if (!result) {
WindowsError.checkLastError();
Expand All @@ -39,7 +41,7 @@ public static boolean wglDXSetResourceShareHandleNV(Win32.IDirect3DResource9 dxR

public static Win32.HANDLE wglDXRegisterObjectNV(Win32.HANDLE hDevice, Win32.IDirect3DResource9 dxResource, int name, int type, int access) throws WindowsError {
long result = nWglDXRegisterObjectNV(hDevice.address, dxResource.address, name, type, access);
System.err.println(Long.toHexString(result) + " = wglDXRegisterObjectNV(" + Long.toHexString(hDevice.address) + ", " + Long.toHexString(dxResource.address) + ", " + name + ", " + type + ", " + access + ")");
Log.debug(Long.toHexString(result) + " = wglDXRegisterObjectNV(" + Long.toHexString(hDevice.address) + ", " + Long.toHexString(dxResource.address) + ", " + name + ", " + type + ", " + access + ")");
if (result == 0) {
WindowsError.checkLastError();
}
Expand All @@ -49,7 +51,7 @@ public static Win32.HANDLE wglDXRegisterObjectNV(Win32.HANDLE hDevice, Win32.IDi

public static boolean wglDXUnregisterObjectNV(Win32.HANDLE hDevice, Win32.HANDLE hObject) throws WindowsError {
boolean result = nWglDXUnregisterObjectNV(hDevice.address, hObject.address);
System.err.println("calling wglDXUnregisterObjectNV(" + Long.toHexString(hDevice.address) + ", " + Long.toHexString(hObject.address) + ")");
Log.debug("calling wglDXUnregisterObjectNV(" + Long.toHexString(hDevice.address) + ", " + Long.toHexString(hObject.address) + ")");
if (!result) {
WindowsError.checkLastError();
}
Expand Down

0 comments on commit 2077a31

Please sign in to comment.