it works ish?
This commit is contained in:
@@ -104,5 +104,22 @@ void main()
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+4]=uvec3(0,2,4)+uvec3(vindex);
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+5]=uvec3(2,4,6)+uvec3(vindex);
|
||||
}
|
||||
} else
|
||||
{
|
||||
gl_MeshVerticesEXT[vindex+0].gl_Position=vec4(0,0,0,1);
|
||||
gl_MeshVerticesEXT[vindex+1].gl_Position=vec4(0,0,0,1);
|
||||
gl_MeshVerticesEXT[vindex+2].gl_Position=vec4(0,0,0,1);
|
||||
gl_MeshVerticesEXT[vindex+3].gl_Position=vec4(0,0,0,1);
|
||||
gl_MeshVerticesEXT[vindex+4].gl_Position=vec4(0,0,0,1);
|
||||
gl_MeshVerticesEXT[vindex+5].gl_Position=vec4(0,0,0,1);
|
||||
gl_MeshVerticesEXT[vindex+6].gl_Position=vec4(0,0,0,1);
|
||||
gl_MeshVerticesEXT[vindex+7].gl_Position=vec4(0,0,0,1);
|
||||
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+0]=uvec3(0,0,0);
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+1]=uvec3(0,0,0);
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+2]=uvec3(0,0,0);
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+3]=uvec3(0,0,0);
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+4]=uvec3(0,0,0);
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+5]=uvec3(0,0,0);
|
||||
}
|
||||
}
|
||||
@@ -77,17 +77,10 @@ const uint OPMinMaterialFloat=__LINE__-1;
|
||||
const uint OPMaxMaterialFloat=__LINE__-1;
|
||||
const uint OPSmoothMinMaterialFloat=__LINE__-1;
|
||||
const uint OPSmoothMaxMaterialFloat=__LINE__-1;
|
||||
const uint OPSwap2Float=__LINE__-1;
|
||||
const uint OPSwap3Float=__LINE__-1;
|
||||
const uint OPSwap4Float=__LINE__-1;
|
||||
const uint OPDupFloat=__LINE__-1;
|
||||
const uint OPDup2Float=__LINE__-1;
|
||||
const uint OPDup3Float=__LINE__-1;
|
||||
const uint OPDup4Float=__LINE__-1;
|
||||
const uint OPDropFloat=__LINE__-1;
|
||||
const uint OPDrop2Float=__LINE__-1;
|
||||
const uint OPDrop3Float=__LINE__-1;
|
||||
const uint OPDrop4Float=__LINE__-1;
|
||||
const uint OPAbsVec2=__LINE__-1;
|
||||
const uint OPSignVec2=__LINE__-1;
|
||||
const uint OPFloorVec2=__LINE__-1;
|
||||
@@ -107,17 +100,10 @@ const uint OPAcosVec2=__LINE__-1;
|
||||
const uint OPAtanVec2=__LINE__-1;
|
||||
const uint OPMinVec2=__LINE__-1;
|
||||
const uint OPMaxVec2=__LINE__-1;
|
||||
const uint OPSwap2Vec2=__LINE__-1;
|
||||
const uint OPSwap3Vec2=__LINE__-1;
|
||||
const uint OPSwap4Vec2=__LINE__-1;
|
||||
const uint OPDupVec2=__LINE__-1;
|
||||
const uint OPDup2Vec2=__LINE__-1;
|
||||
const uint OPDup3Vec2=__LINE__-1;
|
||||
const uint OPDup4Vec2=__LINE__-1;
|
||||
const uint OPDropVec2=__LINE__-1;
|
||||
const uint OPDrop2Vec2=__LINE__-1;
|
||||
const uint OPDrop3Vec2=__LINE__-1;
|
||||
const uint OPDrop4Vec2=__LINE__-1;
|
||||
const uint OPAbsVec3=__LINE__-1;
|
||||
const uint OPSignVec3=__LINE__-1;
|
||||
const uint OPFloorVec3=__LINE__-1;
|
||||
@@ -137,17 +123,10 @@ const uint OPAcosVec3=__LINE__-1;
|
||||
const uint OPAtanVec3=__LINE__-1;
|
||||
const uint OPMinVec3=__LINE__-1;
|
||||
const uint OPMaxVec3=__LINE__-1;
|
||||
const uint OPSwap2Vec3=__LINE__-1;
|
||||
const uint OPSwap3Vec3=__LINE__-1;
|
||||
const uint OPSwap4Vec3=__LINE__-1;
|
||||
const uint OPDupVec3=__LINE__-1;
|
||||
const uint OPDup2Vec3=__LINE__-1;
|
||||
const uint OPDup3Vec3=__LINE__-1;
|
||||
const uint OPDup4Vec3=__LINE__-1;
|
||||
const uint OPDropVec3=__LINE__-1;
|
||||
const uint OPDrop2Vec3=__LINE__-1;
|
||||
const uint OPDrop3Vec3=__LINE__-1;
|
||||
const uint OPDrop4Vec3=__LINE__-1;
|
||||
const uint OPAbsVec4=__LINE__-1;
|
||||
const uint OPSignVec4=__LINE__-1;
|
||||
const uint OPFloorVec4=__LINE__-1;
|
||||
@@ -167,17 +146,10 @@ const uint OPAcosVec4=__LINE__-1;
|
||||
const uint OPAtanVec4=__LINE__-1;
|
||||
const uint OPMinVec4=__LINE__-1;
|
||||
const uint OPMaxVec4=__LINE__-1;
|
||||
const uint OPSwap2Vec4=__LINE__-1;
|
||||
const uint OPSwap3Vec4=__LINE__-1;
|
||||
const uint OPSwap4Vec4=__LINE__-1;
|
||||
const uint OPDupVec4=__LINE__-1;
|
||||
const uint OPDup2Vec4=__LINE__-1;
|
||||
const uint OPDup3Vec4=__LINE__-1;
|
||||
const uint OPDup4Vec4=__LINE__-1;
|
||||
const uint OPDropVec4=__LINE__-1;
|
||||
const uint OPDrop2Vec4=__LINE__-1;
|
||||
const uint OPDrop3Vec4=__LINE__-1;
|
||||
const uint OPDrop4Vec4=__LINE__-1;
|
||||
const uint OPPromoteFloatFloatVec2=__LINE__-1;
|
||||
const uint OPPromoteFloatFloatFloatVec3=__LINE__-1;
|
||||
const uint OPPromoteFloatFloatFloatFloatVec4=__LINE__-1;
|
||||
@@ -185,14 +157,6 @@ const uint OPPromoteVec2FloatVec3=__LINE__-1;
|
||||
const uint OPPromoteVec2FloatFloatVec4=__LINE__-1;
|
||||
const uint OPPromoteVec2Vec2Vec4=__LINE__-1;
|
||||
const uint OPPromoteVec3FloatVec4=__LINE__-1;
|
||||
const uint OPDemoteVec2FloatFloat=__LINE__-1;
|
||||
const uint OPDemoteVec3FloatFloatFloat=__LINE__-1;
|
||||
const uint OPDemoteVec4FloatFloatFloatFloat=__LINE__-1;
|
||||
const uint OPDemoteMat2Float=__LINE__-1;
|
||||
const uint OPDemoteMat2Vec2=__LINE__-1;
|
||||
const uint OPDemoteMat3Vec3=__LINE__-1;
|
||||
const uint OPDemoteMat4Vec4=__LINE__-1;
|
||||
const uint OPDemoteMat2Vec4=__LINE__-1;
|
||||
const uint OPAcoshFloat=__LINE__-1;
|
||||
const uint OPAcoshVec2=__LINE__-1;
|
||||
const uint OPAcoshVec3=__LINE__-1;
|
||||
|
||||
+387
-40
File diff suppressed because it is too large
Load Diff
+66
-8
@@ -27,6 +27,7 @@ use vulkano::VulkanLibrary;
|
||||
use winit::event::{DeviceEvent, ElementState, MouseButton, VirtualKeyCode};
|
||||
|
||||
use egui_winit_vulkano::Gui;
|
||||
use rayon::prelude::*;
|
||||
use vulkano::pipeline::StateMode::Fixed;
|
||||
use vulkano::{
|
||||
buffer::BufferUsage,
|
||||
@@ -151,6 +152,7 @@ fn main() {
|
||||
shader_float16: true,
|
||||
shader_int16: true,
|
||||
shader_int8: true,
|
||||
storage_buffer8_bit_access: true,
|
||||
..Features::empty()
|
||||
},
|
||||
..Default::default()
|
||||
@@ -231,9 +233,6 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
let mesh_vs = mesh_vs::load(device.clone()).unwrap();
|
||||
let mesh_fs = mesh_fs::load(device.clone()).unwrap();
|
||||
|
||||
mod implicit_ms {
|
||||
vulkano_shaders::shader! {
|
||||
ty: "mesh",
|
||||
@@ -263,8 +262,56 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
let implicit_ms = implicit_ms::load(device.clone()).unwrap();
|
||||
let implicit_fs = implicit_fs::load(device.clone()).unwrap();
|
||||
let loaders: Vec<
|
||||
fn(
|
||||
::std::sync::Arc<::vulkano::device::Device>,
|
||||
) -> Result<
|
||||
::std::sync::Arc<::vulkano::shader::ShaderModule>,
|
||||
::vulkano::shader::ShaderCreationError,
|
||||
>,
|
||||
> = vec![
|
||||
((mesh_vs::load)
|
||||
as fn(
|
||||
::std::sync::Arc<::vulkano::device::Device>,
|
||||
) -> Result<
|
||||
::std::sync::Arc<::vulkano::shader::ShaderModule>,
|
||||
::vulkano::shader::ShaderCreationError,
|
||||
>),
|
||||
((mesh_fs::load)
|
||||
as fn(
|
||||
::std::sync::Arc<::vulkano::device::Device>,
|
||||
) -> Result<
|
||||
::std::sync::Arc<::vulkano::shader::ShaderModule>,
|
||||
::vulkano::shader::ShaderCreationError,
|
||||
>),
|
||||
((implicit_ms::load)
|
||||
as fn(
|
||||
::std::sync::Arc<::vulkano::device::Device>,
|
||||
) -> Result<
|
||||
::std::sync::Arc<::vulkano::shader::ShaderModule>,
|
||||
::vulkano::shader::ShaderCreationError,
|
||||
>),
|
||||
((implicit_fs::load)
|
||||
as fn(
|
||||
::std::sync::Arc<::vulkano::device::Device>,
|
||||
) -> Result<
|
||||
::std::sync::Arc<::vulkano::shader::ShaderModule>,
|
||||
::vulkano::shader::ShaderCreationError,
|
||||
>),
|
||||
];
|
||||
|
||||
let pariter = loaders
|
||||
.par_iter()
|
||||
.map(|load| load(device.clone()).unwrap())
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let mesh_vs = pariter[0].clone();
|
||||
let mesh_fs = pariter[1].clone();
|
||||
|
||||
let implicit_ms = pariter[2].clone();
|
||||
let implicit_fs = pariter[3].clone();
|
||||
|
||||
drop(pariter);
|
||||
|
||||
let memory_allocator = Arc::new(MemoryAllocator::new_default(device.clone()));
|
||||
|
||||
@@ -611,6 +658,8 @@ fn main() {
|
||||
CSGPart::opcode(InstructionSet::OPStop, 0b000000),
|
||||
];
|
||||
|
||||
let dependencies: Vec<[u8; 2]> = vec![[1, 255], [255, 255]];
|
||||
|
||||
let floats: Vec<f32> = vec![0.2, 0.2, 0.05];
|
||||
|
||||
let vec2s: Vec<[f32; 2]> = vec![[0.; 2]];
|
||||
@@ -657,6 +706,7 @@ fn main() {
|
||||
mat2s: 0,
|
||||
mat3s: 0,
|
||||
mat4s: 0,
|
||||
dependencies: 0,
|
||||
};
|
||||
|
||||
let descvec = vec![desc];
|
||||
@@ -707,6 +757,13 @@ fn main() {
|
||||
.allocate_slice((mats.len() as u64).max(1))
|
||||
.unwrap();
|
||||
csg_mats.write().unwrap().copy_from_slice(&mats[..]);
|
||||
let csg_depends = uniform_buffer
|
||||
.allocate_slice((dependencies.len() as u64).max(1))
|
||||
.unwrap();
|
||||
csg_depends
|
||||
.write()
|
||||
.unwrap()
|
||||
.copy_from_slice(&dependencies[..]);
|
||||
|
||||
let mesh_layout = mesh_pipeline.layout().set_layouts().get(0).unwrap();
|
||||
let mesh_set = PersistentDescriptorSet::new(
|
||||
@@ -732,10 +789,11 @@ fn main() {
|
||||
WriteDescriptorSet::buffer(5, csg_vec2s.clone()),
|
||||
WriteDescriptorSet::buffer(6, csg_vec3s.clone()),
|
||||
WriteDescriptorSet::buffer(7, csg_vec4s.clone()),
|
||||
WriteDescriptorSet::buffer(8, csg_mat2s.clone()),
|
||||
WriteDescriptorSet::buffer(9, csg_mat3s.clone()),
|
||||
WriteDescriptorSet::buffer(10, csg_mat4s.clone()),
|
||||
//WriteDescriptorSet::buffer(8, csg_mat2s.clone()),
|
||||
//WriteDescriptorSet::buffer(9, csg_mat3s.clone()),
|
||||
//WriteDescriptorSet::buffer(10, csg_mat4s.clone()),
|
||||
//WriteDescriptorSet::buffer(11, csg_mats.clone()),
|
||||
WriteDescriptorSet::buffer(12, csg_depends.clone()),
|
||||
],
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user