├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ └── bug_report_en.yml └── workflows │ ├── Build_and_Upload.yml │ └── gradle.yml ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── TODO.md ├── build.gradle ├── buildSrc ├── build.gradle └── src │ └── main │ └── groovy │ └── superresolution │ ├── BasePlatformConfig.groovy │ ├── CommonConfig.groovy │ ├── Dependence.groovy │ ├── Dependencies.groovy │ ├── FabricPlatformConfig.groovy │ ├── ForgePlatformConfig.groovy │ ├── ModrinthUploader.groovy │ ├── NeoForgePlatformConfig.groovy │ └── VersionConfig.groovy ├── common ├── build.gradle └── src │ └── main │ ├── java │ └── io │ │ └── homo │ │ └── superresolution │ │ ├── api │ │ ├── AbstractAlgorithm.java │ │ ├── SuperResolutionAPI.java │ │ ├── event │ │ │ ├── AlgorithmDispatchEvent.java │ │ │ ├── AlgorithmDispatchFinishEvent.java │ │ │ ├── AlgorithmRegisterEvent.java │ │ │ ├── AlgorithmResizeEvent.java │ │ │ ├── Event.java │ │ │ ├── EventFactory.java │ │ │ ├── LevelRenderEndEvent.java │ │ │ └── LevelRenderStartEvent.java │ │ ├── registry │ │ │ ├── AlgorithmDescription.java │ │ │ └── AlgorithmRegistry.java │ │ └── utils │ │ │ └── Requirement.java │ │ ├── common │ │ ├── SuperResolution.java │ │ ├── config │ │ │ ├── AlgorithmDescriptionSerializer.java │ │ │ ├── Config.java │ │ │ ├── ConfigData.java │ │ │ ├── ConfigFile.java │ │ │ ├── ConfigSpecType.java │ │ │ ├── EnumSerializer.java │ │ │ ├── enums │ │ │ │ ├── CaptureMode.java │ │ │ │ └── SgsrVariant.java │ │ │ └── special │ │ │ │ ├── FSR1SpecialConfig.java │ │ │ │ ├── FSR2SpecialConfig.java │ │ │ │ ├── NISSpecialConfig.java │ │ │ │ ├── SGSR1SpecialConfig.java │ │ │ │ ├── SGSR2SpecialConfig.java │ │ │ │ ├── SpecialConfig.java │ │ │ │ ├── SpecialConfigDescription.java │ │ │ │ └── SpecialConfigs.java │ │ ├── dataset │ │ │ └── DataSetGenerator.java │ │ ├── debug │ │ │ ├── PerformanceInfo.java │ │ │ └── imgui │ │ │ │ ├── ImGuiLayer.java │ │ │ │ └── ImguiMain.java │ │ ├── gui │ │ │ ├── ClothConfig.java │ │ │ ├── ConfigScreenBuilder.java │ │ │ ├── InfoBuilder.java │ │ │ ├── Rectangle.java │ │ │ ├── ScissorsHandler.java │ │ │ ├── effect │ │ │ │ └── BlurRenderer.java │ │ │ ├── entries │ │ │ │ ├── ClothButtonEntry.java │ │ │ │ ├── ClothTextListEntry.java │ │ │ │ └── ClothTextListListEntry.java │ │ │ ├── impl │ │ │ │ ├── ClothConfigBuilder.java │ │ │ │ └── ClothConfigCategoryImpl.java │ │ │ ├── screens │ │ │ │ ├── ClothStyleConfigScreen.java │ │ │ │ └── ClothStyleInfoScreen.java │ │ │ └── widgets │ │ │ │ ├── ClothListWidget.java │ │ │ │ └── Line.java │ │ ├── minecraft │ │ │ ├── CallType.java │ │ │ ├── FrameBufferRenderTargetAdapter.java │ │ │ ├── GpuTextureAdapter.java │ │ │ ├── HandRenderTarget.java │ │ │ ├── LegacyStorageFrameBuffer.java │ │ │ ├── MinecraftRenderHandle.java │ │ │ ├── MinecraftRenderTarget.java │ │ │ ├── MinecraftRenderTargetType.java │ │ │ ├── MinecraftRenderTargetUtil.java │ │ │ ├── MinecraftRenderTargetWrapper.java │ │ │ └── RenderTargetCache.java │ │ ├── mixin │ │ │ ├── MixinPlugin.java │ │ │ ├── core │ │ │ │ ├── ForceOpenGLVersion_WindowMixin.java │ │ │ │ ├── GLXMixin.java │ │ │ │ ├── GameRendererMixin.java │ │ │ │ ├── LevelRendererMixin.java │ │ │ │ ├── MinecraftMixin.java │ │ │ │ ├── OptionsMixin.java │ │ │ │ ├── PostChainMixin.java │ │ │ │ ├── WindowMixin.java │ │ │ │ └── accessor │ │ │ │ │ ├── LevelRendererAccessor.java │ │ │ │ │ ├── MinecraftAccessor.java │ │ │ │ │ ├── OptionInstanceAccessor.java │ │ │ │ │ └── PostChainAccessor.java │ │ │ ├── debug │ │ │ │ ├── ImguiMixin.java │ │ │ │ └── KeyboardHandlerMixin.java │ │ │ └── gui │ │ │ │ ├── AbstractWidgetAccessor.java │ │ │ │ └── GameRendererAccessor.java │ │ ├── platform │ │ │ ├── Arch.java │ │ │ ├── EnvType.java │ │ │ ├── IrisPlatform.java │ │ │ ├── OS.java │ │ │ ├── OSType.java │ │ │ └── Platform.java │ │ └── upscale │ │ │ ├── AlgorithmDescriptions.java │ │ │ ├── AlgorithmManager.java │ │ │ ├── DispatchResource.java │ │ │ ├── MotionVectorsGenerator.java │ │ │ ├── fsr1 │ │ │ └── FSR1.java │ │ │ ├── fsr2 │ │ │ └── FSR2.java │ │ │ ├── nis │ │ │ ├── NVIDIAImageScaling.java │ │ │ ├── NVIDIAImageScalingConfig.java │ │ │ ├── NVIDIAImageScalingConst.java │ │ │ ├── NVIDIAImageScalingVk.java │ │ │ ├── enums │ │ │ │ ├── NISGPUArchitecture.java │ │ │ │ └── NISHDRMode.java │ │ │ └── struct │ │ │ │ ├── NISConfig.java │ │ │ │ └── NISOptimizer.java │ │ │ ├── none │ │ │ └── None.java │ │ │ └── sgsr │ │ │ ├── v1 │ │ │ └── Sgsr1.java │ │ │ └── v2 │ │ │ ├── AbstractSgsrVariant.java │ │ │ ├── Sgsr2.java │ │ │ ├── SgsrParams.java │ │ │ ├── SgsrUtils.java │ │ │ └── variants │ │ │ ├── Sgsr2PassCompute.java │ │ │ ├── Sgsr2PassFragment.java │ │ │ └── Sgsr3PassCompute.java │ │ ├── core │ │ ├── NativeLibManager.java │ │ ├── RenderSystems.java │ │ ├── SuperResolutionNative.java │ │ ├── SuperResolutionNativeHelper.java │ │ ├── graphics │ │ │ ├── GpuVendor.java │ │ │ ├── GraphicsCapabilities.java │ │ │ ├── glslang │ │ │ │ ├── FileIncluder.java │ │ │ │ ├── GlslangCompileShaderResult.java │ │ │ │ ├── GlslangShaderCompiler.java │ │ │ │ └── enums │ │ │ │ │ ├── EProfile.java │ │ │ │ │ ├── EShClient.java │ │ │ │ │ ├── EShLanguage.java │ │ │ │ │ ├── EShMessages.java │ │ │ │ │ ├── EShSource.java │ │ │ │ │ ├── EShTargetClientVersion.java │ │ │ │ │ ├── EShTargetLanguage.java │ │ │ │ │ ├── EShTargetLanguageVersion.java │ │ │ │ │ └── GlslangCompileShaderError.java │ │ │ ├── impl │ │ │ │ ├── BlendFactor.java │ │ │ │ ├── DepthFunc.java │ │ │ │ ├── IDebuggableObject.java │ │ │ │ ├── IUniformStruct.java │ │ │ │ ├── buffer │ │ │ │ │ └── UniformBuffer.java │ │ │ │ ├── framebuffer │ │ │ │ │ ├── FrameBufferAttachmentType.java │ │ │ │ │ ├── FrameBufferBindPoint.java │ │ │ │ │ ├── FrameBufferTextureAdapter.java │ │ │ │ │ └── IFrameBuffer.java │ │ │ │ ├── shader │ │ │ │ │ ├── IShaderProgram.java │ │ │ │ │ ├── ShaderDescription.java │ │ │ │ │ ├── ShaderSource.java │ │ │ │ │ ├── ShaderType.java │ │ │ │ │ └── uniform │ │ │ │ │ │ ├── IShaderUniform.java │ │ │ │ │ │ ├── IShaderUniformBlock.java │ │ │ │ │ │ ├── IShaderUniformSamplerTexture.java │ │ │ │ │ │ ├── IShaderUniformStorageTexture.java │ │ │ │ │ │ ├── ShaderUniformBuffer.java │ │ │ │ │ │ ├── ShaderUniformDescription.java │ │ │ │ │ │ ├── ShaderUniformType.java │ │ │ │ │ │ └── ShaderUniforms.java │ │ │ │ ├── texture │ │ │ │ │ ├── ITexture.java │ │ │ │ │ ├── TextureDescription.java │ │ │ │ │ ├── TextureFilterMode.java │ │ │ │ │ ├── TextureFormat.java │ │ │ │ │ ├── TextureFrameBufferAdapter.java │ │ │ │ │ ├── TextureMipmapSettings.java │ │ │ │ │ ├── TextureSupplier.java │ │ │ │ │ ├── TextureType.java │ │ │ │ │ ├── TextureUsage.java │ │ │ │ │ ├── TextureUsages.java │ │ │ │ │ └── TextureWrapMode.java │ │ │ │ └── vertex │ │ │ │ │ ├── IVertexBuffer.java │ │ │ │ │ ├── PrimitiveType.java │ │ │ │ │ ├── VertexAttribute.java │ │ │ │ │ └── VertexBufferDescription.java │ │ │ ├── interop │ │ │ │ ├── GlVkInteropManager.java │ │ │ │ └── memory │ │ │ │ │ └── SharedMemory.java │ │ │ ├── opengl │ │ │ │ ├── Gl.java │ │ │ │ ├── GlConst.java │ │ │ │ ├── GlRenderState.java │ │ │ │ ├── GlRenderSystem.java │ │ │ │ ├── GlState.java │ │ │ │ ├── GlStates.java │ │ │ │ ├── OpenGLException.java │ │ │ │ ├── OpenGLShaderFactory.java │ │ │ │ ├── buffer │ │ │ │ │ └── GlUniformBuffer.java │ │ │ │ ├── dsa │ │ │ │ │ ├── GL45DirectStateAccessImpl.java │ │ │ │ │ └── IGlDirectStateAccess.java │ │ │ │ ├── framebuffer │ │ │ │ │ ├── GlFrameBuffer.java │ │ │ │ │ └── GlFrameBufferAttachment.java │ │ │ │ ├── pipeline │ │ │ │ │ ├── GlPipeline.java │ │ │ │ │ ├── jobs │ │ │ │ │ │ ├── GlPipelineClearJob.java │ │ │ │ │ │ ├── GlPipelineComputeJob.java │ │ │ │ │ │ ├── GlPipelineCopyJob.java │ │ │ │ │ │ ├── GlPipelineGraphicsJob.java │ │ │ │ │ │ ├── GlPipelineJob.java │ │ │ │ │ │ ├── GlPipelineJobBuilders.java │ │ │ │ │ │ ├── GlPipelineJobDispatchResource.java │ │ │ │ │ │ └── GlPipelineJobType.java │ │ │ │ │ └── resource │ │ │ │ │ │ ├── GlPipelineResourceAccess.java │ │ │ │ │ │ ├── GlPipelineResourceDescription.java │ │ │ │ │ │ ├── GlPipelineResourceDescriptions.java │ │ │ │ │ │ └── GlPipelineResourceType.java │ │ │ │ ├── shader │ │ │ │ │ ├── GlBlitShader.java │ │ │ │ │ ├── GlShader.java │ │ │ │ │ ├── GlShaderProgram.java │ │ │ │ │ ├── ShaderCompileException.java │ │ │ │ │ └── uniform │ │ │ │ │ │ ├── GlShaderUniforms.java │ │ │ │ │ │ ├── ShaderBaseUniform.java │ │ │ │ │ │ ├── ShaderUniformBlock.java │ │ │ │ │ │ ├── ShaderUniformSamplerTexture.java │ │ │ │ │ │ └── ShaderUniformStorageTexture.java │ │ │ │ ├── texture │ │ │ │ │ ├── GlSampler.java │ │ │ │ │ ├── GlTexture1D.java │ │ │ │ │ ├── GlTexture2D.java │ │ │ │ │ └── GlTextureView.java │ │ │ │ ├── utils │ │ │ │ │ └── GlBlitRenderer.java │ │ │ │ └── vertex │ │ │ │ │ └── GlVertexBuffer.java │ │ │ ├── renderdoc │ │ │ │ ├── RenderDoc.java │ │ │ │ └── RenderdocLibrary.java │ │ │ ├── system │ │ │ │ ├── IRenderState.java │ │ │ │ └── IRenderSystem.java │ │ │ └── vulkan │ │ │ │ ├── VkRenderSystem.java │ │ │ │ ├── VulkanApplication.java │ │ │ │ ├── cmd │ │ │ │ └── VulkanCommandManager.java │ │ │ │ └── utils │ │ │ │ ├── VulkanCapabilities.java │ │ │ │ ├── VulkanException.java │ │ │ │ ├── VulkanUtils.java │ │ │ │ └── VulkanValidationLayers.java │ │ ├── impl │ │ │ ├── Destroyable.java │ │ │ ├── Pair.java │ │ │ ├── Resizable.java │ │ │ ├── Vec2.java │ │ │ ├── Vec3.java │ │ │ └── Vec4.java │ │ └── utils │ │ │ ├── ColorUtil.java │ │ │ ├── FileReadHelper.java │ │ │ ├── Md5CaculateUtil.java │ │ │ ├── MessageBox.java │ │ │ └── ShaderCompiler.java │ │ └── fsr2 │ │ ├── Fsr2Context.java │ │ ├── Fsr2ContextConfig.java │ │ ├── Fsr2ContextFlags.java │ │ ├── Fsr2Dimensions.java │ │ ├── Fsr2DispatchDescription.java │ │ ├── Fsr2PipelineDispatchResource.java │ │ ├── Fsr2PipelineResourceType.java │ │ ├── Fsr2PipelineResources.java │ │ ├── Fsr2PipelineResourcesDescription.java │ │ ├── Fsr2ResourceCreateDescription.java │ │ ├── Fsr2ShaderResource.java │ │ ├── Fsr2Utils.java │ │ ├── pipelines │ │ ├── Fsr2AccumulatePipeline.java │ │ ├── Fsr2AccumulateSharpenPipeline.java │ │ ├── Fsr2BasePipeline.java │ │ ├── Fsr2ComputeLuminancePyramidPipeline.java │ │ ├── Fsr2DepthClipPipeline.java │ │ ├── Fsr2GenerateReactivePipeline.java │ │ ├── Fsr2LockPipeline.java │ │ ├── Fsr2RCASPipeline.java │ │ ├── Fsr2ReconstructPreviousDepthPipeline.java │ │ └── Fsr2TcrAutogeneratePipeline.java │ │ └── struct │ │ ├── Fsr2CBFSR2.java │ │ ├── Fsr2CBRcas.java │ │ └── Fsr2CBSpd.java │ └── resources │ ├── assets │ └── super_resolution │ │ ├── lang │ │ ├── en_us.json │ │ └── zh_cn.json │ │ ├── logo.png │ │ ├── shaders │ │ ├── block_layer_opaque.fsh │ │ ├── block_layer_opaque.vsh │ │ ├── block_layer_opaque_1201.fsh │ │ └── block_layer_opaque_1201.vsh │ │ └── textures │ │ ├── coef1.png │ │ ├── coef2.png │ │ ├── coef_scaler.png │ │ ├── coef_usm.png │ │ └── logo.png │ ├── lib │ ├── libSuperResolution+android.so │ ├── libSuperResolution+linux64.so │ └── libSuperResolution+win64.dll │ ├── pack.mcmeta │ ├── shader │ ├── blit.frag.glsl │ ├── blit.vert.glsl │ ├── depth_to_r16f.frag.glsl │ ├── depth_to_r16f.vert.glsl │ ├── fsr1 │ │ ├── fsr1_common.glsl │ │ ├── fsr1_easu.comp.glsl │ │ ├── fsr1_easu_fp16.comp.glsl │ │ ├── fsr1_main.comp.glsl │ │ ├── fsr1_rcas.comp.glsl │ │ └── fsr1_rcas_fp16.comp.glsl │ ├── fsr2 │ │ ├── ffx_common_types.h │ │ ├── ffx_core.h │ │ ├── ffx_core_glsl.h │ │ ├── ffx_core_gpu_common.h │ │ ├── ffx_core_gpu_common_half.h │ │ ├── ffx_core_portability.h │ │ ├── ffx_fsr1.h │ │ ├── ffx_fsr2_accumulate.h │ │ ├── ffx_fsr2_accumulate_pass.glsl │ │ ├── ffx_fsr2_accumulate_pass.ogl.glsl │ │ ├── ffx_fsr2_autogen_reactive_pass.glsl │ │ ├── ffx_fsr2_autogen_reactive_pass.ogl.glsl │ │ ├── ffx_fsr2_callbacks_glsl.h │ │ ├── ffx_fsr2_callbacks_glsl2.h │ │ ├── ffx_fsr2_common.h │ │ ├── ffx_fsr2_compute_luminance_pyramid.h │ │ ├── ffx_fsr2_compute_luminance_pyramid_pass.glsl │ │ ├── ffx_fsr2_compute_luminance_pyramid_pass.ogl.glsl │ │ ├── ffx_fsr2_depth_clip.h │ │ ├── ffx_fsr2_depth_clip_pass.glsl │ │ ├── ffx_fsr2_depth_clip_pass.ogl.glsl │ │ ├── ffx_fsr2_lock.h │ │ ├── ffx_fsr2_lock_pass.glsl │ │ ├── ffx_fsr2_lock_pass.ogl.glsl │ │ ├── ffx_fsr2_postprocess_lock_status.h │ │ ├── ffx_fsr2_rcas.h │ │ ├── ffx_fsr2_rcas_pass.glsl │ │ ├── ffx_fsr2_rcas_pass.ogl.glsl │ │ ├── ffx_fsr2_reconstruct_dilated_velocity_and_previous_depth.h │ │ ├── ffx_fsr2_reconstruct_previous_depth_pass.glsl │ │ ├── ffx_fsr2_reconstruct_previous_depth_pass.ogl.glsl │ │ ├── ffx_fsr2_reproject.h │ │ ├── ffx_fsr2_resources.h │ │ ├── ffx_fsr2_sample.h │ │ ├── ffx_fsr2_tcr_autogen.h │ │ ├── ffx_fsr2_tcr_autogen_pass.glsl │ │ ├── ffx_fsr2_tcr_autogen_pass.ogl.glsl │ │ ├── ffx_fsr2_upsample.h │ │ └── ffx_spd.h │ ├── gui_blur │ │ ├── blur.frag.glsl │ │ └── blur.vert.glsl │ ├── include │ │ └── a.h │ ├── motion_vector │ │ ├── common.vert.glsl │ │ ├── pass1.frag.glsl │ │ ├── pass2.frag.glsl │ │ ├── pass3.frag.glsl │ │ └── preprocess.frag.glsl │ ├── nis │ │ ├── nis_scaler.comp.glsl │ │ └── nis_sharpen.comp.glsl │ ├── rg16f_to_rgb.frag.glsl │ ├── rg16f_to_rgb.vert.glsl │ └── sgsr │ │ ├── 2pass_cs │ │ ├── sgsr2_convert.comp.glsl │ │ └── sgsr2_upscale.comp.glsl │ │ ├── 2pass_fs │ │ ├── sgsr2_convert.frag.glsl │ │ ├── sgsr2_upscale.frag.glsl │ │ └── sgsr2_vertex.vert.glsl │ │ ├── 3pass_cs │ │ ├── sgsr2_activate.comp.glsl │ │ ├── sgsr2_convert.comp.glsl │ │ └── sgsr2_upscale.comp.glsl │ │ └── v1 │ │ ├── sgsr1_shader.frag.glsl │ │ └── sgsr1_shader.vert.glsl │ ├── super_resolution.accesswidener │ ├── super_resolution.mixins.json │ └── super_resolution_logo.png ├── docs ├── CHANGELOG_EN.md └── README_EN.md ├── fabric ├── build.gradle └── src │ └── main │ ├── java │ └── io │ │ └── homo │ │ └── superresolution │ │ └── fabric │ │ ├── SuperResolutionFabric.java │ │ ├── SuperResolutionFabricClient.java │ │ ├── compat │ │ ├── modmenu │ │ │ └── ModMenu.java │ │ └── sodium │ │ │ └── SodiumOptionScreen.java │ │ ├── mixin │ │ ├── compat │ │ │ ├── CompatMixinPlugin.java │ │ │ ├── iris │ │ │ │ └── GlFramebufferMixin.java │ │ │ ├── reesessodiumoptions │ │ │ │ └── TabFrameMixin.java │ │ │ ├── sodium │ │ │ │ ├── GraphicsAdapterProbeMixin.java │ │ │ │ └── SodiumOptionsGUIMixin.java │ │ │ └── sodiumoptionsapi │ │ │ │ └── SodiumOptionsTabFrameMixin.java │ │ └── core │ │ │ └── MinecraftMixin.java │ │ └── platform │ │ ├── FabricPlatform.java │ │ └── IrisFabricPlatform.java │ └── resources │ ├── assets │ └── super_resolution │ │ └── logo.png │ ├── fabric.mod.json │ ├── super_resolution-fabric-compat.mixins.json │ ├── super_resolution-fabric.mixins.json │ └── super_resolution.accesswidener ├── forge ├── build.gradle ├── gradle.properties └── src │ └── main │ ├── java │ └── io │ │ └── homo │ │ └── superresolution │ │ └── forge │ │ ├── SuperResolutionForge.java │ │ ├── compat │ │ └── sodium │ │ │ └── SodiumOptionScreen.java │ │ ├── mixin │ │ ├── compat │ │ │ ├── CompatMixinPlugin.java │ │ │ ├── embeddium │ │ │ │ ├── DefaultChunkRendererMixin.java │ │ │ │ ├── EmbeddiumOptionMixin.java │ │ │ │ └── ShaderChunkRendererMixin.java │ │ │ ├── oculus │ │ │ │ └── GlFramebufferMixin.java │ │ │ └── sodiumoptionsapi │ │ │ │ └── SodiumOptionsTabFrameMixin.java │ │ └── core │ │ │ └── MinecraftMixin.java │ │ └── platform │ │ ├── ForgePlatform.java │ │ └── IrisForgePlatform.java │ └── resources │ ├── META-INF │ ├── accesstransformer.cfg │ └── mods.toml │ ├── pack.mcmeta │ ├── super_resolution-forge-compat.mixins.json │ └── super_resolution-forge.mixins.json ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── libs ├── MixinSquared-0.2.0-beta.6.jar ├── antlr4-runtime-4.13.1.jar ├── crackerslib-forge-1.20.1-0.4.4.jar ├── fabric-api-base-0.4.31+ef105b4977.jar ├── fabric-api-base-0.4.42+d1308ded19.jar ├── fabric-block-view-api-v2-1.0.10+9afaaf8c19.jar ├── fabric-permissions-api-0.3.1.jar ├── fabric-renderer-api-v1-3.4.0+acb05a3919.jar ├── fabric-renderer-api-v1-5.0.0+babc52e504.jar ├── fabric-renderer-api-v1-6.0.0.jar ├── fabric-rendering-data-attachment-v1-0.3.48+73761d2e19.jar ├── glsl-transformer-2.0.1.jar ├── jcpp-1.4.14.jar ├── luaj-core-3.0.8-figura.jar ├── luaj-jse-3.0.8-figura.jar ├── mixinsquared-neoforge-0.2.0.jar ├── net.caffeinemc.sodium-neoforge-0.6.10+mc1.21.4-service.jar ├── net.caffeinemc.sodium-neoforge-0.6.12+mc1.21.5-service.jar └── net.caffeinemc.sodium-neoforge-0.6.5+mc1.21.1-service.jar ├── native ├── LICENSE_NATIVE ├── README.md ├── build.gradle └── cpp │ ├── CMakeLists.txt │ ├── glslang-commit-hash │ ├── include │ ├── define.h │ ├── jni_header.h │ └── utils.h │ ├── src │ ├── glslang.cpp │ ├── main.cpp │ └── utils.cpp │ └── third_party │ ├── JNI0.h │ ├── KHR │ └── khrplatform.h │ ├── glad.h │ ├── glfw3.h │ ├── glfw3native.h │ ├── glslang │ ├── Include │ │ ├── ResourceLimits.h │ │ ├── glslang_c_interface.h │ │ ├── glslang_c_shader_types.h │ │ └── visibility.h │ ├── MachineIndependent │ │ └── Versions.h │ ├── Public │ │ ├── ResourceLimits.h │ │ ├── ShaderLang.h │ │ └── resource_limits_c.h │ ├── SPIRV │ │ ├── GlslangToSpv.h │ │ ├── Logger.h │ │ ├── SPVRemapper.h │ │ ├── SpvTools.h │ │ ├── disassemble.h │ │ └── spirv.hpp11 │ └── build_info.h │ ├── jni_linux64.h │ ├── jni_md_linux64.h │ ├── jni_md_win64.h │ ├── jni_win64.h │ ├── libs │ ├── android │ │ ├── libGenericCodeGen.a │ │ ├── libMachineIndependent.a │ │ ├── libOSDependent.a │ │ ├── libSPIRV-Tools-diff.a │ │ ├── libSPIRV-Tools-link.a │ │ ├── libSPIRV-Tools-lint.a │ │ ├── libSPIRV-Tools-opt.a │ │ ├── libSPIRV-Tools-reduce.a │ │ ├── libSPIRV-Tools-shared.so │ │ ├── libSPIRV-Tools.a │ │ ├── libSPIRV.a │ │ ├── libSPVRemapper.a │ │ ├── libglslang-default-resource-limits.a │ │ └── libglslang.a │ ├── linux64 │ │ ├── libGenericCodeGen.a │ │ ├── libMachineIndependent.a │ │ ├── libOSDependent.a │ │ ├── libSPIRV-Tools-diff.a │ │ ├── libSPIRV-Tools-link.a │ │ ├── libSPIRV-Tools-lint.a │ │ ├── libSPIRV-Tools-opt.a │ │ ├── libSPIRV-Tools-reduce.a │ │ ├── libSPIRV-Tools-shared.so │ │ ├── libSPIRV-Tools.a │ │ ├── libSPIRV.a │ │ ├── libSPVRemapper.a │ │ ├── libglslang-default-resource-limits.a │ │ └── libglslang.a │ └── win64 │ │ ├── libGenericCodeGen.a │ │ ├── libMachineIndependent.a │ │ ├── libOSDependent.a │ │ ├── libSPIRV-Tools-diff.a │ │ ├── libSPIRV-Tools-link.a │ │ ├── libSPIRV-Tools-lint.a │ │ ├── libSPIRV-Tools-opt.a │ │ ├── libSPIRV-Tools-reduce.a │ │ ├── libSPIRV-Tools-shared.a │ │ ├── libSPIRV-Tools.a │ │ ├── libSPIRV.a │ │ ├── libSPVRemapper.a │ │ ├── libglslang-default-resource-limits.a │ │ └── libglslang.a │ ├── spirv-tools │ ├── libspirv.h │ ├── libspirv.hpp │ ├── linker.hpp │ └── optimizer.hpp │ ├── vk_video │ ├── vulkan_video_codec_av1std.h │ ├── vulkan_video_codec_av1std_decode.h │ ├── vulkan_video_codec_h264std.h │ ├── vulkan_video_codec_h264std_decode.h │ ├── vulkan_video_codec_h264std_encode.h │ ├── vulkan_video_codec_h265std.h │ ├── vulkan_video_codec_h265std_decode.h │ ├── vulkan_video_codec_h265std_encode.h │ └── vulkan_video_codecs_common.h │ └── vulkan │ ├── utility │ ├── vk_concurrent_unordered_map.hpp │ ├── vk_format_utils.h │ ├── vk_safe_struct.hpp │ ├── vk_safe_struct_utils.hpp │ ├── vk_small_containers.hpp │ └── vk_sparse_range_map.hpp │ ├── vk_enum_string_helper.h │ ├── vk_icd.h │ ├── vk_layer.h │ ├── vk_platform.h │ ├── vulkan.cppm │ ├── vulkan.h │ ├── vulkan.hpp │ ├── vulkan_android.h │ ├── vulkan_beta.h │ ├── vulkan_core.h │ ├── vulkan_directfb.h │ ├── vulkan_enums.hpp │ ├── vulkan_extension_inspection.hpp │ ├── vulkan_format_traits.hpp │ ├── vulkan_fuchsia.h │ ├── vulkan_funcs.hpp │ ├── vulkan_ggp.h │ ├── vulkan_handles.hpp │ ├── vulkan_hash.hpp │ ├── vulkan_hpp_macros.hpp │ ├── vulkan_ios.h │ ├── vulkan_macos.h │ ├── vulkan_metal.h │ ├── vulkan_profiles.hpp │ ├── vulkan_raii.hpp │ ├── vulkan_screen.h │ ├── vulkan_shared.hpp │ ├── vulkan_static_assertions.hpp │ ├── vulkan_structs.hpp │ ├── vulkan_to_string.hpp │ ├── vulkan_vi.h │ ├── vulkan_video.hpp │ ├── vulkan_wayland.h │ ├── vulkan_win32.h │ ├── vulkan_xcb.h │ ├── vulkan_xlib.h │ └── vulkan_xlib_xrandr.h ├── neoforge ├── build.gradle ├── gradle.properties └── src │ └── main │ ├── java │ └── io │ │ └── homo │ │ └── superresolution │ │ └── neoforge │ │ ├── SuperResolutionNeoForge.java │ │ ├── compat │ │ └── sodium │ │ │ └── SodiumOptionScreen.java │ │ ├── mixin │ │ ├── compat │ │ │ ├── CompatMixinPlugin.java │ │ │ ├── iris │ │ │ │ └── GlFramebufferMixin.java │ │ │ ├── reesessodiumoptions │ │ │ │ └── TabFrameMixin.java │ │ │ ├── sodium │ │ │ │ └── SodiumOptionsGUIMixin.java │ │ │ └── sodiumoptionsapi │ │ │ │ └── SodiumOptionsTabFrameMixin.java │ │ └── core │ │ │ └── MinecraftMixin.java │ │ └── platform │ │ ├── IrisNeoForgePlatform.java │ │ └── NeoForgePlatform.java │ └── resources │ ├── META-INF │ ├── accesstransformer.cfg │ └── neoforge.mods.toml │ ├── pack.mcmeta │ ├── super_resolution-neoforge-compat.mixins.json │ └── super_resolution-neoforge.mixins.json ├── renderdoc └── renderdoc.dll ├── script ├── buildAll.py ├── consts.py ├── uploadMcmod.py ├── uploadModrinth.py ├── uploader_mcmod.py ├── uploader_modrinth.py └── utils.py ├── settings.gradle └── versionConfigs ├── 1.20.1.json ├── 1.20.4.json ├── 1.21.1.json ├── 1.21.4.json └── 1.21.5.json /.github/workflows/Build_and_Upload.yml: -------------------------------------------------------------------------------- 1 | name: Build and Upload Artifacts 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | name: 7 | description: "name" 8 | required: true 9 | tag_name: 10 | description: "tag_name" 11 | required: true 12 | 13 | jobs: 14 | build: 15 | runs-on: windows-latest 16 | steps: 17 | - name: Checkout repository 18 | uses: actions/checkout@v4 19 | - name: Validate Gradle wrapper 20 | uses: gradle/actions/wrapper-validation@v4 21 | - name: Get CMake 22 | uses: symbitic/install-cmake@master 23 | - name: Set up MinGW 24 | uses: egor-tensin/setup-mingw@v2 25 | with: 26 | platform: x64 27 | static: 1 28 | version: 12.2.0 29 | - name: Setup JDK 21 30 | uses: actions/setup-java@v4 31 | with: 32 | java-version: 21 33 | distribution: temurin 34 | - uses: actions/setup-python@v5 35 | with: 36 | python-version: '3.10.5' 37 | 38 | - name: Setup Gradle 39 | uses: gradle/actions/setup-gradle@v4 40 | 41 | - name: Build 42 | id: build 43 | if: ${{ !cancelled() }} 44 | run: python script/buildAll.py 45 | 46 | - name: Upload Artifacts 47 | uses: softprops/action-gh-release@v2 48 | with: 49 | name: ${{ github.event.inputs.name }} 50 | tag_name: ${{ github.event.inputs.tag_name }} 51 | token: ${{ secrets.TOKEN }} 52 | body_path: ./CHANGELOG.md 53 | files: | 54 | ./build_jars/** 55 | ./CHANGELOG.md -------------------------------------------------------------------------------- /.github/workflows/gradle.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | push: 5 | branches: [ '*' ] 6 | 7 | jobs: 8 | build: 9 | if: ${{ !contains(github.event.head_commit.message, 'SKIP') }} 10 | runs-on: windows-latest 11 | steps: 12 | - name: Checkout repository 13 | uses: actions/checkout@v4 14 | - name: Validate Gradle wrapper 15 | uses: gradle/actions/wrapper-validation@v4 16 | - name: Get CMake 17 | uses: symbitic/install-cmake@master 18 | - name: Set up MinGW 19 | uses: egor-tensin/setup-mingw@v2 20 | with: 21 | platform: x64 22 | static: 1 23 | version: 12.2.0 24 | - name: Setup JDK 21 25 | uses: actions/setup-java@v4 26 | with: 27 | java-version: 21 28 | distribution: temurin 29 | - uses: actions/setup-python@v5 30 | with: 31 | python-version: '3.10.5' 32 | 33 | - name: Setup Gradle 34 | uses: gradle/actions/setup-gradle@v4 35 | 36 | - name: Build 37 | id: build 38 | if: ${{ !cancelled() }} 39 | run: python script/buildAll.py 40 | 41 | - name: Capture build artifacts 42 | uses: actions/upload-artifact@v4 43 | with: 44 | name: superresolution-build 45 | path: | 46 | build_jars/ -------------------------------------------------------------------------------- /TODO.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/TODO.md -------------------------------------------------------------------------------- /buildSrc/build.gradle: -------------------------------------------------------------------------------- 1 | // buildSrc/build.gradle 2 | plugins { 3 | id 'groovy' 4 | } 5 | 6 | repositories { 7 | mavenCentral() 8 | maven { url "https://jitpack.io" } 9 | } 10 | 11 | dependencies { 12 | implementation 'dev.masecla:Modrinth4J:2.2.0' 13 | implementation gradleApi() 14 | implementation localGroovy() 15 | 16 | } 17 | 18 | sourceSets { 19 | main { 20 | groovy { 21 | srcDirs = ['src/main/groovy'] 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /buildSrc/src/main/groovy/superresolution/BasePlatformConfig.groovy: -------------------------------------------------------------------------------- 1 | package superresolution 2 | 3 | class BasePlatformConfig { 4 | String loaderVersion 5 | Dependencies dependencies 6 | 7 | BasePlatformConfig(Map config) { 8 | this.loaderVersion = config.loader_version as String 9 | this.dependencies = new Dependencies(config.dependencies as Map) 10 | } 11 | } -------------------------------------------------------------------------------- /buildSrc/src/main/groovy/superresolution/CommonConfig.groovy: -------------------------------------------------------------------------------- 1 | package superresolution 2 | 3 | class CommonConfig { 4 | int javaVersion 5 | String minecraftVersion 6 | String parchmentVersion 7 | List platforms 8 | String lwjglVersion 9 | String architecturyApiVersion 10 | String clothConfigVersion 11 | String modArtifactMinecraftVer 12 | String forgeVersionRange 13 | String neoforgeVersionRange 14 | List fabricVersionRange 15 | 16 | CommonConfig(Map config) { 17 | this.javaVersion = config.java_version as Integer 18 | this.minecraftVersion = config.minecraft_version as String 19 | this.parchmentVersion = config.parchment_version as String 20 | this.platforms = config.platforms as List 21 | this.lwjglVersion = config.lwjgl_version as String 22 | this.architecturyApiVersion = config.architectury_api_version as String 23 | this.clothConfigVersion = config.cloth_config_version as String 24 | this.modArtifactMinecraftVer = config.mod_artifact_minecraft_ver as String 25 | if (config.forge != null) this.forgeVersionRange = config.forge.minecraft_version_range as String 26 | if (config.fabric != null) this.fabricVersionRange = config.fabric.minecraft_version_range as List 27 | if (config.neoforge != null) this.neoforgeVersionRange = config.neoforge.minecraft_version_range as String 28 | } 29 | } -------------------------------------------------------------------------------- /buildSrc/src/main/groovy/superresolution/Dependence.groovy: -------------------------------------------------------------------------------- 1 | package superresolution 2 | 3 | class Dependence { 4 | String name 5 | String version 6 | boolean isMod 7 | 8 | Dependence(Map lib) { 9 | this.name = lib.name as String 10 | this.version = lib.version ? lib.version as String : "" 11 | this.isMod = lib.isMod != null ? lib.isMod as Boolean : true 12 | } 13 | } -------------------------------------------------------------------------------- /buildSrc/src/main/groovy/superresolution/Dependencies.groovy: -------------------------------------------------------------------------------- 1 | package superresolution 2 | 3 | class Dependencies { 4 | List modrinth 5 | List local 6 | 7 | Dependencies(Map libs) { 8 | this.modrinth = libs.modrinth.collect { new Dependence(it as Map) } 9 | this.local = libs.local.collect { new Dependence(it as Map) } 10 | } 11 | } -------------------------------------------------------------------------------- /buildSrc/src/main/groovy/superresolution/FabricPlatformConfig.groovy: -------------------------------------------------------------------------------- 1 | package superresolution 2 | 3 | class FabricPlatformConfig extends BasePlatformConfig { 4 | String apiVersion 5 | String modmenuVersion 6 | 7 | FabricPlatformConfig(Map config) { 8 | super(config) 9 | this.apiVersion = config.api_version as String 10 | this.modmenuVersion = config.modmenu_version as String 11 | } 12 | } -------------------------------------------------------------------------------- /buildSrc/src/main/groovy/superresolution/ForgePlatformConfig.groovy: -------------------------------------------------------------------------------- 1 | package superresolution 2 | 3 | class ForgePlatformConfig extends BasePlatformConfig { 4 | ForgePlatformConfig(Map config) { 5 | super(config) 6 | } 7 | } -------------------------------------------------------------------------------- /buildSrc/src/main/groovy/superresolution/NeoForgePlatformConfig.groovy: -------------------------------------------------------------------------------- 1 | package superresolution 2 | 3 | class NeoForgePlatformConfig extends BasePlatformConfig { 4 | NeoForgePlatformConfig(Map config) { 5 | super(config) 6 | } 7 | } -------------------------------------------------------------------------------- /buildSrc/src/main/groovy/superresolution/VersionConfig.groovy: -------------------------------------------------------------------------------- 1 | package superresolution 2 | 3 | import groovy.json.JsonSlurper 4 | 5 | class VersionConfig { 6 | CommonConfig common 7 | FabricPlatformConfig fabric 8 | ForgePlatformConfig forge 9 | NeoForgePlatformConfig neoforge 10 | 11 | VersionConfig(Map json) { 12 | this.common = new CommonConfig(json.common as Map) 13 | if (json.fabric != null) this.fabric = new FabricPlatformConfig(json.fabric as Map) 14 | if (json.forge != null) this.forge = new ForgePlatformConfig(json.forge as Map) 15 | if (json.neoforge != null) this.neoforge = new NeoForgePlatformConfig(json.neoforge as Map) 16 | } 17 | 18 | static VersionConfig loadFromFile(File file) { 19 | def json = new JsonSlurper().parse(file) 20 | return new VersionConfig(json) 21 | } 22 | } -------------------------------------------------------------------------------- /common/build.gradle: -------------------------------------------------------------------------------- 1 | architectury { 2 | common(versionConfig.common.platforms) 3 | } 4 | 5 | dependencies { 6 | modImplementation "net.fabricmc:fabric-loader:$versionConfig.fabric.loaderVersion" 7 | modCompileOnly "dev.architectury:architectury:$versionConfig.common.architecturyApiVersion" 8 | modCompileOnly("me.shedaniel.cloth:cloth-config:$versionConfig.common.clothConfigVersion") 9 | implementation("io.github.spair:imgui-java-app:1.87.5") 10 | implementation("io.github.spair:imgui-java-binding:1.87.5") 11 | implementation("io.github.spair:imgui-java-lwjgl3:1.87.5") 12 | implementation "org.anarres:jcpp:1.4.14" 13 | if (enableVulkan) { 14 | implementation("org.lwjgl:lwjgl-vulkan:$versionConfig.common.lwjglVersion") 15 | } 16 | implementation('com.electronwill.night-config:toml:3.6.0') 17 | implementation('com.electronwill.night-config:core:3.6.0') 18 | } 19 | 20 | tasks.register("genJNIHeader", Exec) { 21 | workingDir(rootProject.projectDir) 22 | def outputDir = file("../native/cpp/include").absolutePath 23 | def sourceFile = file("src/main/java/io/homo/superresolution/core/SuperResolutionNative.java").absolutePath 24 | def sourceDirs = sourceSets.main.java.srcDirs.join(File.pathSeparator) 25 | def classpath = configurations.runtimeClasspath.asPath 26 | commandLine( 27 | "javac", 28 | "-h", outputDir, 29 | "-sourcepath", sourceDirs, 30 | "-classpath", classpath, 31 | "-encoding", "UTF-8", 32 | sourceFile 33 | ) 34 | 35 | doLast { 36 | delete(fileTree( 37 | dir: file("src/main/java").absolutePath, 38 | includes: ["**/*.class"], 39 | excludes: ["**/*.java"] 40 | 41 | )) 42 | } 43 | } -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/api/event/AlgorithmDispatchEvent.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.api.event; 2 | 3 | import io.homo.superresolution.api.AbstractAlgorithm; 4 | import io.homo.superresolution.common.upscale.DispatchResource; 5 | 6 | public interface AlgorithmDispatchEvent { 7 | Event EVENT = EventFactory.create( 8 | AlgorithmDispatchEvent.class, 9 | (listeners) -> (algorithm, dispatchResource) -> { 10 | for (AlgorithmDispatchEvent listener : listeners) { 11 | listener.onAlgorithmDispatch(algorithm, dispatchResource); 12 | } 13 | } 14 | ); 15 | 16 | void onAlgorithmDispatch(AbstractAlgorithm algorithm, DispatchResource dispatchResource); 17 | } 18 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/api/event/AlgorithmDispatchFinishEvent.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.api.event; 2 | 3 | import io.homo.superresolution.api.AbstractAlgorithm; 4 | import io.homo.superresolution.core.graphics.impl.texture.ITexture; 5 | 6 | public interface AlgorithmDispatchFinishEvent { 7 | Event EVENT = EventFactory.create( 8 | AlgorithmDispatchFinishEvent.class, 9 | (listeners) -> (algorithm, outputTexture) -> { 10 | for (AlgorithmDispatchFinishEvent listener : listeners) { 11 | listener.onAlgorithmDispatchFinish(algorithm, outputTexture); 12 | } 13 | } 14 | ); 15 | 16 | void onAlgorithmDispatchFinish(AbstractAlgorithm algorithm, ITexture outputTexture); 17 | } 18 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/api/event/AlgorithmRegisterEvent.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.api.event; 2 | 3 | public interface AlgorithmRegisterEvent { 4 | Event EVENT = EventFactory.create( 5 | AlgorithmRegisterEvent.class, 6 | (listeners) -> () -> { 7 | for (AlgorithmRegisterEvent listener : listeners) { 8 | listener.onAlgorithmRegister(); 9 | } 10 | } 11 | ); 12 | 13 | void onAlgorithmRegister(); 14 | } 15 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/api/event/AlgorithmResizeEvent.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.api.event; 2 | 3 | import io.homo.superresolution.api.AbstractAlgorithm; 4 | 5 | public interface AlgorithmResizeEvent { 6 | Event EVENT = EventFactory.create( 7 | AlgorithmResizeEvent.class, 8 | (listeners) -> (algorithm, screenWidth, screenHeight, renderWidth, renderHeight) -> { 9 | for (AlgorithmResizeEvent listener : listeners) { 10 | listener.onAlgorithmResize(algorithm, screenWidth, screenHeight, renderWidth, renderHeight); 11 | } 12 | } 13 | ); 14 | 15 | void onAlgorithmResize( 16 | AbstractAlgorithm algorithm, 17 | int screenWidth, int screenHeight, 18 | int renderWidth, int renderHeight 19 | ); 20 | } 21 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/api/event/Event.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.api.event; 2 | 3 | import java.lang.reflect.Array; 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | import java.util.function.Function; 7 | 8 | public class Event { 9 | private final Class listenerType; 10 | private final Function invokerFactory; 11 | private final List listeners = new ArrayList<>(); 12 | private T invoker; 13 | 14 | public Event(Class listenerType, Function invokerFactory) { 15 | this.listenerType = listenerType; 16 | this.invokerFactory = invokerFactory; 17 | updateInvoker(); 18 | } 19 | 20 | public void register(T listener) { 21 | listeners.add(listener); 22 | updateInvoker(); 23 | } 24 | 25 | public T invoker() { 26 | return invoker; 27 | } 28 | 29 | @SuppressWarnings("unchecked") 30 | private void updateInvoker() { 31 | T[] listenersArray = listeners.toArray((T[]) Array.newInstance(listenerType, 0)); 32 | invoker = invokerFactory.apply(listenersArray); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/api/event/EventFactory.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.api.event; 2 | 3 | import java.util.function.Function; 4 | 5 | public class EventFactory { 6 | public static Event create(Class listenerType, Function invokerFactory) { 7 | return new Event<>(listenerType, invokerFactory); 8 | } 9 | } -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/api/event/LevelRenderEndEvent.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.api.event; 2 | 3 | import io.homo.superresolution.api.AbstractAlgorithm; 4 | import io.homo.superresolution.common.upscale.DispatchResource; 5 | 6 | public interface LevelRenderEndEvent { 7 | Event EVENT = EventFactory.create( 8 | LevelRenderEndEvent.class, 9 | (listeners) -> () -> { 10 | for (LevelRenderEndEvent listener : listeners) { 11 | listener.onLevelRenderEnd(); 12 | } 13 | } 14 | ); 15 | 16 | void onLevelRenderEnd(); 17 | } 18 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/api/event/LevelRenderStartEvent.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.api.event; 2 | 3 | import io.homo.superresolution.api.AbstractAlgorithm; 4 | import io.homo.superresolution.common.upscale.DispatchResource; 5 | 6 | public interface LevelRenderStartEvent { 7 | Event EVENT = EventFactory.create( 8 | LevelRenderStartEvent.class, 9 | (listeners) -> () -> { 10 | for (LevelRenderStartEvent listener : listeners) { 11 | listener.onLevelRenderStart(); 12 | } 13 | } 14 | ); 15 | 16 | void onLevelRenderStart(); 17 | } 18 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/api/registry/AlgorithmRegistry.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.api.registry; 2 | 3 | import io.homo.superresolution.common.upscale.AlgorithmDescriptions; 4 | 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | 8 | public class AlgorithmRegistry { 9 | private static final Map> algorithmMap = new HashMap<>(); 10 | private static final Map> codeNameAlgorithmMap = new HashMap<>(); 11 | 12 | static { 13 | AlgorithmDescriptions.registryAlgorithms(); 14 | } 15 | 16 | public static void registry(AlgorithmDescription description) { 17 | algorithmMap.put(description.getUUID(), description); 18 | codeNameAlgorithmMap.put(description.getCodeName(), description); 19 | } 20 | 21 | public static Map> getAlgorithmMap() { 22 | return algorithmMap; 23 | } 24 | 25 | public static AlgorithmDescription getDescriptionByID(String id) { 26 | return codeNameAlgorithmMap.get(id); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/config/AlgorithmDescriptionSerializer.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.config; 2 | 3 | import com.google.gson.*; 4 | import io.homo.superresolution.api.registry.AlgorithmDescription; 5 | import io.homo.superresolution.api.registry.AlgorithmRegistry; 6 | 7 | import java.lang.reflect.Type; 8 | 9 | public class AlgorithmDescriptionSerializer implements JsonSerializer>, JsonDeserializer> { 10 | @Override 11 | public JsonElement serialize(AlgorithmDescription value, Type type, JsonSerializationContext context) { 12 | return new JsonPrimitive(value.codeName); 13 | } 14 | 15 | @Override 16 | public AlgorithmDescription deserialize(JsonElement json, Type type, JsonDeserializationContext context) { 17 | AlgorithmDescription description = AlgorithmRegistry.getDescriptionByID(json.getAsString()); 18 | return description == null ? AlgorithmRegistry.getDescriptionByID("fsr1") : description; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/config/ConfigSpecType.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.config; 2 | 3 | public enum ConfigSpecType { 4 | ENUM, FLOAT, STRING, BOOLEAN, OBJECT 5 | } 6 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/config/enums/CaptureMode.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.config.enums; 2 | 3 | import net.minecraft.network.chat.Component; 4 | 5 | import java.util.Arrays; 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | 9 | public enum CaptureMode { 10 | A(Component.translatable("superresolution.capture_mode.a")), //gameRenderer + noHand 11 | B(Component.translatable("superresolution.capture_mode.b")), //levelRenderer + noHand 12 | C(Component.translatable("superresolution.capture_mode.c")); //gameRenderer + hand 13 | public static final Map TEXT_MAP = new HashMap<>(); 14 | 15 | static { 16 | CaptureMode.TEXT_MAP.put("a", A); 17 | CaptureMode.TEXT_MAP.put("b", B); 18 | CaptureMode.TEXT_MAP.put("c", C); 19 | 20 | 21 | } 22 | 23 | private final Component tooltip; 24 | 25 | CaptureMode(Component tooltip) { 26 | this.tooltip = tooltip; 27 | } 28 | 29 | public static int getId(CaptureMode mode) { 30 | return Arrays.stream(CaptureMode.values()).toList().indexOf(mode); 31 | } 32 | 33 | public static CaptureMode getMode(int mode) { 34 | return Arrays.stream(CaptureMode.values()).toList().get(mode); 35 | } 36 | 37 | public static CaptureMode fromString(String string) { 38 | return TEXT_MAP.get(string.toLowerCase()); 39 | } 40 | 41 | public Component get() { 42 | return tooltip; 43 | } 44 | 45 | @Override 46 | public String toString() { 47 | return tooltip.getString(); 48 | } 49 | 50 | public String getString() { 51 | return this.toString(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/config/enums/SgsrVariant.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.config.enums; 2 | 3 | import net.minecraft.network.chat.Component; 4 | 5 | public enum SgsrVariant { 6 | 7 | CS_2(Component.translatable("superresolution.enum.sgsrvariant.cs_2")), 8 | CS_3(Component.translatable("superresolution.enum.sgsrvariant.cs_3")), 9 | FS_2(Component.translatable("superresolution.enum.sgsrvariant.fs_2")); 10 | private final Component tooltip; 11 | 12 | SgsrVariant(Component tooltip) { 13 | this.tooltip = tooltip; 14 | } 15 | 16 | public Component getComponent() { 17 | return tooltip; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/config/special/FSR1SpecialConfig.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.config.special; 2 | 3 | import io.homo.superresolution.common.config.ConfigSpecType; 4 | import net.minecraft.network.chat.Component; 5 | 6 | import java.util.Map; 7 | 8 | public class FSR1SpecialConfig extends SpecialConfig { 9 | public boolean fp16 = true; 10 | 11 | @Override 12 | protected void buildDescriptions(Map> map) { 13 | map.put( 14 | "fp16", 15 | new SpecialConfigDescription() 16 | .setValue(getSpecialConfigs().fsr1.fp16) 17 | .setKey("fp16") 18 | .setName(Component.translatable("superresolution.screen.config.special.fsr1.fp16.name")) 19 | .setTooltip(Component.translatable("superresolution.screen.config.special.fsr1.fp16.tooltip")) 20 | .setType(ConfigSpecType.BOOLEAN) 21 | .setSaveConsumer((v) -> getSpecialConfigs().fsr1.fp16 = v) 22 | .setDefaultValue(true) 23 | ); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/config/special/FSR2SpecialConfig.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.config.special; 2 | 3 | import java.util.Map; 4 | 5 | public class FSR2SpecialConfig extends SpecialConfig { 6 | @Override 7 | protected void buildDescriptions(Map> map) { 8 | 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/config/special/NISSpecialConfig.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.config.special; 2 | 3 | import java.util.Map; 4 | 5 | public class NISSpecialConfig extends SpecialConfig { 6 | @Override 7 | protected void buildDescriptions(Map> map) { 8 | 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/config/special/SGSR1SpecialConfig.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.config.special; 2 | 3 | import io.homo.superresolution.common.config.enums.SgsrVariant; 4 | import net.minecraft.network.chat.Component; 5 | 6 | import java.util.Map; 7 | 8 | public class SGSR1SpecialConfig extends SpecialConfig { 9 | 10 | @Override 11 | protected void buildDescriptions(Map> map) { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/config/special/SGSR2SpecialConfig.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.config.special; 2 | 3 | import io.homo.superresolution.common.config.ConfigSpecType; 4 | import io.homo.superresolution.common.config.enums.SgsrVariant; 5 | import net.minecraft.network.chat.Component; 6 | 7 | import java.util.Map; 8 | import java.util.Optional; 9 | 10 | public class SGSR2SpecialConfig extends SpecialConfig { 11 | public SgsrVariant variant = SgsrVariant.CS_2; 12 | 13 | @Override 14 | protected void buildDescriptions(Map> map) { 15 | map.put( 16 | "variant", 17 | new SpecialConfigDescription<>() 18 | .setValue(getSpecialConfigs().sgsr2.variant) 19 | .setDefaultValue(SgsrVariant.CS_2) 20 | .setNameSupplier((variant) -> switch ((SgsrVariant) variant) { 21 | case CS_2 -> Optional.of(Component.translatable("superresolution.enum.sgsrvariant.cs_2")); 22 | case CS_3 -> Optional.of(Component.translatable("superresolution.enum.sgsrvariant.cs_3")); 23 | case FS_2 -> Optional.of(Component.translatable("superresolution.enum.sgsrvariant.fs_2")); 24 | }) 25 | .setTooltip(Component.translatable("superresolution.screen.config.special.sgsr2.variant.tooltip")) 26 | .setKey("variant") 27 | .setSaveConsumer((v) -> getSpecialConfigs().sgsr2.variant = (SgsrVariant) v) 28 | .setType(ConfigSpecType.ENUM) 29 | .setClazz(SgsrVariant.class) 30 | ); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/config/special/SpecialConfig.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.config.special; 2 | 3 | import io.homo.superresolution.common.config.Config; 4 | 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | 8 | public abstract class SpecialConfig { 9 | public Map> getDescriptions() { 10 | Map> descriptions = new HashMap<>(); 11 | buildDescriptions(descriptions); 12 | return descriptions; 13 | } 14 | 15 | protected SpecialConfigs getSpecialConfigs() { 16 | return Config.getInstance().getSpecial(); 17 | } 18 | 19 | protected abstract void buildDescriptions(Map> map); 20 | } 21 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/config/special/SpecialConfigs.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.config.special; 2 | 3 | import io.homo.superresolution.core.impl.Pair; 4 | import io.homo.superresolution.common.upscale.AlgorithmDescriptions; 5 | 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | 9 | public class SpecialConfigs { 10 | public FSR1SpecialConfig fsr1 = new FSR1SpecialConfig(); 11 | public FSR2SpecialConfig fsr2 = new FSR2SpecialConfig(); 12 | public NISSpecialConfig nis = new NISSpecialConfig(); 13 | public SGSR2SpecialConfig sgsr2 = new SGSR2SpecialConfig(); 14 | public SGSR1SpecialConfig sgsr1 = new SGSR1SpecialConfig(); 15 | 16 | public transient Map> description = new HashMap<>(); 17 | 18 | public SpecialConfigs() { 19 | description.put("fsr1", Pair.of(fsr1, AlgorithmDescriptions.FSR1.getDisplayName())); 20 | description.put("fsr2", Pair.of(fsr2, AlgorithmDescriptions.FSR2.getDisplayName())); 21 | //description.put("nis", Pair.of(nis, AlgorithmDescriptions.NIS.getDisplayName())); 22 | description.put("sgsr2", Pair.of(sgsr2, AlgorithmDescriptions.SGSR2.getDisplayName())); 23 | description.put("sgsr1", Pair.of(sgsr1, AlgorithmDescriptions.SGSR1.getDisplayName())); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/debug/PerformanceInfo.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.debug; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | public class PerformanceInfo { 7 | private static final Map beginTimeMap = new HashMap<>(); 8 | private static final Map usingTimeMap = new HashMap<>(); 9 | 10 | 11 | public static long begin(String name) { 12 | beginTimeMap.put(name, System.nanoTime()); 13 | return beginTimeMap.get(name); 14 | } 15 | 16 | public static long end(String name) { 17 | usingTimeMap.put(name, System.nanoTime() - beginTimeMap.get(name)); 18 | return usingTimeMap.get(name); 19 | } 20 | 21 | public static long getAsNano(String name) { 22 | if (usingTimeMap.get(name) == null) return -1L; 23 | return usingTimeMap.get(name); 24 | } 25 | 26 | public static float getAsMillis(String name) { 27 | if (usingTimeMap.get(name) == null) return -1L; 28 | return (float) usingTimeMap.get(name) / 1000000L; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/gui/ScissorsHandler.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.gui; 2 | 3 | #if MC_VER < MC_1_21_4 4 | import java.util.List; 5 | #endif 6 | 7 | 8 | public class ScissorsHandler { 9 | #if MC_VER < MC_1_21_4 10 | public static void clearScissors() { 11 | me.shedaniel.clothconfig2.api.ScissorsHandler.INSTANCE.clearScissors(); 12 | } 13 | 14 | public static List getScissorsAreas() { 15 | //懒得实现了,留个坑 16 | return List.of(); 17 | } 18 | 19 | public static void scissor(Rectangle rectangle) { 20 | me.shedaniel.clothconfig2.api.ScissorsHandler.INSTANCE.scissor(new me.shedaniel.math.Rectangle(rectangle.x, rectangle.y, rectangle.width, rectangle.height)); 21 | 22 | } 23 | 24 | public static void removeLastScissor() { 25 | me.shedaniel.clothconfig2.api.ScissorsHandler.INSTANCE.removeLastScissor(); 26 | 27 | } 28 | 29 | public static void applyScissors() { 30 | me.shedaniel.clothconfig2.api.ScissorsHandler.INSTANCE.applyScissors(); 31 | } 32 | #endif 33 | } 34 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/gui/screens/ClothStyleInfoScreen.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.gui.screens; 2 | 3 | import io.homo.superresolution.common.config.Config; 4 | import me.shedaniel.clothconfig2.api.ConfigCategory; 5 | import net.minecraft.client.Minecraft; 6 | import net.minecraft.client.gui.GuiGraphics; 7 | import net.minecraft.client.gui.components.Button; 8 | import net.minecraft.client.gui.screens.Screen; 9 | import net.minecraft.network.chat.Component; 10 | import net.minecraft.resources.ResourceLocation; 11 | 12 | import java.util.Map; 13 | 14 | 15 | public class ClothStyleInfoScreen extends ClothStyleConfigScreen { 16 | public ClothStyleInfoScreen(Screen parent, Component title, Map categoryMap, ResourceLocation backgroundLocation) { 17 | super(parent, title, categoryMap, backgroundLocation); 18 | } 19 | 20 | @Override 21 | protected void init() { 22 | super.init(); 23 | this.removeWidget(exitButton); 24 | this.removeWidget(saveButton); 25 | cancelButton.setMessage(Component.translatable("superresolution.screen.button.label.return")); 26 | cancelButton.setX((width / 2) - (cancelButton.getWidth() / 2)); 27 | } 28 | 29 | @Override 30 | public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) { 31 | super.render(graphics, mouseX, mouseY, delta); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/minecraft/CallType.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.minecraft; 2 | 3 | public enum CallType { 4 | GAME_RENDERER, LEVEL_RENDERER 5 | } 6 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/minecraft/HandRenderTarget.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.minecraft; 2 | 3 | import io.homo.superresolution.core.graphics.opengl.framebuffer.GlFrameBuffer; 4 | import io.homo.superresolution.core.graphics.impl.framebuffer.IFrameBuffer; 5 | 6 | public class HandRenderTarget { 7 | public static IFrameBuffer handRenderTarget; 8 | 9 | public static IFrameBuffer getHandRenderTarget() { 10 | if (handRenderTarget == null) { 11 | handRenderTarget = GlFrameBuffer.create( 12 | MinecraftRenderHandle.getScreenWidth(), 13 | MinecraftRenderHandle.getScreenHeight() 14 | ); 15 | handRenderTarget.setClearColor(0, 0, 0, 0); 16 | handRenderTarget.resizeFrameBuffer( 17 | MinecraftRenderHandle.getScreenWidth(), 18 | MinecraftRenderHandle.getScreenHeight() 19 | ); 20 | handRenderTarget.clearFrameBuffer(); 21 | } 22 | return handRenderTarget; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/minecraft/MinecraftRenderTarget.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.minecraft; 2 | 3 | public class MinecraftRenderTarget extends LegacyStorageFrameBuffer { 4 | public MinecraftRenderTarget(boolean useDepth) { 5 | super(useDepth); 6 | } 7 | } -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/minecraft/MinecraftRenderTargetType.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.minecraft; 2 | 3 | import io.homo.superresolution.common.mixin.core.accessor.LevelRendererAccessor; 4 | import io.homo.superresolution.core.graphics.impl.framebuffer.IFrameBuffer; 5 | import net.minecraft.client.renderer.LevelRenderer; 6 | 7 | import java.util.function.Function; 8 | 9 | public enum MinecraftRenderTargetType { 10 | ENTITY((levelRenderer -> MinecraftRenderTargetWrapper.of(((LevelRendererAccessor) levelRenderer).getEntityRenderTarget()))), 11 | TRANSLUCENT((levelRenderer -> MinecraftRenderTargetWrapper.of(levelRenderer.getTranslucentTarget()))), 12 | ITEM_ENTITY((levelRenderer -> MinecraftRenderTargetWrapper.of(levelRenderer.getItemEntityTarget()))), 13 | PARTICLES((levelRenderer -> MinecraftRenderTargetWrapper.of(levelRenderer.getParticlesTarget()))), 14 | WEATHER((levelRenderer -> MinecraftRenderTargetWrapper.of(levelRenderer.getWeatherTarget()))), 15 | CLOUDS((levelRenderer -> MinecraftRenderTargetWrapper.of(levelRenderer.getCloudsTarget()))), 16 | HAND((levelRenderer) -> HandRenderTarget.getHandRenderTarget()); 17 | 18 | private final Function callback; 19 | 20 | MinecraftRenderTargetType(Function callback) { 21 | this.callback = callback; 22 | } 23 | 24 | public IFrameBuffer get(LevelRenderer levelRenderer) { 25 | return callback.apply(levelRenderer); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/minecraft/MinecraftRenderTargetUtil.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.minecraft; 2 | 3 | 4 | import com.mojang.blaze3d.pipeline.RenderTarget; 5 | 6 | #if MC_VER > MC_1_21_4 7 | import com.mojang.blaze3d.opengl.GlDevice; 8 | import com.mojang.blaze3d.opengl.GlTexture; 9 | import com.mojang.blaze3d.systems.RenderSystem; 10 | 11 | import java.util.Objects; 12 | 13 | public class MinecraftRenderTargetUtil { 14 | public static int getFboId(RenderTarget renderTarget) { 15 | return ((GlTexture) Objects.requireNonNull(renderTarget.getColorTexture())).getFbo(((GlDevice) RenderSystem.getDevice()).directStateAccess(), renderTarget.getDepthTexture()); 16 | } 17 | 18 | public static int getColorTexId(RenderTarget renderTarget) { 19 | return ((GlTexture) Objects.requireNonNull(renderTarget.getColorTexture())).glId(); 20 | } 21 | 22 | public static int getDepthTexId(RenderTarget renderTarget) { 23 | return ((GlTexture) Objects.requireNonNull(renderTarget.getDepthTexture())).glId(); 24 | } 25 | } 26 | #else 27 | public class MinecraftRenderTargetUtil { 28 | public static int getFboId(RenderTarget renderTarget) { 29 | return renderTarget.frameBufferId; 30 | } 31 | 32 | public static int getColorTexId(RenderTarget renderTarget) { 33 | return renderTarget.getColorTextureId(); 34 | } 35 | 36 | public static int getDepthTexId(RenderTarget renderTarget) { 37 | return renderTarget.getDepthTextureId(); 38 | } 39 | } 40 | #endif -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/minecraft/RenderTargetCache.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.minecraft; 2 | 3 | import io.homo.superresolution.core.graphics.impl.framebuffer.IFrameBuffer; 4 | 5 | import java.util.*; 6 | 7 | public class RenderTargetCache { 8 | private static final Map cached = new HashMap<>(); 9 | 10 | public static FrameBufferRenderTargetAdapter cacheOf(IFrameBuffer frameBuffer) { 11 | if (cached.get(frameBuffer) == null) { 12 | FrameBufferRenderTargetAdapter renderTarget = FrameBufferRenderTargetAdapter.ofRenderTarget(frameBuffer); 13 | cached.put(frameBuffer, renderTarget); 14 | return renderTarget; 15 | } else { 16 | return cached.get(frameBuffer).bindFrameBuffer(frameBuffer); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/mixin/core/ForceOpenGLVersion_WindowMixin.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.mixin.core; 2 | 3 | import com.mojang.blaze3d.platform.Window; 4 | import io.homo.superresolution.core.graphics.GraphicsCapabilities; 5 | import org.lwjgl.glfw.GLFW; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Redirect; 9 | 10 | import static org.lwjgl.glfw.GLFW.*; 11 | 12 | @Mixin(value = Window.class) 13 | public class ForceOpenGLVersion_WindowMixin { 14 | @Redirect(method = "", at = @At(value = "INVOKE", target = "Lorg/lwjgl/glfw/GLFW;glfwWindowHint(II)V", ordinal = 5), remap = false) 15 | private void forceOpenGLVersion(int hint, int value) { 16 | glfwWindowHint(GLFW.GLFW_CONTEXT_VERSION_MAJOR, GraphicsCapabilities.getHighestOpenGLVersion().left()); 17 | glfwWindowHint(GLFW.GLFW_CONTEXT_VERSION_MINOR, GraphicsCapabilities.getHighestOpenGLVersion().right()); 18 | glfwWindowHint(hint, value); 19 | } 20 | } -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/mixin/core/GLXMixin.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.mixin.core; 2 | 3 | import com.mojang.blaze3d.platform.GLX; 4 | import io.homo.superresolution.core.graphics.GraphicsCapabilities; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 9 | 10 | import java.util.function.LongSupplier; 11 | 12 | @Mixin(value = GLX.class) 13 | public class GLXMixin { 14 | @Inject(method = "_initGlfw", at = @At(value = "RETURN"), remap = false) 15 | private static void detectSupportedVersions(CallbackInfoReturnable cir) { 16 | GraphicsCapabilities.detectSupportedVersions(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/mixin/core/OptionsMixin.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.mixin.core; 2 | 3 | import io.homo.superresolution.common.config.Config; 4 | import io.homo.superresolution.common.mixin.core.accessor.OptionInstanceAccessor; 5 | import net.minecraft.client.GraphicsStatus; 6 | import net.minecraft.client.OptionInstance; 7 | import net.minecraft.client.Options; 8 | import org.spongepowered.asm.mixin.Final; 9 | import org.spongepowered.asm.mixin.Mixin; 10 | import org.spongepowered.asm.mixin.Shadow; 11 | import org.spongepowered.asm.mixin.injection.At; 12 | import org.spongepowered.asm.mixin.injection.Inject; 13 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 14 | 15 | @Mixin(Options.class) 16 | public class OptionsMixin { 17 | @Final 18 | @Shadow 19 | private OptionInstance graphicsMode; 20 | 21 | @Inject(method = "graphicsMode", at = @At("TAIL")) 22 | private void overwriteGraphicsMode(CallbackInfoReturnable> cir) { 23 | if (((GraphicsStatus) (((OptionInstanceAccessor) (Object) cir.getReturnValue()).getValue())).getId() == 2) { 24 | graphicsMode.set(GraphicsStatus.FANCY); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/mixin/core/accessor/LevelRendererAccessor.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.mixin.core.accessor; 2 | 3 | 4 | import com.mojang.blaze3d.pipeline.RenderTarget; 5 | import net.minecraft.client.renderer.LevelRenderer; 6 | import net.minecraft.client.renderer.PostChain; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.gen.Accessor; 9 | 10 | @Mixin(LevelRenderer.class) 11 | public interface LevelRendererAccessor { 12 | #if MC_VER < MC_1_21_4 13 | @Accessor(value = "entityEffect") 14 | PostChain getEntityEffect(); 15 | 16 | #endif 17 | #if MC_VER < MC_1_21_4 18 | @Accessor(value = "entityTarget") 19 | #else 20 | @Accessor(value = "entityOutlineTarget") 21 | #endif 22 | RenderTarget getEntityRenderTarget(); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/mixin/core/accessor/MinecraftAccessor.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.mixin.core.accessor; 2 | 3 | import com.mojang.blaze3d.pipeline.RenderTarget; 4 | import net.minecraft.client.Minecraft; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Mutable; 7 | import org.spongepowered.asm.mixin.gen.Accessor; 8 | 9 | @Mixin(value = Minecraft.class) 10 | public interface MinecraftAccessor { 11 | @Mutable 12 | @Accessor(value = "mainRenderTarget") 13 | void setRenderTarget(RenderTarget renderTarget); 14 | } 15 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/mixin/core/accessor/OptionInstanceAccessor.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.mixin.core.accessor; 2 | 3 | import net.minecraft.client.OptionInstance; 4 | import net.minecraft.client.Options; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | @Mixin(OptionInstance.class) 9 | public interface OptionInstanceAccessor { 10 | @Accessor(value = "value") 11 | Object getValue(); 12 | } 13 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/mixin/core/accessor/PostChainAccessor.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.mixin.core.accessor; 2 | 3 | import com.mojang.blaze3d.pipeline.RenderTarget; 4 | import net.minecraft.client.renderer.PostChain; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Mutable; 7 | import org.spongepowered.asm.mixin.gen.Accessor; 8 | 9 | import java.util.List; 10 | 11 | @Mixin(value = PostChain.class) 12 | public interface PostChainAccessor { 13 | #if MC_VER < MC_1_21_4 14 | @Mutable 15 | @Accessor(value = "screenTarget") 16 | void setScreenTarget(RenderTarget screenTarget); 17 | 18 | @Mutable 19 | @Accessor(value = "fullSizedTargets") 20 | List getFullSizedTargets(); 21 | 22 | @Mutable 23 | @Accessor(value = "screenWidth") 24 | int getScreenWidth(); 25 | 26 | @Mutable 27 | @Accessor(value = "screenHeight") 28 | int getScreenHeight(); 29 | #endif 30 | } 31 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/mixin/debug/ImguiMixin.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.mixin.debug; 2 | 3 | import io.homo.superresolution.common.debug.imgui.ImguiMain; 4 | import net.minecraft.client.Minecraft; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(Minecraft.class) 11 | public class ImguiMixin { 12 | #if MC_VER < MC_1_21_5 13 | @Inject(at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/pipeline/RenderTarget;unbindWrite()V"), method = "runTick") 14 | private void onRender(CallbackInfo ci) { 15 | if (ImguiMain.getInstance() != null) { 16 | ImguiMain.getInstance().render(); 17 | } 18 | } 19 | #else 20 | @Inject(at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/pipeline/RenderTarget;blitToScreen()V"), method = "runTick") 21 | private void onRender(CallbackInfo ci) { 22 | if (ImguiMain.getInstance() != null) { 23 | ImguiMain.getInstance().render(); 24 | } 25 | } 26 | #endif 27 | 28 | @Inject(at = @At(value = "HEAD"), method = "close") 29 | private void onExit(CallbackInfo ci) { 30 | if (ImguiMain.getInstance() != null) { 31 | ImguiMain.getInstance().destroy(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/mixin/debug/KeyboardHandlerMixin.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.mixin.debug; 2 | 3 | import net.minecraft.client.KeyboardHandler; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | 6 | import static org.apache.commons.io.FileUtils.getFile; 7 | 8 | @Mixin(KeyboardHandler.class) 9 | public class KeyboardHandlerMixin { 10 | } 11 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/mixin/gui/AbstractWidgetAccessor.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.mixin.gui; 2 | 3 | import net.minecraft.client.gui.components.AbstractWidget; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Accessor; 6 | 7 | //sz麻将,明明可以改高度却不肯加个方法 8 | @Mixin(AbstractWidget.class) 9 | public interface AbstractWidgetAccessor { 10 | @Accessor("height") 11 | void setHeight_(int height); 12 | } 13 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/mixin/gui/GameRendererAccessor.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.mixin.gui; 2 | 3 | import net.minecraft.client.renderer.GameRenderer; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | 6 | @Mixin(GameRenderer.class) 7 | public interface GameRendererAccessor { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/platform/Arch.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.platform; 2 | 3 | import com.sun.jna.Platform; 4 | import net.minecraft.network.chat.Component; 5 | 6 | public enum Arch { 7 | AARCH64("aarch64"), 8 | ARM32("arm"), 9 | X86_64("x86-64"), 10 | X86("x86"), 11 | ANY("&^*"); 12 | 13 | private final String platformArch; 14 | 15 | Arch(String platformArch) { 16 | this.platformArch = platformArch; 17 | } 18 | 19 | public static Arch get() { 20 | String arch = Platform.ARCH; 21 | for (Arch a : values()) { 22 | if (a != ANY && a.platformArch.equals(arch)) { 23 | return a; 24 | } 25 | } 26 | return ANY; 27 | } 28 | 29 | public boolean equals(Arch arch) { 30 | return arch == ANY || Arch.get() == arch; 31 | } 32 | 33 | public String getString() { 34 | return switch (this) { 35 | case AARCH64 -> "aarch64"; 36 | case ARM32 -> "arm32"; 37 | case X86_64 -> "x64"; 38 | case X86 -> "x32"; 39 | case ANY -> Component.translatable("superresolution.requirement.os.any").getString(); 40 | }; 41 | } 42 | } -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/platform/EnvType.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.platform; 2 | 3 | public enum EnvType { 4 | CLIENT, SERVER 5 | } 6 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/platform/IrisPlatform.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.platform; 2 | 3 | public abstract class IrisPlatform { 4 | public abstract boolean isShaderPackInUse(); 5 | } 6 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/platform/OS.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.platform; 2 | 3 | import net.minecraft.network.chat.Component; 4 | 5 | public class OS { 6 | public static OS any = new OS(Arch.ANY, OSType.ANY); 7 | public Arch arch; 8 | public OSType type; 9 | 10 | public OS() { 11 | type = OSType.get(); 12 | arch = Arch.get(); 13 | } 14 | 15 | public OS(Arch arch, OSType type) { 16 | this.type = type; 17 | this.arch = arch; 18 | } 19 | 20 | public String getString() { 21 | if (any.equals(this)) return Component.translatable("superresolution.requirement.os.any").getString(); 22 | return "%s %s:%s".formatted( 23 | type.getString(), 24 | Component.translatable("superresolution.requirement.os.arch").getString(), 25 | arch.getString() 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/platform/OSType.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.platform; 2 | 3 | import com.sun.jna.Platform; 4 | import io.homo.superresolution.common.SuperResolution; 5 | import net.minecraft.network.chat.Component; 6 | 7 | public enum OSType { 8 | ANDROID(Platform.ANDROID == Platform.getOSType()), 9 | LINUX(Platform.LINUX == Platform.getOSType()), 10 | WINDOWS(Platform.WINDOWS == Platform.getOSType()), 11 | MACOS(Platform.MAC == Platform.getOSType()), 12 | ANY(true); 13 | 14 | private final boolean isCurrentOS; 15 | 16 | OSType(boolean isCurrentOS) { 17 | this.isCurrentOS = isCurrentOS; 18 | } 19 | 20 | public static OSType get() { 21 | if (ANDROID.isCurrentOS || System.getenv("POJAV_RENDERER") != null) { 22 | return ANDROID; 23 | } else if (LINUX.isCurrentOS) { 24 | return LINUX; 25 | } else if (WINDOWS.isCurrentOS) { 26 | return WINDOWS; 27 | } else if (MACOS.isCurrentOS) { 28 | return MACOS; 29 | } else { 30 | return ANY; 31 | } 32 | } 33 | 34 | public static boolean isCurrentOS(OSType osType) { 35 | return osType.isCurrentOS; 36 | } 37 | 38 | public boolean equals(OSType type) { 39 | return type == ANY || OSType.get() == type; 40 | } 41 | 42 | public String getString() { 43 | return switch (this) { 44 | case ANDROID -> "Android"; 45 | case LINUX -> "Linux"; 46 | case WINDOWS -> "Windows"; 47 | case MACOS -> "MacOS"; 48 | case ANY -> Component.translatable("superresolution.requirement.os.any").getString(); 49 | }; 50 | } 51 | } -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/platform/Platform.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.platform; 2 | 3 | import net.fabricmc.loader.api.FabricLoader; 4 | import net.minecraft.SharedConstants; 5 | 6 | import java.nio.file.Path; 7 | 8 | public abstract class Platform { 9 | public static Platform currentPlatform = null; 10 | private static Boolean isInstallIris = null; 11 | protected IrisPlatform irisPlatform = null; 12 | 13 | public abstract boolean isModLoaded(String modId); 14 | 15 | public abstract boolean isDevelopmentEnvironment(); 16 | 17 | public abstract String getModVersionString(String modId); 18 | 19 | public OS getOS() { 20 | return new OS(); 21 | } 22 | 23 | public abstract EnvType getEnv(); 24 | 25 | public abstract Path getGameFolder(); 26 | 27 | public IrisPlatform iris() { 28 | return irisPlatform; 29 | } 30 | 31 | public abstract void init(); 32 | 33 | public boolean isInstallIris() { 34 | if (isInstallIris == null) 35 | 36 | isInstallIris = currentPlatform.isModLoaded("iris") || currentPlatform.isModLoaded("oculus"); 37 | return isInstallIris; 38 | } 39 | 40 | public String getMinecraftVersion() { 41 | return SharedConstants.VERSION_STRING; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/upscale/DispatchResource.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.upscale; 2 | 3 | import io.homo.superresolution.core.impl.Vec2; 4 | import io.homo.superresolution.core.graphics.opengl.framebuffer.GlFrameBuffer; 5 | import org.joml.Matrix4f; 6 | 7 | public record DispatchResource( 8 | int renderWidth, 9 | int renderHeight, 10 | Vec2 renderSize, 11 | 12 | int screenWidth, 13 | int screenHeight, 14 | Vec2 screenSize, 15 | 16 | int frameCount, 17 | float frameTimeDelta, 18 | 19 | float verticalFov, 20 | float horizontalFov, 21 | 22 | float cameraNear, 23 | float cameraFar, 24 | 25 | Matrix4f modelViewMatrix, 26 | Matrix4f projectionMatrix, 27 | Matrix4f modelViewProjectionMatrix, 28 | Matrix4f viewMatrix, 29 | 30 | Matrix4f lastModelViewMatrix, 31 | Matrix4f lastProjectionMatrix, 32 | Matrix4f lastModelViewProjectionMatrix, 33 | Matrix4f lastViewMatrix, 34 | 35 | GlFrameBuffer motionVectors 36 | ) { 37 | } 38 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/upscale/nis/enums/NISGPUArchitecture.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.upscale.nis.enums; 2 | 3 | public enum NISGPUArchitecture { 4 | NVIDIA_Generic(0), 5 | AMD_Generic(1), 6 | Intel_Generic(2), 7 | NVIDIA_Generic_fp16(3); 8 | private final int value; 9 | NISGPUArchitecture(int value) { 10 | this.value = value; 11 | } 12 | public int getValue() { 13 | return value; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/upscale/nis/enums/NISHDRMode.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.upscale.nis.enums; 2 | 3 | public enum NISHDRMode { 4 | None(0), 5 | Linear(1), 6 | PQ(2); 7 | private final int value; 8 | NISHDRMode(int value) { 9 | this.value = value; 10 | } 11 | public int getValue() { 12 | return value; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/upscale/nis/struct/NISConfig.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.upscale.nis.struct; 2 | 3 | public class NISConfig { 4 | public static final int SIZE = 256; 5 | public float kDetectRatio; 6 | public float kDetectThres; 7 | public float kMinContrastRatio; 8 | public float kRatioNorm; 9 | public float kContrastBoost; 10 | public float kEps; 11 | public float kSharpStartY; 12 | public float kSharpScaleY; 13 | public float kSharpStrengthMin; 14 | public float kSharpStrengthScale; 15 | public float kSharpLimitMin; 16 | public float kSharpLimitScale; 17 | public float kScaleX; 18 | public float kScaleY; 19 | public float kDstNormX; 20 | public float kDstNormY; 21 | public float kSrcNormX; 22 | public float kSrcNormY; 23 | public int kInputViewportOriginX; 24 | public int kInputViewportOriginY; 25 | public int kInputViewportWidth; 26 | public int kInputViewportHeight; 27 | public int kOutputViewportOriginX; 28 | public int kOutputViewportOriginY; 29 | public int kOutputViewportWidth; 30 | public int kOutputViewportHeight; 31 | public float reserved0; 32 | public float reserved1; 33 | } -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/upscale/nis/struct/NISOptimizer.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.upscale.nis.struct; 2 | 3 | import io.homo.superresolution.common.upscale.nis.enums.NISGPUArchitecture; 4 | 5 | public class NISOptimizer { 6 | private boolean isUpscaling; 7 | private NISGPUArchitecture gpuArch; 8 | public int getOptimalBlockWidth() { 9 | switch (gpuArch) { 10 | case NVIDIA_Generic: 11 | case NVIDIA_Generic_fp16: 12 | case AMD_Generic: 13 | case Intel_Generic: 14 | return 32; 15 | default: 16 | return 32; 17 | } 18 | } 19 | 20 | public int getOptimalBlockHeight() { 21 | switch (gpuArch) { 22 | case NVIDIA_Generic: 23 | return isUpscaling ? 24 : 32; 24 | case NVIDIA_Generic_fp16: 25 | return 32; 26 | case AMD_Generic: 27 | return isUpscaling ? 24 : 32; 28 | case Intel_Generic: 29 | return isUpscaling ? 24 : 32; 30 | default: 31 | return isUpscaling ? 24 : 32; 32 | } 33 | } 34 | 35 | public int getOptimalThreadGroupSize() { 36 | switch (gpuArch) { 37 | case NVIDIA_Generic: 38 | case NVIDIA_Generic_fp16: 39 | return 128; 40 | case AMD_Generic: 41 | case Intel_Generic: 42 | return 256; 43 | default: 44 | return 256; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/upscale/none/None.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.upscale.none; 2 | 3 | import io.homo.superresolution.common.minecraft.MinecraftRenderHandle; 4 | import io.homo.superresolution.core.graphics.impl.framebuffer.FrameBufferAttachmentType; 5 | import io.homo.superresolution.api.AbstractAlgorithm; 6 | import io.homo.superresolution.common.upscale.DispatchResource; 7 | import io.homo.superresolution.core.graphics.impl.framebuffer.IFrameBuffer; 8 | 9 | public class None extends AbstractAlgorithm { 10 | @Override 11 | public void init() { 12 | input = null; 13 | output = null; 14 | } 15 | 16 | @Override 17 | public boolean dispatch(DispatchResource dispatchResource) { 18 | return true; 19 | } 20 | 21 | public void resize(int width, int height) { 22 | } 23 | 24 | public void destroy() { 25 | } 26 | 27 | public int getInputTextureId() { 28 | return MinecraftRenderHandle.getRenderTarget().getTextureId(FrameBufferAttachmentType.COLOR); 29 | } 30 | 31 | public int getOutputTextureId() { 32 | return MinecraftRenderHandle.getRenderTarget().getTextureId(FrameBufferAttachmentType.COLOR); 33 | } 34 | 35 | @Override 36 | public IFrameBuffer getInputFrameBuffer() { 37 | return MinecraftRenderHandle.getRenderTarget(); 38 | } 39 | 40 | @Override 41 | public IFrameBuffer getOutputFrameBuffer() { 42 | return MinecraftRenderHandle.getRenderTarget(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/upscale/sgsr/v2/AbstractSgsrVariant.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.upscale.sgsr.v2; 2 | 3 | import io.homo.superresolution.core.impl.Destroyable; 4 | import io.homo.superresolution.core.impl.Resizable; 5 | import io.homo.superresolution.core.graphics.impl.framebuffer.IFrameBuffer; 6 | import io.homo.superresolution.common.upscale.DispatchResource; 7 | 8 | public abstract class AbstractSgsrVariant implements Resizable, Destroyable { 9 | protected IFrameBuffer output; 10 | 11 | public void setOutput(IFrameBuffer output) { 12 | this.output = output; 13 | } 14 | 15 | public abstract void dispatch(DispatchResource resource, Sgsr2 sgsr); 16 | 17 | public abstract void init(Sgsr2 sgsr); 18 | } 19 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/upscale/sgsr/v2/SgsrUtils.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.upscale.sgsr.v2; 2 | 3 | public class SgsrUtils { 4 | public static int divideRoundUp(int dividend, int divisor) { 5 | return (dividend + divisor - 1) / divisor; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/common/upscale/sgsr/v2/variants/Sgsr2PassFragment.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.common.upscale.sgsr.v2.variants; 2 | 3 | import io.homo.superresolution.common.upscale.DispatchResource; 4 | import io.homo.superresolution.common.upscale.sgsr.v2.AbstractSgsrVariant; 5 | import io.homo.superresolution.common.upscale.sgsr.v2.Sgsr2; 6 | 7 | public class Sgsr2PassFragment extends AbstractSgsrVariant { 8 | @Override 9 | public void dispatch(DispatchResource resource, Sgsr2 sgsr) { 10 | 11 | } 12 | 13 | @Override 14 | public void init(Sgsr2 sgsr) { 15 | 16 | } 17 | 18 | @Override 19 | public void destroy() { 20 | 21 | } 22 | 23 | @Override 24 | public void resize(int width, int height) { 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/RenderSystems.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core; 2 | 3 | import io.homo.superresolution.common.config.Config; 4 | import io.homo.superresolution.core.graphics.opengl.GlRenderSystem; 5 | import io.homo.superresolution.core.graphics.vulkan.VkRenderSystem; 6 | 7 | public class RenderSystems { 8 | private static VkRenderSystem vulkan; 9 | private static GlRenderSystem opengl; 10 | 11 | public static void init() { 12 | opengl = new GlRenderSystem(); 13 | if (!Config.isSkipInitVulkan()) { 14 | vulkan = new VkRenderSystem(); 15 | //vulkan.initRenderSystem(); 16 | } 17 | opengl.initRenderSystem(); 18 | } 19 | 20 | public static GlRenderSystem opengl() { 21 | return opengl; 22 | } 23 | 24 | public static VkRenderSystem vulkan() { 25 | return vulkan; 26 | } 27 | 28 | public static GlRenderSystem current() { 29 | return opengl; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/SuperResolutionNative.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core; 2 | 3 | import io.homo.superresolution.core.graphics.glslang.GlslangCompileShaderResult; 4 | 5 | import java.nio.ByteBuffer; 6 | 7 | 8 | public class SuperResolutionNative { 9 | public static native String getVersionInfo(); 10 | 11 | public static native GlslangCompileShaderResult compileShaderToSpirv( 12 | String shaderSrc, 13 | int stage, 14 | int language, 15 | int client, 16 | int client_version, 17 | int target_language, 18 | int target_language_version, 19 | int default_version, 20 | int default_profile, 21 | boolean force_default_version_and_profile, 22 | boolean forward_compatible 23 | ); 24 | 25 | public static native void freeDirectBuffer(ByteBuffer buffer); 26 | 27 | public static native int initGlslang(); 28 | 29 | public static native int destroyGlslang(); 30 | } 31 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/SuperResolutionNativeHelper.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core; 2 | 3 | import org.lwjgl.glfw.GLFW; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | 7 | public class SuperResolutionNativeHelper { 8 | public static final Logger LOGGER_CPP = LoggerFactory.getLogger("SuperResolution-Native"); 9 | 10 | public static void CPP_Log(String msg, int level) { 11 | switch (level) { 12 | case 0 -> LOGGER_CPP.info(msg); 13 | case 1 -> LOGGER_CPP.warn(msg); 14 | case 2 -> LOGGER_CPP.error(msg); 15 | case 3 -> LOGGER_CPP.debug(msg); 16 | } 17 | } 18 | 19 | public static long CPP_glfwGetProcAddress(String name) { 20 | return GLFW.glfwGetProcAddress(name); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/GpuVendor.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics; 2 | 3 | public enum GpuVendor { 4 | AMD, 5 | NVIDIA, 6 | INTEL, 7 | UNKNOWN 8 | } 9 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/glslang/enums/EProfile.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.glslang.enums; 2 | 3 | public enum EProfile { 4 | EBadProfile(0), 5 | ENoProfile((1)), 6 | ECoreProfile((1 << 1)), 7 | ECompatibilityProfile((1 << 2)), 8 | EEsProfile((1 << 3)); 9 | private final int value; 10 | 11 | EProfile(int value) { 12 | this.value = value; 13 | } 14 | 15 | public int getValue() { 16 | return value; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/glslang/enums/EShClient.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.glslang.enums; 2 | 3 | public enum EShClient { 4 | EShClientNone(0), 5 | EShClientVulkan(1), 6 | EShClientOpenGL(2); 7 | private final int value; 8 | 9 | EShClient(int value) { 10 | this.value = value; 11 | } 12 | 13 | public int getValue() { 14 | return value; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/glslang/enums/EShLanguage.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.glslang.enums; 2 | 3 | public enum EShLanguage { 4 | EShLangVertex(0), 5 | EShLangTessControl(1), 6 | EShLangTessEvaluation(2), 7 | EShLangGeometry(3), 8 | EShLangFragment(4), 9 | EShLangCompute(5), 10 | EShLangRayGen(6), 11 | EShLangIntersect(7), 12 | EShLangAnyHit(8), 13 | EShLangClosestHit(9), 14 | EShLangMiss(10), 15 | EShLangCallable(11), 16 | EShLangTask(12), 17 | EShLangMesh(13), 18 | ; 19 | private final int value; 20 | 21 | EShLanguage(int value) { 22 | this.value = value; 23 | } 24 | 25 | public int getValue() { 26 | return value; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/glslang/enums/EShMessages.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.glslang.enums; 2 | 3 | public enum EShMessages { 4 | EShMsgDefault(0), 5 | EShMsgRelaxedErrors((1)), 6 | EShMsgSuppressWarnings((1 << 1)), 7 | EShMsgAST((1 << 2)), 8 | EShMsgSpvRules((1 << 3)), 9 | EShMsgVulkanRules((1 << 4)), 10 | EShMsgOnlyPreprocessor((1 << 5)), 11 | EShMsgReadHlsl((1 << 6)), 12 | EShMsgCascadingErrors((1 << 7)), 13 | EShMsgKeepUncalled((1 << 8)), 14 | EShMsgHlslOffsets((1 << 9)), 15 | EShMsgDebugInfo((1 << 10)), 16 | EShMsgHlslEnable16BitTypes((1 << 11)), 17 | EShMsgHlslLegalization((1 << 12)), 18 | EShMsgHlslDX9Compatible((1 << 13)), 19 | EShMsgBuiltinSymbolTable((1 << 14)), 20 | EShMsgEnhanced((1 << 15)), 21 | EShMsgAbsolutePath((1 << 16)), 22 | EShMsgDisplayErrorColumn((1 << 17)), 23 | EShMsgLinkTimeOptimization((1 << 18)), 24 | EShMsgValidateCrossStageIO((1 << 19)); 25 | private final int value; 26 | 27 | EShMessages(int value) { 28 | this.value = value; 29 | } 30 | 31 | public int getValue() { 32 | return value; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/glslang/enums/EShSource.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.glslang.enums; 2 | 3 | public enum EShSource { 4 | EShSourceNone(0), 5 | EShSourceGlsl(1), 6 | EShSourceHlsl(2); 7 | private final int value; 8 | 9 | EShSource(int value) { 10 | this.value = value; 11 | } 12 | 13 | public int getValue() { 14 | return value; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/glslang/enums/EShTargetClientVersion.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.glslang.enums; 2 | 3 | public enum EShTargetClientVersion { 4 | EShTargetVulkan_1_0(1 << 22), 5 | EShTargetVulkan_1_1((1 << 22) | (1 << 12)), 6 | EShTargetVulkan_1_2((1 << 22) | (2 << 12)), 7 | EShTargetVulkan_1_3((1 << 22) | (3 << 12)), 8 | EShTargetVulkan_1_4((1 << 22) | (4 << 12)), 9 | EShTargetOpenGL_450(450); 10 | private final int value; 11 | 12 | EShTargetClientVersion(int value) { 13 | this.value = value; 14 | } 15 | 16 | public int getValue() { 17 | return value; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/glslang/enums/EShTargetLanguage.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.glslang.enums; 2 | 3 | public enum EShTargetLanguage { 4 | EShTargetNone(0), 5 | EShTargetSpv(1); 6 | private final int value; 7 | 8 | EShTargetLanguage(int value) { 9 | this.value = value; 10 | } 11 | 12 | public int getValue() { 13 | return value; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/glslang/enums/EShTargetLanguageVersion.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.glslang.enums; 2 | 3 | public enum EShTargetLanguageVersion { 4 | EShTargetSpv_1_0((1 << 16)), 5 | EShTargetSpv_1_1((1 << 16) | (1 << 8)), 6 | EShTargetSpv_1_2((1 << 16) | (2 << 8)), 7 | EShTargetSpv_1_3((1 << 16) | (3 << 8)), 8 | EShTargetSpv_1_4((1 << 16) | (4 << 8)), 9 | EShTargetSpv_1_5((1 << 16) | (5 << 8)), 10 | EShTargetSpv_1_6((1 << 16) | (6 << 8)); 11 | private final int value; 12 | 13 | EShTargetLanguageVersion(int value) { 14 | this.value = value; 15 | } 16 | 17 | public int getValue() { 18 | return value; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/glslang/enums/GlslangCompileShaderError.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.glslang.enums; 2 | 3 | public enum GlslangCompileShaderError { 4 | OK(0), 5 | PREPROCESS_ERROR(1), 6 | PARSE_ERROR(2), 7 | LINK_ERROR(3); 8 | private final int value; 9 | 10 | GlslangCompileShaderError(int value) { 11 | this.value = value; 12 | } 13 | 14 | public int getValue() { 15 | return value; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/impl/BlendFactor.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.impl; 2 | 3 | public enum BlendFactor { 4 | ZERO, 5 | ONE, 6 | SRC_COLOR, 7 | ONE_MINUS_SRC_COLOR, 8 | DST_COLOR, 9 | ONE_MINUS_DST_COLOR, 10 | SRC_ALPHA, 11 | ONE_MINUS_SRC_ALPHA, 12 | DST_ALPHA, 13 | ONE_MINUS_DST_ALPHA 14 | } 15 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/impl/DepthFunc.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.impl; 2 | 3 | public enum DepthFunc { 4 | NEVER, 5 | LESS, 6 | EQUAL, 7 | LESS_EQUAL, 8 | GREATER, 9 | NOT_EQUAL, 10 | GREATER_EQUAL, 11 | ALWAYS 12 | } 13 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/impl/IDebuggableObject.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.impl; 2 | 3 | public interface IDebuggableObject { 4 | String getDebugLabel(); 5 | 6 | void updateDebugLabel(String newLabel); 7 | } 8 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/impl/IUniformStruct.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.impl; 2 | 3 | import java.nio.ByteBuffer; 4 | 5 | public interface IUniformStruct { 6 | ByteBuffer container(); 7 | 8 | int sizeof(); 9 | } 10 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/impl/framebuffer/FrameBufferAttachmentType.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.impl.framebuffer; 2 | 3 | public enum FrameBufferAttachmentType { 4 | COLOR(), 5 | ANY_DEPTH(), 6 | DEPTH(), 7 | DEPTH_STENCIL(); 8 | 9 | private int index; 10 | 11 | public int getIndex() { 12 | return index; 13 | } 14 | 15 | public FrameBufferAttachmentType index(int index) { 16 | this.index = index; 17 | return this; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/impl/framebuffer/FrameBufferBindPoint.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.impl.framebuffer; 2 | 3 | public enum FrameBufferBindPoint { 4 | READ, WRITE, ALL 5 | } 6 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/impl/framebuffer/IFrameBuffer.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.impl.framebuffer; 2 | 3 | import com.mojang.blaze3d.pipeline.RenderTarget; 4 | import io.homo.superresolution.core.impl.Destroyable; 5 | import io.homo.superresolution.core.graphics.impl.texture.ITexture; 6 | import io.homo.superresolution.core.graphics.impl.texture.TextureFormat; 7 | 8 | public interface IFrameBuffer extends Destroyable { 9 | int getWidth(); 10 | 11 | int getHeight(); 12 | 13 | void clearFrameBuffer(); 14 | 15 | void resizeFrameBuffer(int width, int height); 16 | 17 | void bind(FrameBufferBindPoint bindPoint, boolean setViewport); 18 | 19 | void bind(FrameBufferBindPoint bindPoint); 20 | 21 | void unbind(FrameBufferBindPoint bindPoint); 22 | 23 | int getTextureId(FrameBufferAttachmentType attachmentType); 24 | 25 | ITexture getTexture(FrameBufferAttachmentType attachmentType); 26 | 27 | int getFrameBufferId(); 28 | 29 | void setClearColor(float red, float green, float blue, float alpha); 30 | 31 | TextureFormat getColorTextureFormat(); 32 | 33 | TextureFormat getDepthTextureFormat(); 34 | 35 | default RenderTarget asMcRenderTarget() { 36 | throw new RuntimeException(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/impl/shader/IShaderProgram.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.impl.shader; 2 | 3 | import io.homo.superresolution.core.graphics.impl.shader.uniform.ShaderUniforms; 4 | 5 | public interface IShaderProgram { 6 | void compile(); 7 | 8 | boolean isCompiled(); 9 | 10 | void destroy(); 11 | 12 | ShaderDescription getDescription(); 13 | 14 | UNIFORM uniforms(); 15 | } 16 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/impl/shader/ShaderType.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.impl.shader; 2 | 3 | public enum ShaderType { 4 | VERTEX, 5 | FRAGMENT, 6 | COMPUTE 7 | } 8 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/impl/shader/uniform/IShaderUniform.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.impl.shader.uniform; 2 | 3 | import io.homo.superresolution.core.impl.Destroyable; 4 | 5 | public interface IShaderUniform extends Destroyable { 6 | SELF set(T value); 7 | 8 | String name(); 9 | 10 | int binding(); 11 | } 12 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/impl/shader/uniform/IShaderUniformBlock.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.impl.shader.uniform; 2 | 3 | public interface IShaderUniformBlock extends IShaderUniform { 4 | SELF setBuffer(B buffer); 5 | 6 | B buffer(); 7 | } -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/impl/shader/uniform/IShaderUniformSamplerTexture.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.impl.shader.uniform; 2 | 3 | import io.homo.superresolution.core.graphics.impl.texture.ITexture; 4 | 5 | public interface IShaderUniformSamplerTexture extends IShaderUniform { 6 | SELF setTexture(ITexture texture); 7 | 8 | ITexture texture(); 9 | } -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/impl/shader/uniform/IShaderUniformStorageTexture.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.impl.shader.uniform; 2 | 3 | import io.homo.superresolution.core.graphics.impl.texture.ITexture; 4 | 5 | public interface IShaderUniformStorageTexture extends IShaderUniform { 6 | SELF setTexture(ITexture texture); 7 | 8 | ITexture texture(); 9 | } 10 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/impl/shader/uniform/ShaderUniformBuffer.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.impl.shader.uniform; 2 | 3 | import org.lwjgl.system.MemoryUtil; 4 | 5 | import java.nio.ByteBuffer; 6 | 7 | public abstract class ShaderUniformBuffer { 8 | protected final int size; 9 | protected final ByteBuffer container; 10 | 11 | protected ShaderUniformBuffer(int size) { 12 | this.size = size; 13 | this.container = MemoryUtil.memCalloc(1, sizeof()); 14 | } 15 | 16 | public ByteBuffer container() { 17 | return container; 18 | } 19 | 20 | public int sizeof() { 21 | return size; 22 | } 23 | 24 | public abstract void fillBuffer(); 25 | } 26 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/impl/shader/uniform/ShaderUniformType.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.impl.shader.uniform; 2 | 3 | public enum ShaderUniformType { 4 | Block, SamplerTexture, StorageTexture 5 | } 6 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/impl/shader/uniform/ShaderUniforms.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.impl.shader.uniform; 2 | 3 | import io.homo.superresolution.core.graphics.impl.shader.IShaderProgram; 4 | import io.homo.superresolution.core.graphics.impl.shader.ShaderDescription; 5 | import io.homo.superresolution.core.impl.Destroyable; 6 | 7 | import java.io.Closeable; 8 | import java.util.HashMap; 9 | import java.util.Map; 10 | 11 | public abstract class ShaderUniforms< 12 | SELF extends ShaderUniforms, 13 | A extends IShaderProgram, 14 | B extends IShaderUniformBlock, 15 | C extends IShaderUniformSamplerTexture, 16 | D extends IShaderUniformStorageTexture 17 | > implements Destroyable, AutoCloseable { 18 | protected final Map shaderUniforms; 19 | protected final A program; 20 | protected final ShaderDescription description; 21 | 22 | public ShaderUniforms(A program, ShaderDescription description) { 23 | this.program = program; 24 | this.description = description; 25 | this.shaderUniforms = new HashMap<>(this.description.shaderUniforms()); 26 | } 27 | 28 | public Map getShaderUniforms() { 29 | return shaderUniforms; 30 | } 31 | 32 | public A getProgram() { 33 | return program; 34 | } 35 | 36 | public ShaderDescription getDescription() { 37 | return description; 38 | } 39 | 40 | public abstract B block(String name); 41 | 42 | public abstract C samplerTexture(String name); 43 | 44 | public abstract D storageTexture(String name); 45 | 46 | public abstract void close(); 47 | } 48 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/impl/texture/ITexture.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.impl.texture; 2 | 3 | import io.homo.superresolution.core.impl.Destroyable; 4 | import io.homo.superresolution.core.impl.Resizable; 5 | 6 | public interface ITexture extends Destroyable, Resizable { 7 | int getTextureId(); 8 | 9 | TextureFormat getTextureFormat(); 10 | 11 | TextureUsages getTextureUsages(); 12 | 13 | TextureType getTextureType(); 14 | 15 | TextureFilterMode getTextureFilterMode(); 16 | 17 | TextureWrapMode getTextureWrapMode(); 18 | 19 | int getWidth(); 20 | 21 | int getHeight(); 22 | 23 | default String string() { 24 | return "ITexture{" + 25 | "id=" + getTextureId() + 26 | "format=" + getTextureFormat() + 27 | "width=" + getWidth() + 28 | "height=" + getHeight() + 29 | '}'; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/impl/texture/TextureFilterMode.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.impl.texture; 2 | 3 | public enum TextureFilterMode { 4 | NEAREST, 5 | LINEAR, 6 | NEAREST_MIPMAP_NEAREST, 7 | LINEAR_MIPMAP_NEAREST, 8 | NEAREST_MIPMAP_LINEAR, 9 | LINEAR_MIPMAP_LINEAR; 10 | 11 | public int gl() { 12 | return switch (this) { 13 | case NEAREST -> org.lwjgl.opengl.GL11.GL_NEAREST; 14 | case LINEAR -> org.lwjgl.opengl.GL11.GL_LINEAR; 15 | case NEAREST_MIPMAP_NEAREST -> org.lwjgl.opengl.GL11.GL_NEAREST_MIPMAP_NEAREST; 16 | case LINEAR_MIPMAP_NEAREST -> org.lwjgl.opengl.GL11.GL_LINEAR_MIPMAP_NEAREST; 17 | case NEAREST_MIPMAP_LINEAR -> org.lwjgl.opengl.GL11.GL_NEAREST_MIPMAP_LINEAR; 18 | case LINEAR_MIPMAP_LINEAR -> org.lwjgl.opengl.GL11.GL_LINEAR_MIPMAP_LINEAR; 19 | }; 20 | } 21 | 22 | public int vk() { 23 | return switch (this) { 24 | case NEAREST, NEAREST_MIPMAP_NEAREST, NEAREST_MIPMAP_LINEAR -> org.lwjgl.vulkan.VK10.VK_FILTER_NEAREST; 25 | case LINEAR, LINEAR_MIPMAP_NEAREST, LINEAR_MIPMAP_LINEAR -> org.lwjgl.vulkan.VK10.VK_FILTER_LINEAR; 26 | }; 27 | } 28 | } -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/impl/texture/TextureType.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.impl.texture; 2 | 3 | public enum TextureType { 4 | Texture2D, Texture1D 5 | } 6 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/impl/texture/TextureUsage.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.impl.texture; 2 | 3 | public enum TextureUsage { 4 | Sampler, 5 | Storage, 6 | AttachmentColor, 7 | AttachmentDepth, 8 | TransferSource, 9 | TransferDestination 10 | } 11 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/impl/texture/TextureUsages.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.impl.texture; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | public class TextureUsages { 7 | private List usages = new ArrayList<>(); 8 | 9 | private TextureUsages(List usages) { 10 | this.usages = usages; 11 | } 12 | 13 | private TextureUsages() { 14 | } 15 | 16 | public static TextureUsages create() { 17 | return new TextureUsages(); 18 | } 19 | 20 | public List getUsages() { 21 | return usages; 22 | } 23 | 24 | public TextureUsages copy() { 25 | return new TextureUsages(new ArrayList<>(usages)); 26 | } 27 | 28 | public boolean isEmpty() { 29 | return usages.isEmpty(); 30 | } 31 | 32 | public TextureUsages sampler() { 33 | usages.add(TextureUsage.Sampler); 34 | return this; 35 | } 36 | 37 | public TextureUsages storage() { 38 | usages.add(TextureUsage.Storage); 39 | return this; 40 | } 41 | 42 | public TextureUsages attachmentColor() { 43 | usages.add(TextureUsage.AttachmentColor); 44 | return this; 45 | } 46 | 47 | public TextureUsages attachmentDepth() { 48 | usages.add(TextureUsage.AttachmentDepth); 49 | return this; 50 | } 51 | 52 | public TextureUsages transferSource() { 53 | usages.add(TextureUsage.TransferSource); 54 | return this; 55 | } 56 | 57 | public TextureUsages transferDestination() { 58 | usages.add(TextureUsage.TransferDestination); 59 | return this; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/impl/texture/TextureWrapMode.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.impl.texture; 2 | 3 | public enum TextureWrapMode { 4 | REPEAT, 5 | MIRRORED_REPEAT, 6 | CLAMP_TO_EDGE, 7 | CLAMP_TO_BORDER; 8 | 9 | /** 10 | * 获取对应的OpenGL枚举值 11 | */ 12 | public int gl() { 13 | return switch (this) { 14 | case REPEAT -> org.lwjgl.opengl.GL11.GL_REPEAT; 15 | case MIRRORED_REPEAT -> org.lwjgl.opengl.GL14.GL_MIRRORED_REPEAT; 16 | case CLAMP_TO_EDGE -> org.lwjgl.opengl.GL12.GL_CLAMP_TO_EDGE; 17 | case CLAMP_TO_BORDER -> org.lwjgl.opengl.GL13.GL_CLAMP_TO_BORDER; 18 | default -> throw new IllegalArgumentException("未知的TextureWrapMode: " + this); 19 | }; 20 | } 21 | 22 | /** 23 | * 获取对应的Vulkan枚举值 24 | */ 25 | public int vk() { 26 | return switch (this) { 27 | case REPEAT -> org.lwjgl.vulkan.VK10.VK_SAMPLER_ADDRESS_MODE_REPEAT; 28 | case MIRRORED_REPEAT -> org.lwjgl.vulkan.VK10.VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT; 29 | case CLAMP_TO_EDGE -> org.lwjgl.vulkan.VK10.VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE; 30 | case CLAMP_TO_BORDER -> org.lwjgl.vulkan.VK10.VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER; 31 | default -> throw new IllegalArgumentException("未知的TextureWrapMode: " + this); 32 | }; 33 | } 34 | } -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/impl/vertex/IVertexBuffer.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.impl.vertex; 2 | 3 | public interface IVertexBuffer { 4 | int getId(); 5 | 6 | int getSize(); 7 | 8 | boolean isDynamic(); 9 | 10 | void updateData(float[] data, int offset, int length); 11 | 12 | void destroy(); 13 | } 14 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/impl/vertex/PrimitiveType.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.impl.vertex; 2 | 3 | public enum PrimitiveType { 4 | TRIANGLES, 5 | LINES, 6 | POINTS 7 | } -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/impl/vertex/VertexAttribute.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.impl.vertex; 2 | 3 | public class VertexAttribute { 4 | private final int location; 5 | private final int componentCount; 6 | private final DataType dataType; 7 | private final int stride; 8 | private final int offset; 9 | 10 | public VertexAttribute(int location, int componentCount, DataType dataType, int stride, int offset) { 11 | this.location = location; 12 | this.componentCount = componentCount; 13 | this.dataType = dataType; 14 | this.stride = stride; 15 | this.offset = offset; 16 | } 17 | 18 | public int getLocation() { 19 | return location; 20 | } 21 | 22 | public int getComponentCount() { 23 | return componentCount; 24 | } 25 | 26 | public DataType getDataType() { 27 | return dataType; 28 | } 29 | 30 | public int getStride() { 31 | return stride; 32 | } 33 | 34 | public int getOffset() { 35 | return offset; 36 | } 37 | 38 | public enum DataType { 39 | FLOAT, // 浮点型 40 | INTEGER // 整型 41 | } 42 | } -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/impl/vertex/VertexBufferDescription.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.impl.vertex; 2 | 3 | public class VertexBufferDescription { 4 | private final int sizeInBytes; 5 | private final boolean dynamic; 6 | 7 | public VertexBufferDescription(int sizeInBytes, boolean dynamic) { 8 | this.sizeInBytes = sizeInBytes; 9 | this.dynamic = dynamic; 10 | } 11 | 12 | public int getSizeInBytes() { 13 | return sizeInBytes; 14 | } 15 | 16 | public boolean isDynamic() { 17 | return dynamic; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/interop/memory/SharedMemory.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.interop.memory; 2 | 3 | import static org.lwjgl.vulkan.VK10.VK_NULL_HANDLE; 4 | 5 | public class SharedMemory { 6 | public long vkMemory = VK_NULL_HANDLE; 7 | public int glMemoryObject = 0; 8 | public int fd = -1; // POSIX FD或Windows句柄 9 | public long allocationSize; 10 | } -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/opengl/GlStates.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.opengl; 2 | 3 | import java.util.Map; 4 | import java.util.concurrent.ConcurrentHashMap; 5 | 6 | public class GlStates { 7 | private static final Map states = new ConcurrentHashMap<>(); 8 | 9 | public static GlState save(Object id) { 10 | return states.put(id, new GlState()); 11 | } 12 | 13 | public static GlState pop(Object id) { 14 | return states.remove(id); 15 | } 16 | 17 | public static GlState get(Object id) { 18 | return states.get(id); 19 | } 20 | 21 | public static void remove(Object id) { 22 | states.remove(id); 23 | } 24 | 25 | public static void clear() { 26 | states.clear(); 27 | } 28 | } -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/opengl/OpenGLException.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.opengl; 2 | 3 | public class OpenGLException extends RuntimeException { 4 | public OpenGLException(String message) { 5 | super(message); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/opengl/OpenGLShaderFactory.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.opengl; 2 | 3 | 4 | import io.homo.superresolution.core.graphics.impl.shader.ShaderDescription; 5 | import io.homo.superresolution.core.graphics.opengl.shader.GlShaderProgram; 6 | 7 | public class OpenGLShaderFactory { 8 | public static GlShaderProgram createShader(ShaderDescription description) { 9 | GlShaderProgram program = new GlShaderProgram(description); 10 | return program; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/opengl/framebuffer/GlFrameBufferAttachment.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.opengl.framebuffer; 2 | 3 | import io.homo.superresolution.core.graphics.opengl.GlConst; 4 | import io.homo.superresolution.core.graphics.impl.texture.ITexture; 5 | 6 | public class GlFrameBufferAttachment { 7 | public FrameBufferAttachmentType type; 8 | public ITexture texture; 9 | 10 | public GlFrameBufferAttachment(FrameBufferAttachmentType type, ITexture texture) { 11 | this.type = type; 12 | this.texture = texture; 13 | } 14 | 15 | public enum FrameBufferAttachmentType { 16 | COLOR(GlConst.GL_COLOR_ATTACHMENT0), 17 | DEPTH(GlConst.GL_DEPTH_ATTACHMENT), 18 | DEPTH_STENCIL(GlConst.GL_DEPTH_STENCIL_ATTACHMENT); 19 | private final int srcAttachmentId; 20 | private int attachmentId; 21 | 22 | FrameBufferAttachmentType(int attachmentId) { 23 | this.attachmentId = attachmentId; 24 | this.srcAttachmentId = attachmentId; 25 | } 26 | 27 | public FrameBufferAttachmentType index(int index) { 28 | if (this.srcAttachmentId != GlConst.GL_COLOR_ATTACHMENT0) { 29 | throw new RuntimeException(); 30 | } 31 | this.attachmentId = srcAttachmentId + index; 32 | return this; 33 | } 34 | 35 | public int attachmentId() { 36 | return attachmentId; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/opengl/pipeline/jobs/GlPipelineClearJob.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.opengl.pipeline.jobs; 2 | 3 | import io.homo.superresolution.core.RenderSystems; 4 | import io.homo.superresolution.core.graphics.impl.texture.ITexture; 5 | 6 | import static org.lwjgl.opengl.GL44.*; 7 | 8 | public class GlPipelineClearJob extends GlPipelineJob { 9 | private final ITexture target; 10 | private final float[] clearColor; 11 | 12 | public GlPipelineClearJob(ITexture target, float[] clearColor) { 13 | this.target = target; 14 | this.clearColor = clearColor; 15 | } 16 | 17 | @Override 18 | public void schedule(GlPipelineJobDispatchResource resource) { 19 | } 20 | 21 | @Override 22 | public void execute(GlPipelineJobDispatchResource resource) { 23 | RenderSystems.opengl().clearTexture(this.target, clearColor); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/opengl/pipeline/jobs/GlPipelineCopyJob.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.opengl.pipeline.jobs; 2 | 3 | import io.homo.superresolution.core.RenderSystems; 4 | import io.homo.superresolution.core.graphics.impl.texture.ITexture; 5 | 6 | import static org.lwjgl.opengl.GL43.*; 7 | 8 | public class GlPipelineCopyJob extends GlPipelineJob { 9 | private final ITexture source; 10 | private final ITexture dest; 11 | 12 | public GlPipelineCopyJob(ITexture source, ITexture dest) { 13 | this.source = source; 14 | this.dest = dest; 15 | } 16 | 17 | @Override 18 | public void schedule(GlPipelineJobDispatchResource resource) { 19 | } 20 | 21 | @Override 22 | public void execute(GlPipelineJobDispatchResource resource) { 23 | RenderSystems.opengl().copyTexture( 24 | source, dest, 25 | 0, 0, source.getWidth(), source.getHeight(), 1, 26 | 0, 0, source.getWidth(), source.getHeight(), 1 27 | ); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/opengl/pipeline/jobs/GlPipelineJobDispatchResource.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.opengl.pipeline.jobs; 2 | 3 | import io.homo.superresolution.core.impl.Vec3; 4 | 5 | public record GlPipelineJobDispatchResource( 6 | Vec3 dimensions 7 | ) { 8 | public static GlPipelineJobDispatchResource nothing() { 9 | return new GlPipelineJobDispatchResource(new Vec3(0.0F)); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/opengl/pipeline/jobs/GlPipelineJobType.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.opengl.pipeline.jobs; 2 | 3 | public enum GlPipelineJobType { 4 | Compute, Graphics 5 | } 6 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/opengl/pipeline/resource/GlPipelineResourceAccess.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.opengl.pipeline.resource; 2 | 3 | public enum GlPipelineResourceAccess { 4 | READ, WRITE, BOTH 5 | } 6 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/opengl/pipeline/resource/GlPipelineResourceDescriptions.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.opengl.pipeline.resource; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | public class GlPipelineResourceDescriptions { 7 | public Map resource = new HashMap<>(); 8 | 9 | public GlPipelineResourceDescriptions addResource(GlPipelineResourceDescription description) { 10 | if (description.type() == GlPipelineResourceType.Sampler2D && description.access() != GlPipelineResourceAccess.READ) { 11 | throw new RuntimeException("管线资源类型为Sampler2D但访问类型不为只读"); 12 | } 13 | resource.put(description.name(), description); 14 | return this; 15 | } 16 | 17 | public Map resource() { 18 | return resource; 19 | } 20 | 21 | public GlPipelineResourceDescriptions clone() { 22 | GlPipelineResourceDescriptions n = new GlPipelineResourceDescriptions(); 23 | n.resource.putAll(this.resource); 24 | return n; 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/opengl/pipeline/resource/GlPipelineResourceType.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.opengl.pipeline.resource; 2 | 3 | public enum GlPipelineResourceType { 4 | Image2D, Sampler2D, UniformBuffer 5 | } 6 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/opengl/shader/GlBlitShader.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.opengl.shader; 2 | 3 | import io.homo.superresolution.core.RenderSystems; 4 | import io.homo.superresolution.core.graphics.impl.shader.ShaderDescription; 5 | import io.homo.superresolution.core.graphics.impl.shader.ShaderSource; 6 | import io.homo.superresolution.core.graphics.impl.shader.ShaderType; 7 | 8 | public class GlBlitShader { 9 | private static GlShaderProgram shaderCache; 10 | 11 | public static GlShaderProgram getShader() { 12 | if (shaderCache == null) { 13 | shaderCache = RenderSystems.current().createShaderProgram( 14 | ShaderDescription.create() 15 | .fragment(new ShaderSource(ShaderType.FRAGMENT, "/shader/blit.frag.glsl", true)) 16 | .vertex(new ShaderSource(ShaderType.VERTEX, "/shader/blit.vert.glsl", true)) 17 | .uniformSamplerTexture("uTexture", 0) 18 | .build()); 19 | shaderCache.compile(); 20 | 21 | } 22 | return shaderCache; 23 | } 24 | } -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/opengl/shader/GlShader.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.opengl.shader; 2 | 3 | import io.homo.superresolution.core.graphics.impl.shader.ShaderType; 4 | import io.homo.superresolution.core.graphics.opengl.Gl; 5 | import io.homo.superresolution.core.impl.Destroyable; 6 | import org.lwjgl.opengl.GL45; 7 | 8 | public class GlShader implements Destroyable { 9 | private int id; 10 | 11 | public GlShader(ShaderType type) { 12 | this.id = Gl.glCreateShader(switch (type) { 13 | case VERTEX -> GL45.GL_VERTEX_SHADER; 14 | case COMPUTE -> GL45.GL_COMPUTE_SHADER; 15 | case FRAGMENT -> GL45.GL_FRAGMENT_SHADER; 16 | }); 17 | } 18 | 19 | public int id() { 20 | return id; 21 | } 22 | 23 | @Override 24 | public void destroy() { 25 | Gl.glDeleteShader(this.id); 26 | this.id = -1; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/opengl/shader/ShaderCompileException.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.opengl.shader; 2 | 3 | public class ShaderCompileException extends RuntimeException { 4 | public ShaderCompileException(String message) { 5 | super(message); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/opengl/shader/uniform/ShaderBaseUniform.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.opengl.shader.uniform; 2 | 3 | import io.homo.superresolution.core.RenderSystems; 4 | import io.homo.superresolution.core.graphics.impl.shader.uniform.IShaderUniform; 5 | import io.homo.superresolution.core.graphics.impl.shader.uniform.IShaderUniformBlock; 6 | import io.homo.superresolution.core.graphics.impl.shader.uniform.ShaderUniformBuffer; 7 | import io.homo.superresolution.core.graphics.opengl.OpenGLException; 8 | import io.homo.superresolution.core.graphics.opengl.shader.GlShaderProgram; 9 | 10 | public abstract class ShaderBaseUniform> implements IShaderUniform { 11 | private final String name; 12 | private final int binding; 13 | protected T current; 14 | protected GlShaderProgram program; 15 | 16 | public ShaderBaseUniform( 17 | String name, 18 | int binding 19 | ) { 20 | this.name = name; 21 | this.binding = binding; 22 | } 23 | 24 | public void bindProgram(GlShaderProgram program) { 25 | this.program = program; 26 | } 27 | 28 | @Override 29 | public SELF set(T value) { 30 | this.current = value; 31 | return (SELF) this; 32 | } 33 | 34 | @Override 35 | public String name() { 36 | return name; 37 | } 38 | 39 | @Override 40 | public int binding() { 41 | return binding; 42 | } 43 | 44 | protected void check() { 45 | if (!RenderSystems.opengl().getShaderProgram().equals(program)) { 46 | throw new OpenGLException("正在设置着色器 %s 的Uniform数据,但当前着色器为 %s".formatted(RenderSystems.opengl().getShaderProgram(), program)); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/opengl/shader/uniform/ShaderUniformBlock.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.opengl.shader.uniform; 2 | 3 | import io.homo.superresolution.core.graphics.impl.shader.uniform.IShaderUniformBlock; 4 | import io.homo.superresolution.core.graphics.impl.shader.uniform.ShaderUniformBuffer; 5 | import io.homo.superresolution.core.graphics.opengl.Gl; 6 | import org.lwjgl.opengl.GL45; 7 | import org.lwjgl.system.MemoryUtil; 8 | 9 | import java.nio.ByteBuffer; 10 | 11 | public class ShaderUniformBlock extends ShaderBaseUniform> implements IShaderUniformBlock> { 12 | private final int uboId; 13 | 14 | public ShaderUniformBlock(String name, int binding) { 15 | super(name, binding); 16 | uboId = Gl.DSA.createBuffer(); 17 | Gl.DSA.bufferData(uboId, GL45.GL_UNIFORM_BUFFER, null, GL45.GL_DYNAMIC_DRAW); 18 | } 19 | 20 | @Override 21 | public ShaderUniformBlock setBuffer(T buffer) { 22 | return set(buffer); 23 | } 24 | 25 | @Override 26 | public T buffer() { 27 | return current; 28 | } 29 | 30 | @Override 31 | public ShaderUniformBlock set(ShaderUniformBuffer value) { 32 | Gl.DSA.bufferSubData(uboId, 0, value.container()); 33 | Gl.DSA.bindBufferBase(GL45.GL_UNIFORM_BUFFER, binding(), uboId); 34 | return super.set((T) value); 35 | } 36 | 37 | @Override 38 | public void destroy() { 39 | Gl.DSA.deleteBuffer(uboId); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/opengl/shader/uniform/ShaderUniformSamplerTexture.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.opengl.shader.uniform; 2 | 3 | import io.homo.superresolution.core.graphics.impl.shader.uniform.IShaderUniformSamplerTexture; 4 | import io.homo.superresolution.core.graphics.impl.texture.ITexture; 5 | import io.homo.superresolution.core.graphics.opengl.Gl; 6 | 7 | import static io.homo.superresolution.core.graphics.opengl.Gl.glBindTextureUnit; 8 | 9 | public class ShaderUniformSamplerTexture extends ShaderBaseUniform implements IShaderUniformSamplerTexture { 10 | public ShaderUniformSamplerTexture(String name, int binding) { 11 | super(name, binding); 12 | } 13 | 14 | @Override 15 | public ShaderUniformSamplerTexture set(ITexture value) { 16 | glBindTextureUnit(binding(), value.getTextureId()); 17 | return super.set(value); 18 | } 19 | 20 | @Override 21 | public ShaderUniformSamplerTexture setTexture(ITexture texture) { 22 | return set(texture); 23 | } 24 | 25 | @Override 26 | public ITexture texture() { 27 | return current; 28 | } 29 | 30 | @Override 31 | public void destroy() { 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/opengl/shader/uniform/ShaderUniformStorageTexture.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.opengl.shader.uniform; 2 | 3 | import io.homo.superresolution.core.graphics.impl.shader.uniform.IShaderUniformStorageTexture; 4 | import io.homo.superresolution.core.graphics.impl.texture.ITexture; 5 | 6 | public class ShaderUniformStorageTexture extends ShaderBaseUniform implements IShaderUniformStorageTexture { 7 | public ShaderUniformStorageTexture(String name, int binding) { 8 | super(name, binding); 9 | } 10 | 11 | @Override 12 | public ShaderUniformStorageTexture set(ITexture value) { 13 | return super.set(value); 14 | } 15 | 16 | @Override 17 | public ShaderUniformStorageTexture setTexture(ITexture texture) { 18 | return set(texture); 19 | } 20 | 21 | @Override 22 | public ITexture texture() { 23 | return current; 24 | } 25 | 26 | @Override 27 | public void destroy() { 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/vulkan/VkRenderSystem.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.vulkan; 2 | 3 | public class VkRenderSystem { 4 | } 5 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/vulkan/utils/VulkanException.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.vulkan.utils; 2 | 3 | public class VulkanException extends RuntimeException { 4 | public VulkanException(String message) { 5 | super(message); 6 | } 7 | 8 | public VulkanException() { 9 | super("Unknown error occurred"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/graphics/vulkan/utils/VulkanUtils.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.graphics.vulkan.utils; 2 | 3 | import io.homo.superresolution.core.graphics.vulkan.VulkanApplication; 4 | 5 | import static org.lwjgl.vulkan.VK10.VK_SUCCESS; 6 | 7 | public class VulkanUtils { 8 | public static int VK_CHECK(int code) { 9 | if (code != VK_SUCCESS) { 10 | VulkanApplication.LOGGER.error("Vulkan error! Code:{}", code); 11 | throw new VulkanException(); 12 | } 13 | return code; 14 | } 15 | 16 | public static int VK_CHECK(int code, String msg) { 17 | if (code != VK_SUCCESS) { 18 | VulkanApplication.LOGGER.error("Vulkan error! Code:{}", code); 19 | throw new VulkanException(msg); 20 | } 21 | return code; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/impl/Destroyable.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.impl; 2 | 3 | public interface Destroyable { 4 | void destroy(); 5 | } 6 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/impl/Pair.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.impl; 2 | 3 | public class Pair { 4 | public final F first; 5 | public final S second; 6 | 7 | protected Pair(F first, S second) { 8 | this.first = first; 9 | this.second = second; 10 | } 11 | 12 | public static Pair of(F first, S second) { 13 | return new Pair(first, second); 14 | } 15 | 16 | public S right() { 17 | return second; 18 | } 19 | 20 | public F left() { 21 | return first; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/impl/Resizable.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.impl; 2 | 3 | public interface Resizable { 4 | void resize(int width, int height); 5 | } 6 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/utils/ColorUtil.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.utils; 2 | 3 | public class ColorUtil { 4 | public static int alpha(int color) { 5 | return color >>> 24; 6 | } 7 | 8 | public static int red(int color) { 9 | return color >> 16 & 255; 10 | } 11 | 12 | public static int green(int color) { 13 | return color >> 8 & 255; 14 | } 15 | 16 | public static int blue(int color) { 17 | return color & 255; 18 | } 19 | 20 | public static int color(int alpha, int red, int green, int blue) { 21 | return alpha << 24 | red << 16 | green << 8 | blue; 22 | } 23 | 24 | public static int color(int red, int green, int blue) { 25 | return color(255, red, green, blue); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/core/utils/MessageBox.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.core.utils; 2 | 3 | import com.sun.jna.Library; 4 | import com.sun.jna.Native; 5 | import com.sun.jna.win32.W32APIOptions; 6 | 7 | public class MessageBox { 8 | private static final boolean ON_WINDOWS = System.getProperty("os.name").toLowerCase().contains("windows"); 9 | 10 | public static void createError(String text, String caption) { 11 | if (!ON_WINDOWS) 12 | return; 13 | User32.INSTANCE.MessageBoxW(0, text, caption, 0x00000010); 14 | } 15 | 16 | public static void createWarn(String text, String caption) { 17 | if (!ON_WINDOWS) 18 | return; 19 | User32.INSTANCE.MessageBoxW(0, text, caption, 0x00000030); 20 | } 21 | 22 | public static void createInfo(String text, String caption) { 23 | if (!ON_WINDOWS) 24 | return; 25 | User32.INSTANCE.MessageBoxW(0, text, caption, 0x00000040); 26 | } 27 | 28 | public static void main(String[] args) { 29 | createError("114514", "114514"); 30 | createWarn("114514", "114514"); 31 | createInfo("114514", "114514"); 32 | } 33 | 34 | private interface User32 extends Library { 35 | User32 INSTANCE = Native.load("user32", User32.class, W32APIOptions.DEFAULT_OPTIONS); 36 | 37 | int MessageBoxW(int hWnd, String lpText, String lpCaption, int uType); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/fsr2/Fsr2ContextConfig.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.fsr2; 2 | 3 | public class Fsr2ContextConfig { 4 | public Fsr2ContextFlags flags; 5 | 6 | private Fsr2ContextConfig(Fsr2ContextFlags flags) { 7 | this.flags = flags; 8 | } 9 | 10 | public static Fsr2ContextConfig create(Fsr2ContextFlags flags) { 11 | return new Fsr2ContextConfig(flags); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/fsr2/Fsr2Dimensions.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.fsr2; 2 | 3 | public record Fsr2Dimensions( 4 | int renderWidth, 5 | int renderHeight, 6 | int screenWidth, 7 | int screenHeight 8 | ) { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/fsr2/Fsr2PipelineDispatchResource.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.fsr2; 2 | 3 | public record Fsr2PipelineDispatchResource( 4 | Fsr2PipelineResources resources, 5 | Fsr2ContextConfig config, 6 | Fsr2Dimensions dimensions, 7 | Fsr2DispatchDescription dispatchDescription 8 | ) { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/fsr2/Fsr2ResourceCreateDescription.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.fsr2; 2 | 3 | import io.homo.superresolution.core.impl.Vec2; 4 | import io.homo.superresolution.core.graphics.impl.texture.TextureFormat; 5 | 6 | public class Fsr2ResourceCreateDescription { 7 | public Vec2 size; 8 | public TextureFormat format; 9 | public int dim; 10 | public String label; 11 | public int mipCount; 12 | 13 | public Fsr2ResourceCreateDescription(Vec2 size, TextureFormat format, int dim, String label) { 14 | this(size, format, dim, label, -1); 15 | } 16 | 17 | public Fsr2ResourceCreateDescription(Vec2 size, TextureFormat format, int dim, String label, int mipCount) { 18 | this.size = size; 19 | this.format = format; 20 | this.dim = dim; 21 | this.label = label; 22 | this.mipCount = mipCount; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/fsr2/pipelines/Fsr2GenerateReactivePipeline.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.fsr2.pipelines; 2 | 3 | import io.homo.superresolution.fsr2.Fsr2Context; 4 | import io.homo.superresolution.fsr2.Fsr2Dimensions; 5 | import io.homo.superresolution.fsr2.Fsr2PipelineDispatchResource; 6 | import io.homo.superresolution.fsr2.Fsr2PipelineResources; 7 | 8 | public class Fsr2GenerateReactivePipeline extends Fsr2BasePipeline { 9 | 10 | 11 | public Fsr2GenerateReactivePipeline(Fsr2Context context) { 12 | super(context); 13 | } 14 | 15 | @Override 16 | public void resize(Fsr2Dimensions size) { 17 | 18 | } 19 | 20 | @Override 21 | public void destroy() { 22 | 23 | } 24 | 25 | @Override 26 | public void init() { 27 | 28 | } 29 | 30 | @Override 31 | public void execute(Fsr2PipelineDispatchResource dispatchResource) { 32 | pipeline.scheduleJobs(); 33 | pipeline.executeJobs(); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/fsr2/pipelines/Fsr2TcrAutogeneratePipeline.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.fsr2.pipelines; 2 | 3 | import io.homo.superresolution.fsr2.Fsr2Context; 4 | import io.homo.superresolution.fsr2.Fsr2Dimensions; 5 | import io.homo.superresolution.fsr2.Fsr2PipelineDispatchResource; 6 | 7 | public class Fsr2TcrAutogeneratePipeline extends Fsr2BasePipeline { 8 | 9 | 10 | public Fsr2TcrAutogeneratePipeline(Fsr2Context context) { 11 | super(context); 12 | } 13 | 14 | @Override 15 | public void resize(Fsr2Dimensions size) { 16 | 17 | } 18 | 19 | @Override 20 | public void destroy() { 21 | 22 | } 23 | 24 | @Override 25 | public void init() { 26 | 27 | } 28 | 29 | @Override 30 | public void execute(Fsr2PipelineDispatchResource dispatchResource) { 31 | 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /common/src/main/java/io/homo/superresolution/fsr2/struct/Fsr2CBRcas.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.fsr2.struct; 2 | 3 | import io.homo.superresolution.core.graphics.impl.IUniformStruct; 4 | import io.homo.superresolution.fsr2.Fsr2Context; 5 | import io.homo.superresolution.fsr2.Fsr2Dimensions; 6 | import io.homo.superresolution.fsr2.Fsr2DispatchDescription; 7 | import io.homo.superresolution.fsr2.Fsr2Utils; 8 | import org.lwjgl.system.MemoryStack; 9 | 10 | import java.nio.ByteBuffer; 11 | import java.nio.ByteOrder; 12 | 13 | public class Fsr2CBRcas implements IUniformStruct { 14 | private final ByteBuffer container; 15 | 16 | public Fsr2CBRcas() { 17 | this.container = MemoryStack.stackCalloc(sizeof()); 18 | this.container.order(ByteOrder.LITTLE_ENDIAN); 19 | } 20 | 21 | public void update(Fsr2Context context, Fsr2DispatchDescription desc, Fsr2Dimensions dims) { 22 | container.clear(); 23 | int[] rcasConfig = new int[4]; 24 | float sharpness = (-2.0f * desc.sharpness) + 2.0f; 25 | Fsr2Utils.rcasCon(rcasConfig, sharpness); 26 | for (int i = 0; i < 4; ++i) { 27 | container.putInt(rcasConfig[i]); 28 | } 29 | container.position(sizeof()); 30 | container.flip(); 31 | } 32 | 33 | @Override 34 | public ByteBuffer container() { 35 | return container.duplicate().rewind(); 36 | } 37 | 38 | @Override 39 | public int sizeof() { 40 | return 16; 41 | } 42 | } -------------------------------------------------------------------------------- /common/src/main/resources/assets/super_resolution/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/common/src/main/resources/assets/super_resolution/logo.png -------------------------------------------------------------------------------- /common/src/main/resources/assets/super_resolution/shaders/block_layer_opaque.fsh: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | #import 4 | 5 | in vec4 v_Color; // The interpolated vertex color 6 | in vec2 v_TexCoord; // The interpolated block texture coordinates 7 | in float v_FragDistance; // The fragment's distance from the camera 8 | 9 | in float v_MaterialMipBias; 10 | in float v_MaterialAlphaCutoff; 11 | in vec4 v_lastPosition; 12 | in vec4 v_currentPosition; 13 | 14 | 15 | uniform sampler2D u_BlockTex; // The block texture 16 | 17 | uniform vec4 u_FogColor; // The color of the shader fog 18 | uniform float u_FogStart; // The starting position of the shader fog 19 | uniform float u_FogEnd; // The ending position of the shader fog 20 | 21 | layout(location = 0) out vec4 fragColor; // 原输出 22 | layout(location = 1) out vec2 o_MotionVector; // 运动矢量 23 | 24 | 25 | vec2 calculateMotionVector() { 26 | vec3 currentNDC = v_currentPosition.xyz / v_currentPosition.w; 27 | vec3 previousNDC = v_lastPosition.xyz / v_lastPosition.w; 28 | return (currentNDC.xy - previousNDC.xy) * 0.5; 29 | } 30 | 31 | 32 | void main() { 33 | vec4 diffuseColor = texture(u_BlockTex, v_TexCoord, v_MaterialMipBias); 34 | 35 | // Apply per-vertex color 36 | diffuseColor *= v_Color; 37 | 38 | #ifdef USE_FRAGMENT_DISCARD 39 | if (diffuseColor.a < v_MaterialAlphaCutoff) { 40 | discard; 41 | } 42 | #endif 43 | 44 | fragColor = _linearFog(diffuseColor, v_FragDistance, u_FogColor, u_FogStart, u_FogEnd); 45 | o_MotionVector = calculateMotionVector(); 46 | } 47 | -------------------------------------------------------------------------------- /common/src/main/resources/assets/super_resolution/textures/coef1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/common/src/main/resources/assets/super_resolution/textures/coef1.png -------------------------------------------------------------------------------- /common/src/main/resources/assets/super_resolution/textures/coef2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/common/src/main/resources/assets/super_resolution/textures/coef2.png -------------------------------------------------------------------------------- /common/src/main/resources/assets/super_resolution/textures/coef_scaler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/common/src/main/resources/assets/super_resolution/textures/coef_scaler.png -------------------------------------------------------------------------------- /common/src/main/resources/assets/super_resolution/textures/coef_usm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/common/src/main/resources/assets/super_resolution/textures/coef_usm.png -------------------------------------------------------------------------------- /common/src/main/resources/assets/super_resolution/textures/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/common/src/main/resources/assets/super_resolution/textures/logo.png -------------------------------------------------------------------------------- /common/src/main/resources/lib/libSuperResolution+android.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/common/src/main/resources/lib/libSuperResolution+android.so -------------------------------------------------------------------------------- /common/src/main/resources/lib/libSuperResolution+linux64.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/common/src/main/resources/lib/libSuperResolution+linux64.so -------------------------------------------------------------------------------- /common/src/main/resources/lib/libSuperResolution+win64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/common/src/main/resources/lib/libSuperResolution+win64.dll -------------------------------------------------------------------------------- /common/src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "description": "superresolution", 4 | "pack_format": 34 5 | } 6 | } -------------------------------------------------------------------------------- /common/src/main/resources/shader/blit.frag.glsl: -------------------------------------------------------------------------------- 1 | #version 430 2 | precision mediump float; 3 | 4 | layout(location = 0)uniform sampler2D uTexture; 5 | layout(location = 0) in vec2 vTexCoord; 6 | layout(location = 0) out vec4 FragColor; 7 | void main() { 8 | FragColor = texture(uTexture, vTexCoord); 9 | } 10 | -------------------------------------------------------------------------------- /common/src/main/resources/shader/blit.vert.glsl: -------------------------------------------------------------------------------- 1 | #version 430 2 | precision mediump float; 3 | 4 | layout(location = 0) in vec2 aPosition; 5 | layout(location = 1) in vec2 aTexCoord; 6 | layout(location = 0) out vec2 vTexCoord; 7 | void main() { 8 | vTexCoord = aTexCoord; 9 | gl_Position = vec4(aPosition, 0.0, 1.0); 10 | } 11 | -------------------------------------------------------------------------------- /common/src/main/resources/shader/depth_to_r16f.frag.glsl: -------------------------------------------------------------------------------- 1 | #version 430 2 | layout(location = 0) uniform sampler2D depthTex; 3 | layout(location = 0) in vec2 vTexCoord; 4 | layout(location = 0) out float outDepth; 5 | 6 | void main() { 7 | float depth = texture(depthTex, vTexCoord).r; 8 | depth -= 0.995; 9 | depth = 0.005/depth; 10 | outDepth = depth; 11 | } -------------------------------------------------------------------------------- /common/src/main/resources/shader/depth_to_r16f.vert.glsl: -------------------------------------------------------------------------------- 1 | #version 430 2 | precision mediump float; 3 | 4 | layout(location = 0) in vec2 aPosition; 5 | layout(location = 1) in vec2 aTexCoord; 6 | layout(location = 0) out vec2 vTexCoord; 7 | void main() { 8 | vTexCoord = aTexCoord; 9 | gl_Position = vec4(aPosition, 0.0, 1.0); 10 | } 11 | -------------------------------------------------------------------------------- /common/src/main/resources/shader/fsr2/ffx_core.h: -------------------------------------------------------------------------------- 1 | // This file is part of the FidelityFX SDK. 2 | // 3 | // Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | 23 | #if !defined(FFX_CORE_H) 24 | #define FFX_CORE_H 25 | 26 | #include "fsr2/ffx_common_types.h" 27 | 28 | #if defined(FFX_GLSL) && defined(FFX_GPU) 29 | #include "fsr2/ffx_core_glsl.h" 30 | #endif // #if defined(FFX_GLSL) && defined(FFX_GPU) 31 | 32 | #if defined(FFX_GPU) 33 | #include "fsr2/ffx_core_gpu_common.h" 34 | #include "fsr2/ffx_core_gpu_common_half.h" 35 | #include "fsr2/ffx_core_portability.h" 36 | #endif // #if defined(FFX_GPU) 37 | #endif // #if !defined(FFX_CORE_H) -------------------------------------------------------------------------------- /common/src/main/resources/shader/gui_blur/blur.frag.glsl: -------------------------------------------------------------------------------- 1 | #version 430 2 | precision mediump float; 3 | //--insert--define--// 4 | #define MAX_LEVELS 8 5 | uniform sampler2D uTexture; 6 | layout(location = 0) uniform vec4 weightA; 7 | layout(location = 1) uniform vec4 weightB; 8 | layout(location = 0) out vec4 FragColor; 9 | layout(location = 0) in vec2 vTexCoord; 10 | void main() 11 | { 12 | vec3 color = vec3(0.f); 13 | vec4 weight[2]; 14 | weight[0] = weightA; 15 | weight[1] = weightB; 16 | for (int i = 0; i < MAX_LEVELS; ++i) { 17 | color += textureLod(uTexture, vTexCoord, float(i)).rgb * weight[i / 4][i % 4]; 18 | } 19 | FragColor = vec4( 20 | color.rgb, 21 | textureLod(uTexture, vTexCoord, 0).a 22 | ); 23 | } 24 | -------------------------------------------------------------------------------- /common/src/main/resources/shader/gui_blur/blur.vert.glsl: -------------------------------------------------------------------------------- 1 | #version 430 2 | precision mediump float; 3 | 4 | layout (location = 0) in vec2 aPosition; 5 | layout (location = 1) in vec2 aTexCoord; 6 | layout (location = 0) out vec2 vTexCoord; 7 | void main() { 8 | vTexCoord = aTexCoord; 9 | gl_Position = vec4(aPosition, 0.0, 1.0); 10 | } -------------------------------------------------------------------------------- /common/src/main/resources/shader/include/a.h: -------------------------------------------------------------------------------- 1 | float eee(){ 2 | return 1.0; 3 | } 4 | -------------------------------------------------------------------------------- /common/src/main/resources/shader/motion_vector/common.vert.glsl: -------------------------------------------------------------------------------- 1 | #version 430 2 | precision mediump float; 3 | 4 | layout(location = 0) in vec2 aPosition; 5 | layout(location = 1) in vec2 aTexCoord; 6 | layout (location = 0) out vec2 uv; 7 | 8 | layout(std140, binding = 0) uniform motion_vector_data_t { 9 | float exposure; 10 | int window_radius; 11 | float min_value; 12 | float scale; 13 | } motion_vector_data; 14 | 15 | void main() { 16 | uv = aTexCoord; 17 | gl_Position = vec4(aPosition, 0.0, 1.0); 18 | } 19 | -------------------------------------------------------------------------------- /common/src/main/resources/shader/motion_vector/pass1.frag.glsl: -------------------------------------------------------------------------------- 1 | #version 430 core 2 | layout(binding = 1) uniform sampler2D tex_current; 3 | layout (location = 0) in vec2 uv; 4 | layout (location = 0)out vec2 out_grad; // R: Ix, G: Iy 5 | 6 | layout(std140, binding = 0) uniform motion_vector_data_t { 7 | float exposure; 8 | int window_radius; 9 | float min_value; 10 | float scale; 11 | } motion_vector_data; 12 | 13 | void main() { 14 | vec2 texelSize = 1.0 / textureSize(tex_current, 0); 15 | float right = texture(tex_current, uv + vec2(texelSize.x, 0.0)).r; 16 | float left = texture(tex_current, uv - vec2(texelSize.x, 0.0)).r; 17 | float Ix = (right - left) / (2.0 * texelSize.x); 18 | 19 | float top = texture(tex_current, uv + vec2(0.0, texelSize.y)).r; 20 | float bottom = texture(tex_current, uv - vec2(0.0, texelSize.y)).r; 21 | float Iy = (top - bottom) / (2.0 * texelSize.y); 22 | 23 | out_grad = vec2(Ix, Iy); 24 | } 25 | -------------------------------------------------------------------------------- /common/src/main/resources/shader/motion_vector/pass2.frag.glsl: -------------------------------------------------------------------------------- 1 | #version 430 core 2 | 3 | layout(binding = 1) uniform sampler2D tex_current; 4 | layout(binding = 2) uniform sampler2D tex_previous; 5 | layout (location = 0) in vec2 uv; 6 | layout (location = 0)out float out_it; 7 | 8 | layout(std140, binding = 0) uniform motion_vector_data_t { 9 | float exposure; 10 | int window_radius; 11 | float min_value; 12 | float scale; 13 | } motion_vector_data; 14 | 15 | void main() { 16 | float current = texture(tex_current, uv).r; 17 | float previous = texture(tex_previous, uv).r; 18 | out_it = previous - current; 19 | } 20 | -------------------------------------------------------------------------------- /common/src/main/resources/shader/motion_vector/preprocess.frag.glsl: -------------------------------------------------------------------------------- 1 | #version 430 core 2 | layout(binding = 1) uniform sampler2D tex_current; 3 | layout (location = 0)in vec2 uv; 4 | layout (location = 0)out float out_result; 5 | 6 | layout(std140, binding = 0) uniform motion_vector_data_t { 7 | float exposure; 8 | int window_radius; 9 | float min_value; 10 | float scale; 11 | } motion_vector_data; 12 | 13 | void main() { 14 | vec3 color = texture(tex_current, uv).rgb; 15 | float luminance = 0.299 * color.r + 0.587 * color.g + 0.114 * color.b; 16 | out_result = luminance * motion_vector_data.exposure; 17 | } 18 | -------------------------------------------------------------------------------- /common/src/main/resources/shader/rg16f_to_rgb.frag.glsl: -------------------------------------------------------------------------------- 1 | #version 430 2 | 3 | precision mediump float; 4 | 5 | layout(location = 0) uniform sampler2D tex; 6 | layout(location = 0) in vec2 vTexCoord; 7 | layout(location = 0) out vec4 outTex; 8 | 9 | void main() { 10 | vec2 co = texture(tex, vTexCoord).rg; 11 | outTex = vec4(co.r,co.g,0.0,1.0); 12 | } -------------------------------------------------------------------------------- /common/src/main/resources/shader/rg16f_to_rgb.vert.glsl: -------------------------------------------------------------------------------- 1 | #version 430 2 | precision mediump float; 3 | 4 | layout(location = 0) in vec2 aPosition; 5 | layout(location = 1) in vec2 aTexCoord; 6 | layout(location = 0) out vec2 vTexCoord; 7 | void main() { 8 | vTexCoord = aTexCoord; 9 | gl_Position = vec4(aPosition, 0.0, 1.0); 10 | } 11 | -------------------------------------------------------------------------------- /common/src/main/resources/shader/sgsr/2pass_fs/sgsr2_vertex.vert.glsl: -------------------------------------------------------------------------------- 1 | #version 320 es 2 | 3 | //============================================================================================================ 4 | // 5 | // 6 | // Copyright (c) 2024, Qualcomm Innovation Center, Inc. All rights reserved. 7 | // SPDX-License-Identifier: BSD-3-Clause 8 | // 9 | //============================================================================================================ 10 | 11 | precision highp float; 12 | precision highp int; 13 | layout (location = 0) in vec3 vPosition; 14 | layout (location = 1) in vec2 vTexCord; 15 | 16 | out vec2 texCoord; 17 | void main() 18 | { 19 | gl_Position = vec4(vPosition,1.0); 20 | texCoord = vTexCord; 21 | } -------------------------------------------------------------------------------- /common/src/main/resources/shader/sgsr/v1/sgsr1_shader.vert.glsl: -------------------------------------------------------------------------------- 1 | #version 430 2 | precision mediump float; 3 | 4 | layout (location = 0) in mediump vec2 aPosition; 5 | layout (location = 1) in mediump vec2 aTexCoord; 6 | layout(location = 0)out mediump vec2 in_TEXCOORD0; 7 | void main() { 8 | in_TEXCOORD0 = aTexCoord; 9 | gl_Position = vec4(aPosition, 0.0, 1.0); 10 | } 11 | 12 | -------------------------------------------------------------------------------- /common/src/main/resources/super_resolution.accesswidener: -------------------------------------------------------------------------------- 1 | accessWidener v2 named 2 | 3 | accessible field net/minecraft/client/renderer/PostChain screenTarget Lcom/mojang/blaze3d/pipeline/RenderTarget; 4 | mutable field net/minecraft/client/renderer/PostChain screenTarget Lcom/mojang/blaze3d/pipeline/RenderTarget; 5 | -------------------------------------------------------------------------------- /common/src/main/resources/super_resolution.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "io.homo.superresolution.common.mixin", 4 | "plugin": "io.homo.superresolution.common.mixin.MixinPlugin", 5 | "compatibilityLevel": "JAVA_8", 6 | "minVersion": "0.8", 7 | "client": [ 8 | "core.ForceOpenGLVersion_WindowMixin", 9 | "core.GameRendererMixin", 10 | "core.GLXMixin", 11 | "core.LevelRendererMixin", 12 | "core.MinecraftMixin", 13 | "core.OptionsMixin", 14 | "core.PostChainMixin", 15 | "core.WindowMixin", 16 | "core.accessor.LevelRendererAccessor", 17 | "core.accessor.MinecraftAccessor", 18 | "core.accessor.OptionInstanceAccessor", 19 | "core.accessor.PostChainAccessor", 20 | "debug.ImguiMixin", 21 | "debug.KeyboardHandlerMixin", 22 | "gui.AbstractWidgetAccessor", 23 | "gui.GameRendererAccessor" 24 | ], 25 | "mixins": [ 26 | ], 27 | "injectors": { 28 | "defaultRequire": 1 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /common/src/main/resources/super_resolution_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/common/src/main/resources/super_resolution_logo.png -------------------------------------------------------------------------------- /fabric/src/main/java/io/homo/superresolution/fabric/SuperResolutionFabric.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.fabric; 2 | 3 | import net.fabricmc.api.ModInitializer; 4 | 5 | public final class SuperResolutionFabric implements ModInitializer { 6 | @Override 7 | public void onInitialize() { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /fabric/src/main/java/io/homo/superresolution/fabric/SuperResolutionFabricClient.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.fabric; 2 | 3 | import dev.architectury.platform.Platform; 4 | import io.homo.superresolution.common.SuperResolution; 5 | import io.homo.superresolution.common.config.Config; 6 | import io.homo.superresolution.common.config.ConfigFile; 7 | import io.homo.superresolution.core.graphics.renderdoc.RenderDoc; 8 | import io.homo.superresolution.fabric.compat.sodium.SodiumOptionScreen; 9 | import net.fabricmc.api.ClientModInitializer; 10 | 11 | public final class SuperResolutionFabricClient implements ClientModInitializer { 12 | public static SuperResolution mod; 13 | 14 | @Override 15 | public void onInitializeClient() { 16 | ConfigFile.read(); 17 | if (Platform.isDevelopmentEnvironment() && Config.isEnableRenderDoc()) RenderDoc.init(); 18 | SuperResolution.preInit(); 19 | mod = new SuperResolution(); 20 | if (io.homo.superresolution.common.platform.Platform.currentPlatform.isModLoaded("sodiumoptionsapi")) { 21 | SodiumOptionScreen.register(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /fabric/src/main/java/io/homo/superresolution/fabric/compat/modmenu/ModMenu.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.fabric.compat.modmenu; 2 | 3 | import com.terraformersmc.modmenu.api.ConfigScreenFactory; 4 | import com.terraformersmc.modmenu.api.ModMenuApi; 5 | import io.homo.superresolution.common.gui.ConfigScreenBuilder; 6 | 7 | public class ModMenu implements ModMenuApi { 8 | @Override 9 | public ConfigScreenFactory getModConfigScreenFactory() { 10 | return ConfigScreenBuilder.create()::buildConfigScreen; 11 | } 12 | } -------------------------------------------------------------------------------- /fabric/src/main/java/io/homo/superresolution/fabric/mixin/compat/CompatMixinPlugin.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.fabric.mixin.compat; 2 | 3 | import io.homo.superresolution.common.platform.Platform; 4 | import io.homo.superresolution.fabric.platform.FabricPlatform; 5 | import org.objectweb.asm.tree.ClassNode; 6 | import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; 7 | import org.spongepowered.asm.mixin.extensibility.IMixinInfo; 8 | 9 | import java.util.List; 10 | import java.util.Objects; 11 | import java.util.Set; 12 | 13 | public class CompatMixinPlugin implements IMixinConfigPlugin { 14 | private String CLASS_START = "io.homo.superresolution.fabric.mixin.compat."; 15 | 16 | public CompatMixinPlugin() { 17 | } 18 | 19 | public void onLoad(String s) { 20 | Platform.currentPlatform = new FabricPlatform(); 21 | Platform.currentPlatform.init(); 22 | } 23 | 24 | public String getRefMapperConfig() { 25 | return null; 26 | } 27 | 28 | public boolean shouldApplyMixin(String s, String s1) { 29 | String modid = s1.replace(CLASS_START, "").split("\\.")[0]; 30 | if (Objects.equals(modid, "reesessodiumoptions")){ 31 | return Platform.currentPlatform.isModLoaded("reeses-sodium-options"); 32 | } 33 | return Platform.currentPlatform.isModLoaded(modid); 34 | } 35 | 36 | public void acceptTargets(Set set, Set set1) { 37 | } 38 | 39 | public List getMixins() { 40 | return List.of(); 41 | } 42 | 43 | public void preApply(String s, ClassNode classNode, String s1, IMixinInfo iMixinInfo) { 44 | } 45 | 46 | public void postApply(String s, ClassNode classNode, String s1, IMixinInfo iMixinInfo) { 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /fabric/src/main/java/io/homo/superresolution/fabric/mixin/compat/sodium/GraphicsAdapterProbeMixin.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.fabric.mixin.compat.sodium; 2 | 3 | import net.fabricmc.loader.api.FabricLoader; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | #if MC_VER > MC_1_20_4 6 | import net.caffeinemc.mods.sodium.client.compatibility.environment.probe.GraphicsAdapterProbe; 7 | #else 8 | import me.jellysquid.mods.sodium.client.compatibility.environment.probe.GraphicsAdapterProbe; 9 | #endif 10 | import org.spongepowered.asm.mixin.injection.At; 11 | import org.spongepowered.asm.mixin.injection.Inject; 12 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 13 | 14 | @Mixin(value = GraphicsAdapterProbe.class, remap = false) 15 | public class GraphicsAdapterProbeMixin { 16 | @Inject(method = "findAdapters", at = @At("HEAD"), cancellable = true) 17 | private static void fix(CallbackInfo ci) { 18 | //if (FabricLoader.getInstance().isDevelopmentEnvironment()) { 19 | // ci.cancel(); 20 | //} 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /fabric/src/main/java/io/homo/superresolution/fabric/mixin/compat/sodiumoptionsapi/SodiumOptionsTabFrameMixin.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.fabric.mixin.compat.sodiumoptionsapi; 2 | 3 | import io.homo.superresolution.common.SuperResolution; 4 | import io.homo.superresolution.common.gui.ConfigScreenBuilder; 5 | import net.minecraft.client.Minecraft; 6 | import net.minecraft.network.chat.Component; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.Shadow; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Inject; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 12 | #if MC_VER != MC_1_20_4 13 | import toni.sodiumoptionsapi.gui.SodiumOptionsTabFrame; 14 | import me.flashyreese.mods.reeses_sodium_options.client.gui.frame.tab.Tab; 15 | #endif 16 | import java.util.Objects; 17 | 18 | #if MC_VER != MC_1_20_4 19 | @Mixin(value = SodiumOptionsTabFrame.class, remap = false) 20 | public class SodiumOptionsTabFrameMixin { 21 | @Shadow 22 | private String selectedHeader; 23 | 24 | @Inject(method = "setTab", at = @At(value = "HEAD"), cancellable = true) 25 | private void onSetTab(Tab tab, CallbackInfo ci) { 26 | if (Objects.equals(this.selectedHeader, SuperResolution.MOD_ID)) { 27 | Minecraft.getInstance().setScreen(ConfigScreenBuilder.create().buildConfigScreen(Minecraft.getInstance().screen)); 28 | ci.cancel(); 29 | } 30 | } 31 | } 32 | #else 33 | @Mixin(value = Minecraft.class) 34 | public class SodiumOptionsTabFrameMixin { 35 | } 36 | #endif 37 | -------------------------------------------------------------------------------- /fabric/src/main/java/io/homo/superresolution/fabric/mixin/core/MinecraftMixin.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.fabric.mixin.core; 2 | 3 | import com.mojang.blaze3d.pipeline.MainTarget; 4 | import io.homo.superresolution.common.SuperResolution; 5 | import io.homo.superresolution.fabric.SuperResolutionFabricClient; 6 | import net.minecraft.client.Minecraft; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | 12 | @Mixin(Minecraft.class) 13 | public class MinecraftMixin { 14 | 15 | @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;setOverlay(Lnet/minecraft/client/gui/screens/Overlay;)V"), method = "") 16 | private void onStart(CallbackInfo ci) { 17 | if (!SuperResolution.isPreInit) return; 18 | SuperResolution.initRendering(); 19 | SuperResolution.createAlgo(); 20 | SuperResolutionFabricClient.mod.init(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /fabric/src/main/java/io/homo/superresolution/fabric/platform/FabricPlatform.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.fabric.platform; 2 | 3 | import io.homo.superresolution.common.platform.EnvType; 4 | import io.homo.superresolution.common.platform.Platform; 5 | import net.fabricmc.loader.api.FabricLoader; 6 | 7 | import java.nio.file.Path; 8 | 9 | public class FabricPlatform extends Platform { 10 | @Override 11 | public void init() { 12 | this.irisPlatform = new IrisFabricPlatform(); 13 | } 14 | 15 | @Override 16 | public boolean isModLoaded(String modId) { 17 | return FabricLoader.getInstance().isModLoaded(modId); 18 | } 19 | 20 | @Override 21 | public boolean isDevelopmentEnvironment() { 22 | return FabricLoader.getInstance().isDevelopmentEnvironment(); 23 | } 24 | 25 | @Override 26 | public String getModVersionString(String modId) { 27 | if (isModLoaded(modId)) 28 | return FabricLoader.getInstance().getModContainer(modId).orElseThrow().getMetadata().getVersion().getFriendlyString(); 29 | return null; 30 | } 31 | 32 | public EnvType getEnv() { 33 | return switch (FabricLoader.getInstance().getEnvironmentType()) { 34 | case CLIENT -> EnvType.CLIENT; 35 | case SERVER -> EnvType.SERVER; 36 | }; 37 | } 38 | 39 | public Path getGameFolder() { 40 | return FabricLoader.getInstance().getGameDir().toAbsolutePath().normalize(); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /fabric/src/main/java/io/homo/superresolution/fabric/platform/IrisFabricPlatform.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.fabric.platform; 2 | 3 | import io.homo.superresolution.common.platform.IrisPlatform; 4 | 5 | import java.lang.reflect.Method; 6 | 7 | public class IrisFabricPlatform extends IrisPlatform { 8 | @Override 9 | public boolean isShaderPackInUse() { 10 | try { 11 | Class irisApiClazz = Class.forName("net.irisshaders.iris.api.v0.IrisApi"); 12 | Method getInstanceMethod = irisApiClazz.getMethod("getInstance"); 13 | Object irisApiInstance = getInstanceMethod.invoke(null); 14 | Method isShaderPackInUseMethod = irisApiInstance.getClass().getMethod("isShaderPackInUse"); 15 | return (boolean) isShaderPackInUseMethod.invoke(irisApiInstance); 16 | } catch (Exception e) { 17 | return false; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /fabric/src/main/resources/assets/super_resolution/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/fabric/src/main/resources/assets/super_resolution/logo.png -------------------------------------------------------------------------------- /fabric/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "super_resolution", 4 | "version": "${version}", 5 | "name": "Super Resolution", 6 | "description": "喵", 7 | "authors": [ 8 | "187J3X1" 9 | ], 10 | "contact": { 11 | "homepage": "https://github.com/187J3X1-114514/superresolution", 12 | "issues": "https://github.com/187J3X1-114514/superresolution/issues" 13 | }, 14 | "license": "MIT", 15 | "icon": "assets/super_resolution/logo.png", 16 | "environment": "client", 17 | "entrypoints": { 18 | "main": [ 19 | "io.homo.superresolution.fabric.SuperResolutionFabric" 20 | ], 21 | "client": [ 22 | "io.homo.superresolution.fabric.SuperResolutionFabricClient" 23 | ], 24 | "modmenu": [ 25 | "io.homo.superresolution.fabric.compat.modmenu.ModMenu" 26 | ] 27 | }, 28 | "mixins": [ 29 | "super_resolution.mixins.json", 30 | "super_resolution-fabric.mixins.json", 31 | "super_resolution-fabric-compat.mixins.json" 32 | ], 33 | "depends": { 34 | "fabricloader": "*", 35 | "minecraft": "{versionRange}", 36 | "java": ">=${javaVersion}", 37 | "architectury": "*", 38 | "fabric-api": "*", 39 | "cloth-config": "*" 40 | }, 41 | "suggests": { 42 | }, 43 | "breaks": { 44 | "resolutioncontrol": "*" 45 | }, 46 | "accessWidener": "super_resolution.accesswidener" 47 | } 48 | -------------------------------------------------------------------------------- /fabric/src/main/resources/super_resolution-fabric-compat.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "io.homo.superresolution.fabric.mixin.compat", 4 | "plugin": "io.homo.superresolution.fabric.mixin.compat.CompatMixinPlugin", 5 | "compatibilityLevel": "JAVA_8", 6 | "minVersion": "0.8", 7 | "client": [ 8 | "reesessodiumoptions.TabFrameMixin", 9 | "sodium.GraphicsAdapterProbeMixin", 10 | "sodium.SodiumOptionsGUIMixin" 11 | ], 12 | "mixins": [ 13 | "iris.GlFramebufferMixin", 14 | "sodiumoptionsapi.SodiumOptionsTabFrameMixin" 15 | ], 16 | "injectors": { 17 | "defaultRequire": 1 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /fabric/src/main/resources/super_resolution-fabric.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "io.homo.superresolution.fabric.mixin", 4 | "compatibilityLevel": "JAVA_8", 5 | "minVersion": "0.8", 6 | "client": [ 7 | "core.MinecraftMixin" 8 | ], 9 | "mixins": [ 10 | ], 11 | "injectors": { 12 | "defaultRequire": 1 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /fabric/src/main/resources/super_resolution.accesswidener: -------------------------------------------------------------------------------- 1 | accessWidener v1 named 2 | accessible field net/minecraft/client/Minecraft mainRenderTarget Lcom/mojang/blaze3d/pipeline/RenderTarget; 3 | mutable field net/minecraft/client/Minecraft mainRenderTarget Lcom/mojang/blaze3d/pipeline/RenderTarget; 4 | -------------------------------------------------------------------------------- /forge/gradle.properties: -------------------------------------------------------------------------------- 1 | loom.platform=forge 2 | -------------------------------------------------------------------------------- /forge/src/main/java/io/homo/superresolution/forge/SuperResolutionForge.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.forge; 2 | 3 | import io.homo.superresolution.common.SuperResolution; 4 | import io.homo.superresolution.common.config.ConfigFile; 5 | import io.homo.superresolution.common.gui.ConfigScreenBuilder; 6 | 7 | import io.homo.superresolution.forge.compat.sodium.SodiumOptionScreen; 8 | import net.minecraftforge.fml.ModLoadingContext; 9 | import net.minecraftforge.fml.common.Mod; 10 | 11 | import net.minecraftforge.network.NetworkConstants; 12 | import net.minecraftforge.client.ConfigScreenHandler; 13 | import net.minecraftforge.fml.IExtensionPoint; 14 | 15 | @Mod(value = SuperResolution.MOD_ID) 16 | public final class SuperResolutionForge { 17 | public static SuperResolution mod; 18 | 19 | public SuperResolutionForge() { 20 | ConfigFile.read(); 21 | ModLoadingContext.get().registerExtensionPoint(ConfigScreenHandler.ConfigScreenFactory.class, () -> new ConfigScreenHandler.ConfigScreenFactory((mc, screen) -> ConfigScreenBuilder.create().buildConfigScreen(screen))); 22 | ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class, () -> new IExtensionPoint.DisplayTest(() -> NetworkConstants.IGNORESERVERONLY, (a, b) -> true)); 23 | if (io.homo.superresolution.common.platform.Platform.currentPlatform.isModLoaded("sodiumoptionsapi")) { 24 | SodiumOptionScreen.register(); 25 | } 26 | SuperResolution.preInit(); 27 | mod = new SuperResolution(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /forge/src/main/java/io/homo/superresolution/forge/mixin/compat/CompatMixinPlugin.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.forge.mixin.compat; 2 | 3 | import io.homo.superresolution.common.platform.Platform; 4 | import io.homo.superresolution.core.graphics.renderdoc.RenderDoc; 5 | import io.homo.superresolution.forge.platform.ForgePlatform; 6 | import org.objectweb.asm.tree.ClassNode; 7 | import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; 8 | import org.spongepowered.asm.mixin.extensibility.IMixinInfo; 9 | 10 | import java.util.List; 11 | import java.util.Set; 12 | 13 | public class CompatMixinPlugin implements IMixinConfigPlugin { 14 | private final String CLASS_START = "io.homo.superresolution.forge.mixin.compat."; 15 | 16 | public CompatMixinPlugin() { 17 | } 18 | 19 | public void onLoad(String s) { 20 | Platform.currentPlatform = new ForgePlatform(); 21 | Platform.currentPlatform.init(); 22 | if (Platform.currentPlatform.isDevelopmentEnvironment()) RenderDoc.init(); 23 | } 24 | 25 | public String getRefMapperConfig() { 26 | return null; 27 | } 28 | 29 | public boolean shouldApplyMixin(String s, String s1) { 30 | String modid = s1.replace(CLASS_START, "").split("\\.")[0]; 31 | return Platform.currentPlatform.isModLoaded(modid); 32 | } 33 | 34 | public void acceptTargets(Set set, Set set1) { 35 | } 36 | 37 | public List getMixins() { 38 | return List.of(); 39 | } 40 | 41 | public void preApply(String s, ClassNode classNode, String s1, IMixinInfo iMixinInfo) { 42 | } 43 | 44 | public void postApply(String s, ClassNode classNode, String s1, IMixinInfo iMixinInfo) { 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /forge/src/main/java/io/homo/superresolution/forge/mixin/compat/embeddium/EmbeddiumOptionMixin.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.forge.mixin.compat.embeddium; 2 | 3 | import me.jellysquid.mods.sodium.client.render.chunk.ShaderChunkRenderer; 4 | import net.minecraft.client.Minecraft; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | import org.embeddedt.embeddium.client.gui.options.OptionIdentifier; 10 | import org.embeddedt.embeddium.gui.EmbeddiumVideoOptionsScreen; 11 | import org.embeddedt.embeddium.gui.frame.tab.Tab; 12 | import net.minecraft.network.chat.Component; 13 | import com.google.common.collect.Multimap; 14 | import io.homo.superresolution.common.SuperResolution; 15 | import io.homo.superresolution.common.gui.ConfigScreenBuilder; 16 | 17 | @Mixin(EmbeddiumVideoOptionsScreen.class) 18 | public class EmbeddiumOptionMixin { 19 | @Inject(method = "createShaderPackButton", at = @At(value = "RETURN"), remap = false) 20 | private void addMyConfigScreen(Multimap> tabs, CallbackInfo ci) { 21 | tabs.put(SuperResolution.MOD_ID, 22 | Tab.createBuilder() 23 | .setTitle(Component.translatable("superresolution.name")) 24 | .setId(OptionIdentifier.create(SuperResolution.MOD_ID, "emb_configscreen")) 25 | .setOnSelectFunction(() -> { 26 | Minecraft.getInstance().setScreen(ConfigScreenBuilder.create().buildConfigScreen((EmbeddiumVideoOptionsScreen) (Object) this)); 27 | return false; 28 | }).build() 29 | ); 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /forge/src/main/java/io/homo/superresolution/forge/mixin/compat/sodiumoptionsapi/SodiumOptionsTabFrameMixin.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.forge.mixin.compat.sodiumoptionsapi; 2 | 3 | import io.homo.superresolution.common.SuperResolution; 4 | import io.homo.superresolution.common.gui.ConfigScreenBuilder; 5 | import org.embeddedt.embeddium.gui.frame.tab.Tab; 6 | import net.minecraft.client.Minecraft; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.Shadow; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Inject; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 12 | import toni.sodiumoptionsapi.gui.SodiumOptionsTabFrame; 13 | 14 | import java.util.Objects; 15 | 16 | @Mixin(value = SodiumOptionsTabFrame.class, remap = false) 17 | public class SodiumOptionsTabFrameMixin { 18 | @Shadow 19 | private String selectedHeader; 20 | 21 | @Inject(method = "setTab", at = @At(value = "HEAD"), cancellable = true) 22 | private void onSetTab(Tab tab, CallbackInfo ci) { 23 | if (Objects.equals(this.selectedHeader, SuperResolution.MOD_ID)) { 24 | Minecraft.getInstance().setScreen(ConfigScreenBuilder.create().buildConfigScreen(Minecraft.getInstance().screen)); 25 | ci.cancel(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /forge/src/main/java/io/homo/superresolution/forge/mixin/core/MinecraftMixin.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.forge.mixin.core; 2 | 3 | import io.homo.superresolution.common.SuperResolution; 4 | import io.homo.superresolution.forge.SuperResolutionForge; 5 | import net.minecraft.client.Minecraft; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Inject; 9 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 10 | 11 | @Mixin(Minecraft.class) 12 | public class MinecraftMixin { 13 | @Inject(at = @At(value = "RETURN"), method = "") 14 | private void onInitDone(CallbackInfo ci) { 15 | if (!SuperResolution.isPreInit) return; 16 | SuperResolution.initRendering(); 17 | SuperResolution.createAlgo(); 18 | SuperResolutionForge.mod.init(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /forge/src/main/java/io/homo/superresolution/forge/platform/ForgePlatform.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.forge.platform; 2 | 3 | import io.homo.superresolution.common.platform.EnvType; 4 | import io.homo.superresolution.common.platform.Platform; 5 | import net.minecraftforge.fml.ModList; 6 | import net.minecraftforge.fml.loading.FMLLoader; 7 | import net.minecraftforge.fml.loading.FMLPaths; 8 | import net.minecraftforge.fml.loading.LoadingModList; 9 | 10 | import java.nio.file.Path; 11 | 12 | public class ForgePlatform extends Platform { 13 | @Override 14 | public void init() { 15 | if (isInstallIris()) this.irisPlatform = new IrisForgePlatform(); 16 | } 17 | 18 | @Override 19 | public boolean isModLoaded(String modId) { 20 | return LoadingModList.get().getModFileById(modId) != null; 21 | } 22 | 23 | @Override 24 | public boolean isDevelopmentEnvironment() { 25 | return !FMLLoader.isProduction(); 26 | } 27 | 28 | @Override 29 | public String getModVersionString(String modId) { 30 | if (isModLoaded(modId)) return ModList.get().getModFileById(modId).versionString(); 31 | return null; 32 | } 33 | 34 | public EnvType getEnv() { 35 | return switch (FMLLoader.getDist()) { 36 | case CLIENT -> EnvType.CLIENT; 37 | case DEDICATED_SERVER -> EnvType.SERVER; 38 | }; 39 | } 40 | 41 | public Path getGameFolder() { 42 | return FMLPaths.GAMEDIR.get(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /forge/src/main/java/io/homo/superresolution/forge/platform/IrisForgePlatform.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.forge.platform; 2 | 3 | import io.homo.superresolution.common.platform.IrisPlatform; 4 | 5 | import java.lang.reflect.Method; 6 | 7 | public class IrisForgePlatform extends IrisPlatform { 8 | @Override 9 | public boolean isShaderPackInUse() { 10 | try{ 11 | Class irisApiClazz = Class.forName("net.irisshaders.iris.api.v0.IrisApi"); 12 | Method getInstanceMethod = irisApiClazz.getMethod("getInstance"); 13 | Object irisApiInstance = getInstanceMethod.invoke(null); 14 | Method isShaderPackInUseMethod = irisApiInstance.getClass().getMethod("isShaderPackInUse"); 15 | return (boolean) isShaderPackInUseMethod.invoke(irisApiInstance); 16 | } catch (Exception e) { 17 | return false; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /forge/src/main/resources/META-INF/accesstransformer.cfg: -------------------------------------------------------------------------------- 1 | public-f net.minecraft.client.Minecraft f_91042_ # f_91042_ 2 | -------------------------------------------------------------------------------- /forge/src/main/resources/META-INF/mods.toml: -------------------------------------------------------------------------------- 1 | modLoader = "javafml" 2 | loaderVersion = "*" 3 | issueTrackerURL = "https://github.com/187J3X1-114514/superresolution/issues" 4 | license = "MIT" 5 | 6 | [[mods]] 7 | modId = "super_resolution" 8 | version = "${version}" 9 | displayName = "Super Resolution" 10 | authors = "187J3X1" 11 | description = ''' 12 | 喵 13 | ''' 14 | logoFile = "super_resolution_logo.png" 15 | 16 | [[dependencies.super_resolution]] 17 | modId = "minecraft" 18 | mandatory = true 19 | versionRange = "{versionRange}" 20 | ordering = "NONE" 21 | side = "BOTH" 22 | 23 | [[dependencies.super_resolution]] 24 | modId = "architectury" 25 | mandatory = true 26 | versionRange = "[*,)" 27 | ordering = "NONE" 28 | side = "BOTH" 29 | 30 | [[dependencies.super_resolution]] 31 | modId = "cloth_config" 32 | mandatory = true 33 | versionRange = "[*,)" 34 | ordering = "NONE" 35 | side = "BOTH" 36 | 37 | [mods."sodium:options"] 38 | "mixin.features.render.gui.debug" = false 39 | 40 | [[mixins]] 41 | config = "super_resolution.mixins.json" 42 | [[mixins]] 43 | config = "super_resolution-forge.mixins.json" 44 | [[mixins]] 45 | config = "super_resolution-forge-compat.mixins.json" -------------------------------------------------------------------------------- /forge/src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "description": "super_resolution resources", 4 | "pack_format": 15 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /forge/src/main/resources/super_resolution-forge-compat.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "io.homo.superresolution.forge.mixin.compat", 4 | "plugin": "io.homo.superresolution.forge.mixin.compat.CompatMixinPlugin", 5 | "compatibilityLevel": "JAVA_8", 6 | "minVersion": "0.8", 7 | "client": [ 8 | "embeddium.EmbeddiumOptionMixin", 9 | "oculus.GlFramebufferMixin" 10 | ], 11 | "mixins": [ 12 | "embeddium.DefaultChunkRendererMixin", 13 | "embeddium.ShaderChunkRendererMixin", 14 | "sodiumoptionsapi.SodiumOptionsTabFrameMixin" 15 | ], 16 | "injectors": { 17 | "defaultRequire": 1 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /forge/src/main/resources/super_resolution-forge.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "io.homo.superresolution.forge.mixin", 4 | "compatibilityLevel": "JAVA_8", 5 | "minVersion": "0.8", 6 | "client": [ 7 | "core.MinecraftMixin" 8 | ], 9 | "mixins": [ 10 | ], 11 | "injectors": { 12 | "defaultRequire": 1 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx6G 2 | org.gradle.parallel=true 3 | mod_version=0.8.0-alpha.1 4 | maven_group=io.homo.SuperResolution 5 | archives_name=superresolution 6 | minecraft_version=1.20.1 7 | sr_enable_vulkan=true 8 | manifold_version=2024.1.54 -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.11-bin.zip 2 | -------------------------------------------------------------------------------- /libs/MixinSquared-0.2.0-beta.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/libs/MixinSquared-0.2.0-beta.6.jar -------------------------------------------------------------------------------- /libs/antlr4-runtime-4.13.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/libs/antlr4-runtime-4.13.1.jar -------------------------------------------------------------------------------- /libs/crackerslib-forge-1.20.1-0.4.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/libs/crackerslib-forge-1.20.1-0.4.4.jar -------------------------------------------------------------------------------- /libs/fabric-api-base-0.4.31+ef105b4977.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/libs/fabric-api-base-0.4.31+ef105b4977.jar -------------------------------------------------------------------------------- /libs/fabric-api-base-0.4.42+d1308ded19.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/libs/fabric-api-base-0.4.42+d1308ded19.jar -------------------------------------------------------------------------------- /libs/fabric-block-view-api-v2-1.0.10+9afaaf8c19.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/libs/fabric-block-view-api-v2-1.0.10+9afaaf8c19.jar -------------------------------------------------------------------------------- /libs/fabric-permissions-api-0.3.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/libs/fabric-permissions-api-0.3.1.jar -------------------------------------------------------------------------------- /libs/fabric-renderer-api-v1-3.4.0+acb05a3919.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/libs/fabric-renderer-api-v1-3.4.0+acb05a3919.jar -------------------------------------------------------------------------------- /libs/fabric-renderer-api-v1-5.0.0+babc52e504.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/libs/fabric-renderer-api-v1-5.0.0+babc52e504.jar -------------------------------------------------------------------------------- /libs/fabric-renderer-api-v1-6.0.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/libs/fabric-renderer-api-v1-6.0.0.jar -------------------------------------------------------------------------------- /libs/fabric-rendering-data-attachment-v1-0.3.48+73761d2e19.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/libs/fabric-rendering-data-attachment-v1-0.3.48+73761d2e19.jar -------------------------------------------------------------------------------- /libs/glsl-transformer-2.0.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/libs/glsl-transformer-2.0.1.jar -------------------------------------------------------------------------------- /libs/jcpp-1.4.14.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/libs/jcpp-1.4.14.jar -------------------------------------------------------------------------------- /libs/luaj-core-3.0.8-figura.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/libs/luaj-core-3.0.8-figura.jar -------------------------------------------------------------------------------- /libs/luaj-jse-3.0.8-figura.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/libs/luaj-jse-3.0.8-figura.jar -------------------------------------------------------------------------------- /libs/mixinsquared-neoforge-0.2.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/libs/mixinsquared-neoforge-0.2.0.jar -------------------------------------------------------------------------------- /libs/net.caffeinemc.sodium-neoforge-0.6.10+mc1.21.4-service.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/libs/net.caffeinemc.sodium-neoforge-0.6.10+mc1.21.4-service.jar -------------------------------------------------------------------------------- /libs/net.caffeinemc.sodium-neoforge-0.6.12+mc1.21.5-service.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/libs/net.caffeinemc.sodium-neoforge-0.6.12+mc1.21.5-service.jar -------------------------------------------------------------------------------- /libs/net.caffeinemc.sodium-neoforge-0.6.5+mc1.21.1-service.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/libs/net.caffeinemc.sodium-neoforge-0.6.5+mc1.21.1-service.jar -------------------------------------------------------------------------------- /native/README.md: -------------------------------------------------------------------------------- 1 | # Super Resolution Native 2 | 3 | # 构建 4 | 5 | * 使用`-DSRLIB_VERSION=0.0.0`指定版本 6 | 7 | ## Windows 8 | 9 | 注意: 10 | 11 | * 仅在GCC版本15.1.0,Windows11上测试过 12 | * 只可使用Mingw作为编译器 13 | 14 | ```shell 15 | cmake -B build -G "MinGW Makefiles" 16 | cmake --build build 17 | ``` 18 | 19 | ## Android 20 | 21 | ### 注意: 22 | 23 | * 仅在NDK版本28.0.12433566(r28b1),Windows11上测试过 24 | * ANDROID_ABI必须为arm64-v8a 25 | 26 | ```shell 27 | cmake . -B build -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=android-21 -DANDROID_NDK=$ANDROID_NDK_HOME -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake -G Ninja 28 | cmake --build build 29 | ``` 30 | 31 | ## Linux 32 | 33 | 注意: 34 | 35 | * 仅在GCC版本11.4.0,Windows11+WSL2上测试过 36 | * 只可使用GCC作为编译器 37 | 38 | ```shell 39 | cmake -B build 40 | cmake --build build 41 | ``` 42 | 43 | # 许可证 44 | 45 | 这部分代码遵循LGPLv3协议 -------------------------------------------------------------------------------- /native/cpp/glslang-commit-hash: -------------------------------------------------------------------------------- 1 | 963588074b26326ff0426c8953c1235213309bdb -------------------------------------------------------------------------------- /native/cpp/include/define.h: -------------------------------------------------------------------------------- 1 | #define JAVA_GLSLANG_INCLUDER_HELPER "io/homo/superresolution/core/graphics/glslang/FileIncluder" 2 | #define JAVA_GLSLANG_COMPILE_RESULT "io/homo/superresolution/core/graphics/glslang/GlslangCompileShaderResult" 3 | #define JAVA_CPPHELPER_CLASS "io/homo/superresolution/core/SuperResolutionNativeHelper" 4 | #ifndef SRLIB_VERSION 5 | #define SRLIB_VERSION "NO-DEFINED" 6 | #endif 7 | -------------------------------------------------------------------------------- /native/cpp/include/utils.h: -------------------------------------------------------------------------------- 1 | 2 | #include "JNI0.h" 3 | 4 | void java_log(const char* msg,int level); 5 | void set_env(JNIEnv * env); 6 | JNIEnv* get_env(); 7 | void check_env(JNIEnv *env); 8 | bool ToCppBool(jboolean value); 9 | 10 | -------------------------------------------------------------------------------- /native/cpp/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "jni_header.h" 2 | #include 3 | #include "define.h" 4 | #include "utils.h" 5 | 6 | JNIEXPORT jstring JNICALL Java_io_homo_superresolution_core_SuperResolutionNative_getVersionInfo(JNIEnv *env, jclass) 7 | { 8 | check_env(env); 9 | return (env)->NewStringUTF(SRLIB_VERSION); 10 | } 11 | 12 | JNIEXPORT void JNICALL Java_io_homo_superresolution_core_SuperResolutionNative_freeDirectBuffer(JNIEnv *env, jclass, jobject buffer) 13 | { 14 | check_env(env); 15 | void *ptr = env->GetDirectBufferAddress(buffer); 16 | if (ptr) 17 | free(ptr); 18 | } 19 | -------------------------------------------------------------------------------- /native/cpp/src/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | #include 3 | #include 4 | #include "define.h" 5 | 6 | JNIEnv *cur_env; 7 | void set_env(JNIEnv *env) 8 | { 9 | cur_env = env; 10 | } 11 | 12 | JNIEnv *get_env() 13 | { 14 | return cur_env; 15 | } 16 | 17 | void check_env(JNIEnv *env) 18 | { 19 | set_env(env); 20 | } 21 | 22 | void java_log(const char *msg, int level) 23 | { 24 | jclass cpp_helper = cur_env->FindClass(JAVA_CPPHELPER_CLASS); 25 | jmethodID methodID = cur_env->GetStaticMethodID(cpp_helper, "CPP_Log", "(Ljava/lang/String;I)V"); 26 | jstring jmsg = cur_env->NewStringUTF(msg); 27 | cur_env->CallStaticVoidMethod(cpp_helper, methodID, jmsg, jint(level)); 28 | cur_env->DeleteLocalRef(jmsg); 29 | } 30 | 31 | 32 | bool ToCppBool(jboolean value) 33 | { 34 | return value == JNI_TRUE; 35 | } 36 | -------------------------------------------------------------------------------- /native/cpp/third_party/JNI0.h: -------------------------------------------------------------------------------- 1 | #ifdef ON_LINUX64 2 | #include "jni_linux64.h" 3 | #elif defined(ON_WIN64) 4 | #include "jni_win64.h" 5 | #elif defined(ON_ANDROID) 6 | #include 7 | #else 8 | #include "jni_win64.h" 9 | #endif -------------------------------------------------------------------------------- /native/cpp/third_party/jni_md_linux64.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved. 4 | * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 5 | * 6 | * 7 | * 8 | * 9 | * 10 | * 11 | * 12 | * 13 | * 14 | * 15 | * 16 | * 17 | * 18 | * 19 | * 20 | * 21 | * 22 | * 23 | * 24 | * 25 | */ 26 | 27 | #ifndef _JAVASOFT_JNI_MD_H_ 28 | #define _JAVASOFT_JNI_MD_H_ 29 | 30 | #ifndef __has_attribute 31 | #define __has_attribute(x) 0 32 | #endif 33 | 34 | #ifndef JNIEXPORT 35 | #if (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ > 2))) || __has_attribute(visibility) 36 | #ifdef ARM 37 | #define JNIEXPORT __attribute__((externally_visible,visibility("default"))) 38 | #else 39 | #define JNIEXPORT __attribute__((visibility("default"))) 40 | #endif 41 | #else 42 | #define JNIEXPORT 43 | #endif 44 | #endif 45 | 46 | #if (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ > 2))) || __has_attribute(visibility) 47 | #ifdef ARM 48 | #define JNIIMPORT __attribute__((externally_visible,visibility("default"))) 49 | #else 50 | #define JNIIMPORT __attribute__((visibility("default"))) 51 | #endif 52 | #else 53 | #define JNIIMPORT 54 | #endif 55 | 56 | #define JNICALL 57 | 58 | typedef int jint; 59 | #ifdef _LP64 60 | typedef long jlong; 61 | #else 62 | typedef long long jlong; 63 | #endif 64 | 65 | typedef signed char jbyte; 66 | 67 | #endif /* !_JAVASOFT_JNI_MD_H_ */ 68 | -------------------------------------------------------------------------------- /native/cpp/third_party/jni_md_win64.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved. 3 | * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 4 | * 5 | * 6 | * 7 | * 8 | * 9 | * 10 | * 11 | * 12 | * 13 | * 14 | * 15 | * 16 | * 17 | * 18 | * 19 | * 20 | * 21 | * 22 | * 23 | * 24 | */ 25 | 26 | #ifndef _JAVASOFT_JNI_MD_H_ 27 | #define _JAVASOFT_JNI_MD_H_ 28 | 29 | #ifndef JNIEXPORT 30 | #define JNIEXPORT __declspec(dllexport) 31 | #endif 32 | #define JNIIMPORT __declspec(dllimport) 33 | #define JNICALL __stdcall 34 | 35 | // 'long' is always 32 bit on windows so this matches what jdk expects 36 | typedef long jint; 37 | typedef __int64 jlong; 38 | typedef signed char jbyte; 39 | 40 | #endif /* !_JAVASOFT_JNI_MD_H_ */ 41 | -------------------------------------------------------------------------------- /native/cpp/third_party/libs/android/libGenericCodeGen.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/android/libGenericCodeGen.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/android/libMachineIndependent.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/android/libMachineIndependent.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/android/libOSDependent.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/android/libOSDependent.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/android/libSPIRV-Tools-diff.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/android/libSPIRV-Tools-diff.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/android/libSPIRV-Tools-link.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/android/libSPIRV-Tools-link.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/android/libSPIRV-Tools-lint.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/android/libSPIRV-Tools-lint.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/android/libSPIRV-Tools-opt.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/android/libSPIRV-Tools-opt.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/android/libSPIRV-Tools-reduce.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/android/libSPIRV-Tools-reduce.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/android/libSPIRV-Tools-shared.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/android/libSPIRV-Tools-shared.so -------------------------------------------------------------------------------- /native/cpp/third_party/libs/android/libSPIRV-Tools.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/android/libSPIRV-Tools.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/android/libSPIRV.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/android/libSPIRV.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/android/libSPVRemapper.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/android/libSPVRemapper.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/android/libglslang-default-resource-limits.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/android/libglslang-default-resource-limits.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/android/libglslang.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/android/libglslang.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/linux64/libGenericCodeGen.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/linux64/libGenericCodeGen.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/linux64/libMachineIndependent.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/linux64/libMachineIndependent.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/linux64/libOSDependent.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/linux64/libOSDependent.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/linux64/libSPIRV-Tools-diff.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/linux64/libSPIRV-Tools-diff.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/linux64/libSPIRV-Tools-link.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/linux64/libSPIRV-Tools-link.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/linux64/libSPIRV-Tools-lint.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/linux64/libSPIRV-Tools-lint.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/linux64/libSPIRV-Tools-opt.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/linux64/libSPIRV-Tools-opt.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/linux64/libSPIRV-Tools-reduce.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/linux64/libSPIRV-Tools-reduce.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/linux64/libSPIRV-Tools-shared.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/linux64/libSPIRV-Tools-shared.so -------------------------------------------------------------------------------- /native/cpp/third_party/libs/linux64/libSPIRV-Tools.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/linux64/libSPIRV-Tools.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/linux64/libSPIRV.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/linux64/libSPIRV.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/linux64/libSPVRemapper.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/linux64/libSPVRemapper.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/linux64/libglslang-default-resource-limits.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/linux64/libglslang-default-resource-limits.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/linux64/libglslang.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/linux64/libglslang.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/win64/libGenericCodeGen.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/win64/libGenericCodeGen.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/win64/libMachineIndependent.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/win64/libMachineIndependent.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/win64/libOSDependent.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/win64/libOSDependent.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/win64/libSPIRV-Tools-diff.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/win64/libSPIRV-Tools-diff.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/win64/libSPIRV-Tools-link.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/win64/libSPIRV-Tools-link.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/win64/libSPIRV-Tools-lint.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/win64/libSPIRV-Tools-lint.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/win64/libSPIRV-Tools-opt.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/win64/libSPIRV-Tools-opt.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/win64/libSPIRV-Tools-reduce.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/win64/libSPIRV-Tools-reduce.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/win64/libSPIRV-Tools-shared.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/win64/libSPIRV-Tools-shared.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/win64/libSPIRV-Tools.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/win64/libSPIRV-Tools.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/win64/libSPIRV.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/win64/libSPIRV.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/win64/libSPVRemapper.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/win64/libSPVRemapper.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/win64/libglslang-default-resource-limits.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/win64/libglslang-default-resource-limits.a -------------------------------------------------------------------------------- /native/cpp/third_party/libs/win64/libglslang.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/native/cpp/third_party/libs/win64/libglslang.a -------------------------------------------------------------------------------- /native/cpp/third_party/vk_video/vulkan_video_codecs_common.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_VIDEO_CODECS_COMMON_H_ 2 | #define VULKAN_VIDEO_CODECS_COMMON_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // vulkan_video_codecs_common is a preprocessor guard. Do not pass it to API calls. 23 | #define vulkan_video_codecs_common 1 24 | #if !defined(VK_NO_STDINT_H) 25 | #include 26 | #endif 27 | 28 | #define VK_MAKE_VIDEO_STD_VERSION(major, minor, patch) \ 29 | ((((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch))) 30 | 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /native/cpp/third_party/vulkan/vulkan_ios.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_IOS_H_ 2 | #define VULKAN_IOS_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // VK_MVK_ios_surface is a preprocessor guard. Do not pass it to API calls. 23 | #define VK_MVK_ios_surface 1 24 | #define VK_MVK_IOS_SURFACE_SPEC_VERSION 3 25 | #define VK_MVK_IOS_SURFACE_EXTENSION_NAME "VK_MVK_ios_surface" 26 | typedef VkFlags VkIOSSurfaceCreateFlagsMVK; 27 | typedef struct VkIOSSurfaceCreateInfoMVK { 28 | VkStructureType sType; 29 | const void* pNext; 30 | VkIOSSurfaceCreateFlagsMVK flags; 31 | const void* pView; 32 | } VkIOSSurfaceCreateInfoMVK; 33 | 34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateIOSSurfaceMVK)(VkInstance instance, const VkIOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 35 | 36 | #ifndef VK_NO_PROTOTYPES 37 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateIOSSurfaceMVK( 38 | VkInstance instance, 39 | const VkIOSSurfaceCreateInfoMVK* pCreateInfo, 40 | const VkAllocationCallbacks* pAllocator, 41 | VkSurfaceKHR* pSurface); 42 | #endif 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /native/cpp/third_party/vulkan/vulkan_macos.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_MACOS_H_ 2 | #define VULKAN_MACOS_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // VK_MVK_macos_surface is a preprocessor guard. Do not pass it to API calls. 23 | #define VK_MVK_macos_surface 1 24 | #define VK_MVK_MACOS_SURFACE_SPEC_VERSION 3 25 | #define VK_MVK_MACOS_SURFACE_EXTENSION_NAME "VK_MVK_macos_surface" 26 | typedef VkFlags VkMacOSSurfaceCreateFlagsMVK; 27 | typedef struct VkMacOSSurfaceCreateInfoMVK { 28 | VkStructureType sType; 29 | const void* pNext; 30 | VkMacOSSurfaceCreateFlagsMVK flags; 31 | const void* pView; 32 | } VkMacOSSurfaceCreateInfoMVK; 33 | 34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateMacOSSurfaceMVK)(VkInstance instance, const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 35 | 36 | #ifndef VK_NO_PROTOTYPES 37 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateMacOSSurfaceMVK( 38 | VkInstance instance, 39 | const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, 40 | const VkAllocationCallbacks* pAllocator, 41 | VkSurfaceKHR* pSurface); 42 | #endif 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /native/cpp/third_party/vulkan/vulkan_vi.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_VI_H_ 2 | #define VULKAN_VI_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // VK_NN_vi_surface is a preprocessor guard. Do not pass it to API calls. 23 | #define VK_NN_vi_surface 1 24 | #define VK_NN_VI_SURFACE_SPEC_VERSION 1 25 | #define VK_NN_VI_SURFACE_EXTENSION_NAME "VK_NN_vi_surface" 26 | typedef VkFlags VkViSurfaceCreateFlagsNN; 27 | typedef struct VkViSurfaceCreateInfoNN { 28 | VkStructureType sType; 29 | const void* pNext; 30 | VkViSurfaceCreateFlagsNN flags; 31 | void* window; 32 | } VkViSurfaceCreateInfoNN; 33 | 34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateViSurfaceNN)(VkInstance instance, const VkViSurfaceCreateInfoNN* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 35 | 36 | #ifndef VK_NO_PROTOTYPES 37 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateViSurfaceNN( 38 | VkInstance instance, 39 | const VkViSurfaceCreateInfoNN* pCreateInfo, 40 | const VkAllocationCallbacks* pAllocator, 41 | VkSurfaceKHR* pSurface); 42 | #endif 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /native/cpp/third_party/vulkan/vulkan_xlib_xrandr.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_XLIB_XRANDR_H_ 2 | #define VULKAN_XLIB_XRANDR_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // VK_EXT_acquire_xlib_display is a preprocessor guard. Do not pass it to API calls. 23 | #define VK_EXT_acquire_xlib_display 1 24 | #define VK_EXT_ACQUIRE_XLIB_DISPLAY_SPEC_VERSION 1 25 | #define VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME "VK_EXT_acquire_xlib_display" 26 | typedef VkResult (VKAPI_PTR *PFN_vkAcquireXlibDisplayEXT)(VkPhysicalDevice physicalDevice, Display* dpy, VkDisplayKHR display); 27 | typedef VkResult (VKAPI_PTR *PFN_vkGetRandROutputDisplayEXT)(VkPhysicalDevice physicalDevice, Display* dpy, RROutput rrOutput, VkDisplayKHR* pDisplay); 28 | 29 | #ifndef VK_NO_PROTOTYPES 30 | VKAPI_ATTR VkResult VKAPI_CALL vkAcquireXlibDisplayEXT( 31 | VkPhysicalDevice physicalDevice, 32 | Display* dpy, 33 | VkDisplayKHR display); 34 | 35 | VKAPI_ATTR VkResult VKAPI_CALL vkGetRandROutputDisplayEXT( 36 | VkPhysicalDevice physicalDevice, 37 | Display* dpy, 38 | RROutput rrOutput, 39 | VkDisplayKHR* pDisplay); 40 | #endif 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /neoforge/gradle.properties: -------------------------------------------------------------------------------- 1 | loom.platform=neoforge 2 | -------------------------------------------------------------------------------- /neoforge/src/main/java/io/homo/superresolution/neoforge/SuperResolutionNeoForge.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.neoforge; 2 | 3 | import io.homo.superresolution.common.SuperResolution; 4 | import io.homo.superresolution.common.config.ConfigFile; 5 | import io.homo.superresolution.common.gui.ConfigScreenBuilder; 6 | import io.homo.superresolution.neoforge.compat.sodium.SodiumOptionScreen; 7 | import net.neoforged.api.distmarker.Dist; 8 | import net.neoforged.fml.ModContainer; 9 | import net.neoforged.fml.ModLoadingContext; 10 | import net.neoforged.fml.common.Mod; 11 | import net.neoforged.fml.loading.FMLConfig; 12 | import net.neoforged.fml.loading.FMLLoader; 13 | import net.neoforged.neoforge.client.gui.IConfigScreenFactory; 14 | 15 | 16 | @Mod(value = SuperResolution.MOD_ID, dist = Dist.CLIENT) 17 | public final class SuperResolutionNeoForge { 18 | public static SuperResolution mod; 19 | 20 | public SuperResolutionNeoForge(ModContainer container) { 21 | ConfigFile.read(); 22 | ModLoadingContext.get().registerExtensionPoint(IConfigScreenFactory.class, () -> (mc, screen) -> ConfigScreenBuilder.create().buildConfigScreen(screen)); 23 | mod = new SuperResolution(); 24 | SuperResolution.preInit(); 25 | if (io.homo.superresolution.common.platform.Platform.currentPlatform.isModLoaded("sodiumoptionsapi")) { 26 | SodiumOptionScreen.register(); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /neoforge/src/main/java/io/homo/superresolution/neoforge/mixin/compat/reesessodiumoptions/TabFrameMixin.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.neoforge.mixin.compat.reesessodiumoptions; 2 | 3 | 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.injection.At; 6 | import org.spongepowered.asm.mixin.injection.Inject; 7 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 8 | import net.minecraft.client.Minecraft; 9 | import net.minecraft.network.chat.Component; 10 | 11 | import java.util.Optional; 12 | 13 | import io.homo.superresolution.common.gui.ConfigScreenBuilder; 14 | 15 | #if MC_VER != 1 16 | import me.flashyreese.mods.reeses_sodium_options.client.gui.frame.tab.Tab; 17 | import me.flashyreese.mods.reeses_sodium_options.client.gui.frame.tab.TabFrame; 18 | 19 | @Mixin(value = TabFrame.class, remap = false) 20 | public class TabFrameMixin { 21 | @Inject(method = "setTab", at = @At(value = "HEAD"), cancellable = true) 22 | private void onSetTab(Optional> tab, CallbackInfo ci) { 23 | if (tab.orElseThrow().getTitle().getString().equals(Component.translatable("superresolution.screen.config.name").getString())) { 24 | Minecraft.getInstance().setScreen(ConfigScreenBuilder.create().buildConfigScreen(Minecraft.getInstance().screen)); 25 | ci.cancel(); 26 | } 27 | } 28 | } 29 | #else 30 | @Mixin(value = Minecraft.class) 31 | public class TabFrameMixin { 32 | } 33 | #endif -------------------------------------------------------------------------------- /neoforge/src/main/java/io/homo/superresolution/neoforge/mixin/compat/sodiumoptionsapi/SodiumOptionsTabFrameMixin.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.neoforge.mixin.compat.sodiumoptionsapi; 2 | 3 | import io.homo.superresolution.common.SuperResolution; 4 | import io.homo.superresolution.common.gui.ConfigScreenBuilder; 5 | import net.minecraft.client.Minecraft; 6 | import net.minecraft.network.chat.Component; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.Shadow; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Inject; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 12 | 13 | import java.util.Objects; 14 | 15 | #if MC_VER != 1 16 | import me.flashyreese.mods.reeses_sodium_options.client.gui.frame.tab.Tab; 17 | import toni.sodiumoptionsapi.gui.SodiumOptionsTabFrame; 18 | 19 | @Mixin(SodiumOptionsTabFrame.class) 20 | public class SodiumOptionsTabFrameMixin { 21 | @Shadow 22 | private String selectedHeader; 23 | 24 | @Inject(method = "setTab", at = @At(value = "HEAD"), cancellable = true) 25 | private void onSetTab(Tab tab, CallbackInfo ci) { 26 | if (Objects.equals(this.selectedHeader, SuperResolution.MOD_ID)) { 27 | Minecraft.getInstance().setScreen(ConfigScreenBuilder.create().buildConfigScreen(Minecraft.getInstance().screen)); 28 | ci.cancel(); 29 | } 30 | } 31 | } 32 | #else 33 | @Mixin(Minecraft.class) 34 | public class SodiumOptionsTabFrameMixin { 35 | } 36 | #endif -------------------------------------------------------------------------------- /neoforge/src/main/java/io/homo/superresolution/neoforge/mixin/core/MinecraftMixin.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.neoforge.mixin.core; 2 | 3 | import io.homo.superresolution.common.SuperResolution; 4 | import io.homo.superresolution.neoforge.SuperResolutionNeoForge; 5 | import net.minecraft.client.Minecraft; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Inject; 9 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 10 | 11 | @Mixin(Minecraft.class) 12 | public class MinecraftMixin { 13 | @Inject(at = @At(value = "RETURN"), method = "") 14 | private void onInitDone(CallbackInfo ci) { 15 | SuperResolution.initRendering(); 16 | } 17 | 18 | @Inject(at = @At(value = "TAIL"), method = "onGameLoadFinished") 19 | private void onLoadFinished(CallbackInfo ci) { 20 | SuperResolution.createAlgo(); 21 | SuperResolutionNeoForge.mod.init(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /neoforge/src/main/java/io/homo/superresolution/neoforge/platform/IrisNeoForgePlatform.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.neoforge.platform; 2 | 3 | import io.homo.superresolution.common.platform.IrisPlatform; 4 | 5 | import java.lang.reflect.Method; 6 | 7 | public class IrisNeoForgePlatform extends IrisPlatform { 8 | @Override 9 | public boolean isShaderPackInUse() { 10 | try { 11 | Class irisApiClazz = Class.forName("net.irisshaders.iris.api.v0.IrisApi"); 12 | Method getInstanceMethod = irisApiClazz.getMethod("getInstance"); 13 | Object irisApiInstance = getInstanceMethod.invoke(null); 14 | Method isShaderPackInUseMethod = irisApiInstance.getClass().getMethod("isShaderPackInUse"); 15 | return (boolean) isShaderPackInUseMethod.invoke(irisApiInstance); 16 | } catch (Exception e) { 17 | return false; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /neoforge/src/main/java/io/homo/superresolution/neoforge/platform/NeoForgePlatform.java: -------------------------------------------------------------------------------- 1 | package io.homo.superresolution.neoforge.platform; 2 | 3 | import io.homo.superresolution.common.platform.EnvType; 4 | import io.homo.superresolution.common.platform.Platform; 5 | import net.neoforged.fml.ModList; 6 | import net.neoforged.fml.loading.FMLLoader; 7 | import net.neoforged.fml.loading.LoadingModList; 8 | 9 | import java.nio.file.Path; 10 | 11 | public class NeoForgePlatform extends Platform { 12 | @Override 13 | public void init() { 14 | this.irisPlatform = new IrisNeoForgePlatform(); 15 | } 16 | 17 | @Override 18 | public boolean isModLoaded(String modId) { 19 | return LoadingModList.get().getModFileById(modId) != null; 20 | } 21 | 22 | @Override 23 | public boolean isDevelopmentEnvironment() { 24 | return !FMLLoader.isProduction(); 25 | } 26 | 27 | @Override 28 | public String getModVersionString(String modId) { 29 | if (isModLoaded(modId)) return ModList.get().getModFileById(modId).versionString(); 30 | return null; 31 | } 32 | 33 | @Override 34 | public EnvType getEnv() { 35 | return FMLLoader.getDist().isClient() ? EnvType.CLIENT : EnvType.SERVER; 36 | } 37 | 38 | @Override 39 | public Path getGameFolder() { 40 | return FMLLoader.getGamePath(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /neoforge/src/main/resources/META-INF/accesstransformer.cfg: -------------------------------------------------------------------------------- 1 | public-f net.minecraft.client.Minecraft f_91042_ # f_91042_ 2 | -------------------------------------------------------------------------------- /neoforge/src/main/resources/META-INF/neoforge.mods.toml: -------------------------------------------------------------------------------- 1 | modLoader = "javafml" 2 | loaderVersion = "*" 3 | issueTrackerURL = "https://github.com/187J3X1-114514/superresolution/issues" 4 | license = "MIT" 5 | 6 | [[mods]] 7 | modId = "super_resolution" 8 | version = "${version}" 9 | displayName = "Super Resolution" 10 | authors = "187J3X1" 11 | description = ''' 12 | 喵 13 | ''' 14 | logoFile = "assets/super_resolution/textures/logo.png" 15 | 16 | [[dependencies.super_resolution]] 17 | modId = "minecraft" 18 | mandatory = true 19 | versionRange = "${versionRange}" 20 | ordering = "NONE" 21 | side = "BOTH" 22 | 23 | [[dependencies.super_resolution]] 24 | modId = "architectury" 25 | mandatory = true 26 | versionRange = "[*,)" 27 | ordering = "NONE" 28 | side = "BOTH" 29 | 30 | [[dependencies.super_resolution]] 31 | modId = "cloth_config" 32 | mandatory = true 33 | versionRange = "[*,)" 34 | ordering = "NONE" 35 | side = "BOTH" 36 | 37 | [mods."sodium:options"] 38 | "mixin.features.render.gui.debug" = false 39 | 40 | [[mixins]] 41 | config = "super_resolution.mixins.json" 42 | [[mixins]] 43 | config = "super_resolution-neoforge.mixins.json" 44 | [[mixins]] 45 | config = "super_resolution-neoforge-compat.mixins.json" -------------------------------------------------------------------------------- /neoforge/src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "description": "super_resolution resources", 4 | "pack_format": 15 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /neoforge/src/main/resources/super_resolution-neoforge-compat.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "io.homo.superresolution.neoforge.mixin.compat", 4 | "plugin": "io.homo.superresolution.neoforge.mixin.compat.CompatMixinPlugin", 5 | "compatibilityLevel": "JAVA_21", 6 | "minVersion": "0.8", 7 | "client": [ 8 | "iris.GlFramebufferMixin", 9 | "reesessodiumoptions.TabFrameMixin", 10 | "sodium.SodiumOptionsGUIMixin", 11 | "sodiumoptionsapi.SodiumOptionsTabFrameMixin" 12 | ], 13 | "mixins": [ 14 | ], 15 | "injectors": { 16 | "defaultRequire": 1 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /neoforge/src/main/resources/super_resolution-neoforge.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "io.homo.superresolution.neoforge.mixin", 4 | "compatibilityLevel": "JAVA_21", 5 | "minVersion": "0.8", 6 | "client": [ 7 | "core.MinecraftMixin" 8 | ], 9 | "mixins": [ 10 | ], 11 | "injectors": { 12 | "defaultRequire": 1 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /renderdoc/renderdoc.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/renderdoc/renderdoc.dll -------------------------------------------------------------------------------- /script/consts.py: -------------------------------------------------------------------------------- 1 | class MinecraftLoader: 2 | FABRIC = "fabric" 3 | FORGE = "forge" 4 | NEOFORGE = "neoforge" 5 | -------------------------------------------------------------------------------- /script/uploadMcmod.py: -------------------------------------------------------------------------------- 1 | import os 2 | import re 3 | import json 4 | import sys 5 | import shutil 6 | import time 7 | import utils 8 | import uploader_mcmod 9 | 10 | from pathlib import Path 11 | from typing import Dict, List, Optional 12 | 13 | if len(sys.argv) < 3: 14 | print("使用: python upload.py ") 15 | sys.exit(1) 16 | ################# 17 | INPUT_DIR = "build_jars" 18 | MCMOD_UUID = sys.argv[1] 19 | MCMOD_PHPSESSID = sys.argv[2] 20 | ################# 21 | print("MCMOD_UUID", MCMOD_UUID) 22 | print("MCMOD_PHPSESSID", MCMOD_PHPSESSID) 23 | cur_path = Path.cwd() 24 | input_dir = cur_path / INPUT_DIR 25 | 26 | files = list(input_dir.glob("*.jar")) 27 | uploader = uploader_mcmod.MCMODModUploader( 28 | "17888", 29 | { 30 | "_uuid": MCMOD_UUID, 31 | "PHPSESSID": MCMOD_PHPSESSID, 32 | }, 33 | ) 34 | for file in files: 35 | info = utils.parse_version_string(file.stem) 36 | print("info", info) 37 | print( 38 | uploader.upload_file( 39 | file_path=file, 40 | mc_version=info["mc_version"], 41 | platform_ids=[1], 42 | api_ids=[utils.to_mcmod_api_string(info["loader"])], 43 | tag_names=["client"], 44 | ) 45 | ) 46 | -------------------------------------------------------------------------------- /script/uploadModrinth.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/script/uploadModrinth.py -------------------------------------------------------------------------------- /script/uploader_modrinth.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/187J3X1-114514/superresolution/59d38d1585a04494571dfaf2a9172e4b42cfa454/script/uploader_modrinth.py -------------------------------------------------------------------------------- /script/utils.py: -------------------------------------------------------------------------------- 1 | def parse_version_string(version_string: str): 2 | """ 3 | 解析类似superresolution-fabric-1.20.1-0.6.2-alpha.1的文件名称转换成版本信息 4 | { 5 | "loader":"fabric", 6 | "mc_version":"1.20.1", 7 | "mod_version":"0.6.2-alpha.1", 8 | } 9 | """ 10 | version_string = version_string.replace(".jar", "") 11 | parts = version_string.split("-") 12 | if len(parts) < 4: 13 | raise ValueError("Invalid version string format") 14 | 15 | loader = parts[1] 16 | mc_version = parts[2] 17 | mod_version = "-".join(parts[3:]) 18 | 19 | return { 20 | "loader": loader, 21 | "mc_version": mc_version, 22 | "mod_version": mod_version, 23 | } 24 | 25 | 26 | def to_mcmod_api_string(loader: str): 27 | loader_mapping = { 28 | "forge": 1, 29 | "fabric": 2, 30 | "neoforge": 13, 31 | } 32 | return loader_mapping.get(loader, 0) 33 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | import groovy.json.JsonSlurper 2 | 3 | pluginManagement { 4 | repositories { 5 | mavenLocal() 6 | maven { url 'https://maven.aliyun.com/repository/central' } 7 | maven { url 'https://maven.aliyun.com/repository/gradle-plugin' } 8 | maven { 9 | name 'ParchmentMC' 10 | url 'https://ldtteam.jfrog.io/artifactory/parchmentmc/' 11 | } 12 | 13 | maven { 14 | url "https://maven.architectury.dev/" 15 | } 16 | maven { 17 | url "https://maven.nucleoid.xyz/" 18 | } 19 | maven { url "https://maven.shedaniel.me/" } 20 | maven { 21 | url "https://maven.neoforged.net/releases" 22 | } 23 | maven { 24 | url "https://libraries.minecraft.net" 25 | } 26 | maven { 27 | url "https://maven.fabricmc.net/" 28 | } 29 | 30 | maven { url "https://crystal.app.lss233.com/repositories/minecraft/" } 31 | gradlePluginPortal() 32 | } 33 | } 34 | 35 | def loadConfig() { 36 | gradle.ext.set("versionConfigSrc", new JsonSlurper().parse(new File("$rootDir/versionConfigs/" + "$minecraft_version" + ".json"))) 37 | } 38 | 39 | loadConfig() 40 | sr_enable_vulkan = sr_enable_vulkan == "true" 41 | rootProject.name = 'super_resolution' 42 | include 'native' 43 | include 'common' 44 | for (loader in gradle.ext.versionConfigSrc.common.platforms) { 45 | def loaderName = loader.strip() 46 | if (loaderName.isEmpty() || loaderName.isBlank()) continue 47 | println "添加加载器 " + loaderName 48 | include(loaderName) 49 | } 50 | 51 | -------------------------------------------------------------------------------- /versionConfigs/1.20.4.json: -------------------------------------------------------------------------------- 1 | { 2 | "common": { 3 | "java_version": 17, 4 | "minecraft_version": "1.20.4", 5 | "parchment_version": "1.20.4:2024.04.14", 6 | "platforms": [ 7 | "fabric" 8 | ], 9 | "lwjgl_version": "3.3.1", 10 | "architectury_api_version": "11.1.17", 11 | "forge": { 12 | "minecraft_version_range": "[1.20.4,)" 13 | }, 14 | "fabric": { 15 | "minecraft_version_range": [ 16 | "~1.20.4" 17 | ] 18 | }, 19 | "cloth_config_version": "13.0.138", 20 | "mod_artifact_minecraft_ver": "1.20.4" 21 | }, 22 | "fabric": { 23 | "loader_version": "0.16.10", 24 | "api_version": "0.97.2+1.20.4", 25 | "dependencies": { 26 | "modrinth": [ 27 | { 28 | "name": "iris", 29 | "version": "1.7.2+1.20.4" 30 | }, 31 | { 32 | "name": "sodium", 33 | "version": "mc1.20.4-0.5.8" 34 | }, 35 | { 36 | "name": "reeses-sodium-options", 37 | "version": "mc1.20.4-1.7.2" 38 | } 39 | ], 40 | "local": [] 41 | }, 42 | "modmenu_version": "9.2.0" 43 | } 44 | } --------------------------------------------------------------------------------