mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 22:58:46 +00:00
Merge tag 'dev-2024-07'
This commit is contained in:
Vendored
+1
-1
@@ -23,7 +23,7 @@ import "core:c"
|
||||
}
|
||||
|
||||
@(private="file") FD_CLR :: #force_inline proc(d: i32, s: ^fd_set) {
|
||||
s.fds_bits[d / (8 * size_of(c.long))] &= ~(c.ulong(1) << (c.ulong(d) % (8 * size_of(c.ulong))))
|
||||
s.fds_bits[d / (8 * size_of(c.long))] &~= c.ulong(1) << (c.ulong(d) % (8 * size_of(c.ulong)))
|
||||
}
|
||||
|
||||
@(private="file") FD_ISSET :: #force_inline proc(d: i32, s: ^fd_set) -> bool {
|
||||
|
||||
Vendored
+3
-1
@@ -39,7 +39,9 @@ foreign WinSock2 {
|
||||
return
|
||||
}
|
||||
}
|
||||
if s.fd_count >= FD_SETSIZE do return
|
||||
if s.fd_count >= FD_SETSIZE {
|
||||
return
|
||||
}
|
||||
s.fd_array[s.fd_count] = fd
|
||||
s.fd_count += 1
|
||||
}
|
||||
|
||||
Vendored
+23
-37
@@ -454,20 +454,13 @@ when !GL_DEBUG {
|
||||
BeginQueryIndexed :: proc "c" (target: u32, index: u32, id: u32) { impl_BeginQueryIndexed(target, index, id) }
|
||||
EndQueryIndexed :: proc "c" (target: u32, index: u32) { impl_EndQueryIndexed(target, index) }
|
||||
GetQueryIndexediv :: proc "c" (target: u32, index: u32, pname: u32, params: [^]i32) { impl_GetQueryIndexediv(target, index, pname, params) }
|
||||
GetTextureHandleARB :: proc "c" (texture: u32) -> u64
|
||||
{ return impl_GetTextureHandleARB(texture) }
|
||||
GetTextureSamplerHandleARB :: proc "c" (texture, sampler: u32) -> u64
|
||||
{ return impl_GetTextureSamplerHandleARB(texture, sampler) }
|
||||
GetImageHandleARB :: proc "c" (texture: u32, level: i32, layered: bool, layer: i32, format: u32) -> u64
|
||||
{ return impl_GetImageHandleARB(texture, level, layered, layer, format) }
|
||||
MakeTextureHandleResidentARB :: proc "c" (handle: u64)
|
||||
{ impl_MakeTextureHandleResidentARB(handle) }
|
||||
MakeImageHandleResidentARB :: proc "c" (handle: u64, access: u32)
|
||||
{ impl_MakeImageHandleResidentARB(handle, access) }
|
||||
MakeTextureHandleNonResidentARB:: proc "c" (handle: u64)
|
||||
{ impl_MakeTextureHandleNonResidentARB(handle) }
|
||||
MakeImageHandleNonResidentARB :: proc "c" (handle: u64)
|
||||
{ impl_MakeImageHandleNonResidentARB(handle) }
|
||||
GetTextureHandleARB :: proc "c" (texture: u32) -> u64 { return impl_GetTextureHandleARB(texture) }
|
||||
GetTextureSamplerHandleARB :: proc "c" (texture, sampler: u32) -> u64 { return impl_GetTextureSamplerHandleARB(texture, sampler) }
|
||||
GetImageHandleARB :: proc "c" (texture: u32, level: i32, layered: bool, layer: i32, format: u32) -> u64 { return impl_GetImageHandleARB(texture, level, layered, layer, format) }
|
||||
MakeTextureHandleResidentARB :: proc "c" (handle: u64) { impl_MakeTextureHandleResidentARB(handle) }
|
||||
MakeImageHandleResidentARB :: proc "c" (handle: u64, access: u32) { impl_MakeImageHandleResidentARB(handle, access) }
|
||||
MakeTextureHandleNonResidentARB:: proc "c" (handle: u64) { impl_MakeTextureHandleNonResidentARB(handle) }
|
||||
MakeImageHandleNonResidentARB :: proc "c" (handle: u64) { impl_MakeImageHandleNonResidentARB(handle) }
|
||||
|
||||
// VERSION_4_1
|
||||
ReleaseShaderCompiler :: proc "c" () { impl_ReleaseShaderCompiler() }
|
||||
@@ -788,17 +781,17 @@ when !GL_DEBUG {
|
||||
{
|
||||
// add input arguments
|
||||
for arg, arg_index in args[num_ret:] {
|
||||
if arg_index > 0 { fmt.printf(", ") }
|
||||
if arg_index > 0 { fmt.printf(", ") }
|
||||
|
||||
if v, ok := arg.(u32); ok { // TODO: Assumes all u32 are GLenum (they're not, GLbitfield and GLuint are also mapped to u32), fix later by better typing
|
||||
if err == .INVALID_ENUM {
|
||||
fmt.printf("INVALID_ENUM=%d", v)
|
||||
if v, ok := arg.(u32); ok { // TODO: Assumes all u32 are GLenum (they're not, GLbitfield and GLuint are also mapped to u32), fix later by better typing
|
||||
if err == .INVALID_ENUM {
|
||||
fmt.printf("INVALID_ENUM=%d", v)
|
||||
} else {
|
||||
fmt.printf("GL_%v=%d", GL_Enum(v), v)
|
||||
}
|
||||
} else {
|
||||
fmt.printf("GL_%v=%d", GL_Enum(v), v)
|
||||
fmt.printf("%v", arg)
|
||||
}
|
||||
} else {
|
||||
fmt.printf("%v", arg)
|
||||
}
|
||||
}
|
||||
|
||||
// add return arguments
|
||||
@@ -817,7 +810,7 @@ when !GL_DEBUG {
|
||||
}
|
||||
|
||||
// add location
|
||||
fmt.printf(" in: %s(%d:%d)\n", from_loc.file_path, from_loc.line, from_loc.column)
|
||||
fmt.printf(" in: %s(%d:%d)\n", from_loc.file_path, from_loc.line, from_loc.column)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1265,20 +1258,13 @@ when !GL_DEBUG {
|
||||
BeginQueryIndexed :: proc "c" (target: u32, index: u32, id: u32, loc := #caller_location) { impl_BeginQueryIndexed(target, index, id); debug_helper(loc, 0, target, index, id) }
|
||||
EndQueryIndexed :: proc "c" (target: u32, index: u32, loc := #caller_location) { impl_EndQueryIndexed(target, index); debug_helper(loc, 0, target, index) }
|
||||
GetQueryIndexediv :: proc "c" (target: u32, index: u32, pname: u32, params: [^]i32, loc := #caller_location) { impl_GetQueryIndexediv(target, index, pname, params); debug_helper(loc, 0, target, index, pname, params) }
|
||||
GetTextureHandleARB :: proc "c" (target: u32, loc := #caller_location) -> u64
|
||||
{ ret := impl_GetTextureHandleARB(target); debug_helper(loc, 0, target); return ret }
|
||||
GetTextureSamplerHandleARB :: proc "c" (texture, sampler: u32, loc := #caller_location) -> u64
|
||||
{ ret := impl_GetTextureSamplerHandleARB(texture, sampler); debug_helper(loc, 0, texture, sampler); return ret }
|
||||
GetImageHandleARB :: proc "c" (texture: u32, level: i32, layered: bool, layer: i32, format: u32, loc := #caller_location) -> u64
|
||||
{ ret := impl_GetImageHandleARB(texture, level, layered, layer, format); debug_helper(loc, 0, texture, level, layered, layer, format); return ret }
|
||||
MakeTextureHandleResidentARB :: proc "c" (handle: u64, loc := #caller_location)
|
||||
{ impl_MakeTextureHandleResidentARB(handle); debug_helper(loc, 0, handle) }
|
||||
MakeImageHandleResidentARB :: proc "c" (handle: u64, access: u32, loc := #caller_location)
|
||||
{ impl_MakeImageHandleResidentARB(handle, access); debug_helper(loc, 0, handle, access) }
|
||||
MakeTextureHandleNonResidentARB:: proc "c" (handle: u64, loc := #caller_location)
|
||||
{ impl_MakeTextureHandleNonResidentARB(handle); debug_helper(loc, 0, handle) }
|
||||
MakeImageHandleNonResidentARB :: proc "c" (handle: u64, loc := #caller_location)
|
||||
{ impl_MakeImageHandleNonResidentARB(handle); debug_helper(loc, 0, handle) }
|
||||
GetTextureHandleARB :: proc "c" (target: u32, loc := #caller_location) -> u64 { ret := impl_GetTextureHandleARB(target); debug_helper(loc, 0, target); return ret }
|
||||
GetTextureSamplerHandleARB :: proc "c" (texture, sampler: u32, loc := #caller_location) -> u64 { ret := impl_GetTextureSamplerHandleARB(texture, sampler); debug_helper(loc, 0, texture, sampler); return ret }
|
||||
GetImageHandleARB :: proc "c" (texture: u32, level: i32, layered: bool, layer: i32, format: u32, loc := #caller_location) -> u64 { ret := impl_GetImageHandleARB(texture, level, layered, layer, format); debug_helper(loc, 0, texture, level, layered, layer, format); return ret }
|
||||
MakeTextureHandleResidentARB :: proc "c" (handle: u64, loc := #caller_location) { impl_MakeTextureHandleResidentARB(handle); debug_helper(loc, 0, handle) }
|
||||
MakeImageHandleResidentARB :: proc "c" (handle: u64, access: u32, loc := #caller_location) { impl_MakeImageHandleResidentARB(handle, access); debug_helper(loc, 0, handle, access) }
|
||||
MakeTextureHandleNonResidentARB:: proc "c" (handle: u64, loc := #caller_location) { impl_MakeTextureHandleNonResidentARB(handle); debug_helper(loc, 0, handle) }
|
||||
MakeImageHandleNonResidentARB :: proc "c" (handle: u64, loc := #caller_location) { impl_MakeImageHandleNonResidentARB(handle); debug_helper(loc, 0, handle) }
|
||||
|
||||
|
||||
|
||||
|
||||
Vendored
+3
-3
@@ -494,15 +494,15 @@ free_cstring :: proc "c" (str: cstring) {
|
||||
free_rawptr(rawptr(str))
|
||||
}
|
||||
free_string :: proc "c" (s: string) {
|
||||
free_rawptr(raw_data(s))
|
||||
free_rawptr(raw_data(s))
|
||||
}
|
||||
free :: proc{free_rawptr, free_cstring}
|
||||
|
||||
// Wrap CMark allocator as Odin allocator
|
||||
@(private)
|
||||
cmark_allocator_proc :: proc(allocator_data: rawptr, mode: runtime.Allocator_Mode,
|
||||
size, alignment: int,
|
||||
old_memory: rawptr, old_size: int, loc := #caller_location) -> (res: []byte, err: runtime.Allocator_Error) {
|
||||
size, alignment: int,
|
||||
old_memory: rawptr, old_size: int, loc := #caller_location) -> (res: []byte, err: runtime.Allocator_Error) {
|
||||
|
||||
cmark_alloc := cast(^Allocator)allocator_data
|
||||
switch mode {
|
||||
|
||||
Vendored
+4
-4
@@ -798,10 +798,10 @@ __getVerticalAlign :: proc(
|
||||
|
||||
case .BOTTOMLEFT:
|
||||
switch av {
|
||||
case .TOP: res = -font.ascender * f32(pixelSize) / 10
|
||||
case .MIDDLE: res = -(font.ascender + font.descender) / 2 * f32(pixelSize) / 10
|
||||
case .BASELINE: res = 0
|
||||
case .BOTTOM: res = -font.descender * f32(pixelSize) / 10
|
||||
case .TOP: res = -font.ascender * f32(pixelSize) / 10
|
||||
case .MIDDLE: res = -(font.ascender + font.descender) / 2 * f32(pixelSize) / 10
|
||||
case .BASELINE: res = 0
|
||||
case .BOTTOM: res = -font.descender * f32(pixelSize) / 10
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -235,8 +235,8 @@ foreign lib {
|
||||
// quit
|
||||
|
||||
QuitRequested :: #force_inline proc "c" () -> bool {
|
||||
PumpEvents()
|
||||
return bool(PeepEvents(nil, 0, .PEEKEVENT, .QUIT, .QUIT) > 0)
|
||||
PumpEvents()
|
||||
return bool(PeepEvents(nil, 0, .PEEKEVENT, .QUIT, .QUIT) > 0)
|
||||
}
|
||||
|
||||
|
||||
|
||||
+11
-11
@@ -94,15 +94,13 @@ def convert_type(t, prev_name, curr_name):
|
||||
if t == "":
|
||||
return t
|
||||
|
||||
if t.startswith("const"):
|
||||
t = convert_type(t[6:], prev_name, curr_name)
|
||||
|
||||
elif t.endswith("*"):
|
||||
elem = ""
|
||||
pointer = "^"
|
||||
if t.startswith("const"):
|
||||
ttype = t[6:len(t)-1]
|
||||
elem = convert_type(ttype, prev_name, curr_name)
|
||||
else:
|
||||
ttype = t[:len(t)-1]
|
||||
elem = convert_type(ttype, prev_name, curr_name)
|
||||
ttype = t[:len(t)-1]
|
||||
elem = convert_type(ttype, prev_name, curr_name)
|
||||
|
||||
if curr_name.endswith("s") or curr_name.endswith("Table"):
|
||||
if prev_name.endswith("Count") or prev_name.endswith("Counts"):
|
||||
@@ -625,12 +623,14 @@ def parse_procedures(f):
|
||||
|
||||
for rt, name, fields in data:
|
||||
proc_name = no_vk(name)
|
||||
|
||||
pf = []
|
||||
prev_name = ""
|
||||
for type_, fname in re.findall(r"(?:\s*|)(.+?)\s*(\w+)(?:,|$)", fields):
|
||||
for type_, fname, array_len in re.findall(r"(?:\s*|)(.+?)\s*(\w+)(?:\[(\d+)\])?(?:,|$)", fields):
|
||||
curr_name = fix_arg(fname)
|
||||
pf.append((do_type(type_, prev_name, curr_name), curr_name))
|
||||
ty = do_type(type_, prev_name, curr_name)
|
||||
if array_len != "":
|
||||
ty = f"^[{array_len}]{ty}"
|
||||
pf.append((ty, curr_name))
|
||||
prev_name = curr_name
|
||||
|
||||
data_fields = ', '.join(["{}: {}".format(n, t) for t, n in pf if t != ""])
|
||||
@@ -798,7 +798,7 @@ API_VERSION_1_2 :: (1<<22) | (2<<12) | (0)
|
||||
API_VERSION_1_3 :: (1<<22) | (3<<12) | (0)
|
||||
|
||||
MAKE_VERSION :: proc(major, minor, patch: u32) -> u32 {
|
||||
return (major<<22) | (minor<<12) | (patch)
|
||||
\treturn (major<<22) | (minor<<12) | (patch)
|
||||
}
|
||||
|
||||
// Base types
|
||||
|
||||
Vendored
+1
-1
@@ -8,7 +8,7 @@ API_VERSION_1_2 :: (1<<22) | (2<<12) | (0)
|
||||
API_VERSION_1_3 :: (1<<22) | (3<<12) | (0)
|
||||
|
||||
MAKE_VERSION :: proc(major, minor, patch: u32) -> u32 {
|
||||
return (major<<22) | (minor<<12) | (patch)
|
||||
return (major<<22) | (minor<<12) | (patch)
|
||||
}
|
||||
|
||||
// Base types
|
||||
|
||||
Vendored
+3
-3
@@ -259,7 +259,7 @@ ProcCmdResolveImage2KHR :: #type proc "system
|
||||
ProcCmdSetAlphaToCoverageEnableEXT :: #type proc "system" (commandBuffer: CommandBuffer, alphaToCoverageEnable: b32)
|
||||
ProcCmdSetAlphaToOneEnableEXT :: #type proc "system" (commandBuffer: CommandBuffer, alphaToOneEnable: b32)
|
||||
ProcCmdSetAttachmentFeedbackLoopEnableEXT :: #type proc "system" (commandBuffer: CommandBuffer, aspectMask: ImageAspectFlags)
|
||||
ProcCmdSetBlendConstants :: #type proc "system" (commandBuffer: CommandBuffer)
|
||||
ProcCmdSetBlendConstants :: #type proc "system" (commandBuffer: CommandBuffer, blendConstants: ^[4]f32)
|
||||
ProcCmdSetCheckpointNV :: #type proc "system" (commandBuffer: CommandBuffer, pCheckpointMarker: rawptr)
|
||||
ProcCmdSetCoarseSampleOrderNV :: #type proc "system" (commandBuffer: CommandBuffer, sampleOrderType: CoarseSampleOrderTypeNV, customSampleOrderCount: u32, pCustomSampleOrders: [^]CoarseSampleOrderCustomNV)
|
||||
ProcCmdSetColorBlendAdvancedEXT :: #type proc "system" (commandBuffer: CommandBuffer, firstAttachment: u32, attachmentCount: u32, pColorBlendAdvanced: ^ColorBlendAdvancedEXT)
|
||||
@@ -302,8 +302,8 @@ ProcCmdSetEvent2KHR :: #type proc "system
|
||||
ProcCmdSetExclusiveScissorEnableNV :: #type proc "system" (commandBuffer: CommandBuffer, firstExclusiveScissor: u32, exclusiveScissorCount: u32, pExclusiveScissorEnables: [^]b32)
|
||||
ProcCmdSetExclusiveScissorNV :: #type proc "system" (commandBuffer: CommandBuffer, firstExclusiveScissor: u32, exclusiveScissorCount: u32, pExclusiveScissors: [^]Rect2D)
|
||||
ProcCmdSetExtraPrimitiveOverestimationSizeEXT :: #type proc "system" (commandBuffer: CommandBuffer, extraPrimitiveOverestimationSize: f32)
|
||||
ProcCmdSetFragmentShadingRateEnumNV :: #type proc "system" (commandBuffer: CommandBuffer, shadingRate: FragmentShadingRateNV)
|
||||
ProcCmdSetFragmentShadingRateKHR :: #type proc "system" (commandBuffer: CommandBuffer, pFragmentSize: ^Extent2D)
|
||||
ProcCmdSetFragmentShadingRateEnumNV :: #type proc "system" (commandBuffer: CommandBuffer, shadingRate: FragmentShadingRateNV, combinerOps: ^[2]FragmentShadingRateCombinerOpKHR)
|
||||
ProcCmdSetFragmentShadingRateKHR :: #type proc "system" (commandBuffer: CommandBuffer, pFragmentSize: ^Extent2D, combinerOps: ^[2]FragmentShadingRateCombinerOpKHR)
|
||||
ProcCmdSetFrontFace :: #type proc "system" (commandBuffer: CommandBuffer, frontFace: FrontFace)
|
||||
ProcCmdSetFrontFaceEXT :: #type proc "system" (commandBuffer: CommandBuffer, frontFace: FrontFace)
|
||||
ProcCmdSetLineRasterizationModeEXT :: #type proc "system" (commandBuffer: CommandBuffer, lineRasterizationMode: LineRasterizationModeEXT)
|
||||
|
||||
Vendored
+2
-9
@@ -29,10 +29,9 @@ foreign {
|
||||
RawQueueSubmitForIndex :: proc(queue: Queue, commandCount: uint, commands: [^]CommandBuffer) -> SubmissionIndex ---
|
||||
|
||||
// Returns true if the queue is empty, or false if there are more queue submissions still in flight.
|
||||
@(link_name="wgpuDevicePoll")
|
||||
RawDevicePoll :: proc(device: Device, wait: b32, /* NULLABLE */ wrappedSubmissionIndex: /* const */ ^WrappedSubmissionIndex) -> b32 ---
|
||||
DevicePoll :: proc(device: Device, wait: b32, /* NULLABLE */ wrappedSubmissionIndex: /* const */ ^WrappedSubmissionIndex = nil) -> b32 ---
|
||||
|
||||
SetLogCallback :: proc "odin" (callback: LogCallback) ---
|
||||
SetLogCallback :: proc(callback: LogCallback, userdata: rawptr) ---
|
||||
|
||||
SetLogLevel :: proc(level: LogLevel) ---
|
||||
|
||||
@@ -67,9 +66,3 @@ InstanceEnumerateAdapters :: proc(instance: Instance, options: ^InstanceEnumerat
|
||||
QueueSubmitForIndex :: proc(queue: Queue, commands: []CommandBuffer) -> SubmissionIndex {
|
||||
return RawQueueSubmitForIndex(queue, len(commands), raw_data(commands))
|
||||
}
|
||||
|
||||
DevicePoll :: proc(device: Device, wait: b32) -> (wrappedSubmissionIndex: WrappedSubmissionIndex, ok: bool) {
|
||||
ok = bool(RawDevicePoll(device, wait, &wrappedSubmissionIndex))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -79,7 +79,7 @@ RequiredLimitsExtras :: struct {
|
||||
}
|
||||
|
||||
SupportedLimitsExtras :: struct {
|
||||
using chain: ChainedStruct,
|
||||
using chain: ChainedStructOut,
|
||||
limits: NativeLimits,
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ SurfaceConfigurationExtras :: struct {
|
||||
desiredMaximumFrameLatency: i32,
|
||||
}
|
||||
|
||||
LogCallback :: #type proc "odin" (level: LogLevel, message: cstring)
|
||||
LogCallback :: #type proc "c" (level: LogLevel, message: cstring, userdata: rawptr)
|
||||
|
||||
// Wrappers
|
||||
|
||||
|
||||
Reference in New Issue
Block a user