Skip to content

Commit d4c4781

Browse files
committed
Make push constant range an integer
1 parent 91f00d9 commit d4c4781

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/main/java/git/artdeell/artvk/Vk11Device.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ private Vk11RenderPipeline compilePipeline(final RenderPipeline pipeline, final
316316
return new Vk11RenderPipeline(pipeline, this, 0L, 0L, 0L, Vk11BindGroupLayout.INVALID_LAYOUT, null, 0L, 0L);
317317
}
318318

319-
long pushConstantRange = Math.max(vertexShader.pushConstantRange(), fragmentShader.pushConstantRange());
319+
int pushConstantRange = Math.max(vertexShader.pushConstantRange(), fragmentShader.pushConstantRange());
320320

321321
try {
322322
Vk11GlslCompiler.CompiledModules modules = this.glslCompiler.compile(this, pipeline, vertexShader, fragmentShader);

src/main/java/git/artdeell/artvk/Vk11IntermediaryShaderModule.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
@Environment(EnvType.CLIENT)
2525
public record Vk11IntermediaryShaderModule(
26-
String name, @Nullable ByteBuffer spirv, List<SpvUniformBuffer> uniformBuffers, List<SpvSampler> samplers, List<SpvVariable> outputs, List<SpvVariable> inputs, long pushConstantRange
26+
String name, @Nullable ByteBuffer spirv, List<SpvUniformBuffer> uniformBuffers, List<SpvSampler> samplers, List<SpvVariable> outputs, List<SpvVariable> inputs, int pushConstantRange
2727
) implements AutoCloseable {
2828
public static final Vk11IntermediaryShaderModule INVALID = new Vk11IntermediaryShaderModule(
2929
"invalid", null, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), 0
@@ -34,7 +34,7 @@ public static Vk11IntermediaryShaderModule createFromSpirv(final String filename
3434
List<SpvSampler> samplers = new ArrayList<>();
3535
List<SpvVariable> outputs = new ArrayList<>();
3636
List<SpvVariable> inputs = new ArrayList<>();
37-
long pushConstantRange = 0;
37+
int pushConstantRange = 0;
3838

3939
try (MemoryStack stack = MemoryStack.stackPush()) {
4040
PointerBuffer pointer = stack.callocPointer(1);
@@ -108,7 +108,7 @@ public static Vk11IntermediaryShaderModule createFromSpirv(final String filename
108108
for(int i =0; i < spvcCount; i++){
109109
long type = Spvc.spvc_compiler_get_type_handle(compiler, pc.get(i).type_id());
110110
if(Spvc.spvc_compiler_get_declared_struct_size(compiler, type, size) == Spvc.SPVC_SUCCESS){
111-
pushConstantRange = Math.max(pushConstantRange, size.get());
111+
pushConstantRange = Math.toIntExact(Math.max(pushConstantRange, size.get()));
112112
}
113113
else {
114114
ArtVK.LOGGER.error("Failed to get declared push constant struct size!");

src/main/java/git/artdeell/artvk/Vk11RenderPipeline.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public boolean isValid() {
3535

3636
public static Vk11RenderPipeline compile(
3737
final Vk11Device device, final Vk11BindGroupLayout layout, final RenderPipeline pipeline, final long vertexModule, final long fragmentModule,
38-
final long vkRenderPassWithDepth, final long vkRenderPassWithoutDepth, final long pushConstantRange
38+
final long vkRenderPassWithDepth, final long vkRenderPassWithoutDepth, final int pushConstantRange
3939
) {
4040
long pipelineLayout;
4141
try (MemoryStack stack = MemoryStack.stackPush()) {
@@ -46,7 +46,7 @@ public static Vk11RenderPipeline compile(
4646
VkPushConstantRange.Buffer range = VkPushConstantRange.calloc(1, stack)
4747
.stageFlags(VK10.VK_SHADER_STAGE_VERTEX_BIT | VK10.VK_SHADER_STAGE_FRAGMENT_BIT)
4848
.offset(0)
49-
.size((int) pushConstantRange);
49+
.size(pushConstantRange);
5050
createInfo.pPushConstantRanges(range);
5151
}
5252
LongBuffer pointer = stack.callocLong(1);

0 commit comments

Comments
 (0)