org.lwjgl.opengl.GL43 Java Examples

The following examples show how to use org.lwjgl.opengl.GL43. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DesktopComputeJobManager.java    From graphicsfuzz with Apache License 2.0 6 votes vote down vote up
@Override
public void prepareEnvironment(JsonObject environmentJson) {
  final JsonObject bufferJson = environmentJson.get("buffer").getAsJsonObject();
  final int bufferBinding = bufferJson.get("binding").getAsInt();
  final int[] bufferInput = UniformSetter.getIntArray(bufferJson.get("input").getAsJsonArray());
  final IntBuffer intBufferData = BufferUtils.createIntBuffer(bufferInput.length);
  intBufferData.put(bufferInput);
  intBufferData.flip();
  shaderStorageBufferObject = GL15.glGenBuffers();
  checkError();
  GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, shaderStorageBufferObject);
  checkError();
  GL15.glBufferData(GL43.GL_SHADER_STORAGE_BUFFER, intBufferData, GL15.GL_STATIC_DRAW);
  checkError();
  GL30.glBindBufferBase(GL43.GL_SHADER_STORAGE_BUFFER, bufferBinding, shaderStorageBufferObject);
  checkError();
  numGroups = UniformSetter.getIntArray(environmentJson.get("num_groups").getAsJsonArray());
}
 
Example #2
Source File: DesktopComputeJobManager.java    From graphicsfuzz with Apache License 2.0 6 votes vote down vote up
@Override
public JsonObject executeComputeShader() {
  GL20.glUseProgram(program);
  checkError();
  GL43.glDispatchCompute(numGroups[0], numGroups[1], numGroups[2]);
  checkError();
  GL42.glMemoryBarrier(GL43.GL_SHADER_STORAGE_BARRIER_BIT);
  checkError();
  GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, shaderStorageBufferObject);
  checkError();
  final IntBuffer dataFromComputeShader = GL15.glMapBuffer(GL43.GL_SHADER_STORAGE_BUFFER, GL15.GL_READ_ONLY)
      .asIntBuffer();
  checkError();
  final JsonArray jsonArray = new JsonArray();
  for (int i = 0; i < dataFromComputeShader.limit(); i++) {
    jsonArray.add(dataFromComputeShader.get(i));
  }
  final JsonObject result = new JsonObject();
  result.add("output", jsonArray);
  return result;
}
 
Example #3
Source File: DesktopComputeJobManager.java    From graphicsfuzz with Apache License 2.0 5 votes vote down vote up
@Override
public void createAndCompileComputeShader(String computeShaderSource) {
  Gdx.app.log("DesktopComputeJobManager", "Compiling compute shader.");
  shader = GL20.glCreateShader(GL43.GL_COMPUTE_SHADER);
  checkError();
  GL20.glShaderSource(shader, computeShaderSource);
  checkError();
  GL20.glCompileShader(shader);
  checkError();
}
 
Example #4
Source File: CoreEngine.java    From Lwjgl3-Game-Engine-Programming-Series with MIT License 5 votes vote down vote up
private void getDeviceProperties(){
	System.out.println("OpenGL version: " + GL11.glGetString(GL11.GL_VERSION) + " bytes");
	System.out.println("Max Geometry Uniform Blocks: " + GL31.GL_MAX_GEOMETRY_UNIFORM_BLOCKS+ " bytes");
	System.out.println("Max Geometry Shader Invocations: " + GL40.GL_MAX_GEOMETRY_SHADER_INVOCATIONS + " bytes");
	System.out.println("Max Uniform Buffer Bindings: " + GL31.GL_MAX_UNIFORM_BUFFER_BINDINGS + " bytes");
	System.out.println("Max Uniform Block Size: " + GL31.GL_MAX_UNIFORM_BLOCK_SIZE + " bytes");
	System.out.println("Max SSBO Block Size: " + GL43.GL_MAX_SHADER_STORAGE_BLOCK_SIZE + " bytes");		
}
 
Example #5
Source File: Errors.java    From Visage with MIT License 5 votes vote down vote up
private static void buildMapping() {
	if (mapping != null) return;
	Multimap<Integer, String> map = HashMultimap.create();
	List<Class<?>> classes = ImmutableList.of(
			GL11.class, GL12.class, GL13.class, GL14.class, GL15.class,
			GL20.class, GL21.class, GL30.class, GL31.class, GL32.class,
			GL33.class, GL40.class, GL41.class, GL42.class, GL43.class,
			GL44.class, GL45.class, GLFW.class
			);
	for (Class<?> clazz : classes) {
		for (Field f : clazz.getDeclaredFields()) {
			if (f.getName().toUpperCase(Locale.ROOT).equals(f.getName()) &&
					f.getType() == int.class && Modifier.isPublic(f.getModifiers()) && Modifier.isStatic(f.getModifiers())) {
				List<String> li = Splitter.on('_').splitToList(f.getName());
				li = li.subList(1, li.size());
				String clean =
					Joiner.on(' ').join(
						li.stream()
							.map(Errors::toTitleCase)
							.iterator());
				try {
					map.put(f.getInt(null), clean);
				} catch (Throwable t) {
					t.printStackTrace();
				}
			}
		}
	}
	mapping = map;
}
 
Example #6
Source File: DesktopMini2DxGame.java    From mini2Dx with Apache License 2.0 5 votes vote down vote up
/**
 * Enables or disables GL debug messages for the specified severity level. Returns false if the severity
 * level could not be set (e.g. the NOTIFICATION level is not supported by the ARB and AMD extensions).
 *
 * See {@link Lwjgl3ApplicationConfiguration#enableGLDebugOutput(boolean, PrintStream)}
 */
public static boolean setGLDebugMessageControl (GLDebugMessageSeverity severity, boolean enabled) {
	GLCapabilities caps = GL.getCapabilities();
	final int GL_DONT_CARE = 0x1100; // not defined anywhere yet

	if (caps.OpenGL43) {
		GL43.glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, severity.gl43, (IntBuffer) null, enabled);
		return true;
	}

	if (caps.GL_KHR_debug) {
		KHRDebug.glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, severity.khr, (IntBuffer) null, enabled);
		return true;
	}

	if (caps.GL_ARB_debug_output && severity.arb != -1) {
		ARBDebugOutput.glDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, severity.arb, (IntBuffer) null, enabled);
		return true;
	}

	if (caps.GL_AMD_debug_output && severity.amd != -1) {
		AMDDebugOutput.glDebugMessageEnableAMD(GL_DONT_CARE, severity.amd, (IntBuffer) null, enabled);
		return true;
	}

	return false;
}
 
Example #7
Source File: PlatformLinuxGLCanvas.java    From lwjgl3-awt with MIT License 4 votes vote down vote up
private static void populateEffectiveGLAttribs(GLData effective) throws AWTException {
	long glGetIntegerv = GL.getFunctionProvider().getFunctionAddress("glGetIntegerv");
	long glGetString = GL.getFunctionProvider().getFunctionAddress("glGetString");
	APIVersion version = APIUtil.apiParseVersion(getString(GL11.GL_VERSION, glGetString));

	effective.majorVersion = version.major;
	effective.minorVersion = version.minor;

	int profileFlags = getInteger(GL32.GL_CONTEXT_PROFILE_MASK, glGetIntegerv);

	if ((profileFlags & GLX_CONTEXT_ES_PROFILE_BIT_EXT) != 0) {
		effective.api = GLData.API.GLES;
	} else {
		effective.api = GLData.API.GL;
	}

	if (version.major >= 3) {
		if (version.major >= 4 || version.minor >= 2) {
			if ((profileFlags & GL32.GL_CONTEXT_CORE_PROFILE_BIT) != 0) {
				effective.profile = GLData.Profile.CORE;
			} else if ((profileFlags & GL32.GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) != 0) {
				effective.profile = GLData.Profile.COMPATIBILITY;
			} else if (
					(profileFlags & GLX_CONTEXT_ES_PROFILE_BIT_EXT) != 0) {
				// OpenGL ES allows checking for profiles at versions below 3.2, so avoid branching into
				// the if and actually check later.
			} else if (profileFlags != 0) {
				throw new AWTException("Unknown profile " + profileFlags);
			}
		}

		int effectiveContextFlags = getInteger(GL30.GL_CONTEXT_FLAGS, glGetIntegerv);
		effective.debug = (effectiveContextFlags & GL43.GL_CONTEXT_FLAG_DEBUG_BIT) != 0;
		effective.forwardCompatible =
				(effectiveContextFlags & GL30.GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT) != 0;
		effective.robustness =
				(effectiveContextFlags & ARBRobustness.GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB) != 0;
		effective.contextResetIsolation =
				(effectiveContextFlags & GLX_CONTEXT_RESET_ISOLATION_BIT_ARB) != 0;
	}

	if (effective.robustness) {
		int effectiveNotificationStrategy = getInteger(ARBRobustness.GL_RESET_NOTIFICATION_STRATEGY_ARB, glGetIntegerv);
		effective.loseContextOnReset = (effectiveNotificationStrategy & ARBRobustness.GL_LOSE_CONTEXT_ON_RESET_ARB) != 0;
	}

	effective.samples = getInteger(GL13.GL_SAMPLES, glGetIntegerv);
}