Misc tweaks.
This commit is contained in:
parent
34fb0e4a8a
commit
eda38a7428
|
@ -47,7 +47,7 @@ bool CircularBuffer::Initialize() {
|
|||
|
||||
if (FLAGS_vendor_gl_extensions && GLEW_NV_shader_buffer_load) {
|
||||
// To use this bindlessly we must make it resident.
|
||||
glMakeNamedBufferResidentNV(buffer_, GL_WRITE_ONLY);
|
||||
glMakeNamedBufferResidentNV(buffer_, GL_READ_ONLY);
|
||||
glGetNamedBufferParameterui64vNV(buffer_, GL_BUFFER_GPU_ADDRESS_NV,
|
||||
&gpu_base_);
|
||||
}
|
||||
|
@ -90,11 +90,16 @@ CircularBuffer::Allocation CircularBuffer::Acquire(size_t length) {
|
|||
return allocation;
|
||||
}
|
||||
|
||||
void CircularBuffer::Discard(Allocation allocation) {
|
||||
write_head_ -= allocation.aligned_length;
|
||||
}
|
||||
|
||||
void CircularBuffer::Commit(Allocation allocation) {
|
||||
uintptr_t start = allocation.gpu_ptr - gpu_base_;
|
||||
uintptr_t end = start + allocation.aligned_length;
|
||||
dirty_start_ = std::min(dirty_start_, start);
|
||||
dirty_end_ = std::max(dirty_end_, end);
|
||||
assert_true(dirty_end_ <= capacity_);
|
||||
}
|
||||
|
||||
void CircularBuffer::Flush() {
|
||||
|
|
|
@ -38,6 +38,7 @@ class CircularBuffer {
|
|||
|
||||
bool CanAcquire(size_t length);
|
||||
Allocation Acquire(size_t length);
|
||||
void Discard(Allocation allocation);
|
||||
void Commit(Allocation allocation);
|
||||
void Flush();
|
||||
|
||||
|
|
|
@ -163,7 +163,6 @@ void CommandProcessor::WorkerMain() {
|
|||
}
|
||||
|
||||
bool CommandProcessor::SetupGL() {
|
||||
glViewport(0, 0, 1280, 720);
|
||||
|
||||
// Circular buffer holding scratch vertex/index data.
|
||||
if (!scratch_buffer_.Initialize()) {
|
||||
|
@ -1580,6 +1579,8 @@ CommandProcessor::UpdateStatus CommandProcessor::UpdateRenderTargets(
|
|||
// TODO(benvanik): can we do this all named?
|
||||
// TODO(benvanik): do we want this on READ too?
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, cached_framebuffer->framebuffer);
|
||||
|
||||
glViewport(0, 0, 1280, 720);
|
||||
}
|
||||
|
||||
return UpdateStatus::kMismatch;
|
||||
|
|
|
@ -936,7 +936,8 @@ bool GL4ShaderTranslator::TranslateALU_RECIP_IEEE(const instr_alu_t& alu) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_RECIPSQ_IEEE(const ucode::instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_RECIPSQ_IEEE(
|
||||
const ucode::instr_alu_t& alu) {
|
||||
AppendDestReg(alu.scalar_dest, alu.scalar_write_mask, alu.export_data);
|
||||
Append(" = ");
|
||||
if (alu.scalar_clamp) {
|
||||
|
@ -1298,8 +1299,7 @@ bool GL4ShaderTranslator::TranslateALU(const instr_alu_t* alu, int sync) {
|
|||
} else {
|
||||
Append("\t \tOP(%u)\t", alu->scalar_opc);
|
||||
}
|
||||
PrintDstReg(alu->scalar_dest, alu->scalar_write_mask,
|
||||
alu->export_data);
|
||||
PrintDstReg(alu->scalar_dest, alu->scalar_write_mask, alu->export_data);
|
||||
Append(" = ");
|
||||
if (is.num_srcs == 2) {
|
||||
// ADD_CONST_0 dest, [const], [reg]
|
||||
|
|
|
@ -215,6 +215,7 @@ void Shader::GatherVertexFetch(const instr_fetch_vtx_t* vtx) {
|
|||
desc.stride_words = vtx->stride;
|
||||
el = &desc.elements[desc.element_count++];
|
||||
}
|
||||
++inputs.total_elements_count;
|
||||
|
||||
el->vtx_fetch = *vtx;
|
||||
el->format = static_cast<VertexFormat>(vtx->format);
|
||||
|
|
|
@ -51,6 +51,7 @@ class Shader {
|
|||
};
|
||||
struct BufferInputs {
|
||||
uint32_t count;
|
||||
uint32_t total_elements_count;
|
||||
BufferDesc descs[32];
|
||||
};
|
||||
const BufferInputs& buffer_inputs() { return buffer_inputs_; }
|
||||
|
|
Loading…
Reference in New Issue