Skip to content

Commit

Permalink
Using the new cross-platform uniforms API (#28)
Browse files Browse the repository at this point in the history
* Using the new cross-platform uniforms API

* Bump Metashade
  • Loading branch information
ppenenko authored Jan 3, 2025
1 parent c2be0f7 commit 85a6a95
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions src/_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _generate_per_frame_uniform_buffer(sh):
iShadowMap = sh.Float # should be an int, unused for now
)

with sh.uniform_buffer(register = 0, name = 'cbPerFrame'):
with sh.uniform_buffer(dx_register = 0, name = 'cbPerFrame'):
sh.uniform('g_VpXf', sh.Matrix4x4f)
sh.uniform('g_prevVpXf', sh.Matrix4x4f)
sh.uniform('g_VpIXf', sh.Matrix4x4f)
Expand Down Expand Up @@ -89,7 +89,7 @@ def _generate_per_object_uniform_buffer(sh, is_ps : bool):
fGlossiness = sh.Float
)

with sh.uniform_buffer(register = 1, name = 'cbPerObject'):
with sh.uniform_buffer(dx_register = 1, name = 'cbPerObject'):
sh.uniform('g_WorldXf', sh.Matrix3x4f)
sh.uniform('g_prevWorldXf', sh.Matrix3x4f)
if is_ps:
Expand Down Expand Up @@ -219,12 +219,12 @@ def _get_sampler_uniform_name(name: str) -> str:
sh.uniform(
_get_texture_uniform_name(texture_name),
sh.Texture2d(texel_type = material_texture.texel_type),
register = texture_idx
dx_register = texture_idx
)
sh.uniform(
_get_sampler_uniform_name(texture_name),
sh.Sampler,
register = texture_idx
dx_register = texture_idx
)

# IBL texture/sampler definitions
Expand All @@ -237,18 +237,18 @@ def _get_sampler_uniform_name(name: str) -> str:
sh.uniform(
_get_texture_uniform_name(ibl_texture_name),
ibl_texture_type,
register = texture_idx
dx_register = texture_idx
)
sh.uniform(
_get_sampler_uniform_name(ibl_texture_name),
sh.Sampler,
register = texture_idx
dx_register = texture_idx
)

# The shadow map registers are hardcoded in the host app
shadow_map_register = 9
sh.uniform('g_tShadowMap', sh.Texture2d, register = shadow_map_register)
sh.uniform('g_sShadowMap', sh.SamplerCmp, register = shadow_map_register)
sh.uniform('g_tShadowMap', sh.Texture2d, dx_register = shadow_map_register)
sh.uniform('g_sShadowMap', sh.SamplerCmp, dx_register = shadow_map_register)

def _get_material_uv(texture_name : str):
material_texture = material_textures.get(texture_name)
Expand Down

0 comments on commit 85a6a95

Please sign in to comment.