Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support more shader stages #263

Merged
merged 5 commits into from
Mar 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/compute/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import Vulkan.Core10 as Vk
import Vulkan.Extensions.VK_EXT_debug_utils
import Vulkan.Extensions.VK_EXT_validation_features
import Vulkan.Utils.Debug
import Vulkan.Utils.ShaderQQ
import Vulkan.Utils.ShaderQQ.GLSL.Glslang
import Vulkan.Zero
import VulkanMemoryAllocator as VMA
hiding ( getPhysicalDeviceProperties )
Expand Down
15 changes: 8 additions & 7 deletions examples/hlsl/Pipeline.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ module Pipeline

import Control.Monad.Trans.Resource
import Data.Bits
import Data.Foldable ( traverse_ )
import qualified Data.Vector as V
import Data.Foldable ( traverse_ )
import qualified Data.Vector as V
import MonadVulkan
import Vulkan.CStruct.Extends
import Vulkan.Core10 as Vk
hiding ( withBuffer
, withImage
)
import Vulkan.Utils.ShaderQQ.Shaderc
import Vulkan.Core10 as Vk
hiding ( withBuffer
, withImage
)
import Vulkan.Utils.ShaderQQ.HLSL.Shaderc ( vert
, frag )
import Vulkan.Zero

-- Create the most vanilla rendering pipeline
Expand Down
2 changes: 1 addition & 1 deletion examples/offscreen/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import Vulkan.Core10 as Vk
import Vulkan.Extensions.VK_EXT_debug_utils
import Vulkan.Extensions.VK_EXT_validation_features
import Vulkan.Utils.Debug
import Vulkan.Utils.ShaderQQ
import Vulkan.Utils.ShaderQQ.GLSL.Glslang
import Vulkan.Zero
import VulkanMemoryAllocator as VMA
hiding ( getPhysicalDeviceProperties )
Expand Down
40 changes: 21 additions & 19 deletions examples/rays/Pipeline.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,29 @@ module Pipeline
import Control.Monad.IO.Class
import Control.Monad.Trans.Resource
import Data.Bits
import Data.Foldable ( for_
, traverse_
)
import qualified Data.Vector as V
import Data.Vector ( Vector )
import Data.Foldable ( for_
, traverse_
)
import qualified Data.Vector as V
import Data.Vector ( Vector )
import Data.Word
import Foreign ( nullPtr )
import Foreign.Marshal.Utils ( moveBytes )
import Foreign.Ptr ( Ptr
, plusPtr
)
import Foreign ( nullPtr )
import Foreign.Marshal.Utils ( moveBytes )
import Foreign.Ptr ( Ptr
, plusPtr
)
import MonadVulkan
import Say
import Vulkan.CStruct.Extends
import Vulkan.Core10 as Vk
hiding ( withBuffer
, withImage
)
import Vulkan.Core10 as Vk
hiding ( withBuffer
, withImage
)
import Vulkan.Extensions.VK_KHR_acceleration_structure
import Vulkan.Extensions.VK_KHR_ray_tracing_pipeline
import Vulkan.Utils.ShaderQQ

import Vulkan.Utils.ShaderQQ.GLSL.Glslang ( glsl
, compileShaderQ )
import Vulkan.Zero
import VulkanMemoryAllocator
import Scene
Expand Down Expand Up @@ -186,7 +188,7 @@ createRTDescriptorSets descriptorSetLayout tlas SceneBuffers {..} numDescriptorS
createRayGenerationShader
:: V (ReleaseKey, SomeStruct PipelineShaderStageCreateInfo)
createRayGenerationShader = do
let code = $(compileShaderQ (Just "spirv1.4") "rgen" [glsl|
let code = $(compileShaderQ (Just "spirv1.4") "rgen" Nothing [glsl|
#version 460
#extension GL_EXT_ray_tracing : require

Expand Down Expand Up @@ -238,7 +240,7 @@ createRayGenerationShader = do

createRayHitShader :: V (ReleaseKey, SomeStruct PipelineShaderStageCreateInfo)
createRayHitShader = do
let code = $(compileShaderQ (Just "spirv1.4") "rchit" [glsl|
let code = $(compileShaderQ (Just "spirv1.4") "rchit" Nothing [glsl|
#version 460
#extension GL_EXT_ray_tracing : require

Expand Down Expand Up @@ -269,7 +271,7 @@ createRayHitShader = do

createRayIntShader :: V (ReleaseKey, SomeStruct PipelineShaderStageCreateInfo)
createRayIntShader = do
let code = $(compileShaderQ (Just "spirv1.4") "rint" [glsl|
let code = $(compileShaderQ (Just "spirv1.4") "rint" Nothing [glsl|
#version 460
#extension GL_EXT_ray_tracing : require

Expand Down Expand Up @@ -311,7 +313,7 @@ createRayIntShader = do

createRayMissShader :: V (ReleaseKey, SomeStruct PipelineShaderStageCreateInfo)
createRayMissShader = do
let code = $(compileShaderQ (Just "spirv1.4") "rmiss" [glsl|
let code = $(compileShaderQ (Just "spirv1.4") "rmiss" Nothing [glsl|
#version 460
#extension GL_EXT_ray_tracing : require

Expand Down
4 changes: 2 additions & 2 deletions examples/resize/Julia.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import Data.Vector ( Vector )

import Vulkan.CStruct.Extends
import Vulkan.Core10
import Vulkan.Utils.ShaderQQ
import Vulkan.Utils.ShaderQQ.GLSL.Glslang
import Vulkan.Zero

import Julia.Constants
Expand Down Expand Up @@ -100,7 +100,7 @@ juliaDescriptorSet descriptorSetLayout imageViews = do

juliaShader :: V (ReleaseKey, SomeStruct PipelineShaderStageCreateInfo)
juliaShader = do
let compCode = $(compileShaderQ (Just "vulkan1.0") "comp" [glsl|
let compCode = $(compileShaderQ (Just "vulkan1.0") "comp" Nothing [glsl|
#version 450
#extension GL_ARB_separate_shader_objects : enable

Expand Down
2 changes: 1 addition & 1 deletion examples/resize/Pipeline.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import Vulkan.Core10 as Vk
hiding ( withBuffer
, withImage
)
import Vulkan.Utils.ShaderQQ
import Vulkan.Utils.ShaderQQ.GLSL.Glslang
import Vulkan.Zero

import MonadVulkan
Expand Down
27 changes: 14 additions & 13 deletions examples/sdl-triangle/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@ import Control.Monad.IO.Class
import Control.Monad.Managed
import Control.Monad.Trans.Maybe
import Data.Bits
import qualified Data.ByteString as BS
import qualified Data.ByteString as BS
import Data.Foldable
import Data.List ( nub
, partition
)
import Data.List ( nub
, partition
)
import Data.Ord
import Data.String ( IsString )
import Data.Text hiding ( maximum
, partition
)
import qualified Data.Text as T
import Data.String ( IsString )
import Data.Text hiding ( maximum
, partition
)
import qualified Data.Text as T
import Data.Text.Encoding
import Data.Traversable
import qualified Data.Vector as V
import qualified Data.Vector as V
import Data.Word
import Foreign.Ptr ( castPtr )
import Foreign.Ptr ( castPtr )
import qualified SDL
import qualified SDL.Video.Vulkan as SDL
import qualified SDL.Video.Vulkan as SDL
import Say
import System.Exit
import Vulkan.CStruct.Extends
Expand All @@ -38,7 +38,8 @@ import Vulkan.Extensions.VK_EXT_validation_features
import Vulkan.Extensions.VK_KHR_surface
import Vulkan.Extensions.VK_KHR_swapchain
import Vulkan.Utils.Debug
import Vulkan.Utils.ShaderQQ
import Vulkan.Utils.ShaderQQ.GLSL.Glslang ( vert
, frag )
import Vulkan.Zero

main :: IO ()
Expand Down
16 changes: 16 additions & 0 deletions utils/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

## WIP

## [0.5.0] - 2021-02-24
- Refactor module `Vulkan.Utils.ShaderQQ`
- Remove `Vulkan.Utils.ShaderQQ`
- Remove `Vulkan.Utils.ShaderQQ.Shaderc`
- Provide `glsl`/`hlsl`, `vert` .. `comp`, `rgen` .. `rcall`, `mesh`, `task`, `compileShaderQ`, `compileShader` in each ShaderQQ provider module under `Vulkan.Utils.ShaderQQ` for help compile shaders
- Add `Vulkan.Utils.ShaderQQ.Backend.Glslang`to help process warning & error messages for glslangValidator
- Add `Vulkan.Utils.ShaderQQ.Backend.Shaderc`to help process warning & error messages for glslc
- Add `Vulkan.Utils.ShaderQQ.GLSL.Glslang` to compile glsl shaders for glslangValidator
- Add `Vulkan.Utils.ShaderQQ.GLSL.Shaderc` to compile glsl shaders for glslc
- Add `Vulkan.Utils.ShaderQQ.HLSL.Glslang` to compile hlsl shaders for glslangValidator
- Add `Vulkan.Utils.ShaderQQ.HLSL.Shaderc` to compile hlsl shaders for glslc
- specify `--target-spv` for shaderc ray tracing shaders
- specify `--target-env` for glslang ray tracing shaders
- support pass hlsl entry point to glslangValidator and shaderc
- support pass glsl entry point to glslangValidator

## [0.4.2] - 2021-02-18
- Relax bounds on `vulkan`

Expand Down
2 changes: 1 addition & 1 deletion utils/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: vulkan-utils
version: "0.4.2"
version: "0.5.0"
synopsis: Utils for the vulkan package
category: Graphics
maintainer: Joe Hermaszewski <live.long.and.prosper@monoid.al>
Expand Down
Loading