├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ ├── config.yml │ └── feature_request.yml └── workflows │ └── build.yml ├── .gitignore ├── LICENSE ├── README.md ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src └── main ├── java └── net │ └── vulkanmod │ ├── Initializer.java │ ├── config │ ├── Config.java │ ├── Platform.java │ ├── gui │ │ ├── GuiElement.java │ │ ├── GuiRenderer.java │ │ ├── OptionBlock.java │ │ ├── VOptionList.java │ │ ├── VOptionScreen.java │ │ └── widget │ │ │ ├── CyclingOptionWidget.java │ │ │ ├── OptionWidget.java │ │ │ ├── RangeOptionWidget.java │ │ │ ├── SwitchOptionWidget.java │ │ │ ├── VAbstractWidget.java │ │ │ └── VButtonWidget.java │ ├── option │ │ ├── CyclingOption.java │ │ ├── Option.java │ │ ├── OptionPage.java │ │ ├── Options.java │ │ ├── RangeOption.java │ │ └── SwitchOption.java │ └── video │ │ ├── VideoModeManager.java │ │ ├── VideoModeSet.java │ │ └── WindowMode.java │ ├── gl │ ├── GlUtil.java │ ├── VkGlBuffer.java │ ├── VkGlFramebuffer.java │ ├── VkGlProgram.java │ ├── VkGlRenderbuffer.java │ └── VkGlTexture.java │ ├── interfaces │ ├── ExtendedRenderType.java │ ├── ExtendedVertexBuilder.java │ ├── FrustumMixed.java │ ├── ModelPartCubeMixed.java │ ├── ShaderMixed.java │ ├── VertexFormatMixed.java │ ├── VisibilitySetExtended.java │ ├── VoxelShapeExtended.java │ ├── biome │ │ └── BiomeManagerExtended.java │ └── color │ │ └── BlockColorsExtended.java │ ├── mixin │ ├── MixinPlugin.java │ ├── chunk │ │ ├── ClientChunkCacheM.java │ │ ├── ClientPacketListenerM.java │ │ ├── DirectionMixin.java │ │ ├── FrustumMixin.java │ │ ├── LevelRendererMixin.java │ │ ├── SectionBufferBuilderPoolM.java │ │ ├── SectionRenderDispatcherM.java │ │ ├── ViewAreaM.java │ │ └── VisibilitySetMixin.java │ ├── compatibility │ │ ├── EffectInstanceM.java │ │ ├── PostChainM.java │ │ ├── PostPassM.java │ │ ├── ProgramM.java │ │ ├── UniformM.java │ │ └── gl │ │ │ ├── GL11M.java │ │ │ ├── GL14M.java │ │ │ ├── GL15M.java │ │ │ └── GL30M.java │ ├── debug │ │ ├── DebugScreenOverlayM.java │ │ ├── GlDebugInfoM.java │ │ ├── KeyboardHandlerM.java │ │ └── crash_report │ │ │ └── SystemReportM.java │ ├── matrix │ │ ├── Matrix4fM.java │ │ └── PoseAccessor.java │ ├── profiling │ │ ├── GuiMixin.java │ │ ├── KeyboardHandlerM.java │ │ └── LevelRendererMixin.java │ ├── render │ │ ├── BufferUploaderM.java │ │ ├── GameRendererMixin.java │ │ ├── GlProgramManagerMixin.java │ │ ├── GlStateManagerM.java │ │ ├── MinecraftMixin.java │ │ ├── RenderSystemMixin.java │ │ ├── RenderTypeM.java │ │ ├── ShaderInstanceM.java │ │ ├── biome │ │ │ └── BiomeManagerM.java │ │ ├── block │ │ │ └── BakedQuadM.java │ │ ├── clouds │ │ │ └── LevelRendererM.java │ │ ├── color │ │ │ └── BlockColorsM.java │ │ ├── entity │ │ │ ├── EntityRendererM.java │ │ │ ├── LevelRendererM.java │ │ │ └── model │ │ │ │ ├── ModelPartCubeM.java │ │ │ │ └── ModelPartM.java │ │ ├── frame │ │ │ ├── MinecraftMixin.java │ │ │ └── RenderSystemMixin.java │ │ ├── frapi │ │ │ ├── BakedModelM.java │ │ │ ├── ItemRendererAccessor.java │ │ │ ├── ItemRendererMixin.java │ │ │ └── ModelBlockRendererM.java │ │ ├── particle │ │ │ └── SingleQuadParticleM.java │ │ ├── target │ │ │ ├── MainTargetMixin.java │ │ │ └── RenderTargetMixin.java │ │ └── vertex │ │ │ ├── BufferBuilderM.java │ │ │ ├── FaceBakeryM.java │ │ │ ├── IndexTypeMixin.java │ │ │ ├── VertexBufferM.java │ │ │ └── VertexFormatMixin.java │ ├── screen │ │ ├── OptionsScreenM.java │ │ └── ScreenM.java │ ├── texture │ │ ├── MAbstractTexture.java │ │ ├── MTextureUtil.java │ │ ├── image │ │ │ ├── MNativeImage.java │ │ │ └── NativeImageAccessor.java │ │ ├── mip │ │ │ └── MipmapGeneratorM.java │ │ └── update │ │ │ ├── GameRendererM.java │ │ │ ├── MLightTexture.java │ │ │ ├── MSpriteContents.java │ │ │ └── MTextureManager.java │ ├── util │ │ └── ScreenshotRecorderM.java │ ├── vertex │ │ ├── EntityOutlineGeneratorM.java │ │ ├── SpriteCoordinateExpanderM.java │ │ └── VertexMultiConsumersM.java │ ├── voxel │ │ └── VoxelShapeMixin.java │ ├── wayland │ │ ├── InputConstantsM.java │ │ └── MinecraftMixin.java │ └── window │ │ ├── WindowAccessor.java │ │ └── WindowMixin.java │ ├── render │ ├── PipelineManager.java │ ├── VBO.java │ ├── chunk │ │ ├── ChunkArea.java │ │ ├── ChunkAreaManager.java │ │ ├── ChunkStatusMap.java │ │ ├── RenderSection.java │ │ ├── SectionGrid.java │ │ ├── WorldRenderer.java │ │ ├── buffer │ │ │ ├── AreaBuffer.java │ │ │ ├── DrawBuffers.java │ │ │ ├── DrawParametersBuffer.java │ │ │ └── UploadManager.java │ │ ├── build │ │ │ ├── RenderRegion.java │ │ │ ├── RenderRegionBuilder.java │ │ │ ├── UploadBuffer.java │ │ │ ├── biome │ │ │ │ └── BiomeData.java │ │ │ ├── color │ │ │ │ ├── BlockColorRegistry.java │ │ │ │ ├── BoxBlur.java │ │ │ │ └── TintCache.java │ │ │ ├── frapi │ │ │ │ ├── VulkanModRenderer.java │ │ │ │ ├── helper │ │ │ │ │ ├── ColorHelper.java │ │ │ │ │ ├── GeometryHelper.java │ │ │ │ │ ├── NormalHelper.java │ │ │ │ │ └── TextureHelper.java │ │ │ │ ├── material │ │ │ │ │ ├── MaterialFinderImpl.java │ │ │ │ │ ├── MaterialViewImpl.java │ │ │ │ │ └── RenderMaterialImpl.java │ │ │ │ ├── mesh │ │ │ │ │ ├── EncodingFormat.java │ │ │ │ │ ├── MeshBuilderImpl.java │ │ │ │ │ ├── MeshImpl.java │ │ │ │ │ ├── MutableQuadViewImpl.java │ │ │ │ │ └── QuadViewImpl.java │ │ │ │ └── render │ │ │ │ │ ├── AbstractBlockRenderContext.java │ │ │ │ │ ├── AbstractRenderContext.java │ │ │ │ │ ├── BlockRenderContext.java │ │ │ │ │ └── ItemRenderContext.java │ │ │ ├── light │ │ │ │ ├── LightMode.java │ │ │ │ ├── LightPipeline.java │ │ │ │ ├── data │ │ │ │ │ ├── ArrayLightDataCache.java │ │ │ │ │ ├── LightDataAccess.java │ │ │ │ │ └── QuadLightData.java │ │ │ │ ├── flat │ │ │ │ │ └── FlatLightPipeline.java │ │ │ │ └── smooth │ │ │ │ │ ├── AoFaceData.java │ │ │ │ │ ├── AoNeighborInfo.java │ │ │ │ │ ├── FaceDataFlags.java │ │ │ │ │ ├── NewSmoothLightPipeline.java │ │ │ │ │ ├── SmoothLightPipeline.java │ │ │ │ │ └── SubBlockAoFace.java │ │ │ ├── renderer │ │ │ │ ├── BlockRenderer.java │ │ │ │ ├── DefaultFluidRenderers.java │ │ │ │ └── FluidRenderer.java │ │ │ ├── task │ │ │ │ ├── BuildTask.java │ │ │ │ ├── ChunkTask.java │ │ │ │ ├── CompileResult.java │ │ │ │ ├── CompiledSection.java │ │ │ │ ├── SortTransparencyTask.java │ │ │ │ └── TaskDispatcher.java │ │ │ └── thread │ │ │ │ ├── BuilderResources.java │ │ │ │ └── ThreadBuilderPack.java │ │ ├── cull │ │ │ └── QuadFacing.java │ │ ├── frustum │ │ │ ├── FrustumOctree.java │ │ │ └── VFrustum.java │ │ ├── graph │ │ │ ├── GraphDirections.java │ │ │ └── SectionGraph.java │ │ └── util │ │ │ ├── AreaSetQueue.java │ │ │ ├── BufferUtil.java │ │ │ ├── CircularIntList.java │ │ │ ├── ResettableQueue.java │ │ │ ├── SimpleDirection.java │ │ │ ├── StaticQueue.java │ │ │ └── Util.java │ ├── gui │ │ └── GuiBatchRenderer.java │ ├── model │ │ ├── CubeModel.java │ │ └── quad │ │ │ ├── ModelQuad.java │ │ │ ├── ModelQuadFlags.java │ │ │ ├── ModelQuadView.java │ │ │ └── QuadUtils.java │ ├── profiling │ │ ├── BuildTimeProfiler.java │ │ ├── Profiler.java │ │ └── ProfilerOverlay.java │ ├── shader │ │ └── ShaderLoadUtil.java │ ├── sky │ │ └── CloudRenderer.java │ ├── texture │ │ ├── ImageUploadHelper.java │ │ └── SpriteUpdateUtil.java │ ├── util │ │ ├── DrawUtil.java │ │ ├── MathUtil.java │ │ └── SortUtil.java │ └── vertex │ │ ├── CustomVertexFormat.java │ │ ├── QuadSorter.java │ │ ├── TerrainBufferBuilder.java │ │ ├── TerrainBuilder.java │ │ ├── TerrainRenderType.java │ │ ├── VertexBuilder.java │ │ └── format │ │ └── I32_SNorm.java │ └── vulkan │ ├── Drawer.java │ ├── Renderer.java │ ├── Synchronization.java │ ├── SystemInfo.java │ ├── VRenderSystem.java │ ├── Vulkan.java │ ├── device │ ├── Device.java │ └── DeviceManager.java │ ├── framebuffer │ ├── Framebuffer.java │ ├── RenderPass.java │ └── SwapChain.java │ ├── memory │ ├── MemoryManager.java │ ├── MemoryType.java │ ├── MemoryTypes.java │ └── buffer │ │ ├── Buffer.java │ │ ├── IndexBuffer.java │ │ ├── IndirectBuffer.java │ │ ├── StagingBuffer.java │ │ ├── UniformBuffer.java │ │ ├── VertexBuffer.java │ │ └── index │ │ └── AutoIndexBuffer.java │ ├── pass │ ├── DefaultMainPass.java │ └── MainPass.java │ ├── queue │ ├── CommandPool.java │ ├── ComputeQueue.java │ ├── GraphicsQueue.java │ ├── PresentQueue.java │ ├── Queue.java │ └── TransferQueue.java │ ├── shader │ ├── GraphicsPipeline.java │ ├── Pipeline.java │ ├── PipelineState.java │ ├── SPIRVUtils.java │ ├── Uniforms.java │ ├── converter │ │ ├── CodeParser.java │ │ ├── GlslConverter.java │ │ ├── InputOutputParser.java │ │ └── UniformParser.java │ ├── descriptor │ │ ├── Descriptor.java │ │ ├── ImageDescriptor.java │ │ ├── ManualUBO.java │ │ └── UBO.java │ └── layout │ │ ├── AlignedStruct.java │ │ ├── Mat3.java │ │ ├── PushConstants.java │ │ ├── Uniform.java │ │ ├── Vec1f.java │ │ └── Vec1i.java │ ├── texture │ ├── ImageUtil.java │ ├── SamplerManager.java │ ├── VTextureSelector.java │ └── VulkanImage.java │ └── util │ ├── ColorUtil.java │ ├── DrawUtil.java │ ├── MappedBuffer.java │ ├── Pair.java │ ├── VUtil.java │ └── VkResult.java └── resources ├── assets └── vulkanmod │ ├── Vlogo.png │ ├── lang │ └── en_us.json │ ├── shaders │ ├── basic │ │ ├── blit │ │ │ ├── blit.fsh │ │ │ ├── blit.json │ │ │ └── blit.vsh │ │ ├── clouds │ │ │ ├── clouds.fsh │ │ │ ├── clouds.json │ │ │ └── clouds.vsh │ │ ├── terrain │ │ │ ├── terrain.fsh │ │ │ ├── terrain.json │ │ │ └── terrain.vsh │ │ └── terrain_earlyZ │ │ │ ├── terrain_earlyZ.fsh │ │ │ └── terrain_earlyZ.json │ ├── core │ │ ├── blit_screen │ │ │ ├── blit_screen.fsh │ │ │ ├── blit_screen.json │ │ │ └── blit_screen.vsh │ │ ├── entity │ │ │ ├── entity.fsh │ │ │ └── entity.vsh │ │ ├── glint │ │ │ ├── glint.fsh │ │ │ └── glint.vsh │ │ ├── gui │ │ │ ├── gui.fsh │ │ │ └── gui.vsh │ │ ├── lightmap │ │ │ ├── lightmap.fsh │ │ │ └── lightmap.json │ │ ├── particle │ │ │ ├── particle.fsh │ │ │ ├── particle.json │ │ │ └── particle.vsh │ │ ├── position │ │ │ ├── position.fsh │ │ │ ├── position.json │ │ │ └── position.vsh │ │ ├── position_color │ │ │ ├── position_color.fsh │ │ │ ├── position_color.json │ │ │ └── position_color.vsh │ │ ├── position_color_lightmap │ │ │ ├── position_color_lightmap.fsh │ │ │ ├── position_color_lightmap.json │ │ │ └── position_color_lightmap.vsh │ │ ├── position_color_normal │ │ │ ├── position_color_normal.fsh │ │ │ ├── position_color_normal.json │ │ │ └── position_color_normal.vsh │ │ ├── position_color_tex │ │ │ ├── position_color_tex.fsh │ │ │ ├── position_color_tex.json │ │ │ └── position_color_tex.vsh │ │ ├── position_color_tex_lightmap │ │ │ ├── position_color_tex_lightmap.fsh │ │ │ ├── position_color_tex_lightmap.json │ │ │ └── position_color_tex_lightmap.vsh │ │ ├── position_tex │ │ │ ├── position_tex.fsh │ │ │ ├── position_tex.json │ │ │ └── position_tex.vsh │ │ ├── position_tex_color │ │ │ ├── position_tex_color.fsh │ │ │ ├── position_tex_color.json │ │ │ └── position_tex_color.vsh │ │ ├── position_tex_color_normal │ │ │ ├── position_tex_color_normal.fsh │ │ │ ├── position_tex_color_normal.json │ │ │ └── position_tex_color_normal.vsh │ │ ├── rendertype_armor_cutout_no_cull │ │ │ ├── rendertype_armor_cutout_no_cull.fsh │ │ │ ├── rendertype_armor_cutout_no_cull.json │ │ │ └── rendertype_armor_cutout_no_cull.vsh │ │ ├── rendertype_armor_entity_glint │ │ │ ├── rendertype_armor_entity_glint.fsh │ │ │ ├── rendertype_armor_entity_glint.json │ │ │ └── rendertype_armor_entity_glint.vsh │ │ ├── rendertype_armor_glint │ │ │ └── rendertype_armor_glint.json │ │ ├── rendertype_armor_translucent │ │ │ └── rendertype_armor_translucent.json │ │ ├── rendertype_beacon_beam │ │ │ ├── rendertype_beacon_beam.fsh │ │ │ ├── rendertype_beacon_beam.json │ │ │ └── rendertype_beacon_beam.vsh │ │ ├── rendertype_breeze_wind │ │ │ ├── rendertype_breeze_wind.fsh │ │ │ ├── rendertype_breeze_wind.json │ │ │ └── rendertype_breeze_wind.vsh │ │ ├── rendertype_clouds │ │ │ ├── rendertype_clouds.fsh │ │ │ ├── rendertype_clouds.json │ │ │ └── rendertype_clouds.vsh │ │ ├── rendertype_crumbling │ │ │ ├── rendertype_crumbling.fsh │ │ │ ├── rendertype_crumbling.json │ │ │ └── rendertype_crumbling.vsh │ │ ├── rendertype_cutout │ │ │ ├── rendertype_cutout.fsh │ │ │ ├── rendertype_cutout.json │ │ │ └── rendertype_cutout.vsh │ │ ├── rendertype_cutout_mipped │ │ │ ├── rendertype_cutout_mipped.fsh │ │ │ ├── rendertype_cutout_mipped.json │ │ │ └── rendertype_cutout_mipped.vsh │ │ ├── rendertype_end_gateway │ │ │ └── rendertype_end_gateway.json │ │ ├── rendertype_end_portal │ │ │ ├── rendertype_end_portal.fsh │ │ │ ├── rendertype_end_portal.json │ │ │ └── rendertype_end_portal.vsh │ │ ├── rendertype_energy_swirl │ │ │ ├── rendertype_energy_swirl.fsh │ │ │ ├── rendertype_energy_swirl.json │ │ │ └── rendertype_energy_swirl.vsh │ │ ├── rendertype_entity_alpha │ │ │ ├── rendertype_entity_alpha.fsh │ │ │ ├── rendertype_entity_alpha.json │ │ │ └── rendertype_entity_alpha.vsh │ │ ├── rendertype_entity_cutout │ │ │ └── rendertype_entity_cutout.json │ │ ├── rendertype_entity_cutout_no_cull │ │ │ └── rendertype_entity_cutout_no_cull.json │ │ ├── rendertype_entity_cutout_no_cull_z_offset │ │ │ └── rendertype_entity_cutout_no_cull_z_offset.json │ │ ├── rendertype_entity_decal │ │ │ ├── rendertype_entity_decal.fsh │ │ │ ├── rendertype_entity_decal.json │ │ │ └── rendertype_entity_decal.vsh │ │ ├── rendertype_entity_glint │ │ │ ├── rendertype_entity_glint.fsh │ │ │ ├── rendertype_entity_glint.json │ │ │ └── rendertype_entity_glint.vsh │ │ ├── rendertype_entity_glint_direct │ │ │ ├── rendertype_entity_glint_direct.fsh │ │ │ ├── rendertype_entity_glint_direct.json │ │ │ └── rendertype_entity_glint_direct.vsh │ │ ├── rendertype_entity_no_outline │ │ │ ├── rendertype_entity_no_outline.fsh │ │ │ ├── rendertype_entity_no_outline.json │ │ │ └── rendertype_entity_no_outline.vsh │ │ ├── rendertype_entity_shadow │ │ │ ├── rendertype_entity_shadow.fsh │ │ │ ├── rendertype_entity_shadow.json │ │ │ └── rendertype_entity_shadow.vsh │ │ ├── rendertype_entity_smooth_cutout │ │ │ └── rendertype_entity_smooth_cutout.json │ │ ├── rendertype_entity_solid │ │ │ ├── rendertype_entity_solid.fsh │ │ │ ├── rendertype_entity_solid.json │ │ │ └── rendertype_entity_solid.vsh │ │ ├── rendertype_entity_translucent │ │ │ └── rendertype_entity_translucent.json │ │ ├── rendertype_entity_translucent_cull │ │ │ ├── rendertype_entity_translucent_cull.fsh │ │ │ ├── rendertype_entity_translucent_cull.json │ │ │ └── rendertype_entity_translucent_cull.vsh │ │ ├── rendertype_entity_translucent_emissive │ │ │ ├── rendertype_entity_translucent_emissive.fsh │ │ │ ├── rendertype_entity_translucent_emissive.json │ │ │ └── rendertype_entity_translucent_emissive.vsh │ │ ├── rendertype_eyes │ │ │ ├── rendertype_eyes.fsh │ │ │ ├── rendertype_eyes.json │ │ │ └── rendertype_eyes.vsh │ │ ├── rendertype_glint │ │ │ └── rendertype_glint.json │ │ ├── rendertype_glint_direct │ │ │ └── rendertype_glint_direct.json │ │ ├── rendertype_glint_translucent │ │ │ └── rendertype_glint_translucent.json │ │ ├── rendertype_gui │ │ │ └── rendertype_gui.json │ │ ├── rendertype_gui_ghost_recipe_overlay.json │ │ ├── rendertype_gui_overlay │ │ │ └── rendertype_gui_overlay.json │ │ ├── rendertype_gui_text_highlight.json │ │ ├── rendertype_item_entity_translucent_cull │ │ │ ├── rendertype_item_entity_translucent_cull.fsh │ │ │ ├── rendertype_item_entity_translucent_cull.json │ │ │ └── rendertype_item_entity_translucent_cull.vsh │ │ ├── rendertype_leash │ │ │ ├── rendertype_leash.fsh │ │ │ ├── rendertype_leash.json │ │ │ └── rendertype_leash.vsh │ │ ├── rendertype_lightning │ │ │ ├── rendertype_lightning.fsh │ │ │ ├── rendertype_lightning.json │ │ │ └── rendertype_lightning.vsh │ │ ├── rendertype_lines │ │ │ ├── rendertype_lines.fsh │ │ │ ├── rendertype_lines.json │ │ │ └── rendertype_lines.vsh │ │ ├── rendertype_outline │ │ │ ├── rendertype_outline.fsh │ │ │ ├── rendertype_outline.json │ │ │ └── rendertype_outline.vsh │ │ ├── rendertype_solid │ │ │ ├── rendertype_solid.fsh │ │ │ ├── rendertype_solid.json │ │ │ └── rendertype_solid.vsh │ │ ├── rendertype_text │ │ │ ├── rendertype_text.fsh │ │ │ ├── rendertype_text.json │ │ │ └── rendertype_text.vsh │ │ ├── rendertype_text_background │ │ │ ├── rendertype_text_background.fsh │ │ │ ├── rendertype_text_background.json │ │ │ └── rendertype_text_background.vsh │ │ ├── rendertype_text_background_see_through │ │ │ ├── rendertype_text_background_see_through.fsh │ │ │ ├── rendertype_text_background_see_through.json │ │ │ └── rendertype_text_background_see_through.vsh │ │ ├── rendertype_text_intensity │ │ │ ├── rendertype_text_intensity.fsh │ │ │ ├── rendertype_text_intensity.json │ │ │ └── rendertype_text_intensity.vsh │ │ ├── rendertype_text_intensity_see_through │ │ │ ├── rendertype_text_intensity_see_through.fsh │ │ │ ├── rendertype_text_intensity_see_through.json │ │ │ └── rendertype_text_intensity_see_through.vsh │ │ ├── rendertype_text_see_through │ │ │ ├── rendertype_text_see_through.fsh │ │ │ ├── rendertype_text_see_through.json │ │ │ └── rendertype_text_see_through.vsh │ │ ├── rendertype_translucent │ │ │ ├── rendertype_translucent.fsh │ │ │ ├── rendertype_translucent.json │ │ │ └── rendertype_translucent.vsh │ │ ├── rendertype_translucent_moving_block │ │ │ ├── rendertype_translucent_moving_block.fsh │ │ │ ├── rendertype_translucent_moving_block.json │ │ │ └── rendertype_translucent_moving_block.vsh │ │ ├── rendertype_translucent_no_crumbling │ │ │ ├── rendertype_translucent_no_crumbling.fsh │ │ │ ├── rendertype_translucent_no_crumbling.json │ │ │ └── rendertype_translucent_no_crumbling.vsh │ │ ├── rendertype_tripwire │ │ │ ├── rendertype_tripwire.fsh │ │ │ ├── rendertype_tripwire.json │ │ │ └── rendertype_tripwire.vsh │ │ └── rendertype_water_mask │ │ │ ├── rendertype_water_mask.fsh │ │ │ ├── rendertype_water_mask.json │ │ │ └── rendertype_water_mask.vsh │ └── include │ │ ├── fog.glsl │ │ ├── light.glsl │ │ ├── matrix.glsl │ │ └── projection.glsl │ └── vlogo_transparent.png ├── fabric.mod.json ├── vulkanmod.accesswidener └── vulkanmod.mixins.json /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: true -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.yml: -------------------------------------------------------------------------------- 1 | name: Feature request 2 | description: Suggest an idea for this project 3 | body: 4 | - type: markdown 5 | attributes: 6 | value: >- 7 | - **Check if another similar request has already been made before creating a new one.** 8 | 9 | - type: textarea 10 | id: description 11 | attributes: 12 | label: Describe the request 13 | description: A clear and concise description of what the issue is and what the suggestion is supposed to solve. 14 | validations: 15 | required: true 16 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | # Automatically build the project and run any configured tests for every push 2 | # and submitted pull request. This can help catch issues that only occur on 3 | # certain platforms or Java versions, and provides a first line of defence 4 | # against bad commits. 5 | 6 | name: build 7 | on: [pull_request, push] 8 | 9 | jobs: 10 | build: 11 | strategy: 12 | matrix: 13 | # Use these Java versions 14 | java: [ 15 | 21, # Current Java LTS 16 | ] 17 | runs-on: ubuntu-22.04 18 | steps: 19 | - name: checkout repository 20 | uses: actions/checkout@v4 21 | - name: validate gradle wrapper 22 | uses: gradle/wrapper-validation-action@v2 23 | - name: setup jdk ${{ matrix.java }} 24 | uses: actions/setup-java@v4 25 | with: 26 | java-version: ${{ matrix.java }} 27 | distribution: 'microsoft' 28 | - name: make gradle wrapper executable 29 | run: chmod +x ./gradlew 30 | - name: build 31 | run: ./gradlew build 32 | - name: capture build artifacts 33 | if: ${{ matrix.java == '21' }} # Only upload artifacts built from latest java 34 | uses: actions/upload-artifact@v4 35 | with: 36 | name: Artifacts 37 | path: build/libs/ -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # gradle 2 | 3 | .gradle/ 4 | /build/ 5 | out/ 6 | classes/ 7 | 8 | # eclipse 9 | 10 | *.launch 11 | 12 | # idea 13 | 14 | .idea/ 15 | *.iml 16 | *.ipr 17 | *.iws 18 | 19 | # vscode 20 | 21 | .settings/ 22 | .vscode/ 23 | bin/ 24 | .classpath 25 | .project 26 | 27 | # macos 28 | 29 | *.DS_Store 30 | 31 | # fabric 32 | 33 | run/ 34 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Done to increase the memory available to gradle. 2 | org.gradle.jvmargs=-Xmx3G 3 | org.gradle.parallel=true 4 | 5 | # Fabric Properties 6 | # check these on https://fabricmc.net/develop 7 | minecraft_version=1.21.1 8 | yarn_mappings=1.21.1+build.3 9 | loader_version=0.16.10 10 | 11 | # Fabric API 12 | fabric_version=0.114.0+1.21.1 13 | 14 | # Mod Properties 15 | mod_version = 0.5.4-dev 16 | maven_group = net.vulkanmod 17 | archives_base_name = VulkanMod_1.21.1 18 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xCollateral/VulkanMod/f23855f2675f1efb52fb8aa2c26bc23dccfb5543/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | maven { 4 | name = 'Fabric' 5 | url = 'https://maven.fabricmc.net/' 6 | } 7 | mavenCentral() 8 | gradlePluginPortal() 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/config/gui/OptionBlock.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.config.gui; 2 | 3 | import net.vulkanmod.config.option.Option; 4 | 5 | public record OptionBlock(String title, Option[] options) { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/config/option/OptionPage.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.config.option; 2 | 3 | import net.vulkanmod.config.gui.OptionBlock; 4 | import net.vulkanmod.config.gui.VOptionList; 5 | 6 | public class OptionPage { 7 | public final String name; 8 | OptionBlock[] optionBlocks; 9 | private VOptionList optionList; 10 | 11 | public OptionPage(String name, OptionBlock[] optionBlocks) { 12 | this.name = name; 13 | this.optionBlocks = optionBlocks; 14 | } 15 | 16 | public void createList(int x, int y, int width, int height, int itemHeight) { 17 | this.optionList = new VOptionList(x, y, width, height, itemHeight); 18 | this.optionList.addAll(optionBlocks); 19 | } 20 | 21 | public VOptionList getOptionList() { 22 | return this.optionList; 23 | } 24 | 25 | public boolean optionChanged() { 26 | boolean changed = false; 27 | for (var block : this.optionBlocks) { 28 | for (var option : block.options()) { 29 | if (option.isChanged()) 30 | changed = true; 31 | } 32 | } 33 | return changed; 34 | } 35 | 36 | public void applyOptionChanges() { 37 | for (var block : this.optionBlocks) { 38 | for (var option : block.options()) { 39 | if (option.isChanged()) 40 | option.apply(); 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/config/option/SwitchOption.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.config.option; 2 | 3 | import net.minecraft.network.chat.Component; 4 | import net.vulkanmod.config.gui.widget.OptionWidget; 5 | import net.vulkanmod.config.gui.widget.SwitchOptionWidget; 6 | 7 | import java.util.function.Consumer; 8 | import java.util.function.Supplier; 9 | 10 | public class SwitchOption extends Option { 11 | public SwitchOption(Component name, Consumer setter, Supplier getter) { 12 | super(name, setter, getter, i -> Component.nullToEmpty(String.valueOf(i))); 13 | } 14 | 15 | @Override 16 | public OptionWidget createOptionWidget(int x, int y, int width, int height) { 17 | return new SwitchOptionWidget(this, x, y, width, height, this.name); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/config/video/WindowMode.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.config.video; 2 | 3 | public enum WindowMode { 4 | WINDOWED(0), 5 | WINDOWED_FULLSCREEN(1), 6 | EXCLUSIVE_FULLSCREEN(2); 7 | 8 | public final int mode; 9 | 10 | WindowMode(int mode) { 11 | this.mode = mode; 12 | } 13 | 14 | public static WindowMode fromValue(int value) { 15 | return switch (value) { 16 | case 0 -> WINDOWED; 17 | case 1 -> WINDOWED_FULLSCREEN; 18 | case 2 -> EXCLUSIVE_FULLSCREEN; 19 | 20 | default -> throw new IllegalStateException("Unexpected value: " + value); 21 | }; 22 | } 23 | 24 | public static String getComponentName(WindowMode windowMode) { 25 | return switch (windowMode) { 26 | case WINDOWED -> "vulkanmod.options.windowMode.windowed"; 27 | case WINDOWED_FULLSCREEN -> "vulkanmod.options.windowMode.windowedFullscreen"; 28 | case EXCLUSIVE_FULLSCREEN -> "options.fullscreen"; 29 | }; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/interfaces/ExtendedRenderType.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.interfaces; 2 | 3 | import net.vulkanmod.render.vertex.TerrainRenderType; 4 | 5 | public interface ExtendedRenderType { 6 | 7 | TerrainRenderType getTerrainRenderType(); 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/interfaces/ExtendedVertexBuilder.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.interfaces; 2 | 3 | import com.mojang.blaze3d.vertex.VertexConsumer; 4 | 5 | public interface ExtendedVertexBuilder { 6 | 7 | static ExtendedVertexBuilder of(VertexConsumer vertexConsumer) { 8 | if (vertexConsumer instanceof ExtendedVertexBuilder) { 9 | return (ExtendedVertexBuilder) vertexConsumer; 10 | } 11 | 12 | return null; 13 | } 14 | 15 | default boolean canUseFastVertex() { 16 | return true; 17 | } 18 | 19 | void vertex(float x, float y, float z, int packedColor, float u, float v, int overlay, int light, int packedNormal); 20 | 21 | // Used for particles 22 | default void vertex(float x, float y, float z, float u, float v, int packedColor, int light) {} 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/interfaces/FrustumMixed.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.interfaces; 2 | 3 | import net.vulkanmod.render.chunk.frustum.VFrustum; 4 | 5 | public interface FrustumMixed { 6 | 7 | VFrustum customFrustum(); 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/interfaces/ModelPartCubeMixed.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.interfaces; 2 | 3 | import net.vulkanmod.render.model.CubeModel; 4 | 5 | public interface ModelPartCubeMixed { 6 | 7 | CubeModel getCubeModel(); 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/interfaces/ShaderMixed.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.interfaces; 2 | 3 | import net.minecraft.client.renderer.ShaderInstance; 4 | import net.vulkanmod.vulkan.shader.GraphicsPipeline; 5 | import net.vulkanmod.vulkan.shader.descriptor.UBO; 6 | import net.vulkanmod.vulkan.util.MappedBuffer; 7 | 8 | import java.util.function.Supplier; 9 | 10 | public interface ShaderMixed { 11 | 12 | static ShaderMixed of(ShaderInstance compiledShaderProgram) { 13 | return (ShaderMixed) compiledShaderProgram; 14 | } 15 | 16 | void setPipeline(GraphicsPipeline graphicsPipeline); 17 | 18 | GraphicsPipeline getPipeline(); 19 | 20 | void setupUniformSuppliers(UBO ubo); 21 | 22 | Supplier getUniformSupplier(String name); 23 | 24 | void setDoUniformsUpdate(); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/interfaces/VertexFormatMixed.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.interfaces; 2 | 3 | import com.mojang.blaze3d.vertex.VertexFormatElement; 4 | 5 | import java.util.List; 6 | 7 | public interface VertexFormatMixed { 8 | 9 | int getOffset(int i); 10 | 11 | List getFastList(); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/interfaces/VisibilitySetExtended.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.interfaces; 2 | 3 | public interface VisibilitySetExtended { 4 | 5 | long getVisibility(); 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/interfaces/VoxelShapeExtended.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.interfaces; 2 | 3 | public interface VoxelShapeExtended { 4 | 5 | int getCornerOcclusion(); 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/interfaces/biome/BiomeManagerExtended.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.interfaces.biome; 2 | 3 | import net.minecraft.world.level.biome.BiomeManager; 4 | 5 | public interface BiomeManagerExtended { 6 | 7 | static BiomeManagerExtended of(BiomeManager biomeManager) { 8 | return (BiomeManagerExtended) biomeManager; 9 | } 10 | 11 | long getBiomeZoomSeed(); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/interfaces/color/BlockColorsExtended.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.interfaces.color; 2 | 3 | import net.minecraft.client.color.block.BlockColors; 4 | import net.vulkanmod.render.chunk.build.color.BlockColorRegistry; 5 | 6 | public interface BlockColorsExtended { 7 | 8 | static BlockColorsExtended from(BlockColors blockColors) { 9 | return (BlockColorsExtended) blockColors; 10 | } 11 | 12 | BlockColorRegistry getColorResolverMap(); 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/MixinPlugin.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin; 2 | 3 | import org.objectweb.asm.tree.ClassNode; 4 | import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; 5 | import org.spongepowered.asm.mixin.extensibility.IMixinInfo; 6 | 7 | import java.util.List; 8 | import java.util.Set; 9 | 10 | public class MixinPlugin implements IMixinConfigPlugin { 11 | 12 | @Override 13 | public void onLoad(String mixinPackage) { 14 | } 15 | 16 | @Override 17 | public String getRefMapperConfig() { 18 | return null; 19 | } 20 | 21 | @Override 22 | public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { 23 | return true; 24 | } 25 | 26 | @Override 27 | public void acceptTargets(Set myTargets, Set otherTargets) { 28 | 29 | } 30 | 31 | @Override 32 | public List getMixins() { 33 | return null; 34 | } 35 | 36 | @Override 37 | public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { 38 | } 39 | 40 | @Override 41 | public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/chunk/ClientPacketListenerM.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin.chunk; 2 | 3 | import net.minecraft.client.multiplayer.ClientPacketListener; 4 | import net.minecraft.network.protocol.game.ClientboundForgetLevelChunkPacket; 5 | import net.minecraft.network.protocol.game.ClientboundLightUpdatePacketData; 6 | import net.minecraft.world.level.ChunkPos; 7 | import net.vulkanmod.render.chunk.ChunkStatusMap; 8 | import org.spongepowered.asm.mixin.Mixin; 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 | @Mixin(ClientPacketListener.class) 14 | public class ClientPacketListenerM { 15 | 16 | @Inject(method = "applyLightData", at = @At("RETURN")) 17 | private void setChunkStatus(int x, int z, ClientboundLightUpdatePacketData clientboundLightUpdatePacketData, CallbackInfo ci) { 18 | ChunkStatusMap.INSTANCE.setChunkStatus(x, z, ChunkStatusMap.LIGHT_READY); 19 | } 20 | 21 | @Inject(method = "handleForgetLevelChunk", at = @At("RETURN")) 22 | private void resetChunkStatus(ClientboundForgetLevelChunkPacket clientboundForgetLevelChunkPacket, CallbackInfo ci) { 23 | ChunkPos chunkPos = clientboundForgetLevelChunkPacket.pos(); 24 | ChunkStatusMap.INSTANCE.resetChunkStatus(chunkPos.x, chunkPos.z, ChunkStatusMap.LIGHT_READY); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/chunk/DirectionMixin.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin.chunk; 2 | 3 | import net.minecraft.core.Direction; 4 | import org.spongepowered.asm.mixin.Final; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Overwrite; 7 | import org.spongepowered.asm.mixin.Shadow; 8 | 9 | @Mixin(Direction.class) 10 | public class DirectionMixin { 11 | 12 | @Shadow @Final private static Direction[] BY_3D_DATA; 13 | 14 | @Shadow @Final private int oppositeIndex; 15 | 16 | /** 17 | * @author 18 | * @reason 19 | */ 20 | @Overwrite 21 | public Direction getOpposite() { 22 | return BY_3D_DATA[this.oppositeIndex]; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/chunk/FrustumMixin.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin.chunk; 2 | 3 | import net.minecraft.client.renderer.culling.Frustum; 4 | import net.vulkanmod.interfaces.FrustumMixed; 5 | import net.vulkanmod.render.chunk.frustum.VFrustum; 6 | import org.joml.Matrix4f; 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 | @Mixin(Frustum.class) 14 | public class FrustumMixin implements FrustumMixed { 15 | 16 | @Shadow private double camX; 17 | @Shadow private double camY; 18 | @Shadow private double camZ; 19 | private final VFrustum vFrustum = new VFrustum(); 20 | 21 | @Inject(method = "calculateFrustum", at = @At("HEAD"), cancellable = true) 22 | private void calculateFrustum(Matrix4f modelView, Matrix4f projection, CallbackInfo ci) { 23 | // this.vFrustum = new VFrustum(modelView, projection); 24 | this.vFrustum.calculateFrustum(modelView, projection); 25 | ci.cancel(); 26 | } 27 | 28 | @Inject(method = "prepare", at = @At("RETURN")) 29 | public void prepare(double d, double e, double f, CallbackInfo ci) { 30 | this.vFrustum.setCamOffset(this.camX, this.camY, this.camZ); 31 | } 32 | 33 | @Override 34 | public VFrustum customFrustum() { 35 | return vFrustum; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/chunk/SectionBufferBuilderPoolM.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin.chunk; 2 | 3 | import net.minecraft.client.renderer.SectionBufferBuilderPool; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.injection.At; 6 | import org.spongepowered.asm.mixin.injection.ModifyVariable; 7 | 8 | @Mixin(SectionBufferBuilderPool.class) 9 | public class SectionBufferBuilderPoolM { 10 | 11 | @ModifyVariable(method = "allocate", at = @At("STORE"), ordinal = 1) 12 | private static int skipAllocation(int value) { 13 | return 0; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/chunk/SectionRenderDispatcherM.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin.chunk; 2 | 3 | import net.minecraft.client.renderer.chunk.SectionRenderDispatcher; 4 | import net.minecraft.util.thread.ProcessorMailbox; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Redirect; 8 | 9 | @Mixin(SectionRenderDispatcher.class) 10 | public class SectionRenderDispatcherM { 11 | 12 | @Redirect(method = "", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/thread/ProcessorMailbox;tell(Ljava/lang/Object;)V")) 13 | private void redirectTask(ProcessorMailbox instance, Object object) {} 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/chunk/ViewAreaM.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin.chunk; 2 | 3 | import net.minecraft.client.renderer.ViewArea; 4 | import net.minecraft.client.renderer.chunk.SectionRenderDispatcher; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Shadow; 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(ViewArea.class) 12 | public abstract class ViewAreaM { 13 | 14 | @Shadow public SectionRenderDispatcher.RenderSection[] sections; 15 | 16 | @Shadow protected abstract void setViewDistance(int i); 17 | 18 | @Inject(method = "createSections", at = @At("HEAD")) 19 | private void skipAllocation(SectionRenderDispatcher sectionRenderDispatcher, CallbackInfo ci) { 20 | // It's not possible to completely skip allocation since it would cause an error if repositionCamera is called 21 | this.setViewDistance(0); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/compatibility/gl/GL14M.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin.compatibility.gl; 2 | 3 | import net.vulkanmod.vulkan.VRenderSystem; 4 | import org.lwjgl.opengl.GL14; 5 | import org.lwjgl.opengl.GL14C; 6 | import org.lwjgl.system.NativeType; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.Overwrite; 9 | 10 | @Mixin(GL14.class) 11 | public class GL14M { 12 | 13 | /** 14 | * @author 15 | * @reason 16 | */ 17 | @Overwrite(remap = false) 18 | public static void glBlendFuncSeparate(@NativeType("GLenum") int sfactorRGB, @NativeType("GLenum") int dfactorRGB, @NativeType("GLenum") int sfactorAlpha, @NativeType("GLenum") int dfactorAlpha) { 19 | VRenderSystem.blendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/debug/GlDebugInfoM.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin.debug; 2 | 3 | import com.mojang.blaze3d.platform.GlUtil; 4 | import net.vulkanmod.vulkan.SystemInfo; 5 | import net.vulkanmod.vulkan.Vulkan; 6 | import net.vulkanmod.vulkan.device.Device; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.Overwrite; 9 | 10 | @Mixin(GlUtil.class) 11 | public class GlDebugInfoM { 12 | 13 | /** 14 | * @author 15 | */ 16 | @Overwrite 17 | public static String getVendor() { 18 | return Vulkan.getDevice() != null ? Vulkan.getDevice().vendorIdString : "n/a"; 19 | } 20 | 21 | /** 22 | * @author 23 | */ 24 | @Overwrite 25 | public static String getRenderer() { 26 | return Vulkan.getDevice() != null ? Vulkan.getDevice().deviceName : "n/a"; 27 | } 28 | 29 | /** 30 | * @author 31 | */ 32 | @Overwrite 33 | public static String getOpenGLVersion() { 34 | return Vulkan.getDevice() != null ? Vulkan.getDevice().driverVersion : "n/a"; 35 | } 36 | 37 | /** 38 | * @author 39 | */ 40 | @Overwrite 41 | public static String getCpuInfo() { 42 | return SystemInfo.cpuInfo; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/debug/KeyboardHandlerM.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin.debug; 2 | 3 | import com.mojang.blaze3d.platform.InputConstants; 4 | import net.minecraft.client.KeyboardHandler; 5 | import net.minecraft.client.Minecraft; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.Shadow; 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(KeyboardHandler.class) 13 | public abstract class KeyboardHandlerM { 14 | 15 | @Shadow protected abstract boolean handleChunkDebugKeys(int i); 16 | 17 | @Shadow private boolean handledDebugKey; 18 | 19 | @Inject(method = "keyPress", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/InputConstants;isKeyDown(JI)Z", ordinal = 0, shift = At.Shift.AFTER)) 20 | private void chunkDebug(long window, int key, int scancode, int action, int mods, CallbackInfo ci) { 21 | // GLFW key 296 -> F7 22 | // U -> Capture frustum 23 | this.handledDebugKey |= InputConstants.isKeyDown(Minecraft.getInstance().getWindow().getWindow(), 296) 24 | && this.handleChunkDebugKeys(key); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/debug/crash_report/SystemReportM.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin.debug.crash_report; 2 | 3 | import net.minecraft.SystemReport; 4 | import net.vulkanmod.vulkan.device.DeviceManager; 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(SystemReport.class) 11 | public class SystemReportM { 12 | 13 | @Inject(method = "appendToCrashReportString", at = @At("RETURN")) 14 | private void addVulkanDevicesInfo(StringBuilder stringBuilder, CallbackInfo ci) { 15 | stringBuilder.append("\n\n -- VulkanMod Device Report --"); 16 | stringBuilder.append(DeviceManager.getAvailableDevicesInfo()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/matrix/PoseAccessor.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin.matrix; 2 | 3 | import com.mojang.blaze3d.vertex.PoseStack; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Accessor; 6 | 7 | @Mixin(PoseStack.Pose.class) 8 | public interface PoseAccessor { 9 | 10 | @Accessor("trustedNormals") 11 | boolean trustedNormals(); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/profiling/GuiMixin.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin.profiling; 2 | 3 | import net.minecraft.client.DeltaTracker; 4 | import net.minecraft.client.Minecraft; 5 | import net.minecraft.client.gui.Gui; 6 | import net.minecraft.client.gui.GuiGraphics; 7 | import net.minecraft.client.gui.components.DebugScreenOverlay; 8 | import net.minecraft.client.renderer.entity.ItemRenderer; 9 | import net.vulkanmod.render.profiling.ProfilerOverlay; 10 | import org.spongepowered.asm.mixin.Final; 11 | import org.spongepowered.asm.mixin.Mixin; 12 | import org.spongepowered.asm.mixin.Shadow; 13 | import org.spongepowered.asm.mixin.injection.At; 14 | import org.spongepowered.asm.mixin.injection.Inject; 15 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 16 | 17 | @Mixin(Gui.class) 18 | public class GuiMixin { 19 | 20 | @Shadow @Final private DebugScreenOverlay debugOverlay; 21 | 22 | @Inject(method = "", at = @At("RETURN")) 23 | private void createProfilerOverlay(Minecraft minecraft, CallbackInfo ci) { 24 | ProfilerOverlay.createInstance(minecraft); 25 | } 26 | 27 | @Inject(method = "render", at = @At(value = "RETURN")) 28 | private void renderProfilerOverlay(GuiGraphics guiGraphics, DeltaTracker deltaTracker, CallbackInfo ci) { 29 | if(ProfilerOverlay.shouldRender && !this.debugOverlay.showDebugScreen()) 30 | ProfilerOverlay.INSTANCE.render(guiGraphics); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/render/GlProgramManagerMixin.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin.render; 2 | 3 | import com.mojang.blaze3d.shaders.ProgramManager; 4 | import com.mojang.blaze3d.shaders.Shader; 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.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 10 | 11 | import java.io.IOException; 12 | 13 | @Mixin(ProgramManager.class) 14 | public class GlProgramManagerMixin { 15 | 16 | @Inject(method = "linkShader", at = @At("HEAD"), cancellable = true) 17 | private static void linkProgram(Shader shader, CallbackInfo ci) throws IOException { 18 | ci.cancel(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/render/RenderTypeM.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin.render; 2 | 3 | import com.mojang.blaze3d.vertex.VertexFormat; 4 | import net.minecraft.client.renderer.RenderType; 5 | import net.vulkanmod.interfaces.ExtendedRenderType; 6 | import net.vulkanmod.render.vertex.TerrainRenderType; 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(RenderType.class) 13 | public class RenderTypeM implements ExtendedRenderType { 14 | TerrainRenderType terrainRenderType; 15 | 16 | @Inject(method = "", at = @At("RETURN")) 17 | private void inj(String string, VertexFormat vertexFormat, VertexFormat.Mode mode, int i, boolean bl, boolean bl2, Runnable runnable, Runnable runnable2, CallbackInfo ci) { 18 | terrainRenderType = switch (string) { 19 | case "solid" -> TerrainRenderType.SOLID; 20 | case "cutout" -> TerrainRenderType.CUTOUT; 21 | case "cutout_mipped" -> TerrainRenderType.CUTOUT_MIPPED; 22 | case "translucent" -> TerrainRenderType.TRANSLUCENT; 23 | case "tripwire" -> TerrainRenderType.TRIPWIRE; 24 | default -> null; 25 | }; 26 | } 27 | 28 | @Override 29 | public TerrainRenderType getTerrainRenderType() { 30 | return terrainRenderType; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/render/biome/BiomeManagerM.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin.render.biome; 2 | 3 | import net.minecraft.world.level.biome.BiomeManager; 4 | import net.vulkanmod.interfaces.biome.BiomeManagerExtended; 5 | import org.spongepowered.asm.mixin.Final; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.Shadow; 8 | 9 | @Mixin(BiomeManager.class) 10 | public class BiomeManagerM implements BiomeManagerExtended { 11 | 12 | @Shadow @Final private long biomeZoomSeed; 13 | 14 | @Override 15 | public long getBiomeZoomSeed() { 16 | return this.biomeZoomSeed; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/render/color/BlockColorsM.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin.render.color; 2 | 3 | import net.minecraft.client.color.block.BlockColor; 4 | import net.minecraft.client.color.block.BlockColors; 5 | import net.minecraft.world.level.block.Block; 6 | import net.vulkanmod.interfaces.color.BlockColorsExtended; 7 | import net.vulkanmod.render.chunk.build.color.BlockColorRegistry; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.Unique; 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(BlockColors.class) 15 | public class BlockColorsM implements BlockColorsExtended { 16 | 17 | @Unique 18 | private BlockColorRegistry colorResolvers = new BlockColorRegistry(); 19 | 20 | @Inject(method = "register", at = @At("RETURN")) 21 | private void onRegister(BlockColor blockColor, Block[] blocks, CallbackInfo ci) { 22 | this.colorResolvers.register(blockColor, blocks); 23 | } 24 | 25 | @Override 26 | public BlockColorRegistry getColorResolverMap() { 27 | return this.colorResolvers; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/render/entity/model/ModelPartCubeM.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin.render.entity.model; 2 | 3 | import net.minecraft.client.model.geom.ModelPart; 4 | import net.minecraft.core.Direction; 5 | import net.vulkanmod.interfaces.ModelPartCubeMixed; 6 | import net.vulkanmod.render.model.CubeModel; 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 | import java.util.Set; 13 | 14 | @Mixin(ModelPart.Cube.class) 15 | public class ModelPartCubeM implements ModelPartCubeMixed { 16 | 17 | CubeModel cube; 18 | 19 | @Inject(method = "", at = @At(value = "FIELD", 20 | target = "Lnet/minecraft/client/model/geom/ModelPart$Cube;polygons:[Lnet/minecraft/client/model/geom/ModelPart$Polygon;", 21 | ordinal = 0, shift = At.Shift.AFTER)) 22 | private void getVertices(int i, int j, float f, float g, float h, float k, float l, float m, float n, float o, float p, boolean bl, float q, float r, Set set, CallbackInfo ci) { 23 | //TODO check if set is needed 24 | CubeModel cube = new CubeModel(); 25 | cube.setVertices(i, j, f, g, h, k, l, m, n, o, p, bl, q, r, set); 26 | this.cube = cube; 27 | } 28 | 29 | 30 | @Override 31 | public CubeModel getCubeModel() { 32 | return this.cube; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/render/frame/RenderSystemMixin.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin.render.frame; 2 | 3 | import com.mojang.blaze3d.systems.RenderSystem; 4 | import net.vulkanmod.vulkan.Renderer; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Redirect; 8 | 9 | @Mixin(RenderSystem.class) 10 | public class RenderSystemMixin { 11 | 12 | @Redirect(method = "flipFrame", at = @At(value = "INVOKE", target = "Lorg/lwjgl/glfw/GLFW;glfwSwapBuffers(J)V"), remap = false) 13 | private static void endFrame(long window) { 14 | Renderer.getInstance().endFrame(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/render/frapi/BakedModelM.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin.render.frapi; 2 | 3 | import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel; 4 | import net.fabricmc.fabric.api.renderer.v1.render.RenderContext; 5 | import net.minecraft.client.resources.model.BakedModel; 6 | import net.minecraft.core.BlockPos; 7 | import net.minecraft.util.RandomSource; 8 | import net.minecraft.world.item.ItemStack; 9 | import net.minecraft.world.level.BlockAndTintGetter; 10 | import net.minecraft.world.level.block.state.BlockState; 11 | import net.vulkanmod.render.chunk.build.frapi.render.AbstractBlockRenderContext; 12 | import net.vulkanmod.render.chunk.build.frapi.render.ItemRenderContext; 13 | import org.spongepowered.asm.mixin.Mixin; 14 | 15 | import java.util.function.Supplier; 16 | 17 | @Mixin(BakedModel.class) 18 | public interface BakedModelM extends FabricBakedModel { 19 | 20 | @Override 21 | default void emitBlockQuads(BlockAndTintGetter blockView, BlockState state, BlockPos pos, Supplier randomSupplier, RenderContext context) { 22 | ((AbstractBlockRenderContext) context).emitBlockQuads((BakedModel) this, state, randomSupplier, context); 23 | } 24 | 25 | @Override 26 | default void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { 27 | ((ItemRenderContext) context).emitItemQuads((BakedModel) this, null, randomSupplier); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/render/frapi/ItemRendererAccessor.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin.render.frapi; 2 | 3 | import net.minecraft.client.renderer.entity.ItemRenderer; 4 | import net.minecraft.world.item.ItemStack; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Invoker; 7 | 8 | @Mixin(ItemRenderer.class) 9 | public interface ItemRendererAccessor { 10 | @Invoker("hasAnimatedTexture") 11 | static boolean hasAnimatedTexture(ItemStack stack) { 12 | throw new AssertionError(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/render/target/MainTargetMixin.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin.render.target; 2 | 3 | import com.mojang.blaze3d.pipeline.MainTarget; 4 | import com.mojang.blaze3d.pipeline.RenderTarget; 5 | import net.vulkanmod.vulkan.Renderer; 6 | import net.vulkanmod.vulkan.Vulkan; 7 | import net.vulkanmod.vulkan.framebuffer.SwapChain; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.Overwrite; 10 | 11 | @Mixin(MainTarget.class) 12 | public class MainTargetMixin extends RenderTarget { 13 | 14 | public MainTargetMixin(boolean useDepth) { 15 | super(useDepth); 16 | } 17 | 18 | /** 19 | * @author 20 | * @reason 21 | */ 22 | @Overwrite 23 | private void createFrameBuffer(int width, int height) { 24 | this.frameBufferId = 0; 25 | 26 | this.viewWidth = width; 27 | this.viewHeight = height; 28 | this.width = width; 29 | this.height = height; 30 | } 31 | 32 | @Override 33 | public void bindWrite(boolean updateScissor) { 34 | Renderer.getInstance().getMainPass().rebindMainTarget(); 35 | } 36 | 37 | @Override 38 | public void bindRead() { 39 | Renderer.getInstance().getMainPass().bindAsTexture(); 40 | } 41 | 42 | @Override 43 | public int getColorTextureId() { 44 | return Renderer.getInstance().getMainPass().getColorAttachment().id; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/render/vertex/IndexTypeMixin.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin.render.vertex; 2 | 3 | import com.mojang.blaze3d.vertex.VertexFormat; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.Overwrite; 6 | 7 | @Mixin(VertexFormat.IndexType.class) 8 | public class IndexTypeMixin { 9 | 10 | /** 11 | * @author 12 | */ 13 | @Overwrite 14 | public static VertexFormat.IndexType least(int number) { 15 | return VertexFormat.IndexType.SHORT; 16 | } 17 | } -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/screen/OptionsScreenM.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin.screen; 2 | 3 | import net.minecraft.client.Options; 4 | import net.minecraft.client.gui.screens.Screen; 5 | import net.minecraft.client.gui.screens.options.OptionsScreen; 6 | import net.minecraft.network.chat.Component; 7 | import net.vulkanmod.config.gui.VOptionScreen; 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(OptionsScreen.class) 16 | public class OptionsScreenM extends Screen { 17 | 18 | @Shadow @Final private Screen lastScreen; 19 | 20 | @Shadow @Final private Options options; 21 | 22 | protected OptionsScreenM(Component title) { 23 | super(title); 24 | } 25 | 26 | @Inject(method = "method_19828", at = @At("HEAD"), cancellable = true) 27 | private void injectVideoOptionScreen(CallbackInfoReturnable cir) { 28 | cir.setReturnValue(new VOptionScreen(Component.literal("Video Setting"), this)); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/screen/ScreenM.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin.screen; 2 | 3 | import net.minecraft.client.gui.screens.Screen; 4 | import net.vulkanmod.vulkan.Renderer; 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(Screen.class) 11 | public class ScreenM { 12 | 13 | @Inject(method = "renderBlurredBackground", at = @At("RETURN")) 14 | private void clearDepth(float f, CallbackInfo ci) { 15 | // Workaround to fix hardcoded z value on PostPass blit shader, 16 | // that conflicts with Vulkan depth range [0.0, 1.0] 17 | Renderer.clearAttachments(256); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/texture/image/NativeImageAccessor.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin.texture.image; 2 | 3 | import com.mojang.blaze3d.platform.NativeImage; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Accessor; 6 | 7 | @Mixin(NativeImage.class) 8 | public interface NativeImageAccessor { 9 | 10 | @Accessor 11 | long getPixels(); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/texture/update/GameRendererM.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin.texture.update; 2 | 3 | import net.minecraft.client.DeltaTracker; 4 | import net.minecraft.client.Minecraft; 5 | import net.minecraft.client.renderer.GameRenderer; 6 | import net.vulkanmod.render.texture.ImageUploadHelper; 7 | import org.spongepowered.asm.mixin.Final; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.Shadow; 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(GameRenderer.class) 15 | public abstract class GameRendererM { 16 | 17 | @Shadow 18 | @Final 19 | Minecraft minecraft; 20 | 21 | @Inject(method = "render", at = @At("HEAD")) 22 | private void onRender(DeltaTracker deltaTracker, boolean bl, CallbackInfo ci) { 23 | if (this.minecraft.noRender || !(bl && this.minecraft.level != null && this.minecraft.isGameLoadFinished())) { 24 | ImageUploadHelper.INSTANCE.submitCommands(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/texture/update/MTextureManager.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin.texture.update; 2 | 3 | import net.minecraft.client.renderer.texture.TextureManager; 4 | import net.minecraft.client.renderer.texture.Tickable; 5 | import net.vulkanmod.render.texture.SpriteUpdateUtil; 6 | import net.vulkanmod.vulkan.Renderer; 7 | import org.spongepowered.asm.mixin.Final; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.Overwrite; 10 | import org.spongepowered.asm.mixin.Shadow; 11 | 12 | import java.util.Set; 13 | 14 | @Mixin(TextureManager.class) 15 | public abstract class MTextureManager { 16 | 17 | @Shadow @Final private Set tickableTextures; 18 | 19 | /** 20 | * @author 21 | */ 22 | @Overwrite 23 | public void tick() { 24 | if (Renderer.skipRendering) 25 | return; 26 | 27 | //Debug D 28 | for (Tickable tickable : this.tickableTextures) { 29 | tickable.tick(); 30 | } 31 | 32 | SpriteUpdateUtil.transitionLayouts(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/util/ScreenshotRecorderM.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin.util; 2 | 3 | import com.mojang.blaze3d.pipeline.RenderTarget; 4 | import com.mojang.blaze3d.platform.NativeImage; 5 | import net.minecraft.client.Screenshot; 6 | import net.vulkanmod.gl.VkGlTexture; 7 | import net.vulkanmod.vulkan.Renderer; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.Overwrite; 10 | 11 | @Mixin(Screenshot.class) 12 | public class ScreenshotRecorderM { 13 | 14 | /** 15 | * @author 16 | */ 17 | @Overwrite 18 | public static NativeImage takeScreenshot(RenderTarget target) { 19 | int width = target.width; 20 | int height = target.height; 21 | 22 | NativeImage nativeimage = new NativeImage(width, height, false); 23 | VkGlTexture.bindTexture(target.getColorTextureId()); 24 | 25 | // Need to submit and wait cmds if screenshot was requested 26 | // before the end of the frame 27 | Renderer.getInstance().flushCmds(); 28 | 29 | nativeimage.downloadTexture(0, true); 30 | return nativeimage; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/wayland/InputConstantsM.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin.wayland; 2 | 3 | import com.mojang.blaze3d.platform.InputConstants; 4 | import net.vulkanmod.config.Platform; 5 | import org.lwjgl.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 | @Mixin(InputConstants.class) 11 | public class InputConstantsM { 12 | /** 13 | * @author 14 | * @reason Setting the cursor position is not supported on Wayland 15 | */ 16 | @Redirect(method = "grabOrReleaseMouse", at = @At(value = "INVOKE", target = "Lorg/lwjgl/glfw/GLFW;glfwSetCursorPos(JDD)V")) 17 | private static void grabOrReleaseMouse(long window, double xpos, double ypos) { 18 | if (!Platform.isWayLand()) 19 | GLFW.glfwSetCursorPos(window, xpos, ypos); 20 | } 21 | } -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/mixin/window/WindowAccessor.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.mixin.window; 2 | 3 | import com.mojang.blaze3d.platform.Window; 4 | import com.mojang.blaze3d.platform.WindowEventHandler; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | @Mixin(Window.class) 9 | public interface WindowAccessor { 10 | 11 | @Accessor 12 | WindowEventHandler getEventHandler(); 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/render/chunk/build/color/BlockColorRegistry.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.render.chunk.build.color; 2 | 3 | import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap; 4 | import net.minecraft.client.color.block.BlockColor; 5 | import net.minecraft.world.level.block.Block; 6 | 7 | public class BlockColorRegistry { 8 | 9 | private final Reference2ReferenceOpenHashMap map = new Reference2ReferenceOpenHashMap<>(); 10 | 11 | public void register(BlockColor blockColor, Block... blocks) { 12 | for (Block block : blocks) { 13 | this.map.put(block, blockColor); 14 | } 15 | } 16 | 17 | public BlockColor getBlockColor(Block block) { 18 | return this.map.get(block); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/render/chunk/build/light/LightMode.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.render.chunk.build.light; 2 | 3 | public abstract class LightMode { 4 | public static final int FLAT = 0; 5 | public static final int SMOOTH = 1; 6 | public static final int SUB_BLOCK = 2; 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/render/chunk/build/light/LightPipeline.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.render.chunk.build.light; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.core.Direction; 5 | import net.vulkanmod.render.model.quad.ModelQuadView; 6 | import net.vulkanmod.render.chunk.build.light.data.QuadLightData; 7 | 8 | /** 9 | * Light pipelines allow model quads for any location in the world to be lit using various backends, including fluids 10 | * and block entities. 11 | */ 12 | public interface LightPipeline { 13 | /** 14 | * Calculates the light data for a given block model quad, storing the result in {@param out}. 15 | * @param quad The block model quad 16 | * @param pos The block position of the model this quad belongs to 17 | * @param out The data arrays which will store the calculated light data results 18 | * @param cullFace The cull face of the quad 19 | * @param lightFace The light face of the quad 20 | * @param shade True if the block is shaded by ambient occlusion 21 | */ 22 | void calculate(ModelQuadView quad, BlockPos pos, QuadLightData out, Direction cullFace, Direction lightFace, boolean shade); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/render/chunk/build/light/data/QuadLightData.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.render.chunk.build.light.data; 2 | 3 | /** 4 | * Stores the computed light data for a block model quad. The vertex order of each array is defined as that of the 5 | * quad's vertex order. 6 | */ 7 | public class QuadLightData { 8 | /** 9 | * The brightness of each vertex in the quad as normalized floats. 10 | */ 11 | public final float[] br = new float[4]; 12 | 13 | /** 14 | * The lightmap texture coordinates for each vertex in the quad. 15 | */ 16 | public final int[] lm = new int[4]; 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/render/chunk/build/light/smooth/FaceDataFlags.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.render.chunk.build.light.smooth; 2 | 3 | /** 4 | * Bit flags to indicate which light properties have been computed for a given face. 5 | */ 6 | abstract class FaceDataFlags { 7 | /** 8 | * The light data has been retrieved from the cache. 9 | */ 10 | public static final int HAS_LIGHT_DATA = 0b01; 11 | 12 | /** 13 | * The light data has been unpacked into normalized floating point values. 14 | */ 15 | public static final int HAS_UNPACKED_LIGHT_DATA = 0b10; 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/render/chunk/build/renderer/DefaultFluidRenderers.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.render.chunk.build.renderer; 2 | 3 | import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet; 4 | import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandler; 5 | 6 | public abstract class DefaultFluidRenderers { 7 | 8 | private static final ReferenceOpenHashSet set = new ReferenceOpenHashSet<>(); 9 | 10 | public static void add(FluidRenderHandler handler) { 11 | set.add(handler); 12 | } 13 | 14 | public static boolean has(FluidRenderHandler handler) { 15 | return set.contains(handler); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/render/chunk/build/task/ChunkTask.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.render.chunk.build.task; 2 | 3 | import net.vulkanmod.render.chunk.RenderSection; 4 | import net.vulkanmod.render.chunk.build.RenderRegion; 5 | import net.vulkanmod.render.chunk.build.thread.BuilderResources; 6 | 7 | import java.util.concurrent.atomic.AtomicBoolean; 8 | 9 | public abstract class ChunkTask { 10 | public static final boolean BENCH = true; 11 | 12 | protected static TaskDispatcher taskDispatcher; 13 | 14 | public static BuildTask createBuildTask(RenderSection renderSection, RenderRegion renderRegion, boolean highPriority) { 15 | return new BuildTask(renderSection, renderRegion, highPriority); 16 | } 17 | 18 | protected AtomicBoolean cancelled = new AtomicBoolean(false); 19 | protected final RenderSection section; 20 | public boolean highPriority = false; 21 | 22 | ChunkTask(RenderSection renderSection) { 23 | this.section = renderSection; 24 | } 25 | 26 | public abstract String name(); 27 | 28 | public abstract Result runTask(BuilderResources builderResources); 29 | 30 | public void cancel() { 31 | this.cancelled.set(true); 32 | } 33 | 34 | public static void setTaskDispatcher(TaskDispatcher dispatcher) { 35 | taskDispatcher = dispatcher; 36 | } 37 | 38 | public enum Result { 39 | CANCELLED, 40 | SUCCESSFUL 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/render/chunk/build/task/CompiledSection.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.render.chunk.build.task; 2 | 3 | import com.google.common.collect.Lists; 4 | import net.minecraft.world.level.block.entity.BlockEntity; 5 | import net.vulkanmod.render.vertex.QuadSorter; 6 | 7 | import org.jetbrains.annotations.Nullable; 8 | import java.util.List; 9 | 10 | public class CompiledSection { 11 | public static final CompiledSection UNCOMPILED = new CompiledSection(); 12 | 13 | boolean isCompletelyEmpty = false; 14 | final List blockEntities = Lists.newArrayList(); 15 | @Nullable QuadSorter.SortState transparencyState; 16 | 17 | public boolean hasTransparencyState() { 18 | return this.transparencyState != null; 19 | } 20 | 21 | public List getBlockEntities() { 22 | return this.blockEntities; 23 | } 24 | } 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/render/chunk/graph/GraphDirections.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.render.chunk.graph; 2 | 3 | public abstract class GraphDirections { 4 | public static final int DOWN = 0; 5 | public static final int UP = 1; 6 | public static final int NORTH = 2; 7 | public static final int SOUTH = 3; 8 | public static final int WEST = 4; 9 | public static final int EAST = 5; 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/render/chunk/util/AreaSetQueue.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.render.chunk.util; 2 | 3 | import net.vulkanmod.render.chunk.ChunkArea; 4 | 5 | import java.util.Arrays; 6 | import java.util.Iterator; 7 | 8 | public record AreaSetQueue(int size, int[] set, StaticQueue queue) { 9 | 10 | public AreaSetQueue(int size) { 11 | this(size, new int[(int) Math.ceil((float) size / Integer.SIZE)], new StaticQueue<>(size)); 12 | } 13 | 14 | public void add(ChunkArea chunkArea) { 15 | final int i = chunkArea.index >> 5; 16 | final int mask = 1 << (chunkArea.index & 31); 17 | if ((this.set[i] & mask) == 0) { 18 | queue.add(chunkArea); 19 | this.set[i] |= mask; 20 | } 21 | } 22 | 23 | public void clear() { 24 | Arrays.fill(this.set, 0); 25 | 26 | this.queue.clear(); 27 | } 28 | 29 | public Iterator iterator(boolean reverseOrder) { 30 | return queue.iterator(reverseOrder); 31 | } 32 | 33 | public Iterator iterator() { 34 | return this.iterator(false); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/render/chunk/util/BufferUtil.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.render.chunk.util; 2 | 3 | import org.lwjgl.system.MemoryUtil; 4 | 5 | import java.nio.ByteBuffer; 6 | 7 | public class BufferUtil { 8 | 9 | public static ByteBuffer clone(ByteBuffer src) { 10 | ByteBuffer ret = MemoryUtil.memAlloc(src.remaining()); 11 | MemoryUtil.memCopy(src, ret); 12 | return ret; 13 | } 14 | 15 | public static ByteBuffer bufferSlice(ByteBuffer buffer, int start, int end) { 16 | return MemoryUtil.memSlice(buffer, start, end - start); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/render/chunk/util/SimpleDirection.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.render.chunk.util; 2 | 3 | import net.minecraft.core.Direction; 4 | import net.minecraft.core.Vec3i; 5 | 6 | public enum SimpleDirection { 7 | DOWN(0, 1, -1, new Vec3i(0, -1, 0)), 8 | UP(1, 0, -1, new Vec3i(0, 1, 0)), 9 | NORTH(2, 3, 2, new Vec3i(0, 0, -1)), 10 | SOUTH(3, 2, 0, new Vec3i(0, 0, 1)), 11 | WEST(4, 5, 1, new Vec3i(-1, 0, 0)), 12 | EAST(5, 4, 3, new Vec3i(1, 0, 0)); 13 | 14 | private static final SimpleDirection[] VALUES = SimpleDirection.values(); 15 | 16 | public static SimpleDirection of(Direction direction) { 17 | return VALUES[direction.get3DDataValue()]; 18 | } 19 | 20 | private final int data3d; 21 | private final int oppositeIndex; 22 | private final int data2d; 23 | 24 | public final byte nx, ny, nz; 25 | 26 | SimpleDirection(int j, int k, int l, Vec3i normal) { 27 | this.data3d = j; 28 | this.oppositeIndex = k; 29 | this.data2d = l; 30 | 31 | this.nx = (byte) normal.getX(); 32 | this.ny = (byte) normal.getY(); 33 | this.nz = (byte) normal.getZ(); 34 | } 35 | 36 | public int get3DDataValue() { 37 | return this.data3d; 38 | } 39 | 40 | public byte getStepX() { 41 | return this.nx; 42 | } 43 | 44 | public byte getStepY() { 45 | return this.ny; 46 | } 47 | 48 | public byte getStepZ() { 49 | return this.nz; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/render/gui/GuiBatchRenderer.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xCollateral/VulkanMod/f23855f2675f1efb52fb8aa2c26bc23dccfb5543/src/main/java/net/vulkanmod/render/gui/GuiBatchRenderer.java -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/render/model/quad/ModelQuadView.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.render.model.quad; 2 | 3 | import net.minecraft.core.Direction; 4 | import net.vulkanmod.render.chunk.cull.QuadFacing; 5 | 6 | public interface ModelQuadView { 7 | 8 | int getFlags(); 9 | 10 | float getX(int idx); 11 | 12 | float getY(int idx); 13 | 14 | float getZ(int idx); 15 | 16 | int getColor(int idx); 17 | 18 | float getU(int idx); 19 | 20 | float getV(int idx); 21 | 22 | int getColorIndex(); 23 | 24 | Direction getFacingDirection(); 25 | 26 | Direction lightFace(); 27 | 28 | QuadFacing getQuadFacing(); 29 | 30 | int getNormal(); 31 | 32 | default boolean isTinted() { 33 | return this.getColorIndex() != -1; 34 | } 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/render/profiling/BuildTimeProfiler.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.render.profiling; 2 | 3 | import net.minecraft.client.Minecraft; 4 | 5 | public abstract class BuildTimeProfiler { 6 | 7 | private static boolean bench = false; 8 | private static long startTime; 9 | private static float deltaTime; 10 | 11 | public static void runBench(boolean building) { 12 | if(bench) { 13 | if (startTime == 0) { 14 | startTime = System.nanoTime(); 15 | } 16 | 17 | if(!building) { 18 | deltaTime = (System.nanoTime() - startTime) * 0.000001f; 19 | bench = false; 20 | startTime = 0; 21 | } 22 | } 23 | } 24 | 25 | public static void startBench() { 26 | bench = true; 27 | Minecraft.getInstance().levelRenderer.allChanged(); 28 | } 29 | 30 | public static float getDeltaTime() { 31 | return deltaTime; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/render/texture/ImageUploadHelper.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.render.texture; 2 | 3 | import net.vulkanmod.vulkan.Synchronization; 4 | import net.vulkanmod.vulkan.device.DeviceManager; 5 | import net.vulkanmod.vulkan.queue.CommandPool; 6 | import net.vulkanmod.vulkan.queue.Queue; 7 | 8 | public class ImageUploadHelper { 9 | 10 | public static final ImageUploadHelper INSTANCE = new ImageUploadHelper(); 11 | 12 | final Queue queue; 13 | private CommandPool.CommandBuffer currentCmdBuffer; 14 | 15 | public ImageUploadHelper() { 16 | queue = DeviceManager.getGraphicsQueue(); 17 | } 18 | 19 | public void submitCommands() { 20 | if (this.currentCmdBuffer == null) { 21 | return; 22 | } 23 | 24 | long fence = queue.submitCommands(this.currentCmdBuffer); 25 | Synchronization.INSTANCE.addCommandBuffer(this.currentCmdBuffer); 26 | 27 | this.currentCmdBuffer = null; 28 | } 29 | 30 | public CommandPool.CommandBuffer getOrStartCommandBuffer() { 31 | if (this.currentCmdBuffer == null) { 32 | this.currentCmdBuffer = this.queue.beginCommands(); 33 | } 34 | 35 | return this.currentCmdBuffer; 36 | } 37 | 38 | public CommandPool.CommandBuffer getCommandBuffer() { 39 | return this.currentCmdBuffer; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/render/texture/SpriteUpdateUtil.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.render.texture; 2 | 3 | import net.vulkanmod.vulkan.texture.VulkanImage; 4 | import org.lwjgl.system.MemoryStack; 5 | import org.lwjgl.vulkan.VkCommandBuffer; 6 | 7 | import java.util.HashSet; 8 | import java.util.Set; 9 | 10 | public abstract class SpriteUpdateUtil { 11 | 12 | private static boolean doUpload = true; 13 | private static final Set transitionedLayouts = new HashSet<>(); 14 | 15 | public static void setDoUpload(boolean b) { 16 | doUpload = b; 17 | } 18 | 19 | public static boolean doUploadFrame() { 20 | return doUpload; 21 | } 22 | 23 | public static void addTransitionedLayout(VulkanImage image) { 24 | transitionedLayouts.add(image); 25 | } 26 | 27 | public static void transitionLayouts() { 28 | if (!doUpload || transitionedLayouts.isEmpty()) { 29 | return; 30 | } 31 | 32 | VkCommandBuffer commandBuffer = ImageUploadHelper.INSTANCE.getOrStartCommandBuffer().handle; 33 | 34 | try (MemoryStack stack = MemoryStack.stackPush()) { 35 | transitionedLayouts.forEach(image -> image.readOnlyLayout(stack, commandBuffer)); 36 | transitionedLayouts.clear(); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/render/vertex/CustomVertexFormat.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.render.vertex; 2 | 3 | import com.mojang.blaze3d.vertex.VertexFormat; 4 | import com.mojang.blaze3d.vertex.VertexFormatElement; 5 | 6 | public class CustomVertexFormat { 7 | 8 | public static final VertexFormatElement ELEMENT_POSITION = new VertexFormatElement(0, 0,VertexFormatElement.Type.SHORT, VertexFormatElement.Usage.POSITION, 4); 9 | public static final VertexFormatElement ELEMENT_COLOR = new VertexFormatElement(1, 0, VertexFormatElement.Type.UINT, VertexFormatElement.Usage.COLOR, 1); 10 | public static final VertexFormatElement ELEMENT_UV0 = new VertexFormatElement(2, 0, VertexFormatElement.Type.USHORT, VertexFormatElement.Usage.UV, 2); 11 | 12 | public static final VertexFormat COMPRESSED_TERRAIN = 13 | VertexFormat.builder() 14 | .add("Position", ELEMENT_POSITION) 15 | .add("UV0", ELEMENT_UV0) 16 | .add("Color", ELEMENT_COLOR) 17 | .build(); 18 | 19 | public static final VertexFormat NONE = VertexFormat.builder().build(); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/render/vertex/format/I32_SNorm.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.render.vertex.format; 2 | 3 | public abstract class I32_SNorm { 4 | private static final float NORM_INV = 1.0f / 127.0f; 5 | 6 | public static int packNormal(float x, float y, float z) { 7 | x *= 127.0f; 8 | y *= 127.0f; 9 | z *= 127.0f; 10 | 11 | return ((int)x & 0xFF) | ((int)y & 0xFF) << 8| ((int)z & 0xFF) << 16; 12 | } 13 | 14 | public static int packNormal(int x, int y, int z) { 15 | return (x & 0xFF) | (y & 0xFF) << 8| (z & 0xFF) << 16; 16 | } 17 | 18 | public static float unpackX(int i) { 19 | return (byte)(i & 0xFF) * NORM_INV; 20 | } 21 | 22 | public static float unpackY(int i) { 23 | return (byte)((i >> 8) & 0xFF) * NORM_INV; 24 | } 25 | 26 | public static float unpackZ(int i) { 27 | return (byte)((i >> 16) & 0xFF) * NORM_INV; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/vulkan/SystemInfo.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.vulkan; 2 | 3 | import oshi.hardware.CentralProcessor; 4 | 5 | public class SystemInfo { 6 | public static final String cpuInfo; 7 | 8 | static { 9 | CentralProcessor centralProcessor = new oshi.SystemInfo().getHardware().getProcessor(); 10 | cpuInfo = String.format("%s", centralProcessor.getProcessorIdentifier().getName()).replaceAll("\\s+", " "); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/vulkan/memory/MemoryType.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.vulkan.memory; 2 | 3 | import net.vulkanmod.vulkan.memory.buffer.Buffer; 4 | import org.lwjgl.vulkan.VkMemoryHeap; 5 | import org.lwjgl.vulkan.VkMemoryType; 6 | 7 | import java.nio.ByteBuffer; 8 | 9 | public abstract class MemoryType { 10 | final Type type; 11 | public final VkMemoryType vkMemoryType; 12 | public final VkMemoryHeap vkMemoryHeap; 13 | 14 | MemoryType(Type type, VkMemoryType vkMemoryType, VkMemoryHeap vkMemoryHeap) { 15 | this.type = type; 16 | this.vkMemoryType = vkMemoryType; 17 | this.vkMemoryHeap = vkMemoryHeap; 18 | } 19 | 20 | public abstract void createBuffer(Buffer buffer, long size); 21 | 22 | public abstract void copyToBuffer(Buffer buffer, ByteBuffer src, long size, long srcOffset, long dstOffset); 23 | 24 | public abstract void copyFromBuffer(Buffer buffer, long bufferSize, ByteBuffer byteBuffer); 25 | 26 | public abstract boolean mappable(); 27 | 28 | public Type getType() { 29 | return this.type; 30 | } 31 | 32 | public enum Type { 33 | DEVICE_LOCAL, 34 | HOST_LOCAL 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/vulkan/memory/buffer/IndexBuffer.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.vulkan.memory.buffer; 2 | 3 | import net.vulkanmod.vulkan.memory.MemoryType; 4 | 5 | import static org.lwjgl.vulkan.VK10.*; 6 | 7 | public class IndexBuffer extends Buffer { 8 | 9 | public IndexType indexType; 10 | 11 | public IndexBuffer(int size, MemoryType type) { 12 | this(size, type, IndexType.UINT16); 13 | } 14 | 15 | public IndexBuffer(int size, MemoryType type, IndexType indexType) { 16 | super(VK_BUFFER_USAGE_INDEX_BUFFER_BIT, type); 17 | this.indexType = indexType; 18 | 19 | this.createBuffer(size); 20 | } 21 | 22 | public enum IndexType { 23 | UINT16(2, VK_INDEX_TYPE_UINT16), 24 | UINT32(4, VK_INDEX_TYPE_UINT32); 25 | 26 | public final int size; 27 | public final int value; 28 | 29 | IndexType(int size, int value) { 30 | this.size = size; 31 | this.value = value; 32 | } 33 | } 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/vulkan/memory/buffer/UniformBuffer.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.vulkan.memory.buffer; 2 | 3 | import net.vulkanmod.vulkan.device.DeviceManager; 4 | import net.vulkanmod.vulkan.memory.MemoryType; 5 | 6 | import static net.vulkanmod.vulkan.util.VUtil.align; 7 | import static org.lwjgl.vulkan.VK10.VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT; 8 | 9 | public class UniformBuffer extends Buffer { 10 | private final static int MIN_OFFSET_ALIGNMENT = (int) DeviceManager.deviceProperties.limits().minUniformBufferOffsetAlignment(); 11 | 12 | public static int getAlignedSize(int uploadSize) { 13 | return align(uploadSize, MIN_OFFSET_ALIGNMENT); 14 | } 15 | 16 | public UniformBuffer(int size, MemoryType memoryType) { 17 | super(VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, memoryType); 18 | this.createBuffer(size); 19 | } 20 | 21 | public void checkCapacity(int size) { 22 | if (size > this.bufferSize - this.usedBytes) { 23 | resizeBuffer((this.bufferSize + size) * 2); 24 | } 25 | } 26 | 27 | public void updateOffset(int alignedSize) { 28 | usedBytes += alignedSize; 29 | } 30 | 31 | public long getPointer() { 32 | return this.dataPtr + usedBytes; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/vulkan/memory/buffer/VertexBuffer.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.vulkan.memory.buffer; 2 | 3 | import net.vulkanmod.vulkan.memory.MemoryType; 4 | import net.vulkanmod.vulkan.memory.MemoryTypes; 5 | 6 | import static org.lwjgl.vulkan.VK10.VK_BUFFER_USAGE_VERTEX_BUFFER_BIT; 7 | 8 | public class VertexBuffer extends Buffer { 9 | 10 | public VertexBuffer(int size) { 11 | this(size, MemoryTypes.HOST_MEM); 12 | } 13 | 14 | public VertexBuffer(int size, MemoryType type) { 15 | super(VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, type); 16 | this.createBuffer(size); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/vulkan/pass/MainPass.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.vulkan.pass; 2 | 3 | import net.vulkanmod.gl.VkGlTexture; 4 | import org.lwjgl.system.MemoryStack; 5 | import org.lwjgl.vulkan.VkCommandBuffer; 6 | 7 | public interface MainPass { 8 | 9 | void begin(VkCommandBuffer commandBuffer, MemoryStack stack); 10 | 11 | void end(VkCommandBuffer commandBuffer); 12 | 13 | void cleanUp(); 14 | 15 | void onResize(); 16 | 17 | default void mainTargetBindWrite() {} 18 | 19 | default void mainTargetUnbindWrite() {} 20 | 21 | default void rebindMainTarget() {} 22 | 23 | default void bindAsTexture() {} 24 | 25 | default VkGlTexture getColorAttachment() { 26 | throw new UnsupportedOperationException(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/vulkan/queue/ComputeQueue.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.vulkan.queue; 2 | 3 | import org.lwjgl.system.MemoryStack; 4 | 5 | public class ComputeQueue extends Queue { 6 | 7 | public ComputeQueue(MemoryStack stack, int familyIndex) { 8 | super(stack, familyIndex); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/vulkan/queue/PresentQueue.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.vulkan.queue; 2 | 3 | import org.lwjgl.system.MemoryStack; 4 | 5 | public class PresentQueue extends Queue { 6 | 7 | public PresentQueue(MemoryStack stack, int familyIndex) { 8 | super(stack, familyIndex, false); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/vulkan/shader/descriptor/Descriptor.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.vulkan.shader.descriptor; 2 | 3 | public interface Descriptor { 4 | 5 | int getBinding(); 6 | 7 | int getType(); 8 | 9 | int getStages(); 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/vulkan/shader/descriptor/ManualUBO.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.vulkan.shader.descriptor; 2 | 3 | import org.lwjgl.system.MemoryUtil; 4 | 5 | public class ManualUBO extends UBO { 6 | 7 | private long srcPtr; 8 | private int srcSize; 9 | 10 | private boolean update = true; 11 | 12 | public ManualUBO(int binding, int type, int size) { 13 | super(binding, type, size * 4, null); 14 | } 15 | 16 | @Override 17 | public void update(long ptr) { 18 | // update manually 19 | if (update) 20 | MemoryUtil.memCopy(this.srcPtr, ptr, this.srcSize); 21 | } 22 | 23 | public void setSrc(long ptr, int size) { 24 | this.srcPtr = ptr; 25 | this.srcSize = size; 26 | } 27 | 28 | public void setUpdate(boolean update) { 29 | this.update = update; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/vulkan/shader/descriptor/UBO.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.vulkan.shader.descriptor; 2 | 3 | import net.vulkanmod.vulkan.memory.buffer.UniformBuffer; 4 | import net.vulkanmod.vulkan.shader.layout.AlignedStruct; 5 | import net.vulkanmod.vulkan.shader.layout.Uniform; 6 | 7 | import java.util.List; 8 | 9 | import static org.lwjgl.vulkan.VK10.VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC; 10 | 11 | public class UBO extends AlignedStruct implements Descriptor { 12 | private final int binding; 13 | private final int stages; 14 | 15 | private UniformBuffer uniformBuffer; 16 | 17 | public UBO(int binding, int stages, int size, List infoList) { 18 | super(infoList, size); 19 | this.binding = binding; 20 | this.stages = stages; 21 | } 22 | 23 | public int getBinding() { 24 | return binding; 25 | } 26 | 27 | @Override 28 | public int getType() { 29 | return VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC; 30 | } 31 | 32 | public int getStages() { 33 | return stages; 34 | } 35 | 36 | public UniformBuffer getUniformBuffer() { 37 | return uniformBuffer; 38 | } 39 | 40 | public void setUniformBuffer(UniformBuffer uniformBuffer) { 41 | this.uniformBuffer = uniformBuffer; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/vulkan/shader/layout/Mat3.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.vulkan.shader.layout; 2 | 3 | import net.vulkanmod.vulkan.util.MappedBuffer; 4 | import org.lwjgl.system.MemoryUtil; 5 | 6 | public class Mat3 extends Uniform { 7 | 8 | Mat3(Info info) { 9 | super(info); 10 | } 11 | 12 | void update(long ptr) { 13 | MappedBuffer src = values.get(); 14 | 15 | MemoryUtil.memCopy(src.ptr + 0, ptr + this.offset + 0, 12); 16 | MemoryUtil.memCopy(src.ptr + 12, ptr + this.offset + 16, 12); 17 | MemoryUtil.memCopy(src.ptr + 24, ptr + this.offset + 32, 12); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/vulkan/shader/layout/PushConstants.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.vulkan.shader.layout; 2 | 3 | import java.util.List; 4 | 5 | public class PushConstants extends AlignedStruct { 6 | 7 | protected PushConstants(List infoList, int size) { 8 | super(infoList, size); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/vulkan/shader/layout/Vec1f.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.vulkan.shader.layout; 2 | 3 | import net.vulkanmod.vulkan.util.MappedBuffer; 4 | import org.lwjgl.system.MemoryUtil; 5 | 6 | import java.util.function.Supplier; 7 | 8 | public class Vec1f extends Uniform { 9 | private Supplier floatSupplier; 10 | 11 | public Vec1f(Info info) { 12 | super(info); 13 | } 14 | 15 | protected void setupSupplier() { 16 | if (this.info.floatSupplier != null) { 17 | this.floatSupplier = this.info.floatSupplier; 18 | } else { 19 | this.setSupplier(this.info.bufferSupplier); 20 | } 21 | } 22 | 23 | @Override 24 | public void setSupplier(Supplier supplier) { 25 | this.floatSupplier = () -> supplier.get().getFloat(0); 26 | } 27 | 28 | void update(long ptr) { 29 | float f = this.floatSupplier.get(); 30 | MemoryUtil.memPutFloat(ptr + this.offset, f); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/vulkan/shader/layout/Vec1i.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.vulkan.shader.layout; 2 | 3 | import net.vulkanmod.vulkan.shader.Uniforms; 4 | import net.vulkanmod.vulkan.util.MappedBuffer; 5 | import org.apache.commons.lang3.Validate; 6 | import org.lwjgl.system.MemoryUtil; 7 | 8 | import java.util.function.Supplier; 9 | 10 | public class Vec1i extends Uniform { 11 | private Supplier intSupplier; 12 | 13 | public Vec1i(Info info) { 14 | super(info); 15 | } 16 | 17 | protected void setupSupplier() { 18 | if (this.info.intSupplier != null) { 19 | this.intSupplier = this.info.intSupplier; 20 | } else { 21 | this.setSupplier(this.info.bufferSupplier); 22 | } 23 | } 24 | 25 | @Override 26 | public void setSupplier(Supplier supplier) { 27 | this.intSupplier = () -> supplier.get().getInt(0); 28 | } 29 | 30 | void update(long ptr) { 31 | int i = this.intSupplier.get(); 32 | MemoryUtil.memPutInt(ptr + this.offset, i); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/vulkan/util/MappedBuffer.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.vulkan.util; 2 | 3 | import org.lwjgl.system.MemoryUtil; 4 | 5 | import java.nio.ByteBuffer; 6 | 7 | public class MappedBuffer { 8 | 9 | public final ByteBuffer buffer; 10 | public final long ptr; 11 | 12 | public static MappedBuffer createFromBuffer(ByteBuffer buffer) { 13 | return new MappedBuffer(buffer, MemoryUtil.memAddress0(buffer)); 14 | } 15 | MappedBuffer(ByteBuffer buffer, long ptr) { 16 | this.buffer = buffer; 17 | this.ptr = ptr; 18 | } 19 | 20 | public MappedBuffer(int size) { 21 | this.buffer = MemoryUtil.memAlloc(size); 22 | this.ptr = MemoryUtil.memAddress0(this.buffer); 23 | } 24 | 25 | public void putFloat(int idx, float f) { 26 | VUtil.UNSAFE.putFloat(ptr + idx, f); 27 | } 28 | 29 | public void putInt(int idx, int f) { 30 | VUtil.UNSAFE.putInt(ptr + idx, f); 31 | } 32 | 33 | public float getFloat(int idx) { 34 | return VUtil.UNSAFE.getFloat(ptr + idx); 35 | } 36 | 37 | public int getInt(int idx) { 38 | return VUtil.UNSAFE.getInt(ptr + idx); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/net/vulkanmod/vulkan/util/Pair.java: -------------------------------------------------------------------------------- 1 | package net.vulkanmod.vulkan.util; 2 | 3 | public class Pair { 4 | public A first; 5 | public B second; 6 | 7 | public Pair(A a, B b) { 8 | this.first = a; 9 | this.second = b; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/Vlogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xCollateral/VulkanMod/f23855f2675f1efb52fb8aa2c26bc23dccfb5543/src/main/resources/assets/vulkanmod/Vlogo.png -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/basic/blit/blit.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(binding = 0) uniform sampler2D DiffuseSampler; 4 | 5 | layout(location = 0) in vec2 texCoord; 6 | 7 | layout(location = 0) out vec4 fragColor; 8 | 9 | void main() { 10 | vec4 color = texture(DiffuseSampler, texCoord); 11 | 12 | // blit final output of compositor into displayed back buffer 13 | fragColor = color; 14 | } 15 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/basic/blit/blit.json: -------------------------------------------------------------------------------- 1 | { 2 | "samplers": [ 3 | { "name": "Sampler0" } 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/basic/blit/blit.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | const vec4 pos[] = { vec4(-1, -1, 0, 1), vec4(3, -1, 0, 1), vec4(-1, 3, 0, 1) }; 4 | 5 | #define INVERTED_UV 6 | 7 | #ifndef INVERTED_UV 8 | const vec2 uv[] = { vec2(0, 1), vec2(2, 1), vec2(0, -1) }; 9 | #else 10 | const vec2 uv[] = { vec2(0, 0), vec2(2, 0), vec2(0, 2) }; 11 | #endif 12 | 13 | layout(location = 0) out vec2 outUV; 14 | 15 | void main() { 16 | outUV = uv[gl_VertexIndex]; 17 | gl_Position = pos[gl_VertexIndex]; 18 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/basic/clouds/clouds.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(binding = 1) uniform UBO{ 4 | vec4 ColorModulator; 5 | vec4 FogColor; 6 | float FogStart; 7 | float FogEnd; 8 | }; 9 | 10 | layout(location = 0) in vec4 vertexColor; 11 | layout(location = 1) in float vertexDistance; 12 | 13 | layout(location = 0) out vec4 fragColor; 14 | 15 | void main() { 16 | vec4 color = vertexColor * ColorModulator; 17 | 18 | float alpha = smoothstep(FogEnd, FogStart, vertexDistance); 19 | fragColor = vec4(color.rgb, color.a * alpha); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/basic/clouds/clouds.json: -------------------------------------------------------------------------------- 1 | { 2 | "vertex": "clouds", 3 | "fragment": "clouds", 4 | "samplers": [], 5 | "UBOs": [ 6 | { "type": "vertex", "binding": 0, "fields": [ 7 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, 8 | { "name": "ModelOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] } 9 | ] }, 10 | { "type": "fragment", "binding": 1, "fields": [ 11 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }, 12 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }, 13 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, 14 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] } 15 | ] } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/basic/clouds/clouds.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(binding = 0) uniform UniformBufferObject { 4 | mat4 MVP; 5 | vec3 ModelOffset; 6 | }; 7 | 8 | layout(location = 0) in vec3 Position; 9 | layout(location = 1) in vec4 Color; 10 | 11 | layout(location = 0) out vec4 vertexColor; 12 | layout(location = 1) out float vertexDistance; 13 | 14 | void main() { 15 | gl_Position = MVP * vec4(Position, 1.0); 16 | vec3 viewPos = Position + ModelOffset; 17 | vertexDistance = length(viewPos.xyz); 18 | 19 | vertexColor = Color; 20 | } 21 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/basic/terrain/terrain.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "light.glsl" 4 | #include "fog.glsl" 5 | 6 | layout(binding = 2) uniform sampler2D Sampler0; 7 | 8 | layout(binding = 1) uniform UBO { 9 | vec4 FogColor; 10 | float FogStart; 11 | float FogEnd; 12 | float AlphaCutout; 13 | }; 14 | 15 | layout(location = 0) in vec4 vertexColor; 16 | layout(location = 1) in vec2 texCoord0; 17 | layout(location = 2) in float vertexDistance; 18 | 19 | layout(location = 0) out vec4 fragColor; 20 | 21 | void main() { 22 | vec4 color = texture(Sampler0, texCoord0) * vertexColor; 23 | if (color.a < AlphaCutout) { 24 | discard; 25 | } 26 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); 27 | } 28 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/basic/terrain/terrain.json: -------------------------------------------------------------------------------- 1 | { 2 | "vertex": "terrain", 3 | "fragment": "terrain", 4 | "samplers": [ 5 | { "name": "Sampler0" }, 6 | { "name": "Sampler2" } 7 | ], 8 | "UBOs": [ 9 | { "type": "vertex", "binding": 0, "fields": [ 10 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 11 | ] }, 12 | { "type": "fragment", "binding": 1, "fields": [ 13 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }, 14 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, 15 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] }, 16 | { "name": "AlphaCutout", "type": "float", "count": 1, "values": [ 1.0 ] } 17 | ] } 18 | ], 19 | "PushConstants": [ 20 | { "name": "ModelOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/basic/terrain_earlyZ/terrain_earlyZ.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(early_fragment_tests) in; 4 | 5 | #include "light.glsl" 6 | #include "fog.glsl" 7 | 8 | layout(binding = 2) uniform sampler2D Sampler0; 9 | 10 | layout(binding = 1) uniform UBO { 11 | vec4 FogColor; 12 | float FogStart; 13 | float FogEnd; 14 | }; 15 | 16 | layout(location = 0) in vec4 vertexColor; 17 | layout(location = 1) in vec2 texCoord0; 18 | layout(location = 2) in float vertexDistance; 19 | 20 | layout(location = 0) out vec4 fragColor; 21 | 22 | void main() { 23 | vec4 color = texture(Sampler0, texCoord0) * vertexColor; 24 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/basic/terrain_earlyZ/terrain_earlyZ.json: -------------------------------------------------------------------------------- 1 | { 2 | "vertex": "terrain", 3 | "fragment": "terrain_earlyZ", 4 | "samplers": [ 5 | { "name": "Sampler0" }, 6 | { "name": "Sampler2" } 7 | ], 8 | "UBOs": [ 9 | { "type": "vertex", "binding": 0, "fields": [ 10 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 11 | ] }, 12 | { "type": "fragment", "binding": 1, "fields": [ 13 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }, 14 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, 15 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] }, 16 | { "name": "AlphaCutout", "type": "float", "count": 1, "values": [ 1.0 ] } 17 | ] } 18 | ], 19 | "PushConstants": [ 20 | { "name": "ModelOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/blit_screen/blit_screen.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(binding = 0) uniform sampler2D DiffuseSampler; 4 | 5 | layout(location = 0) in vec2 texCoord; 6 | 7 | layout(location = 0) out vec4 fragColor; 8 | 9 | void main() { 10 | vec4 color = texture(DiffuseSampler, texCoord); 11 | fragColor = color; 12 | } 13 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/blit_screen/blit_screen.json: -------------------------------------------------------------------------------- 1 | { 2 | "vertex": "blit_screen", 3 | "fragment": "blit_screen", 4 | "samplers": [ 5 | { "name": "Sampler0" } 6 | ], 7 | "uniforms": [ 8 | ] 9 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/blit_screen/blit_screen.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(location = 0) in vec3 Position; 4 | 5 | layout(location = 0) out vec2 texCoord; 6 | 7 | void main() { 8 | vec2 screenPos = Position.xy * 2.0 - 1.0; 9 | gl_Position = vec4(screenPos.x, screenPos.y, 1.0, 1.0); 10 | texCoord = Position.xy; 11 | } 12 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/entity/entity.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | #include "fog.glsl" 3 | 4 | layout(binding = 2) uniform sampler2D Sampler0; 5 | 6 | layout(binding = 1) uniform UBO{ 7 | vec4 ColorModulator; 8 | vec4 FogColor; 9 | float FogStart; 10 | float FogEnd; 11 | }; 12 | 13 | layout(location = 0) in vec4 vertexColor; 14 | layout(location = 1) in vec4 lightMapColor; 15 | layout(location = 2) in vec4 overlayColor; 16 | layout(location = 3) in vec2 texCoord0; 17 | layout(location = 4) in float vertexDistance; 18 | 19 | layout(location = 0) out vec4 fragColor; 20 | 21 | void main() { 22 | vec4 color = texture(Sampler0, texCoord0); 23 | if (color.a < 0.1) { 24 | discard; 25 | } 26 | color *= vertexColor * ColorModulator; 27 | color.rgb = mix(overlayColor.rgb, color.rgb, overlayColor.a); 28 | color *= lightMapColor; 29 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); 30 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/entity/entity.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "light.glsl" 4 | #include "fog.glsl" 5 | 6 | layout(location = 0) in vec3 Position; 7 | layout(location = 1) in vec4 Color; 8 | layout(location = 2) in vec2 UV0; 9 | layout(location = 3) in ivec2 UV1; 10 | layout(location = 4) in ivec2 UV2; 11 | layout(location = 5) in vec3 Normal; 12 | 13 | layout(binding = 0) uniform UniformBufferObject { 14 | mat4 MVP; 15 | vec3 Light0_Direction; 16 | vec3 Light1_Direction; 17 | }; 18 | 19 | layout(binding = 3) uniform sampler2D Sampler1; 20 | layout(binding = 4) uniform sampler2D Sampler2; 21 | 22 | layout(location = 0) out vec4 vertexColor; 23 | layout(location = 1) out vec4 lightMapColor; 24 | layout(location = 2) out vec4 overlayColor; 25 | layout(location = 3) out vec2 texCoord0; 26 | layout(location = 4) out float vertexDistance; 27 | 28 | void main() { 29 | gl_Position = MVP * vec4(Position, 1.0); 30 | 31 | vertexDistance = fog_distance(Position.xyz, 0); 32 | vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color); 33 | lightMapColor = texelFetch(Sampler2, UV2 / 16, 0); 34 | overlayColor = texelFetch(Sampler1, UV1, 0); 35 | texCoord0 = UV0; 36 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/glint/glint.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | #include "fog.glsl" 3 | 4 | layout(binding = 2) uniform sampler2D Sampler0; 5 | 6 | layout(binding = 1) uniform UBO{ 7 | vec4 ColorModulator; 8 | float FogStart; 9 | float FogEnd; 10 | float GlintAlpha; 11 | }; 12 | 13 | layout(location = 0) in float vertexDistance; 14 | layout(location = 1) in vec2 texCoord0; 15 | 16 | layout(location = 0) out vec4 fragColor; 17 | 18 | void main() { 19 | vec4 color = texture(Sampler0, texCoord0) * ColorModulator; 20 | if (color.a < 0.1) { 21 | discard; 22 | } 23 | float fade = linear_fog_fade(vertexDistance, FogStart, FogEnd) * GlintAlpha; 24 | fragColor = vec4(color.rgb * fade, color.a); 25 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/glint/glint.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "fog.glsl" 4 | 5 | layout(location = 0) in vec3 Position; 6 | layout(location = 1) in vec2 UV0; 7 | 8 | layout(binding = 0) uniform UniformBufferObject { 9 | mat4 MVP; 10 | mat4 TextureMat; 11 | }; 12 | 13 | layout(location = 0) out float vertexDistance; 14 | layout(location = 1) out vec2 texCoord0; 15 | 16 | void main() { 17 | gl_Position = MVP * vec4(Position, 1.0); 18 | 19 | vertexDistance = fog_distance(Position.xyz, 0); 20 | texCoord0 = (TextureMat * vec4(UV0, 0.0, 1.0)).xy; 21 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/gui/gui.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(location = 0) in vec4 vertexColor; 4 | 5 | layout(binding = 1) uniform UBO{ 6 | vec4 ColorModulator; 7 | }; 8 | 9 | layout(location = 0) out vec4 fragColor; 10 | 11 | void main() { 12 | vec4 color = vertexColor; 13 | if (color.a == 0.0) { 14 | discard; 15 | } 16 | fragColor = color * ColorModulator; 17 | } 18 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/gui/gui.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(location = 0) in vec3 Position; 4 | layout(location = 1) in vec4 Color; 5 | 6 | layout(binding = 0) uniform UniformBufferObject { 7 | mat4 MVP; 8 | }; 9 | 10 | layout(location = 0) out vec4 vertexColor; 11 | 12 | void main() { 13 | gl_Position = MVP * vec4(Position, 1.0); 14 | 15 | vertexColor = Color; 16 | } 17 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/particle/particle.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | #include "fog.glsl" 3 | 4 | layout(binding = 2) uniform sampler2D Sampler0; 5 | 6 | layout(binding = 1) uniform UBO{ 7 | vec4 ColorModulator; 8 | vec4 FogColor; 9 | float FogStart; 10 | float FogEnd; 11 | }; 12 | 13 | layout(location = 0) in vec4 vertexColor; 14 | layout(location = 1) in vec2 texCoord0; 15 | layout(location = 2) in float vertexDistance; 16 | 17 | layout(location = 0) out vec4 fragColor; 18 | 19 | void main() { 20 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; 21 | if (color.a < 0.1) { 22 | discard; 23 | } 24 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); 25 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/particle/particle.json: -------------------------------------------------------------------------------- 1 | { 2 | "vertex": "particle", 3 | "fragment": "particle", 4 | "samplers": [ 5 | { "name": "Sampler0" }, 6 | { "name": "Sampler2" } 7 | ], 8 | "UBOs": [ 9 | { "type": "vertex", "binding": 0, "fields": [ 10 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 11 | ] }, 12 | { "type": "fragment", "binding": 1, "fields": [ 13 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, 14 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }, 15 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, 16 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] } 17 | ] } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/particle/particle.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "fog.glsl" 4 | 5 | layout(location = 0) in vec3 Position; 6 | layout(location = 1) in vec2 UV0; 7 | layout(location = 2) in vec4 Color; 8 | layout(location = 3) in ivec2 UV2; 9 | 10 | layout(binding = 0) uniform UniformBufferObject { 11 | mat4 MVP; 12 | }; 13 | 14 | layout(binding = 3) uniform sampler2D Sampler2; 15 | 16 | layout(location = 0) out vec4 vertexColor; 17 | layout(location = 1) out vec2 texCoord0; 18 | layout(location = 2) out float vertexDistance; 19 | 20 | void main() { 21 | gl_Position = MVP * vec4(Position, 1.0); 22 | 23 | vertexDistance = fog_distance(Position.xyz, 0); 24 | texCoord0 = UV0; 25 | vertexColor = Color * texelFetch(Sampler2, UV2 / 16, 0); 26 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/position/position.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | #include "fog.glsl" 3 | 4 | layout(binding = 1) uniform UBO{ 5 | vec4 ColorModulator; 6 | vec4 FogColor; 7 | float FogStart; 8 | float FogEnd; 9 | }; 10 | 11 | layout(location = 0) in float vertexDistance; 12 | 13 | layout(location = 0) out vec4 fragColor; 14 | 15 | void main() { 16 | fragColor = linear_fog(ColorModulator, vertexDistance, FogStart, FogEnd, FogColor); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/position/position.json: -------------------------------------------------------------------------------- 1 | { 2 | "blend": { 3 | "func": "add", 4 | "srcrgb": "srcalpha", 5 | "dstrgb": "1-srcalpha" 6 | }, 7 | "vertex": "position", 8 | "fragment": "position", 9 | "attributes": [], 10 | "samplers": [], 11 | "uniforms": [ 12 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, 13 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, 14 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] }, 15 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] } 16 | ], 17 | "UBOs": [ 18 | { "type": "vertex", "binding": 0, "fields": [ 19 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 20 | ] }, 21 | { "type": "fragment", "binding": 1, "fields": [ 22 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, 23 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }, 24 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, 25 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] } 26 | ] } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/position/position.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "fog.glsl" 4 | 5 | layout(location = 0) in vec3 Position; 6 | 7 | layout(binding = 0) uniform UniformBufferObject { 8 | mat4 MVP; 9 | }; 10 | 11 | layout(location = 0) out float vertexDistance; 12 | 13 | void main() { 14 | gl_Position = MVP * vec4(Position, 1.0); 15 | 16 | vertexDistance = fog_distance(Position.xyz, 0); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/position_color/position_color.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(location = 0) in vec4 vertexColor; 4 | 5 | layout(binding = 1) uniform UBO{ 6 | vec4 ColorModulator; 7 | }; 8 | 9 | layout(location = 0) out vec4 fragColor; 10 | 11 | void main() { 12 | vec4 color = vertexColor; 13 | if (color.a == 0.0) { 14 | discard; 15 | } 16 | fragColor = color * ColorModulator; 17 | } 18 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/position_color/position_color.json: -------------------------------------------------------------------------------- 1 | { 2 | "blend": { 3 | "func": "add", 4 | "srcrgb": "srcalpha", 5 | "dstrgb": "1-srcalpha" 6 | }, 7 | "vertex": "position_color", 8 | "fragment": "position_color", 9 | "attributes": [ 10 | "Color" 11 | ], 12 | "samplers": [], 13 | "uniforms": [ 14 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 15 | ], 16 | "UBOs": [ 17 | { "type": "vertex", "binding": 0, "fields": [ 18 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 19 | ] }, 20 | { "type": "fragment", "binding": 1, "fields": [ 21 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 22 | ] } 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/position_color/position_color.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(location = 0) in vec3 Position; 4 | layout(location = 1) in vec4 Color; 5 | 6 | layout(binding = 0) uniform UniformBufferObject { 7 | mat4 MVP; 8 | }; 9 | 10 | layout(location = 0) out vec4 vertexColor; 11 | 12 | void main() { 13 | gl_Position = MVP * vec4(Position, 1.0); 14 | 15 | vertexColor = Color; 16 | } 17 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/position_color_lightmap/position_color_lightmap.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(location = 0) in vec4 vertexColor; 4 | layout(location = 1) in vec2 texCoord2; 5 | 6 | layout(binding = 1) uniform UBO { 7 | vec4 ColorModulator; 8 | }; 9 | 10 | layout(binding = 2) uniform sampler2D Sampler2; 11 | 12 | layout(location = 0) out vec4 fragColor; 13 | 14 | void main() { 15 | vec4 color = texture(Sampler2, texCoord2) * vertexColor; 16 | fragColor = color * ColorModulator; 17 | } 18 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/position_color_lightmap/position_color_lightmap.json: -------------------------------------------------------------------------------- 1 | { 2 | "blend": { 3 | "func": "add", 4 | "srcrgb": "srcalpha", 5 | "dstrgb": "1-srcalpha" 6 | }, 7 | "vertex": "position_color_lightmap", 8 | "fragment": "position_color_lightmap", 9 | "attributes": [ 10 | "Position", 11 | "Color", 12 | "UV2" 13 | ], 14 | "samplers": [ 15 | { "name": "Sampler2" } 16 | ], 17 | "uniforms": [ 18 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 19 | ], 20 | "UBOs": [ 21 | { "type": "vertex", "binding": 0, "fields": [ 22 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 23 | ] }, 24 | { "type": "fragment", "binding": 1, "fields": [ 25 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 26 | ] } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/position_color_lightmap/position_color_lightmap.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(location = 0) in vec3 Position; 4 | layout(location = 1) in vec4 Color; 5 | layout(location = 2) in vec2 UV2; 6 | 7 | layout(binding = 0) uniform UniformBufferObject { 8 | mat4 MVP; 9 | }; 10 | 11 | layout(location = 0) out vec4 vertexColor; 12 | layout(location = 1) out vec2 texCoord2; 13 | 14 | void main() { 15 | gl_Position = MVP * vec4(Position, 1.0); 16 | 17 | vertexColor = Color; 18 | texCoord2 = UV2; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/position_color_normal/position_color_normal.fsh: -------------------------------------------------------------------------------- 1 | //#version 150 2 | // 3 | //#moj_import 4 | // 5 | //uniform vec4 ColorModulator; 6 | //uniform float FogStart; 7 | //uniform float FogEnd; 8 | //uniform vec4 FogColor; 9 | // 10 | //in float vertexDistance; 11 | //in vec4 vertexColor; 12 | //in vec4 normal; 13 | // 14 | //out vec4 fragColor; 15 | // 16 | //void main() { 17 | // vec4 color = vertexColor * ColorModulator; 18 | // if (color.a < 0.1) { 19 | // discard; 20 | // } 21 | // fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); 22 | //} 23 | 24 | #version 450 25 | 26 | #include 27 | 28 | layout(binding = 2) uniform sampler2D Sampler0; 29 | 30 | layout(binding = 1) uniform UBO{ 31 | vec4 ColorModulator; 32 | float FogStart; 33 | float FogEnd; 34 | vec4 FogColor; 35 | }; 36 | 37 | layout(location = 0) in float vertexDistance; 38 | layout(location = 1) in vec4 vertexColor; 39 | layout(location = 2) in vec4 normal; 40 | 41 | layout(location = 0) out vec4 fragColor; 42 | 43 | void main() { 44 | vec4 color = vertexColor * ColorModulator; 45 | if (color.a < 0.1) { 46 | discard; 47 | } 48 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); 49 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/position_color_normal/position_color_normal.json: -------------------------------------------------------------------------------- 1 | { 2 | "blend": { 3 | "func": "add", 4 | "srcrgb": "srcalpha", 5 | "dstrgb": "1-srcalpha" 6 | }, 7 | "vertex": "position_color_normal", 8 | "fragment": "position_color_normal", 9 | "attributes": [ 10 | "Position", 11 | "Color", 12 | "Normal" 13 | ], 14 | "samplers": [], 15 | "uniforms": [ 16 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, 17 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, 18 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] }, 19 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] } 20 | ], 21 | "UBOs": [ 22 | { "type": "vertex", "binding": 0, "fields": [ 23 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 24 | ] }, 25 | { "type": "fragment", "binding": 1, "fields": [ 26 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 27 | ] } 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/position_color_normal/position_color_normal.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "fog.glsl" 4 | 5 | layout(location = 0) in vec3 Position; 6 | layout(location = 1) in vec4 Color; 7 | layout(location = 2) in vec3 Normal; 8 | 9 | layout(binding = 0) uniform UniformBufferObject { 10 | mat4 MVP; 11 | }; 12 | 13 | layout(location = 0) out float vertexDistance; 14 | layout(location = 1) out vec4 vertexColor; 15 | layout(location = 2) out vec4 normal; 16 | 17 | void main() { 18 | gl_Position = MVP * vec4(Position, 1.0); 19 | 20 | vertexDistance = fog_distance(Position.xyz, 0); 21 | vertexColor = Color; 22 | normal = MVP * vec4(Normal, 0.0); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/position_color_tex/position_color_tex.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(binding = 2) uniform sampler2D Sampler0; 4 | 5 | layout(binding = 1) uniform UBO{ 6 | vec4 ColorModulator; 7 | }; 8 | 9 | layout(location = 0) in vec4 vertexColor; 10 | layout(location = 1) in vec2 texCoord0; 11 | 12 | layout(location = 0) out vec4 fragColor; 13 | 14 | void main() { 15 | vec4 color = texture(Sampler0, texCoord0) * vertexColor; 16 | if (color.a < 0.1) { 17 | discard; 18 | } 19 | fragColor = color * ColorModulator; 20 | } 21 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/position_color_tex/position_color_tex.json: -------------------------------------------------------------------------------- 1 | { 2 | "blend": { 3 | "func": "add", 4 | "srcrgb": "srcalpha", 5 | "dstrgb": "1-srcalpha" 6 | }, 7 | "vertex": "position_color_tex", 8 | "fragment": "position_color_tex", 9 | "attributes": [ 10 | "Position", 11 | "Color", 12 | "UV0" 13 | ], 14 | "samplers": [ 15 | { "name": "Sampler0" } 16 | ], 17 | "uniforms": [ 18 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 19 | ], 20 | "UBOs": [ 21 | { "type": "vertex", "binding": 0, "fields": [ 22 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 23 | ] }, 24 | { "type": "fragment", "binding": 1, "fields": [ 25 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 26 | ] } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/position_color_tex/position_color_tex.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(location = 0) in vec3 Position; 4 | layout(location = 1) in vec4 Color; 5 | layout(location = 2) in vec2 UV0; 6 | 7 | layout(binding = 0) uniform UniformBufferObject { 8 | mat4 MVP; 9 | }; 10 | 11 | layout(location = 0) out vec4 vertexColor; 12 | layout(location = 1) out vec2 texCoord0; 13 | 14 | void main() { 15 | gl_Position = MVP * vec4(Position, 1.0); 16 | 17 | vertexColor = Color; 18 | texCoord0 = UV0; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/position_color_tex_lightmap/position_color_tex_lightmap.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(binding = 2) uniform sampler2D Sampler0; 4 | 5 | layout(binding = 1) uniform UBO{ 6 | vec4 ColorModulator; 7 | }; 8 | 9 | layout(location = 0) in vec4 vertexColor; 10 | layout(location = 1) in vec2 texCoord0; 11 | 12 | layout(location = 0) out vec4 fragColor; 13 | 14 | void main() { 15 | vec4 color = texture(Sampler0, texCoord0) * vertexColor; 16 | if (color.a < 0.1) { 17 | discard; 18 | } 19 | fragColor = color * ColorModulator; 20 | } 21 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/position_color_tex_lightmap/position_color_tex_lightmap.json: -------------------------------------------------------------------------------- 1 | { 2 | "blend": { 3 | "func": "add", 4 | "srcrgb": "srcalpha", 5 | "dstrgb": "1-srcalpha" 6 | }, 7 | "vertex": "position_color_tex_lightmap", 8 | "fragment": "position_color_tex_lightmap", 9 | "attributes": [ 10 | "Position", 11 | "Color", 12 | "UV0" 13 | ], 14 | "samplers": [ 15 | { "name": "Sampler0" } 16 | ], 17 | "uniforms": [ 18 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 19 | ], 20 | "UBOs": [ 21 | { "type": "vertex", "binding": 0, "fields": [ 22 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 23 | ] }, 24 | { "type": "fragment", "binding": 1, "fields": [ 25 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 26 | ] } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/position_color_tex_lightmap/position_color_tex_lightmap.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(location = 0) in vec3 Position; 4 | layout(location = 1) in vec4 Color; 5 | layout(location = 2) in vec2 UV0; 6 | 7 | layout(binding = 0) uniform UniformBufferObject { 8 | mat4 MVP; 9 | }; 10 | 11 | layout(location = 0) out vec4 vertexColor; 12 | layout(location = 1) out vec2 texCoord0; 13 | 14 | void main() { 15 | gl_Position = MVP * vec4(Position, 1.0); 16 | 17 | vertexColor = Color; 18 | texCoord0 = UV0; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/position_tex/position_tex.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(binding = 2) uniform sampler2D Sampler0; 4 | 5 | layout(binding = 1) uniform UBO{ 6 | vec4 ColorModulator; 7 | }; 8 | 9 | layout(location = 0) in vec2 texCoord0; 10 | 11 | layout(location = 0) out vec4 fragColor; 12 | 13 | void main() { 14 | vec4 color = texture(Sampler0, texCoord0); 15 | if (color.a == 0.0) { 16 | discard; 17 | } 18 | fragColor = color * ColorModulator; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/position_tex/position_tex.json: -------------------------------------------------------------------------------- 1 | { 2 | "blend": { 3 | "func": "add", 4 | "srcrgb": "srcalpha", 5 | "dstrgb": "1-srcalpha" 6 | }, 7 | "vertex": "position_tex", 8 | "fragment": "position_tex", 9 | "attributes": [ 10 | "Position", 11 | "UV0" 12 | ], 13 | "samplers": [ 14 | { "name": "Sampler0" } 15 | ], 16 | "uniforms": [ 17 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 18 | ], 19 | "UBOs": [ 20 | { "type": "vertex", "binding": 0, "fields": [ 21 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 22 | ] }, 23 | { "type": "fragment", "binding": 1, "fields": [ 24 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 25 | ] } 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/position_tex/position_tex.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(location = 0) in vec3 Position; 4 | layout(location = 1) in vec2 UV0; 5 | 6 | layout(binding = 0) uniform UniformBufferObject { 7 | mat4 MVP; 8 | }; 9 | 10 | layout(location = 0) out vec2 texCoord0; 11 | 12 | void main() { 13 | gl_Position = MVP * vec4(Position, 1.0); 14 | 15 | texCoord0 = UV0; 16 | } 17 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/position_tex_color/position_tex_color.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(binding = 2) uniform sampler2D Sampler0; 4 | 5 | layout(binding = 1) uniform UBO{ 6 | vec4 ColorModulator; 7 | }; 8 | 9 | layout(location = 0) in vec4 vertexColor; 10 | layout(location = 1) in vec2 texCoord0; 11 | 12 | layout(location = 0) out vec4 fragColor; 13 | 14 | void main() { 15 | vec4 color = texture(Sampler0, texCoord0) * vertexColor; 16 | if (color.a < 0.1) { 17 | discard; 18 | } 19 | fragColor = color * ColorModulator; 20 | } 21 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/position_tex_color/position_tex_color.json: -------------------------------------------------------------------------------- 1 | { 2 | "vertex": "minecraft:core/position_tex_color", 3 | "fragment": "minecraft:core/position_tex_color", 4 | "samplers": [ 5 | { "name": "Sampler0" } 6 | ], 7 | "uniforms": [ 8 | { "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, 9 | { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, 10 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 11 | ], 12 | "UBOs": [ 13 | { "type": "vertex", "binding": 0, "fields": [ 14 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 15 | ] }, 16 | { "type": "fragment", "binding": 1, "fields": [ 17 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 18 | ] } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/position_tex_color/position_tex_color.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(location = 0) in vec3 Position; 4 | layout(location = 2) in vec4 Color; 5 | layout(location = 1) in vec2 UV0; 6 | 7 | layout(binding = 0) uniform UniformBufferObject { 8 | mat4 MVP; 9 | }; 10 | 11 | layout(location = 0) out vec4 vertexColor; 12 | layout(location = 1) out vec2 texCoord0; 13 | 14 | void main() { 15 | gl_Position = MVP * vec4(Position, 1.0); 16 | 17 | vertexColor = Color; 18 | texCoord0 = UV0; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/position_tex_color_normal/position_tex_color_normal.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | #include "fog.glsl" 3 | 4 | layout(binding = 2) uniform sampler2D Sampler0; 5 | 6 | layout(binding = 1) uniform UBO{ 7 | vec4 ColorModulator; 8 | vec4 FogColor; 9 | float FogStart; 10 | float FogEnd; 11 | }; 12 | 13 | layout(location = 0) in vec4 vertexColor; 14 | layout(location = 1) in vec2 texCoord0; 15 | layout(location = 2) in float vertexDistance; 16 | 17 | layout(location = 0) out vec4 fragColor; 18 | 19 | void main() { 20 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; 21 | if (color.a < 0.1) { 22 | discard; 23 | } 24 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); 25 | } 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/position_tex_color_normal/position_tex_color_normal.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "fog.glsl" 4 | 5 | layout(location = 0) in vec3 Position; 6 | layout(location = 1) in vec2 UV0; 7 | layout(location = 2) in vec4 Color; 8 | 9 | layout(binding = 0) uniform UniformBufferObject { 10 | mat4 MVP; 11 | }; 12 | 13 | layout(location = 0) out vec4 vertexColor; 14 | layout(location = 1) out vec2 texCoord0; 15 | layout(location = 2) out float vertexDistance; 16 | 17 | void main() { 18 | gl_Position = MVP * vec4(Position, 1.0); 19 | 20 | texCoord0 = UV0; 21 | vertexDistance = fog_distance(Position.xyz, 0); 22 | vertexColor = Color; 23 | } 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_armor_cutout_no_cull/rendertype_armor_cutout_no_cull.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | #include "fog.glsl" 3 | 4 | layout(binding = 2) uniform sampler2D Sampler0; 5 | 6 | layout(binding = 1) uniform UBO{ 7 | vec4 ColorModulator; 8 | vec4 FogColor; 9 | float FogStart; 10 | float FogEnd; 11 | }; 12 | 13 | layout(location = 0) in vec4 vertexColor; 14 | layout(location = 1) in vec2 texCoord0; 15 | layout(location = 2) in float vertexDistance; 16 | 17 | layout(location = 0) out vec4 fragColor; 18 | 19 | void main() { 20 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; 21 | if (color.a < 0.1) { 22 | discard; 23 | } 24 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); 25 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_armor_cutout_no_cull/rendertype_armor_cutout_no_cull.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "light.glsl" 4 | #include "fog.glsl" 5 | 6 | layout(location = 0) in vec3 Position; 7 | layout(location = 1) in vec4 Color; 8 | layout(location = 2) in vec2 UV0; 9 | layout(location = 4) in ivec2 UV2; 10 | layout(location = 5) in vec3 Normal; 11 | 12 | layout(binding = 0) uniform UniformBufferObject { 13 | mat4 MVP; 14 | vec3 Light0_Direction; 15 | vec3 Light1_Direction; 16 | }; 17 | 18 | layout(binding = 3) uniform sampler2D Sampler2; 19 | 20 | layout(location = 0) out vec4 vertexColor; 21 | layout(location = 1) out vec2 texCoord0; 22 | layout(location = 2) out float vertexDistance; 23 | 24 | void main() { 25 | gl_Position = MVP * vec4(Position, 1.0); 26 | 27 | vertexDistance = fog_distance(Position.xyz, 0); 28 | vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color) * texelFetch(Sampler2, UV2 / 16, 0); 29 | texCoord0 = UV0; 30 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_armor_entity_glint/rendertype_armor_entity_glint.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | #include "fog.glsl" 3 | 4 | layout(binding = 2) uniform sampler2D Sampler0; 5 | 6 | layout(binding = 1) uniform UBO{ 7 | vec4 ColorModulator; 8 | float FogStart; 9 | float FogEnd; 10 | float GlintAlpha; 11 | }; 12 | 13 | layout(location = 0) in float vertexDistance; 14 | layout(location = 1) in vec2 texCoord0; 15 | 16 | layout(location = 0) out vec4 fragColor; 17 | 18 | void main() { 19 | vec4 color = texture(Sampler0, texCoord0) * ColorModulator; 20 | if (color.a < 0.1) { 21 | discard; 22 | } 23 | float fade = linear_fog_fade(vertexDistance, FogStart, FogEnd) * GlintAlpha; 24 | fragColor = vec4(color.rgb * fade, color.a); 25 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_armor_entity_glint/rendertype_armor_entity_glint.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "fog.glsl" 4 | 5 | layout(location = 0) in vec3 Position; 6 | layout(location = 1) in vec2 UV0; 7 | 8 | layout(binding = 0) uniform UniformBufferObject { 9 | mat4 MVP; 10 | mat4 TextureMat; 11 | }; 12 | 13 | layout(location = 0) out float vertexDistance; 14 | layout(location = 1) out vec2 texCoord0; 15 | 16 | void main() { 17 | gl_Position = MVP * vec4(Position, 1.0); 18 | 19 | vertexDistance = fog_distance(Position.xyz, 0); 20 | texCoord0 = (TextureMat * vec4(UV0, 0.0, 1.0)).xy; 21 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_armor_glint/rendertype_armor_glint.json: -------------------------------------------------------------------------------- 1 | { 2 | "vertex": "glint", 3 | "fragment": "glint", 4 | "samplers": [ 5 | { "name": "Sampler0" } 6 | ], 7 | "UBOs": [ 8 | { "type": "vertex", "binding": 0, "fields": [ 9 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, 10 | { "name": "TextureMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 11 | ] }, 12 | { "type": "fragment", "binding": 1, "fields": [ 13 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, 14 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, 15 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] }, 16 | { "name": "GlintAlpha", "type": "float", "count": 1, "values": [ 1.0 ] } 17 | ] } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_armor_translucent/rendertype_armor_translucent.json: -------------------------------------------------------------------------------- 1 | { 2 | "vertex": "entity", 3 | "fragment": "entity", 4 | "defines": { 5 | "values": { 6 | "ALPHA_CUTOUT": "0.1" 7 | }, 8 | "flags": [ 9 | "NO_OVERLAY" 10 | ] 11 | }, 12 | "samplers": [ 13 | { "name": "Sampler0" }, 14 | { "name": "Sampler2" } 15 | ], 16 | "UBOs": [ 17 | { "type": "vertex", "binding": 0, "fields": [ 18 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, 19 | { "name": "Light0_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] }, 20 | { "name": "Light1_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] } 21 | ] }, 22 | { "type": "fragment", "binding": 1, "fields": [ 23 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, 24 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }, 25 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, 26 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] } 27 | ] } 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_beacon_beam/rendertype_beacon_beam.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | #include "fog.glsl" 3 | 4 | layout(binding = 0) uniform UniformBufferObject { 5 | mat4 MVP; 6 | mat4 ProjMat; 7 | }; 8 | 9 | layout(binding = 1) uniform UBO{ 10 | vec4 ColorModulator; 11 | vec4 FogColor; 12 | float FogStart; 13 | float FogEnd; 14 | }; 15 | 16 | layout(binding = 2) uniform sampler2D Sampler0; 17 | 18 | layout(location = 0) in vec4 vertexColor; 19 | layout(location = 1) in vec2 texCoord0; 20 | 21 | layout(location = 0) out vec4 fragColor; 22 | 23 | void main() { 24 | vec4 color = texture(Sampler0, texCoord0); 25 | color *= vertexColor * ColorModulator; 26 | float fragmentDistance = -ProjMat[3].z / ((gl_FragCoord.z) * -2.0 + 1.0 - ProjMat[2].z); 27 | fragColor = linear_fog(color, fragmentDistance, FogStart, FogEnd, FogColor); 28 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_beacon_beam/rendertype_beacon_beam.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(location = 0) in vec3 Position; 4 | layout(location = 1) in vec4 Color; 5 | layout(location = 2) in vec2 UV0; 6 | 7 | layout(binding = 0) uniform UniformBufferObject { 8 | mat4 MVP; 9 | mat4 ProjMat; 10 | }; 11 | 12 | layout(location = 0) out vec4 vertexColor; 13 | layout(location = 1) out vec2 texCoord0; 14 | 15 | void main() { 16 | gl_Position = MVP * vec4(Position, 1.0); 17 | 18 | vertexColor = Color; 19 | texCoord0 = UV0; 20 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_breeze_wind/rendertype_breeze_wind.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | #include "fog.glsl" 3 | 4 | layout(binding = 2) uniform sampler2D Sampler0; 5 | 6 | layout(binding = 1) uniform UBO{ 7 | vec4 ColorModulator; 8 | float FogStart; 9 | float FogEnd; 10 | }; 11 | 12 | layout(location = 0) in float vertexDistance; 13 | layout(location = 1) in vec4 vertexColor; 14 | layout(location = 3) in vec2 texCoord0; 15 | 16 | layout(location = 0) out vec4 fragColor; 17 | 18 | void main() { 19 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; 20 | if (color.a < 0.1) { 21 | discard; 22 | } 23 | fragColor = color * linear_fog_fade(vertexDistance, FogStart, FogEnd); 24 | } 25 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_breeze_wind/rendertype_breeze_wind.json: -------------------------------------------------------------------------------- 1 | { 2 | "vertex": "rendertype_breeze_wind", 3 | "fragment": "rendertype_breeze_wind", 4 | "samplers": [ 5 | { "name": "Sampler0" }, 6 | { "name": "Sampler2" } 7 | ], 8 | "UBOs": [ 9 | { "type": "vertex", "binding": 0, "fields": [ 10 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, 11 | { "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, 12 | { "name": "TextureMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, 13 | { "name": "FogShape", "type": "int", "count": 1, "values": [ 0 ] } 14 | ] }, 15 | { "type": "fragment", "binding": 1, "fields": [ 16 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, 17 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, 18 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] } 19 | ] } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_breeze_wind/rendertype_breeze_wind.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "fog.glsl" 4 | 5 | layout(location = 0) in vec3 Position; 6 | layout(location = 1) in vec4 Color; 7 | layout(location = 2) in vec2 UV0; 8 | layout(location = 4) in ivec2 UV2; 9 | 10 | layout(binding = 0) uniform UniformBufferObject { 11 | mat4 MVP; 12 | mat4 ModelViewMat; 13 | mat4 TextureMat; 14 | int FogShape; 15 | }; 16 | 17 | layout(binding = 3) uniform sampler2D Sampler2; 18 | 19 | layout(location = 0) out float vertexDistance; 20 | layout(location = 1) out vec4 vertexColor; 21 | layout(location = 2) out vec4 lightMapColor; 22 | layout(location = 3) out vec2 texCoord0; 23 | 24 | void main() { 25 | gl_Position = MVP * vec4(Position, 1.0); 26 | 27 | vertexDistance = fog_distance(Position, FogShape); 28 | lightMapColor = texelFetch(Sampler2, UV2 / 16, 0); 29 | vertexColor = Color * lightMapColor; 30 | 31 | texCoord0 = (TextureMat * vec4(UV0, 0.0, 1.0)).xy; 32 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_clouds/rendertype_clouds.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "fog.glsl" 4 | 5 | layout(binding = 1) uniform UBO{ 6 | vec4 FogColor; 7 | float FogStart; 8 | float FogEnd; 9 | }; 10 | 11 | layout(location = 0) in vec4 vertexColor; 12 | layout(location = 1) in float vertexDistance; 13 | 14 | layout(location = 0) out vec4 fragColor; 15 | 16 | void main() { 17 | fragColor = linear_fog(vertexColor, vertexDistance, FogStart, FogEnd, FogColor); 18 | } 19 | 20 | //#version 150 21 | // 22 | //#moj_import 23 | // 24 | //uniform sampler2D Sampler0; 25 | // 26 | //uniform vec4 ColorModulator; 27 | //uniform float FogStart; 28 | //uniform float FogEnd; 29 | //uniform vec4 FogColor; 30 | // 31 | //in vec2 texCoord0; 32 | //in float vertexDistance; 33 | //in vec4 vertexColor; 34 | // 35 | //out vec4 fragColor; 36 | // 37 | //void main() { 38 | // vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; 39 | // if (color.a < 0.1) { 40 | // discard; 41 | // } 42 | // fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); 43 | //} 44 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_clouds/rendertype_clouds.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "fog.glsl" 4 | 5 | layout(location = 0) in vec3 Position; 6 | layout(location = 1) in vec2 UV0; 7 | layout(location = 2) in vec4 Color; 8 | layout(location = 3) in vec3 Normal; 9 | 10 | layout(binding = 0) uniform UniformBufferObject { 11 | mat4 MVP; 12 | mat4 ModelViewMat; 13 | int FogShape; 14 | }; 15 | 16 | layout(location = 0) out vec4 vertexColor; 17 | layout(location = 1) out vec2 texCoord0; 18 | layout(location = 2) out float vertexDistance; 19 | layout(location = 3) out vec3 normal; 20 | 21 | void main() { 22 | gl_Position = MVP * vec4(Position, 1.0); 23 | 24 | texCoord0 = UV0; 25 | vec4 pos = ModelViewMat * vec4(Position, 1.0); 26 | vertexDistance = fog_distance(pos.xyz, FogShape); 27 | vertexColor = Color; 28 | } 29 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_crumbling/rendertype_crumbling.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(binding = 2) uniform sampler2D Sampler0; 4 | 5 | layout(binding = 1) uniform UBO{ 6 | vec4 ColorModulator; 7 | }; 8 | 9 | layout(location = 0) in vec4 vertexColor; 10 | layout(location = 1) in vec2 texCoord0; 11 | 12 | layout(location = 0) out vec4 fragColor; 13 | 14 | void main() { 15 | vec4 color = texture(Sampler0, texCoord0) * vertexColor; 16 | if (color.a < 0.1) { 17 | discard; 18 | } 19 | fragColor = color * ColorModulator; 20 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_crumbling/rendertype_crumbling.json: -------------------------------------------------------------------------------- 1 | { 2 | "blend": { 3 | "func": "add", 4 | "srcrgb": "srcalpha", 5 | "dstrgb": "1-srcalpha" 6 | }, 7 | "vertex": "rendertype_crumbling", 8 | "fragment": "rendertype_crumbling", 9 | "attributes": [ 10 | "Position", 11 | "Color", 12 | "UV0", 13 | "Normal" 14 | ], 15 | "samplers": [ 16 | { "name": "Sampler0" } 17 | ], 18 | "uniforms": [ 19 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 20 | ], 21 | "UBOs": [ 22 | { "type": "vertex", "binding": 0, "fields": [ 23 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 24 | ] }, 25 | { "type": "fragment", "binding": 1, "fields": [ 26 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 27 | ] } 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_crumbling/rendertype_crumbling.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(location = 0) in vec3 Position; 4 | layout(location = 1) in vec4 Color; 5 | layout(location = 2) in vec2 UV0; 6 | layout(location = 4) in vec3 Normal; 7 | 8 | layout(binding = 0) uniform UniformBufferObject { 9 | mat4 MVP; 10 | }; 11 | 12 | layout(location = 0) out vec4 vertexColor; 13 | layout(location = 1) out vec2 texCoord0; 14 | 15 | void main() { 16 | gl_Position = MVP * vec4(Position, 1.0); 17 | 18 | vertexColor = Color; 19 | texCoord0 = UV0; 20 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_cutout/rendertype_cutout.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | #include "fog.glsl" 3 | 4 | layout(binding = 2) uniform sampler2D Sampler0; 5 | 6 | layout(binding = 1) uniform UBO{ 7 | vec4 ColorModulator; 8 | vec4 FogColor; 9 | float FogStart; 10 | float FogEnd; 11 | }; 12 | 13 | layout(location = 0) in float vertexDistance; 14 | layout(location = 1) in vec4 vertexColor; 15 | layout(location = 2) in vec2 texCoord0; 16 | 17 | layout(location = 0) out vec4 fragColor; 18 | 19 | void main() { 20 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; 21 | if (color.a < 0.1) { 22 | discard; 23 | } 24 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); 25 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_cutout/rendertype_cutout.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "light.glsl" 4 | #include "fog.glsl" 5 | 6 | layout(location = 0) in vec3 Position; 7 | layout(location = 1) in vec4 Color; 8 | layout(location = 2) in vec2 UV0; 9 | layout(location = 3) in ivec2 UV2; 10 | layout(location = 4) in vec3 Normal; 11 | 12 | layout(binding = 0) uniform UniformBufferObject { 13 | mat4 MVP; 14 | vec3 ChunkOffset; 15 | }; 16 | 17 | layout(binding = 3) uniform sampler2D Sampler2; 18 | 19 | layout(location = 0) out float vertexDistance; 20 | layout(location = 1) out vec4 vertexColor; 21 | layout(location = 2) out vec2 texCoord0; 22 | 23 | void main() { 24 | vec3 pos = Position + ChunkOffset; 25 | gl_Position = MVP * vec4(pos, 1.0); 26 | 27 | vertexDistance = fog_distance(pos, 0); 28 | vertexColor = Color * minecraft_sample_lightmap(Sampler2, UV2); 29 | texCoord0 = UV0; 30 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_cutout_mipped/rendertype_cutout_mipped.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | #include "fog.glsl" 3 | 4 | layout(binding = 2) uniform sampler2D Sampler0; 5 | 6 | layout(binding = 1) uniform UBO{ 7 | vec4 ColorModulator; 8 | vec4 FogColor; 9 | float FogStart; 10 | float FogEnd; 11 | }; 12 | 13 | layout(location = 0) in float vertexDistance; 14 | layout(location = 1) in vec4 vertexColor; 15 | layout(location = 2) in vec2 texCoord0; 16 | 17 | layout(location = 0) out vec4 fragColor; 18 | 19 | void main() { 20 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; 21 | if (color.a < 0.5) { 22 | discard; 23 | } 24 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); 25 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_cutout_mipped/rendertype_cutout_mipped.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "light.glsl" 4 | #include "fog.glsl" 5 | 6 | layout(location = 0) in vec3 Position; 7 | layout(location = 1) in vec4 Color; 8 | layout(location = 2) in vec2 UV0; 9 | layout(location = 3) in ivec2 UV2; 10 | layout(location = 4) in vec3 Normal; 11 | 12 | layout(binding = 0) uniform UniformBufferObject { 13 | mat4 MVP; 14 | vec3 ChunkOffset; 15 | }; 16 | 17 | layout(binding = 3) uniform sampler2D Sampler2; 18 | 19 | layout(location = 0) out float vertexDistance; 20 | layout(location = 1) out vec4 vertexColor; 21 | layout(location = 2) out vec2 texCoord0; 22 | 23 | void main() { 24 | vec3 pos = Position + ChunkOffset; 25 | gl_Position = MVP * vec4(pos, 1.0); 26 | 27 | vertexDistance = fog_distance(pos, 0); 28 | vertexColor = Color * minecraft_sample_lightmap(Sampler2, UV2); 29 | texCoord0 = UV0; 30 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_end_gateway/rendertype_end_gateway.json: -------------------------------------------------------------------------------- 1 | { 2 | "vertex": "rendertype_end_portal", 3 | "fragment": "rendertype_end_portal", 4 | "samplers": [ 5 | { "name": "Sampler0" }, 6 | { "name": "Sampler1" } 7 | ], 8 | "UBOs": [ 9 | { "type": "vertex", "binding": 0, "fields": [ 10 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 11 | ] }, 12 | { "type": "fragment", "binding": 1, "fields": [ 13 | { "name": "GameTime", "type": "float", "count": 1, "values": [ 0.0 ] }, 14 | { "name": "EndPortalLayers", "type": "int", "count": 1, "values": [ 15 ] } 15 | ] } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_end_portal/rendertype_end_portal.json: -------------------------------------------------------------------------------- 1 | { 2 | "vertex": "rendertype_end_portal", 3 | "fragment": "rendertype_end_portal", 4 | "samplers": [ 5 | { "name": "Sampler0" }, 6 | { "name": "Sampler1" } 7 | ], 8 | "UBOs": [ 9 | { "type": "vertex", "binding": 0, "fields": [ 10 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 11 | ] }, 12 | { "type": "fragment", "binding": 1, "fields": [ 13 | { "name": "GameTime", "type": "float", "count": 1, "values": [ 0.0 ] }, 14 | { "name": "EndPortalLayers", "type": "int", "count": 1, "values": [ 15 ] } 15 | ] } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_end_portal/rendertype_end_portal.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | //projection.glsl 4 | vec4 projection_from_position(vec4 position) { 5 | vec4 projection = position * 0.5; 6 | projection.xy = vec2(projection.x + projection.w, projection.y + projection.w); 7 | projection.zw = position.zw; 8 | return projection; 9 | } 10 | 11 | layout(location = 0) in vec3 Position; 12 | 13 | layout(binding = 0) uniform UniformBufferObject { 14 | mat4 MVP; 15 | }; 16 | 17 | layout(location = 0) out vec4 texProj0; 18 | 19 | void main() { 20 | gl_Position = MVP * vec4(Position, 1.0); 21 | 22 | texProj0 = projection_from_position(gl_Position); 23 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_energy_swirl/rendertype_energy_swirl.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | #include "fog.glsl" 3 | 4 | layout(binding = 2) uniform sampler2D Sampler0; 5 | 6 | layout(binding = 1) uniform UBO{ 7 | vec4 ColorModulator; 8 | float FogStart; 9 | float FogEnd; 10 | }; 11 | 12 | layout(location = 0) in float vertexDistance; 13 | layout(location = 1) in vec4 vertexColor; 14 | layout(location = 2) in vec2 texCoord0; 15 | 16 | layout(location = 0) out vec4 fragColor; 17 | 18 | void main() { 19 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; 20 | if (color.a < 0.1) { 21 | discard; 22 | } 23 | fragColor = color * linear_fog_fade(vertexDistance, FogStart, FogEnd); 24 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_energy_swirl/rendertype_energy_swirl.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "fog.glsl" 4 | 5 | layout(location = 0) in vec3 Position; 6 | layout(location = 1) in vec4 Color; 7 | layout(location = 2) in vec2 UV0; 8 | 9 | layout(binding = 0) uniform UniformBufferObject { 10 | mat4 MVP; 11 | mat4 TextureMat; 12 | }; 13 | 14 | layout(location = 0) out float vertexDistance; 15 | layout(location = 1) out vec4 vertexColor; 16 | layout(location = 2) out vec2 texCoord0; 17 | 18 | void main() { 19 | gl_Position = MVP * vec4(Position, 1.0); 20 | 21 | vertexDistance = fog_distance(Position.xyz, 0); 22 | vertexColor = Color; 23 | texCoord0 = (TextureMat * vec4(UV0, 0.0, 1.0)).xy; 24 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_entity_alpha/rendertype_entity_alpha.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(binding = 1) uniform sampler2D Sampler0; 4 | 5 | layout(location = 0) in vec4 vertexColor; 6 | layout(location = 1) in vec2 texCoord0; 7 | 8 | layout(location = 0) out vec4 fragColor; 9 | 10 | void main() { 11 | vec4 color = texture(Sampler0, texCoord0); 12 | if (color.a < vertexColor.a) { 13 | discard; 14 | } 15 | fragColor = color; 16 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_entity_alpha/rendertype_entity_alpha.json: -------------------------------------------------------------------------------- 1 | { 2 | "vertex": "rendertype_entity_alpha", 3 | "fragment": "rendertype_entity_alpha", 4 | "samplers": [ 5 | { "name": "Sampler0" } 6 | ], 7 | "UBOs": [ 8 | { "type": "vertex", "binding": 0, "fields": [ 9 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 10 | ] } 11 | 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_entity_alpha/rendertype_entity_alpha.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(location = 0) in vec3 Position; 4 | layout(location = 1) in vec4 Color; 5 | layout(location = 2) in vec2 UV0; 6 | layout(location = 5) in vec3 Normal; 7 | 8 | layout(binding = 0) uniform UniformBufferObject { 9 | mat4 MVP; 10 | }; 11 | 12 | layout(location = 0) out vec4 vertexColor; 13 | layout(location = 1) out vec2 texCoord0; 14 | 15 | 16 | void main() { 17 | gl_Position = MVP * vec4(Position, 1.0); 18 | 19 | vertexColor = Color; 20 | texCoord0 = UV0; 21 | } 22 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_entity_cutout/rendertype_entity_cutout.json: -------------------------------------------------------------------------------- 1 | { 2 | "vertex": "entity", 3 | "fragment": "entity", 4 | "defines": { 5 | "values": { 6 | "ALPHA_CUTOUT": "0.1" 7 | } 8 | }, 9 | "samplers": [ 10 | { "name": "Sampler0" }, 11 | { "name": "Sampler1" }, 12 | { "name": "Sampler2" } 13 | ], 14 | "UBOs": [ 15 | { "type": "vertex", "binding": 0, "fields": [ 16 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, 17 | { "name": "Light0_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] }, 18 | { "name": "Light1_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] } 19 | ] }, 20 | { "type": "fragment", "binding": 1, "fields": [ 21 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, 22 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }, 23 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, 24 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] } 25 | ] } 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_entity_cutout_no_cull/rendertype_entity_cutout_no_cull.json: -------------------------------------------------------------------------------- 1 | { 2 | "vertex": "entity", 3 | "fragment": "entity", 4 | "defines": { 5 | "values": { 6 | "ALPHA_CUTOUT": "0.1" 7 | } 8 | }, 9 | "samplers": [ 10 | { "name": "Sampler0" }, 11 | { "name": "Sampler1" }, 12 | { "name": "Sampler2" } 13 | ], 14 | "UBOs": [ 15 | { "type": "vertex", "binding": 0, "fields": [ 16 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, 17 | { "name": "Light0_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] }, 18 | { "name": "Light1_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] } 19 | ] }, 20 | { "type": "fragment", "binding": 1, "fields": [ 21 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, 22 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }, 23 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, 24 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] } 25 | ] } 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_entity_cutout_no_cull_z_offset/rendertype_entity_cutout_no_cull_z_offset.json: -------------------------------------------------------------------------------- 1 | { 2 | "vertex": "entity", 3 | "fragment": "entity", 4 | "defines": { 5 | "values": { 6 | "ALPHA_CUTOUT": "0.1" 7 | } 8 | }, 9 | "samplers": [ 10 | { "name": "Sampler0" }, 11 | { "name": "Sampler1" }, 12 | { "name": "Sampler2" } 13 | ], 14 | "UBOs": [ 15 | { "type": "vertex", "binding": 0, "fields": [ 16 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, 17 | { "name": "Light0_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] }, 18 | { "name": "Light1_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] } 19 | ] }, 20 | { "type": "fragment", "binding": 1, "fields": [ 21 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, 22 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }, 23 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, 24 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] } 25 | ] } 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_entity_decal/rendertype_entity_decal.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | #include "fog.glsl" 3 | 4 | layout(binding = 2) uniform sampler2D Sampler0; 5 | 6 | layout(binding = 1) uniform UBO{ 7 | vec4 ColorModulator; 8 | vec4 FogColor; 9 | float FogStart; 10 | float FogEnd; 11 | }; 12 | 13 | layout(location = 0) in vec4 vertexColor; 14 | layout(location = 1) in vec4 overlayColor; 15 | layout(location = 2) in vec2 texCoord0; 16 | layout(location = 3) in float vertexDistance; 17 | 18 | layout(location = 0) out vec4 fragColor; 19 | 20 | void main() { 21 | vec4 color = texture(Sampler0, texCoord0); 22 | if (color.a < 0.1) { 23 | discard; 24 | } 25 | color.rgb = mix(overlayColor.rgb, color.rgb, overlayColor.a); 26 | color *= vertexColor * ColorModulator; 27 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); 28 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_entity_decal/rendertype_entity_decal.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "light.glsl" 4 | #include "fog.glsl" 5 | 6 | layout(location = 0) in vec3 Position; 7 | layout(location = 1) in vec4 Color; 8 | layout(location = 2) in vec2 UV0; 9 | layout(location = 3) in ivec2 UV1; 10 | layout(location = 4) in ivec2 UV2; 11 | layout(location = 5) in vec3 Normal; 12 | 13 | layout(binding = 0) uniform UniformBufferObject { 14 | mat4 MVP; 15 | vec3 Light0_Direction; 16 | vec3 Light1_Direction; 17 | }; 18 | 19 | layout(binding = 3) uniform sampler2D Sampler1; 20 | layout(binding = 4) uniform sampler2D Sampler2; 21 | 22 | layout(location = 0) out vec4 vertexColor; 23 | layout(location = 1) out vec4 overlayColor; 24 | layout(location = 2) out vec2 texCoord0; 25 | layout(location = 3) out float vertexDistance; 26 | 27 | void main() { 28 | gl_Position = MVP * vec4(Position, 1.0); 29 | 30 | vertexDistance = fog_distance(Position.xyz, 0); 31 | vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color) * texelFetch(Sampler2, UV2 / 16, 0); 32 | overlayColor = texelFetch(Sampler1, UV1, 0); 33 | texCoord0 = UV0; 34 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_entity_glint/rendertype_entity_glint.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | #include "fog.glsl" 3 | 4 | layout(binding = 2) uniform sampler2D Sampler0; 5 | 6 | layout(binding = 1) uniform UBO{ 7 | vec4 ColorModulator; 8 | float FogStart; 9 | float FogEnd; 10 | float GlintAlpha; 11 | }; 12 | 13 | layout(location = 0) in float vertexDistance; 14 | layout(location = 1) in vec2 texCoord0; 15 | 16 | layout(location = 0) out vec4 fragColor; 17 | 18 | void main() { 19 | vec4 color = texture(Sampler0, texCoord0) * ColorModulator; 20 | if (color.a < 0.1) { 21 | discard; 22 | } 23 | float fade = linear_fog_fade(vertexDistance, FogStart, FogEnd) * GlintAlpha; 24 | fragColor = vec4(color.rgb * fade, color.a); 25 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_entity_glint/rendertype_entity_glint.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "fog.glsl" 4 | 5 | layout(location = 0) in vec3 Position; 6 | layout(location = 1) in vec2 UV0; 7 | 8 | layout(binding = 0) uniform UniformBufferObject { 9 | mat4 MVP; 10 | mat4 TextureMat; 11 | }; 12 | 13 | layout(location = 0) out float vertexDistance; 14 | layout(location = 1) out vec2 texCoord0; 15 | 16 | void main() { 17 | gl_Position = MVP * vec4(Position, 1.0); 18 | 19 | vertexDistance = fog_distance(Position.xyz, 0); 20 | texCoord0 = (TextureMat * vec4(UV0, 0.0, 1.0)).xy; 21 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_entity_glint_direct/rendertype_entity_glint_direct.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | #include "fog.glsl" 3 | 4 | layout(binding = 2) uniform sampler2D Sampler0; 5 | 6 | layout(binding = 1) uniform UBO{ 7 | vec4 ColorModulator; 8 | float FogStart; 9 | float FogEnd; 10 | float GlintAlpha; 11 | }; 12 | 13 | layout(location = 0) in float vertexDistance; 14 | layout(location = 1) in vec2 texCoord0; 15 | 16 | layout(location = 0) out vec4 fragColor; 17 | 18 | void main() { 19 | vec4 color = texture(Sampler0, texCoord0) * ColorModulator; 20 | if (color.a < 0.1) { 21 | discard; 22 | } 23 | float fade = linear_fog_fade(vertexDistance, FogStart, FogEnd) * GlintAlpha; 24 | fragColor = vec4(color.rgb * fade, color.a); 25 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_entity_glint_direct/rendertype_entity_glint_direct.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "fog.glsl" 4 | 5 | layout(location = 0) in vec3 Position; 6 | layout(location = 1) in vec2 UV0; 7 | 8 | layout(binding = 0) uniform UniformBufferObject { 9 | mat4 MVP; 10 | mat4 TextureMat; 11 | }; 12 | 13 | layout(location = 0) out float vertexDistance; 14 | layout(location = 1) out vec2 texCoord0; 15 | 16 | void main() { 17 | gl_Position = MVP * vec4(Position, 1.0); 18 | 19 | vertexDistance = fog_distance(Position.xyz, 0); 20 | texCoord0 = (TextureMat * vec4(UV0, 0.0, 1.0)).xy; 21 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_entity_no_outline/rendertype_entity_no_outline.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | #include "fog.glsl" 3 | 4 | layout(binding = 2) uniform sampler2D Sampler0; 5 | 6 | layout(binding = 1) uniform UBO{ 7 | vec4 ColorModulator; 8 | vec4 FogColor; 9 | float FogStart; 10 | float FogEnd; 11 | }; 12 | 13 | layout(location = 0) in vec4 vertexColor; 14 | layout(location = 1) in vec2 texCoord0; 15 | layout(location = 2) in float vertexDistance; 16 | 17 | layout(location = 0) out vec4 fragColor; 18 | 19 | void main() { 20 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; 21 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); 22 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_entity_no_outline/rendertype_entity_no_outline.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "light.glsl" 4 | #include "fog.glsl" 5 | 6 | layout(location = 0) in vec3 Position; 7 | layout(location = 1) in vec4 Color; 8 | layout(location = 2) in vec2 UV0; 9 | layout(location = 4) in ivec2 UV2; 10 | layout(location = 5) in vec3 Normal; 11 | 12 | layout(binding = 0) uniform UniformBufferObject { 13 | mat4 MVP; 14 | vec3 Light0_Direction; 15 | vec3 Light1_Direction; 16 | }; 17 | 18 | layout(binding = 3) uniform sampler2D Sampler2; 19 | 20 | layout(location = 0) out vec4 vertexColor; 21 | layout(location = 1) out vec2 texCoord0; 22 | layout(location = 2) out float vertexDistance; 23 | 24 | void main() { 25 | gl_Position = MVP * vec4(Position, 1.0); 26 | 27 | vertexDistance = fog_distance(Position.xyz, 0); 28 | vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color) * texelFetch(Sampler2, UV2 / 16, 0); 29 | texCoord0 = UV0; 30 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_entity_shadow/rendertype_entity_shadow.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(binding = 2) uniform sampler2D Sampler0; 4 | 5 | layout(binding = 1) uniform UBO{ 6 | vec4 ColorModulator; 7 | }; 8 | 9 | layout(location = 0) in vec4 vertexColor; 10 | layout(location = 1) in vec2 texCoord0; 11 | 12 | layout(location = 0) out vec4 fragColor; 13 | 14 | void main() { 15 | vec4 color = texture(Sampler0, clamp(texCoord0, 0.0, 1.0)); 16 | color *= vertexColor * ColorModulator; 17 | fragColor = color; 18 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_entity_shadow/rendertype_entity_shadow.json: -------------------------------------------------------------------------------- 1 | { 2 | "blend": { 3 | "func": "add", 4 | "srcrgb": "srcalpha", 5 | "dstrgb": "1-srcalpha" 6 | }, 7 | "vertex": "rendertype_entity_shadow", 8 | "fragment": "rendertype_entity_shadow", 9 | "attributes": [ 10 | "Position", 11 | "Color", 12 | "UV0" 13 | ], 14 | "samplers": [ 15 | { "name": "Sampler0" } 16 | ], 17 | "uniforms": [ 18 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 19 | ], 20 | "UBOs": [ 21 | { "type": "vertex", "binding": 0, "fields": [ 22 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 23 | ] }, 24 | { "type": "fragment", "binding": 1, "fields": [ 25 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 26 | ] } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_entity_shadow/rendertype_entity_shadow.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(location = 0) in vec3 Position; 4 | layout(location = 1) in vec4 Color; 5 | layout(location = 2) in vec2 UV0; 6 | 7 | layout(binding = 0) uniform UniformBufferObject { 8 | mat4 MVP; 9 | }; 10 | 11 | layout(location = 0) out vec4 vertexColor; 12 | layout(location = 1) out vec2 texCoord0; 13 | 14 | void main() { 15 | gl_Position = MVP * vec4(Position, 1.0); 16 | 17 | vertexColor = Color; 18 | texCoord0 = UV0; 19 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_entity_smooth_cutout/rendertype_entity_smooth_cutout.json: -------------------------------------------------------------------------------- 1 | { 2 | "vertex": "entity", 3 | "fragment": "entity", 4 | "defines": { 5 | "values": { 6 | "ALPHA_CUTOUT": "0.1" 7 | } 8 | }, 9 | "samplers": [ 10 | { "name": "Sampler0" }, 11 | { "name": "Sampler1" }, 12 | { "name": "Sampler2" } 13 | ], 14 | "UBOs": [ 15 | { "type": "vertex", "binding": 0, "fields": [ 16 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, 17 | { "name": "Light0_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] }, 18 | { "name": "Light1_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] } 19 | ] }, 20 | { "type": "fragment", "binding": 1, "fields": [ 21 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, 22 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }, 23 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, 24 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] } 25 | ] } 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_entity_solid/rendertype_entity_solid.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | #include "fog.glsl" 3 | 4 | layout(binding = 2) uniform sampler2D Sampler0; 5 | 6 | layout(binding = 1) uniform UBO{ 7 | vec4 ColorModulator; 8 | vec4 FogColor; 9 | float FogStart; 10 | float FogEnd; 11 | }; 12 | 13 | layout(location = 0) in vec4 vertexColor; 14 | layout(location = 1) in vec4 lightMapColor; 15 | layout(location = 2) in vec4 overlayColor; 16 | layout(location = 3) in vec2 texCoord0; 17 | layout(location = 4) in float vertexDistance; 18 | 19 | layout(location = 0) out vec4 fragColor; 20 | 21 | void main() { 22 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; 23 | color.rgb = mix(overlayColor.rgb, color.rgb, overlayColor.a); 24 | color *= lightMapColor; 25 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); 26 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_entity_solid/rendertype_entity_solid.json: -------------------------------------------------------------------------------- 1 | { 2 | "vertex": "rendertype_entity_solid", 3 | "fragment": "rendertype_entity_solid", 4 | "samplers": [ 5 | { "name": "Sampler0" }, 6 | { "name": "Sampler1" }, 7 | { "name": "Sampler2" } 8 | ], 9 | "UBOs": [ 10 | { "type": "vertex", "binding": 0, "fields": [ 11 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, 12 | { "name": "Light0_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] }, 13 | { "name": "Light1_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] } 14 | ] }, 15 | { "type": "fragment", "binding": 1, "fields": [ 16 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, 17 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }, 18 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, 19 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] } 20 | ] } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_entity_solid/rendertype_entity_solid.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "light.glsl" 4 | #include "fog.glsl" 5 | 6 | layout(location = 0) in vec3 Position; 7 | layout(location = 1) in vec4 Color; 8 | layout(location = 2) in vec2 UV0; 9 | layout(location = 3) in ivec2 UV1; 10 | layout(location = 4) in ivec2 UV2; 11 | layout(location = 5) in vec3 Normal; 12 | 13 | layout(binding = 0) uniform UniformBufferObject { 14 | mat4 MVP; 15 | vec3 Light0_Direction; 16 | vec3 Light1_Direction; 17 | }; 18 | 19 | layout(binding = 3) uniform sampler2D Sampler1; 20 | layout(binding = 4) uniform sampler2D Sampler2; 21 | 22 | layout(location = 0) out vec4 vertexColor; 23 | layout(location = 1) out vec4 lightMapColor; 24 | layout(location = 2) out vec4 overlayColor; 25 | layout(location = 3) out vec2 texCoord0; 26 | layout(location = 4) out float vertexDistance; 27 | 28 | void main() { 29 | gl_Position = MVP * vec4(Position, 1.0); 30 | 31 | vertexDistance = fog_distance(Position.xyz, 0); 32 | vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color); 33 | lightMapColor = texelFetch(Sampler2, UV2 / 16, 0); 34 | overlayColor = texelFetch(Sampler1, UV1, 0); 35 | texCoord0 = UV0; 36 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_entity_translucent/rendertype_entity_translucent.json: -------------------------------------------------------------------------------- 1 | { 2 | "vertex": "entity", 3 | "fragment": "entity", 4 | "defines": { 5 | "values": { 6 | "ALPHA_CUTOUT": "0.1" 7 | } 8 | }, 9 | "samplers": [ 10 | { "name": "Sampler0" }, 11 | { "name": "Sampler1" }, 12 | { "name": "Sampler2" } 13 | ], 14 | "UBOs": [ 15 | { "type": "vertex", "binding": 0, "fields": [ 16 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, 17 | { "name": "Light0_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] }, 18 | { "name": "Light1_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] } 19 | ] }, 20 | { "type": "fragment", "binding": 1, "fields": [ 21 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, 22 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }, 23 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, 24 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] } 25 | ] } 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_entity_translucent_cull/rendertype_entity_translucent_cull.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | #include "fog.glsl" 3 | 4 | layout(binding = 2) uniform sampler2D Sampler0; 5 | 6 | layout(binding = 1) uniform UBO{ 7 | vec4 ColorModulator; 8 | vec4 FogColor; 9 | float FogStart; 10 | float FogEnd; 11 | }; 12 | 13 | layout(location = 0) in vec4 vertexColor; 14 | layout(location = 1) in vec2 texCoord0; 15 | layout(location = 2) in float vertexDistance; 16 | 17 | layout(location = 0) out vec4 fragColor; 18 | 19 | void main() { 20 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; 21 | if (color.a < 0.1) { 22 | discard; 23 | } 24 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_entity_translucent_cull/rendertype_entity_translucent_cull.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "light.glsl" 4 | #include "fog.glsl" 5 | 6 | layout(location = 0) in vec3 Position; 7 | layout(location = 1) in vec4 Color; 8 | layout(location = 2) in vec2 UV0; 9 | layout(location = 3) in ivec2 UV1; 10 | layout(location = 4) in ivec2 UV2; 11 | layout(location = 5) in vec3 Normal; 12 | 13 | layout(binding = 0) uniform UniformBufferObject { 14 | mat4 MVP; 15 | vec3 Light0_Direction; 16 | vec3 Light1_Direction; 17 | }; 18 | 19 | layout(binding = 3) uniform sampler2D Sampler2; 20 | 21 | layout(location = 0) out vec4 vertexColor; 22 | layout(location = 1) out vec2 texCoord0; 23 | layout(location = 2) out float vertexDistance; 24 | 25 | void main() { 26 | gl_Position = MVP * vec4(Position, 1.0); 27 | 28 | vertexDistance = fog_distance(Position.xyz, 0); 29 | vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color) * texelFetch(Sampler2, UV2 / 16, 0); 30 | texCoord0 = UV0; 31 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_entity_translucent_emissive/rendertype_entity_translucent_emissive.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | #include "fog.glsl" 3 | 4 | layout(binding = 2) uniform sampler2D Sampler0; 5 | 6 | layout(binding = 1) uniform UBO{ 7 | vec4 ColorModulator; 8 | float FogStart; 9 | float FogEnd; 10 | }; 11 | 12 | layout(location = 0) in vec4 vertexColor; 13 | layout(location = 1) in vec4 overlayColor; 14 | layout(location = 2) in vec2 texCoord0; 15 | layout(location = 3) in float vertexDistance; 16 | 17 | layout(location = 0) out vec4 fragColor; 18 | 19 | void main() { 20 | vec4 color = texture(Sampler0, texCoord0); 21 | if (color.a < 0.1) { 22 | discard; 23 | } 24 | color *= vertexColor * ColorModulator; 25 | color.rgb = mix(overlayColor.rgb, color.rgb, overlayColor.a); 26 | fragColor = color * linear_fog_fade(vertexDistance, FogStart, FogEnd); 27 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_entity_translucent_emissive/rendertype_entity_translucent_emissive.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "light.glsl" 4 | #include "fog.glsl" 5 | 6 | layout(location = 0) in vec3 Position; 7 | layout(location = 1) in vec4 Color; 8 | layout(location = 2) in vec2 UV0; 9 | layout(location = 3) in ivec2 UV1; 10 | layout(location = 5) in vec3 Normal; 11 | 12 | layout(binding = 0) uniform UniformBufferObject { 13 | mat4 MVP; 14 | vec3 Light0_Direction; 15 | vec3 Light1_Direction; 16 | }; 17 | 18 | layout(binding = 3) uniform sampler2D Sampler1; 19 | layout(binding = 4) uniform sampler2D Sampler2; 20 | 21 | layout(location = 0) out vec4 vertexColor; 22 | layout(location = 1) out vec4 overlayColor; 23 | layout(location = 2) out vec2 texCoord0; 24 | layout(location = 3) out float vertexDistance; 25 | 26 | void main() { 27 | gl_Position = MVP * vec4(Position, 1.0); 28 | 29 | vertexDistance = fog_distance(Position.xyz, 0); 30 | vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color); 31 | overlayColor = texelFetch(Sampler1, UV1, 0); 32 | texCoord0 = UV0; 33 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_eyes/rendertype_eyes.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | #include "fog.glsl" 3 | 4 | layout(binding = 2) uniform sampler2D Sampler0; 5 | 6 | layout(binding = 1) uniform UBO{ 7 | vec4 ColorModulator; 8 | float FogStart; 9 | float FogEnd; 10 | }; 11 | 12 | layout(location = 0) in vec4 vertexColor; 13 | layout(location = 1) in vec2 texCoord0; 14 | layout(location = 2) in float vertexDistance; 15 | 16 | layout(location = 0) out vec4 fragColor; 17 | 18 | void main() { 19 | vec4 color = texture(Sampler0, texCoord0) * vertexColor; 20 | fragColor = color * ColorModulator * linear_fog_fade(vertexDistance, FogStart, FogEnd); 21 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_eyes/rendertype_eyes.json: -------------------------------------------------------------------------------- 1 | { 2 | "blend": { 3 | "func": "add", 4 | "srcrgb": "srcalpha", 5 | "dstrgb": "1-srcalpha" 6 | }, 7 | "vertex": "rendertype_eyes", 8 | "fragment": "rendertype_eyes", 9 | "attributes": [ 10 | "Position", 11 | "Color", 12 | "UV0" 13 | ], 14 | "samplers": [ 15 | { "name": "Sampler0" } 16 | ], 17 | "uniforms": [ 18 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, 19 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, 20 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] } 21 | ], 22 | "UBOs": [ 23 | { "type": "vertex", "binding": 0, "fields": [ 24 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 25 | ] }, 26 | { "type": "fragment", "binding": 1, "fields": [ 27 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, 28 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, 29 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] } 30 | ] } 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_eyes/rendertype_eyes.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "fog.glsl" 4 | 5 | layout(location = 0) in vec3 Position; 6 | layout(location = 1) in vec4 Color; 7 | layout(location = 2) in vec2 UV0; 8 | 9 | layout(binding = 0) uniform UniformBufferObject { 10 | mat4 MVP; 11 | }; 12 | 13 | layout(location = 0) out vec4 vertexColor; 14 | layout(location = 1) out vec2 texCoord0; 15 | layout(location = 2) out float vertexDistance; 16 | 17 | void main() { 18 | gl_Position = MVP * vec4(Position, 1.0); 19 | 20 | vertexDistance = fog_distance(Position.xyz, 0); 21 | vertexColor = Color; 22 | texCoord0 = UV0; 23 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_glint/rendertype_glint.json: -------------------------------------------------------------------------------- 1 | { 2 | "vertex": "glint", 3 | "fragment": "glint", 4 | "samplers": [ 5 | { "name": "Sampler0" } 6 | ], 7 | "UBOs": [ 8 | { "type": "vertex", "binding": 0, "fields": [ 9 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, 10 | { "name": "TextureMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 11 | ] }, 12 | { "type": "fragment", "binding": 1, "fields": [ 13 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, 14 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, 15 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] }, 16 | { "name": "GlintAlpha", "type": "float", "count": 1, "values": [ 1.0 ] } 17 | ] } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_glint_direct/rendertype_glint_direct.json: -------------------------------------------------------------------------------- 1 | { 2 | "vertex": "glint", 3 | "fragment": "glint", 4 | "samplers": [ 5 | { "name": "Sampler0" } 6 | ], 7 | "UBOs": [ 8 | { "type": "vertex", "binding": 0, "fields": [ 9 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, 10 | { "name": "TextureMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 11 | ] }, 12 | { "type": "fragment", "binding": 1, "fields": [ 13 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, 14 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, 15 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] }, 16 | { "name": "GlintAlpha", "type": "float", "count": 1, "values": [ 1.0 ] } 17 | ] } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_glint_translucent/rendertype_glint_translucent.json: -------------------------------------------------------------------------------- 1 | { 2 | "vertex": "glint", 3 | "fragment": "glint", 4 | "samplers": [ 5 | { "name": "Sampler0" } 6 | ], 7 | "UBOs": [ 8 | { "type": "vertex", "binding": 0, "fields": [ 9 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, 10 | { "name": "TextureMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 11 | ] }, 12 | { "type": "fragment", "binding": 1, "fields": [ 13 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, 14 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, 15 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] }, 16 | { "name": "GlintAlpha", "type": "float", "count": 1, "values": [ 1.0 ] } 17 | ] } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_gui/rendertype_gui.json: -------------------------------------------------------------------------------- 1 | { 2 | "vertex": "minecraft:core/gui", 3 | "fragment": "minecraft:core/gui", 4 | "samplers": [ 5 | ], 6 | "uniforms": [ 7 | { "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, 8 | { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, 9 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 10 | ], 11 | "UBOs": [ 12 | { "type": "vertex", "binding": 0, "fields": [ 13 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 14 | ] }, 15 | { "type": "fragment", "binding": 1, "fields": [ 16 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 17 | ] } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_gui_ghost_recipe_overlay.json: -------------------------------------------------------------------------------- 1 | { 2 | "vertex": "minecraft:core/gui", 3 | "fragment": "minecraft:core/gui", 4 | "samplers": [ 5 | ], 6 | "uniforms": [ 7 | { "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, 8 | { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, 9 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 10 | ], 11 | "UBOs": [ 12 | { "type": "vertex", "binding": 0, "fields": [ 13 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 14 | ] }, 15 | { "type": "fragment", "binding": 1, "fields": [ 16 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 17 | ] } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_gui_overlay/rendertype_gui_overlay.json: -------------------------------------------------------------------------------- 1 | { 2 | "vertex": "minecraft:core/gui", 3 | "fragment": "minecraft:core/gui", 4 | "samplers": [ 5 | ], 6 | "uniforms": [ 7 | { "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, 8 | { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, 9 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 10 | ], 11 | "UBOs": [ 12 | { "type": "vertex", "binding": 0, "fields": [ 13 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 14 | ] }, 15 | { "type": "fragment", "binding": 1, "fields": [ 16 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 17 | ] } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_gui_text_highlight.json: -------------------------------------------------------------------------------- 1 | { 2 | "vertex": "minecraft:core/gui", 3 | "fragment": "minecraft:core/gui", 4 | "samplers": [ 5 | ], 6 | "uniforms": [ 7 | { "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, 8 | { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, 9 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 10 | ], 11 | "UBOs": [ 12 | { "type": "vertex", "binding": 0, "fields": [ 13 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 14 | ] }, 15 | { "type": "fragment", "binding": 1, "fields": [ 16 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 17 | ] } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_item_entity_translucent_cull/rendertype_item_entity_translucent_cull.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | #include "fog.glsl" 3 | 4 | layout(binding = 2) uniform sampler2D Sampler0; 5 | 6 | layout(binding = 1) uniform UBO{ 7 | vec4 ColorModulator; 8 | vec4 FogColor; 9 | float FogStart; 10 | float FogEnd; 11 | }; 12 | 13 | layout(location = 0) in vec4 vertexColor; 14 | layout(location = 1) in vec2 texCoord0; 15 | layout(location = 2) in float vertexDistance; 16 | 17 | layout(location = 0) out vec4 fragColor; 18 | 19 | void main() { 20 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; 21 | if (color.a < 0.1) { 22 | discard; 23 | } 24 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_item_entity_translucent_cull/rendertype_item_entity_translucent_cull.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "light.glsl" 4 | #include "fog.glsl" 5 | 6 | layout(location = 0) in vec3 Position; 7 | layout(location = 1) in vec4 Color; 8 | layout(location = 2) in vec2 UV0; 9 | layout(location = 4) in ivec2 UV2; 10 | layout(location = 5) in vec3 Normal; 11 | 12 | layout(binding = 0) uniform UniformBufferObject { 13 | mat4 MVP; 14 | vec3 Light0_Direction; 15 | vec3 Light1_Direction; 16 | }; 17 | 18 | layout(binding = 3) uniform sampler2D Sampler2; 19 | 20 | layout(location = 0) out vec4 vertexColor; 21 | layout(location = 1) out vec2 texCoord0; 22 | layout(location = 2) out float vertexDistance; 23 | 24 | void main() { 25 | gl_Position = MVP * vec4(Position, 1.0); 26 | 27 | vertexDistance = fog_distance(Position.xyz, 0); 28 | vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color) * texelFetch(Sampler2, UV2 / 16, 0); 29 | texCoord0 = UV0; 30 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_leash/rendertype_leash.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | #include "fog.glsl" 3 | 4 | layout(binding = 1) uniform UBO{ 5 | vec4 FogColor; 6 | float FogStart; 7 | float FogEnd; 8 | }; 9 | 10 | layout(location = 0) flat in vec4 vertexColor; 11 | layout(location = 1) in float vertexDistance; 12 | 13 | layout(location = 0) out vec4 fragColor; 14 | 15 | void main() { 16 | fragColor = linear_fog(vertexColor, vertexDistance, FogStart, FogEnd, FogColor); 17 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_leash/rendertype_leash.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "fog.glsl" 4 | 5 | layout(location = 0) in vec3 Position; 6 | layout(location = 1) in vec4 Color; 7 | layout(location = 2) in ivec2 UV2; 8 | 9 | layout(binding = 0) uniform UniformBufferObject { 10 | mat4 MVP; 11 | vec4 ColorModulator; 12 | }; 13 | 14 | layout(binding = 2) uniform sampler2D Sampler2; 15 | 16 | layout(location = 0) flat out vec4 vertexColor; 17 | layout(location = 1) out float vertexDistance; 18 | 19 | void main() { 20 | gl_Position = MVP * vec4(Position, 1.0); 21 | 22 | vertexDistance = fog_distance(Position.xyz, 0); 23 | vertexColor = Color * ColorModulator * texelFetch(Sampler2, UV2 / 16, 0); 24 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_lightning/rendertype_lightning.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | #include "fog.glsl" 3 | 4 | layout(binding = 1) uniform UBO{ 5 | vec4 ColorModulator; 6 | float FogStart; 7 | float FogEnd; 8 | }; 9 | 10 | layout(location = 0) in vec4 vertexColor; 11 | layout(location = 1) in float vertexDistance; 12 | 13 | layout(location = 0) out vec4 fragColor; 14 | 15 | void main() { 16 | fragColor = vertexColor * ColorModulator * linear_fog_fade(vertexDistance, FogStart, FogEnd); 17 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_lightning/rendertype_lightning.json: -------------------------------------------------------------------------------- 1 | { 2 | "blend": { 3 | "func": "add", 4 | "srcrgb": "srcalpha", 5 | "dstrgb": "1-srcalpha" 6 | }, 7 | "vertex": "rendertype_lightning", 8 | "fragment": "rendertype_lightning", 9 | "attributes": [ 10 | "Color" 11 | ], 12 | "samplers": [], 13 | "uniforms": [ 14 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, 15 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, 16 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] } 17 | ], 18 | "UBOs": [ 19 | { "type": "vertex", "binding": 0, "fields": [ 20 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 21 | ] }, 22 | { "type": "fragment", "binding": 1, "fields": [ 23 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, 24 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, 25 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] } 26 | ] } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_lightning/rendertype_lightning.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "fog.glsl" 4 | 5 | layout(location = 0) in vec3 Position; 6 | layout(location = 1) in vec4 Color; 7 | 8 | layout(binding = 0) uniform UniformBufferObject { 9 | mat4 MVP; 10 | }; 11 | 12 | layout(location = 0) out vec4 vertexColor; 13 | layout(location = 1) out float vertexDistance; 14 | 15 | void main() { 16 | gl_Position = MVP * vec4(Position, 1.0); 17 | 18 | vertexDistance = fog_distance(Position.xyz, 0); 19 | vertexColor = Color; 20 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_lines/rendertype_lines.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | #include "fog.glsl" 3 | 4 | layout(binding = 1) uniform UBO{ 5 | vec4 ColorModulator; 6 | vec4 FogColor; 7 | float FogStart; 8 | float FogEnd; 9 | }; 10 | 11 | layout(location = 0) in vec4 vertexColor; 12 | layout(location = 1) in float vertexDistance; 13 | 14 | layout(location = 0) out vec4 fragColor; 15 | 16 | void main() { 17 | vec4 color = vertexColor * ColorModulator; 18 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); 19 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_outline/rendertype_outline.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(binding = 2) uniform sampler2D Sampler0; 4 | 5 | layout(binding = 1) uniform UBO{ 6 | vec4 ColorModulator; 7 | }; 8 | 9 | layout(location = 0) in vec4 vertexColor; 10 | layout(location = 1) in vec2 texCoord0; 11 | 12 | layout(location = 0) out vec4 fragColor; 13 | 14 | void main() { 15 | vec4 color = texture(Sampler0, texCoord0); 16 | if (color.a == 0.0) { 17 | discard; 18 | } 19 | fragColor = vec4(ColorModulator.rgb * vertexColor.rgb, ColorModulator.a); 20 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_outline/rendertype_outline.json: -------------------------------------------------------------------------------- 1 | { 2 | "blend": { 3 | "func": "add", 4 | "srcrgb": "srcalpha", 5 | "dstrgb": "1-srcalpha" 6 | }, 7 | "vertex": "rendertype_outline", 8 | "fragment": "rendertype_outline", 9 | "attributes": [ 10 | "Position", 11 | "Color", 12 | "UV0" 13 | ], 14 | "samplers": [ 15 | { "name": "Sampler0" } 16 | ], 17 | "uniforms": [ 18 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 19 | ], 20 | "UBOs": [ 21 | { "type": "vertex", "binding": 0, "fields": [ 22 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 23 | ] }, 24 | { "type": "fragment", "binding": 1, "fields": [ 25 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 26 | ] } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_outline/rendertype_outline.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(location = 0) in vec3 Position; 4 | layout(location = 1) in vec2 UV0; 5 | layout(location = 2) in vec4 Color; 6 | 7 | layout(binding = 0) uniform UniformBufferObject { 8 | mat4 MVP; 9 | }; 10 | 11 | layout(location = 0) out vec4 vertexColor; 12 | layout(location = 1) out vec2 texCoord0; 13 | 14 | void main() { 15 | gl_Position = MVP * vec4(Position, 1.0); 16 | 17 | vertexColor = Color; 18 | texCoord0 = UV0; 19 | } 20 | 21 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_solid/rendertype_solid.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | #include "fog.glsl" 3 | 4 | layout(binding = 2) uniform sampler2D Sampler0; 5 | 6 | layout(binding = 1) uniform UBO{ 7 | vec4 ColorModulator; 8 | vec4 FogColor; 9 | float FogStart; 10 | float FogEnd; 11 | }; 12 | 13 | layout(location = 0) in float vertexDistance; 14 | layout(location = 1) in vec4 vertexColor; 15 | layout(location = 2) in vec2 texCoord0; 16 | 17 | layout(location = 0) out vec4 fragColor; 18 | 19 | void main() { 20 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; 21 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); 22 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_solid/rendertype_solid.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "light.glsl" 4 | #include "fog.glsl" 5 | 6 | layout(location = 0) in vec3 Position; 7 | layout(location = 1) in vec4 Color; 8 | layout(location = 2) in vec2 UV0; 9 | layout(location = 3) in ivec2 UV2; 10 | layout(location = 4) in vec3 Normal; 11 | 12 | layout(binding = 0) uniform UniformBufferObject { 13 | mat4 MVP; 14 | vec3 ChunkOffset; 15 | }; 16 | 17 | layout(binding = 3) uniform sampler2D Sampler2; 18 | 19 | layout(location = 0) out float vertexDistance; 20 | layout(location = 1) out vec4 vertexColor; 21 | layout(location = 2) out vec2 texCoord0; 22 | 23 | void main() { 24 | vec3 pos = Position + ChunkOffset; 25 | gl_Position = MVP * vec4(pos, 1.0); 26 | 27 | vertexDistance = fog_distance(pos, 0); 28 | vertexColor = Color * minecraft_sample_lightmap(Sampler2, UV2); 29 | texCoord0 = UV0; 30 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_text/rendertype_text.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | #include "fog.glsl" 3 | 4 | layout(binding = 2) uniform sampler2D Sampler0; 5 | 6 | layout(binding = 1) uniform UBO{ 7 | vec4 ColorModulator; 8 | vec4 FogColor; 9 | float FogStart; 10 | float FogEnd; 11 | }; 12 | 13 | layout(location = 0) in vec4 vertexColor; 14 | layout(location = 1) in vec2 texCoord0; 15 | layout(location = 2) in float vertexDistance; 16 | 17 | layout(location = 0) out vec4 fragColor; 18 | 19 | void main() { 20 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; 21 | if (color.a < 0.1) { 22 | discard; 23 | } 24 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_text/rendertype_text.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "fog.glsl" 4 | 5 | layout(location = 0) in vec3 Position; 6 | layout(location = 1) in vec4 Color; 7 | layout(location = 2) in vec2 UV0; 8 | layout(location = 3) in ivec2 UV2; 9 | 10 | layout(binding = 0) uniform UniformBufferObject { 11 | mat4 MVP; 12 | }; 13 | 14 | layout(binding = 3) uniform sampler2D Sampler2; 15 | 16 | layout(location = 0) out vec4 vertexColor; 17 | layout(location = 1) out vec2 texCoord0; 18 | layout(location = 2) out float vertexDistance; 19 | 20 | void main() { 21 | gl_Position = MVP * vec4(Position, 1.0); 22 | 23 | vertexDistance = fog_distance(Position.xyz, 0); 24 | vertexColor = Color * texelFetch(Sampler2, UV2 / 16, 0); 25 | texCoord0 = UV0; 26 | } 27 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_text_background/rendertype_text_background.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | #include "fog.glsl" 3 | 4 | layout(binding = 1) uniform UBO{ 5 | vec4 ColorModulator; 6 | vec4 FogColor; 7 | float FogStart; 8 | float FogEnd; 9 | }; 10 | 11 | layout(location = 0) in vec4 vertexColor; 12 | layout(location = 2) in float vertexDistance; 13 | 14 | layout(location = 0) out vec4 fragColor; 15 | 16 | void main() { 17 | vec4 color = vertexColor * ColorModulator; 18 | if (color.a < 0.1) { 19 | discard; 20 | } 21 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); 22 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_text_background/rendertype_text_background.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "fog.glsl" 4 | 5 | layout(location = 0) in vec3 Position; 6 | layout(location = 1) in vec4 Color; 7 | layout(location = 2) in ivec2 UV2; 8 | 9 | layout(binding = 0) uniform UniformBufferObject { 10 | mat4 MVP; 11 | }; 12 | 13 | layout(binding = 2) uniform sampler2D Sampler2; 14 | 15 | layout(location = 0) out vec4 vertexColor; 16 | layout(location = 2) out float vertexDistance; 17 | 18 | void main() { 19 | gl_Position = MVP * vec4(Position, 1.0); 20 | 21 | vertexDistance = fog_distance(Position.xyz, 0); 22 | vertexColor = Color * texelFetch(Sampler2, UV2 / 16, 0); 23 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_text_background_see_through/rendertype_text_background_see_through.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(location = 0) in vec4 vertexColor; 4 | 5 | layout(binding = 1) uniform UBO{ 6 | vec4 ColorModulator; 7 | }; 8 | 9 | layout(location = 0) out vec4 fragColor; 10 | 11 | void main() { 12 | vec4 color = vertexColor; 13 | if (color.a < 0.1) { 14 | discard; 15 | } 16 | fragColor = color * ColorModulator; 17 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_text_background_see_through/rendertype_text_background_see_through.json: -------------------------------------------------------------------------------- 1 | { 2 | "blend": { 3 | "func": "add", 4 | "srcrgb": "srcalpha", 5 | "dstrgb": "1-srcalpha" 6 | }, 7 | "vertex": "rendertype_text_background_see_through", 8 | "fragment": "rendertype_text_background_see_through", 9 | "attributes": [ 10 | "Position", 11 | "Color" 12 | ], 13 | "samplers": [], 14 | "uniforms": [ 15 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 16 | ], 17 | "UBOs": [ 18 | { "type": "vertex", "binding": 0, "fields": [ 19 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 20 | ] }, 21 | { "type": "fragment", "binding": 1, "fields": [ 22 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 23 | ] } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_text_background_see_through/rendertype_text_background_see_through.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(location = 0) in vec3 Position; 4 | layout(location = 1) in vec4 Color; 5 | 6 | layout(binding = 0) uniform UniformBufferObject { 7 | mat4 MVP; 8 | }; 9 | 10 | layout(location = 0) out vec4 vertexColor; 11 | 12 | void main() { 13 | gl_Position = MVP * vec4(Position, 1.0); 14 | 15 | vertexColor = Color; 16 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_text_intensity/rendertype_text_intensity.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | #include "fog.glsl" 3 | 4 | layout(binding = 2) uniform sampler2D Sampler0; 5 | 6 | layout(binding = 1) uniform UBO{ 7 | vec4 ColorModulator; 8 | vec4 FogColor; 9 | float FogStart; 10 | float FogEnd; 11 | }; 12 | 13 | layout(location = 0) in vec4 vertexColor; 14 | layout(location = 1) in vec2 texCoord0; 15 | layout(location = 2) in float vertexDistance; 16 | 17 | layout(location = 0) out vec4 fragColor; 18 | 19 | void main() { 20 | vec4 color = texture(Sampler0, texCoord0).rrrr * vertexColor * ColorModulator; 21 | if (color.a < 0.1) { 22 | discard; 23 | } 24 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); 25 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_text_intensity/rendertype_text_intensity.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "fog.glsl" 4 | 5 | layout(location = 0) in vec3 Position; 6 | layout(location = 1) in vec4 Color; 7 | layout(location = 2) in vec2 UV0; 8 | layout(location = 3) in ivec2 UV2; 9 | 10 | layout(binding = 0) uniform UniformBufferObject { 11 | mat4 MVP; 12 | }; 13 | 14 | layout(binding = 3) uniform sampler2D Sampler2; 15 | 16 | layout(location = 0) out vec4 vertexColor; 17 | layout(location = 1) out vec2 texCoord0; 18 | layout(location = 2) out float vertexDistance; 19 | 20 | void main() { 21 | gl_Position = MVP * vec4(Position, 1.0); 22 | 23 | vertexDistance = fog_distance(Position.xyz, 0); 24 | vertexColor = Color * texelFetch(Sampler2, UV2 / 16, 0); 25 | texCoord0 = UV0; 26 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_text_intensity_see_through/rendertype_text_intensity_see_through.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(binding = 2) uniform sampler2D Sampler0; 4 | 5 | layout(binding = 1) uniform UBO { 6 | vec4 ColorModulator; 7 | }; 8 | 9 | layout(location = 0) in vec4 vertexColor; 10 | layout(location = 1) in vec2 texCoord0; 11 | 12 | layout(location = 0) out vec4 fragColor; 13 | 14 | void main() { 15 | vec4 color = texture(Sampler0, texCoord0).rrrr * vertexColor; 16 | if (color.a < 0.1) { 17 | discard; 18 | } 19 | fragColor = color * ColorModulator; 20 | } 21 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_text_intensity_see_through/rendertype_text_intensity_see_through.json: -------------------------------------------------------------------------------- 1 | { 2 | "blend": { 3 | "func": "add", 4 | "srcrgb": "srcalpha", 5 | "dstrgb": "1-srcalpha" 6 | }, 7 | "vertex": "rendertype_text_intensity_see_through", 8 | "fragment": "rendertype_text_intensity_see_through", 9 | "attributes": [ 10 | "Position", 11 | "Color", 12 | "UV0" 13 | ], 14 | "samplers": [ 15 | { "name": "Sampler0" } 16 | ], 17 | "uniforms": [ 18 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 19 | ], 20 | "UBOs": [ 21 | { "type": "vertex", "binding": 0, "fields": [ 22 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 23 | ] }, 24 | { "type": "fragment", "binding": 1, "fields": [ 25 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 26 | ] } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_text_intensity_see_through/rendertype_text_intensity_see_through.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(location = 0) in vec3 Position; 4 | layout(location = 1) in vec4 Color; 5 | layout(location = 2) in vec2 UV0; 6 | 7 | layout(binding = 0) uniform UniformBufferObject { 8 | mat4 MVP; 9 | }; 10 | 11 | layout(location = 0) out vec4 vertexColor; 12 | layout(location = 1) out vec2 texCoord0; 13 | 14 | void main() { 15 | gl_Position = MVP * vec4(Position, 1.0); 16 | 17 | vertexColor = Color; 18 | texCoord0 = UV0; 19 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_text_see_through/rendertype_text_see_through.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(binding = 2) uniform sampler2D Sampler0; 4 | 5 | layout(binding = 1) uniform UBO{ 6 | vec4 ColorModulator; 7 | }; 8 | 9 | layout(location = 0) in vec4 vertexColor; 10 | layout(location = 1) in vec2 texCoord0; 11 | 12 | layout(location = 0) out vec4 fragColor; 13 | 14 | void main() { 15 | vec4 color = texture(Sampler0, texCoord0) * vertexColor; 16 | if (color.a < 0.1) { 17 | discard; 18 | } 19 | fragColor = color * ColorModulator; 20 | } 21 | 22 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_text_see_through/rendertype_text_see_through.json: -------------------------------------------------------------------------------- 1 | { 2 | "blend": { 3 | "func": "add", 4 | "srcrgb": "srcalpha", 5 | "dstrgb": "1-srcalpha" 6 | }, 7 | "vertex": "rendertype_text_see_through", 8 | "fragment": "rendertype_text_see_through", 9 | "attributes": [ 10 | "Position", 11 | "Color", 12 | "UV0" 13 | ], 14 | "samplers": [ 15 | { "name": "Sampler0" } 16 | ], 17 | "uniforms": [ 18 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 19 | ], 20 | "UBOs": [ 21 | { "type": "vertex", "binding": 0, "fields": [ 22 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 23 | ] }, 24 | { "type": "fragment", "binding": 1, "fields": [ 25 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 26 | ] } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_text_see_through/rendertype_text_see_through.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(location = 0) in vec3 Position; 4 | layout(location = 1) in vec4 Color; 5 | layout(location = 2) in vec2 UV0; 6 | 7 | layout(binding = 0) uniform UniformBufferObject { 8 | mat4 MVP; 9 | }; 10 | 11 | layout(location = 0) out vec4 vertexColor; 12 | layout(location = 1) out vec2 texCoord0; 13 | 14 | void main() { 15 | gl_Position = MVP * vec4(Position, 1.0); 16 | 17 | vertexColor = Color; 18 | texCoord0 = UV0; 19 | } 20 | 21 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_translucent/rendertype_translucent.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | #include "fog.glsl" 3 | 4 | layout(binding = 2) uniform sampler2D Sampler0; 5 | 6 | layout(binding = 1) uniform UBO{ 7 | vec4 ColorModulator; 8 | vec4 FogColor; 9 | float FogStart; 10 | float FogEnd; 11 | }; 12 | 13 | layout(location = 0) in vec4 vertexColor; 14 | layout(location = 1) in vec2 texCoord0; 15 | layout(location = 2) in float vertexDistance; 16 | 17 | layout(location = 0) out vec4 fragColor; 18 | 19 | void main() { 20 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; 21 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); 22 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_translucent/rendertype_translucent.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "light.glsl" 4 | #include "fog.glsl" 5 | 6 | layout(location = 0) in vec3 Position; 7 | layout(location = 1) in vec4 Color; 8 | layout(location = 2) in vec2 UV0; 9 | layout(location = 3) in ivec2 UV2; 10 | layout(location = 4) in vec3 Normal; 11 | 12 | layout(binding = 0) uniform UniformBufferObject { 13 | mat4 MVP; 14 | vec3 ChunkOffset; 15 | }; 16 | 17 | layout(binding = 3) uniform sampler2D Sampler2; 18 | 19 | layout(location = 0) out vec4 vertexColor; 20 | layout(location = 1) out vec2 texCoord0; 21 | layout(location = 2) out float vertexDistance; 22 | 23 | void main() { 24 | vec3 pos = Position + ChunkOffset; 25 | gl_Position = MVP * vec4(pos, 1.0); 26 | 27 | vertexDistance = fog_distance(pos, 0); 28 | vertexColor = Color * minecraft_sample_lightmap(Sampler2, UV2); 29 | texCoord0 = UV0; 30 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_translucent_moving_block/rendertype_translucent_moving_block.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(binding = 2) uniform sampler2D Sampler0; 4 | 5 | layout(binding = 1) uniform UBO{ 6 | vec4 ColorModulator; 7 | }; 8 | 9 | layout(location = 0) in vec4 vertexColor; 10 | layout(location = 1) in vec2 texCoord0; 11 | 12 | layout(location = 0) out vec4 fragColor; 13 | 14 | void main() { 15 | vec4 color = texture(Sampler0, texCoord0) * vertexColor; 16 | fragColor = color * ColorModulator; 17 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_translucent_moving_block/rendertype_translucent_moving_block.json: -------------------------------------------------------------------------------- 1 | { 2 | "blend": { 3 | "func": "add", 4 | "srcrgb": "srcalpha", 5 | "dstrgb": "1-srcalpha" 6 | }, 7 | "vertex": "rendertype_translucent_moving_block", 8 | "fragment": "rendertype_translucent_moving_block", 9 | "attributes": [ 10 | "Position", 11 | "Color", 12 | "UV0", 13 | "UV2", 14 | "Normal" 15 | ], 16 | "samplers": [ 17 | { "name": "Sampler0" }, 18 | { "name": "Sampler2" } 19 | ], 20 | "uniforms": [ 21 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 22 | ], 23 | "UBOs": [ 24 | { "type": "vertex", "binding": 0, "fields": [ 25 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 26 | ] }, 27 | { "type": "fragment", "binding": 1, "fields": [ 28 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 29 | ] } 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_translucent_moving_block/rendertype_translucent_moving_block.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(location = 0) in vec3 Position; 4 | layout(location = 1) in vec4 Color; 5 | layout(location = 2) in vec2 UV0; 6 | layout(location = 3) in ivec2 UV2; 7 | layout(location = 4) in vec3 Normal; 8 | 9 | layout(binding = 0) uniform UniformBufferObject { 10 | mat4 MVP; 11 | }; 12 | 13 | layout(binding = 3) uniform sampler2D Sampler2; 14 | 15 | layout(location = 0) out vec4 vertexColor; 16 | layout(location = 1) out vec2 texCoord0; 17 | 18 | void main() { 19 | gl_Position = MVP * vec4(Position, 1.0); 20 | 21 | vertexColor = Color * texelFetch(Sampler2, UV2 / 16, 0); 22 | texCoord0 = UV0; 23 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_translucent_no_crumbling/rendertype_translucent_no_crumbling.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(binding = 2) uniform sampler2D Sampler0; 4 | 5 | layout(binding = 1) uniform UBO{ 6 | vec4 ColorModulator; 7 | }; 8 | 9 | layout(location = 0) in vec4 vertexColor; 10 | layout(location = 1) in vec2 texCoord0; 11 | 12 | layout(location = 0) out vec4 fragColor; 13 | 14 | void main() { 15 | vec4 color = texture(Sampler0, texCoord0) * vertexColor; 16 | fragColor = color * ColorModulator; 17 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_translucent_no_crumbling/rendertype_translucent_no_crumbling.json: -------------------------------------------------------------------------------- 1 | { 2 | "blend": { 3 | "func": "add", 4 | "srcrgb": "srcalpha", 5 | "dstrgb": "1-srcalpha" 6 | }, 7 | "vertex": "rendertype_translucent_no_crumbling", 8 | "fragment": "rendertype_translucent_no_crumbling", 9 | "attributes": [ 10 | "Position", 11 | "Color", 12 | "UV0", 13 | "Normal" 14 | ], 15 | "samplers": [ 16 | { "name": "Sampler0" } 17 | ], 18 | "uniforms": [ 19 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 20 | ], 21 | "UBOs": [ 22 | { "type": "vertex", "binding": 0, "fields": [ 23 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 24 | ] }, 25 | { "type": "fragment", "binding": 1, "fields": [ 26 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 27 | ] } 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_translucent_no_crumbling/rendertype_translucent_no_crumbling.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(location = 0) in vec3 Position; 4 | layout(location = 1) in vec4 Color; 5 | layout(location = 2) in vec2 UV0; 6 | layout(location = 4) in vec3 Normal; 7 | 8 | layout(binding = 0) uniform UniformBufferObject { 9 | mat4 MVP; 10 | }; 11 | 12 | layout(binding = 3) uniform sampler2D Sampler2; 13 | 14 | layout(location = 0) out vec4 vertexColor; 15 | layout(location = 1) out vec2 texCoord0; 16 | 17 | void main() { 18 | gl_Position = MVP * vec4(Position, 1.0); 19 | 20 | vertexColor = Color; 21 | texCoord0 = UV0; 22 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_tripwire/rendertype_tripwire.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | #include "fog.glsl" 3 | 4 | layout(binding = 2) uniform sampler2D Sampler0; 5 | 6 | layout(binding = 1) uniform UBO{ 7 | vec4 ColorModulator; 8 | vec4 FogColor; 9 | float FogStart; 10 | float FogEnd; 11 | }; 12 | 13 | layout(location = 0) in vec4 vertexColor; 14 | layout(location = 1) in vec2 texCoord0; 15 | layout(location = 2) in float vertexDistance; 16 | 17 | layout(location = 0) out vec4 fragColor; 18 | 19 | void main() { 20 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; 21 | if (color.a < 0.1) { 22 | discard; 23 | } 24 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); 25 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_tripwire/rendertype_tripwire.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #include "light.glsl" 4 | #include "fog.glsl" 5 | 6 | layout(location = 0) in vec3 Position; 7 | layout(location = 1) in vec4 Color; 8 | layout(location = 2) in vec2 UV0; 9 | layout(location = 3) in ivec2 UV2; 10 | layout(location = 4) in vec3 Normal; 11 | 12 | layout(binding = 0) uniform UniformBufferObject { 13 | mat4 MVP; 14 | vec3 ChunkOffset; 15 | }; 16 | 17 | layout(binding = 3) uniform sampler2D Sampler2; 18 | 19 | layout(location = 0) out vec4 vertexColor; 20 | layout(location = 1) out vec2 texCoord0; 21 | layout(location = 2) out float vertexDistance; 22 | 23 | void main() { 24 | vec3 pos = Position + ChunkOffset; 25 | gl_Position = MVP * vec4(pos, 1.0); 26 | 27 | vertexDistance = fog_distance(pos, 0); 28 | vertexColor = Color * minecraft_sample_lightmap(Sampler2, UV2); 29 | texCoord0 = UV0; 30 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_water_mask/rendertype_water_mask.fsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(binding = 1) uniform UniformBufferObject { 4 | vec4 ColorModulator; 5 | }; 6 | 7 | layout(location = 0) out vec4 fragColor; 8 | 9 | void main() { 10 | fragColor = ColorModulator; 11 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_water_mask/rendertype_water_mask.json: -------------------------------------------------------------------------------- 1 | { 2 | "blend": { 3 | "func": "add", 4 | "srcrgb": "srcalpha", 5 | "dstrgb": "1-srcalpha" 6 | }, 7 | "vertex": "rendertype_water_mask", 8 | "fragment": "rendertype_water_mask", 9 | "attributes": [], 10 | "samplers": [], 11 | "uniforms": [ 12 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 13 | ], 14 | "UBOs": [ 15 | { "type": "vertex", "binding": 0, "fields": [ 16 | { "name": "MVP", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] } 17 | ] }, 18 | { "type": "fragment", "binding": 1, "fields": [ 19 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } 20 | ] } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/core/rendertype_water_mask/rendertype_water_mask.vsh: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(location = 0) in vec3 Position; 4 | 5 | layout(binding = 0) uniform UniformBufferObject { 6 | mat4 MVP; 7 | }; 8 | 9 | void main() { 10 | gl_Position = MVP * vec4(Position, 1.0); 11 | } -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/include/fog.glsl: -------------------------------------------------------------------------------- 1 | vec4 linear_fog(vec4 inColor, float vertexDistance, float fogStart, float fogEnd, vec4 fogColor) { 2 | return (vertexDistance <= fogStart) ? inColor : mix(inColor, fogColor, smoothstep(fogStart, fogEnd, vertexDistance) * fogColor.a); 3 | } 4 | 5 | float linear_fog_fade(float vertexDistance, float fogStart, float fogEnd) { 6 | if (vertexDistance <= fogStart) { 7 | return 1.0; 8 | } else if (vertexDistance >= fogEnd) { 9 | return 0.0; 10 | } 11 | 12 | return smoothstep(fogEnd, fogStart, vertexDistance); 13 | } 14 | 15 | float fog_distance(vec3 pos, int shape) { 16 | if (shape == 0) { 17 | return length(pos); 18 | } else { 19 | float distXZ = length(pos.xz); 20 | float distY = abs(pos.y); 21 | return max(distXZ, distY); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/include/light.glsl: -------------------------------------------------------------------------------- 1 | //light.glsl 2 | //#pragma once 3 | const float MINECRAFT_LIGHT_POWER = (0.6); 4 | const float MINECRAFT_AMBIENT_LIGHT = (0.4); 5 | 6 | vec4 minecraft_mix_light(vec3 lightDir0, vec3 lightDir1, vec3 normal, vec4 color) { 7 | lightDir0 = normalize(lightDir0); 8 | lightDir1 = normalize(lightDir1); 9 | float light0 = max(0.0, dot(lightDir0, normal)); 10 | float light1 = max(0.0, dot(lightDir1, normal)); 11 | float lightAccum = min(1.0, fma((light0 + light1), MINECRAFT_LIGHT_POWER, MINECRAFT_AMBIENT_LIGHT)); 12 | return vec4(color.rgb * lightAccum, color.a); 13 | } 14 | 15 | vec4 minecraft_sample_lightmap(sampler2D lightMap, ivec2 uv) { 16 | return texelFetch(lightMap, bitfieldExtract(uv, 4, 8), 0); 17 | //return texture(lightMap, clamp(uv / 256.0, vec2(0.5 / 16.0), vec2(15.5 / 16.0))); 18 | } 19 | 20 | vec4 sample_lightmap(sampler2D lightMap, ivec2 uv) { 21 | return texelFetch(lightMap, bitfieldExtract(uv, 4, 8), 0); 22 | } 23 | 24 | vec4 sample_lightmap2(sampler2D lightMap, uint uv) { 25 | const ivec2 lm = ivec2(bitfieldExtract(uv, 4, 4), bitfieldExtract(uv, 12, 4)); 26 | // const ivec2 lm = ivec2(uv >> 12, (uv >> 4) & 0xF); 27 | return texelFetch(lightMap, lm, 0); 28 | } 29 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/include/matrix.glsl: -------------------------------------------------------------------------------- 1 | mat2 mat2_rotate_z(float radians) { 2 | return mat2( 3 | cos(radians), -sin(radians), 4 | sin(radians), cos(radians) 5 | ); 6 | } 7 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/shaders/include/projection.glsl: -------------------------------------------------------------------------------- 1 | vec4 projection_from_position(vec4 position) { 2 | vec4 projection = position * 0.5; 3 | projection.xy = vec2(projection.x + projection.w, projection.y + projection.w); 4 | projection.zw = position.zw; 5 | return projection; 6 | } 7 | -------------------------------------------------------------------------------- /src/main/resources/assets/vulkanmod/vlogo_transparent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xCollateral/VulkanMod/f23855f2675f1efb52fb8aa2c26bc23dccfb5543/src/main/resources/assets/vulkanmod/vlogo_transparent.png -------------------------------------------------------------------------------- /src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "vulkanmod", 4 | "version": "${version}", 5 | 6 | "name": "VulkanMod", 7 | "description": "Bring Vulkan to Minecraft!", 8 | "authors": [ 9 | "Collateral" 10 | ], 11 | "contact": { 12 | "homepage": "", 13 | "sources": "https://github.com/xCollateral/VulkanMod" 14 | }, 15 | 16 | "icon": "assets/vulkanmod/Vlogo.png", 17 | 18 | "environment": "client", 19 | "entrypoints": { 20 | "client": [ 21 | "net.vulkanmod.Initializer" 22 | ] 23 | }, 24 | "mixins": [ 25 | "vulkanmod.mixins.json" 26 | ], 27 | "accessWidener" : "vulkanmod.accesswidener", 28 | 29 | "depends": { 30 | "fabricloader": ">=0.14.14", 31 | "minecraft": ["1.21", "1.21.1"] 32 | }, 33 | "custom": { 34 | "fabric-renderer-api-v1:contains_renderer": true 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/resources/vulkanmod.accesswidener: -------------------------------------------------------------------------------- 1 | accessWidener v1 named 2 | 3 | accessible class net/minecraft/client/model/geom/ModelPart$Polygon 4 | accessible class net/minecraft/client/model/geom/ModelPart$Vertex 5 | accessible class net/minecraft/client/gui/Gui$HeartType 6 | 7 | accessible class net/minecraft/client/renderer/OutlineBufferSource$EntityOutlineGenerator 8 | 9 | accessible class net/minecraft/client/renderer/texture/SpriteContents$Ticker 10 | accessible class net/minecraft/client/renderer/texture/SpriteContents$FrameInfo 11 | accessible class net/minecraft/client/renderer/texture/SpriteContents$AnimatedTexture 12 | accessible field net/minecraft/client/renderer/texture/SpriteContents$AnimatedTexture frames Ljava/util/List; 13 | accessible field net/minecraft/client/renderer/texture/SpriteContents$FrameInfo time I 14 | 15 | #1.20 16 | accessible field com/mojang/blaze3d/systems/RenderSystem vertexSorting Lcom/mojang/blaze3d/vertex/VertexSorting; 17 | accessible field net/minecraft/client/renderer/RenderStateShard name Ljava/lang/String; 18 | --------------------------------------------------------------------------------