Textures shaders write that the title reads on the CPU are copied back into title memory (from fxceless f5c03f3b, pull request 999: Geckomacabre 895c0b8f, 04df4350); on by default
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
30f7859baf
commit
23925a4aa2
6 files changed
+383
-6
No files matched your search
@@ -2690,6 +2690,7 @@ fn hand_out_resource(
|
||||
if desc.dimension != BUFFER {
|
||||
let at = std::ptr::from_ref::<Resource>(&resource) as usize;
|
||||
textures().insert(at);
|
||||
crate::texback::replaced(resource.data() as usize);
|
||||
if !fills(&desc) {
|
||||
TARGETS_AT
|
||||
.lock()
|
||||
@@ -2714,7 +2715,9 @@ impl Drop for Resource {
|
||||
// Out of the table of textures first: the sweep looks at the ones
|
||||
// in it, under its lock.
|
||||
if self.desc.dimension != BUFFER {
|
||||
textures().remove(&(std::ptr::from_ref::<Resource>(self) as usize));
|
||||
let address = std::ptr::from_ref::<Resource>(self) as usize;
|
||||
crate::texback::released(address);
|
||||
textures().remove(&address);
|
||||
if !fills(&self.desc) {
|
||||
let mut targets = TARGETS_AT.lock().unwrap_or_else(|e| e.into_inner());
|
||||
let at = self.data() as u64;
|
||||
@@ -2946,6 +2949,38 @@ pub(crate) fn placed_filler_twins() -> u64 {
|
||||
PLACED_TWINS.load(std::sync::atomic::Ordering::Relaxed)
|
||||
}
|
||||
|
||||
/// Width, height and format of texture `this` (`None` for a buffer), for
|
||||
/// `crate::texback`'s kinds.
|
||||
#[cfg(windows)]
|
||||
pub(crate) fn texture_kind(this: This) -> Option<(u64, u32, u32)> {
|
||||
if this.is_null() {
|
||||
return None;
|
||||
}
|
||||
let r = resource(this);
|
||||
const TEXTURE_2D: u32 = 3;
|
||||
(r.desc.dimension == TEXTURE_2D && r.desc.sample_count <= 1)
|
||||
.then_some((r.desc.width, r.desc.height, r.desc.format))
|
||||
}
|
||||
|
||||
/// Texture `this`'s console layout (one plane), where it lies in title
|
||||
/// memory and the bytes that layout takes, for `crate::texback`; `None` for
|
||||
/// a buffer or a texture with planes.
|
||||
#[cfg(windows)]
|
||||
pub(crate) fn title_texture(this: This) -> Option<(victory_formats::texture::Layout, usize, usize)> {
|
||||
if this.is_null() {
|
||||
return None;
|
||||
}
|
||||
let r = resource(this);
|
||||
if r.desc.dimension == BUFFER {
|
||||
return None;
|
||||
}
|
||||
let t = texture_layout(&r.desc)?;
|
||||
let [plane] = &t.planes[..] else {
|
||||
return None;
|
||||
};
|
||||
Some((plane.layout.clone(), r.data() as usize, t.size as usize))
|
||||
}
|
||||
|
||||
/// The bytes of title memory a texture with the resource description
|
||||
/// `desc` (as words) takes where the title placed it; `None` for a buffer
|
||||
/// and for a description without a size.
|
||||
|
||||
Reference in new issue
Block a user