Skip to content

Commit 0772527

Browse files
committed
Remove texture copy functionality
Way too much of a pain to implement cross platform (mostly just a bunch of parameter structs to make). Either way compute stuff is entirely nonfunctional right now and will need to be redone. Plus, only the bucket used this. This makes the texture_manager fully render backend agnostic. Finally.
1 parent 339791c commit 0772527

File tree

6 files changed

+7
-36
lines changed

6 files changed

+7
-36
lines changed

packages/arisu-gfx/command_encoder.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
---@class gfx.TextureDataDescriptor
1+
---@class gfx.TextureWriteDescriptor
22
---@field width number
33
---@field height number
44
---@field depth number? # For 3D textures
@@ -31,7 +31,7 @@
3131
---@field draw fun(self: gfx.CommandEncoder, vertexCount: number, instanceCount: number, firstVertex: number?, firstInstance: number?)
3232
---@field drawIndexed fun(self: gfx.CommandEncoder, indexCount: number, instanceCount: number, firstIndex: number?, baseVertex: number?, firstInstance: number?)
3333
---@field writeBuffer fun(self: gfx.CommandEncoder, buffer: gfx.Buffer, size: number, data: ffi.cdata*, offset: number?)
34-
---@field writeTexture fun(self: gfx.CommandEncoder, texture: gfx.Texture, descriptor: gfx.TextureDataDescriptor, data: ffi.cdata*)
34+
---@field writeTexture fun(self: gfx.CommandEncoder, texture: gfx.Texture, descriptor: gfx.TextureWriteDescriptor, data: ffi.cdata*)
3535
local Encoder = require("arisu-gfx.encoder.gl") --[[@as gfx.CommandEncoder]]
3636

3737
return Encoder

packages/arisu-gfx/command_encoder/gl.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ local GLCommandBuffer = require("arisu-gfx.command_buffer.gl")
1111
---| { type: "draw", vertexCount: number, instanceCount: number, firstVertex: number, firstInstance: number }
1212
---| { type: "drawIndexed", indexCount: number, instanceCount: number, firstIndex: number, baseVertex: number, firstInstance: number }
1313
---| { type: "writeBuffer", buffer: gfx.gl.Buffer, size: number, data: ffi.cdata*, offset: number }
14-
---| { type: "writeTexture", texture: gfx.gl.Texture, descriptor: gfx.TextureDataDescriptor, data: ffi.cdata* }
14+
---| { type: "writeTexture", texture: gfx.gl.Texture, descriptor: gfx.TextureWriteDescriptor, data: ffi.cdata* }
1515

1616
---@class gfx.gl.Encoder
1717
---@field commands gfx.gl.Command[]
@@ -108,7 +108,7 @@ function GLCommandEncoder:writeBuffer(buffer, size, data, offset)
108108
end
109109

110110
---@param texture gfx.gl.Texture
111-
---@param descriptor gfx.TextureDataDescriptor
111+
---@param descriptor gfx.TextureWriteDescriptor
112112
---@param data ffi.cdata*
113113
function GLCommandEncoder:writeTexture(texture, descriptor, data)
114114
self.commands[#self.commands + 1] = {

packages/arisu-gfx/queue.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---@class gfx.Queue
22
---@field submit fun(self: gfx.Queue, commandBuffer: gfx.CommandBuffer)
33
---@field writeBuffer fun(self: gfx.Queue, buffer: gfx.Buffer, size: number, data: ffi.cdata*, offset: number?)
4-
---@field writeTexture fun(self: gfx.Queue, texture: gfx.Texture, descriptor: gfx.TextureDataDescriptor, data: ffi.cdata*)
4+
---@field writeTexture fun(self: gfx.Queue, texture: gfx.Texture, descriptor: gfx.TextureWriteDescriptor, data: ffi.cdata*)
55
local Queue = require("arisu-gfx.queue.gl") --[[@as gfx.Queue]]
66

77
return Queue

packages/arisu-gfx/queue/gl.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ end
2929

3030
--- Helper method to write data to a texture
3131
---@param texture gfx.gl.Texture
32-
---@param descriptor gfx.TextureDataDescriptor
32+
---@param descriptor gfx.TextureWriteDescriptor
3333
---@param data ffi.cdata*
3434
function GLQueue:writeTexture(texture, descriptor, data)
3535
local cmd = GLCommandEncoder.new()

packages/arisu-gfx/texture/gl.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function GLTexture.new(device, descriptor)
5757
return setmetatable({ framebuffer = 0, id = id, descriptor = descriptor }, GLTexture)
5858
end
5959

60-
---@param desc gfx.TextureDataDescriptor
60+
---@param desc gfx.TextureWriteDescriptor
6161
---@param data ffi.cdata*
6262
function GLTexture:writeData(desc, data)
6363
local extents = self.descriptor.extents

packages/arisu/gl/texture_manager.lua

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
local ffi = require("ffi")
22

33
local util = require("arisu-util")
4-
local gl = require("arisu-opengl")
54
local gfx = require("arisu-gfx")
65

76
local Image = require("arisu-image")
@@ -103,34 +102,6 @@ function TextureManager:allocate(width, height)
103102
return layer
104103
end
105104

106-
---@param source Texture
107-
---@param destination Texture
108-
function TextureManager:copy(source, destination)
109-
assert(self.textures[source], "Source texture does not exist")
110-
assert(self.textures[destination], "Destination texture does not exist")
111-
112-
local width = math.min(self.textures[source].width, self.textures[destination].width)
113-
local height = math.min(self.textures[source].height, self.textures[destination].height)
114-
115-
gl.copyImageSubData(
116-
self.texture.id,
117-
gl.TEXTURE_2D_ARRAY,
118-
0,
119-
0,
120-
0,
121-
source,
122-
self.texture.id,
123-
gl.TEXTURE_2D_ARRAY,
124-
0,
125-
0,
126-
0,
127-
destination,
128-
width,
129-
height,
130-
1
131-
)
132-
end
133-
134105
---@param image Image
135106
function TextureManager:update(texture, image)
136107
assert(self.textures[texture], "Texture does not exist")

0 commit comments

Comments
 (0)