# HG changeset patch # User Sam # Date 1685272160 -25200 # Node ID 2113397265b5cf8aa13ab6353c1c4b315d9added # Parent 360664dfc17dd9d48ded78366d3222eee1a9c216 add: flat attribute for shader in/outputs diff -r 360664dfc17d -r 2113397265b5 src/semicongine/core/gpu_data.nim --- a/src/semicongine/core/gpu_data.nim Sun May 28 17:52:03 2023 +0700 +++ b/src/semicongine/core/gpu_data.nim Sun May 28 18:09:20 2023 +0700 @@ -150,6 +150,7 @@ thetype*: DataType arrayCount*: uint32 perInstance*: bool + noInterpolation: bool memoryPerformanceHint*: MemoryPerformanceHint func vertexInputs*(attributes: seq[ShaderAttribute]): seq[ShaderAttribute] = @@ -292,6 +293,7 @@ name: string, perInstance=false, arrayCount=0'u32, + noInterpolation=false, memoryPerformanceHint=PreferFastRead, ): auto = ShaderAttribute( @@ -299,6 +301,7 @@ thetype: getDataType[T](), perInstance: perInstance, arrayCount: arrayCount, + noInterpolation: noInterpolation, memoryPerformanceHint: memoryPerformanceHint, ) @@ -1059,7 +1062,8 @@ var i = 0'u32 for attribute in group: assert attribute.arrayCount == 0, "arrays not supported for shader vertex attributes" - result.add &"layout(location = {i}) in {attribute.thetype.glslType} {attribute.name};" + let flat = if attribute.noInterpolation: "flat " else: "" + result.add &"layout(location = {i}) {flat}in {attribute.thetype.glslType} {attribute.name};" for j in 0 ..< attribute.thetype.numberOfVertexInputAttributeDescriptors: i += attribute.thetype.nLocationSlots @@ -1092,5 +1096,6 @@ var i = 0'u32 for attribute in group: assert attribute.arrayCount == 0, "arrays not supported for outputs" - result.add &"layout(location = {i}) out {attribute.thetype.glslType} {attribute.name};" + let flat = if attribute.noInterpolation: "flat " else: "" + result.add &"layout(location = {i}) {flat}out {attribute.thetype.glslType} {attribute.name};" i += 1 diff -r 360664dfc17d -r 2113397265b5 src/semicongine/resources/mesh.nim --- a/src/semicongine/resources/mesh.nim Sun May 28 17:52:03 2023 +0700 +++ b/src/semicongine/resources/mesh.nim Sun May 28 18:09:20 2023 +0700 @@ -12,7 +12,13 @@ import ./image -let DEFAULTEXTURE = Texture(image: newImage(1, 1, @[[255'u8, 255'u8, 255'u8, 255'u8]]), sampler: DefaultSampler()) +let DEFAULTSAMPLER = Sampler( + magnification: VK_FILTER_NEAREST, + minification: VK_FILTER_NEAREST, + wrapModeS: VK_SAMPLER_ADDRESS_MODE_REPEAT, + wrapModeT: VK_SAMPLER_ADDRESS_MODE_REPEAT, + ) +let DEFAULTEXTURE = Texture(image: newImage(1, 1, @[[255'u8, 255'u8, 255'u8, 255'u8]]), sampler: DEFAULTSAMPLER) type glTFHeader = object