use of net.coderbot.iris.rendertarget.RenderTarget in project Iris by IrisShaders.
the class IrisImages method addRenderTargetImages.
public static void addRenderTargetImages(ImageHolder images, Supplier<ImmutableSet<Integer>> flipped, RenderTargets renderTargets) {
for (int i = 0; i < renderTargets.getRenderTargetCount(); i++) {
final int index = i;
// Note: image bindings *are* impacted by buffer flips.
IntSupplier textureID = () -> {
ImmutableSet<Integer> flippedBuffers = flipped.get();
RenderTarget target = renderTargets.get(index);
if (flippedBuffers.contains(index)) {
return target.getAltTexture();
} else {
return target.getMainTexture();
}
};
final InternalTextureFormat internalFormat = renderTargets.get(i).getInternalFormat();
final String name = "colorimg" + i;
images.addTextureImage(textureID, internalFormat, name);
}
}
use of net.coderbot.iris.rendertarget.RenderTarget in project Iris by IrisShaders.
the class IrisSamplers method addRenderTargetSamplers.
public static void addRenderTargetSamplers(SamplerHolder samplers, Supplier<ImmutableSet<Integer>> flipped, RenderTargets renderTargets, boolean isFullscreenPass) {
// colortex0,1,2,3 are only able to be sampled from fullscreen passes.
// Iris could lift this restriction, though I'm not sure if it could cause issues.
int startIndex = isFullscreenPass ? 0 : 4;
for (int i = startIndex; i < renderTargets.getRenderTargetCount(); i++) {
final int index = i;
IntSupplier sampler = () -> {
ImmutableSet<Integer> flippedBuffers = flipped.get();
RenderTarget target = renderTargets.get(index);
if (flippedBuffers.contains(index)) {
return target.getAltTexture();
} else {
return target.getMainTexture();
}
};
final String name = "colortex" + i;
if (i < PackRenderTargetDirectives.LEGACY_RENDER_TARGETS.size()) {
String legacyName = PackRenderTargetDirectives.LEGACY_RENDER_TARGETS.get(i);
// colortex0 is the default sampler in fullscreen passes
if (i == 0 && isFullscreenPass) {
samplers.addDefaultSampler(sampler, name, legacyName);
} else {
samplers.addDynamicSampler(sampler, name, legacyName);
}
} else {
samplers.addDynamicSampler(sampler, name);
}
}
}
Aggregations